@haaaiawd/loom 2.1.0 → 2.1.2

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.
package/CHANGELOG.md CHANGED
@@ -1,40 +1,51 @@
1
- # Changelog
2
-
1
+ # Changelog
2
+
3
3
  ## Unreleased
4
4
 
5
+ ## 2.1.2
6
+
5
7
  - Added environment-aware clarification through `loom context --human-channel available|unavailable`. Unattended Agents inspect first, research only permitted objective facts, and then use bounded assumptions or blocks rather than fabricating users or substituting web search for intent.
6
8
  - Added `--state-dir <outside-workspace-dir>` sidecars for isolated benchmark and sandbox runs. Sidecars preserve virtual `.loom/` Task references without mutating the scored workspace or its `AGENTS.md`.
7
9
  - Added equal human-channel controls and unattended condition prompts to Evil Eval scaffolding.
8
-
9
- ## 2.1.0
10
-
11
- - Added a current-state and recommended-action header to `loom context` output. Agents entering a project or resuming after compression now see project status, active task, work-map counts, and a recommended next action before the full protocol. The recommendation is advisory, not a script.
12
- - Rewrote `AGENTS.md` with explicit LOOM trigger conditions (project entry, context reset, before substantial work, between Tasks) and a standard work rhythm that keeps Agent judgment while making the next step obvious.
13
- - Integrated Crux integrity-chain review into the Keeper handoff. The Keeper now checks that responsible intent, project promises, design and capability decisions, Work Map, executable behavior, and human feedback loop form an intact chain, and looks for omission, substitution, drift, unsupported leaps, blindness, and ownerless gaps.
14
- - Added staged visibility and review guidance to the project template and active-Task execution protocol. Tasks should prefer human-visible acceptance evidence, the Agent should show real working things at milestones, run `loom check` and project tests together before declaring a batch done, and prioritize reaching an exciting surface early to sustain the human's momentum.
15
- - Strengthened capability source validation: `loom capability synthesize` now requires each decision-tree node's `source:` citation to reference a real `.md` file in the dossier's `research/` directory.
16
- - Added `research/_guide.md` generation in `loom capability research` so Agents know what good research material looks like, what to avoid, and how to cite sources.
17
- - Added `.loom/STRUCTURE.md` as a fifth project-truth layer declaring where source code, tests, docs, assets, and configuration files live. `loom check` warns when it is missing or still templated.
18
- - Added `loom decision --json-file` for recording consequential superseding decisions with affected files and tasks. `loom check` warns when a done Task is marked affected by a later decision.
19
- - Added `acceptance[]` as the primary Task completion structure, pairing `criterion`, `verify_by`, and `evidence`. Legacy `done_when[]` remains supported.
20
- - Added Keeper auto-pass: when all Keeper gaps are minor and 3 or fewer, fixing them and running `loom project ready` auto-passes without another Keeper round.
21
- - Added deliverable coverage tracking through `loom deliverable add` and Task `covers` field. `loom check` reports uncovered delivery units.
22
- - Added `loom capability research → synthesize → confirm` lifecycle with status tracking per dossier.
23
- - Updated help text with a typical first-pass flow and capability lifecycle sequence.
24
-
25
- ## 2.0.1
26
-
27
- - Added an active-Task execution protocol that restores workspace-aware coding guidance, risk-based testing, restartable progress, criterion-level proof, and conditional commit/PR boundaries after context resets.
28
- - Strengthened the generated `AGENTS.md` anchor so Agents reload LOOM at project entry, after context loss, and before resumed editing without invoking it before every tool call.
29
-
30
- ## 2.0.0
31
-
32
- - Rebuilt LOOM as invisible Agent infrastructure around project understanding, a scalable design-document graph, separate professional-field dossiers, a broad Work Map, and one active Task.
33
- - Replaced fixed roles and stages with an adaptive clarification protocol and explicit convergence conditions.
34
- - Added human-editable project truth, structured continuity state, and superseding decision history.
35
- - Added context selection that keeps very large Task maps on disk and injects only the active horizon.
36
- - Added seven adaptable design-document templates and `loom prompts` as a complete live prompt inventory.
37
- - Reduced Keeper to one independent build-readiness handoff with revision, changed-digest, fresh-run, and stale-state enforcement.
38
- - Added controlled Evil Eval scaffolding for equal-condition, repeated, reset-heavy blind comparison.
39
- - Added bilingual English/Chinese release documentation and a flat, minimal visual system with editable loop diagrams.
40
- - Deliberately stopped automatic mutation of legacy `.loom/v1` projects.
10
+ - Added explicit capability authority provenance: human selections become confirmed, while Agent selections remain visibly provisional until human confirmation.
11
+ - Required independent Keeper review provenance for a passing handoff; known self-review can no longer be recorded as an independent pass.
12
+ - Added Task integrity enforcement for design links, capability hooks or explicit exemptions, plus declared output existence checks before completion.
13
+ - Added command-specific canonical JSON help and recovery pointers for every structured-write command.
14
+ - Updated generated Agent guidance and both public READMEs so installed and source-checkout invocation paths are unambiguous.
15
+
16
+ ## 2.1.1
17
+
18
+ - Re-published 2.1.0 content with corrected CHANGELOG line endings.
19
+
20
+ ## 2.1.0
21
+
22
+ - Added a current-state and recommended-action header to `loom context` output. Agents entering a project or resuming after compression now see project status, active task, work-map counts, and a recommended next action before the full protocol. The recommendation is advisory, not a script.
23
+ - Rewrote `AGENTS.md` with explicit LOOM trigger conditions (project entry, context reset, before substantial work, between Tasks) and a standard work rhythm that keeps Agent judgment while making the next step obvious.
24
+ - Integrated Crux integrity-chain review into the Keeper handoff. The Keeper now checks that responsible intent, project promises, design and capability decisions, Work Map, executable behavior, and human feedback loop form an intact chain, and looks for omission, substitution, drift, unsupported leaps, blindness, and ownerless gaps.
25
+ - Added staged visibility and review guidance to the project template and active-Task execution protocol. Tasks should prefer human-visible acceptance evidence, the Agent should show real working things at milestones, run `loom check` and project tests together before declaring a batch done, and prioritize reaching an exciting surface early to sustain the human's momentum.
26
+ - Strengthened capability source validation: `loom capability synthesize` now requires each decision-tree node's `source:` citation to reference a real `.md` file in the dossier's `research/` directory.
27
+ - Added `research/_guide.md` generation in `loom capability research` so Agents know what good research material looks like, what to avoid, and how to cite sources.
28
+ - Added `.loom/STRUCTURE.md` as a fifth project-truth layer declaring where source code, tests, docs, assets, and configuration files live. `loom check` warns when it is missing or still templated.
29
+ - Added `loom decision --json-file` for recording consequential superseding decisions with affected files and tasks. `loom check` warns when a done Task is marked affected by a later decision.
30
+ - Added `acceptance[]` as the primary Task completion structure, pairing `criterion`, `verify_by`, and `evidence`. Legacy `done_when[]` remains supported.
31
+ - Added Keeper auto-pass: when all Keeper gaps are minor and 3 or fewer, fixing them and running `loom project ready` auto-passes without another Keeper round.
32
+ - Added deliverable coverage tracking through `loom deliverable add` and Task `covers` field. `loom check` reports uncovered delivery units.
33
+ - Added `loom capability research → synthesize → confirm` lifecycle with status tracking per dossier.
34
+ - Updated help text with a typical first-pass flow and capability lifecycle sequence.
35
+
36
+ ## 2.0.1
37
+
38
+ - Added an active-Task execution protocol that restores workspace-aware coding guidance, risk-based testing, restartable progress, criterion-level proof, and conditional commit/PR boundaries after context resets.
39
+ - Strengthened the generated `AGENTS.md` anchor so Agents reload LOOM at project entry, after context loss, and before resumed editing without invoking it before every tool call.
40
+
41
+ ## 2.0.0
42
+
43
+ - Rebuilt LOOM as invisible Agent infrastructure around project understanding, a scalable design-document graph, separate professional-field dossiers, a broad Work Map, and one active Task.
44
+ - Replaced fixed roles and stages with an adaptive clarification protocol and explicit convergence conditions.
45
+ - Added human-editable project truth, structured continuity state, and superseding decision history.
46
+ - Added context selection that keeps very large Task maps on disk and injects only the active horizon.
47
+ - Added seven adaptable design-document templates and `loom prompts` as a complete live prompt inventory.
48
+ - Reduced Keeper to one independent build-readiness handoff with revision, changed-digest, fresh-run, and stale-state enforcement.
49
+ - Added controlled Evil Eval scaffolding for equal-condition, repeated, reset-heavy blind comparison.
50
+ - Added bilingual English/Chinese release documentation and a flat, minimal visual system with editable loop diagrams.
51
+ - Deliberately stopped automatic mutation of legacy `.loom/v1` projects.
package/EVIL_EVAL.md CHANGED
@@ -22,11 +22,11 @@ baseline and does not answer whether LOOM itself adds value.
22
22
 
