@haaaiawd/loom 1.2.2 → 2.0.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +11 -58
  2. package/CONTRIBUTING.md +37 -0
  3. package/EVIL_EVAL.md +112 -0
  4. package/README.md +193 -446
  5. package/README.zh-CN.md +174 -0
  6. package/SECURITY.md +11 -0
  7. package/cli/bin/loom.js +170 -995
  8. package/cli/src/protocol.js +367 -0
  9. package/cli/src/store.js +626 -0
  10. package/design.md +194 -0
  11. package/docs/PROMPT_CATALOG.md +99 -0
  12. package/docs/RELEASE_CHECKLIST.md +53 -0
  13. package/docs/UX_FLOW.md +171 -0
  14. package/docs/brand/loom-mark.svg +18 -0
  15. package/docs/brand/loom-readme-header.svg +34 -0
  16. package/docs/brand/loom-readme-header.zh-CN.svg +29 -0
  17. package/docs/loom-eval-loop.drawio +21 -0
  18. package/docs/loom-eval-loop.svg +56 -0
  19. package/docs/loom-production-loop.drawio +41 -0
  20. package/docs/loom-production-loop.svg +92 -0
  21. package/package.json +43 -40
  22. package/EXTERNAL_ACQUISITION_DESIGN.md +0 -143
  23. package/cli/help/asset.md +0 -36
  24. package/cli/help/atelier.md +0 -37
  25. package/cli/help/capability.md +0 -73
  26. package/cli/help/concepts.md +0 -103
  27. package/cli/help/doctor.md +0 -73
  28. package/cli/help/expertise.md +0 -51
  29. package/cli/help/loop.md +0 -134
  30. package/cli/help/patch.md +0 -33
  31. package/cli/help/preview.md +0 -60
  32. package/cli/help/proposals.md +0 -21
  33. package/cli/help/version.md +0 -136
  34. package/cli/help/workflow.md +0 -114
  35. package/cli/src/activate.js +0 -473
  36. package/cli/src/asset-library.js +0 -384
  37. package/cli/src/atelier.js +0 -331
  38. package/cli/src/auto.js +0 -116
  39. package/cli/src/capability-graph.js +0 -430
  40. package/cli/src/capability-proposals.js +0 -225
  41. package/cli/src/diagnostics.js +0 -766
  42. package/cli/src/expertise-pack.js +0 -336
  43. package/cli/src/guide.js +0 -495
  44. package/cli/src/help.js +0 -41
  45. package/cli/src/init.js +0 -187
  46. package/cli/src/intent-draft.js +0 -303
  47. package/cli/src/intent-map.js +0 -747
  48. package/cli/src/patch.js +0 -214
  49. package/cli/src/philosophy.js +0 -331
  50. package/cli/src/preview-prompt.md +0 -337
  51. package/cli/src/preview.js +0 -73
  52. package/cli/src/shared/intent-ref.js +0 -38
  53. package/cli/src/shared/md-utils.js +0 -125
  54. package/cli/src/shared/paths.js +0 -73
  55. package/cli/src/shared/proof-reference.js +0 -19
  56. package/cli/src/shared/verification-method.js +0 -32
  57. package/cli/src/verify.js +0 -394
  58. package/cli/src/version.js +0 -134
  59. package/dimensions/AUTHORSHIP.md +0 -45
  60. package/dimensions/PART_DECOMPOSITION.md +0 -42
  61. package/dimensions/SEARCH_METHODOLOGY.md +0 -101
  62. package/dimensions/examples/AGENT_SYSTEM/README.md +0 -219
  63. package/dimensions/examples/CLI_TOOL/README.md +0 -163
  64. package/dimensions/universal/COLLABORATION_PHILOSOPHY.md +0 -28
  65. package/dimensions/universal/ENGINEERING_CREED.md +0 -30
  66. package/dimensions/universal/PRODUCT_PHILOSOPHY.md +0 -32
  67. package/meta/BASELINE.md +0 -91
  68. package/meta/INTENT_LOOP.md +0 -296
  69. package/meta/PHILOSOPHY_WEAVER.md +0 -110
  70. package/meta/ROLE_ACTIVATION.md +0 -114
  71. package/roles/architect.md +0 -86
  72. package/roles/forge.md +0 -112
  73. package/roles/keeper.md +0 -113
  74. package/roles/visionary.md +0 -57
  75. package/templates/ASSET_LIBRARY_MANIFEST_TEMPLATE.json +0 -10
  76. package/templates/ATELIER_RECORD_TEMPLATE.json +0 -48
  77. package/templates/CAPABILITY_BRIEF_TEMPLATE.md +0 -35
  78. package/templates/CAPABILITY_GRAPH_TEMPLATE.json +0 -11
  79. package/templates/EXPERTISE_PACK_TEMPLATE.json +0 -22
  80. package/templates/INTENT_MAP_TEMPLATE.json +0 -85
  81. package/templates/PHILOSOPHY_TEMPLATE.md +0 -44
  82. package/templates/VISION_TEMPLATE.md +0 -44
