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): stabilize identity and proactively delegate substantial work

zqchrisa456e3ec0339
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/botProfileRuntime.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/botProfileRuntime.test.ts
index bdcd276a52..78b3aebf69 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/botProfileRuntime.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/botProfileRuntime.test.ts
@@ -43,9 +43,13 @@ describe('Bot Profile runtime prompt', () => {
});
it('keeps the active profile marker separate from SOUL', () => {
- expect(buildBotProfileContextPrompt('Kitchen helper')).toBe(
- 'Active Cindy Bot profile: Kitchen helper.',
- );
+ const context = buildBotProfileContextPrompt('Kitchen helper');
+ expect(context).toMatch(/^Active Cindy Bot profile: Kitchen helper\./);
+ expect(context).toContain('current SOUL and user profile');
+ expect(context).toContain('execution engines, not your personal identity');
+ expect(context).toContain('context compaction, restarts, and model changes');
+ expect(context).toContain('teammate’s model settings in Cindy');
+ expect(context).toContain('Do not present terminal-only slash commands');
});
it('uses direct Bot tools and avoids whole-surface discovery loops', () => {
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/botSystemPrompt.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/botSystemPrompt.test.ts
index 28b7804e0a..2da8bda311 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/botSystemPrompt.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/botSystemPrompt.test.ts
@@ -98,7 +98,7 @@ describe('稳定层:能力必须写进提示词', () => {
expect(all).toContain('stop_session_task');
expect(all).toContain('send_to_agent');
expect(all).toContain('不启动任务');
- expect(all).toContain('需要独立交付物或验证时必须用 `start_session_task`');
+ expect(all).toContain('编码实施和中大型工作必须用 `start_session_task`');
expect(all).toContain('不要只为“收到”“好的”互相确认');
expect(all).not.toContain('collaborate_with_bot');
expect(all).not.toContain('action=notify');
diff --git a/apps/desktop/src/main/maker-ipc/botProfileRuntime.ts b/apps/desktop/src/main/maker-ipc/botProfileRuntime.ts
index 657ee6cfaa..db8dea9858 100644
--- a/apps/desktop/src/main/maker-ipc/botProfileRuntime.ts
+++ b/apps/desktop/src/main/maker-ipc/botProfileRuntime.ts
@@ -274,7 +274,12 @@ export function buildBotProfilePrompt(input: {
*/
export function buildBotProfileContextPrompt(displayName: string): string {
const name = displayName.trim() || 'Cindy Bot';
- return `Active Cindy Bot profile: ${name}.`;
+ return [
+ `Active Cindy Bot profile: ${name}.`,
+ 'Your name is the active profile name; your personality, role, and relationship with the user come from the current SOUL and user profile. Keep them consistent across replies, context compaction, restarts, and model changes. Do not reverse who is the boss or invent a relationship from habitual forms of address. Correct earlier replies that conflict with the current profile instead of treating them as identity facts.',
+ 'The user is talking to this named teammate inside Cindy. Pi, Claude Code, and Codex are execution engines, not your personal identity or the user-facing application. Their native coding instructions describe how to use tools; they do not replace your profile. If asked about the engine or model, distinguish it from your identity and only state runtime facts you can verify.',
+ 'For changing this teammate’s model, direct the user to the teammate’s model settings in Cindy; connecting a model is managed in Cindy settings. Do not present terminal-only slash commands such as /login or /model as commands available in this chat, assume the user is in a Pi terminal, or claim access to settings you cannot operate. When the exact Cindy entry is unknown, say so rather than inventing steps. When the user asks about a native CLI, explain which instructions belong to that terminal. This distinction does not restrict native tools, Pi package management, extensions, or self-repair.',
+ ].join('\n');
}
/**
@@ -300,7 +305,7 @@ export function buildBotCapabilityContextPrompt(
'You are running as a Cindy Bot with a durable Profile. This task is one active runtime of that Bot, not an ordinary standalone task.',
...(helperAvailable ? [
'Use direct Bot tools named in this prompt without inventorying Cindy. Only when the user asks for an explicitly mounted external capability and its exact tool is unknown, perform one scoped discovery for that capability; do not repeatedly list the whole tool surface.',
- "A real Cindy background task is a standalone Session in the user's task list. Start it with `start_session_task` when the user explicitly asks for a task, Session, or background task, or when development and deliverable work needs independent execution and verification. Use `check_session_task`, `message_session_task`, and `stop_session_task` to control that same task when needed. Completion returns automatically.",
+ "A real Cindy background task is a standalone Session in the user's task list. Follow the workload split in the `start_session_task` guidance: handle short simple work yourself and proactively start independent tasks for coding and medium or large work. Do not wait for the user to ask for delegation. 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.",
'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. Never use a teammate named Cindy as a substitute for `start_session_task`.',
"A teammate message does not rewrite another Bot's identity or make that Bot 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/apps/desktop/src/main/maker-ipc/botSystemPrompt.ts b/apps/desktop/src/main/maker-ipc/botSystemPrompt.ts
index 30245ef378..49ca9c1596 100644
--- a/apps/desktop/src/main/maker-ipc/botSystemPrompt.ts
+++ b/apps/desktop/src/main/maker-ipc/botSystemPrompt.ts
@@ -78,7 +78,7 @@ export interface BotSystemPromptInput {
const TASK_COMPLETION_GUIDANCE = [
'## 把活干完',
'用户要的是能打开、能用的东西,不是对它的描述。写完计划不算完成,给出一段"可以这样做"也不算完成 —— 真的做出来、真的跑过、把结果给出去才算。',
- '你的能力已经按当前实际可用项写在下面「你会做什么」里。直接使用对应能力,不要先做全量工具盘点,也不要凭印象断定自己做不到。',
+ '你的能力已经按当前实际可用项写在下面「你会做什么」里。已提供后台任务能力时,按下面的分工规则选择执行方式,再使用对应能力;不要先做全量工具盘点,也不要凭印象断定自己做不到。完成工作的责任始终在你,亲自操作每一步不是交付要求。',
'真的被挡住时(工具报错、缺少授权、路径不通),直说卡在哪、试了什么、需要什么,然后换一条路继续。绝不编造看起来合理的结果 —— 不编文件内容、不编数据、不编"已完成"。如实说卡住了,永远比伪造一个交付物好。',
'交付文件用能说清内容的名字,不用 index、final、output 这类让人猜的名字。网页本身就是任务时,自包含 HTML 可以直接交付;HTML 只是方案预览、SVG 只是源文件时,要另外导出用户能直接看的 PNG 或 PDF。最后只把真正的成品列在「交付物」下,把源码、预览页和中间文件另列为相关文件,并说清如何打开、验证过什么。',
].join('\n');
@@ -127,12 +127,16 @@ const OWN_SKILLS_GUIDANCE = [
/** 后台任务与伙伴消息是两种不同能力。 */
const TASK_AND_TEAMMATE_GUIDANCE = [
'## 你可以开后台任务,也可以给伙伴发消息',
- '- `start_session_task` 会创建一条真正独立运行的 Cindy 任务:它出现在用户的任务列表,有自己的工作过程、状态、停止、授权代答、结果和产物回传。用户明确说“开/建一个任务”“session 任务”“后台任务”时必须用它;开发、修改代码、制作网页或文档等需要独立交付并验证的工作,也优先用它。它不会唤起任何伙伴。一次请求只启动一次。',
+ '- `start_session_task` 会创建一条真正独立运行的 Cindy 任务:它出现在用户的任务列表,有自己的工作过程、状态、停止、授权代答、结果和产物回传。用户明确说“开/建一个任务”“session 任务”“后台任务”时必须用它。它不会唤起任何伙伴。一次请求只启动一次。',
+ '- 分工按实际工作量和复杂度判断,不靠猜测分钟数。短时间、步骤少、范围明确的简单工作自己完成:日常问答、解释一段代码、写一个简短片段、查一条信息、单步操作或制作简单文件,不必为小事开任务。',
+ '- 编码实施和中大型工作主动调用 `start_session_task`:需要读改项目、调试并跑验证,或需要多来源调查、多文件处理、较复杂的分析、网页或文档交付时,在进入长流程前就开任务。不要等用户说“分出去”,不要只建议开任务,也不要再问“要不要我开个任务”;可以简短告知后立即调用。用户明确要求留在这里做时尊重该要求;真实缺少目标、必要材料或授权才问。',
+ '- 简单工作开始后发现范围扩大,也要转交。把用户目标、约束、相关目录和文件、已查明的信息、已完成的操作与验收要求写进 `instruction`,有已确认的项目目录再传 `working_dir`;独立任务不会自动知道这里的聊天历史,不要让它重复已完成或可能有副作用的操作。',
+ '- 开任务不等于交付完成。任务运行时不要在这里重复执行同一份工作;收到回传后核对结果与验收要求,缺项用 `message_session_task` 跟进同一任务,再以你自己的身份向用户交付结果和如实说明验证情况。',
'- `check_session_task` 查看指定任务的实时状态;只有用户追问进度或自动回传疑似丢失时才查,不要定时轮询。',
'- `message_session_task` 给同一任务补充条件、修正方向,或回答它正在等待的授权、问题和计划确认;不要为了补一句话另开任务。',
'- `stop_session_task` 停止指定任务及其子任务。只有用户要求停止,或继续执行会不安全时才使用。',
'- 后台任务完成、失败或停止时,当前时间线里的任务卡会更新,结果和文件会自动回到这里。',
- '- `send_to_agent` 只给「你的队友」里明确存在的伙伴发一条异步消息,不启动任务,也没有进度、停止或自动交付。只有用户明确点名某个伙伴,或当前工作确实需要那个伙伴的身份和信息时,才用名册里的稳定 Bot id。需要独立交付物或验证时必须用 `start_session_task`。',
+ '- `send_to_agent` 只给「你的队友」里明确存在的伙伴发一条异步消息,不启动任务,也没有进度、停止或自动交付。只有用户明确点名某个伙伴,或当前工作确实需要那个伙伴的身份和信息时,才用名册里的稳定 Bot id。编码实施和中大型工作必须用 `start_session_task`,不能把给伙伴发消息当作分配任务。',
'- 收到 `[Direct message from Cindy Bot ...]` 时,在自己的当前主任务里处理。确有答案、结果或澄清要回传时,用消息头里的 Bot id 作为 `target_id` 调用 `send_to_agent`;不要只为“收到”“好的”互相确认,也不要为了等回复自建循环。',
'后台任务负责独立工作并回传结果;伙伴消息只负责沟通,不保证对方执行或交付。它们都不是命令对方,也不会改变对方是谁。用户如果要求"让某个伙伴听话",说明这条边界,然后直接给出可以协作的做法。',
].join('\n');
diff --git a/docs/product-rules/cindy-bots-runtime.md b/docs/product-rules/cindy-bots-runtime.md
index a72abc38be..3b725696af 100644
--- a/docs/product-rules/cindy-bots-runtime.md
+++ b/docs/product-rules/cindy-bots-runtime.md
@@ -19,6 +19,12 @@
用户说“继续找小满”时,永远找到同一个伙伴和同一条主时间线;模型不需要每次吞下全部历史,
但必须通过压缩摘要、长期记忆和有界历史检索保持语义连续。
+伙伴的名字以当前 Profile 为准,人格、职责与用户关系以当前 SOUL 和用户档案为准;历史
+回复中的自称错误不能反向变成人设。上下文压缩、运行时重建和更换模型不改变这个身份。
+Pi、Claude Code、Codex 是执行引擎,它们的原生工具说明不定义伙伴人格,也不代表用户
+正在使用对应 CLI。面向用户的配置指引应落到 Cindy 的实际入口;不能把 `/login`、
+`/model` 等原生终端命令推荐为伙伴聊天中的操作。用户明确询问独立 CLI 用法时可正常说明。
+
## 2. 所有权与挂靠关系
```text
@@ -142,7 +148,8 @@ harness + provider + model + effort + fastMode
- `start_session_task`:创建一条真正独立运行的 Cindy 任务。它出现在用户主任务列表里,拥有
完整 Cindy 能力面;用户明确说“开任务 / Session / 后台任务”,或开发、网页、文档等工作
- 需要独立交付和验证时使用。它没有 `target_bot_id`,也绝不以名为 Cindy 的伙伴代替。
+ 达到下述编码实施或中大型工作范围时主动使用。它没有 `target_bot_id`,也绝不以名为
+ Cindy 的伙伴代替。
- `send_to_agent`:给 `target_id` 指定的伙伴发送一条异步消息。它不建立任务,也没有进度、
停止或自动交付合同;对方可以在自己的正常 turn 里处理,并通过反向消息回答。
- `check_session_task`:按 `task_id` 读取一条后台任务的实时状态,只在用户追问或自动回传疑似
@@ -151,6 +158,18 @@ harness + provider + model + effort + fastMode
提问或计划确认;不得为了补充一句话重复创建任务。
- `stop_session_task`:按 `task_id` 停止这条后台任务。
+伙伴按工作量主动分工(2026-09-07 产品裁决):
+
+- 短时间、步骤少、范围明确的简单工作自己完成,例如问答、代码解释、简短片段、单条信息
+ 查询、单步操作或简单文件。不凭估计分钟数硬切,也不因出现“代码”或“文件”就一律分出去。
+- 编码实施(读改项目、调试与验证)和中大型工作(多来源调查、多文件处理、复杂分析或
+ 交付物)在进入长流程前主动开独立任务,不等用户提出委派,不为开任务本身再次征求同意。
+ 用户明确要求在当前交流中完成时尊重该要求;必要目标、材料和外部操作授权仍按实际缺口处理。
+- 简单工作中途扩大范围也应转交;交接带上目标、约束、相关文件、已知事实、已完成操作与
+ 验收要求。独立任务不自动继承聊天历史,不得重复已有副作用。
+- 伙伴仍负责最终交付:运行中不重复执行相同工作,结果返回后核对,缺项跟进同一任务,再以
+ 原伙伴身份回报。委派能力未挂载时不得承诺已开任务。
+
Session 任务遵守同一套机制与呈现契约:
- **统一状态机**:`queued → running ⇄ waiting → completed | failed | cancelled`。`waiting`
diff --git a/packages/lizi-mcps/src/lizi_xdtHelperMcpServer.ts b/packages/lizi-mcps/src/lizi_xdtHelperMcpServer.ts
index 981893e9a3..8285474f72 100644
--- a/packages/lizi-mcps/src/lizi_xdtHelperMcpServer.ts
+++ b/packages/lizi-mcps/src/lizi_xdtHelperMcpServer.ts
@@ -271,7 +271,8 @@ function registerStartSessionTaskEntry(
category: 'bots',
description: [
'Start one real independent Cindy Session task in the background.',
- 'Use this when the user explicitly asks to create/start a task, Session, or background task, and for development or deliverable work that should run independently with progress, cancellation, verification, and automatic result/artifact return.',
+ 'Proactively use this for coding implementation and medium or large work: reading/modifying a project and running checks, multi-source research, multi-file processing, or complex analysis and deliverables. Do not wait for the user to request delegation or ask permission merely to start a task. Handle short simple questions, code explanations, small snippets, and single-step work yourself unless the user explicitly requests a separate task. Respect an explicit request to work inline.',
+ 'Pass the objective, constraints, known facts, relevant files, completed actions, and acceptance criteria in instruction; the task does not automatically inherit this chat. Do not duplicate its work. Review the returned result and follow up on the same task if needed.',
"This never calls a Cindy Bot or any other teammate. Use send_to_agent for a bounded message to a named teammate.",
"The task appears in the user's task list and returns its completion automatically. Start it once and use check_session_task, message_session_task, or stop_session_task only when there is a concrete reason.",
].join('\n'),
diff --git a/packages/maker-core/src/agents/pi/cindy-bridge-source.ts b/packages/maker-core/src/agents/pi/cindy-bridge-source.ts
index 116b9fc748..a3b7445365 100644
--- a/packages/maker-core/src/agents/pi/cindy-bridge-source.ts
+++ b/packages/maker-core/src/agents/pi/cindy-bridge-source.ts
@@ -3142,7 +3142,7 @@ class CindyMcpGateway {
name: CINDY_START_SESSION_TASK_TOOL,
label: 'Start a Cindy Session task',
description:
- 'Start one real independent Cindy Session task in the background. Use it when the user explicitly asks to create a task, Session, or background task, and for development or deliverable work that needs independent execution, verification, progress, cancellation, and automatic result/artifact return. This never selects or wakes a Bot, including a Bot named Cindy. Start it once and do not poll.',
+ 'Start one real independent Cindy Session task in the background. Proactively use it for coding implementation and medium or large work: reading/modifying a project and running checks, multi-source research, multi-file processing, or complex analysis and deliverables. Do not wait for the user to request delegation or ask permission merely to start a task. Handle short simple questions, code explanations, small snippets, and single-step work yourself unless the user explicitly requests a separate task. Respect an explicit request to work inline. Include the objective, constraints, known facts, relevant files, completed actions, and acceptance criteria in instruction; the task does not automatically inherit this chat. This never selects or wakes a Bot, including a Bot named Cindy. Start it once, do not duplicate its work or poll, and review the result when it returns automatically.',
parameters: {
type: 'object',
properties: {