@thincoder/core 0.11.3 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/advisor/compaction.mjs +40 -17
  3. package/advisor/loop.mjs +14 -6
  4. package/advisor/notice.mjs +1 -1
  5. package/advisor/timeline.mjs +4 -4
  6. package/agent/completion.mjs +19 -0
  7. package/agent/dispatch-gates.mjs +2 -0
  8. package/agent/dispatch.mjs +2 -2
  9. package/agent/family-tools.mjs +13 -9
  10. package/agent/helpers.mjs +10 -6
  11. package/agent/planning-step.mjs +453 -0
  12. package/agent/post-turn.mjs +70 -2
  13. package/agent/run-stages.mjs +22 -50
  14. package/agent/run-start.mjs +17 -0
  15. package/agent/setup-reminders.mjs +71 -8
  16. package/agent/setup.mjs +8 -39
  17. package/agent/spawn-child.mjs +6 -2
  18. package/agent/task-lifecycle.mjs +146 -0
  19. package/agent/turn-loop.mjs +73 -11
  20. package/agent-tools/batch-closeout.mjs +21 -34
  21. package/agent-tools/batch-gate.mjs +7 -5
  22. package/agent-tools/batch-ledger-bind.mjs +21 -1
  23. package/agent-tools/batch-lifecycle.mjs +7 -7
  24. package/agent-tools/batch-record-write.mjs +237 -280
  25. package/agent-tools/batch-supersede.mjs +3 -3
  26. package/agent-tools/batch.mjs +42 -9
  27. package/agent-tools/context.mjs +0 -13
  28. package/agent-tools/escalate-async.mjs +7 -1
  29. package/agent-tools/parent-channel.mjs +7 -6
  30. package/agent-tools/plan.mjs +103 -67
  31. package/agent-tools/review-facts.mjs +3 -3
  32. package/agent-tools/settings.mjs +2 -0
  33. package/agent-tools/spawn-gates.mjs +37 -11
  34. package/agent-tools/ssh-session.mjs +68 -25
  35. package/agent-tools/ssh-transfer.mjs +7 -2
  36. package/agent-tools/ssh-transport.mjs +2 -2
  37. package/agent-tools/ssh-vault.mjs +2 -2
  38. package/agent-tools/step.mjs +462 -0
  39. package/agent-tools/subagent-actions.mjs +6 -1
  40. package/agent-tools/subagent-run.mjs +7 -0
  41. package/agent-tools/subagent-spawn.mjs +1 -1
  42. package/agent-tools/subagent.mjs +17 -11
  43. package/agent-tools/task.mjs +178 -26
  44. package/agent-tools.mjs +1 -0
  45. package/agent.mjs +2 -0
  46. package/config-defaults.mjs +17 -1
  47. package/config-migrate.mjs +8 -5
  48. package/config.mjs +7 -0
  49. package/context.mjs +5 -4
  50. package/declaration.mjs +4 -4
  51. package/generate-title.mjs +0 -6
  52. package/i18n.mjs +4 -0
  53. package/ledger-cmd.mjs +11 -1
  54. package/ledger-tools.mjs +15 -4
  55. package/manifest-schema.mjs +1 -0
  56. package/model-context.mjs +34 -11
  57. package/model-specs.mjs +5 -2
  58. package/package.json +1 -1
  59. package/prompt-files.mjs +48 -11
  60. package/prompt-overlays.mjs +79 -8
  61. package/prompts/advisor-design.md +253 -206
  62. package/prompts/advisor-round1.md +151 -145
  63. package/prompts/advisor-round2.md +136 -130
  64. package/prompts/advisor-round3.md +140 -134
  65. package/prompts/common.md +244 -96
  66. package/prompts/consult-base.md +29 -30
  67. package/prompts/discipline-engineering.md +73 -519
  68. package/prompts/discipline-normal.md +28 -136
  69. package/prompts/knowledge/batch-before-write.md +8 -0
  70. package/prompts/knowledge/batch-cycle-register.md +15 -0
  71. package/prompts/knowledge/batch-progress-ledger.md +29 -0
  72. package/prompts/knowledge/business-gates.md +24 -24
  73. package/prompts/knowledge/decision-quality.md +8 -19
  74. package/prompts/knowledge/doc-discipline-d-rules.md +63 -0
  75. package/prompts/knowledge/doc-lookup.md +25 -24
  76. package/prompts/knowledge/document-writing.md +11 -32
  77. package/prompts/knowledge/documentation-evaluation.md +42 -42
  78. package/prompts/knowledge/eng-dispatch-ops.md +34 -0
  79. package/prompts/knowledge/eng-ledger-ops.md +26 -0
  80. package/prompts/knowledge/evidence-discipline.md +10 -32
  81. package/prompts/knowledge/normal-batch-discipline.md +13 -0
  82. package/prompts/knowledge/normal-coding-workflow.md +97 -99
  83. package/prompts/knowledge/normal-delivery-collaboration.md +107 -112
  84. package/prompts/knowledge/normal-work-management.md +44 -44
  85. package/prompts/knowledge/product-security.md +7 -26
  86. package/prompts/knowledge/project-records.md +69 -64
  87. package/prompts/knowledge/tool-advisor.md +17 -17
  88. package/prompts/knowledge/tool-apply-patch.md +14 -14
  89. package/prompts/knowledge/tool-bash.md +32 -31
  90. package/prompts/knowledge/tool-batch-eng-coder.md +19 -13
  91. package/prompts/knowledge/tool-batch-eng-designer.md +21 -14
  92. package/prompts/knowledge/tool-batch-review.md +18 -12
  93. package/prompts/knowledge/tool-batch.md +93 -85
  94. package/prompts/knowledge/tool-browser.md +59 -59
  95. package/prompts/knowledge/tool-code-search.md +2 -2
  96. package/prompts/knowledge/tool-consult-start.md +6 -6
  97. package/prompts/knowledge/tool-consult-stop.md +3 -3
  98. package/prompts/knowledge/tool-context.md +4 -4
  99. package/prompts/knowledge/tool-delete.md +16 -16
  100. package/prompts/knowledge/tool-doc-check.md +39 -39
  101. package/prompts/knowledge/tool-doc-graph-read.md +11 -11
  102. package/prompts/knowledge/tool-doc-graph.md +48 -48
  103. package/prompts/knowledge/tool-doc-search.md +3 -3
  104. package/prompts/knowledge/tool-edit.md +30 -30
  105. package/prompts/knowledge/tool-eng.md +1 -1
  106. package/prompts/knowledge/tool-execute.md +16 -16
  107. package/prompts/knowledge/tool-fetch.md +15 -15
  108. package/prompts/knowledge/tool-file-ops.md +15 -15
  109. package/prompts/knowledge/tool-get-current-time.md +3 -3
  110. package/prompts/knowledge/tool-git-read.md +15 -15
  111. package/prompts/knowledge/tool-git.md +26 -26
  112. package/prompts/knowledge/tool-glob.md +14 -14
  113. package/prompts/knowledge/tool-goal.md +5 -5
  114. package/prompts/knowledge/tool-grep.md +19 -18
  115. package/prompts/knowledge/tool-hashline-edit.md +13 -13
  116. package/prompts/knowledge/tool-insert-after.md +14 -14
  117. package/prompts/knowledge/tool-instance-list.md +3 -3
  118. package/prompts/knowledge/tool-instance-send.md +5 -5
  119. package/prompts/knowledge/tool-knowledge.md +12 -12
  120. package/prompts/knowledge/tool-ledger-read.md +20 -20
  121. package/prompts/knowledge/tool-ledger.md +44 -44
  122. package/prompts/knowledge/tool-lint.md +10 -10
  123. package/prompts/knowledge/tool-ls.md +11 -11
  124. package/prompts/knowledge/tool-lsp.md +8 -8
  125. package/prompts/knowledge/tool-main-history.md +1 -1
  126. package/prompts/knowledge/tool-manifest-read.md +7 -7
  127. package/prompts/knowledge/tool-manifest.md +43 -32
  128. package/prompts/knowledge/tool-memory-read.md +12 -12
  129. package/prompts/knowledge/tool-memory.md +14 -14
  130. package/prompts/knowledge/tool-notify-parent.md +10 -10
  131. package/prompts/knowledge/tool-operations.md +88 -88
  132. package/prompts/knowledge/tool-peek.md +10 -0
  133. package/prompts/knowledge/tool-peer-instances.md +1 -1
  134. package/prompts/knowledge/tool-plan.md +6 -3
  135. package/prompts/knowledge/tool-process-read.md +8 -8
  136. package/prompts/knowledge/tool-process.md +11 -11
  137. package/prompts/knowledge/tool-question.md +11 -13
  138. package/prompts/knowledge/tool-read-history-batch.md +13 -13
  139. package/prompts/knowledge/tool-read-history.md +19 -19
  140. package/prompts/knowledge/tool-read-image.md +8 -8
  141. package/prompts/knowledge/tool-read.md +17 -17
  142. package/prompts/knowledge/tool-recent-changes.md +4 -4
  143. package/prompts/knowledge/tool-repo-outline.md +2 -2
  144. package/prompts/knowledge/tool-settings-read.md +5 -7
  145. package/prompts/knowledge/tool-settings.md +10 -10
  146. package/prompts/knowledge/tool-skill.md +4 -4
  147. package/prompts/knowledge/tool-ssh.md +66 -66
  148. package/prompts/knowledge/tool-step.md +26 -0
  149. package/prompts/knowledge/tool-subagent.md +52 -50
  150. package/prompts/knowledge/tool-task.md +14 -11
  151. package/prompts/knowledge/tool-team-ledger-read.md +7 -7
  152. package/prompts/knowledge/tool-team-ledger.md +13 -13
  153. package/prompts/knowledge/tool-timer.md +14 -14
  154. package/prompts/knowledge/tool-tree.md +11 -11
  155. package/prompts/knowledge/tool-verify.md +11 -11
  156. package/prompts/knowledge/tool-wait-for.md +20 -20
  157. package/prompts/knowledge/tool-websearch.md +16 -14
  158. package/prompts/knowledge/tool-write.md +10 -10
  159. package/prompts/knowledge/upstream-protocol.md +37 -38
  160. package/prompts/persona-coder.md +22 -22
  161. package/prompts/persona-eng-coder.md +87 -81
  162. package/prompts/persona-eng-designer.md +173 -153
  163. package/prompts/persona-engineering.md +53 -554
  164. package/prompts/persona-explore.md +18 -15
  165. package/prompts/persona-normal.md +62 -63
  166. package/prompts/persona-plan.md +36 -32
  167. package/prompts/persona-tester.md +39 -39
  168. package/prompts/planning-next-moves.md +9 -0
  169. package/prompts/subagent-base.md +4 -16
  170. package/provider/errors.mjs +0 -24
  171. package/provider/list-models.mjs +20 -2
  172. package/session-lifecycle.mjs +4 -3
  173. package/tool-args.mjs +25 -0
  174. package/tool-docs/peek.md +3 -0
  175. package/tool-docs/plan.md +1 -1
  176. package/tool-docs/question.md +1 -1
  177. package/tool-docs/step.md +3 -0
  178. package/tools/edit-diff.mjs +4 -4
  179. package/tools/index.mjs +3 -2
  180. package/tools/peek.mjs +447 -0
  181. package/tools/question.mjs +87 -9
  182. package/tools/ssh.mjs +1 -1
  183. package/window-policy.mjs +107 -80
