Lacuna finds your uncovered code, writes real tests with AI, runs them, and retries until they pass — from the terminal or right inside VS Code. Powered by DeepSeek by default — cheap enough to run on every PR.
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.
DeepSeek is the default — it's fast, affordable, and has no rate-limit headaches. Switch to any other provider with a single flag: lacuna generate -m claude
New
The same agent, embedded in VS Code (and Cursor, Windsurf, VSCodium). Right-click a file to generate or fix tests, watch a live progress panel, and review every change in a diff before it's kept — without ever leaving your editor.
Right-click any source file → Generate Tests, or a failing test → Fix Tests. Run a whole folder at once, with parallel workers processing files concurrently.
A legible progress panel streams every phase — generating, running, retrying — plus request count and the learned rules in play. Hit Stop and the in-flight run aborts instantly.
Every generated or fixed file opens in a diff you accept or reject. Shared mock files are always reviewed separately — a run never silently rewrites what the whole suite depends on.
A sidebar tree lists every file below threshold or with no test — one click to generate. Uncovered lines are painted in the gutter of the file you're already looking at.
Lacuna's confidence-weighted memory of framework quirks and mock patterns is browsable in its own view — sort by confidence, and flag a rule that stops helping.
Your API key is stored in the OS keychain (VS Code SecretStorage), never written to .lacuna.json. Every run is confirmed and metered up front.
Same .lacuna.json, same models — a UI instead of a terminal.
Get it on the VS Code Marketplace or Open VSX (Cursor, Windsurf, VSCodium) — or just search “Lacuna” in the Extensions view.
Run Lacuna: Set Up to create .lacuna.json, then Lacuna: Set API Key — stored securely in your OS keychain.
Pick a source file or a whole folder. Watch the live panel, then accept the diff. Below-threshold files show up in the Coverage Gaps sidebar too.