@haaaiawd/loom 2.0.1 → 2.1.0

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,18 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ - 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
+ - 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
+ - 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
+
3
25
  ## 2.0.1
4
26
 
5
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.
6
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.
7
29
 
8
30
  ## 2.0.0
9
-
10
- - 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.
11
- - Replaced fixed roles and stages with an adaptive clarification protocol and explicit convergence conditions.
12
- - Added human-editable project truth, structured continuity state, and superseding decision history.
13
- - Added context selection that keeps very large Task maps on disk and injects only the active horizon.
14
- - Added seven adaptable design-document templates and `loom prompts` as a complete live prompt inventory.
15
- - Reduced Keeper to one independent build-readiness handoff with revision, changed-digest, fresh-run, and stale-state enforcement.
16
- - Added controlled Evil Eval scaffolding for equal-condition, repeated, reset-heavy blind comparison.
17
- - Added bilingual English/Chinese release documentation and a flat, minimal visual system with editable loop diagrams.
18
- - Deliberately stopped automatic mutation of legacy `.loom/v1` projects.
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.
package/EVIL_EVAL.md CHANGED
@@ -22,10 +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
- - 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;
29
30
  - context-reset points;
30
31
  - equal token, time, and tool budgets;
31
32
  - at least three repetitions per condition.
@@ -42,7 +43,18 @@ decision.
42
43
  4. Change one consequential user answer after the first plan is formed.
43
44
  5. Give both conditions equal access to discoverable repository facts.
44
45
  6. Penalize unnecessary questions, ceremony, document volume, time, and token cost.
45
- 7. Require an implementation attempt or operational transcript; documents alone cannot win.
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
58
 
47
59
  ## Measures
48
60
 
@@ -93,10 +105,11 @@ Create a scenario description:
93
105
  ```json
94
106
  {
95
107
  "id": "EVAL-001",
96
- "title": "Ambiguous multidisciplinary build",
97
- "brief": "Build a calming recovery tool from this repository.",
98
- "hidden_user_facts": ["The user must retain manual control."],
99
- "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."],
100
113
  "context_reset_points": ["after-shaping", "mid-task"],
101
114
  "repetitions": 3
102
115
  }
package/README.md CHANGED
@@ -105,16 +105,37 @@ loom --version
105
105
  Inside a project, the Agent runs:
106
106
 
107
107
  ```bash
108
- loom init
109
- loom context
110
- ```
111
-
112
- When a Task is active, `loom context` also restores a compact execution protocol: reconcile the Task with
113
- the current workspace and version-control state, inspect relevant tests before editing, choose proof by risk
114
- and exact `done_when` claims, persist `completed/current/next` at meaningful handoffs, and close only with
115
- reproducible evidence. It does not impose a ceremonial test or pull request on work that does not need one.
116
-
117
- The Agent edits `.loom/PROJECT.md`, design documents, and capability dossiers as human-readable project truth. Structured
108
+ loom init
109
+ loom context
110
+ ```
111
+
112
+ When a Task is active, `loom context` also restores a compact execution protocol: reconcile the Task with
113
+ the current workspace and version-control state, inspect relevant tests before editing, choose proof by risk
114
+ and exact `acceptance` criteria, persist `completed/current/next` at meaningful handoffs, show the human real
115
+ working things at milestones, and close only with reproducible evidence. It does not impose a ceremonial test
116
+ or pull request on work that does not need one.
117
+
118
+ ### Unattended and benchmark runs
119
+
120
+ LOOM does not invent a user when none is reachable. Tell the context compiler that the human channel is
121
+ unavailable; the Agent then resolves uncertainty in order: inspect the workspace and tools, research only
122
+ objective facts when the task permits it, then record a bounded assumption and choose a reversible action or
123
+ block on unavailable authority. Web research never substitutes for user intent, preference, or permission.
124
+
125
+ ```bash
126
+ loom context --human-channel unavailable
127
+ ```
128
+
129
+ Benchmark runners can keep LOOM state out of the scored workspace by using an external sidecar on **every**
130
+ LOOM command. Virtual references such as `.loom/PROJECT.md` still work inside Task context, but `init` does not
131
+ write `.loom/` or `AGENTS.md` into the workspace being scored.
132
+
133
+ ```bash
134
+ loom init --state-dir /runner/run-001/loom-state
135
+ loom context --state-dir /runner/run-001/loom-state --human-channel unavailable
136
+ ```
137
+
138
+ The Agent edits `.loom/PROJECT.md`, design documents, and capability dossiers as human-readable project truth. Structured
118
139
  writes use JSON files so long content remains auditable and shell quoting does not corrupt it:
