Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
Open-source TypeScript terminal coding agent for DeepSeek-V4 — builds on DeepSeek's strong price-performance and ultra-cheap cache pricing, engineering byte-stable prefixes and cache-reusing forks so cross-session memory and a continuous self-correction layer add almost no token cost; 1M context, Skills/MCP/Hooks, Claude Code config compatible.
Jump to setup instructionsFetched from the repository for this visit.
English · 中文
A terminal coding agent built around cost, experience, and availability — squeezing the most capability and the lowest cost out of the high-value DeepSeek V4.

Dao Code (command dao) is a terminal-native AI coding assistant: it reads code, writes code, runs commands, and fixes bugs right in your terminal — streaming its reasoning and tool calls while executing safely behind an approval gate, until the task is done. It targets DeepSeek V4 (1M context), is Chinese-first, and is inspired by Claude Code — but takes a different road: rather than buying experience with an expensive model, it builds on DeepSeek's strong price-performance and ultra-cheap cache pricing, engineering byte-stable prefixes so cross-session memory adds almost no token cost.
A coding agent is only useful if you can actually run it.
Low unit price — DeepSeek sits at the lowest price tier among mainstream capable models; both input and output prices are far below the top-tier closed models.
Cache cuts it further — DeepSeek's prefix-cache hit price is ≈ 1/120 of a miss (~two orders of magnitude). Dao Code keeps the system prefix / tool table / memory index byte-stable within a session, so the hit rate keeps climbing.
Measured on real OSS bug-fixes (not toy demos) — 7 SWE-bench-style tasks (valibot / date-fns / es-toolkit / sqlglot / hono), 3.89M input tokens total, 95.8% aggregate cache hit (85.4%–97.7% per task). At DeepSeek V4 Pro current pricing, a full feature (read + edit + test + self-review) runs ¥0.07–0.21, avg ¥0.15; all 7 total ¥1.07. Every figure traces back to evals/runs/<task>/run-1/agent.log; replay any time with /cost.
Cost vs Claude Code — pricing the same token trace of these 7 tasks under each vendor's official rates (and crediting Dao Code's high hit rate to Claude too, in its favor), total cost is still ~30× cheaper than Claude Opus 4.8, ~18× cheaper than Sonnet 4.6.
| Task (real OSS repo) | Input tok | Hit % | DeepSeek Pro | vs Opus | vs Sonnet |
|---|---|---|---|---|---|
| t7-sqlglot-sqlite-autoinc | 1,218,385 | 97.7% | ¥0.213 | 37× | 22× |
| t6-sqlglot-comment-on | 625,772 | 96.3% | ¥0.144 | 32× | 19× |
| t9-hono-compress | 699,479 | 96.0% | ¥0.209 | 31× | 18× |
| t8-hono-cookie-dup | 502,866 | 94.9% | ¥0.136 | 28× | 17× |
| t4-estoolkit-omitby | 445,475 | 94.4% | ¥0.159 | 28× | 17× |
| L1-nodeps-toolkit | 289,989 | 93.2% | ¥0.140 | 27× | 16× |
| t5-estoolkit-uniqwith | 104,071 | 85.4% | ¥0.068 | 21× | 12× |
| Total | 3,886,037 | 95.8% | ¥1.07 | 30× | 18× |
Prices as of 2026-06 official rates: DeepSeek V4 Pro hit/miss/output = $0.003625 / $0.435 / $0.87 per 1M; Claude Opus 4.8 = $5 / $25 (hits at 0.1× cache-read), Sonnet 4.6 = $3 / $15. Multiples are USD-on-USD, exchange-rate-independent; ¥ converted at ¥7.1/$. Cross-check: re-pricing L1 at current rates gives ¥0.140 ≈ the ¥0.136 the in-log /cost reported.
Verify the cache mechanism live — npm run accept:cache runs a multi-turn conversation against the live API so you can watch the hit rate climb from cold start to steady state (mechanism demo; cost figures above come from the real eval suite).
deepseek-v4-pro at the benchmark's official 1× timeout. The interesting part isn't the score — it's that the iteration to get there was evaluation-driven engineering: reading real failure traces surfaced and fixed actual framework bugs, not prompt tuning. See below.See Testing & evaluation.
A byte-stable system prefix rides DeepSeek's prefix cache to the max; near the limit it auto-compacts (reactive retry + in-place clearing of stale tool results + incremental summary + hard-truncate fallback if the summarizer fails); oversized output spills to disk, leaving only a pointer in context. /cost shows hit rate & spend.
When you correct it, state a preference, or explain context the code doesn't show, it writes a one-fact Markdown file to ~/.dao/projects/<repo>/memory/ and adds a line to MEMORY.md. The index is loaded at the start of each session; details are read on demand. Say "forget …" and it deletes the file. /memory shows the directory and index.
Session log + crash recovery (dao -c); /rewind rewinds the conversation; todo list survives compaction to prevent goal drift; background subagents (always async; results arrive as a new message, inspect/stop via JobOutput/JobStop); --goal autonomous long-task mode.
Rich Ink rendering + a Taiji splash + light/dark adaptation; @ file references, slash-command Tab completion, steering (type while a turn is running, queued), diffs with line numbers + syntax highlighting, thinking blocks, todo checklists, a Taoist-verb spinner; ESC interrupts (model stream and shell stop together); non-TTY auto-fallback to a plain-text REPL.
Basics (mirror CC, all shipped): 24 tools · boundary-based permissions (workspace allowed + catastrophic-command hardline) + defense-in-depth (secret scanning / SSRF / sandbox / keychain) · Skills (Claude Code skill format compatible) · MCP (stdio + HTTP/SSE, tools/resources/prompts) · Hooks (5 lifecycle events) · custom subagents / slash commands / plugins · multi-account profiles (
/account) · OS cron scheduling (/schedule). See Extension system and the tool overview below.
A. One-line install (no Node):
curl -fsSL https://raw.githubusercontent.com/tigicion/dao-code/master/install.sh | sh
Or download manually from Releases: macOS dao-darwin-arm64 (Apple silicon) / dao-darwin-x64 (Intel), Linux dao-linux-arm64/dao-linux-x64, Windows dao-windows-x64.exe. On Unix chmod +x then run; on Windows just double-click the .exe.
B. npm (Node ≥ 20, all platforms):
npx dao-code # zero-install trial
npm i -g dao-code # global install, command name dao
C. From source:
git clone https://github.com/tigicion/dao-code.git && cd dao-code
npm install && npm run build && npm link # then dao is global
# or run directly in dev: npm run dev
Get a DeepSeek API key: https://platform.deepseek.com/api_keys
Launch → follow the prompt to enter your key:
dao # installed (binary / global); or npx dao-code
Choose your provider and paste your API key. Dao names the account and looks up models. It stores the key in the system keychain when available and otherwise in your user configuration. For a custom gateway, enter its API URL and confirm a model. Use /account to add or switch accounts later.
Or use headless one-shot with a key:
dao --api-key sk-xxx --provider deepseek "tell me a joke"
Light terminals: type /theme at runtime, or set DAO_THEME=light before launch.
Common slash commands (full list via /help):
| Command | Effect |
|---|---|
/init | Scan the repo and generate DAO.md (project overview/conventions, auto-loaded in future sessions) |
/model [id] | Refresh the current account’s model list. For plans without a listing API, Dao tries a public plan catalog. Offline, it shows local choices. You can also enter a provider model ID. |
/mode [x] | Permission mode default / yolo (also Shift+Tab to toggle) |
/plan | Quick toggle plan (read-only + propose) / normal |
/goal <objective> | Autonomous long-task mode (auto-approve + keep going; large tasks auto-staged) |
/cost | Token usage & cache hit rate |
/skills | List / toggle skills |
/compact | Compact the conversation · /clear clear · /help command list · /exit (also /quit) quit |
Add
--yoloat launch (e.g.dao --yolo/dao --yolo "task") to start in auto-approve; toggle anytime with/yolo.dao --verbose(or--debug) enters verbose mode at startup: full tool results, full thinking, and raw tool arguments. Plaindaotruncates by default; at runtime press Ctrl+O to expand/collapse full output (mirrors CC). History already printed to the scroll region can't be edited in place, so expanding re-prints the most recent collapsed block once.
Interactive mode (default):
dao
↑/↓ browse history; Esc interrupts the current turn; lines starting with / are slash commands (with completion hints).←/→ move cursor, Ctrl-A/E line start/end, Ctrl-W delete word, Backspace/Delete delete at cursor; paste supported (no auto-submit).@ to reference a file: type @ + a path fragment to list matches, Tab to complete.[y] once [s] session [a] always [n] deny, see "Extension system · Permissions"); /yolo or --yolo auto-approves everything (catastrophic commands still ask).Press Ctrl+T during execution to inspect subagent status, elapsed time, tool-call count and recent output. The panel reads local records every second without model requests. Use ↑/↓ to select a task, PgUp/PgDn for history, and Esc or Ctrl+T to close without interrupting tasks. Completed and failed tasks remain visible. Use DAO_SUBAGENT_MAX_TURNS=800 dao for a larger budget; an agent definition’s maxTurns takes precedence.
One-shot mode (task as an argument, exits when done, good for scripts):
dao "make formatDate in src/utils.ts timezone-aware"
You ──▶ Ink TUI ──▶ agent loop ──▶ DeepSeek V4
│ streamChat (streaming reasoning + answer)
│ ▶ model requests a tool call
│ ▶ approval gate (write/exec needs clearance)
│ ▶ run tool → feed result back
└─ loop until the model stops requesting tools
src/agent/loop.ts): each turn calls streamChat to stream reasoning + answer; if the model requests a tool, it runs through the approval gate, feeds the result back, and loops until done or max turns; AbortSignal is threaded through the model stream and tools for ESC interrupts.src/memory/memory_dir.ts): locates ~/.dao/projects/<git-root slug>/memory/ and reads MEMORY.md once when the system prompt is built; the model writes and deletes memory files with the ordinary file tools (edits and single-file rm inside that directory need no approval).Built for long tasks that "run autonomously for a long time without drifting and are recoverable":
.dao/sessions/<id>/events.jsonl and a state snapshot to state.json; after a crash/abnormal exit, dao -c resumes the last session (src/session/log.ts).todo_write is re-injected as a system message after compaction, preventing goal drift on long tasks..dao/spill/; the context keeps only a truncation + pointer, fetched back on demand via read_file.Agent always runs the subagent in the background (call it several times in one message to parallelize; at most 10 run at once, the rest queue). The main agent finishes what doesn't depend on the result and ends its turn; when a subagent or background shell finishes, the result is injected as a new message and a new turn starts automatically — interactive and headless alike (src/agent/session_scheduler.ts).dao --goal (legacy --task / --coordinator still accepted) or /goal <objective> at runtime — auto-approve + autonomous continuous progress + higher turn cap; large tasks auto-stage (parallel research → synthesize → implement → verify), asking you only when truly stuck.rm -r of root/home/system dirs, mkfs, dd/redirect to raw disks, fork bomb, curl|sh, shutdown/reboot, git push --force. Only command positions count — quoted strings and heredoc bodies are data (a commit message mentioning rm -rf ~ is not blocked).~/.ssh, ~/.aws, .env, *.pem…), and first use of an MCP tool./yolo, /mode yolo, Shift+Tab, --yolo): only the hardline list still asks. plan is not a permission mode but a read-only session state (write/exec tools are removed).[y] once / [s] this session / [a] always / [n] deny. "Always" remembers the category, not the literal call: an outside write adds its directory (git repo root) to additionalDirectories; a credential file is remembered by path; an MCP tool by name. Inspect/remove via /permissions.permissions.allow (rules, Tool(specifier) syntax), permissions.additionalDirectories, permissions.defaultMode (default/bypassPermissions); layered ~/.dao/settings.json < .dao/settings.json < .dao/settings.local.json < CLI (--allow/--add-dir/--permission-mode) < enterprise policy. Legacy deny/ask/autoMode keys are ignored; use a PreToolUse hook for custom blocking.src/permissions/ (hardline / engine / gate / rules / settings)..dao/agents/<name>.md (frontmatter: name/description/tools allowlist/model + body prompt). Pick with the agent tool's agent_type; each has its own role and tools..dao/commands/<name>.md (body is a prompt template, $ARGUMENTS/$1). /<name> args expands into a single turn..dao/skills/<name>/SKILL.md. Progressive disclosure: startup lists only name+description; the model loads the body on demand via the skill tool..dao/hooks.json. PreToolUse (can block) / PostToolUse (e.g. auto-format) / UserPromptSubmit (inject context / block) / SessionStart / End..dao/mcp.json. Connects to stdio MCP servers; tools auto-register as mcp__<server>__<tool>.general-purpose (all tools) and explore (read-only); custom types via .dao/agents/*.md. Subagents cannot nest, ask the user, or manage background jobs; a subagent interrupted by a restart settles as failed.Compatible with Claude Code:
settings.json,SKILL.md,hooks.json, andmcp.jsonuse the same formats as CC (tool names auto-map, e.g.Bash↔exec_shell), so existing CC configs/skills work as-is.
Registry in src/index.ts, implementations in src/tools/.
| Tool | Effect |
|---|---|
read_file | Read a text file, returns numbered content (supports offset/limit) |
list_dir | List directory entries |
write_file | Create or wholesale-rewrite a file (must have read it before overwriting) |
edit_file / multi_edit | Exact string replacement (single / many at once) |
notebook_edit | Edit Jupyter notebook cells |
exec_shell | Run shell; foreground/background (background=true) |
grep_files / file_search | Search by content regex / by filename glob |
ask_user | Ask the user one clarifying question and wait |
fetch_url / web_search | Fetch web page as text / DuckDuckGo web search |
todo_write | Maintain a single-level task list (whole-table replace) |
skill / skill_install | Load a skill body / install an external skill |
Agent / JobOutput / JobStop | Dispatch a background subagent / inspect background jobs (subagents, shells, monitors) / stop one |
schedule | Create an OS crontab scheduled task |
Unit tests (Vitest):
npm test # run once
npm run test:watch
npm run typecheck
npm auditwarnings all come from the dev test toolchain (vitest / vite / esbuild), are not shipped in the release artifact (dist), and don't affect thedaoruntime; the critical one is avitest --uiserver vulnerability (unused by this project). CI:.github/workflows/ci.yml.
Agent end-to-end evaluation lives in evals/: SWE-bench-style, drawn from recent real open-source bug fixes, with dual-track fail2pass / pass2pass verification (after the fix the target test flips from fail to pass, and existing functional tests aren't broken); test files are hidden from the agent and injected only after the run, to prevent reward-hacking.
# evals use --api-key and --provider; set them in evals/run.mjs or pass via env
node evals/run.mjs # default 3 runs per task, see pass^k reliability
EVAL_RUNS=1 node evals/run.mjs # smoke test
Evaluation makes real model calls and incurs cost; each task runs in a throwaway temp dir — set
DAO_AUTO_APPROVE=1for unattended runs. Seeevals/README.md.
Terminal-Bench is a third-party benchmark of real terminal/coding tasks judged by hidden verifiers inside sandboxed containers, run here via Harbor. 89 tasks (4 easy / 55 medium / 30 hard) span system administration, security, data science, scientific computing, debugging, ML, and more. Dao Code passes 70/89 (78.7%) with deepseek-v4-pro, at the benchmark's official timeout (1×, never inflated to make a task easier).
The score is downstream of a closed loop, not "read the log, patch the code": diagnose → design → re-verify.
Case in point — the TodoWrite gate. Headless sessions kept reasoning for the full 15-minute budget without ever calling a tool. Diagnose: the system prompt already told the model, in the literal text it received (confirmed byte-for-byte in the transcript), to plan before acting — so the problem wasn't a missing instruction, it was that a soft text instruction carries no real weight with the model. Design: escalate from suggestion to enforcement — a runtime gate that hard-rejects a headless session's first tool-call batch unless it includes TodoWrite. Re-verify: a real re-run confirmed the gate does what it's supposed to (the model's first move is now TodoWrite) — but re-verification didn't stop there. On one task the gate fired correctly and reward was still 0, because the real blocker had moved to an unrelated memory-corruption bug in the model's own C code. Stopping at "the mechanism fired" would have logged a false win; the loop only closes once the reward and the causal chain agree.
The same diagnose-design-re-verify discipline caught things a prompt tweak alone never would: a background snapshot loop so a forced timeout no longer destroys its own diagnostic evidence; a native-build fix for a qemu-family task that was actually being killed by the host (a Rosetta 2 gap), not the model; and an explicit switch to disable web access in eval mode after it let a model fetch a leaked reference solution instead of solving the task.
The remaining failures are triaged into named root-cause categories (real engineering scope beyond the time budget, implementation bugs in an otherwise-correct approach, domain-insight gaps, spec/grader mismatches) rather than left as an unexplained score, and every environment modification that could affect comparability (e.g. a shortened password dictionary for one crypto task) is disclosed rather than folded silently into the pass rate. Full per-task results, the failure-mode journal, and the harness itself: evals/terminal-bench/.
| Variable | Description | Default |
|---|---|---|
| — | API key: run dao interactively to set via onboarding, or /account to manage | — |
DEEPSEEK_MODEL | Default model (deprecated) | deepseek-v4-pro |
DAO_THEME | Force terminal background light / dark | detected from COLORFGBG / OSC 11, else dark |
DAO_REASONING_EFFORT | Reasoning effort | max |
DAO_MAX_TURNS | Max model iterations per main-session turn | Unlimited |
DAO_SUBAGENT_MAX_TURNS | Max subagent model iterations (positive integer; call override > environment) | 500 |
DAO_EXPLORE_MODEL | Explore model; use an exact gateway-supported ID, or inherit the current main model | inherit |
DAO_AUTO_APPROVE | Skip all approvals (sandbox/eval only) | off |
Released v0.3.0 (npm dao-code + multi-platform binaries on Releases). Core is complete: Ink TUI and Taiji splash, streaming agent loop, 24 tools, layered permissions, persistent memory, cache engineering, long-task robustness, Skills/MCP/Hooks/subagent extensions, and a real OSS evaluation harness. Actively iterating — issues/PRs welcome.
Open-source projects built entirely with Dao Code:
dao --goal long-task mode.Issues and PRs welcome! Onboarding, scripts, and commit conventions are in CONTRIBUTING.md; the community guidelines are in CODE_OF_CONDUCT.md. Do not file security vulnerabilities via public issues — report them privately per SECURITY.md. Changelog: CHANGELOG.md.
MIT © tigicion
GitHub checked 39h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.