23
23
  A scenario records:
24
24
 
25
- - the identical raw brief;
26
- - workspace setup and immutable snapshot;
27
- - hidden user facts and a deterministic answer script;
28
- - human-channel availability (`available` or `unavailable`), identical across conditions;
29
- - success criteria that judges can observe;
25
+ - the identical raw brief;
26
+ - workspace setup and immutable snapshot;
27
+ - hidden user facts and a deterministic answer script;
28
+ - human-channel availability (`available` or `unavailable`), identical across conditions;
29
+ - success criteria that judges can observe;
30
30
  - context-reset points;
31
31
  - equal token, time, and tool budgets;
32
32
  - at least three repetitions per condition.
@@ -43,18 +43,18 @@ decision.
43
43
  4. Change one consequential user answer after the first plan is formed.
44
44
  5. Give both conditions equal access to discoverable repository facts.
45
45
  6. Penalize unnecessary questions, ceremony, document volume, time, and token cost.
46
- 7. Require an implementation attempt or operational transcript; documents alone cannot win.
47
-
48
- ## Unattended external benchmarks
49
-
50
- An external benchmark such as a terminal-use suite may provide no human response channel. In that condition,
51
- set `human_channel` to `unavailable` for both arms. Neither arm may invent a user answer or treat web search as
52
- a substitute for user intent, preference, or authority. Both may inspect the workspace and use only the research
53
- tools the benchmark makes available; unresolved consequential choices require a bounded reversible assumption or
54
- a block.
55
-
56
- Run LOOM with `--state-dir` pointing outside the scored workspace. The sidecar must be fresh per run and passed
57
- to every LOOM command, so `.loom/` state cannot alter task files or hidden-test behavior.
46
+ 7. Require an implementation attempt or operational transcript; documents alone cannot win.
47
+
48
+ ## Unattended external benchmarks
49
+
50
+ An external benchmark such as a terminal-use suite may provide no human response channel. In that condition,
51
+ set `human_channel` to `unavailable` for both arms. Neither arm may invent a user answer or treat web search as
52
+ a substitute for user intent, preference, or authority. Both may inspect the workspace and use only the research
53
+ tools the benchmark makes available; unresolved consequential choices require a bounded reversible assumption or
54
+ a block.
55
+
56
+ Run LOOM with `--state-dir` pointing outside the scored workspace. The sidecar must be fresh per run and passed
57
+ to every LOOM command, so `.loom/` state cannot alter task files or hidden-test behavior.
58
58
 
