draht logo draht   /dʁaːt/
· built in Dortmund · MIT N° 001 / MONOREPO · 14 PACKAGES HANDGEFERTIGT — OSKAR FREYE, MMXXVI
Dynamic routing for coding agents — handgefertigt in Dortmund

draht.

Use the right model. Test before code. Read the domain. Orchestrate when it saves time.

Draht is German for wire. It routes each coding-agent task to a suitable model, writes the failing test first, reads the codebase's domain map, and keeps a local record of model calls and cost.
License
MIT
Packages
14
Providers
42
Install telemetry
none
A.
Claude Code plugin
You have Claude Max or Pro. Keep it.
$ npx draht-claude install

Add GSD workflow, sub-agents, and TDD discipline to Claude Code. Also ships as a Codex plugin (npx draht-codex install).

B.
Standalone CLI
Use API keys, OAuth, or your own models.
$ bun add -g @draht/coding-agent

Run the full agent across 42 providers. Claude is not required.

§ 01
Wie es funktioniert — how it works
Three wires. One circuit.
I. Route

Use the right model.

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.

II. Test

Test first. Use the domain.

The agent writes a failing test before code. It reads bounded contexts, aggregates, and the terms your team uses. It edits in that language. Red tests block commits.

III. Ship

Run, watch, rewind.

Sub-agents run independent work in parallel; dependent work stays ordered. Checkpoints snapshot the repo before risky edits, and /rewind steps back when a turn goes wrong. The session log keeps every model call and its cost on disk.

§ 02
Die Werkbank — the workbench
42 providers · 1 router · no lock-in
~/projects/atelier · draht
F/01

Routing you can read.

A JSON config maps roles — architect, implement, boilerplate, quick, review, docs — to a primary model with ordered fallbacks. Direct API calls, no OpenRouter in the hot path. Override per project or globally.

F/02

Sessions that branch.

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.

F/03

Sub-agents that finish.

Ten built-in specialists cover advice, architecture, implementation, investigation, review, spec review, security, verification, debugging, and git commits. You set the model for each one. Commits use red:/green:/refactor: discipline.

F/04

Four ways to run.

Interactive, print mode (text or JSON), RPC over stdin/stdout, or the SDK. The Slack bot (@draht/mom) runs on the SDK path; embed it the same way in your own app.

F/05

Scripts, not tool calls.

Codemode writes a script against the active tools instead of calling them one at a time, in a QuickJS sandbox. Nested calls and their results stay out of the model's context — only the script's own output comes back.

F/06

MCP, built in.

draht mcp add/list/login configures Model Context Protocol servers in .draht/mcp.json, OAuth included. No extension required, and MCP tools run through codemode by default.

§ 03
Das Sortiment — fourteen packages, one mono-repo
MIT licensed · monorepo workspace
№ 01
@draht/coding-agent the agent
The draht CLI. Read/bash/edit/write tools, session management, sub-agents, checkpoints, and the GSD workflow (/new-project, /plan-phase, /execute-phase).
CORE
№ 02
@draht/agent-core the harness
General-purpose agent with transport abstraction, state management, and attachment support. What draht is built on.
CORE
№ 03
@draht/ai the primitives
Unified LLM API across 42 providers, with automatic model discovery and provider configuration.
LIBRARY
№ 04
@draht/router the dispatcher
Role-based model routing with direct API calls, ordered fallback chains, and cost tracking. No OpenRouter in the hot path.
LIBRARY
№ 05
@draht/chord the composer
Application composition runtime for services, replicated state, RPC, and plugins. Backs the agent harness.
LIBRARY
№ 06
@draht/codemode the sandbox
Sandboxed JavaScript execution where the only capability is calling injected tools. Powers the agent's codemode tool.
LIBRARY
№ 07
@draht/mcp the client
Standalone Model Context Protocol client for draht and other applications.
LIBRARY
№ 08
@draht/tui the loom
Terminal UI library with differential rendering. Renders the interactive CLI.
LIBRARY
№ 09
draht-claude the claude bridge
GSD, multi-agent, TDD, and DDD workflows as a Claude Code plugin. npx draht-claude install.
PLUGIN
№ 10
draht-codex the codex bridge
The same workflows as a Codex plugin. npx draht-codex install.
PLUGIN
№ 11
@draht/tools the gsd cli
The Get Shit Done CLI shared by draht-claude and @draht/coding-agent — codebase knowledge graph, skills, and workflow commands.
CLI
№ 12
@draht/knowledge the memory
Per-client vector database for knowledge persistence across projects.
PRODUCT
№ 13
@draht/mom the slack bridge
Slack bot that delegates messages to the Draht coding agent.
PRODUCT
№ 14
@draht/pods the foundry
Manages vLLM deployments on GPU pods. Start, rotate, and retire self-hosted models from the command line.
PRODUCT
§ 04
Philosophie — six principles, non-negotiable
How draht decides for you.
i.
— Cheapest model that works —
Route, don't default.

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.

ii.
— Red before green —
Test first, always.

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.

iii.
— Language of the domain —
DDD is not optional.

Bounded contexts, aggregates, and your team's words guide edits. The agent reads that model first. Guessing costs money.

iv.
— Parallel by default —
Split work. Don't queue it.

Run independent work in parallel sub-agents. Keep dependent work ordered. The orchestrator merges the results.

v.
— Cost receipts, not audits —
Log what you spend.

Every model call and its cost lands in the session's local JSONL file — your own record, not a compliance artifact. No install telemetry phones home.

vi.
— Boring ships —
No hidden magic.

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.

Zwei Türen — same build, two ways in
© MMXXVI Oskar Freye · MIT licensed · set in Instrument Serif & Geist Mono · Dortmund · Gemeinnützig im Geist