多 agent 协作的规矩:没有 agent 直接接着另一个 agent 干。每个 agent 只做一件事——把进展汇报给人,人做决策、人做接力。所有 agent(Cursor / Codex / Claude / DSH)共用下面这段提示词。
每个项目维护一张「手交卡」.handoff.md(Markdown,人机共读,约 300 token),作为交接的主入口。浏览器可视化入口:/project/(总索引),每项目一张 /project/led/。原始存储(SQLite / transcript)只在卡缺失或过期时才挖。
updatedAt / transcriptBytes 与真实文件对不上 → 卡过期,才回退到下面「找对话与原文」的 SQLite / transcript 深挖;.handoff.md。只写路径/指针,不写密钥、.env、密码。{
"schema": "handoff-card/v1",
"slug": "led",
"project": "LED 屏数据管理",
"folder": "D:/…/项目文件夹",
"composerId": "dd329bdb-…",
"updatedAt": "2026-09-03T10:18:25+08:00",
"status": "in_progress",
"todos": [{"id":"…","content":"…","status":"done|in_progress|pending"}],
"nowDoing": "…",
"blocker": "…",
"next": "…",
"recentFiles": ["…"],
"source": {"transcript":"…","transcriptBytes":0,"plan":"…"},
"agents": {"cursor":"…","codex":null,"claude":null,"dsh":null}
}
status 取值:done / in_progress / pending / error / blocked。首次进入 handoff 的项目做一次「全量索引」生成卡,之后每次收尾增量刷新即可。
把整段复制给任意 agent,它只读、只汇报,不改代码、不部署、不写任何账本。返回一份固定格式的「进展说明」给你。
你是当前项目的进度汇报 agent,向用户汇报。只读:不改代码、不部署、不写任何账本,只返回一份「进展说明」。 【任务】找到指定的项目,按下面顺序收集信息,最后用固定格式返回说明。 0. 先读手交卡(若有) - 读项目根目录的 .handoff.md(Markdown,人机共读,约 300 token),或读 https://ai.njwl.ai/project/<slug>/ 对应卡片。 - 卡缺失或过期(updatedAt / transcriptBytes 与真实文件对不上)才执行下面 1–3 步深挖。 1. 找对话(Cursor) - 查 %APPDATA%\Cursor\User\globalStorage\conversation-search.db 的 conversations 表,按标题找 id(SQLite 用 file:...?mode=ro&immutable=1 只读打开,时间戳是毫秒)。 - 查 state.vscdb 的 composerHeaders 表,拿 workspace、最后更新时间、改了哪些文件(totalLinesAdded / filesChangedCount)。 2. 找原文与计划 - 读 ~\.cursor\projects\<hash>\agent-transcripts\<composerId>.jsonl 末尾,看上一回合做了什么、有没有报错(turn_ended / error)。 - 读 ~\.cursor\plans\*.plan.md 的 todos 状态(in_progress / pending)。 3. 找文件与归属 - 按 workspaceIdentifier 找到项目文件夹,列出最近修改的几个文件(= 上次现场)。 - 若有其他 agent(Codex / Claude / DSH)参与,去 ~\.codex、~\.claude、DSH 的 .agents\notes 看一眼对应记录。 【输出】用这个格式返回「进展说明」: - 项目 / 文件夹: - 对话 id + 标题 + 最后更新时间: - 干到哪了(最近改的文件 + todo 状态): - 卡点 / 报错(若有): - 下一步(下一个 pending 的 todo): - 参与过的 agent 与 source 指针:
| ❌ 直接接力(不推荐) | ✅ 只汇报 + 人做决策 | |
|---|---|---|
| 谁决定下一步 | agent 自己接着写代码 | 人看汇报后决定 |
| 归属 | agent 互相写、容易暴力写入、来源被抹掉 | 汇报里带 source 指针,谁干的一目了然 |
| 风险 | agent 可能跑偏、直接改上线 | 每一步都要过人,可控 |
提示词第 1、2 步的展开,人工排查时用。
%APPDATA%\Cursor\User\ ├── globalStorage\ │ ├── state.vscdb ← 主状态库(很大,别整体读) │ └── conversation-search.db ← 对话搜索索引(小,先查它) └── workspaceStorage\<workspaceId>\
import sqlite3
con = sqlite3.connect(f"file:{r'%APPDATA%/Cursor/User/globalStorage/conversation-search.db'}?mode=ro&immutable=1", uri=True)
for id, title, updated_at, archived in con.execute(
"SELECT id, title, updated_at, is_archived FROM conversations WHERE title LIKE ?",
("%关键词%",)):
print(id, title, updated_at, archived)
再查 state.vscdb 的 composerHeaders 表拿元数据(workspaceId / lastUpdatedAt / value 里的 workspaceIdentifier、totalLinesAdded 等)。workspaceIdentifier.uri.external 才是「对话 → 文件夹」的权威映射——标题 ≠ 文件夹名。
~\.cursor\projects\<项目hash>\agent-transcripts\<composerId>\ ├── <composerId>.jsonl ← 主对话全文 ├── subagents\*.jsonl ← 子 agent └── ..\..\terminals\*.txt ← shell 输出
计划文件:~\.cursor\plans\<名字>_<hash>.plan.md(YAML 头有 todos + status)。转写末尾 "turn_ended","status":"error" = 上一回合报错(常见:模型用量超限、手动中止)。
汇报里必须带「参与过的 agent + source 指针」,这样人转发时归属不会丢。
| agent | 原文在哪 | 指针写法 |
|---|---|---|
| Cursor | ~\.cursor\projects\<hash>\agent-transcripts\<composerId>.jsonl | composerId |
| Codex | ~\.codex\session_index.jsonl(索引)+ state_5.sqlite / thread_history_1.sqlite(正文) | threadId |
| Claude | ~\.claude\projects\C--Users-ben22\<sessionId>.jsonl | sessionId |
| DSH | checkout 的 .agents\notes\(proposed / implemented) | 笔记文件路径 |
~\.codex\external_agent_session_imports.json(source_path + sha256 + imported_thread_id + connector_names),可当归属索引用。找 Codex 会话时(尤其下「某 agent 未参与」结论前)务必多数据源交叉,别一次 grep 定论。
~\.codex\ ├── session_index.jsonl ← 会话索引(在根目录,不是 sessions\) ├── state_5.sqlite ← threads 表:标题 / updated_at / tokens_used / cwd / model └── thread_history_1.sqlite ← thread_items(正文)、thread_turns(状态/报错)
thread_id 上。按 thread_items.created_at_ms 全表倒序查最新,别用固定 thread_id 硬查。thread_turns.started_at / completed_at 是「秒」,thread_items.created_at_ms 是「毫秒」,混用会算出错日期。Select-String 默认按 ANSI 读会漏匹配;用 -Encoding UTF8 或直接用 Python。session_index.jsonl + threads 表 + thread_items + thread_spawn_edges 都过一遍。接力只发生在「人 → agent」,从不在 agent 之间直接发生。
file:...?mode=ro&immutable=1 只读打开即可,无需登录、无需联网。