Lacuna finds your uncovered code, writes real tests with AI, runs them, and retries until they pass — all from one command.
Lacuna isn't a code assistant that suggests tests. It's an autonomous agent that writes, runs, and verifies them — and recovers when something goes wrong.
Lacuna sends your source file, existing tests, type definitions, and project dependencies to the model — giving it everything needed to write real, meaningful tests.
Every generated test is immediately run against your actual test suite. If it fails, lacuna records what went wrong and retries with negative constraints so it doesn't repeat the same mistake.
Run lacuna fix to repair existing failing tests without rewriting them. The model surgically fixes what's broken and leaves everything else untouched.
Process multiple files simultaneously with -w 4. Each worker runs independently with a live status display showing what every worker is doing in real time.
If all retries fail or the model gets stuck, your original test file is automatically restored. Oscillation detection stops the loop early when the model is spinning in circles.
Works with Claude, GPT-4o, Gemini, DeepSeek, Groq, OpenRouter, Ollama, and LM Studio — or any OpenAI-compatible API. Switch models with a single flag.
Three steps. No configuration required to get started.
Lacuna runs your test suite, reads the coverage report, and finds every file and function below your threshold — without touching any files.
For each gap, lacuna builds a full context — source code, type definitions, existing tests, imports, and mocks — then asks the model to write tests that actually exercise the behavior.
Generated tests are run immediately. Failures are diagnosed, constraints are recorded, and the model retries with specific instructions not to repeat what failed.
Lacuna works with any AI provider. Bring your own API key, or run fully local with Ollama or LM Studio — no data leaves your machine.