59
59
  ## Measures
60
60
 
@@ -105,11 +105,11 @@ Create a scenario description:
105
105
  ```json
106
106
  {
107
107
  "id": "EVAL-001",
108
- "title": "Ambiguous multidisciplinary build",
109
- "brief": "Build a calming recovery tool from this repository.",
110
- "hidden_user_facts": ["The user must retain manual control."],
111
- "human_channel": "available",
112
- "success_criteria": ["A fresh Agent resumes correctly after a forced reset."],
108
+ "title": "Ambiguous multidisciplinary build",
109
+ "brief": "Build a calming recovery tool from this repository.",
110
+ "hidden_user_facts": ["The user must retain manual control."],
111
+ "human_channel": "available",
112
+ "success_criteria": ["A fresh Agent resumes correctly after a forced reset."],
113
113
  "context_reset_points": ["after-shaping", "mid-task"],
114
114
  "repetitions": 3
115
115
  }
package/README.md CHANGED
@@ -12,9 +12,9 @@
12
12
 
13
13
  <p align="center"><strong>The human talks to the Agent. LOOM helps the Agent remember, understand, and continue.</strong></p>
14
14
 
15
- LOOM is invisible project-understanding and continuity infrastructure for AI Agents. It supports
16
- any work that can be materially advanced through code or command-line tools: software, operations,
17
- research workflows, office automation, data work, and highly personalized projects.
15
+ LOOM is spec-driven continuity, proof, and project understanding infrastructure for AI coding agents.
16
+ It supports any work that can be materially advanced through code or command-line tools: software,
17
+ operations, research workflows, office automation, data work, and highly personalized projects.
18
18
 
19
19
  The human does not learn a framework or operate a CLI. They describe what they want, answer useful
20
20
  questions, disagree, delegate decisions, and watch the work become real. The Agent uses LOOM in the
@@ -65,10 +65,13 @@ understand or verify it independently. `PROJECT.md` maps the whole instead of be
65
65
 
66
66
  A dossier exists only when specialist knowledge would change a question, design choice,
67
67
  implementation, risk, or verification method. Each dossier represents one recognizable professional
68
- field—such as UI/UX design, visual art direction, game design, psychology, security, or distributed
69
- systems. Different fields remain separate even when tightly coupled; their synthesis belongs in the
70
- design document whose decision they jointly shape. A task technique such as triage, ranking, parsing,
71
- or caching is not allowed to masquerade as the project's entire capability surface.
68
+ field—such as UI/UX design, visual art direction, game design, psychology, security, or distributed
69
+ systems. Different fields remain separate even when tightly coupled; their synthesis belongs in the
70
+ design document whose decision they jointly shape. A task technique such as triage, ranking, parsing,
71
+ or caching is not allowed to masquerade as the project's entire capability surface.
72
+
73
+ Capability scenario authority remains visible: `--source human` confirms a user-selected scenario;
74
+ `--source agent` records a provisional selection when the human is unavailable.
72
75
 
73
76
  ### Work Map and Task
74
77
 
@@ -82,7 +85,8 @@ Agent:
82
85
  - what observable result to create;
83
86
  - what proves completion;
84
87
  - what must not be damaged;
85
- - which project and capability documents matter;
88
+ - which project and capability documents matter;
89
+ - which design decision and capability nodes apply, or why they do not;
86
90
  - what has happened, what is happening, and what comes next;
87
91
  - which evidence already exists and which exact done condition it proves.
88
92
 
@@ -144,8 +148,9 @@ loom design add product --title "Product definition" --kind product
144
148
  loom design add local-analysis --title "Local analysis system" --kind system
145
149
  loom design add acceptance --title "Vertical-slice verification" --kind verification
146
150
  loom capability add ui-ux-design --title "UI/UX design"
147
- loom capability add behavioral-psychology --title "Behavioral psychology"
148
- loom task plan --json-file initial-work-map.json
151
+ loom capability add behavioral-psychology --title "Behavioral psychology"
152
+ loom capability confirm behavioral-psychology --scenario "<project-specific expert situation>" --source human
153
+ loom task plan --json-file initial-work-map.json
149
154
  loom project ready
150
155
  ```
