Use the right model. Test before code. Read the domain. Orchestrate when it saves time.
npx draht-claude install Add routing, TDD, orchestration, and audit logs to Claude Code.
bun add -g @draht/coding-agent Run the full agent across 17 providers. Claude is not required.
The router scores each task by reasoning, context, and latency. It sends simple work to cheap models. It saves Opus for hard architecture. You stop paying Opus rates for boilerplate.
The agent writes a failing test before code. It reads bounded contexts, aggregates, and your team names. It edits in that language. Red tests block commits.
The orchestrator runs independent work in parallel. CI blocks broken merges. The log records every model call, cost, and source. Use it for GDPR audits or invoice review.
Policies are TypeScript. Match file glob, task type, context size, or budget. Route to Haiku, Sonnet, Opus, GPT, Gemini, or your own model. Override per repo, branch, or session.
Every run writes a tree to one JSONL file. Jump back. Fork a branch. Swap the routing profile. Return later. Token costs stay on disk.
Seven specialists handle architecture, code, review, debug, verify, security, and git. You set the model for each one. Split work runs in parallel. Ordered work stays ordered. Commits use red:/green:/refactor: discipline.
Use the REPL, print mode, JSON events, or RPC over stdin/stdout. Run draht in CI, a cron job, or a Slack bot. Embed the SDK in your app.
No model fits every task. The router scores the work and picks the cheapest model that can do it. You pay for Opus when the job needs Opus.
The failing test is the spec. The agent must create a test, watch it fail, and make it pass before it commits code. If you skip TDD, skip draht.
Bounded contexts, aggregates, and your team's words guide edits. The agent reads that model first. Guessing costs money.
Run independent work in parallel sub-agents. The orchestrator merges the output. One long task becomes three short tasks.
Log every model call, cost, and billable step. The receipt sits on disk for clients, auditors, tax, or your own memory.
Policies are files. State lives on disk. The harness is TypeScript. You can read it in an afternoon. If something surprises you, open the file.