package/README.md CHANGED
@@ -1,462 +1,209 @@
1
- # LOOM
2
-
3
- > **Loop + Orchestration + Ontology + Mind**
4
- >
5
- > 哲学是经线,意图是纬线,loop 的往复就是织机运作,织出软件。
6
-
7
- ---
8
-
9
- ## LOOM 是什么
10
-
11
- LOOM 是一个**哲学驱动的 Agent 质量框架**,核心理念:
12
-
13
- **让 Agent 先拥有项目判断,再为当前任务编译专业能力;在可靠完成之上,通过比较与独立证据追求出众。**
14
-
15
- LOOM 的核心机制:
16
- 1. **Project Doctrine** 从项目事实中形成长期判断,而不是套用规范模板
17
- 2. **Intent + Contract** 同时定义可靠完成的底线与可选的质量上限
18
- 3. **Expertise Compiler** 为当前任务临时组装领域、品味、作者、批评与验证能力
19
- 4. **Quality Arena + Quality Proof** 用机制不同的候选和独立证据支撑质量提升
20
- 5. **Authorship + Atelier** 在真正需要创作判断时形成作者命题、媒介原型与可审计选择
21
-
22
- ---
23
-
24
- ## 核心概念
25
-
26
- | 概念 | 一句话解释 |
27
- |---|---|
28
- | **哲学** | 项目的价值观和工程原则——为什么存在、什么不做、冲突时谁优先。由 Weaver 从真实思想体系织造,不是模板填空 |
29
- | **Intent** | 一个意图单元——不是"做什么"(任务),是"为什么做"(意图)。每个 Intent 有验收契约,Keeper 据此判定实现是否忠实 |
30
- | **Intent Map** | 所有 Intent 的依赖图(JSON)。Architect 绘制,定义拓扑序和依赖关系 |
31
- | **Capability Graph** | 在 Intent 前展开项目问题面、能力缺口、风险和证据;高影响节点必须路由,并回链到 Intent |
32
- | **Expertise Pack** | Forge 通过真实外部检索为当前 Intent 编译的来源化核心信息组;绑定 revision,不成为永久规则 |
33
- | **Authorial Stance** | 针对单个 Intent 编译的创作命题、选择、拒绝项、媒介语法和验证视角,不是 Persona 扮演 |
34
- | **Atelier Path** | 可选创作深路径:冻结基线、形成机制不同候选、比较或保留原版,并把证据写入唯一 Atelier Record |
35
- | **Quality Arena** | 以基线和机制不同候选进行探索、比较、实现与观察 |
36
- | **Quality Proof** | Keeper 独立验证完成与质量声明,证据不足时不允许宣称提升 |
37
- | **Intent Loop** | 选择 编译专业能力 实现/比较 独立证明 闭合或回流 |
38
- | **Keeper** | 独立验证角色——不继承 Forge 的解释,从磁盘重新加载意图和契约 |
39
- | **底线** | 不可妥协的约束(BASELINE.md 5 条 + 项目特定底线)。角色激活时强制加载,哲学不能覆盖 |
40
-
41
- ### Intent Loop 怎么跑
42
-
43
- ```
44
- Host/Orchestrator 选 Intent(拓扑序第一个 pending 且依赖都 completed 的)
45
-
46
- Host/Orchestrator 更新 status → in_progress
47
-
48
- Forge 编译 Expertise Pack,并在需要时运行 Quality Arena
49
-
50
- Keeper 验证(基础四维;有质量契约时增加 quality_achievement,相对提升时附 Quality Proof)
51
-
52
- 判定结果:
53
- passed → status completed,回到选 Intent
54
- deviated → Forge 对话修正,重新实现重新验证(连续 3 轮升级 blocked)
55
- blocked → status blocked,停下报告用户
56
- pending_human 等用户补充判定(L3 人类反馈,如游戏手感)
57
- ```
58
-
59
- **Loop 终止**:所有 Intent 的 status 为 completed → 项目阶段完成。
60
-
61
- 对会变更既有用户或系统状态的 Intent,Architect `continuity_required: true`。它不创建第二份需求文档,而是要求同一份 acceptance 明确“哪些旧状态不得消失”与“旧状态 操作 新状态”的验证序列。此类 Intent 只有结果、守恒、可复现证据(以及按需的质量证明)同时通过,才允许闭合。
62
-
63
- ---
64
-
65
- ## 快速开始
66
-
67
- ### 安装
1
+ <p align="center"><strong>English</strong> · <a href="README.zh-CN.md">简体中文</a></p>
2
+
3
+ <p align="center">
4
+ <img src="docs/brand/loom-readme-header.svg" alt="LOOM — Keep the whole. Continue the work." width="100%">
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/@haaaiawd/loom"><img src="https://img.shields.io/npm/v/%40haaaiawd%2Floom?style=flat-square&amp;color=4169E1&amp;label=npm" alt="npm version"></a>
9
+ <img src="https://img.shields.io/badge/node-%E2%89%A518-17212B?style=flat-square" alt="Node.js 18 or newer">
10
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-9AD8C2?style=flat-square&amp;labelColor=17212B" alt="MIT license"></a>
11
+ </p>
12
+
13
+ <p align="center"><strong>The human talks to the Agent. LOOM helps the Agent remember, understand, and continue.</strong></p>
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.
18
+
19
+ The human does not learn a framework or operate a CLI. They describe what they want, answer useful
20
+ questions, disagree, delegate decisions, and watch the work become real. The Agent uses LOOM in the
21
+ background to preserve the whole project across context compression, new sessions, and implementation.
22
+
23
+ <table>
24
+ <tr>
25
+ <td width="33%"><strong>Whole over fragments</strong><br>Keep the result, decisions, systems, and unknowns connected.</td>
26
+ <td width="33%"><strong>Expertise over costumes</strong><br>Compile project-specific professional judgment, not decorative expert personas.</td>
27
+ <td width="33%"><strong>Proof over ceremony</strong><br>Use independent handoff, exact done conditions, and disk evidence.</td>
28
+ </tr>
29
+ </table>
30
+
31
+ ## The loop
32
+
33
+ ![The LOOM production loop](docs/loom-production-loop.svg)
34
+
35
+ LOOM has three explicit feedback loops: understanding converges on the whole project; a fresh Keeper
36
+ tests the frozen handoff and returns concrete gaps; restartable Tasks carry implementation and evidence
37
+ across interruptions. A failed Keeper does not become a warning that everyone politely ignores—it sends
38
+ the project back to the exact source that needs repair, then requires a changed digest and a new Keeper.
39
+
40
+ The loop is adaptive. LOOM does not provide a universal questionnaire, fixed professional roles, or
41
+ a mandatory phase ritual. The Agent keeps clarifying while unknowns could materially change the whole.
42
+ It proceeds when the remaining uncertainty is reversible and local, or when the human explicitly asks
43
+ to skip after hearing the concrete cost.
44
+
45
+ ## Project truth on disk
46
+
47
+ An initialized project contains one small semantic backbone:
48
+
49
+ ```text
50
+ .loom/
51
+ ├── PROJECT.md concise entry point and map of the current whole
52
+ ├── DECISIONS.md concise history when important decisions supersede earlier ones
53
+ ├── design/ product, experience, system, contract, verification, operations, or research docs
54
+ ├── capabilities/ one project-specific dossier per recognizable professional field
55
+ ├── state.json confirmed facts, assumptions, unresolved questions, Keeper status
56
+ ├── tasks.json broad Work Map plus the detailed active horizon
57
+ └── eval/ optional Evil Eval scenarios for testing LOOM itself
58
+ ```
59
+
60
+ Small projects may need few design documents; large projects may need many. A consequential subsystem,
61
+ experience, interface, contract, or operational concern gets its own document when a fresh Agent must
62
+ understand or verify it independently. `PROJECT.md` maps the whole instead of becoming a thousand-line attic.
63
+
64
+ ### Capability dossiers
65
+
66
+ A dossier exists only when specialist knowledge would change a question, design choice,
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.
72
+
73
+ ### Work Map and Task
74
+
75
+ The Work Map may be hundreds or thousands of lines. It is stored, searched, and revised on disk; it
76
+ is not injected into every model context. Planning begins broadly, while detailed steps are compiled
77
+ only for the active horizon.
78
+
79
+ A Task is not a miniature bureaucracy. It is the smallest restartable checkpoint that tells a fresh
80
+ Agent:
81
+
82
+ - what observable result to create;
83
+ - what proves completion;
84
+ - what must not be damaged;
85
+ - which project and capability documents matter;
86
+ - what has happened, what is happening, and what comes next;
87
+ - which evidence already exists and which exact done condition it proves.
88
+
89
+ ## Agent quick start
90
+
91
+ Install the CLI:
68
92
 