151
156
 
@@ -155,7 +160,11 @@ At the transition to material execution, open a fresh Agent thread and give it o
155
160
  Run loom keeper prompt in this project and follow it. Decide whether you can responsibly start.
156
161
  ```
157
162
 
158
- If Keeper returns `needs_revision` or `blocked`, those exact gaps reappear in `loom context`. The Agent
163
+ Keeper pass JSON records `review.mode: "independent"`, a reviewer identity, and concrete isolation evidence.
164
+ Known self-review cannot pass; if the host cannot isolate a fresh Agent, use `loom keeper skip` with the
165
+ reason so reduced confidence stays visible.
166
+
167
+ If Keeper returns `needs_revision` or `blocked`, those exact gaps reappear in `loom context`. The Agent
159
168
  repairs the relevant project, design, capability, or Task source, prepares a changed digest, and opens a
160
169
  different fresh Keeper. If the host cannot create a subagent, the human can open a new window and use the
161
170
  same sentence. After the one-time handoff passes, the execution Agent starts and maintains Tasks normally:
@@ -175,17 +184,19 @@ Completion is deliberately explicit:
175
184
 
176
185
  ```json
177
186
  {
178
- "evidence": ["npm test: 20 passed, 0 failed"],
187
+ "evidence": ["npm test: 21 passed, 0 failed"],
179
188
  "acceptance_results": [
180
189
  {
181
190
  "criterion": "The exact acceptance criterion from the Task.",
182
- "evidence": ["The command, artifact, or observation that proves this criterion."]
191
+ "evidence": "The command, artifact, or observation that proves this criterion."
183
192
  }
184
193
  ]
185
194
  }
186
195
  ```
187
196
 
188
- Run `loom --help` for the complete command surface. Run `loom check` for structural health. Run
197
+ Run `loom --help` for the complete command surface. Structured-write commands expose canonical payloads
198
+ through command-specific help such as `loom record --help` and `loom task done --help`. Run `loom check`
199
+ for structural health. Run
189
200
  `loom prompts` to print every cognitive message LOOM can inject: the stable collaboration core,
190
201
  runtime protocol, dynamic state layer, all document templates, Keeper prompt, eval conditions, judge
191
202
  prompt, and their composition order. See the [prompt and message catalog](docs/PROMPT_CATALOG.md).
@@ -215,7 +226,7 @@ user burden, time, and token cost are penalized alongside quality. See [EVIL_EVA
215
226
  npm test
216
227
  ```
217
228
 
218
- The v2 test suite (20 end-to-end tests) exercises the complete loop, including a 250-Task Work Map, context selection,
229
+ The v2 test suite exercises the complete loop, including a 250-Task Work Map, context selection,
219
230
  superseding decisions, scalable design documents, professional-field separation, capability compilation with
220
231
  source-citation validation, multi-attempt Keeper revision with auto-pass, stale digest and duplicate-run
221
232
  rejection, exact-file Task start, block/reopen including disproven completion, per-acceptance-criterion evidence,
package/README.zh-CN.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  <p align="center"><strong>人只需要和 Agent 自然聊天。LOOM 在背后帮助 Agent 记住、理解,并继续工作。</strong></p>
14
14
 
15
- LOOM 是为 AI Agent 准备的、隐形的项目理解与连续性基础设施。凡是能够通过代码或命令行获得实质推进的工作——软件、运维、科研流程、办公自动化、数据处理,以及高度个性化的项目——都在它的能力边界内。
15
+ LOOM 是为 AI 编码 Agent 准备的 spec 驱动连续性、证据与项目理解基础设施。凡是能够通过代码或命令行获得实质推进的工作——软件、运维、科研流程、办公自动化、数据处理,以及高度个性化的项目——都在它的能力边界内。
16
16
 
17
17
  用户不需要学习一套框架,也不需要亲自操作 CLI。他只需要描述想要什么、回答真正有价值的问题、提出异议、把某些判断交给 Agent,然后看着结果逐渐成为现实。Agent 在后台使用 LOOM,让项目全貌在上下文压缩、会话切换和长期施工中保持连续。
18
18
 
@@ -115,19 +115,22 @@ loom record --json-file understanding-update.json
115
115
  loom design add product --title "Product definition" --kind product
116
116
  loom design add local-analysis --title "Local analysis system" --kind system
117
117
  loom design add acceptance --title "Vertical-slice verification" --kind verification
118
- loom capability add ui-ux-design --title "UI/UX design"
119
- loom capability add behavioral-psychology --title "Behavioral psychology"
120
- loom task plan --json-file initial-work-map.json
121
- loom project ready
122
- ```
118
+ loom capability add ui-ux-design --title "UI/UX design"
119
+ loom capability add behavioral-psychology --title "Behavioral psychology"
120
+ loom capability confirm behavioral-psychology --scenario "<项目特定的专家情境>" --source human
121
+ loom task plan --json-file initial-work-map.json
122
+ loom project ready
123
+ ```
123
124
 
124
125
  准备从项目成型进入实质施工时,打开一个全新的 Agent 线程,只给它一句简短指令:
125
126
 
126
127
  ```text
127
- Run loom keeper prompt in this project and follow it. Decide whether you can responsibly start.
128
- ```
129
-
130
- 如果 Keeper 返回 `needs_revision` 或 `blocked`,这些具体缺口会重新出现在 `loom context` 中。Agent 修复对应的项目、设计、能力或 Task 源文件,生成发生变化的新 digest,再打开另一个全新的 Keeper。若宿主不支持子代理,用户可以新开一个窗口并使用同一句提示词。
128
+ Run loom keeper prompt in this project and follow it. Decide whether you can responsibly start.
129
+ ```
130
+
131
+ Keeper 通过记录必须包含 `review.mode: "independent"`、审查者标识和具体的隔离证据。已知的自我审查不能通过;如果宿主无法隔离出全新的 Agent,应使用 `loom keeper skip` 并写明原因,让置信度降低这件事保持可见。
132
+
133
+ 如果 Keeper 返回 `needs_revision` 或 `blocked`,这些具体缺口会重新出现在 `loom context` 中。Agent 修复对应的项目、设计、能力或 Task 源文件,生成发生变化的新 digest,再打开另一个全新的 Keeper。若宿主不支持子代理,用户可以新开一个窗口并使用同一句提示词。
131
134
 
132
135
  一次性交接通过后,施工 Agent 正常启动并维护 Task:
133
136
 
@@ -146,17 +149,17 @@ loom task done TASK-001 --json-file evidence.json
146
149
 
147
150
  ```json
148
151
  {
149
- "evidence": ["npm test: 20 passed, 0 failed"],
152
+ "evidence": ["npm test: 21 passed, 0 failed"],
150
153
  "acceptance_results": [
151
- {
152
- "criterion": "The exact acceptance criterion from the Task.",
153
- "evidence": ["The command, artifact, or observation that proves this criterion."]
154
- }
155
- ]
156
- }
157
- ```
158
-
159
- 运行 `loom --help` 查看全部命令,运行 `loom check` 检查结构健康度。`loom prompts` 会打印 LOOM 可能注入的全部认知消息:稳定协作核心、运行时协议、动态状态层、所有文档模板、Keeper 提示词、Eval 条件、裁判提示词,以及它们的组合顺序。详见[提示词与消息目录](docs/PROMPT_CATALOG.md)。
154
+ {
155
+ "criterion": "The exact acceptance criterion from the Task.",
156
+ "evidence": "The command, artifact, or observation that proves this criterion."
157
+ }
158
+ ]
159
+ }
160
+ ```
161
+
162
+ 运行 `loom --help` 查看全部命令。所有结构化写入命令都通过命令级帮助给出可直接使用的标准 JSON,例如 `loom record --help` 和 `loom task done --help`;校验失败也会保留具体错误,并指向对应帮助。运行 `loom check` 检查结构健康度。`loom prompts` 会打印 LOOM 可能注入的全部认知消息:稳定协作核心、运行时协议、动态状态层、所有文档模板、Keeper 提示词、Eval 条件、裁判提示词,以及它们的组合顺序。详见[提示词与消息目录](docs/PROMPT_CATALOG.md)。
160
163
 
161
164
  ## LOOM 刻意删除了什么
162
165
 
@@ -176,7 +179,7 @@ LOOM 2 用一个自适应理解环、可扩展的设计文档图、彼此独立
176
179
  npm test
177
180
  ```
178
181
 
179
- v2 测试套件(20 个端到端测试)覆盖完整闭环,包括 250 个 Task 的 Work Map、上下文选择、决策替代历史、可扩展设计文档、专业领域分离、能力编译(含 source 引用校验)、多轮 Keeper 修订(含 auto-pass)、陈旧 digest 与重复 run 拒绝、精确文件级 Task 启动、阻塞与重开(包括完成证据被推翻)、逐 acceptance 条件证据、交付物覆盖、决策记录与受影响 Task 警告,以及 Evil Eval 的控制变量。详见[完整 UX 与闭环规范](docs/UX_FLOW.md)。
182
+ v2 测试套件(21 个端到端测试)覆盖完整闭环,包括 250 个 Task 的 Work Map、上下文选择、决策替代历史、可扩展设计文档、专业领域分离、能力编译(含 source 引用校验和人类/Agent 权限来源)、Task 设计与能力关联、声明产物存在性、多轮 Keeper 修订(含独立审查来源与 auto-pass)、陈旧 digest 与重复 run 拒绝、精确文件级 Task 启动、阻塞与重开(包括完成证据被推翻)、逐 acceptance 条件证据、交付物覆盖、决策记录与受影响 Task 警告,以及 Evil Eval 的控制变量。详见[完整 UX 与闭环规范](docs/UX_FLOW.md)。
180
183
 
181
184
  ## 文档
182
185
 
package/cli/bin/loom.js CHANGED
@@ -67,7 +67,7 @@ function jsonFile() {
67
67
  }
68
68
  }
69
69
 
70
- function help() {
70
+ function help() {
71
71
  return `loom — continuity infrastructure for Agents
72
72
 
73
73
  The human talks naturally to the Agent. The Agent uses these commands silently.
@@ -105,7 +105,8 @@ Preserve understanding
105
105
  loom capability list|get <slug>
106
106
  loom capability research <slug> --field <text> (creates research/_guide.md — add .md files there)
107
107
  loom capability synthesize <slug> (builds decision tree from research, validates sources)
108
- loom capability confirm <slug> --scenario <text> (user confirms which expert scenario applies)
108
+ loom capability confirm <slug> --scenario <text> --source human|agent
109
+ — human confirms, or Agent records a provisional selection
109
110
  loom capability status <slug>
110
111
 
111
112
  Map the delivery surface
@@ -137,16 +138,73 @@ Evaluate LOOM itself
137
138
  Use \`--state-dir <outside-workspace-dir>\` on every command to keep LOOM state in an isolated sidecar
138
139
  (for example, a benchmark runner's per-run state directory). Sidecar initialization never edits AGENTS.md.
139
140
 
140
- Use JSON files for structured writes so long content and shell quoting remain auditable.
141
- Task completion JSON includes evidence plus either acceptance_results[] (one per acceptance criterion,
142
- each with concrete evidence) or checks[] (one per done_when criterion, for legacy tasks).`;
143
- }
141
+ Use \`loom <command> --help\` or \`loom help <topic>\` for canonical JSON payloads. Topics:
142
+ record, decision, task-plan, task-update, task-block, task-done, keeper-record, eval-scaffold
143
+
144
+ Use JSON files for structured writes so long content and shell quoting remain auditable.
145
+ Task completion JSON includes evidence plus either acceptance_results[] (one per acceptance criterion,
146
+ each with concrete evidence) or checks[] (one per done_when criterion, for legacy tasks).`;
147
+ }
148
+
149
+ const STRUCTURED_HELP = {
150
+ record: {
151
+ usage: 'loom record --json-file <update.json>',
152
+ example: {
153
+ confirmed: ['A fact confirmed by the human or workspace.'],
154
+ assumptions: [{ text: 'A bounded, reversible Agent assumption.', source: 'agent' }],
155
+ unresolved: [{ question: 'A consequential question still open?', impact: 'high' }],
156
+ decisions: [{ title: 'Decision title', decision: 'Current decision.', rationale: 'Why it follows.', supersedes: [], affects: ['.loom/PROJECT.md'] }],
157
+ },
158
+ },
159
+ decision: {
160
+ usage: 'loom decision --json-file <decision.json>',
161
+ example: { summary: 'What changed and why.', changes: ['.loom/design/system.md', 'src/system.js'], affected_tasks: ['TASK-001'] },
162
+ },
163
+ 'task-plan': {
164
+ usage: 'loom task plan --json-file <tasks.json>',
165
+ example: { tasks: [{ title: 'Create one verifiable result', outcome: 'A concrete artifact behaves as specified.', acceptance: [{ criterion: 'Observable condition', verify_by: 'Exact command or review method', evidence: '' }], boundaries: ['Does not change unrelated behavior'], depends_on: [], reads: ['.loom/PROJECT.md', '.loom/design/system.md'], touches: ['src/result.js'], implements: '.loom/design/system.md#Decision', capability_hooks: [{ node: 'field#C1', at: 'decision point', must_produce: 'project-specific choice' }], covers: ['DLV-001'] }] },
166
+ },
167
+ 'task-update': {
168
+ usage: 'loom task update <id> --json-file <patch.json>',
169
+ example: { progress: { completed: ['Finished checkpoint'], current: 'Verifying behavior', next: 'Run the named acceptance check' } },
170
+ },
171
+ 'task-block': {
172
+ usage: 'loom task block <id> --json-file <block.json>',
173
+ example: { reason: 'A concrete dependency or authority is unavailable.', recovery_conditions: ['Observable condition that permits resuming'], evidence: ['Inspection or command output showing the block'] },
174
+ },
175
+ 'task-done': {
176
+ usage: 'loom task done <id> --json-file <evidence.json>',
177
+ example: { evidence: ['Overall reproducible verification result'], acceptance_results: [{ criterion: 'Exact acceptance criterion from the Task', evidence: 'Concrete command, artifact, or observation' }] },
178
+ },
179
+ 'keeper-record': {
180
+ usage: 'loom keeper record --json-file <result.json>',
181
+ example: { run_id: 'fresh-agent-run-001', prepared_digest: '<digest from loom project ready>', verdict: 'passed', review: { mode: 'independent', reviewer_id: 'fresh-agent-001', evidence: 'Host opened a separate Agent without the shaping conversation.' }, summary: 'Build-readiness judgment.', gaps: [], evidence: ['Files and observations supporting the verdict'] },
182
+ },
183
+ 'eval-scaffold': {
184
+ usage: 'loom eval scaffold --json-file <scenario.json>',
185
+ example: { id: 'EVAL-001', title: 'Ambiguous real project', brief: 'Identical brief for both conditions.', hidden_user_facts: ['Fact revealed by the same answer script'], human_channel: 'unavailable', success_criteria: ['Observable result'], context_reset_points: ['after-shaping', 'mid-task'], repetitions: 3 },
186
+ },
187
+ };
188
+
189
+ function structuredHelp(topic) {
190
+ const entry = STRUCTURED_HELP[topic];
191
+ if (!entry) throw new Error(`Unknown help topic: ${topic}. Available topics: ${Object.keys(STRUCTURED_HELP).join(', ')}`);
192
+ return `${entry.usage}\n\nCanonical JSON payload:\n${JSON.stringify(entry.example, null, 2)}`;
193
+ }
194
+
195
+ function activeStructuredHelpTopic() {
196
+ if (command === 'record' || command === 'decision') return command;
197
+ if (command === 'task' && ['plan', 'update', 'block', 'done'].includes(subcommand)) return `task-${subcommand}`;
198
+ if (command === 'keeper' && subcommand === 'record') return 'keeper-record';
199
+ if (command === 'eval' && subcommand === 'scaffold') return 'eval-scaffold';
200
+ return '';
201
+ }
144
202
 