@@ -1,29 +1,29 @@
1
1
  aliases: 评审, 顾问, 设计评审, 代码评审
2
- `type` is REQUIRED — one of exactly two values, no default and no silent fallback.
2
+ `type` 必填 —— 只能是两个值之一,没有默认值,也没有静默回退。
3
3
 
4
- - `type="design"` — design review: reviews design / requirement documents BEFORE implementation. Pass `documents=[...]` and `batchDoc` — the batch record this review belongs to. **`batchDoc` is required**: a design review without it is refused before launch.
5
- - `type="code"` — code review: reviews the code you changed AFTER implementation. Pass `paths=[...]` to scope files/directories; `documents=[...]` adds acceptance-criteria context.
4
+ - `type="design"` —— 设计评审:在实施之前评审设计文档。需求文档是尺子,应一并列入 `documents` 供对照,不是被审对象。传 `documents=[...]` 与 `batchDoc` —— 本次评审所属的批次档。**`batchDoc` 必填**:缺了它的设计评审在发起前即被拒绝。
5
+ - `type="code"` —— 代码评审:在实施之后评审你改动的代码。传 `paths=[...]` 划定文件或目录范围;`documents=[...]` 补充验收判据的上下文。
6
6
 
7
- `documents` — one rule: a relative path resolves against the session project root (e.g. `docs/<area>/<name>.md`); an absolute path is used as-is.
7
+ `documents` —— 一条规则:相对路径按会话项目根解析(例如 `docs/<area>/<name>.md`);绝对路径原样使用。
8
8
 
9
- The relative form needs the session anchor to be inside a project. When the anchor is a workspace root (several projects below it, no manifest of its own) there is no single project root to resolve against, and a relative path is refused with `no-project-root` — write the absolute path there.
9
+ 相对形式要求会话锚点位于某个项目之内。当锚点是工作区根(其下有几个项目、自身没有清单)时,没有唯一的项目根可供解析,相对路径会以 `no-project-root` 被拒绝 —— 那里请写绝对路径。
10
10
 
11
- Accepted = an existing `.md` file anywhere inside a project — a doc sitting at the repo root counts. Anything else is refused with the resolved path, the reason and the two expected forms.
11
+ 可接受 = 项目内任意位置一个已存在的 `.md` 文件 —— 放在仓库根的一份文档也算。其余一律拒绝,并给出解析后的路径、原因与两种可接受的形式。
12
12
 
13
- A call without a type (or with a conflicting `object.type`) is refused.
13
+ 不带 type 的调用(或 `object.type` 自相冲突的调用)被拒绝。
14
14
 
15
- Returns the verdict: all-clear (call `verify`) or a findings list to fix.
15
+ 返回裁决:全部通过(调用 `verify`),或一份待修的问题清单。
16
16
 
17
- The advisor is an independent read-only sub-agent (explores the codebase, reads files, traces callers via grep/lsp).
17
+ advisor 是一个独立的只读子代理(探索代码库、读文件、用 grep/lsp 追调用方)。
18
18
 
19
- - Code review converges: round 1 full review → round 2 verifies the agent's fix claims → round 3+ re-checks only the fix claims.
20
- - Design review is a single pass against methodology and requirements.
21
- - Criteria come from `.thincoder/advisor.md` (if present) or sensible defaults.
22
- - After the review you MUST produce a response table (format = discipline rules); on all-clear, call `verify`.
19
+ - 代码评审收敛:第 1 轮全量评审 → 第 2 轮核验 agent 的修复主张 → 第 3 轮起只复核修复主张。
20
+ - 设计评审是对照需求、通读设计方法的一轮。
21
+ - 判据来自 `.thincoder/advisor.md`(若存在)或合理的默认值。
22
+ - 评审之后你**必须**产出一张响应表(格式 = 纪律规则);全部通过时调用 `verify`。
23
23
 
24
- `object={type,target,status,reason,exclude}` — optional; it declares what this review is about, and absent = no declaration (the review then judges whatever `documents` / `paths` name).
24
+ `object={type,target,status,reason,exclude}` —— 可选;它声明这次评审针对什么,缺省 = 不作声明(此时评审判断的就是 `documents` / `paths` 指名的东西)。
25
25
 
26
- ASYNC (depth 0 only): pass `async: true` to run the review in the background — omitting it is refused (pass `async: false` for the blocking review). The ack returns immediately; the report arrives automatically in a digest turn.
26
+ ASYNC(仅深度 0):传 `async: true` 让评审在后台跑 —— 省略即被拒绝(阻塞式评审传 `async: false`)。确认立即返回;报告会在一个摘要轮里自动送达。
27
27
 
28
- - One shared pool: `agent.poolLimits.advisor`, default 4 — configurable via `/config` or the same key in the user config file. Pool-full and same-scope launches are refused stating the current limit; launch reviews one at a time.
29
- - Inside a child (depth>0) reviews are always synchronous (`async:true` rejected).
28
+ - 一个共享池:`agent.poolLimits.advisor`,默认 4 —— 可通过 `/config` 或用户配置文件里的同名键调整。池满与同范围发起都会被拒绝,并说明当前上限;评审逐个发起。
29
+ - 在子代理内(深度>0)评审永远是同步的(`async:true` 被拒绝)。
@@ -1,17 +1,17 @@
1
1
  aliases: 补丁, 多档修改, 批量写盘
2
- **Use it for whole-file and multi-file changes**: creating several new files at once (`--- /dev/null` header per file), whole-file replacement, and cross-file refactors — one unified-diff call covers the whole change.
3
- All-or-nothing: every hunk is checked before anything is written, one permission ask and one turn instead of N separate calls.
2
+ **用它做整档改动与多档改动**:一次创建几个新文件(每个文件一个 `--- /dev/null` 头)、整档替换、跨文件重构 —— 一次 unified diff 调用覆盖整个改动。
3
+ 全有或全无:每个 hunk 都检查过才开始写盘,一次权限询问、一个轮次,而不是 N 次分别调用。
4
4
 
5
- Parameters:
6
- - patch (required): unified diff text. One `--- a/path` / `+++ b/path` header pair per file, then `@@ -old,count +new,count @@` hunks. `--- /dev/null` creates a new file. The `+++ b/path` pair may be omitted for existing files — a lone `--- a/path` (or `--- b/path`) header followed directly by hunks applies to that path; new files still need `--- /dev/null` + `+++ b/path`.
7
- - ledger: the in-flight ledger row this call serves — `"#N"` or `"N"`.
8
- - project: the project root holding `PROJECT-MANIFEST.json` (absolute or cwd-relative).
5
+ 参数:
6
+ - patch(必填):unified diff 文本。每个文件一对 `--- a/path` / `+++ b/path` 头,随后是 `@@ -old,count +new,count @@` 形式的 hunk。`--- /dev/null` 创建新文件。对已存在的文件,`+++ b/path` 这一对可以省略 —— 单写一个 `--- a/path`(或 `--- b/path`)头、紧跟 hunk,就作用于该路径;新文件仍需 `--- /dev/null` + `+++ b/path`。
7
+ - ledger:这次调用所服务的在途台账行 —— `"#N"` 或 `"N"`。
8
+ - project:存放 `PROJECT-MANIFEST.json` 的项目根(绝对路径或相对于 cwd)。
9
9
 
10
- Notes:
11
- - A hunk header `@@` without coordinates is accepted: that hunk is located by its context and removed (-) lines and applies only on a unique match.
12
- A pure-addition hunk needs at least 2 context lines. A hunk that removes at least one line is anchored by those removed lines,
13
- so it may carry no context at all — a context line is a courtesy there, not a requirement.
14
- - Hunks are located by context and removed lines, not line numbers, and the context must match the file EXACTLY: read the files first and build the patch from actual content. A context matching several locations is rejected — add surrounding lines.
15
- - For one file, `edit` is simpler; to rewrite a file whole, `write` is simpler. Deleting files is not supported — use `delete`.
16
- - Returns the applied-file summary (`Applied patch to N file(s)`, per-file change lines, syntax-check notes for changed .mjs files).
17
- - A failure in the write phase reports every file block in patch order (`modified` / `created` / `not committed`), the failed block as `<path> — failed: <reason>`, and a final line `apply_patch: <k>/<M> file(s) applied, <M−k> failed` plus the committed paths. Files already committed stay on disk and are never rolled back.
10
+ 注意:
11
+ - 不带坐标的 hunk 头 `@@` 也接受:该 hunk 按它的上下文行与删除(-)行定位,并且只在唯一匹配处生效。
12
+ 纯新增的 hunk 至少需要 2 行上下文。至少删掉一行的 hunk 由那些删除行锚定,
13
+ 因此它可以完全不带上下文 —— 上下文行在那里是礼貌,不是要求。
14
+ - hunk 按上下文与删除行定位,不按行号,且上下文必须与文件**完全一致**:先读文件,再按实际内容构造补丁。上下文能匹配多个位置的补丁被拒绝 —— 请加上周边行。
15
+ - 只改一个文件时,`edit` 更简单;要整档重写,`write` 更简单。删除文件不支持 —— 用 `delete`。
16
+ - 返回已应用文件的摘要(`Applied patch to N file(s)`、逐文件的改动行数、被改动 .mjs 文件的语法检查提示)。
17
+ - 写盘阶段有失败时,按补丁顺序报告每个文件块(`modified` / `created` / `not committed`),失败块报成 `<path> — failed: <reason>`,最后一行是 `apply_patch: <k>/<M> file(s) applied, <M−k> failed` 加上已提交的路径。已经提交的文件留在盘上,永不回滚。
@@ -1,25 +1,25 @@
1
1
  aliases: 命令行, 终端, 执行命令, shell