69
93
  ```bash
70
94
  npm install --global @haaaiawd/loom
71
95
  loom --version
72
96
  ```
73
97
 
74
- 也可以不做全局安装,直接运行:
98
+ Or install from the repository during development:
99
+
100
+ ```bash
101
+ npm install --global .
102
+ loom --version
103
+ ```
104
+
105
+ Inside a project, the Agent runs:
106
+
107
+ ```bash
108
+ loom init
109
+ loom context
110
+ ```
111
+
112
+ The Agent edits `.loom/PROJECT.md`, design documents, and capability dossiers as human-readable project truth. Structured
113
+ writes use JSON files so long content remains auditable and shell quoting does not corrupt it:
75
114
 
76
115
  ```bash
77
- npx @haaaiawd/loom --help
116
+ loom record --json-file understanding-update.json
117
+ loom design add product --title "Product definition" --kind product
118
+ loom design add local-analysis --title "Local analysis system" --kind system
119
+ loom design add acceptance --title "Vertical-slice verification" --kind verification
120
+ loom capability add ui-ux-design --title "UI/UX design"
121
+ loom capability add behavioral-psychology --title "Behavioral psychology"
122
+ loom task plan --json-file initial-work-map.json
123
+ loom project ready
78
124
  ```
79
125
 
80
- ### 步骤 0:诊断当前阶段
81
-
126
+ At the transition to material execution, open a fresh Agent thread and give it one short instruction:
127
+
128
+ ```text
129
+ Run loom keeper prompt in this project and follow it. Decide whether you can responsibly start.
130
+ ```
131
+
132
+ If Keeper returns `needs_revision` or `blocked`, those exact gaps reappear in `loom context`. The Agent
133
+ repairs the relevant project, design, capability, or Task source, prepares a changed digest, and opens a
134
+ different fresh Keeper. If the host cannot create a subagent, the human can open a new window and use the
135
+ same sentence. After the one-time handoff passes, the execution Agent starts and maintains Tasks normally:
136
+
82
137
  ```bash
83
- loom guide
84
- loom guide --dry-run # 只读诊断,不写 heartbeat
138
+ loom task next
139
+ loom task start TASK-001
140
+ loom context
141
+ loom task update TASK-001 --json-file progress.json
142
+ loom task block TASK-001 --json-file block.json
143
+ loom task reopen TASK-001
144
+ loom task reopen TASK-001 --reason "Prior completion evidence was disproven"
145
+ loom task done TASK-001 --json-file evidence.json
85
146
  ```