119
140
 
120
141
  ```bash
@@ -154,10 +175,10 @@ Completion is deliberately explicit:
154
175
 
155
176
  ```json
156
177
  {
157
- "evidence": ["npm test: 21 passed, 0 failed"],
158
- "checks": [
178
+ "evidence": ["npm test: 20 passed, 0 failed"],
179
+ "acceptance_results": [
159
180
  {
160
- "criterion": "The exact done_when sentence from the Task.",
181
+ "criterion": "The exact acceptance criterion from the Task.",
161
182
  "evidence": ["The command, artifact, or observation that proves this criterion."]
162
183
  }
163
184
  ]
@@ -182,7 +203,7 @@ observable completion, context isolation, and evidence. They no longer require s
182
203
  ## Proving that LOOM helps
183
204
 
184
205
  `loom eval scaffold --json-file scenario.json` creates an Evil Eval scenario with equal model, tools,
185
- workspace, user facts, and budget across two conditions. The only intended difference is the availability
206
+ workspace, user-channel availability, facts, and budget across two conditions. The only intended difference is the availability
186
207
  of LOOM. Runs are repeated, context is forcibly reset, outputs are blinded and order-swapped, and ceremony,
187
208
  user burden, time, and token cost are penalized alongside quality. See [EVIL_EVAL.md](EVIL_EVAL.md).
188
209
 
@@ -194,11 +215,11 @@ user burden, time, and token cost are penalized alongside quality. See [EVIL_EVA
194
215
  npm test
195
216
  ```
196
217
 
197
- The v2 test suite exercises the complete loop, including a 250-Task Work Map, context selection,
198
- superseding decisions, scalable design documents, professional-field separation, capability compilation,
199
- multi-attempt Keeper revision, stale digest and duplicate-run
200
- rejection, exact-file Task start, block/reopen including disproven completion, per-done-condition evidence,
201
- and Evil Eval controls. See the
218
+ The v2 test suite (20 end-to-end tests) exercises the complete loop, including a 250-Task Work Map, context selection,
219
+ superseding decisions, scalable design documents, professional-field separation, capability compilation with
220
+ source-citation validation, multi-attempt Keeper revision with auto-pass, stale digest and duplicate-run
221
+ rejection, exact-file Task start, block/reopen including disproven completion, per-acceptance-criterion evidence,
222
+ deliverable coverage, decision recording with affected-task warnings, and Evil Eval controls. See the
202
223
  [complete UX and loop specification](docs/UX_FLOW.md).
203
224
 
204
225
  ## Documentation
package/README.zh-CN.md CHANGED
@@ -87,13 +87,28 @@ loom --version
87
87
  进入项目后,Agent 运行:
88
88
 
89
89
  ```bash
90
- loom init
91
- loom context
92
- ```
93
-
94
- 当存在活跃 Task 时,`loom context` 还会恢复一段紧凑的执行协议:先把 Task 与当前工作区和版本控制状态校准,编辑前检查相关测试,根据风险和精确的 `done_when` 选择证据,在重要交接点写回 `completed/current/next`,最后只用可复现证据关闭 Task。它不会为了形式感强迫所有工作都写一个测试或开一个 PR。
95
-
96
- Agent `.loom/PROJECT.md`、设计文档和能力卷宗作为人类可读的项目事实维护。结构化写入通过 JSON 文件完成,让长内容可以审计,也避免 shell 引号损坏数据:
90
+ loom init
91
+ loom context
92
+ ```
93
+
94
+ 当存在活跃 Task 时,`loom context` 还会恢复一段紧凑的执行协议:先把 Task 与当前工作区和版本控制状态校准,编辑前检查相关测试,根据风险和精确的 `acceptance` 条件选择证据,在重要交接点写回 `completed/current/next`,在里程碑向人类展示真实可运行的东西,最后只用可复现证据关闭 Task。它不会为了形式感强迫所有工作都写一个测试或开一个 PR。
95
+
96
+ ### 无人值守与 benchmark 运行
97
+
98
+ 当人类不可达时,LOOM 不会凭空编造一次用户对话。向上下文编译器说明人类通道不可用后,Agent 会依次检查工作区和工具、仅在任务许可时研究客观外部事实,然后记录有边界的假设并选择可逆方案;若需要不可逆、高风险或有实质成本的授权,则阻塞。网络搜索永远不能替代用户的意图、偏好或许可。
99
+
100
+ ```bash
101
+ loom context --human-channel unavailable
102
+ ```
103
+
104
+ Benchmark runner 可以通过外部 sidecar 将 LOOM 状态放在评分工作区之外;**每一条** LOOM 命令都要带同一个状态目录。Task 中的 `.loom/PROJECT.md` 等虚拟引用仍能使用,但 `init` 不会在被评分工作区写入 `.loom/` 或 `AGENTS.md`。
105
+
106
+ ```bash
107
+ loom init --state-dir /runner/run-001/loom-state
108
+ loom context --state-dir /runner/run-001/loom-state --human-channel unavailable
109
+ ```
110
+
111
+ Agent 将 `.loom/PROJECT.md`、设计文档和能力卷宗作为人类可读的项目事实维护。结构化写入通过 JSON 文件完成,让长内容可以审计,也避免 shell 引号损坏数据:
97
112
 
98
113
  ```bash
99
114
  loom record --json-file understanding-update.json
@@ -131,10 +146,10 @@ loom task done TASK-001 --json-file evidence.json
131
146
 
132
147
  ```json
133
148
  {
134
- "evidence": ["npm test: 21 passed, 0 failed"],
135
- "checks": [
149
+ "evidence": ["npm test: 20 passed, 0 failed"],
150
+ "acceptance_results": [
136
151
  {
137
- "criterion": "The exact done_when sentence from the Task.",
152
+ "criterion": "The exact acceptance criterion from the Task.",
138
153
  "evidence": ["The command, artifact, or observation that proves this criterion."]
139
154
  }
140
155
  ]
@@ -151,7 +166,7 @@ LOOM 2 用一个自适应理解环、可扩展的设计文档图、彼此独立
151
166
 
152
167
  ## 证明 LOOM 真的有用
153
168
 
154
- `loom eval scaffold --json-file scenario.json` 会创建一个 Evil Eval 场景。在两个条件中,模型、工具、工作区、用户事实和预算完全相同;唯一预期差异是能否使用 LOOM。实验会重复运行、强制重置上下文、匿名并交换产物顺序,同时把仪式成本、用户负担、时间和 token 消耗与质量一起计分。详见 [EVIL_EVAL.md](EVIL_EVAL.md)。
169
+ `loom eval scaffold --json-file scenario.json` 会创建一个 Evil Eval 场景。在两个条件中,模型、工具、工作区、人类通道可用性、用户事实和预算完全相同;唯一预期差异是能否使用 LOOM。实验会重复运行、强制重置上下文、匿名并交换产物顺序,同时把仪式成本、用户负担、时间和 token 消耗与质量一起计分。详见 [EVIL_EVAL.md](EVIL_EVAL.md)。
155
170
 
156
171
  ![LOOM Evil Eval](docs/loom-eval-loop.svg)
157
172
 
@@ -161,7 +176,7 @@ LOOM 2 用一个自适应理解环、可扩展的设计文档图、彼此独立
161
176
  npm test
162
177
  ```
163
178
 
164
- v2 测试覆盖完整闭环,包括 250 个 Task 的 Work Map、上下文选择、决策替代历史、可扩展设计文档、专业领域分离、能力编译、多轮 Keeper 修订、陈旧 digest 与重复 run 拒绝、精确文件级 Task 启动、阻塞与重开(包括完成证据被推翻)、逐完成条件证据,以及 Evil Eval 的控制变量。详见[完整 UX 与闭环规范](docs/UX_FLOW.md)。
179
+ v2 测试套件(20 个端到端测试)覆盖完整闭环,包括 250 个 Task 的 Work Map、上下文选择、决策替代历史、可扩展设计文档、专业领域分离、能力编译(含 source 引用校验)、多轮 Keeper 修订(含 auto-pass)、陈旧 digest 与重复 run 拒绝、精确文件级 Task 启动、阻塞与重开(包括完成证据被推翻)、逐 acceptance 条件证据、交付物覆盖、决策记录与受影响 Task 警告,以及 Evil Eval 的控制变量。详见[完整 UX 与闭环规范](docs/UX_FLOW.md)。
165
180
 
166
181
  ## 文档
167
182
 
package/cli/bin/loom.js CHANGED
@@ -4,26 +4,35 @@ import { readFileSync } from 'node:fs';
4
4
  import { dirname, resolve } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import {
7
+ addDeliverable,
7
8
  blockTask,
8
9
  checkProject,
10
+ checkDeliverableCoverage,
9
11
  compileContext,
10
12
  completeTask,
13
+ confirmCapability,
14
+ configureRuntime,
11
15
  createCapability,
12
16
  createDesign,
17
+ recordDecision,
13
18
  getCapability,
19
+ getCapabilityStatus,
14
20
  getDesign,
15
21
  getKeeperPrompt,
16
22
  getTask,
17
23
  importTasks,
18
24
  initProject,
19
25
  listCapabilities,
26
+ listDeliverables,
20
27
  listDesigns,
21
28
  loadProject,
22
29
  markReady,
23
30
  recordKeeper,
24
31
  recordUnderstanding,
25
32
  reopenTask,
33
+ researchCapability,
26
34
  scaffoldEval,
35
+ synthesizeCapability,
27
36
  skipKeeper,
28
37
  startTask,
29
38
  taskSummary,
@@ -63,19 +72,46 @@ function help() {
63
72
 
64
73
  The human talks naturally to the Agent. The Agent uses these commands silently.
65
74
 
75
+ Typical flow (first pass):
76
+ 1. loom init — create .loom/ skeleton
77
+ 2. loom record — confirm facts, assumptions, open questions
78
+ 3. loom design add — write design documents for consequential systems
79
+ 4. loom capability add → research → synthesize → confirm
80
+ — build professional decision trees for fields that matter
81
+ 5. loom deliverable add — decompose the delivery surface
82
+ 6. loom task plan — write Tasks with acceptance criteria covering deliverables
83
+ 7. loom project ready — freeze a digest for Keeper review
84
+ 8. loom keeper prompt → record — fresh Agent verifies build-readiness (one-time)
85
+ 9. loom task start → done — execute one Task at a time, fill acceptance evidence
86
+ 10. loom check — verify health, coverage, and drift
87
+
88
+ When a new idea changes an existing decision:
89
+ loom decision --json-file <decision.json> — record what changed and affected tasks
90
+ then update the design document directly; loom check warns which done tasks need reopening.
91
+
66
92
  Start and resume
67
93
  loom init
68
- loom context [--task TASK-001] [--keeper]
94
+ loom context [--task TASK-001] [--keeper] [--human-channel available|unavailable]
69
95
  loom check
70
96
  loom prompts
71
97
 
72
98
  Preserve understanding
73
99
  loom record --json-file <update.json>
100
+ loom decision --json-file <decision.json>
74
101
  loom project ready
75
102
  loom design add <slug> --title <text> --kind <product|experience|system|contract|verification|operations|research>
76
103
  loom design list|get <slug>
77
104
  loom capability add <slug> --title <professional-field>
78
105
  loom capability list|get <slug>
106
+ loom capability research <slug> --field <text> (creates research/_guide.md — add .md files there)
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)
109
+ loom capability status <slug>
110
+
111
+ Map the delivery surface
112
+ loom deliverable add <slug> --title <text> --kind <module|feature|behavior|interface|artifact|operational|verification|other>
113
+ loom deliverable list
114
+ loom deliverable coverage
79
115
 
80
116
  Maintain the work map
81
117
  loom task plan --json-file <tasks.json>
@@ -86,6 +122,10 @@ Maintain the work map
86
122
  loom task reopen <id> [--reason <reason>]
87
123
  loom task done <id> --json-file <evidence.json>
88
124
 
125
+ Each Task should produce one verifiable unit of real work. Use acceptance[] with criterion,
126
+ verify_by, and evidence fields. Task completion fills in each acceptance condition's evidence
127
+ with the actual result (for acceptance tasks) or quotes each done_when criterion (for legacy tasks).
128
+
89
129
  One-time independent handoff
90
130
  loom keeper prompt
91
131
  loom keeper record --json-file <result.json>
@@ -94,11 +134,18 @@ One-time independent handoff
94
134
  Evaluate LOOM itself
95
135
  loom eval scaffold --json-file <scenario.json>
96
136
 
137
+ Use \`--state-dir <outside-workspace-dir>\` on every command to keep LOOM state in an isolated sidecar
138
+ (for example, a benchmark runner's per-run state directory). Sidecar initialization never edits AGENTS.md.
139
+
97
140
  Use JSON files for structured writes so long content and shell quoting remain auditable.
98
- Task completion JSON includes evidence plus one check for every exact done_when criterion.`;
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).`;
99
143
  }
100
144
 
101
145
  try {
146
+ configureRuntime({ stateDir: option('--state-dir') });
147
+ const humanChannel = option('--human-channel');
148
+ if (humanChannel && !['available', 'unavailable'].includes(humanChannel)) throw new Error('--human-channel must be available or unavailable');
102
149
  switch (command) {
103
150
  case '--version':
104
151
  case '-v': {
@@ -117,7 +164,7 @@ try {
117
164
  break;
118
165
  case 'context':
119
166
  case 'resume':
120
- output(compileContext({ taskId: option('--task'), keeper: argv.includes('--keeper') }));
167
+ output(compileContext({ taskId: option('--task'), keeper: argv.includes('--keeper'), humanChannel: humanChannel || 'available' }));
121
168
  break;
122
169
  case 'prompts':
123
170
  output(promptCatalog());
@@ -125,6 +172,9 @@ try {
125
172
  case 'record':
126
173
  output(recordUnderstanding(jsonFile()));
127
174
  break;
175
+ case 'decision':
176
+ output(recordDecision(jsonFile()));
177
+ break;
128
178
  case 'check': {
129
179
  const result = checkProject();
130
180
  output(result);
@@ -159,7 +209,31 @@ try {
159
209
  else if (subcommand === 'get') {
160
210
  if (!rest[0]) throw new Error('Usage: loom capability get <slug>');
161
211
  output(getCapability(rest[0]));
162
- } else throw new Error('Usage: loom capability add|list|get');
212
+ } else if (subcommand === 'research') {
213
+ if (!rest[0]) throw new Error('Usage: loom capability research <slug> --field <text>');
214
+ output(researchCapability(rest[0], { field: option('--field') }));
215
+ } else if (subcommand === 'synthesize') {
216
+ if (!rest[0]) throw new Error('Usage: loom capability synthesize <slug>');
217
+ output(synthesizeCapability(rest[0]));
218
+ } else if (subcommand === 'confirm') {
219
+ if (!rest[0]) throw new Error('Usage: loom capability confirm <slug> --scenario <text>');
220
+ output(confirmCapability(rest[0], { scenario: option('--scenario') }));
221
+ } else if (subcommand === 'status') {
222
+ if (!rest[0]) throw new Error('Usage: loom capability status <slug>');
223
+ output(getCapabilityStatus(rest[0]));
224
+ } else throw new Error('Usage: loom capability add|list|get|research|synthesize|confirm|status');
225
+ break;
226
+ }
227
+ case 'deliverable': {
228
+ if (subcommand === 'add') {
229
+ const slug = rest[0];
230
+ const title = option('--title');
231
+ const kind = option('--kind');
232
+ if (!slug) throw new Error('Usage: loom deliverable add <slug> --title <text> --kind <module|feature|behavior|interface|artifact|operational|verification|other>');
233
+ output(addDeliverable(slug, { title, kind, notes: option('--notes') }));
234
+ } else if (subcommand === 'list') output(listDeliverables());
235
+ else if (subcommand === 'coverage') output(checkDeliverableCoverage());
236
+ else throw new Error('Usage: loom deliverable add|list|coverage');
163
237
  break;
164
238
  }
165
239
  case 'task': {