Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(bots): clarify bounded judgment reads and reference preservation

zqchrisb2de25a2349a
diff --git a/apps/desktop/src/main/maker-ipc/teammateGuide.ts b/apps/desktop/src/main/maker-ipc/teammateGuide.ts
index f6b91e8e52..793f3a97dd 100644
--- a/apps/desktop/src/main/maker-ipc/teammateGuide.ts
+++ b/apps/desktop/src/main/maker-ipc/teammateGuide.ts
@@ -36,9 +36,9 @@ export function buildTeammateGuide(
"A real background task is a standalone Session in the user's task list. Prefer completing work in the current chat. Use `start_session_task` when the user explicitly requests an independent task or the work needs separate ongoing execution, an isolated workspace, parallel delivery, or independent tracking. Use `check_session_task`, `message_session_task`, and `stop_session_task` to control that same task when needed. Completion returns automatically; you remain responsible for reviewing and presenting the result.",
'Todo maintenance is a shared operating responsibility alongside task execution. A Todo is a commitment you made to the user in conversation, including everyday work before any project or task exists. Projects, Sessions and PRs are optional references, not the identity or prerequisite of that commitment. Ordinary task titles, engine status and archive state belong to the existing task list; do not reinterpret them as Todo completion.',
'Each turn, check whether the conversation adds a clear commitment or changes its scope, progress, next step or completion evidence. Also check when you receive a task result, a user correction or new facts during authorized proactive follow-up. Only when something relevant changes, use the live Todo/workbench tools to read the relevant existing entries, reuse the same id for the same commitment, and update it through `set_workbench_task` or `set_workbench_tasks`. Retrying execution or linking a PR does not create a second commitment. Keep unaccepted suggestions distinct (`idea` where supported); recording an idea does not authorize starting work, and ongoing authorized work does not need repeated permission. No change means no fabricated Todo and no pointless read/write cycle.',
- 'Write the current title, facts and one next step together: setters replace the entire entry, so preserve its still-valid reference and project fields. Do not encode state in title prefixes or leave old PR prose after a verified merge. Use `done` only when evidence satisfies the agreed outcome; an idle/stopped task or a merged PR alone need not satisfy it. If acceptance remains, keep it unfinished and name the next verification; unknown facts remain explicitly unverified. For current tools, keep a concise completion basis in `next` and its supporting reference in `ref` where available; these are not structured completion metadata.',
+ 'Write the current title, facts and one next step together: setters replace the entire entry, so preserve its still-valid reference and project fields. For Session judgments, `get_workbench` omits `ref` and `read_workbench_task` returns only conversation text. An omitted field is not proof that no reference exists: recover it from a confirmed prior write receipt matching the current judgment’s updatedAt if available; otherwise do not overwrite that judgment and explain the safe-update limitation briefly. Do not encode state in title prefixes or leave old PR prose after a verified merge. Use `done` only when evidence satisfies the agreed outcome; an idle/stopped task or a merged PR alone need not satisfy it. If acceptance remains, keep it unfinished and name the next verification; unknown facts remain explicitly unverified. For current tools, keep a concise completion basis in `next` and its supporting reference in `ref` where available; these are not structured completion metadata.',
'Current workbench tools are a limited project-scoped store: only a local active teammate main Session can use them, supported ids and references must pass the host checks, and even `idea` requires an entrusted project. They do not yet support project-free Todos, independent optional task/PR associations, or a browsable completed section. `done` is returned for retained project items by `get_workbench` but hidden in the current UI; the 200-entry bound can evict old completed judgments, and continuing an item as a background task can remove its judgment. Do not invent unsupported fields, create a fake project, disguise an everyday commitment as a project idea, write raw storage, or claim these gaps are implemented. State the specific recording limitation briefly and retain the commitment in the conversation until a supported tool can save it.',
- 'Inspect every write result, including each batch item, then read back the supported entries with `get_workbench` before claiming they were saved. A partial failure is not a successful whole update; report unsaved items plainly. Reply with only the useful result and remaining work, without tool logs or internal coordination messages. Update on received events and during already-authorized follow-up; guidance alone cannot run while you are not awakened. Do not install a timer merely to maintain Todo or promise unattended real-time updates.',
+ 'Inspect every write result, including each batch item, then attempt to read back supported entries with `get_workbench`. Its Session list is limited to recent candidates and a count bound, so an older or omitted Session judgment can save successfully without appearing in that read. An explicit successful write receipt confirms saving; if readback cannot show it, distinguish saved-but-not-visible from a failed write and from content verified by readback. Do not retry a successful write just to make it appear. A partial failure is not a successful whole update; report unsaved items plainly. Reply with only the useful result and remaining work, without tool logs or internal coordination messages. Update on received events and during already-authorized follow-up; guidance alone cannot run while you are not awakened. Do not install a timer merely to maintain Todo or promise unattended real-time updates.',
'Use `list_agents` to discover local and authorized remote teammates, including device identity. Use the exact returned id; never route by name. Use `send_to_agent` only to send one bounded asynchronous message to a named teammate. It is not a task and has no progress or cancellation. Do not substitute a message to a teammate for `start_session_task`.',
'An older remote host can receive an attributed message through its ordinary conversation. When `send_to_agent` returns `transport=remote-conversation`, use `check_agent_message` with its message_id on follow-up to read ordinary replies. Do not poll, resend uncertain deliveries, or describe a bridged reply as a remote tool call.',
"A teammate message does not rewrite another teammate's identity or make that teammate obey. If the user asks for obedience or control, explain this boundary and offer either a message or a tracked Session task, whichever matches the work.",
diff --git a/docs/product-rules/cindy-bots-runtime.md b/docs/product-rules/cindy-bots-runtime.md
index 2b72c75257..1044c44555 100644
--- a/docs/product-rules/cindy-bots-runtime.md
+++ b/docs/product-rules/cindy-bots-runtime.md
@@ -475,7 +475,10 @@ Todo 是伙伴根据与用户的对话维护的承诺清单,可包括没有项
承诺、范围、进展、下一步与完成依据;收到任务结果、用户纠正及已授权主动跟进中新事实时
同样检查。有变化才读相关已有记录、沿用 id 幂等更新;整条替换时保留仍有效的关联,多条
变化批量写。只写有依据的状态,建议与已接下的承诺区分,记录不等于开工。逐条核对结果并
-读回后才说已更新;失败与不支持的事项如实说明,没有变化不造条目、不做无意义调用。
+尝试读回并区分回执确认保存、列表可见性和内容核对;失败与不支持的事项如实说明,没有变化不造条目、不做无意义调用。
+会话判断的读取不含旧 `ref`;没有 updatedAt 与当前判断一致的已确认写入回执可恢复原引用时,不整条覆盖该判断,不能把
+字段缺失当作没有引用。近期与数量限制可能让成功写入的旧会话不在读回列表中;成功回执
+确认保存,读回不可见不等于失败,不为出现于列表而重复写入。
现工具仅能维护获准项目内的事项,无项目承诺先在对话中保留并说明无法持久记录;不得
写原始存储或把日常事务冒充项目建议。当前可在 `done.next` 写简短完成依据、`ref` 放证据,
不把它描述为已支持结构化完成记录或完成列表。提示词只规定收到事件时的维护行为,不能
diff --git a/packages/lizi-mcps/src/xdt-helper/bot_workbench.ts b/packages/lizi-mcps/src/xdt-helper/bot_workbench.ts
index c943fe93a5..fc24282c4b 100644
--- a/packages/lizi-mcps/src/xdt-helper/bot_workbench.ts
+++ b/packages/lizi-mcps/src/xdt-helper/bot_workbench.ts
@@ -252,14 +252,14 @@ export function registerBotWorkbenchTools(
+ '项目里最近 30 天的会话(项目里的 Cindy 任务——包括主人自己开的——不管你判断过没有都在,最多 30 条;再补本机 Claude Code / Codex / Pi 会话,合计最多 40 条;更早的只给 olderCount),你写过的 PR / issue / 建议条目,你的例行任务与项目里的自动化。'
+ 'Todo 是你在对话中答应主人的事务,可早于项目或任务;当前工具只支持已接手项目内的记录,不支持无项目 Todo,不要创建伪项目或把日常事务塞成项目 idea。'
+ '主人提到这个项目、让你跟进或问进展,或对话/任务回传/已授权跟进中发现承诺变化时,读相关记录并沿用 id 更新;没有变化不反复读写。项目里的任务是上下文,不应逐条复制为 Todo。'
- + '每条会话带 digest:起始目的与最后几条对话,足够大多数判断,不用逐个读全文。'
+ + '每条会话带 digest:起始目的与最后几条对话,足够大多数判断,不用逐个读全文。会话 judgment 不返回 ref,不能把缺字段当成没有旧引用;找不到 updatedAt 与当前判断一致的已确认写入回执时不要覆盖该判断。'
+ '接手的做法:主人把项目交给你时,先调用它;再用你自己的文件工具读 brief.docs 里最前面的一两份(README / DESIGN / AGENTS 之类),弄清项目是做什么的、在往哪走;'
+ '然后看最近的提交(不是 git 仓库时看 brief.recent)和会话 digest,只对实际变化的相关事项用 set_workbench_tasks 批量写下判断;只有拿不准的几件才 read_workbench_task。'
+ '判断与下一步要体现你对项目的理解(它在项目里处于什么位置、和哪份文档或哪次提交有关),不要只复述会话。'
+ '项目文档(如 DESIGN.md)、最近的 PR 与 issue 同样是素材:值得做的写成 pr:<owner>/<repo>#<n>、issue:<owner>/<repo>#<n> 或 idea:<slug> 条目,带上 ref。'
+ '判断标准:已接下但约定结果未达成 → unfinished;尚未接下的建议 → idea;有可核实依据达到约定结果 → done。纯问答与无关内容不新建条目;停止、空闲、PR 合并不自动等于承诺完成,仍待验收时写明下一步。'
+ 'get_workbench 会返回尚保留且仍在项目范围内的 done 条目,当前界面隐藏,最多 200 条且旧 done 优先淘汰;继续为后台任务时也可能移除原判断,不能当完整完成历史。'
- + '写后检查逐条结果并读回确认,聊天只简短说明结果与余项;记录建议不等于开工授权。已有同范围授权时继续跟进,不重复求许可;没有授权的建议不能自行开始。'
+ + '写后检查逐条结果并尝试读回确认。会话列表受近期窗口和数量上限约束,写入成功的旧会话可能不在返回中;成功回执确认保存,列表缺席不等于写失败,不能为此重复写。聊天简短区分已保存但列表不可见、已读回核对和未保存;记录建议不等于开工授权。已有同范围授权时继续跟进,不重复求许可;没有授权的建议不能自行开始。'
+ '主人在工作台上点「跟进」时会发来「跟进「<标题>」」(其它语言如 Follow up on “<标题>”):先调用本工具按标题找到那一条,'
+ '再 continue_workbench_task——会话条目发一句承接上文、收到就能接着做的指令;PR / issue / 建议条目会在项目目录开后台任务。'
+ '找不到同名条目就问主人是哪一件,不要猜;有几条同名时列出候选让主人选。'
@@ -296,7 +296,7 @@ export function registerBotWorkbenchTools(
name: 'set_workbench_task',
category: 'bots',
description:
- '维护一件已接手项目内的事务判断。按 task_id 整条替换,多件变化用 set_workbench_tasks;保留仍有效的 ref/project,写后检查结果并用 get_workbench 读回。当前不支持无项目 Todo 或独立的可选任务/PR 关联。'
+ '维护一件已接手项目内的事务判断。按 task_id 整条替换,多件变化用 set_workbench_tasks;保留仍有效的 ref/project。get_workbench 的会话判断没有 ref,无法从 updatedAt 与当前判断一致的已确认回执找回旧 ref 时不要覆盖。写后检查结果并尝试读回;成功回执已确认保存,近期/数量过滤导致列表不可见不等于失败,不重复写。当前不支持无项目 Todo 或独立的可选任务/PR 关联。'
+ 'task_id:get_workbench 返回的会话 taskId,或你新写的 pr:<owner>/<repo>#<n>、issue:<owner>/<repo>#<n>(须是已接手项目的 GitHub 仓库)、idea:<slug>(小写字母数字与连字符,3–40 位)。'
+ '同一承诺沿用原 id,重复执行不重复建条目。title:当前人话标题,不超过 40 字,不用状态前缀;verdict:unfinished(约定未完成)/ idea(尚未接下的建议)/ done(有依据完成,当前界面隐藏)。无关内容不新建;记录不自动开工。'
+ 'next:当前进展与下一步,不超过 120 字,unfinished / idea 必填;done 时写完成依据,ref 放支持依据的 https 链接或项目内文件路径。没有专门完成依据字段。停止或合并仍待验收则保持 unfinished;事实未知写待核实。只写有依据的判断,不要编造。',
@@ -316,7 +316,7 @@ export function registerBotWorkbenchTools(
category: 'bots',
description:
`批量写下判断(1–${WORKBENCH_BATCH_MAX} 条),字段与 set_workbench_task 相同。逐条校验,一条不合格不影响其它条;返回每条的结果。`
- + '对话承诺、任务回传、用户纠正或已授权跟进发现相关变化后才写,同一承诺沿用 id;没有变化不造条目。检查每条结果,部分失败不代表全部成功,再 get_workbench 读回。与单条工具一样,当前只支持项目内记录。',
+ + '对话承诺、任务回传、用户纠正或已授权跟进发现相关变化后才写,同一承诺沿用 id;没有变化不造条目。与单条一样保留旧引用,会话 ref 无法确认时不覆盖。检查每条结果,部分失败不代表全部成功,再尝试 get_workbench 读回;成功项可能因会话近期/数量限制不可见,不误报失败或重复写。当前只支持项目内记录。',
inputShape: {
items: z.array(z.object(JUDGMENT_FIELDS)).min(1).max(WORKBENCH_BATCH_MAX).describe('判断列表'),
},