86
147
 
87
- guide 检测项目当前在哪个阶段,输出"你在阶段 X,下一步做 Y"。
88
- Agent 每完成一步都跑 guide 确认下一步。
89
- 如果只是审计或探测,不希望产生任何状态写入,用 `loom guide --dry-run`。
90
-
91
- `guide` 的下一步是 `loom activate <role>` 时,先运行这条命令:它会把该阶段需要的
92
- 规范与版本化输入编译为 Context Pack。`guide` 只负责导航,不输出待阅读文件清单。
93
-
94
- ### AUTO 模式
95
-
96
- ```bash
97
- loom auto on # Agent 在允许阶段连续推进;不会跳过契约、证据或 Keeper 门禁
98
- loom auto off # 每步需要用户确认
99
- ```
100
-
101
- ### 步骤 1:初始化项目
102
-
103
- ```bash
104
- loom init
105
- ```
106
-
107
- **输入**:无(在项目根目录执行)
108
- **产出**:`.loom/v1/` 目录结构 + 模板文件 + AGENTS.md 锚点
109
- **下一步**:`loom guide` 激活 Weaver 织造哲学
110
-
111
- ### 步骤 2:织造哲学
112
-
113
- ```bash
114
- loom activate weaver
115
- ```
116
-
117
- **输入**:项目特征(什么类型的项目、目标用户、技术栈、约束)
118
- **Weaver 会做什么**:扫描 `dimensions/` 判断激活哪些维度 搜索高质量参考 萃取原则 产出哲学文档
119
- **产出**:`.loom/v1/00_PHILOSOPHY/` 下的哲学文档(PRODUCT_PHILOSOPHY、ENGINEERING_CREED、DECISION_RUBRIC,按需领域哲学,按需 PROJECT_BASELINE)
120
- **怎么判断合格**:哲学文档有北极星、有反模式清单、有决策取舍规则。如果全是空话,让它重做
121
- **下一步**:激活 Visionary 定义愿景
122
-
123
- ### 步骤 3:定义愿景
124
-
125
- ```bash
126
- loom activate visionary
127
- ```
128
-
129
- **输入**:用户需求(产品要解决什么问题、目标用户是谁)
130
- **Visionary 会做什么**:基于哲学定义产品愿景 → 为每个 Intent 写意图叙事("为什么存在")
131
- **产出**:`.loom/v1/01_VISION.md`(含北极星 + 意图叙事列表)
132
- **怎么判断合格**:意图叙事是"为什么"不是"做什么"。如果写成了功能列表,让它重做
133
- **下一步**:激活 Architect 设计系统
134
-
135
- ### 步骤 4:设计系统
136
-
137
- ```bash
138
- loom activate architect
139
- ```
140
-
141
- **输入**:愿景文档 + 哲学文档
142
- **Architect 会做什么**:先展开 Capability Graph → 设计系统边界 → 绘制 Intent Map → 定义完成契约、按需的质量契约与专业能力需求
143
- **产出**:`.loom/v1/07_CAPABILITY_GRAPH.json` + `07_CAPABILITY_BRIEFS/` + `.loom/v1/02_ARCHITECTURE.md` + `.loom/v1/04_INTENT_MAP.json`
144
- **怎么判断合格**:高影响图谱节点都有路由、Intent 都可回链到图谱,完成契约可观察,质量契约可比较,依赖无环
145
- **下一步**:进入 Intent Loop
146
-
147
- ### 步骤 5:进入 Intent Loop
148
-
149
- ```bash
150
- # Keeper 选 Intent 并更新状态
151
- loom intent next # 查看下一个可执行 Intent
152
- loom intent update INT-001 --status in_progress
153
-
154
- # Forge 编译专业能力并实现
155
- loom activate forge --intent INT-001
156
-
157
- # 仅当 Architect 为该 Intent 声明 quality_strategy=atelier
158
- loom atelier init INT-001
159
- loom atelier validate INT-001
160
-
161
- # Keeper 独立形成 Quality Proof
162
- loom activate keeper --intent INT-001
163
- loom verify contract INT-001 # 查看验收契约
164
- loom verify write --json-file verification.json # 写入验证记录
165
-
166
- # 根据判定结果
167
- loom intent update INT-001 --status completed # passed
168
- loom intent update INT-001 --status blocked # blocked
169
-
170
- # 查看进度
171
- loom intent status
172
- ```
173
-
174
- **Loop 结束**:`loom intent status` 显示所有 Intent 为 completed。
175
-
176
- ### 步骤 6:人类预览
177
-
148
+ Completion is deliberately explicit:
149
+
150
+ ```json
151
+ {
152
+ "evidence": ["npm test: 21 passed, 0 failed"],
153
+ "checks": [
154
+ {
155
+ "criterion": "The exact done_when sentence from the Task.",
156
+ "evidence": ["The command, artifact, or observation that proves this criterion."]
157
+ }
158
+ ]
159
+ }
160
+ ```
161
+
162
+ Run `loom --help` for the complete command surface. Run `loom check` for structural health. Run
163
+ `loom prompts` to print every cognitive message LOOM can inject: the stable collaboration core,
164
+ runtime protocol, dynamic state layer, all document templates, Keeper prompt, eval conditions, judge
165
+ prompt, and their composition order. See the [prompt and message catalog](docs/PROMPT_CATALOG.md).
166
+
167
+ ## What LOOM deliberately removed
168
+
169
+ LOOM 2 replaces the v1 chain of Doctrine, Vision, Capability Graph, Impact Gate, Intent Map, Expertise
170
+ Pack, Atelier, Quality Arena, per-Intent Keeper, and Atlas with one adaptive understanding loop, a
171
+ scalable graph of design documents, separate professional-field dossiers, one Work Map, and one
172
+ restartable Task contract.
173
+
174
+ The valuable ideas remain: project judgment, external professional capability, authored choices,
175
+ observable completion, context isolation, and evidence. They no longer require separate roles and gates.
176
+
177
+ ## Proving that LOOM helps
178
+
179
+ `loom eval scaffold --json-file scenario.json` creates an Evil Eval scenario with equal model, tools,
180
+ workspace, user facts, and budget across two conditions. The only intended difference is the availability
181
+ of LOOM. Runs are repeated, context is forcibly reset, outputs are blinded and order-swapped, and ceremony,
182
+ user burden, time, and token cost are penalized alongside quality. See [EVIL_EVAL.md](EVIL_EVAL.md).
183
+
184
+ ![The LOOM Evil Eval](docs/loom-eval-loop.svg)
185
+
186
+ ## Development
187
+
178
188
  ```bash
179
- loom preview status # 先检查 preview 是否新鲜
180
- loom preview # 新鲜则打开;过期则提示重新生成
181
- loom preview --regen # 输出生成提示词,让 Agent 重写 loom-preview.html
189
+ npm test
182
190
  ```
