Reduces API costs by more than 50%, produces better and faster work. Uses line-anchored parallel edits, AST manipulation and a whole lot of neat optimizations. Fully Open Source.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
It is a well studied phenomenon that any given model's reasoning ability degrades with the context length. If we can keep context tightly curated, we improve both accuracy and cost while making larger changes tractable in a single task.
Dirac is an open-source coding agent built with this in mind. It reduces API costs by 64.8% on average while producing better and faster work. Using line-anchored parallel edits, AST manipulation, and a suite of advanced optimizations. Oh, and no MCP.
Our goal: Optimize for bang-for-the-buck on tooling with bare minimum prompting instead of going blindly minimalistic.
📊 Evals
Dirac is benchmarked against other leading open-source agents on complex, real-world refactoring tasks. Dirac consistently achieves 100% accuracy at a fraction of the cost. These evals are run on public github repos and should be reproducible by anyone.
🏆 TerminalBench 2.0 Leaderboard: Dirac recently topped the Terminal-Bench-2 leaderboard with a 65.2% score using gemini-3-flash-preview. This outperforms both Google's official baseline (47.6%) and the top closed-source agent Junie CLI (64.3%). This was achieved without any benchmark-specific info or any AGENTS.md files being inserted.
Note on the cost table below: A bug was discovered in Cline, the parent repo, after running these evals ([issue #10314](https://github.com/cline/cline/issues/10314)). We have submitted a [PR #10315](https://github.com/cline/cline/pull/10315) to fix this. This bug caused the evals for Dirac and Cline to slightly underreport the numbers ($0.03 vs $0.05 per million token cache read). Although there won't be a large difference, we will update the evals soon.
All tasks for all models used gemini-3-flash-preview with thinking set to high
Cost Comparison: Dirac is 64.8% cheaper than the competition (a 2.8x cost reduction).
* Expected number of files to be modified/created to complete the task.
See evals/README.md for detailed task descriptions and methodology.
🚀 Key Features
Line-Anchored Edits: Dirac uses opaque, stateful line IDs paired with exact source content to target edits precisely without relying on line numbers.
AST-Native Precision: Built-in understanding of language syntax (TypeScript, Python, C++, etc.) allows Dirac to perform structural manipulations like function extraction or class refactoring with 100% accuracy.
Multi-File Batching: Dirac can process and edit multiple files in a single LLM roundtrip, significantly reducing latency and API costs.
High-Bandwidth Context: Optimized context curation keeps the agent lean and fast, ensuring the LLM always has the most relevant information without wasting tokens.
Autonomous Tool Use: Dirac can read/write files, execute terminal commands, use a headless browser, and more - all while keeping you in control with an approval-based workflow.
Skills & AGENTS.md: Customize Dirac's behavior with project-specific instructions using AGENTS.md files. It also seamlessly picks up Claude's skills by automatically reading from .ai, .claude, and .agents directories.
Native Tool Calling Only: To ensure maximum reliability and performance, Dirac exclusively supports models with native tool calling enabled. (Note: MCP is not supported).
Note: Node.js v25 is currently not supported due to an upstream V8 Turboshaft compiler bug that causes out-of-memory crashes during WASM initialization. Please use Node.js v20, v22, or v24 (LTS versions).
🚀 CLI Quick Start
Authenticate:
dirac auth
Run your first task:
dirac "Analyze the architecture of this project"
Configuration (Environment Variables)
You can provide API keys via environment variables to skip the dirac auth step. This is ideal for CI/CD or non-persistent environments.
... and others (see src/shared/storage/env-config.ts for the full list).
Using Any OpenAI compatible endpoint
You can use any OpenAI-compatible provider (e.g., DeepSeek, DeepInfra, OpenRouter, or your own local proxy) by providing the base URL and model ID.
Environment Variables:
OPENAI_API_BASE: Your API base URL (e.g., https://api.deepseek.com/v1).
OPENAI_API_KEY (or OPENAI_COMPATIBLE_CUSTOM_KEY): Your API key.
CUSTOM_HEADERS: Optional custom headers (e.g., "Authorization=Bearer token,X-Account-Id=123" or JSON format).
CLI Example:
# Using environment variables
export OPENAI_API_BASE="https://api.yourprovider.com/v1"
export OPENAI_API_KEY="your-api-key"
export CUSTOM_HEADERS="Authorization=Bearer XXX"
dirac "explain Dirac Delta function" \
# --provider is now optional if OPENAI_API_BASE is set
--model "your-model-id"
dirac -p "prompt": Run in Plan Mode to see the strategy before executing.
dirac -y "prompt": Yolo Mode (auto-approve all actions, great for simple fixes).
git diff | dirac "Review these changes": Pipe context directly into Dirac.
dirac history: View and resume previous tasks.
dirac --acp: Run Dirac as an ACP agent for editor integration.
🔌 ACP Editor Integration
Dirac can run as an external coding agent in editors that support the Agent Client Protocol (ACP), including JetBrains IDEs and Zed. Installing from the ACP Registry is recommended so the editor can manage the agent package and updates.
JetBrains IDEs 2025.3 and later: open Settings → Tools → AI Assistant → Agents, or select Install From ACP Registry… in the agent picker, then install Dirac.
Zed: open Agent Settings → External Agents, select Add Agent → Install from Registry, then install Dirac.
Dirac owns its provider configuration independently of the editor. On first use, choose Configure a Dirac provider to enter a provider, model, and API key. ChatGPT sign-in is optional; you can instead use DeepSeek or another supported provider with your own credentials.
For environment-variable setup, manual dirac --acp configuration, and troubleshooting, see the CLI ACP guide.
🛠️ Getting Started
Open the Dirac sidebar in VS Code.
Configure your preferred AI provider (Anthropic, OpenAI, OpenRouter, etc.).
Start a new task by describing what you want to build or fix.
Watch Dirac go!
🛠️ Development
Setup
npm run install:all
Protobufs (required before build)
npm run protos
Build
npm run compile
Lint
npm run lint
Running Tests
Unit tests require the TS_NODE_PROJECT environment variable set to ./tsconfig.unit-test.json. This is because VS Code's test runner requires CommonJS modules while the main project uses ESM.
# Run all tests (unit + integration)
npm test
# Run only unit tests
npm run test:unit
The test:unit script already sets TS_NODE_PROJECT=./tsconfig.unit-test.json automatically. If you need to run mocha directly, set it manually: