docs(orca,pi): verification summaries name the log path; sync gate doc

Greptile P2 x2: a pass/fail summary without the log path forces the lead
to ask where the details live, so lead rule 3/10 and worker rule 12 now
require command + outcome + log file path (failure may append the single
most relevant error line). pi-harness.md no longer describes the pre-
self-heal gate: first uninspected call is blocked once, auto-recorded
with the current schema and let through; real-tool permission prompts
still apply.

Signed-off-by: Zhang Yunjin <zhangyunjin@zju.edu.cn>
This commit is contained in:
Zhang Yunjin
2026-10-14 02:09:42 +08:00
parent 381937368a
commit 238d7d5774
3 changed files with 9 additions and 8 deletions

View File

@@ -55,10 +55,11 @@ Cindy 以 `pi --mode rpc` spawn pi 二进制(JSONL/stdio),`translator.ts` 把 pi
调用保留 600s 长预算。SSE response 按 event 增量消费,不等待 server 关闭持续流。Pi 模型侧
始终只注册 `cindy_mcp_list_tools` 与 `cindy_mcp_call_tool` 两个稳定网关 schema;完整工具目录与
input schema 留在 bridge 内部。先发现名称/描述,再按具体 server + tool 取单个 schema,
未检查 schema 的调用在 bridge 内 fail closed,不会触达 MCP 或弹权限框。Host 审批、策略与变更捕获仍使用真实
未检查 schema 的调用会被 bridge 拦下一次:按当前 schema 自动记账(审计日志一行)并放行,之后不再拦;
schema 变更后重新关门一次。真实工具的权限框照常弹出。Host 审批、策略与变更捕获仍使用真实
`mcp__<server>__<tool>` identity 和真实参数,不能退化成对网关包装器授权。上下文压缩成功后,bridge 会在
下一次运行开始前注入一条一次性的已披露工具清单提醒(display:false 常驻上下文),避免模型因压缩失忆
而重跑 `cindy_mcp_list_tools`;这是提示卫生,不改变门的任何判定。Claude Code 与
下一次运行开始前注入一条一次性的已披露工具清单提醒(display:false 常驻上下文;只列当前存在且指纹仍
匹配的工具),避免模型因压缩失忆而重跑 `cindy_mcp_list_tools`;这是提示卫生,不改变门的任何判定。Claude Code 与
Codex 保持各自的直接 MCP 注册方式,不经过此 Pi 专属网关。配置新增、修改、禁用或删除对
下一新建/重启会话生效;旧活动会话保留启动时 generation 快照至 close。
展示层通过共享 `parseMessageToolUse` 将网关调用还原为既有 MCP 工具名与参数;实时事件、

View File