2
- Use for running commands, builds, tests.
2
+ 用来跑命令、构建、测试。
3
3
 
4
- **Route to a dedicated tool instead of bash:**
4
+ **改用专用工具,而不是 bash:**
5
5
  - `cat file` / `head` / `tail` → `read`
6
6
  - `ls` / `dir` → `ls`
7
- - `find` / glob search → `glob`
7
+ - `find` / glob 搜索 → `glob`
8
8
  - `grep` / `rg` → `grep`
9
- - `echo >` / `sed` / `printf >` / `cat << EOF` → `write` / `edit` / `hashline_edit` / `apply_patch` (preferred: write tools handle encoding/EOL correctly)
10
- - `git diff` / `git status` / `git log` → `git` tool
9
+ - 改文件内容 → `write` / `edit` / `hashline_edit` / `apply_patch`(改一处也一样;命令工具写盘几乎必因字符集写坏)
10
+ - `git diff` / `git status` / `git log` → `git` 工具
11
11
 
12
- Parameters:
13
- - command (required): Shell command to execute
14
- - timeout: Timeout in milliseconds (default 120000 for synchronous runs; background runs have no default — an explicit timeout still applies; no upper bound)
15
- - filter: Optional — a regex; only output lines matching it are returned (case-insensitive). Synchronous runs only: a background run has no result to filter, so it returns a note and you grep its log instead.
16
- Use it instead of hand-writing a pipe into `findstr`/`grep`.
17
- - async: Run in the background (default false) — returns an ack at once (bash#<id>, log path); the result arrives as a digest when the process exits. Depth-0 only.
18
- - ledger: the in-flight ledger row this call serves — `"#N"` or `"N"`.
19
- - project: the project root holding `PROJECT-MANIFEST.json` (absolute or cwd-relative).
20
- `bash` has no locating parameter of its own, and `project` does not change where the command runs.
12
+ 参数:
13
+ - command(必填):要执行的 shell 命令
14
+ - timeout:超时毫秒数(同步运行默认 120000;后台运行没有默认值 —— 显式给的超时仍然生效;没有上限)
15
+ - filter:可选 —— 一个正则;只返回匹配它的输出行(不区分大小写)。仅同步运行可用:后台运行没有可过滤的结果,它会返回一句说明,你就去 grep 它的日志。
16
+ 用它,而不是手写管道接 `findstr`/`grep`。
17
+ - async:在后台运行(默认 false)—— 立即返回一个确认(bash#<id>、日志路径);进程退出时结果以摘要送达。仅深度 0 可用。
18
+ - ledger:这次调用所服务的在途台账行 —— `"#N"` 或 `"N"`。
19
+ - project:存放 `PROJECT-MANIFEST.json` 的项目根(绝对路径或相对于 cwd)。
20
+ `bash` 自身没有定位参数,`project` 不会改变命令运行的位置。
21
21
 
22
- Output format:
22
+ 输出格式:
23
23
  ```
24
24
  [stdout]:
25
25
  <standard output, or "(empty)">
@@ -30,19 +30,20 @@ Output format:
30
30
  (exit code N)
31
31
  ```
32
32
 
33
- Notes:
34
- - There is NO TTY — editors, pagers (vim, less), and interactive prompts WILL hang. Always pass non-interactive flags: `git commit -m`, `git --no-pager`, `-y`/`--yes` where applicable
35
- - The environment sets GIT_PAGER=cat, PAGER=cat, EDITOR=true, TERM=dumb — but still always use non-interactive flags
36
- - Output is capped twice, in characters, by two independent limits. Each stream (stdout and stderr) keeps accumulating only while its buffer is under 2,000,000 characters; beyond that the rest of that stream is dropped with no notice.
37
- The assembled result is then cut to 200,000 characters, and a cut result ends with `[... truncated: N chars omitted — redirect to a file if you need the full output]`, where N counts what this second cut removed.
38
- The missing tail may contain errors, so read the saved log file's tail before trusting success.
39
- Use `filter` to narrow instead of hand-piping.
40
- Redirecting to a file to rescue a large output is one of the two exceptions to the NEVER rule at the end of this list: those bytes come from the command, not from you.
41
- - Check `[stderr]` for error messages, warnings, and diagnostic output — it is separated from `[stdout]` so you can quickly identify problems.
42
- - Shell identity: the bash tool's shell is NOT fixed — it depends on configuration and environment. The current executor is declared in the session head's `Shell:` item, together with the version it reports; write commands for THAT shell, and when a command fails read its error output to identify the actual shell.
43
- - Never use bash to read, copy, or transmit secret files (.env, keys, tokens)
44
- - Do NOT run destructive commands (rm -rf, force-push, drop table) without explicit user confirmation
45
- - After commands that change files (git checkout, npm install, etc.), repo_outline and code_search may be stale — re-run them to get current results.
46
- - Prefer read/glob/grep/ls for file operations inside the project — file tools and bash reach the same paths (no directory restriction).
47
- - NEVER write or modify file CONTENT through bash (`echo > file`, `sed -i`, `printf >`, heredoc, …). Use write/edit/insert_after/apply_patch instead — they handle encoding, escaping, and EOL conventions correctly.
48
- Two things this rule does not forbid: redirecting a command's own output to a file to rescue a large result (see the output-cap note above), and `bash mkdir`, which creates a directory and writes no content.
33
+ 注意:
34
+ - 这里**没有** TTY —— 编辑器、分页器(vim、less)与交互式提示**会**挂起。永远传非交互参数:`git commit -m`、`git --no-pager`、能用的地方加 `-y`/`--yes`
35
+ - 环境已设置 GIT_PAGER=cat、PAGER=cat、EDITOR=true、TERM=dumb —— 但仍要永远使用非交互参数
36
+ - 输出按字符数被两道独立上限各截一次。每条流(stdout 与 stderr)只在其缓冲区低于 2,000,000 字符时继续累积;超过之后该流的余下部分被丢弃,且不作提示。
37
+ 拼装好的结果再被截到 200,000 字符;被截的结果末尾是 `[... truncated: N chars omitted — redirect to a file if you need the full output]`,其中 N 计的是这第二次截断删掉的内容。
38
+ 丢失的尾部可能含有错误,所以在信任成功之前,先读已保存日志文件的尾部。
39
+ 用 `filter` 收窄,而不是手写管道。
40
+ 把大输出重定向到文件抢救,是本表末尾「绝不」规则的两个例外之一:那些字节来自命令,不是来自你。
41
+ - 查 `[stderr]` 里的错误信息、警告与诊断输出 —— 它与 `[stdout]` 分开,让你能快速定位问题。
42
+ - Shell 身份:bash 工具用的 shell **不**固定 —— 它取决于配置与环境。当前执行器声明在会话头的 `Shell:` 项里,连同它报告的版本;按**那个** shell 写命令,命令失败时读它的错误输出以确认实际的 shell。
43
+ - 绝不用 bash 读、复制或传输机密文件(.env、密钥、token)
44
+ - 没有用户明确确认,**不要**运行破坏性命令(rm -rf、force-push、drop table)
45
+ - 跑过会改动文件的命令(git checkout、npm install 等)之后,repo_outline 与 code_search 可能已经过期 —— 重跑它们以拿到当前结果。
46
+ - 项目内的文件操作优先用 read/glob/grep/ls —— 文件工具与 bash 到达同一批路径(没有目录限制)。
47
+ - **绝不**通过命令工具改文件内容。改一处和改一批一样。判据是字节怎么落到盘上,不是命令长什么样:一行 `-replace`、`Set-Content`、`sed -i`、重定向,和写一个脚本再跑,是同一类。改用 write/edit/insert_after/apply_patch。编辑工具报错,只许重读、再调编辑工具、或停下问,不许改走命令工具写盘。
48
+ 命令工具写盘几乎一定会把文件写坏,因为字符集对不上。
49
+ 这条规则不禁两件事:把命令自身的输出重定向到文件以抢救大结果(见上面的输出上限说明),以及 `bash mkdir` —— 它创建目录,不写任何内容。
@@ -1,19 +1,25 @@
1
1
  aliases: 批次档, 实施记录, 工程实施
2
- Three write steps: `append` (add text to the END of §5), `edit` (replace one anchored range inside it), `status` (§5's status line).
2
+ 四个写入步骤:`append`(把文本加到 §5 的**末尾**)、`edit`(替换它内部一个带锚的范围)、`update`(经 `entries` 一次原子应用多条 §5 的 `append`/`edit`)、`status`(§5 的状态行)。
3
3
 
4
- The record is the one bound to this spawn and its path arrives with the spawn, so there is no path parameter — one record serves one concurrent spawn, and yours is the in-flight one you were given.
4
+ 记录就是与本次派生绑定的那一份,它的路径随派生一起送到,因此没有路径参数 —— 一份记录服务一个并发派生,你的那份就是你拿到的在途记录。
5
5
 
6
- `read` is on this face too and writes nothing: with no `segment` it returns the record's section index, and with `segment` + `offset` one window of that section (1-based, at most 200 lines; the receipt names the next `offset`).
7
- It reads the whole record, not only §5 — §1 carries the rulings and §2 the task book.
6
+ `read` 也在这一面,且不写任何东西:不给 `segment` 时返回记录的小节索引,给 `segment` + `offset` 时返回该小节的一个窗口(1 起算,最多 200 行;回执会给出下一个 `offset`)。
7
+ 它读整份记录,不只是 §5 —— §1 载着裁决,§2 是任务书。
8
8
 
9
- - `append` — `text` goes to the end of §5. Limit 20000 characters per call; longer is refused, so split it.
10
- A line that STARTS with the status-line form (`**状态行**:…`) is refused: no channel adds such a line here,
11
- and this channel may only make such lines fewer, never more.
12
- Quote it with a leading `> `, or write prose.
13
- The delivery summary, the decision-disclosure table, the audit and review rounds and the terminal state land here — write it as the round actually ran.
14
- - `edit` — `oldText` must match exactly once, byte for byte, inside §5; `newText` replaces it (empty `newText` deletes it). Refused with nothing written: a blank `oldText`, zero hits, two or more hits (the matching lines are named), an anchor crossing the section boundary, an anchor touching the protected status line, and a replacement that would introduce a status line or leave more of them than before.
15
- - `status` — `value` carries exactly ONE legal keyword of §5's word list — `进行中` (in flight) or `实施完成` (that section's done word) — plus decoration (surrounding symbols, a trailing ISO date, whitespace); prose goes to `note` and lands as a parenthetical.
9
+ - `append` —— `text` 落到 §5 末尾。每次调用上限 20000 字符;更长会被拒绝,请拆开。
10
+ **以**状态行形式开头的行(`**状态行**:…`)会被拒绝:这里没有任何通道添加这种行,
11
+ 而本通道只能让它更少,绝不能让它更多。
12
+ 要用它,就加前导 `> ` 引用,或者写成叙述。
13
+ 交付摘要、决策披露表、核对与评审轮次以及终态都落在这里 —— 照这一轮实际怎么跑的就怎么写。
14
+ - `edit` —— `oldText` 必须在 §5 内逐字节精确匹配一次;`newText` 替换它(`newText` 为空即删除)。下列情形被拒绝且不写任何东西:`oldText` 为空、零命中、两处及以上命中(会列出匹配的行)、锚跨越小节边界、锚碰到受保护的状态行,以及替换文本会引入状态行或让状态行比原先更多。
15
+ - `status` —— `value` 只能携带 §5 词表里**一个**合法关键字 —— `进行中`(在途)或 `实施完成`(该小节的完成词)—— 外加装饰(外围符号、末尾 ISO 日期、空白);叙述放进 `note`,以括号形式落盘。
16
16
 
17
- `segment` names the section you write — `"§5"` is this face's pen. Everything else belongs to another author: §1 discussion, §2 design, §3 design review findings, §4 user approval and §6 verification are written by their own seats, and writing them is refused.
17
+ `segment` 指名你写的小节 —— `"§5"` 是这一面的笔。其余各段归别的作者:§1 讨论、§2 设计、§3 设计评审结论、§4 用户批准与 §6 核验由各自的席位写,写它们会被拒绝。
18
18
 
19
- The record is a process document, droppable whole once the round closes, so nothing normative may live only in it — a rule that must outlive the round belongs in the design document.
19
+ 记录是过程文档,一轮收口后可以整份丢弃,因此任何规范性内容都不能只活在它里面 —— 必须活过这一轮的规则属于设计文档。
20
+
21
+ **批次循环勾要。**
22
+
23
+ | 逐字规则名 | 消费面 |
24
+ |---|---|
25
+ | `Batch cycle — landing check and §5` | eng-coder:append / edit / status 三步,交付落 §5,写没落盘报「§5 not written」。 |
@@ -1,20 +1,27 @@
1
1
  aliases: 批次档, 设计段, 工程设计
2
- Three write steps: `append` (add text to the END of §2), `edit` (replace one anchored range inside it), `status` (§2's status line).
2
+ 四个写入步骤:`append`(把文本加到 §2 的**末尾**)、`edit`(替换它内部一个带锚的范围)、`update`(经 `entries` 一次原子应用多条 §2 的 `append`/`edit`)、`status`(§2 的状态行)。
3
3
 
4
- The record is the one bound to this spawn and its path arrives with the spawn, so there is no path parameter — one record serves one concurrent spawn, and yours is the in-flight one you were given.
4
+ 记录就是与本次派生绑定的那一份,它的路径随派生一起送到,因此没有路径参数 —— 一份记录服务一个并发派生,你的那份就是你拿到的在途记录。
5
5
 
6
- `read` is on this face too and writes nothing: with no `segment` it returns the record's section index, and with `segment` + `offset` one window of that section (1-based, at most 200 lines; the receipt names the next `offset`).
7
- It reads the whole record, not only §2 — §1 carries the rulings and §3 the previous round.
6
+ `read` 也在这一面,且不写任何东西:不给 `segment` 时返回记录的小节索引,给 `segment` + `offset` 时返回该小节的一个窗口(1 起算,最多 200 行;回执会给出下一个 `offset`)。
7
+ 它读整份记录,不只是 §2 —— §1 载着裁决,§3 是上一轮。
8
8
 
9
- - `append` — `text` goes to the end of §2. Limit 20000 characters per call; longer is refused, so split it.
10
- A line that STARTS with the status-line form (`**状态行**:…`) is refused: no channel adds such a line here,
11
- and this channel may only make such lines fewer, never more.
12
- Quote it with a leading `> `, or write prose.
13
- - `edit` — `oldText` must match exactly once, byte for byte, inside §2; `newText` replaces it (empty `newText` deletes it). Refused with nothing written: a blank `oldText`, zero hits, two or more hits (the matching lines are named), an anchor crossing the section boundary, an anchor touching the protected status line, and a replacement that would introduce a status line or leave more of them than before.
14
- - `status` — `value` carries exactly ONE legal keyword of §2's word list — `进行中` (in flight) or `设计完成` (that section's done word) — plus decoration
15
- (surrounding symbols, a trailing ISO date, whitespace); prose goes to `note` and lands as a parenthetical.
16
- Reading a status needs exactly one status line in the header zone — with two or more it reads as unset and `status` refuses, naming the repair order.
9
+ - `append` —— `text` 落到 §2 末尾。每次调用上限 20000 字符;更长会被拒绝,请拆开。
10
+ **以**状态行形式开头的行(`**状态行**:…`)会被拒绝:这里没有任何通道添加这种行,
11
+ 而本通道只能让它更少,绝不能让它更多。
12
+ 要用它,就加前导 `> ` 引用,或者写成叙述。
13
+ - `edit` —— `oldText` 必须在 §2 内逐字节精确匹配一次;`newText` 替换它(`newText` 为空即删除)。下列情形被拒绝且不写任何东西:`oldText` 为空、零命中、两处及以上命中(会列出匹配的行)、锚跨越小节边界、锚碰到受保护的状态行,以及替换文本会引入状态行或让状态行比原先更多。
14
+ - `status` —— `value` 只能携带 §2 词表里**一个**合法关键字 —— `进行中`(在途)或 `设计完成`(该小节的完成词)—— 外加装饰
15
+ (外围符号、末尾 ISO 日期、空白);叙述放进 `note`,以括号形式落盘。
16
+ 读状态要求头部区域恰好只有一行状态行 —— 两行及以上会读成未设置,`status` 因此拒绝,并给出修复的顺序。
17
17
 
18
- `segment` names the section you write — `"§2"` is this face's pen. Everything else belongs to another author: §1 discussion, §3 design review findings, §4 user approval, §5 implementation record and §6 verification are written by their own seats, and writing them is refused.
18
+ `segment` 指名你写的小节 —— `"§2"` 是这一面的笔。其余各段归别的作者:§1 讨论、§3 设计评审结论、§4 用户批准、§5 实施记录与 §6 核验由各自的席位写,写它们会被拒绝。
19
19
 
20
- The record is a process document, droppable whole once the round closes, so nothing normative may live only in it.
20
+
21
+ **批次循环勾要。**
22
+
23
+ | 逐字规则名 | 消费面 |
24
+ |---|---|
25
+ | `Batch cycle — the loop` | eng-designer:append / edit / status 三步与拒因,§2 写面。 |
26
+
27
+ 记录是过程文档,一轮收口后可以整份丢弃,因此任何规范性内容都不能只活在它里面。
@@ -1,18 +1,24 @@
1
1
  aliases: 批次档, 评审轮次, 评审结论
2
- Three write steps: `append` (add a round to the END of §3), `edit` (replace one anchored range inside it), `status` (§3's status line).
2
+ 四个写入步骤:`append`(把一轮加到 §3 的**末尾**)、`edit`(替换它内部一个带锚的范围)、`update`(经 `entries` 一次原子应用多条 §3 的 `append`/`edit`)、`status`(§3 的状态行)。
3
3
 
4
- The record is the one bound to this review instance and its path arrives with the instance key, so there is no path parameter.
4
+ 记录就是与这个评审实例绑定的那一份,它的路径随实例键一起送到,因此没有路径参数。
5
5
 
6
- `read` is on this face too and writes nothing: with no `segment` it returns the record's section index, and with `segment` + `offset` one window of that section (1-based, at most 200 lines; the receipt names the next `offset`).
7
- It reads the whole record, not only §3 — §1 carries the rulings and §2 the task book this review judges.
6
+ `read` 也在这一面,且不写任何东西:不给 `segment` 时返回记录的小节索引,给 `segment` + `offset` 时返回该小节的一个窗口(1 起算,最多 200 行;回执会给出下一个 `offset`)。
7
+ 它读整份记录,不只是 §3 —— §1 载着裁决,§2 是本次评审判断的任务书。
8
8
 
9
- - `append` — a design-review round belongs here: one row per finding (`#` / severity / status / evidence), the evidence cell holding a pointer — a section number, a symbol name, or the exact words of the line — plus the VERDICT line and the counts.
10
- The report's own paragraphs stay out. The round heading (`### 轮次 N(评审子代理)`) is tool-generated; do not write your own, it would be dropped. Limit 20000 characters per call.
11
- A line that STARTS with the status-line form (`**状态行**:…`) is refused: no channel adds such a line here,
12
- and this channel may only make such lines fewer, never more.
13
- - `edit` — `oldText` must match exactly once, byte for byte, inside §3; `newText` replaces it (empty `newText` deletes it). Refused with nothing written: a blank `oldText`, zero hits, two or more hits, an anchor crossing the section boundary, an anchor touching the protected status line, and a replacement that would introduce a status line or leave more of them than before.
14
- - `status` — `value` carries exactly ONE legal keyword of §3's word list — `进行中` (in flight) or `评审通过` (that section's done word) — plus decoration (surrounding symbols, a trailing ISO date, whitespace); prose goes to `note` and lands as a parenthetical.
9
+ - `append` —— 一轮设计评审就落在这里:每条结论一行(`#` / 严重度 / 状态 / 证据),证据格放一个指针 —— 小节号、符号名,或该行的原话 —— 再加上 VERDICT 行与计数。
10
+ 报告自身的段落留在外面。轮次标题(`### 轮次 N(评审子代理)`)由工具生成;不要自己写,写了会被丢弃。每次调用上限 20000 字符。
11
+ **以**状态行形式开头的行(`**状态行**:…`)会被拒绝:这里没有任何通道添加这种行,
12
+ 而本通道只能让它更少,绝不能让它更多。
13
+ - `edit` —— `oldText` 必须在 §3 内逐字节精确匹配一次;`newText` 替换它(`newText` 为空即删除)。下列情形被拒绝且不写任何东西:`oldText` 为空、零命中、两处及以上命中、锚跨越小节边界、锚碰到受保护的状态行,以及替换文本会引入状态行或让状态行比原先更多。
14
+ - `status` —— `value` 只能携带 §3 词表里**一个**合法关键字 —— `进行中`(在途)或 `评审通过`(该小节的完成词)—— 外加装饰(外围符号、末尾 ISO 日期、空白);叙述放进 `note`,以括号形式落盘。
15
15
 
16
- `segment` names the section you write — `"§3"` is this face's pen. Everything else belongs to another author: §1 discussion, §2 design, §4 user approval, §5 implementation record and §6 verification are written by their own seats, and writing them is refused.
16
+ `segment` 指名你写的小节 —— `"§3"` 是这一面的笔。其余各段归别的作者:§1 讨论、§2 设计、§4 用户批准、§5 实施记录与 §6 核验由各自的席位写,写它们会被拒绝。
17
17
 
18
- A finding enters the record only with a pointer that resolves — an evidence cell pointing at nothing is a reading, not proof the thing exists.
18
+ 一条结论只有在指针解析得通时才进记录 —— 证据格指向空处,那是一次读数,不是那东西存在的证明。
19
+
20
+ **批次循环勾要。**
21
+
22
+ | 逐字规则名 | 消费面 |
23
+ |---|---|
24
+ | `Batch cycle — review convergence and the §3 landing` | 评审实例:一轮一条结论表、VERDICT 行、计数,报告正文不进块。 |
@@ -1,94 +1,102 @@
1
1
  aliases: 批次档, 批次记录, 任务书
2
- Each section has one author: `append` adds text at its end, `edit` rewrites its lines in place,
3
- and `status` writes the status line — with one exception.
4
- An `append` or `edit` that leaves content in §2 or §5 sets that section's done word in the same write
5
- (`设计完成` / `实施完成`), so a writer who never calls `status` can still leave a completed section behind.
2
+ 每一节只有一位作者:`append` 在它的末尾加文本,`edit` 就地重写它的行,
3
+ `status` 写状态行 —— 有一个例外。
4
+ 一次在 §2 或 §5 留下内容的 `append` 或 `edit`,会在同一次写入里设置该节的完成词
5
+ (`设计完成` / `实施完成`),因此从不调用 `status` 的写者也能留下一个已完成的节。
6
6
 
7
- No write is silent. A pre-write refusal leaves the file byte-for-byte unchanged (`Nothing was written.`); a later failure rolls the record back, or names the rollback failure and points at `check`.
7
+ 没有静默的写入。写盘前的拒绝让文件逐字节保持不变(`Nothing was written.`);之后的失败会回滚记录,或者指名回滚失败并指向 `check`。
8
8
 
9
- - create (depth-0 only): write a new six-section skeleton record — `path`, `topic` (the subject the header and file name share), `source` (REQUIRED, the origin line), plus optional `ledger` / `board` filling the `台账` header line, and `date` / `prev` for the date and predecessor pointer.
10
- - `ledger:"#N"` takes over an existing row. Omitted, it opens a new row — but only when no unsettled row exists on the same board; otherwise refused with the candidate list, and you pass `newDebt:"<why this is new>"` or `ledger:"#<id>"`.
11
- - Omitting both claims a **reserved** row for this path: register intent first with `ledger add` (`task_book` = `docs/batches/<x>.md(预定)`, marker at the tail); creating that path later takes it over — no second row, pointer becomes the plain form. Two reserved rows for one path are refused, each named.
12
- - attach (depth-0 only): hang a ledger row on an ALREADY EXISTING in-flight record — a reopened record taking on new work, where create cannot go (file exists) and a settled row has no way back.
13
- - `title` is required and opens a new row (its own subject, never the batch's); or take over an unsettled one with `ledger:"#<id>"`. The number lands at the end of the header `台账` list; the parenthesis group (board · trigger) stays as is — changing it is a plain document write.
14
- - Its ledger parameters are create's own: `ledger` / `newDebt` / `board`, same meaning and same-face rule. Replaying the same attach is zero-write once the number is in that list; a settled row is never reopened here.
15
- - attach skips the dead-placeholder gate on purpose: a header still carrying `#<编号>` is already real on the ledger side, and attach is how that placeholder becomes a number.
16
- - Refused, nothing written: the record is frozen (reopen first, or start a new batch), its §1 status line is unreadable, the header has no `台账` line, a new row without `title`, or a face with unsettled rows and no `newDebt` reason.
17
- - append: add `text` to the END of YOUR section — existing lines stay byte-for-byte.
18
- A line that STARTS with the status-line form (`**状态行**:…`) is refused: no channel adds such a line here,
19
- and this channel may only make such lines fewer, never more.
20
- Quote it with a leading `> `, or write prose.
21
- - edit: replace one anchored range inside YOUR OWN section — `oldText` must match exactly once, byte for byte (line endings included). `newText` replaces it; empty deletes it. Limit 20000 characters per call — the same cap append enforces. Refused, nothing written: blank `oldText`, zero hits, two or more hits (matching lines named), an anchor crossing the section boundary, an anchor touching the section's FIRST `**状态行**:` line, or a replacement that introduces a status line or leaves more than before. Deleting a surplus status line is allowed — the repair path for a section that reads as unset.
22
- - status: update YOUR section's `**状态行**:` line. `value` carries exactly ONE legal keyword of your section's word list (the schema enumerates them) plus decoration only — symbols, a trailing ISO date, whitespace. Prose goes to `note`, landing as a parenthetical.
23
- - A section's status reads only with exactly one status line in its header zone; two or more read as unset and `status` refuses, naming the repair order (edit the surplus away, then rewrite the remaining one; on §1 the main agent repairs it with a document write).
24
- - Writing §1 `已收口` is a full closeout, not a status flip: it runs the same five arms `close` lists, in the same order and under the same skip rule; a refusal at any arm refuses this write too and writes nothing.
25
- The chain arm's content rule: §2 / §3 / §4 / §6 must each carry content (§1 and §5 are exempt); the `不适用` declaration is retired, so any `> 不适用:§N` line in §1 is refused outright.
26
- After the arms it behaves like `close` as well: `completed` and `closeEvidence` required, design tokens consumed, record frozen, ledger rows reanchored — it is the only `status` call accepting those two.
27
- - Reopen a frozen record with §1 → `进行中` and `note` = the reason: the tool rewrites the status line and appends a `重开记录` line, touching nothing else.
28
- - A reopen reverses a recorded decision, so it is all-or-nothing: if the ledger rows cannot return to 在途, the record rolls back to the frozen bytes and the call is refused with the reason named. A record reading as open while its rows stay 待核销 refuses every write and is never left standing silently.
29
- - close (depth-0 only): freeze the record — §1 → `已收口 <date>`; every further write is refused except the reopen conjunction. A close runs five arms in order, and a refusal at any arm writes nothing. Arms ① ② ⑤ run on the normal edge only — a repair close and a supersede skip them; arms ③ ④ run on every edge:
30
- ① the chain gate — §2 / §3 / §4 / §6 each carry content (the missing ones are named);
31
- ② §3's status word reads `评审通过`;
32
- ③ the batch's unit-test files are off disk;
33
- ④ the document-check gate is neither REFUSED nor ERROR;
34
- ⑤ the tier arm — a code file over the closeout line in this batch's changed surface needs its split plan in §2's machine-readable table (a missing §2 block is not itself a refusal).
35
- - **Repair close (`补关`)**: when this record's own rows are all archived (non-empty, every row `已核销` / `已废弃`) and the only reading against it is `open-but-settled`, the content gate and the §3 pass arm are skipped and the record freezes. Qualification is a reading, not a guess: with §1 reading 进行中, run `check` first — the qualifying reading is `open-but-settled` as the only inconsistency, exit line 直接收口(活已做完、档未冻结). One `**补关记录**:<date> · 行集全归档(<N> 行)· §3/§4/§6 未补写 · 操作者 = 主 agent` line is appended to §1 and the receipt carries `[ledger repair]`. No row is rewritten and no section content is invented.
36
- - Everything else still runs: the unit-test-file gate, the document-check gate, `completed`, `closeEvidence`, design-token consumption, the reanchor. A row set still holding in-flight work is not a repair case — the chain gate applies as usual. An all-archived batch reading as any other inconsistency (`header-row-missing` etc.) is refused with every reading listed and a pointer to `check`. A record whose §1 status line is unreadable cannot enter repair close — repair §1 first.
37
- - `completed` is required: a number array of every completed 在途 row. Ids unique, belonging to this record, currently 在途. `[]` only when no 在途 row remains.
38
- - `closeEvidence` is required: one line of what this batch actually did, landing in every settled row behind a `收口 <YYYY-MM-DD>:` prefix. Blank is refused before anything is written — the machine never writes this sentence, or the close-proof gate would be decoration.
39
- - Closing settles in the same action: each listed 在途 row goes 在途 → 待核销 → 已核销 in one transaction, and this batch's existing 待核销 rows settle with them. Closing leaves zero 在途 and zero 待核销.
40
- - A missing, duplicate, unknown, foreign or non-在途 id is refused before tokens, the record or the ledger are written. Return unfinished 在途 rows to 待讨论 first.
41
- - Waiting rows still reanchor to `条件` with the resume sentence 「原批 <record> 已收口,须另起批次接手」. A non-empty resume_when is preserved and the sentence appended to evidence; inactive `认账不排期` rows stay untouched.
42
- - Every settled row is named in a `[ledger reanchor]` line, and the two starts read differently: `#N 「title」在途 → 待核销 → 已核销` and `#N 「title」待核销 → 已核销` — the second is work already done and merely unbooked.
43
- - The record is written first and the ledger second, so the irreversible side goes last. If the ledger write fails, the record rolls back to its pre-write bytes and the call is refused, so you can retry as it stands. If that rollback also fails, the refusal says so and points at `check`: inconsistent rows need repair, while a closed and fully settled batch must not be retried.
44
- - supersede (depth-0 only): freeze a record whose object is gone, that will never be implemented, and that can name its successor. The third closeout edge: `close` needs the whole chain and a repair close needs every row archived, so a dropped batch's finished rows would otherwise stay unsettled forever.
45
- - `supersededBy` is required and is a fact only you can give. Machine-checked forms: a batch record path (on disk), a document plus a section (`docs/<area>/<name>.md §<N>`, the number hitting a heading line, neither side a digit or dot), or a commit (40 hex, reachable). A planned or never-done successor does not resolve and is refused; naming this record is refused too — keeping it alive is the reopen path.
46
- - `closeEvidence` is required exactly as on close: one line of what this batch did before it was dropped. Blank (missing / empty / whitespace) is refused before anything is written; it lands in every settled row behind the `收口 <date>:` prefix.
47
- - It neither fills §3 / §4 / §6 to make `close` pass (that is fabrication) nor leaves them blank: one `**取代记录**:<date> · 由 <successor> 取代 · 本批无实施记录(§5 未写)· §3/§4/§6 未补写 · 结算 <N> 行 · 改挂条件 <M> 行 · 操作者 = 主 agent` line is appended to §1, and the status line becomes `已收口 <date>(被取代)`.
48
- - Rows go where they belong: this batch's `待核销` rows settle to `已核销` (evidence behind the `收口 <date>:` prefix), and each unnamed `在途` row returns to `待讨论` with trigger `条件` and the resume sentence — the work was not done, and the receipt says so instead of claiming it. `completed` is therefore optional: list a row only if this batch really finished it.
49
- - Refused, nothing written: `supersededBy` missing or resolving back to this record, the record is not open, its ledger cannot be read (the all-archived case is unjudgeable without it), every row is already archived (use `close` — repair close covers it), §5 already carries content (that batch was implemented, so the "no implementation record" line would be a lie), or `closeEvidence` is blank.
50
- - Everything else still runs: the unit-test-file gate, the document-check gate, `closeEvidence`, design-token consumption, record-first ledger-second with rollback. The receipt carries a `[ledger supersede]` line naming every settled and every returned row.
51
- - The six inconsistencies it can name: `closed-but-open-rows` (frozen with 在途 rows, or 待讨论 / 待设计 rows whose trigger is neither 条件 nor 认账不排期) · `closed-but-settling` (frozen, rows still 待核销) · `open-but-unwritable` (open, no 在途 row left but 待核销 rows exist) · `open-but-settled` (not frozen — `open`, or an unreadable §1 line — with a non-empty row set entirely archived, expected after reopening a fully settled batch; a repair-close entry only when §1 reads 进行中) · `pointer-stale` (a row whose task_book does not resolve) · `header-row-missing` (a header 台账 number with no same-id items row).
52
- - `header-row-missing` judges existence only: a row that still exists but was legitimately unbound does not count. Drop the missing number from the header with a document write; rerunning attach is the secondary path, subject to the same-face rule.
53
- - A reserved pointer (`…md(预定)`) is not `pointer-stale`: its record does not exist yet, and that is its legal state.
54
- - Every `status` and `close` receipt ends with one `[ledger consistency]` line: `一致(本批 N 行)`, or the inconsistent items with their way out. It reports; it never repairs and never blocks.
55
- - read (read-only; every seat that holds this tool, and it writes nothing): the six sections are readable whether or not you can write them — §1 carries the rulings, §3 the previous round, §5 the implementation record.
56
- - No `segment` ⇒ the record's index: the header rows (编制 / 台账 / 批起 sha), one line per section carrying its status word and body line count (`无状态行` when the section has no readable status line), and a tail line with the absolute path and the shape of the next call.
57
- - `segment` + `offset` ⇒ one window of that section's body: first line `§N · 行 a-b / 共 T`, then the body lines, then — while lines remain — the next `offset`.
58
- - `offset` is required whenever `segment` is given, 1-based (the first body line is 1), and a window carries at most 200 lines.
59
- - Refused, nothing written, the parameter named: `segment` without `offset`, a segment the record does not carry, and an `offset` that is not an integer ≥ 1 or runs past that section's body.
60
- - A closed record reads the same as an open one — freezing is a write gate; the target is the same binding as `append` / `edit`, so sub-agents and reviews pass no `path`.
9
+ - create(仅深度 0):写一份新的六段骨架记录 —— `path`、`topic`(头部与文件名共用的主题)、`source`(必填,来源行),另可选 `ledger` / `board` 填 `台账` 标题行,以及 `date` / `prev` 填日期与前身指针。
10
+ - `ledger:"#N"` 接管一个已存在的行。省略时它开一个新行 —— 但只在同一板块上没有未结行时才允许;否则被拒绝并给出候选清单,你要传 `newDebt:"<why this is new>"` 或 `ledger:"#<id>"`。
11
+ - 两者都省略,则为这个路径认领一个**预定**行:先用 `ledger add` 登记意图(`task_book` = `docs/batches/<x>.md(预定)`,标记在尾部);之后创建该路径即接管它 —— 不会出现第二行,指针变成普通形式。同一路径两条预定行会被拒绝,并逐条指名。
12
+ - attach(仅深度 0):把一条台账行挂到一个**已经存在**的在途记录上 —— 重开的记录接新活时用,那里 create 走不通(文件已存在),已结的行也没有回头路。
13
+ - `title` 必填,会开一个新行(用它自己的主题,绝不用批次的主题);或者用 `ledger:"#<id>"` 接管一个未结行。编号落在头部 `台账` 列表末尾;括号组(板块 · 触发)保持原样 —— 改它属于一次普通的文档写入。
14
+ - 它的台账参数就是 create 的那几个:`ledger` / `newDebt` / `board`,含义与同面孔规则一致。编号一旦进入那个列表,重放同一次 attach 是零写入;已结的行绝不在这里重开。
15
+ - attach 有意跳过死占位闸:仍带着 `#<编号>` 的头部在台账侧已经是真实存在的,而 attach 正是让那个占位变成编号的途径。
16
+ - 拒绝,不写任何东西:记录已冻结(先重开,或另起一个新批次)、它的 §1 状态行读不出来、头部没有 `台账` 行、新行缺 `title`,或该面孔上有未结行却没有 `newDebt` 理由。
17
+ - append:把 `text` 加到**你那一节**的末尾 —— 已有的行逐字节保持原样。
18
+ **以**状态行形式开头的行(`**状态行**:…`)会被拒绝:这里没有任何通道添加这种行,
19
+ 而本通道只能让它更少,绝不能让它更多。
20
+ 要用它,就加前导 `> ` 引用,或者写成叙述。
21
+ - edit:替换**你自己那一节**内部一个带锚的范围 —— `oldText` 必须逐字节精确匹配一次(换行符也算)。`newText` 替换它;为空即删除。每次调用上限 20000 字符 —— 与 append 的上限相同。拒绝,不写任何东西:`oldText` 为空、零命中、两处及以上命中(会列出匹配的行)、锚跨越小节边界、锚碰到该节第一行 `**状态行**:`,或替换文本引入状态行、或让状态行比原先更多。删掉多余的状态行是允许的 —— 那是把读成未设置的节修回来的路径。
22
+ - update:批量原子更新 —— 用 `entries` 数组(1–20 条,每条 `{ op: "append"|"edit", segment, text | oldText+newText }`)在**同一次调用**里按序写入多节或多处范围。同一回合需要写 2+ 节(或同一节改多处)时优先用 `update` 减少工具往返。每条均过与单笔完全相同的段白名单、锚判据、状态行保护与 §3/§5 门,最后统一过一次文档机检门并单次落盘;任一条失败或被机检门拒绝则整笔回滚、零字节落盘。
23
+ - status:更新**你那一节**的 `**状态行**:` 行。`value` 只能携带你那一节词表里的**一个**合法关键字(schema 会枚举它们),外加纯装饰 —— 符号、末尾 ISO 日期、空白。叙述放进 `note`,以括号形式落盘。
24
+ - 一节的状态只有在头部区域恰好一行状态行时才读得出来;两行及以上会读成未设置,`status` 因此拒绝,并给出修复顺序(先把多余的那行 edit 掉,再重写剩下的那行;§1 上由主 agent 用一次文档写入修复)。
25
+ - 把 §1 写成 `已收口` 是一次完整收口,不是翻一下状态:它跑 `close` 列出的同样五臂,顺序相同、跳过规则相同;任一臂拒绝,这次写入也一起拒绝,且不写任何东西。
26
+ 链闸的内容规则:§2 / §3 / §4 / §6 各自必须载有内容(§1 与 §5 豁免);`不适用` 声明已退役,因此 §1 里任何 `> 不适用:§N` 行都被直接拒绝。
27
+ 跑完各臂之后它的行为也同 `close`:`completed` 与 `closeEvidence` 必填,设计令牌被消费,记录被冻结,台账行被改挂 —— 它是唯一接受这两个参数的 `status` 调用。
28
+ - 用 §1 → `进行中` 且 `note` = 理由来重开一份冻结的记录:工具重写状态行并追加一行 `重开记录`,别的什么都不碰。
29
+ - 重开是在推翻一个已记录的决定,因此是全有或全无:如果台账行回不到 在途,记录回滚到冻结时的字节,调用被拒绝并指名理由。记录读作已开而它的行仍停在 待核销 时,拒绝每一次写入,并且绝不静默地放着不管。
30
+ - close(仅深度 0):冻结记录 —— §1 → `已收口 <date>`;此后除重开那一组合外,每一次写入都被拒绝。close 按顺序跑五臂,任一臂拒绝就什么都不写。臂 ① ② ⑤ 只在普通收口边上跑 —— 补关与取代会跳过它们;臂 ③ ④ 在每条边上都跑:
31
+ ① 链闸 —— §2 / §3 / §4 / §6 各自载有内容(缺的会被指名);
32
+ ② §3 的状态词读作 `评审通过`;
33
+ ③ 本批的单元测试文件已离开磁盘;
34
+ ④ 文档检查闸既不是 REFUSED 也不是 ERROR;
35
+ ⑤ 档位臂 —— 本批改动面里超过收口线的代码文件,需要在 §2 的机器可读表里有它的分拆方案(缺 §2 这一块本身不算拒绝)。
36
+ - **`补关`**(repair close):当这份记录自己的行全部归档(非空,每一行都是 `已核销` / `已废弃`)且对它的唯一不一致读数是 `open-but-settled` 时,跳过内容闸与 §3 通过臂,记录照常冻结。资格是一条读数,不是猜的:§1 读作 进行中 时,先跑 `check` —— 合格读数是 `open-but-settled` 作为唯一的不一致,退出行是 直接收口(活已做完、档未冻结)。在 §1 追加一行 `**补关记录**:<date> · 行集全归档(<N> 行)· §3/§4/§6 未补写 · 操作者 = 主 agent`,回执带 `[ledger repair]`。不重写任何行,也不编造任何小节内容。
37
+ - 其余步骤照跑:单元测试文件闸、文档检查闸、`completed`、`closeEvidence`、设计令牌消费、改挂。行集里仍有无结活的不是补关情形 —— 链闸照常生效。全部归档的批次若还读作出别的不一致(`header-row-missing` 等),被拒绝并列出每一条读数、指向 `check`。§1 状态行读不出来的记录进不了补关 —— 先修 §1。
38
+ - `completed` 必填:一个数字数组,列出每一个已完成的 在途 行。id 唯一、属于这份记录、当前是 在途。只有在一行 在途 都不剩时才允许 `[]`。
39
+ - `closeEvidence` 必填:一行,写本批实际做了什么,落在每一个被结的行里,前面加 `收口 <YYYY-MM-DD>:` 前缀。空白在写入之前即被拒绝 —— 机器永不代写这句话,否则收口证明闸就成了装饰。
40
+ - 收口在同一次动作里完成结算:列出的每条 在途 行在一个事务里走 在途 → 待核销 → 已核销,本批已有的 待核销 行随之一起结掉。收口之后留下零条 在途 与零条 待核销。
41
+ - id 缺失、重复、未知、属于别的记录或不在 在途,都在令牌、记录或台账被写之前拒绝。先把没做完的 在途 行退回 待讨论。
42
+ - 等待中的行仍改挂到 `条件`,附续起句「原批 <record> 已收口,须另起批次接手」。非空的 resume_when 保留,句子追加到 evidence;未激活的 `认账不排期` 行原样不动。
43
+ - 每条被结的行都在 `[ledger reanchor]` 行里被指名,两种起点读法不同:`#N 「title」在途 → 待核销 → 已核销` 与 `#N 「title」待核销 → 已核销` —— 后者是活已做完、只是没记账。
44
+ - 先写记录,后写台账,所以不可逆的那一侧放最后。台账写入失败时,记录回滚到写前字节,调用被拒绝,你可以照原样重试。回滚也失败时,拒绝里会说明并指向 `check`:不一致的行需要修,而一个已收口、已全部结清的批次绝不能重试。
45
+ - supersede(仅深度 0):冻结一份对象已消失、永远不会实施、且能指名其继任者的记录。这是收口的第三条边:`close` 需要整条链,补关需要每行都归档,所以一个被放弃的批次的已完成行否则会永远悬着。
46
+ - `supersededBy` 必填,而且只有你能给出这个事实。机器校验的形式:一个批次档路径(在盘上)、一份文档加一个小节(`docs/<area>/<name>.md §<N>`,编号要命中一个标题行,两侧都不是数字或点),或一个提交(40 位十六进制、可达)。一个计划中或从未做完的继任者解析不出来,被拒绝;指名这份记录本身也被拒绝 —— 让它活着才是重开路径。
47
+ - `closeEvidence` 必填,与 close 上完全一样:一行,写本批在被放弃之前做了什么。空白(缺失 / 空串 / 纯空白)在写入之前即被拒绝;它落在每一个被结的行里,前面加 `收口 <date>:` 前缀。
48
+ - 它既不填 §3 / §4 / §6 去让 `close` 通过(那是编造),也不把它们留白:在 §1 追加一行 `**取代记录**:<date> · 由 <successor> 取代 · 本批无实施记录(§5 未写)· §3/§4/§6 未补写 · 结算 <N> 行 · 改挂条件 <M> 行 · 操作者 = 主 agent`,状态行变成 `已收口 <date>(被取代)`。
49
+ - 行各归各位:本批的 `待核销` 行结为 `已核销`(证据带 `收口 <date>:` 前缀),每条未指名的 `在途` 行退回 `待讨论`,触发为 `条件` 并附续起句 —— 活没做完,回执就照实说,而不是宣称做完了。因此 `completed` 可选:只有本批真的做完了某行才列它。
50
+ - 拒绝,不写任何东西:`supersededBy` 缺失或解析回这份记录本身、记录不是打开的、它的台账读不出来(全部归档的情形没有台账就无法判断)、每一行都已归档(改用 `close` —— 补关覆盖它)、§5 已载有内容(那个批次实施过,所以「无实施记录」那行会是谎话),或 `closeEvidence` 是空白。
51
+ - 其余步骤照跑:单元测试文件闸、文档检查闸、`closeEvidence`、设计令牌消费、先记录后台账加回滚。回执带一行 `[ledger supersede]`,指名每一条被结的行与每一条被退回的行。
52
+ - 它能指名的六种不一致:`closed-but-open-rows`(已冻结却还有 在途 行,或有 待讨论 / 待设计 行而其触发既不是 条件 也不是 认账不排期)· `closed-but-settling`(已冻结,行仍是 待核销)· `open-but-unwritable`(已开,在途 行已不剩但存在 待核销 行)· `open-but-settled`(未冻结 —— `open`,或 §1 行读不出来 —— 而行集非空且全部归档,重开一个已全部结清的批次之后就是这种预期状态;只有 §1 读作 进行中 时才够得上补关入口)· `pointer-stale`(某一行的 task_book 解析不出来)· `header-row-missing`(头部 台账 编号没有同 id 的 items 行)。
53
+ - `header-row-missing` 只判断存在性:行还在、只是被合法地解绑了,不算。用一次文档写入把缺的编号从头部删掉;重跑 attach 是次要路径,受同面孔规则约束。
54
+ - 预定指针(`…md(预定)`)不算 `pointer-stale`:它的记录还不存在,那正是它的合法状态。
55
+ - 每一次 `status` 与 `close` 的回执都以一行 `[ledger consistency]` 结尾:`一致(本批 N 行)`,或不一致项及其出路。它只报告;从不修复,也从不阻塞。
56
+ - read(只读;持有本工具的每个席位都有,它不写任何东西):六节无论你能不能写都读得到 —— §1 载着裁决,§3 是上一轮,§5 是实施记录。
57
+ - 不给 `segment` ⇒ 记录的索引:头部行(编制 / 台账 / 批起 sha)、每节一行并带它的状态词与正文行数(该节没有可读状态行时是 `无状态行`),以及一行尾部,带绝对路径与下一次调用的形状。
58
+ - `segment` + `offset` ⇒ 该节正文的一个窗口:首行 `§N · 行 a-b / 共 T`,然后是正文行,然后 —— 若还有行 —— 下一个 `offset`。
59
+ - 给了 `segment` 就必须给 `offset`,1 起算(正文第一行是 1),一个窗口最多 200 行。
60
+ - 拒绝,不写任何东西并指名参数:有 `segment` 无 `offset`、记录里没有该小节,以及 `offset` 不是 ≥ 1 的整数或越过该节正文。
61
+ - 已收口的记录读起来与打开的一样 —— 冻结是写入闸;目标绑定与 `append` / `edit` 相同,所以子代理与评审不传 `path`。
61
62
 
62
- Who may write what — identity decides, and a write outside your own section is refused:
63
- - main agent (depth 0) — create / attach / close / supersede.
64
- - Append and status domains are mode-dependent: engineering — append §1/§4/§6, status §1; normal — append §1/§2/§4/§5/§6, status §1/§2/§5 (the main agent holds the designer and implementer seats there).
65
- - edit reads the same whitelist as append — one table, two actions. Depth-0 gains §2 and §5 on edit in normal mode.
66
- - eng-designer — §2; eng-coder — §5; a normal-mode coder bound via `batchDoc` — §5; design review (review binding) — §3 on the code track and in normal mode only. The engineering-mode design track has no §3 face: that record gets no `batch` tool, and the block — table, VERDICT line and counts included — is written by the design-review settlement, so a reviewer appends nothing and reports no missing entry.
63
+ 谁能写什么 —— 由身份决定,写到自己小节之外会被拒绝:
64
+ - 主 agent(深度 0)—— create / attach / close / supersede。
65
+ - append 与 status 的域随模式变化:工程模式 —— append §1/§4/§6,status §1;普通模式 —— append §1/§2/§4/§5/§6,status §1/§2/§5(那里主 agent 兼任设计席与实施席)。
66
+ - edit 读的白名单与 append 相同 —— 一张表,两个动作。普通模式下深度 0 在 edit 上额外获得 §2 与 §5。
67
+ - eng-designer —— §2;eng-coder —— §5;普通模式下经 `batchDoc` 绑定的 coder —— §5;设计评审(评审绑定)—— 仅代码轨与普通模式下的 §3。工程模式的设计轨没有 §3 写面:那份记录拿不到 `batch` 工具,块 —— 含表格、VERDICT 行与计数 —— 由设计评审的落档写入,因此评审者什么都不 append,也不报「缺条目」。
67
68
 
68
- Skeleton placeholders are dead literals in the header's structural lines — `#<编号>` / `<板块>`, and the older `<BATCH-ID>` / `<讨论来源>`. They block append / edit / status until filled:
69
- - create with ledger / board fills them at creation.
70
- - On an in-flight record still carrying them, attach fills the number.
71
- - Otherwise the main agent fills the header by file edit. Citing these literals in a section's prose is fine — only the header is checked.
72
- - `<§N 模板占位:…>` template lines are legal and never blocked.
69
+ 骨架占位是头部结构行里的死字面 —— `#<编号>` / `<板块>`,以及更早的 `<BATCH-ID>` / `<讨论来源>`。它们阻塞 append / edit / status,直到被填上:
70
+ - 带 ledger / board 的 create 在创建时就填好它们。
71
+ - 在仍带着它们的在途记录上,attach 填编号。
72
+ - 否则由主 agent 用文件编辑填好头部。在某一节的叙述里引用这些字面没问题 —— 只检查头部。
73
+ - `<§N 模板占位:…>` 是合法的模板行,永不被阻塞。
73
74
 
74
- Target record:
75
- - Sub-agents and design reviews have NO path parameter — the record arrives via the spawn binding or the review instance key, and passing `path` is refused.
76
- - Depth-0 MAY pass `path` on any action (a given value must be readable); omitting it picks the unique in-flight record (0 or ≥2 ⇒ refused — pass `path`).
75
+ 目标记录:
76
+ - 子代理与设计评审**没有**路径参数 —— 记录经派生绑定或评审实例键送达,传 `path` 会被拒绝。
77
+ - 深度 0 **可以**在任何动作上传 `path`(给的值必须可读);省略它会选中唯一的在途记录(0 份或 ≥2 份 ⇒ 拒绝 —— 请传 `path`)。
77
78
 
78
- §3 has its own rules:
79
- - A §3 append carries exactly one verdict on its own line — `VERDICT: pass` or `VERDICT: changes-required`; the localized whole-line forms count too (`结论:通过` / `结论:不通过`, their 需修改 variants, optional trailing 。). No verdict line, or both at once, is refused with nothing written — no round number is consumed, so resend with the verdict added.
80
- - On the code track and in normal mode, a design review's §3 append carries the round's conclusion table — one row per finding (`#` / severity / status / evidence) — plus the VERDICT line and the counts. An evidence cell holds a pointer: a section number, a symbol name, or the exact words — never a line number. The report's own paragraphs stay out of the record.
81
- - On the code track and in normal mode the tool stamps the append with a `### 轮次 N(评审子代理)` heading — N is tool-counted; do not write your own, it would be dropped. On the engineering-mode design track that stamp still heads the block, written by the settlement.
79
+ §3 有自己的规则:
80
+ - 一次 §3 的 append 必须在自己的一行上带恰好一个结论 —— `VERDICT: pass` 或 `VERDICT: changes-required`;本地化的整行形式也算(`结论:通过` / `结论:不通过`,以及它们的 需修改 变体,尾部可选的 。)。没有结论行、或同时出现两条,都被拒绝且不写任何东西 —— 不消耗轮次号,所以补上结论重发即可。
81
+ - 在代码轨与普通模式下,一次设计评审的 §3 append 带这一轮的结论表 —— 每条结论一行(`#` / 严重度 / 状态 / 证据)—— 加上 VERDICT 行与计数。证据格放一个指针:小节号、符号名,或原话 —— 绝不用行号。报告自身的段落留在记录之外。
82
+ - 在代码轨与普通模式下,工具会给这次 append 盖上 `### 轮次 N(评审子代理)` 标题 —— N 由工具计数;不要自己写,写了会被丢弃。在工程模式的设计轨上,那个戳仍由落档写在这个块的头部。
82
83
 
83
- Document-check gate — append and edit run it before the write in engineering mode only, any section, depth-0, sub-agent and design review alike; outside engineering mode the gate is `null` and the write is not checked.
84
- Closing a record and setting §1 to `已收口` run it in both modes.
85
- - It judges the same three things `doc_check` judges — a paragraph over 300 characters, a line number used as an anchor, a dangling pointer — and nothing else. The number lives in the tool: run the check, do not measure by hand.
86
- - Writing (`append` / `edit`) judges the whole of what is being written — the candidate text, or the record view after the edit — and a hit anywhere refuses. Closing (`close` / `status → 已收口`) judges only this batch's changed region: the lines a `git diff` of the record's start snapshot against the working tree yields. Inside the region all three criteria apply; outside it nothing comes out, because a closeout measures what this batch did, not the old debt a document carries.
87
- - A document with nothing to judge produces no line and is not counted in `范围 N 档` — this batch did not touch it, the region could not be derived, or the region came out empty. The closing arm runs `git add` by path (never `git add -A`, so another seat's half-finished file stays out), then takes the region, so a file this batch created has one too.
88
- - Which documents: `append` / `edit` judge the files this run already touched plus the record itself (before it lands, the candidate text stands in); `close` and `status → 已收口` judge those plus every document the batch committed, minus the record itself.
89
- - The record itself is exempt from the dangling criterion, whole: §1–§6 may name a file that is not on disk, because "this file does not exist" is a finding a record must be able to write down. The other two criteria apply to it as written.
90
- - A path this batch plans to create is exempt while the record is in flight — list it in the §2 machine-readable table under `**受影响文件(机读清单)**`. The exemption ends when the record closes.
91
- - A refusal throws with the gate named, the verdict line and every hit line; nothing is written. A pass receipt reads `[doc-check gate] DOC-CHECK GATE: PASS · 范围 N 档`, N being the documents actually judged; a document that could not be judged is named (`不在盘,未判` / `读不到,未判`), never counted as clean.
92
- - `ERROR` lets an append land but refuses a closeout — no `PASS` means not passed. With no `PROJECT-MANIFEST.json` the gate does not run.
84
+ **批次循环勾要。**
93
85
 
94
- Failures are hard and visible (no silent fallback): if a write is refused or fails, say so in your report — "§N not written".
86
+ | 逐字规则名 | 消费面 |
87
+ |---|---|
88
+ | `Batch cycle — review convergence and the §3 landing` | depth-0 派单席与评审实例:create / attach / status 五臂、状态词表、写面白名单、§3 落档规则。 |
89
+
90
+
91
+ 文档检查闸 —— 仅工程模式下,append 与 edit 在写盘前跑它,任何小节、深度 0、子代理与设计评审都一样;工程模式之外该闸为 `null`,写入不受检查。
92
+ 收口一份记录、把 §1 置为 `已收口`,在两种模式下都跑它。
93
+ - 它判断的是 `doc_check` 判断的那三件事 —— 一段超过 300 字符、用行号做锚、悬空指针 —— 别的什么都不判。那个数字活在工具里:跑检查,不要用手量。
94
+ - 写入(`append` / `edit`)判断正在写的东西整体 —— 候选文本,或编辑后的记录视图 —— 任何一处命中就拒绝。收口(`close` / `status → 已收口`)只判断本批的改动区间:记录起始快照对工作树的 `git diff` 所给出的那些行。区间内三条判据全适用;区间外什么都不出,因为收口衡量的是本批做了什么,不是一份文档背着的旧债。
95
+ - 没有可判内容的文档不产生任何行,也不计入 `范围 N 档` —— 本批没碰它、区间推导不出来,或区间是空的。收口臂按路径跑 `git add`(绝不 `git add -A`,别处席位半写完的文件进不来),然后再取区间,所以本批新建的文件也有区间。
96
+ - 判断哪些文档:`append` / `edit` 判断本次运行已经碰过的文件加上记录本身(在它落盘前,候选文本顶替);`close` 与 `status → 已收口` 判断那些文件加上本批提交过的每一份文档,再减去记录本身。
97
+ - 记录本身对悬空判据整份豁免:§1–§6 可以指名一个不在盘上的文件,因为「这个文件不存在」正是记录必须能写下的一条结论。另两条判据照它写的样子适用。
98
+ - 本批计划创建的路径在记录在途期间豁免 —— 把它列进 §2 机器可读表的 `**受影响文件(机读清单)**` 之下。记录一收口,豁免即结束。
99
+ - 拒绝会带着闸名、裁决行与每一条命中行抛出;什么都不写。通过的回执读作 `[doc-check gate] DOC-CHECK GATE: PASS · 范围 N 档`,N 是实际判过的文档数;判不了的文档会被指名(`不在盘,未判` / `读不到,未判`),绝不计作干净。
100
+ - `ERROR` 允许 append 落盘,但拒绝收口 —— 没有 `PASS` 就是没通过。没有 `PROJECT-MANIFEST.json` 时该闸不跑。
101
+
102
+ 失败是硬性的、可见的(没有静默回退):一次写入被拒绝或失败,就在报告里说「§N not written」。