From 1c90312c022579e85535e99d57c37218e108af81 Mon Sep 17 00:00:00 2001 From: cflmy Date: Thu, 22 Oct 2026 15:17:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(ai):=20M10=20=E6=8A=8A=E3=80=8C=E6=8E=A5?= =?UTF-8?q?=E4=B8=8D=E4=BA=86=E5=B0=B1=E7=94=B3=E6=8A=A5=E3=80=8D=E5=86=99?= =?UTF-8?q?=E8=BF=9B=20agent=20=E6=8F=90=E7=A4=BA=E8=AF=8D=EF=BC=88standin?= =?UTF-8?q?g=20+=20how-to-act=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 两处: 1) how-to-act 协议段(每轮都带):无法真正接通的capability 不许静默伪造、不许声称完成, 改写成带状态的遮蔽,例如 [按关键词检索,接口未接,待开发](None); 桩必须能跑并写清返回值(None 亦可);收尾用 labels.search 自查。 2) 默认 standing(p):追加一句"接不了就在描述里申报(待开发/模拟),别假装成功"。 为什么两处:standing 定基调(每轮开头),how-to-act 定动作(每轮), 只写一处会被长上下文冲淡或缺动机。 设计要点:给范式而非规则(可直接抄)、给返回值要求(对应 label.empty_payload)、 给自查动作(labels.search)、用英文与既有协议一致。 验证:marqdo check ext/ai/agent.mq.md(occlusion 模式)通过; grep 确认两处文本落地;全量回归 587 passed / 0 failed(不改逻辑)。 文档:doc/design/change-m10-engineering-habits.md --- doc/design/change-m10-engineering-habits.md | 73 +++++++++++++++++++++ ext/ai/agent.mq.md | 4 +- 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 doc/design/change-m10-engineering-habits.md diff --git a/doc/design/change-m10-engineering-habits.md b/doc/design/change-m10-engineering-habits.md new file mode 100644 index 0000000..6572590 --- /dev/null +++ b/doc/design/change-m10-engineering-habits.md @@ -0,0 +1,73 @@ +# 变更记录:M10 工程化落点(README + agent 提示词) + +| | | +|---|---| +| 状态 | **Implemented** | +| 日期 | 2026-10-22 | +| 里程碑 | M10([occlusion-description-and-search.md](occlusion-description-and-search.md) §5) | +| 改动文件 | `ext/ai/agent.mq.md`(README 一节已在文档阶段落地) | + +--- + +## 1. 改了什么 + +把「接不了就申报,别假装完成」写进 **agent 的默认提示词**,两处: + +### 1.1 `how-to-act` 协议段(每轮都会带) + +``` +Call ONLY names listed under --- tools --- (whitelist). … +If a capability cannot truly be wired, do NOT fake it silently and never claim it works: +write an occlusion with an explicit status, e.g. [按关键词检索,接口未接,待开发](None). +Stubs must run without error and must state their return value (None is acceptable). +Before finishing, check your own declarations with labels.search. +Tools run via Marqdo subtask (spawn fn / wait). +``` + +### 1.2 默认 standing(`p`) + +``` +You are a Marqdo agent. Code is documentation: … not a hidden system prompt. +When you cannot wire a capability, declare it in the description (待开发 / 模拟) +instead of faking success. +``` + +**为什么这两处**:standing 定基调(每次对话开头),how-to-act 定动作(每轮)。 +只写 standing 容易被长上下文冲淡;只写 how-to-act 又缺"为什么要申报"。 + +--- + +## 2. 设计要点 + +| 要点 | 说明 | +|------|------| +| 给**范式**而不是规则 | 直接给出可抄的 `[按关键词检索,接口未接,待开发](None)`,模型不必发明措辞 | +| 给**返回值**要求 | "必须写清返回什么(None 也行)"——对应 `label.empty_payload` 的 warning | +| 给**自查**动作 | `labels.search` 让模型收尾时能自己盘点,而不是靠人提醒 | +| 用**英文**写 | 与既有 standing / 协议段语言一致(模型对英文指令更稳) | + +--- + +## 3. 验证 + +| 项 | 结果 | +|----|------| +| `marqdo check ext/ai/agent.mq.md`(occlusion 模式) | `contract check OK` | +| 提示词文本落入模块 | `grep` 命中 2 处(standing 与 how-to-act 各 1) | +| 全量回归 | 587 passed / 0 failed(与 M9 相同,本改动不动逻辑) | + +--- + +## 4. 边界 + +- 提示词是**建议**,不是门禁;违反不会被拒绝,但会在描述/诊断里暴露。 +- `labels.search` 需要 M7 翻转默认后对 classic 文档才有意义;提示词先就位。 + +--- + +## 5. 变更清单 + +| 文件 | 变更 | +|------|------| +| `ext/ai/agent.mq.md` | how-to-act 协议段与默认 standing 各追加申报约定 | +| `doc/design/change-m10-engineering-habits.md` | 本文件 | diff --git a/ext/ai/agent.mq.md b/ext/ai/agent.mq.md index a283eef..5e40989 100644 --- a/ext/ai/agent.mq.md +++ b/ext/ai/agent.mq.md @@ -36,7 +36,7 @@ The runbook `.mq.md` is ground truth (code as documentation). Default budgets ke **skill = > skill_brief depth=`skill_depth`** **task_s = > json.stringify value=`task`** -**esc = > json.parse text={"a":"\n\n--- standing ---\n","b":"\n\n--- task ---\n","c":"\n\n--- tools ---\n","d":"\n\n--- call site ---\n","e":"\n\n--- source (.mq.md) ---\n","f":"\n\n--- marqdo skill ---\n","g":"\n\n--- how to act ---\nCall ONLY names listed under --- tools --- (whitelist). If that section is empty or says none, do NOT emit CALL / 调用 — reply with the final answer only.\nNever CALL internal framework helpers (build_step_context, plan, inspect_workbook, etc.).\nContext is budgeted: if you see a [truncated …] marker, you may first emit exactly one line READ:source or READ:skill (Chinese: 读取:source|skill) to deepen, then you will be re-prompted.\nWhen calling an allowed tool, reply with exactly one line: CALL:\n(Chinese ok: 调用:)\nOtherwise reply with the final answer only.\nTools run via Marqdo subtask (spawn fn / wait).\n"}** +**esc = > json.parse text={"a":"\n\n--- standing ---\n","b":"\n\n--- task ---\n","c":"\n\n--- tools ---\n","d":"\n\n--- call site ---\n","e":"\n\n--- source (.mq.md) ---\n","f":"\n\n--- marqdo skill ---\n","g":"\n\n--- how to act ---\nCall ONLY names listed under --- tools --- (whitelist). If that section is empty or says none, do NOT emit CALL / 调用 — reply with the final answer only.\nNever CALL internal framework helpers (build_step_context, plan, inspect_workbook, etc.).\nContext is budgeted: if you see a [truncated …] marker, you may first emit exactly one line READ:source or READ:skill (Chinese: 读取:source|skill) to deepen, then you will be re-prompted.\nWhen calling an allowed tool, reply with exactly one line: CALL:\n(Chinese ok: 调用:)\nOtherwise reply with the final answer only.\nIf a capability cannot truly be wired, do NOT fake it silently and never claim it works: write an occlusion with an explicit status, e.g. [按关键词检索,接口未接,待开发](None). Stubs must run without error and must state their return value (None is acceptable). Before finishing, check your own declarations with labels.search.\nTools run via Marqdo subtask (spawn fn / wait).\n"}** **a = > json.get value=`esc` key="a"** **b = > json.get value=`esc` key="b"** **c = > json.get value=`esc` key="c"** @@ -45,7 +45,7 @@ The runbook `.mq.md` is ground truth (code as documentation). Default budgets ke **f = > json.get value=`esc` key="f"** **g = > json.get value=`esc` key="g"** -**p = "You are a Marqdo agent. Code is documentation: this runbook source and call site are your ground truth — not a hidden system prompt."** +**p = "You are a Marqdo agent. Code is documentation: this runbook source and call site are your ground truth — not a hidden system prompt. When you cannot wire a capability, declare it in the description (待开发 / 模拟) instead of faking success."** **p = p + a + up + b + task_s + d + site_s + c + tools_s + e + src + f + skill + g** *p*