by tigicion
Terminal coding agent for DeepSeek V4 — cost-efficient, self-verifying memory, robust long tasks. MIT
# Add to your Claude Code skills
git clone https://github.com/tigicion/dao-codedao-code is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by tigicion. Terminal coding agent for DeepSeek V4 — cost-efficient, self-verifying memory, robust long tasks. MIT. It has 61 GitHub stars.
dao-code's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/tigicion/dao-code" and add it to your Claude Code skills directory (see the Installation section above).
dao-code is primarily written in TypeScript. It is open-source under tigicion on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh dao-code against similar tools.
No comments yet. Be the first to share your thoughts!
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
中文 · English → README.en.md
以成本、体验、可用性为核心的终端编码 agent —— 在高性价比的 DeepSeek V4 上,极致压榨模型的潜能与成本优势。
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(命令 dao)是终端原生的 AI 编码助手:在你的终端里读代码、写代码、跑命令、修 bug,边流式展示推理与工具调用,边在审批门下安全执行,直到任务做完。它面向 DeepSeek V4(1M 上下文),中文优先,灵感来自 Claude Code,但走的是另一条路——不靠贵模型堆体验,靠工程把高性价比模型的体验提升上来。
编码 agent 的前提是"用得上"。
npm run accept:cache 可复现):多轮对话命中率 31% → 89% → 94% → 96.3% 爬到稳态;同一会话累计输入从 1.4 万 → 32 万 tok(23×),花费仅 ¥0.030 → ¥0.054(未命中量全程恒定在约 1.2 万,几乎全是首轮冷启动)。一次完整功能开发(读+改+测+自审)实测约 ¥0.1、一个 83 步工具的长任务约 ¥0.33。/cost 随时看命中率与花费。真实开源近期 bug-fix 评测(SWE-bench 风格,fail2pass + pass2pass 双轨判定,测试文件对 agent 隐藏以防 reward-hacking):稳定解决 13/14。详见 测试与评测。
系统前缀字节稳定吃满 DeepSeek 前缀缓存;反思与记忆走复用主缓存的 fork(不破前缀);接近上限自动压缩(反应式重试 + 旧工具结果就地清理 + 增量摘要 + 摘要失败硬截断兜底),超大输出落盘、上下文只留指针。/cost 看命中率与花费,/audit cache 用四维指纹定位"谁破了缓存"。
会话结束自动蒸馏你的偏好、项目约定与关键事实;启动时按当前代码确定性校验——过期的剔除、变了的标注,而非盲目堆历史。衰减 GC 清死记忆,模型可 memory_read 按需检索。
挑战者:连续失败或同错复发时,派独立视角怀疑性复核、质疑前提;纠偏者:长任务每 N 轮复述最初目标、揪 scope 蔓延;reply-challenger:你重提同一问题时自动介入。三者都跑复用缓存的 fork,几乎不额外烧钱。
会话日志 + 崩溃恢复(dao -c);影子 git 检查点(/restore /rewind,独立快照、不碰你的 .git);todo 穿越压缩防目标漂移;DoD 验收(/dod + verify_done);卡死检测止损;并行 / 后台 / worktree 隔离子代理 + 子↔父双向通信;--goal 长任务自主模式。
Ink 富渲染 + 太极开屏 + 亮暗自适应;@ 引文件、slash Tab 补全、steering(回合运行中打字排队)、带行号+语法高亮的 diff、思考块、todo 复选框、道家动词 spinner;ESC 一键打断(模型流与 shell 一并停);非 TTY 自动回退纯文本 REPL。
基本功(对标 CC,均已落地):24 个工具 ·
allow/ask/deny分层权限 +auto智能审批 + 安全纵深(密钥扫描/SSRF/沙箱/钥匙串)· Skills(含外来技能自动适配工具名与模型档)· MCP(stdio + HTTP/SSE,tools/resources/prompts)· Hooks(5 生命周期事件)· 自定义子代理 / slash 命令 / 插件 · profile 多账户(/account)· OS 定时调度(/schedule)。详见 扩展系统与下方工具一览。
A. 一键安装(无需 Node):
curl -fsSL https://raw.githubusercontent.com/tigicion/dao-code/master/install.sh | sh
或手动到 Releases 下载:macOS dao-darwin-arm64(Apple 芯)/dao-darwin-x64(Intel)、Linux dao-linux-arm64/dao-linux-x64、Windows dao-windows-x64.exe。Unix 下 chmod +x 后运行;Windows 直接双击 .exe。
B. npm(需 Node ≥ 20,全平台):
npx dao-code # 零安装试用
npm i -g dao-code # 全局安装,命令名 dao
C. 从源码:
git clone https://github.com/tigicion/dao-code.git && cd dao-code
npm install && npm run build && npm link # 之后可全局 dao
# 或开发直跑:npm run dev
拿一个 DeepSeek API key:https://platform.deepseek.com/api_keys
启动 → 跟着引导填 key:
dao # 已安装(二进制/全局);或 npx dao-code
首次在终端运行且没检测到 key 时,会引导你粘贴,并存到 ~/.dao/config.json(下次自动读,无需再配)。
或手动设 key(任选一种,按你的系统):
| 方式 | 命令 |
|---|---|
.env(项目根,全平台) |
写一行 DEEPSEEK_API_KEY=sk-... |
| macOS / Linux | export DEEPSEEK_API_KEY=sk-... |
| Windows PowerShell | $env:DEEPSEEK_API_KEY="sk-..." |
| Windows CMD | set DEEPSEEK_API_KEY=sk-... |
浅色终端:运行中输入 /theme 切换,或启动前设 DAO_THEME=light。
常用斜杠命令(完整列表见 /help):
| 命令 | 作用 |
|---|---|
/init |
扫描本仓库生成 DAO.md(项目概览/约定,供以后会话自动加载) |
/model [id] |
切换模型(不带参数在 deepseek-v4-pro / deepseek-v4-flash 间切换) |
/mode [x] |
权限模式 default / acceptEdits / auto(智能审批)/ plan(亦 Shift+Tab 循环) |
/plan |
快捷切换 plan(只读+提方案)/ normal |
/goal <目标> |
长任务自主模式(自动批准 + 连续推进,大任务自动分阶段) |
/cost |
查看 token 用量与缓存命中率 |
/skills |
列出 / 开关技能 |
/compact |
手动压缩对话 · /clear 清空 · /help 命令列表 · /exit(亦 /quit)退出 |
启动时加
--yolo(如dao --yolo/dao --yolo "任务")可一开始就进入自动批准;运行中用/yolo随时开关。dao --verbose(或--debug)启动即进入详尽模式:工具结果全量、思考全量、并展示工具的原样参数。 普通dao启动时默认截断,运行中按 Ctrl+O 展开/收起全量(对标 CC);已打印进滚动区的历史无法原地改,故展开时会把最近一条折叠内容补充显示一次。
交互模式(默认):
dao
↑/↓ 翻历史;Esc 打断当前回合;/ 开头走斜杠命令(带补全提示)。←/→ 移光标、Ctrl-A/E 行首尾、Ctrl-W 删词、Backspace/Delete 按光标删;支持粘贴(不自动提交)。@ 引用文件:输入 @ + 路径片段,列出匹配文件,Tab 补全。[y]本次 [a]记住(写 allow 规则) [n]拒绝);也可在 .dao/settings.json 用 allow/ask/deny 规则预先放行或拦截(见「扩展系统 · 权限控制」);/yolo 或 --yolo 全自动批准(deny 仍拦)。一次性模式(把任务作为参数,跑完即退,不蒸馏记忆,适合脚本):
dao "把 src/utils.ts 里的 formatDate 改成支持时区"
你 ──▶ Ink TUI ──▶ agent loop ──▶ DeepSeek V4
│ streamChat(流式推理+回答)
│ ▶ 模型请求工具调用
│ ▶ 审批门(写/执行需放行)
│ ▶ 执行工具 → 回灌结果
└─ 循环直到模型不再请求工具
src/agent/loop.ts):每回合调 streamChat 流式拿推理+回答,模型若请求工具就经审批门执行、把结果回灌,循环至完成或达最大轮数;AbortSignal 透传给模型流与工具,支持 ESC 中断。src/memory/):启动时迁移→加载→对实时代码确定性验证→注入固定前缀;退出时用便宜的 flash 模型蒸馏新事实,去重后 upsert。面向"自主跑很久、不漂移、可恢复、能验收"的长任务:
.dao/sessions/<id>/events.jsonl、状态快照写 state.json;崩溃/异常退出后 dao -c 恢复上次会话(src/session/log.ts)。.dao/shadow.git 对工作区快照(不碰你的 .git/不改你的历史);/restore 一键回退上一回合改动(src/session/checkpoint.ts)。todo_write 维护的清单在压缩后作为 system 消息重注入,防长任务目标漂移。/dod <命令>(或 DAO_VERIFY_CMD)设可执行验收命令,verify_done 跑它——通过(exit 0)才算完成;没设则模型据证据自判。src/agent/stuck.ts)。.dao/spill/、上下文只留截断+指针,按需 read_file 取回。agent 传 tasks[] 并行,或 background:true 后台跑(立即返回、不阻塞主循环);完成后结果作为 <task-notification> 自动注入续跑(src/agent/tasks.ts)。memory_read 让模型主动检索跨会话记忆(启动只注入 top-K,被截断/刚写的也查得到)。dao --goal(旧名 --task / --coordinator 仍兼容)或运行时 /goal <目标> —— 自动批准 + 自主连续推进 + 更高轮数;大任务自动分阶段编排(研究并行 → 综合 → 实现 → verify_done 验收),仅真卡住才问你。allow / ask / deny,语法 Tool(specifier)——Bash(npm run test:*)(命令前缀)、Edit(src/**)/Read(//etc/**)(gitignore 式路径 glob)、WebFetch(domain:example.com)、裸工具名、mcp__server__tool。优先级 deny > ask > allow > 模式/能力默认(deny 是硬黑名单,YOLO 下也拦)。
~/.dao/settings.json(用户)< .dao/settings.json(项目,入库)< .dao/settings.local.json(本地,不入库)< CLI(--allow/--deny/--add-dir/--permission-mode)< 企业托管策略(/etc/dao/managed-settings.json 等,不可被下层覆盖)。cd /tmp && rm -rf x 会按 &&/||/;/| 拆开,任一子命令命中 deny 即整条拦截(杜绝绕过)。/mode <x> 或 Shift+Tab 循环;状态栏显示):default(按需审批)/ acceptEdits(自动批准文件编辑)/ auto(AI 分类器智能审批:只读与工作区内编辑自动放行、拿不准转人工)/ plan(只读规划);bypassPermissions(=YOLO)仅 dao --yolo 启动时开。[y] 本次 / [s] 本会话 / [a] 记住(写 allow 规则到 .dao/settings.local.json)/ [n] 拒绝。additionalDirectories:预授权的工作区外目录,读取不弹窗。src/permissions/(rules / identity / settings / engine / gate),含端到端测试。.dao/agents/<name>.md(frontmatter:name/description/tools 白名单/model + 正文 prompt)。agent 工具 agent_type 指定;各有专属角色与工具。.dao/commands/<name>.md(正文为 prompt 模板,$ARGUMENTS/$1)。/<name> 参数 展开成一个回合跑。.dao/skills/<name>/SKILL.md。渐进式披露:启动只列 name+description,模型用 skill 工具按需加载正文。.dao/hooks.json。PreToolUse(可阻断)/PostToolUse(如自动格式化)/UserPromptSubmit(注入上下文/阻断)/SessionStart/End。.dao/mcp.json。连 stdio MCP server,工具自动注册为 mcp__<server>__<tool>。tasks[]、background:true 异步后台、isolate:true git worktree 隔离、task_send 给运行中任务追加指令、前台超时自动转后台、转录落盘 .dao/subagents/。兼容 Claude Code:
settings.json、SKILL.md、hooks.json、mcp.json与 CC 同款格式(工具名自动映射Bash↔exec_shell等),现成的 CC 配置/技能可直接拿来用。
注册表见 src/index.ts,实现在 src/tools/。
| 工具 | 作用 |
|---|---|
read_file |
读文本文件,返回带行号内容(支持 offset/limit) |
list_dir |
列目录条目 |
write_file |
新建或整体重写文件(覆盖前需先读过) |
edit_file / multi_edit |
精确字符串替换(单处 / 一次多处) |
notebook_edit |
编辑 Jupyter notebook 单元 |
exec_shell(+_poll/_kill) |
在工作区执行 shell;支持前台/后台(background=true)、读后台输出、终止 |
grep_files / file_search |
按内容正则 / 按文件名 glob 搜索 |
ask_user |
向用户提一个澄清问题并等回答 |
fetch_url / web_search |
抓网页纯文本 / DuckDuckGo 联网搜索 |
todo_write |
维护单层任务清单(整表替换) |
verify_done |
跑 DoD 验收命令判定任务是否完成 |
memory_write / memory_read |
记一条跨会话记忆 / 按需检索记忆 |
skill / skill_install |
加载技能正文 / 安装外部技能 |
agent / task_send / message_parent |
派子代理 / 给运行中子代理追加指令 / 子→父回传 |
schedule |
创建 OS crontab 定时任务 |
单元测试(Vitest):
npm test # 跑一遍
npm run test:watch
npm run typecheck
npm audit的告警均来自 dev 测试工具链(vitest / vite / esbuild),不随发布产物(dist)分发,不影响dao运行时;其中的 critical 是vitest --ui服务器漏洞(本项目不使用)。CI 见 [.github/workflows/ci.yml](.github/workfl