183
191
 
184
- preview 是人类总览用的只读投影:哲学、愿景、架构、Intent 进度、验证历史。
185
- `loom preview` 会用 mtime 检查 `.loom/v{N}` 是否比 `loom-preview.html` 更新:
186
- - 新鲜:直接打开 `loom-preview.html`
187
- - 过期:不打开旧投影,提示 `loom preview --regen`
188
- - 强行打开旧投影:`loom preview --stale`
189
-
190
- Agent 在用户说"看看进度 / 打开 preview / 看全局"时,先跑 `loom preview status`。
191
-
192
- **版本演进三档**:
193
-
194
- | 档位 | 什么时候用 | LOOM 流程 |
195
- |---|---|---|
196
- | Patch | 不触及 Intent,只修 bug / 样式 / 实现细节 | 不走 Intent Loop;跑验证并用 `loom patch record` 记录 |
197
- | Minor | 新增或修改 Intent,但不改变哲学前提、愿景北极星、架构边界 | 当前版本内变更;相关 Intent 进入 `pending` / `needs_review` |
198
- | Major | 哲学前提、愿景北极星或架构边界变化 | `loom version new` 创建新版本,全套重跑 |
199
-
200
- 当前版本全部完成后,运行 `loom guide` 会提示按三档判断,而不是默认开新版本。
201
-
202
- **CLI 命令一览**:
203
-
204
- | 命令 | 用途 |
205
- |---|---|
206
- | `loom init` | 初始化项目 |
207
- | `loom guide` | 诊断当前阶段,输出下一步引导 |
208
- | `loom guide --dry-run` | 只读诊断当前阶段,不写 heartbeat |
209
- | `loom auto on\|off\|status` | AUTO 模式开关 |
210
- | `loom activate <role>` | 输出角色激活提示词 |
211
- | `loom activate <role> --intent <id>` | 输出仅含指定 draft/官方 Intent 的角色上下文 |
212
- | `loom preview` | 打开新鲜 HTML 预览;过期时提示重新生成 |
213
- | `loom preview status` | 检查 `loom-preview.html` 是否存在、是否新鲜 |
214
- | `loom preview --regen` | 输出提示词,让 Agent 重写 HTML 预览 |
215
- | `loom preview --stale` | 强行打开过期预览 |
216
- | `loom help <topic>` | 分层指南(含 workflow、concepts、loop、capability、atelier、version、patch、doctor、preview) |
217
- | `loom version list` | 列出所有版本(* 标记当前) |
218
- | `loom version new` | 创建新版本 + 自动切换(Major 升级) |
219
- | `loom version use <v>` | 切换当前版本 |
220
- | `loom version diff <v1> <v2>` | 对比两个版本的文件差异 |
221
- | `loom patch record --json-file <path>` | 写入权威 Patch JSON 并生成 Markdown 投影 |
222
- | `loom patch list` | 列出当前版本 Patch |
223
- | `loom patch get <id>` | 查看单条 Patch |
224
- | `loom patch validate` | 校验 Patch ledger 和生成投影 |
225
- | `loom intent next` | 下一个可执行 Intent |
226
- | `loom intent status` | 进度概览 |
227
- | `loom intent get <id>` | Intent 详情 |
228
- | `loom intent add --title <text> [--depends-on <ids>]` | 创建当前版本新增 Intent draft |
229
- | `loom intent revise <id> --reason <text>` | 创建修订 draft 并报告反向依赖 |
230
- | `loom intent draft <id>` | 查看 draft |
231
- | `loom intent finalize <id> [--review <ids> --unaffected <ids>]` | 校验 draft 并原子更新官方 Map/topo_order;修订时必须分类全部下游影响 |
232
- | `loom capability graph\|frontier\|get\|coverage\|compile` | 查看能力图谱、未路由前沿、覆盖缺口和当前 Intent 的能力编译输入 |
233
- | `loom capability proposal list\|get\|submit\|decide\|close` | 以 provenance 提交新发现,并由 Architect 裁决和闭合 |
234
- | `loom asset import\|list\|search\|get\|validate` | 管理带来源、许可、哈希、批准状态与 evidence 回链的本地素材 |
235
- | `loom expertise init\|get\|validate <id>` | 创建和校验 revision-scoped Search Plan、外部来源与 Capability Capsules |
236
- | `loom atelier init\|get\|validate <id>` | 为显式 Atelier Intent 创建、读取和校验创作记录 |
237
- | `loom intent deprecate <id> --reason <text>` | 只读评估当前版本弃用影响;加 `--confirm` 并完整分类依赖方后原子写入 |
238
- | `loom intent narrative <id>` | Intent 意图叙事 |
239
- | `loom intent trace <id>` | Intent 完整追溯链(依赖+验证+哲学+叙事) |
240
- | `loom intent diff <v1> <v2>` | 按显式 lineage 比较新建、修订、拆分、合并和未映射 Intent |
241
- | `loom intent reverse-dep <id>` | 反向依赖(谁依赖这个 Intent) |
242
- | `loom intent reverse-ref <anchor>` | 反向哲学引用(哪些 Intent 引用这个锚点) |
243
- | `loom intent update <id> --status <s>` | 更新状态(Keeper 用) |
244
- | `loom philosophy get <anchor>` | 加载哲学章节 |
245
- | `loom philosophy impact <anchor>` | 只读返回直接引用该锚点的 Intent 及传递依赖影响 |
246
- | `loom philosophy revise <anchor> --classification <clarification\|minor\|major> --reason <text>` | 只读评估哲学修订;clarification/minor 加 `--confirm` 和完整分区后写审计 ADR |
247
- | `loom verify contract <id>` | 获取验收契约 |
248
- | `loom verify write --json-file <path>` | 写入验证记录 |
249
- | `loom verify history <ref> --across-versions` | 沿 predecessors 读取各 owning version 的本地验证历史 |
250
- | `loom doctor` | 项目健康检查 |
251
- | `loom context` | 上下文摘要(Agent 重启后一条命令获取状态) |
252
-
253
- 读命令 `intent get`、`intent narrative`、`intent trace` 和 `verify history` 支持 `v1:INT-003` 形式的跨版本引用;裸 ID 仍指当前版本。历史引用只读。跨版本沿革必须显式写在可选 `lineage.predecessors` 中,同 ID 或同标题不会建立映射,且 lineage 不属于 `depends_on`。
254
-
255
- 弃用只适用于当前版本中已 `completed` 的 Intent。首次运行 `loom intent deprecate <id> --reason "<why>"` 只返回目标、直接/传递依赖方、各自状态和确认命令,不写文件。确认时用 `--review` 与 `--unaffected` 将所有依赖方恰好分类一次;叶子 Intent 不需要分类参数。弃用记录写入 `lifecycle.deprecation`,目标仍为 `completed`,依赖和契约不被修改。重复确认会明确失败。
256
-
257
- 哲学修订由 CLI 分析后果和记录审计,不由 CLI 自动改写哲学文本。`philosophy impact` 与未确认的 `philosophy revise` 严格只读。确认 clarification 时全部受影响 Intent 必须归入 `--unaffected`;确认 minor 时可将确需重验的 Intent 归入 `--review`,其中 `completed` 才转为 `needs_review`。两者都不改 acceptance,并在 `03_DECISIONS/PHIL-REV-NNN.md` 记录审计。Major 永不修改当前版本,只返回 `loom version new`。
258
-
259
- ---
260
-
261
- ## 系统结构
262
-
263
- ```
264
- LOOM/
265
- ├── README.md 你在这里。系统总览
266
-
267
- ├── meta/ 元规范(薄而硬——我们写的核心)
268
- │ ├── BASELINE.md 不可妥协的底线(5 条)
269
- │ ├── ROLE_ACTIVATION.md 角色怎么激活、哲学怎么加载
270
- │ ├── INTENT_LOOP.md Loop 控制流 + Intent Map + Verification 底线
271
- │ └── PHILOSOPHY_WEAVER.md 哲学织造器规范
272
-
273
- ├── dimensions/ 哲学维度库(Weaver 的弹药库)
274
- │ ├── SEARCH_METHODOLOGY.md 检索方法论(怎么找到优质思想)
275
- │ ├── AUTHORSHIP.md Atelier 启用时加载的作者性方法
276
- │ ├── universal/ 通用层:产品/工程/协作(按需填充)
277
- │ ├── domain/ 领域层:UX/游戏/后端/AI(按需填充)
278
- │ └── crosscutting/ 交叉层:性能/安全/心理学/增长(按需填充)
279
-
280
- ├── roles/ 角色原型定义
281
- │ ├── visionary.md 远见者——定义愿景,织造意图叙事
282
- │ ├── architect.md 建筑师——展开图谱,设计系统,绘制 Intent Map
283
- │ ├── forge.md 锻造师——在哲学约束下自主实现
284
- │ └── keeper.md 守护者——验证意图忠实度
285
-
286
- ├── cli/ CLI 传感器层(Agent 通过 CLI 访问磁盘数据)
287
- │ ├── bin/loom.js 命令入口
288
- │ ├── src/ 核心库(intent-map / capability / atelier / verify)
289
- │ ├── help/ Agent 可直接读取的工作流指南
290
- │ └── test/ 端到端测试
291
-
292
- └── templates/ 项目级起点骨架
293
- ├── PHILOSOPHY_TEMPLATE.md 哲学文档起点
294
- ├── VISION_TEMPLATE.md 愿景文档起点
295
- ├── INTENT_MAP_TEMPLATE.json Intent Map 起点
296
- ├── CAPABILITY_GRAPH_TEMPLATE.json Capability Graph 起点
297
- ├── CAPABILITY_BRIEF_TEMPLATE.md Capability Brief 起点
298
- ├── ASSET_LIBRARY_MANIFEST_TEMPLATE.json Asset Library 起点
299
- ├── EXPERTISE_PACK_TEMPLATE.json 外部能力获取记录起点
300
- └── ATELIER_RECORD_TEMPLATE.json Atelier Record 起点
301
- ```
302
-
303
- ### 文档导航
304
-
305
- **想了解什么 → 读哪个文件**:
306
-
307
- | 想了解 | 读这个 |
308
- |---|---|
309
- | 底线是什么、什么不能做 | `meta/BASELINE.md` |
310
- | Loop 怎么跑、验证怎么判定 | `meta/INTENT_LOOP.md` |
311
- | 角色怎么激活 | `meta/ROLE_ACTIVATION.md` |
312
- | 哲学怎么织造 | `meta/PHILOSOPHY_WEAVER.md` |
313
- | Visionary 做什么 | `roles/visionary.md` |
314
- | Architect 做什么 | `roles/architect.md` |
315
- | Forge 做什么 | `roles/forge.md` |
316
- | Keeper 做什么 | `roles/keeper.md` |
317
- | 哲学文档长什么样 | `templates/PHILOSOPHY_TEMPLATE.md` |
318
- | 愿景文档长什么样 | `templates/VISION_TEMPLATE.md` |
319
- | Capability Graph 与 Brief 长什么样 | `cli/help/capability.md`、`templates/CAPABILITY_GRAPH_TEMPLATE.json` |
320
- | 为什么必须外部检索、Expertise Pack 怎么闭合 | `cli/help/expertise.md`、`EXTERNAL_ACQUISITION_DESIGN.md` |
321
- | Author 与 Atelier 怎么工作 | `cli/help/atelier.md`、`dimensions/AUTHORSHIP.md` |
322
- | Intent Map 长什么样 | `templates/INTENT_MAP_TEMPLATE.json` |
323
- | 怎么搜索高质量参考 | `dimensions/SEARCH_METHODOLOGY.md` |
324
-
325
- ---
326
-
327
- ## 我们写的 vs Agent 生成的
328
-
329
- **我们写的**(LOOM 的内核,薄而硬):
330
- - `meta/` — 元规范:怎么织造哲学、loop 怎么跑、角色怎么激活、底线是什么
331
- - `roles/` — 角色原型:每个角色的身份、自主空间、职责
332
- - `templates/` — 起点骨架:Agent 生成的起点,不是填空模板
333
-
334
- **Agent 生成的**(每个项目跑出来的,厚而灵活):
335
- - 哲学文档体系(Weaver 决定要几个、多详细)
336
- - 愿景文档(带意图叙事)
337
- - 架构文档(根据哲学决定结构)
338
- - Capability Graph 与按需生成的 Capability Brief
339
- - Intent Map(意图依赖图,JSON)
340
- - 验证契约和验证记录
341
-
342
- **我们的规范是元规范**——规范"怎么生成规范",不直接规范"规范长什么样"。
343
-
344
- ---
345
-
346
- ## 四个角色
347
-
348
- | 角色 | 原型 | 职责 | 激活时机 |
349
- |---|---|---|---|
350
- | **Visionary** 远见者 | 产品联合创始人 | 定义愿景,织造意图叙事 | 项目启动 |
351
- | **Architect** 建筑师 | 系统建筑师 | 展开 Capability Graph,设计系统,绘制 Intent Map | Visionary 完成后 |
352
- | **Forge** 锻造师 | 高级工程师 | 在哲学约束下自主实现 | Intent Loop 实现阶段 |
353
- | **Keeper** 守护者 | 独立验证者(独立激活) | 从磁盘事实验证意图与质量主张 | Intent Loop 验证阶段 |
354
-
355
- Visionary 和 Keeper **同源但独立**——同一个产品哲学,但 Keeper 是"回溯验证者",作为子代理运行,不继承 Forge 的实现上下文。
356
-
357
- ---
358
-
359
- ## Intent-Driven Loop
360
-
361
- ```
362
- Host/Orchestrator 选 Intent → Forge 加载意图链并自主实现 → Keeper 子代理独立验证 → 判定
363
- ↑ │
364
- │ │
365
- └────────────── passed: 闭合,下一个 Intent ──────────────────────────┘
366
- deviated: Keeper 与 Forge 对话修正 → 重新实现 → 重新验证
367
- blocked: 停下,报告用户
368
- ```
369
-
370
- Loop 的单元是意图,验证的核心问题是"实现是否忠实于原始意图"。
371
-
372
- ---
373
-
374
- ## 五条底线
375
-
376
- 所有角色、所有哲学、所有项目都必须遵守:
377
-
378
- 1. **B1:必须有结构设计** — 编码前必须有明确的结构设计
379
- 2. **B2:禁止硬编码** — 密钥、配置、环境值不进代码
380
- 3. **B3:接口契约必须显式** — 对外可观察的接口必须有显式定义
381
- 4. **B4:决策必须可追溯** — 影响架构/接口/技术栈的决策必须记录
382
- 5. **B5:意图必须可回溯** — 任何实现都必须能回溯到原始意图
383
-
384
- 底线不可被哲学覆盖。哲学内化底线,不是绕过底线。
385
-
386
- ---
387
-
388
- ## 项目级文档结构
389
-
390
- Agent 在项目中生成的文档结构:
391
-
392
- ```
393
- .loom/
394
- └── v{N}/ 版本目录(跟随项目演进)
395
- ├── 00_PHILOSOPHY/ Weaver 产出
396
- │ ├── PRODUCT_PHILOSOPHY.md
397
- │ ├── ENGINEERING_CREED.md
398
- │ ├── DECISION_RUBRIC.md
399
- │ └── ...(按需,Weaver 决定)
400
- ├── 01_VISION.md Visionary 产出(带意图叙事)
401
- ├── 02_ARCHITECTURE.md Architect 产出
402
- ├── 03_DECISIONS/ 架构决策记录
403
- ├── 04_INTENT_MAP.json 意图依赖图(DAG)
404
- ├── 05_VERIFICATION.md 每个 Intent 的验证契约
405
- ├── 06_CHANGELOG.json Patch 变更记录(唯一权威来源)
406
- ├── 06_CHANGELOG.md 确定性生成的只读投影
407
- ├── 07_CAPABILITY_GRAPH.json 问题面、能力缺口、风险、证据与 Intent 回链
408
- ├── 07_CAPABILITY_BRIEFS/ 按需生成的项目化能力 Brief
409
- └── verifications/ Keeper 的验证记录
410
- ├── INT-001.json
411
- ├── INT-001.md
412
- └── ...
413
- ```
414
-
415
- ---
416
-
417
- ## 格式原则
418
-
419
- | 内容 | 格式 | 理由 |
420
- |---|---|---|
421
- | 哲学、愿景、架构、决策 | **MD** | 叙事性,人类可读,Git diff 友好 |
422
- | Intent Map、验证判定 | **JSON** | 结构化,机器可读,CLI 可查询 |
423
- | 混合内容 | **JSON + MD + ref 互引** | JSON 存结构,MD 存叙事 |
424
-
425
- Agent 通过 **CLI 访问** JSON,不直接读文件——省 token、更高效、还能做校验。
426
-
427
- ---
428
-
429
- ## 运行流程
430
-
431
- ```
432
- 1. Weaver 织造 Project Doctrine
433
- → 读取项目事实 → 提炼长期判断 → 按决策未知搜索 → 转译为原则、边界与 Evidence Map
434
-
435
- 2. Visionary 定义愿景
436
- → 基于哲学写愿景 → 每个意图带意图叙事 → 识别需要的哲学维度
437
-
438
- 3. Architect 先展开 Capability Graph,再设计系统
439
- → 基于愿景检查问题面、能力缺口、风险与证据 → 路由高影响节点 → 绘制 Intent Map → 定义验证契约
440
-
441
- 4. LOOM Quality Engine
442
- → Forge 编译 Expertise Pack → 按需编译 Authorial Stance / 进入 Atelier
443
- → Quality Arena 实现/比较 → Keeper 形成 Quality Proof
444
- → 循环直到所有 Intent 闭合
445
- ```
446
-
447
- ---
448
-
449
- ## 当前状态
450
-
451
- - [x] `meta/` 元规范(4 个文件)
452
- - [x] `roles/` 角色原型(4 个角色)
453
- - [x] `templates/` 起点骨架
454
- - [x] `README.md` 系统总览
455
- - [x] `dimensions/SEARCH_METHODOLOGY.md` 检索方法论
456
- - [x] `cli/` CLI 访问层(Capability Graph / Proposal / Asset Library / Atelier / Quality Proof)
457
- - [x] `dimensions/AUTHORSHIP.md` 按需创作方法
458
- - [ ] 继续通过真实项目校准专业维度与 Atelier 的质量增益
459
-
460
- ---
461
-
462
- > **LOOM 的信条**:编排而非控制。给 Agent 价值观和边界,让它在边界内自主发挥。底线守住不会崩,哲学填充边界内的内容,loop 确保实现忠实于意图。
192
+ The v2 test suite exercises the complete loop, including a 250-Task Work Map, context selection,
193
+ superseding decisions, scalable design documents, professional-field separation, capability compilation,
194
+ multi-attempt Keeper revision, stale digest and duplicate-run
195
+ rejection, exact-file Task start, block/reopen including disproven completion, per-done-condition evidence,
196
+ and Evil Eval controls. See the
197
+ [complete UX and loop specification](docs/UX_FLOW.md).
198
+
199
+ ## Documentation
200
+
201
+ | Read this | When you need |
202
+ | --- | --- |
203
+ | [System design](design.md) | The architecture, storage model, invariants, and command contracts |
204
+ | [UX and loop specification](docs/UX_FLOW.md) | Every human, Agent, LOOM, Keeper, and Task transition |
205
+ | [Prompt and message catalog](docs/PROMPT_CATALOG.md) | Every message LOOM injects and how the layers compose |
206
+ | [Evil Eval protocol](EVIL_EVAL.md) | A controlled framework-vs-no-framework comparison |
207
+ | [Changelog](CHANGELOG.md) | What changed in LOOM 2 |
208
+
209
+ Editable Draw.io sources live beside both flow diagrams in [`docs/`](docs/).