145
203
  try {
146
204
  configureRuntime({ stateDir: option('--state-dir') });
147
205
  const humanChannel = option('--human-channel');
148
206
  if (humanChannel && !['available', 'unavailable'].includes(humanChannel)) throw new Error('--human-channel must be available or unavailable');
149
- switch (command) {
207
+ switch (command) {
150
208
  case '--version':
151
209
  case '-v': {
152
210
  const here = dirname(fileURLToPath(import.meta.url));
@@ -154,11 +212,14 @@ try {
154
212
  output(`loom ${pkg.version}`);
155
213
  break;
156
214
  }
157
- case '--help':
215
+ case '--help':
158
216
  case '-h':
159
217
  case undefined:
160
- output(help());
161
- break;
218
+ output(help());
219
+ break;
220
+ case 'help':
221
+ output(subcommand ? structuredHelp(subcommand) : help());
222
+ break;
162
223
  case 'init':
163
224
  output(initProject());
164
225
  break;
@@ -169,11 +230,11 @@ try {
169
230
  case 'prompts':
170
231
  output(promptCatalog());
171
232
  break;
172
- case 'record':
173
- output(recordUnderstanding(jsonFile()));
174
- break;
175
- case 'decision':
176
- output(recordDecision(jsonFile()));
233
+ case 'record':
234
+ output(subcommand === '--help' ? structuredHelp('record') : recordUnderstanding(jsonFile()));
235
+ break;
236
+ case 'decision':
237
+ output(subcommand === '--help' ? structuredHelp('decision') : recordDecision(jsonFile()));
177
238
  break;
178
239
  case 'check': {
179
240
  const result = checkProject();
@@ -217,7 +278,7 @@ try {
217
278
  output(synthesizeCapability(rest[0]));
218
279
  } else if (subcommand === 'confirm') {
219
280
  if (!rest[0]) throw new Error('Usage: loom capability confirm <slug> --scenario <text>');
220
- output(confirmCapability(rest[0], { scenario: option('--scenario') }));
281
+ output(confirmCapability(rest[0], { scenario: option('--scenario'), source: option('--source') }));
221
282
  } else if (subcommand === 'status') {
222
283
  if (!rest[0]) throw new Error('Usage: loom capability status <slug>');
223
284
  output(getCapabilityStatus(rest[0]));
@@ -236,8 +297,9 @@ try {
236
297
  else throw new Error('Usage: loom deliverable add|list|coverage');
237
298
  break;
238
299
  }
239
- case 'task': {
240
- if (subcommand === 'plan') output(importTasks(jsonFile()));
300
+ case 'task': {
301
+ if (argv.includes('--help') && ['plan', 'update', 'block', 'done'].includes(subcommand)) output(structuredHelp(`task-${subcommand}`));
302
+ else if (subcommand === 'plan') output(importTasks(jsonFile()));
241
303
  else if (subcommand === 'status') output(taskSummary(loadProject().taskStore.tasks));
242
304
  else if (subcommand === 'next') output(getTask());
243
305
  else if (subcommand === 'get') {
@@ -261,20 +323,26 @@ try {
261
323
  } else throw new Error('Usage: loom task plan|status|next|get|start|update|block|reopen|done');
262
324
  break;
263
325
  }
264
- case 'keeper': {
265
- if (subcommand === 'prompt') output(getKeeperPrompt());
326
+ case 'keeper': {
327
+ if (argv.includes('--help') && subcommand === 'record') output(structuredHelp('keeper-record'));
328
+ else if (subcommand === 'prompt') output(getKeeperPrompt());
266
329
  else if (subcommand === 'record') output(recordKeeper(jsonFile()));
267
330
  else if (subcommand === 'skip') output(skipKeeper(option('--reason')));
268
331
  else throw new Error('Usage: loom keeper prompt|record|skip');
269
332
  break;
270
333
  }
271
- case 'eval':
272
- if (subcommand !== 'scaffold') throw new Error('Usage: loom eval scaffold --json-file <scenario.json>');
273
- output(scaffoldEval(jsonFile()));
334
+ case 'eval':
335
+ if (argv.includes('--help') && subcommand === 'scaffold') output(structuredHelp('eval-scaffold'));
336
+ else {
337
+ if (subcommand !== 'scaffold') throw new Error('Usage: loom eval scaffold --json-file <scenario.json>');
338
+ output(scaffoldEval(jsonFile()));
339
+ }
274
340
  break;
275
341
  default:
276
342
  throw new Error(`Unknown command: ${command}\n\n${help()}`);
277
343
  }
278
- } catch (error) {
279
- fail(error.message);
280
- }
344
+ } catch (error) {
345
+ const topic = activeStructuredHelpTopic();
346
+ const pointer = topic && !argv.includes('--help') ? `\nRun ${STRUCTURED_HELP[topic].usage.replace(/ --json-file .+$/, ' --help').replace(/ <id>/, '')} for a canonical payload.` : '';
347
+ fail(`${error.message}${pointer}`);
348
+ }