@@ -230,12 +230,12 @@ describe('renderOrcaWorkerSystemPrompt', () => {
const leadPrompt = renderOrcaLeadSystemPrompt(null);
expect(leadPrompt).toContain('10. Token hygiene: do not re-issue a tool call just to re-fetch a result you already have and that is still current');
expect(leadPrompt).toContain('Re-running a state read after something changed, re-running verification after new edits, and retrying a failed call are not repetition.');
expect(leadPrompt).toContain('require gate/verification commands (build/test/smoke/LSP/md5/git) to be answered with a one-line pass/fail summary');
expect(leadPrompt).toContain('require gate/verification commands (build/test/smoke/LSP/md5/git) to be answered with a one-line pass/fail summary naming the command, the outcome and the log file path');
const workerPrompt = renderOrcaWorkerSystemPrompt(workerMeta);
expect(workerPrompt).toContain('12. Token hygiene: do not re-issue a tool call just to re-fetch a result you already have and that is still current');
expect(workerPrompt).toContain('Re-running a state read after something changed, re-running verification (build/test/smoke/LSP) after new edits, and retrying a failed call are not repetition.');
expect(workerPrompt).toContain('keep full output in a file and report only a one-line pass/fail summary to the lead');
expect(workerPrompt).toContain('report only a one-line pass/fail summary to the lead — command, outcome and the log file path');
});
it('keeps the Worker rule concise without the unreachable fallback', () => {

View File

@@ -66,7 +66,7 @@ export function renderOrcaLeadSystemPrompt(initialWorker?: OrcaInitialWorkerRef
'Rules:',
'1. Discuss task breakdown with the user before dispatching.',
'2. Before any dispatch, call get_workspace_info. For a multi-role request, resolve every requested role or label before dispatching any task; if any target is missing or its creation approval is unresolved, dispatch nothing, report all missing targets, and ask first. Use send_to_worker only for an existing worker that already matches the requested worker/session/role/label — messages queue automatically, so a running worker can take a new task too. Use create_worker only when the user explicitly asks to open one new worker, and use create_workers only when the user explicitly asks to open multiple new workers. If no existing worker matches a requested role or label, say so and ask whether to create one; do not silently substitute another worker or a native subagent. If the user assigns a task to a generic Orca Worker but no worker exists, say so and ask whether to create one; the assignment itself is not authorization to create it.',
'3. Dispatches must include Intent, Decisions, Boundaries, and Task; quote critical constraints and flag assumptions so workers can act independently. In the Task, require gate/verification commands (build/test/smoke/LSP/md5/git) to be answered with a one-line pass/fail summary, with full output redirected to a file instead of pasted into the conversation.',
'3. Dispatches must include Intent, Decisions, Boundaries, and Task; quote critical constraints and flag assumptions so workers can act independently. In the Task, require gate/verification commands (build/test/smoke/LSP/md5/git) to be answered with a one-line pass/fail summary naming the command, the outcome and the log file path — full output goes to that file, not the conversation; on failure append the single most relevant error line.',
'4. If a worker explicitly asks you to reply via send_to_worker, do so. The worker cannot see your conversation output — send_to_worker is the only way to reach it.',
'Use interrupt_worker only when the active task must not continue and the new instruction must replace it; for additional context or later work, use send_to_worker.',
'If get_workspace_info shows queued_count > 0 or queue_paused=true, call get_worker_queue_status first, then revise or withdraw one pending message, merge related messages, or send a separate task.',
@@ -76,7 +76,7 @@ export function renderOrcaLeadSystemPrompt(initialWorker?: OrcaInitialWorkerRef
'7. If you see "[Auto-bridged: ...]" in a worker message, it means the worker finished but forgot to call send_to_lead — the system bridged its output for you. Treat it the same as a normal worker report.',
'8. Before saying that all tasks are complete, verify every task from the terminal state reported by the same execution channel that ran it. A native subagent result is not evidence that an Orca Worker ran or completed.',
'9. In the final summary, label every delegated task with its actual execution channel: Orca Worker or native subagent.',
'10. Token hygiene: do not re-issue a tool call just to re-fetch a result you already have and that is still current — reuse that result instead. Re-running a state read after something changed, re-running verification after new edits, and retrying a failed call are not repetition. For verification commands (build/test/smoke/LSP/md5/git) you run yourself, keep full output in a file and surface only a one-line pass/fail summary.',
'10. Token hygiene: do not re-issue a tool call just to re-fetch a result you already have and that is still current — reuse that result instead. Re-running a state read after something changed, re-running verification after new edits, and retrying a failed call are not repetition. For verification commands (build/test/smoke/LSP/md5/git) you run yourself, keep full output in a file and surface only a one-line pass/fail summary that names the command, the outcome and the log file path; on failure append the single most relevant error line.',
];
if (initialWorker) {
@@ -113,7 +113,7 @@ export function renderOrcaWorkerSystemPrompt(meta: OrcaWorkerPromptMeta): string
'9. When first created, wait for the lead to assign a task. Do not proactively message the lead.',
'10. If the user asks for a "subagent" / "子代理", use your own native subagent mechanism (for example Codex spawn_agent, or the Claude Code Agent/Task tool) to handle it yourself — do NOT escalate to the lead for it, and do NOT call start_team / create_worker (you cannot create Orca workers). An Orca Worker is never a substitute for a subagent.',
'11. An [Orca UI Assignment] may include a Lead session id and snapshot_before_ms because the Lead did not compose the assignment. If the task depends on current work, continuing work, this PR, or other relative context, use read_lead_history to inspect the owning Lead transcript before acting; pass snapshot_before_ms as from_ms when present. This read is scoped to your Lead and does not wake it. If the task is self-contained, proceed without reading history.',
'12. Token hygiene: do not re-issue a tool call just to re-fetch a result you already have and that is still current — reuse that result instead. Re-running a state read after something changed, re-running verification (build/test/smoke/LSP) after new edits, and retrying a failed call are not repetition. For gate/verification commands, keep full output in a file and report only a one-line pass/fail summary to the lead.',
'12. Token hygiene: do not re-issue a tool call just to re-fetch a result you already have and that is still current — reuse that result instead. Re-running a state read after something changed, re-running verification (build/test/smoke/LSP) after new edits, and retrying a failed call are not repetition. For gate/verification commands, keep full output in a file and report only a one-line pass/fail summary to the lead — command, outcome and the log file path; on failure append the single most relevant error line.',
];
return lines.join('\n');