@haaaiawd/loom 1.0.0 → 1.2.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 +39 -0
- package/EXTERNAL_ACQUISITION_DESIGN.md +143 -0
- package/README.md +71 -30
- package/cli/bin/loom.js +176 -7
- package/cli/help/asset.md +36 -0
- package/cli/help/atelier.md +37 -0
- package/cli/help/capability.md +73 -0
- package/cli/help/concepts.md +13 -3
- package/cli/help/expertise.md +51 -0
- package/cli/help/loop.md +4 -2
- package/cli/help/proposals.md +21 -0
- package/cli/help/workflow.md +26 -4
- package/cli/src/activate.js +85 -2
- package/cli/src/asset-library.js +384 -0
- package/cli/src/atelier.js +331 -0
- package/cli/src/capability-graph.js +416 -0
- package/cli/src/capability-proposals.js +225 -0
- package/cli/src/diagnostics.js +132 -3
- package/cli/src/expertise-pack.js +336 -0
- package/cli/src/guide.js +148 -21
- package/cli/src/init.js +11 -5
- package/cli/src/intent-map.js +20 -0
- package/cli/src/verify.js +35 -1
- package/dimensions/AUTHORSHIP.md +45 -0
- package/meta/INTENT_LOOP.md +59 -5
- package/meta/ROLE_ACTIVATION.md +17 -6
- package/package.json +11 -5
- package/roles/architect.md +24 -11
- package/roles/forge.md +30 -5
- package/roles/keeper.md +12 -0
- package/templates/ASSET_LIBRARY_MANIFEST_TEMPLATE.json +10 -0
- package/templates/ATELIER_RECORD_TEMPLATE.json +48 -0
- package/templates/CAPABILITY_BRIEF_TEMPLATE.md +35 -0
- package/templates/CAPABILITY_GRAPH_TEMPLATE.json +11 -0
- package/templates/EXPERTISE_PACK_TEMPLATE.json +22 -0
- package/templates/INTENT_MAP_TEMPLATE.json +2 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Atelier
|
|
2
|
+
|
|
3
|
+
Atelier 是 `quality_strategy=atelier` 的创作深路径。它让 Authorial Stance、基线、候选、
|
|
4
|
+
修正和选择证据成为单个版本化记录,不替代 Intent 状态或 Keeper。
|
|
5
|
+
|
|
6
|
+
## 何时启用
|
|
7
|
+
|
|
8
|
+
由 Architect 在 Intent 同时声明:
|
|
9
|
+
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"quality_contract": "相对基线可观察的质量主张与证据方式",
|
|
13
|
+
"quality_strategy": "atelier",
|
|
14
|
+
"creative_scope": "允许改变什么;必须保护什么。"
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
普通任务省略该字段或使用 `adaptive`,不会创建 Atelier Record。
|
|
19
|
+
|
|
20
|
+
## 工作流
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
loom activate forge --intent INT-001
|
|
24
|
+
loom atelier init INT-001
|
|
25
|
+
loom atelier validate INT-001
|
|
26
|
+
loom atelier get INT-001
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
记录位于 `.loom/vN/09_ATELIER/INT-001.json`,证据位于
|
|
30
|
+
`.loom/vN/09_ATELIER/files/INT-001/`。
|
|
31
|
+
|
|
32
|
+
每个候选必须绑定 `stance_revision`。Stance 改变后,旧候选要设置 `archived: true`,
|
|
33
|
+
或在重新检查后写 `requalified_for_stance_revision`。局部创作修正写入 `corrections[]`;
|
|
34
|
+
结构性新发现提交 Capability Graph proposal,由 Architect 裁决。
|
|
35
|
+
|
|
36
|
+
`loom atelier validate` 只证明记录结构、新鲜度和引用合法,不证明作品优秀。最终质量仍由
|
|
37
|
+
新的 Keeper task 依据 Quality Proof 独立判定。
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
## Capability Graph 指南
|
|
2
|
+
|
|
3
|
+
Capability Graph 位于 Vision 与 Intent Map 之间:它把项目初衷展开为需要被理解、设计、实现或证明的
|
|
4
|
+
问题面、能力缺口、风险与证据。它不是待办列表,也不替代 Intent Map。
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
loom capability graph
|
|
8
|
+
loom capability frontier
|
|
9
|
+
loom capability get <node-id>
|
|
10
|
+
loom capability coverage
|
|
11
|
+
loom capability compile <intent-id>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 工作方式
|
|
15
|
+
|
|
16
|
+
Visionary 给出 outcome、角色、非目标与项目事实。Architect 用项目类型相符的透镜检查用户旅程、
|
|
17
|
+
体验、系统、资产、横切质量和未知;每个透镜必须被展开、覆盖或明确排除。
|
|
18
|
+
|
|
19
|
+
高影响节点不能停在 `open`。它必须继续展开、生成 Capability Brief、编译为 Intent,或带理由地
|
|
20
|
+
延后/排除。`loom capability frontier` 显示尚未路由的高影响节点;`loom capability coverage` 检查
|
|
21
|
+
图谱与 Intent 的双向追溯。
|
|
22
|
+
|
|
23
|
+
高影响 `outcome` 还必须有一条真实的观察链:以 `validated_by` 指向 `evidence` 节点。该 evidence 的
|
|
24
|
+
`verification` 对象必须包含 `method`、`target`、`procedure`、`pass_criteria` 和 `artifact`,并以
|
|
25
|
+
`intent_refs` 回链负责产出该证据的 Intent。`target` 写结果真正要被看见、接收或使用的位置,例如目标
|
|
26
|
+
宿主的渲染面、用户拿到的导出文件、外部系统的接收端或人工验收现场。不要把“HTTP 200”“URL 可访问”或
|
|
27
|
+
“本地生成了文件”当作用户已得到结果。
|
|
28
|
+
|
|
29
|
+
不新增媒体、平台或版权专用节点类型:目标宿主与交付链路用 `concern` / `capability` 表达,许可、来源、
|
|
30
|
+
隐私或平台限制用 `risk` 和 `constrains` 关系表达;只有需要项目化判断时才为相关节点创建 Brief,并在其
|
|
31
|
+
“项目约束”和“产出与验证入口”中写清授权边界与实际交付验证。
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"id": "EVIDENCE-DELIVERY-RENDER",
|
|
36
|
+
"kind": "evidence",
|
|
37
|
+
"title": "在目标宿主中实际呈现交付物",
|
|
38
|
+
"status": "covered",
|
|
39
|
+
"impact": "high",
|
|
40
|
+
"route": "intent",
|
|
41
|
+
"intent_refs": ["INT-004"],
|
|
42
|
+
"verification": {
|
|
43
|
+
"method": "manual_visual",
|
|
44
|
+
"target": "目标桌面客户端的消息渲染面",
|
|
45
|
+
"procedure": "在干净会话中发送产物并观察实际渲染",
|
|
46
|
+
"pass_criteria": "用户无需打开外链即可看见完整内容",
|
|
47
|
+
"artifact": "verifications/INT-004-host-render.png"
|
|
48
|
+
},
|
|
49
|
+
"relationships": []
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Capability Brief
|
|
54
|
+
|
|
55
|
+
只有高影响、需要调研、需要专业方法或将进入当前 Intent 的能力节点才需要 Brief。Brief 位于:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
.loom/vN/07_CAPABILITY_BRIEFS/<node-id>.md
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
它写当前项目问题、成功判断、约束、能力获取计划、产出/验证入口与非目标。不要复制通用教程,
|
|
62
|
+
也不要用“你是某领域专家”代替项目化能力说明。
|
|
63
|
+
|
|
64
|
+
## 编译与回流
|
|
65
|
+
|
|
66
|
+
`loom capability compile <intent-id>` 只读显示会进入当前 Intent 的图谱节点与 Brief。Forge 激活
|
|
67
|
+
Intent 时会获得同一份输入;发现新依赖、风险或能力缺口时必须回流 Architect 更新 Graph,不能静默
|
|
68
|
+
扩展实现。Keeper 以图谱回链检查高影响问题是否真的被兑现。
|
|
69
|
+
|
|
70
|
+
Capability 节点可选声明 `acquisition_mode: adaptive | external_required | project_only`。
|
|
71
|
+
`project_only` 必须附 `acquisition_rationale`。未声明时,高影响 capability 自动提升为
|
|
72
|
+
`external_required`。Graph 只保存获取必要性,不保存网站、Skill 名称或
|
|
73
|
+
搜索词;Forge 在本轮 Expertise Pack 中按项目信号派生查询并记录真实来源。
|
package/cli/help/concepts.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
LOOM 用一条完整链路把长期判断、当前意图、专业能力、创造性探索和独立证明连起来:
|
|
4
4
|
|
|
5
5
|
```text
|
|
6
|
-
Doctrine → Intent → Contract
|
|
6
|
+
Doctrine → Intent narrative → Capability Graph → Contract
|
|
7
7
|
→ Expertise Compiler → Quality Arena → Quality Proof
|
|
8
8
|
→ Reflow
|
|
9
9
|
```
|
|
@@ -31,6 +31,12 @@ Weaver 从项目事实和决策相关证据中织造 Doctrine;它不预写产
|
|
|
31
31
|
|
|
32
32
|
Architect 是 Intent DAG 与两类契约的唯一负责人。
|
|
33
33
|
|
|
34
|
+
## Capability Graph
|
|
35
|
+
|
|
36
|
+
Capability Graph 位于 Vision 和 Intent Map 之间。它将项目初衷展开成 `outcome`、`concern`、`capability`、`risk`、`evidence` 五类节点,描述哪些问题必须被理解、设计、实现或证明。
|
|
37
|
+
|
|
38
|
+
它不是执行 DAG,也不替代 Intent Map:Graph 保留未知、研究与分叉;Intent 只保留边界明确、能独立验收的承诺。高影响节点必须有明确路由(继续展开、Brief、Intent、延后或排除),每个 Intent 必须回链至少一个图谱节点。只有需要专业方法、调研或即将进入当前 Intent 的节点才创建短小的项目化 Capability Brief。
|
|
39
|
+
|
|
34
40
|
## System Boundary
|
|
35
41
|
|
|
36
42
|
LOOM 不假装能够清除宿主 Agent 的既有记忆。`loom activate` 生成有序 Context Pack,
|
|
@@ -38,7 +44,7 @@ LOOM 不假装能够清除宿主 Agent 的既有记忆。`loom activate` 生成
|
|
|
38
44
|
|
|
39
45
|
## Expertise Compiler
|
|
40
46
|
|
|
41
|
-
Forge 针对当前 Intent 临时组装一个 Expertise Pack
|
|
47
|
+
Forge 针对当前 Intent 临时组装一个 Expertise Pack。先由 Capability Graph 编译关联节点和 Capability Brief,再回答:
|
|
42
48
|
|
|
43
49
|
1. 这是什么专业问题。
|
|
44
50
|
2. 优秀作品的判断标准是什么。
|
|
@@ -48,7 +54,10 @@ Forge 针对当前 Intent 临时组装一个 Expertise Pack,回答:
|
|
|
48
54
|
6. 如何验证专业质量。
|
|
49
55
|
|
|
50
56
|
能力名称只表示“可发现”;只有真实加载并转化为任务判断的内容才算进入 Expertise Pack。
|
|
51
|
-
|
|
57
|
+
当 External Acquisition Gate 为 required 时,Forge 只能自行派生 Search Plan,内容必须来自
|
|
58
|
+
实际打开的 Skill、网络、官方文档或研究资料;Pack 写入当前 Intent revision 的
|
|
59
|
+
`10_EXPERTISE_PACKS`,每个 Capability Capsule 都直接回链来源。Pack 仅服务当前任务,不成为
|
|
60
|
+
长期 Doctrine。
|
|
52
61
|
|
|
53
62
|
## Quality Arena
|
|
54
63
|
|
|
@@ -81,6 +90,7 @@ Keeper 在独立上下文中验证:
|
|
|
81
90
|
- 长期价值判断 → Weaver
|
|
82
91
|
- 产品目标与 narrative → Visionary
|
|
83
92
|
- 系统边界、Intent、契约 → Architect
|
|
93
|
+
- 图谱遗漏、未路由高影响节点或新的能力缺口 → Architect 更新 Capability Graph
|
|
84
94
|
- 专业能力与实现 → Forge
|
|
85
95
|
- 证据不足或判定偏离 → Keeper
|
|
86
96
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# External Acquisition 与 Expertise Pack
|
|
2
|
+
|
|
3
|
+
LOOM 把“知道任务需要某项能力”和“真正获得了这项能力”分开。Capability Graph 只决定是否
|
|
4
|
+
需要外部获取;Forge 在当前 Intent 中派生查询、实际检索,再把有来源的核心信息编译成
|
|
5
|
+
Capability Capsules。
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
loom capability compile <intent-id>
|
|
9
|
+
loom expertise init <intent-id>
|
|
10
|
+
# 编辑 .loom/vN/10_EXPERTISE_PACKS/<intent-id>.json,并实际执行检索
|
|
11
|
+
loom expertise validate <intent-id>
|
|
12
|
+
loom activate forge --intent <intent-id>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 什么时候强制
|
|
16
|
+
|
|
17
|
+
- capability 显式声明 `acquisition_mode: external_required`;
|
|
18
|
+
- 或高影响 capability 没有显式声明其他模式。
|
|
19
|
+
|
|
20
|
+
中低影响任务默认为 `adaptive`。高影响任务只有在 Architect 明确写 `adaptive` 时才按证据
|
|
21
|
+
决定是否检索;仅依赖未公开内部协议、外部知识不会改变做法的机械任务可以用 `project_only`,
|
|
22
|
+
但必须写 `acquisition_rationale`。
|
|
23
|
+
|
|
24
|
+
## Search Plan
|
|
25
|
+
|
|
26
|
+
Forge 根据 capability question、Capability Brief、Intent narrative、质量契约、creative
|
|
27
|
+
scope、媒介约束和基线缺口派生查询。关键词是运行时证据,不写回 Graph。
|
|
28
|
+
|
|
29
|
+
必须实际使用 Skill registry、网络、官方文档或研究资料。模型自行生成的原则、没有打开的
|
|
30
|
+
搜索摘要和只看标题的结果都不能登记为来源。每个计划必须写停止条件,避免无边界浏览。
|
|
31
|
+
|
|
32
|
+
## Capability Capsule
|
|
33
|
+
|
|
34
|
+
每个 required capability 至少有一个 Capsule,包含:
|
|
35
|
+
|
|
36
|
+
- 专业问题与适用时机;
|
|
37
|
+
- 规则和工作流;
|
|
38
|
+
- 决策门与失败模式;
|
|
39
|
+
- 可观察验证信号;
|
|
40
|
+
- 至少一个直接外部来源引用。
|
|
41
|
+
|
|
42
|
+
Pack 只保存项目化综合和定位信息,不复制第三方 Skill 或网页正文,也不会自动变成 Doctrine
|
|
43
|
+
或通用 Skill。Intent revision 改变后,旧 Pack 自动失效。
|
|
44
|
+
|
|
45
|
+
## Keeper
|
|
46
|
+
|
|
47
|
+
CLI 能检查 Pack 当前、来源可定位、Capsule 直接引用外部资料,但不能仅凭 JSON 判断来源是否
|
|
48
|
+
真的支持结论。Keeper 必须在独立 task 中重新打开至少一个关键来源,核对规则与判断门,并让
|
|
49
|
+
`loom verify pass` 将当前 Pack 的内容摘要绑定进验证记录;之后 Pack 内容发生变化必须重验。
|
|
50
|
+
|
|
51
|
+
更多设计边界见 `EXTERNAL_ACQUISITION_DESIGN.md`。
|
package/cli/help/loop.md
CHANGED
|
@@ -28,8 +28,10 @@ Forge 先形成任务级 Expertise Pack:
|
|
|
28
28
|
- 已实际加载的技能、资料、工具及其用途。
|
|
29
29
|
- Critic 视角与验证方法。
|
|
30
30
|
|
|
31
|
-
Pack
|
|
32
|
-
|
|
31
|
+
Pack 是任务级认知配置,不写成新的长期规范。External Acquisition Gate required 时,Pack
|
|
32
|
+
必须落盘到 `10_EXPERTISE_PACKS/<intent-id>.json`:Search Plan 可由 AI 派生,但 Capsule 内容
|
|
33
|
+
必须来自实际打开的外部来源,并写出判断门、失败模式和验证信号。明显的机械任务可以保持
|
|
34
|
+
`adaptive`;高质量任务必须足以解释为什么某个专业手法适合这个项目。
|
|
33
35
|
|
|
34
36
|
## 3. Quality Arena
|
|
35
37
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Capability Graph Change Proposals
|
|
2
|
+
|
|
3
|
+
New user requirements, research findings, and implementation discoveries are candidates, not silent changes to the official Capability Graph or current Intent.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
loom capability proposal submit --json-file ./CGP-NEW-REQUIREMENT.json
|
|
7
|
+
loom capability proposal list
|
|
8
|
+
loom capability proposal get CGP-NEW-REQUIREMENT
|
|
9
|
+
loom capability proposal decide CGP-NEW-REQUIREMENT graph_update --rationale "..."
|
|
10
|
+
loom capability proposal close CGP-NEW-REQUIREMENT --resolution-file ./CGP-NEW-REQUIREMENT-resolution.json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Each proposal records an origin, provenance (source, observation time, concrete evidence), candidate kind, title and why-now. Candidate kinds are `outcome`, `constraint`, `capability`, `risk`, and `evidence`.
|
|
14
|
+
|
|
15
|
+
Only Architect decides whether it is already covered, needs a Graph update, changes an Intent or acceptance contract, belongs in Minor/Major, or is rejected. A decision still blocks the loop until a structured resolution closes it; an arbitrary path or prose string is not evidence.
|
|
16
|
+
|
|
17
|
+
The resolution is decision-specific and is checked against the current version after the decision baseline: `graph_update` names changed Graph nodes (which must carry the proposal ID); `intent_change` names changed Intents; `acceptance_change` names Intents whose acceptance artifact changed; `covered` names the already-effective Graph coverage plus a rationale; and `minor`, `major`, or `reject` references a newly written `03_DECISIONS/` artifact naming the proposal. A `constraint` decided as `graph_update` must additionally appear in the formal Graph `constraints` array with its affected node IDs.
|
|
18
|
+
|
|
19
|
+
For `covered_by`, use both `covered_by: "NODE-ID"` and a `{ "type": "covered_by", "target": "NODE-ID" }` relationship. The target must be a different, currently covered node with a direct route; chained or self-referential coverage is rejected.
|
|
20
|
+
|
|
21
|
+
Forge and Keeper may submit candidates but cannot use them to expand their active scope.
|
package/cli/help/workflow.md
CHANGED
|
@@ -27,7 +27,18 @@ loom activate visionary
|
|
|
27
27
|
|
|
28
28
|
输出产品目标、成功图景、非目标与 Intent narrative。Visionary 不写 acceptance、DAG 或架构。
|
|
29
29
|
|
|
30
|
-
## 3.
|
|
30
|
+
## 3. Capability Graph — Architect
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
loom activate architect
|
|
34
|
+
loom capability graph
|
|
35
|
+
loom capability frontier
|
|
36
|
+
loom capability coverage
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
在写 Intent Map 前,Architect 先把愿景展开为项目问题面、能力缺口、风险与证据。图谱不是待办列表:高影响节点必须继续展开、形成项目化 Capability Brief、编译为 Intent,或带理由地延后/排除。每个 Intent 必须回链图谱;只有边界清楚且可独立验证的结果才进入 Intent Map。
|
|
40
|
+
|
|
41
|
+
## 4. Contract — Architect
|
|
31
42
|
|
|
32
43
|
```bash
|
|
33
44
|
loom activate architect
|
|
@@ -41,7 +52,7 @@ Architect 产出系统边界、Intent DAG、完成契约和可选质量契约,
|
|
|
41
52
|
完成契约定义 **Reliability Floor**:做到什么才算可靠完成。
|
|
42
53
|
质量契约定义 **Distinctive Ceiling**:什么可观察差异让结果不止合格。
|
|
43
54
|
|
|
44
|
-
##
|
|
55
|
+
## 5. Quality Engine — Forge 与 Keeper
|
|
45
56
|
|
|
46
57
|
```bash
|
|
47
58
|
loom intent next
|
|
@@ -53,6 +64,16 @@ loom activate keeper --intent <id>
|
|
|
53
64
|
Forge 编译 Expertise Pack,在 Quality Arena 中实现与比较。
|
|
54
65
|
Keeper 从当前磁盘事实和契约独立验证,不继承 Forge 的解释。
|
|
55
66
|
|
|
67
|
+
当 `loom capability compile <id>` 报告 `acquisition.required=true` 时,先运行:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
loom expertise init <id>
|
|
71
|
+
# 实际执行 find skill / web / official docs / research 检索并填写 Pack
|
|
72
|
+
loom expertise validate <id>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
门未闭合时不能写入 passed。Keeper 会重新打开关键来源,passed 记录绑定当前 Pack。
|
|
76
|
+
|
|
56
77
|
无质量契约时,四个基础维度通过即可闭合。存在质量契约时,额外验证
|
|
57
78
|
`quality_achievement`;声明相对提升时,在该维度中链接 Quality Proof:
|
|
58
79
|
|
|
@@ -67,12 +88,13 @@ loom intent done <id>
|
|
|
67
88
|
|
|
68
89
|
复杂或混合判定使用 `loom verify write --json-file <path>`。
|
|
69
90
|
|
|
70
|
-
##
|
|
91
|
+
## 6. Reflow
|
|
71
92
|
|
|
72
93
|
验证偏离时,不要把所有问题都扔回 Forge:
|
|
73
94
|
|
|
74
95
|
- Doctrine 不足 → Weaver
|
|
75
96
|
- 产品目标错误 → Visionary
|
|
97
|
+
- 问题面、能力缺口或 Intent 路由遗漏 → Architect 更新 Capability Graph
|
|
76
98
|
- 契约、边界或依赖错误 → Architect
|
|
77
99
|
- 专业判断或实现不足 → Forge
|
|
78
100
|
- 证据不足 → Keeper 补证或 `pending_human`
|
|
@@ -80,7 +102,7 @@ loom intent done <id>
|
|
|
80
102
|
连续三次 `deviated` 自动升级为 `blocked`。所有当前 revision 和当前验证 epoch 的 Intent 都有最新 passed
|
|
81
103
|
记录,且没有 `needs_review`、`loom doctor` 没有 fatal/high 风险时,本轮收敛。
|
|
82
104
|
|
|
83
|
-
##
|
|
105
|
+
## 7. 演进
|
|
84
106
|
|
|
85
107
|
- Patch:不改变 Intent 语义,验证后记录 changelog。
|
|
86
108
|
- Minor:用 `loom intent add|revise` 创建 draft,经限定作用域的 Visionary/Architect 更新后 finalize。
|
package/cli/src/activate.js
CHANGED
|
@@ -8,6 +8,9 @@ import { getIntentDraft } from './intent-draft.js';
|
|
|
8
8
|
import { getPhilosophy } from './philosophy.js';
|
|
9
9
|
import { getVerificationContract } from './verify.js';
|
|
10
10
|
import { extractMdSection } from './shared/md-utils.js';
|
|
11
|
+
import { compileCapabilityInputs } from './capability-graph.js';
|
|
12
|
+
import { getAtelierRecord } from './atelier.js';
|
|
13
|
+
import { formatExpertisePackForPrompt, getExpertisePack, getExpertisePackState } from './expertise-pack.js';
|
|
11
14
|
|
|
12
15
|
const VALID_ROLES = ['weaver', 'visionary', 'architect', 'forge', 'keeper'];
|
|
13
16
|
|
|
@@ -130,6 +133,12 @@ function compileObjective(role, versionDir, intentId) {
|
|
|
130
133
|
}
|
|
131
134
|
|
|
132
135
|
const intent = getIntent(versionDir, intentId);
|
|
136
|
+
if (['forge', 'keeper'].includes(role)) {
|
|
137
|
+
const unfinishedDependencies = intent.depends_on.filter((dependencyId) => getIntent(versionDir, dependencyId).status !== 'completed');
|
|
138
|
+
if (unfinishedDependencies.length) {
|
|
139
|
+
throw new Error(`Intent ${intentId} 的依赖尚未闭合: ${unfinishedDependencies.join(', ')}。不得通过 activate --intent 绕过执行顺序;先运行 loom intent next 或完成依赖 Intent。`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
133
142
|
const narrative = getNarrative(versionDir, intentId);
|
|
134
143
|
const objectiveView = {
|
|
135
144
|
id: intent.id,
|
|
@@ -241,19 +250,92 @@ function compileProjectJudgment(role, versionDir, objective) {
|
|
|
241
250
|
return blocks.join('\n\n');
|
|
242
251
|
}
|
|
243
252
|
|
|
244
|
-
function compileExpertiseInputs(role, objective) {
|
|
253
|
+
function compileExpertiseInputs(role, versionDir, objective) {
|
|
245
254
|
const subject = objective.intent || objective.draft;
|
|
246
255
|
if (!subject || !['architect', 'forge', 'keeper'].includes(role)) {
|
|
247
256
|
return '当前阶段不编译任务级 Expertise Pack。';
|
|
248
257
|
}
|
|
249
258
|
const needs = Array.isArray(subject.capability_needs) ? subject.capability_needs : [];
|
|
259
|
+
const qualityStrategy = subject.quality_strategy ?? 'adaptive';
|
|
250
260
|
const lines = [
|
|
251
261
|
`- capability_needs: ${needs.length ? needs.join(', ') : '未声明;按当前任务发现必要能力'}`,
|
|
252
262
|
`- creative_scope: ${subject.creative_scope || '未声明;遵循最小完整干预'}`,
|
|
263
|
+
`- quality_strategy: ${qualityStrategy}`,
|
|
253
264
|
'- Skill、工具和资产名称只代表可发现入口;实际检查并加载后才进入 Expertise Pack。',
|
|
254
265
|
];
|
|
266
|
+
let compiled = null;
|
|
267
|
+
if (versionDir && objective.intent) {
|
|
268
|
+
compiled = compileCapabilityInputs(versionDir, objective.intent.id);
|
|
269
|
+
if (!compiled.available) {
|
|
270
|
+
lines.push(`- Capability Graph: ${compiled.warnings.join(' ')}`);
|
|
271
|
+
} else if (compiled.nodes.length === 0) {
|
|
272
|
+
lines.push('- Capability Graph: 当前 Intent 没有回链节点;不得凭任务标题猜测能力,回流 Architect 补图谱或明确兼容原因。');
|
|
273
|
+
} else {
|
|
274
|
+
lines.push('- Capability Graph: 以下节点是本 Intent 的能力与风险输入:');
|
|
275
|
+
for (const node of compiled.nodes) {
|
|
276
|
+
lines.push(` - ${node.id} [${node.kind}/${node.impact}] ${node.title}${node.question ? ` — ${node.question}` : ''}`);
|
|
277
|
+
}
|
|
278
|
+
for (const brief of compiled.briefs) {
|
|
279
|
+
lines.push(`\n### Capability Brief: ${brief.node_id}\n\n${brief.content.trim()}`);
|
|
280
|
+
}
|
|
281
|
+
for (const warning of compiled.warnings) lines.push(`- Capability Graph warning: ${warning}`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (compiled?.acquisition?.nodes?.length) {
|
|
285
|
+
lines.push('- External acquisition modes:');
|
|
286
|
+
for (const node of compiled.acquisition.nodes) {
|
|
287
|
+
lines.push(` - ${node.node_id}: ${node.mode}(${node.reason})`);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (versionDir && objective.intent && ['forge', 'keeper'].includes(role)) {
|
|
291
|
+
const state = getExpertisePackState(versionDir, subject.id);
|
|
292
|
+
if (state.required && !state.ready) {
|
|
293
|
+
lines.push(
|
|
294
|
+
'\n### External Acquisition Gate — OPEN',
|
|
295
|
+
`- required_capabilities: ${state.required_node_ids.join(', ')}`,
|
|
296
|
+
'- 先根据 Capability question、Authorial Stance/creative_scope、媒介约束与已观察缺口派生搜索词;搜索词属于本轮计划,不得写死进 Capability Graph。',
|
|
297
|
+
'- 必须实际使用外部 find skill、网络搜索、官方文档或研究资料获取信息。模型自行生成的常识、内部复述和未打开的搜索结果不能充当来源。',
|
|
298
|
+
`- ${state.reason === 'missing' ? `运行 \`loom expertise init ${subject.id}\`` : `修正 \`10_EXPERTISE_PACKS/${subject.id}.json\``},记录可回查来源与 Capability Capsules,再运行 \`loom expertise validate ${subject.id}\`。`,
|
|
299
|
+
'- 门未闭合时,只能完成机械性勘察、基线冻结与检索;不得声称专业方案已形成,也不得通过验证。',
|
|
300
|
+
);
|
|
301
|
+
} else if (state.required && role === 'forge') {
|
|
302
|
+
const pack = getExpertisePack(versionDir, subject.id);
|
|
303
|
+
lines.push(
|
|
304
|
+
'\n### External Acquisition Gate — READY',
|
|
305
|
+
'- 以下内容是本 Intent revision 的来源化核心信息组。它不是永久 Doctrine,也不是复制进仓库的第三方 Skill。',
|
|
306
|
+
`\n${formatExpertisePackForPrompt(pack)}`,
|
|
307
|
+
);
|
|
308
|
+
} else if (state.required && role === 'keeper') {
|
|
309
|
+
lines.push(
|
|
310
|
+
'\n### External Acquisition Evidence — PRESENT',
|
|
311
|
+
`- record_ref: 10_EXPERTISE_PACKS/${subject.id}.json`,
|
|
312
|
+
`- required_capabilities: ${state.required_node_ids.join(', ')}`,
|
|
313
|
+
`- source_count: ${state.validation.source_count}; capsule_count: ${state.validation.capsule_count}`,
|
|
314
|
+
'- 不继承 Forge 的 Capsule 结论。重新打开至少一个关键来源,检查来源确实支持规则与判断门,并把绑定写入本轮验证记录。',
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
255
318
|
if (role === 'keeper') {
|
|
256
319
|
lines.push('- 不继承 Forge Expertise Pack;按契约独立准备验证能力。');
|
|
320
|
+
if (qualityStrategy === 'atelier') {
|
|
321
|
+
const record = getAtelierRecord(versionDir, subject.id);
|
|
322
|
+
lines.push(
|
|
323
|
+
'- 当前 Intent 使用 Atelier:以下 Record 是创作证据入口,不是通过结论。',
|
|
324
|
+
`\n### Atelier Record\n\n\`\`\`json\n${JSON.stringify(record, null, 2)}\n\`\`\``,
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (role === 'forge' && qualityStrategy === 'atelier') {
|
|
329
|
+
const authorshipPath = join(getLoomRoot(), 'dimensions', 'AUTHORSHIP.md');
|
|
330
|
+
if (!existsSync(authorshipPath)) {
|
|
331
|
+
throw new Error(`Atelier 方法文件不存在: ${authorshipPath}`);
|
|
332
|
+
}
|
|
333
|
+
lines.push(
|
|
334
|
+
'- 当前 Intent 进入 Atelier Path:先冻结基线并形成 Authorial Stance,再生成机制不同的候选。',
|
|
335
|
+
`- Atelier Record: \`09_ATELIER/${subject.id}.json\`;候选必须绑定 stance_revision。`,
|
|
336
|
+
'- Author 只能修正局部创作假设;结构性发现提交 provenance-backed Capability Graph proposal,由 Architect 裁决。',
|
|
337
|
+
`\n### Authorship Method\n\n${readFileSync(authorshipPath, 'utf-8').trim()}`,
|
|
338
|
+
);
|
|
257
339
|
}
|
|
258
340
|
return lines.join('\n');
|
|
259
341
|
}
|
|
@@ -263,6 +345,7 @@ function compileWorkingFacts(versionDir, objective) {
|
|
|
263
345
|
const subject = objective.intent || objective.draft;
|
|
264
346
|
const refs = [
|
|
265
347
|
'- architecture: `.loom/.../02_ARCHITECTURE.md`(只读取与当前决定相关部分)',
|
|
348
|
+
'- capability_graph: 从 `07_CAPABILITY_GRAPH.json` 查询与当前 Intent 回链的能力、风险与 Brief;不能用会话记忆补全未路由分支。',
|
|
266
349
|
'- artifacts: 从真实工作区检查,不从会话记忆猜测。',
|
|
267
350
|
];
|
|
268
351
|
const systemId = subject?._optional?.system_id || subject?.system_id;
|
|
@@ -294,7 +377,7 @@ export function activateRole(role, versionDir, intentId = null) {
|
|
|
294
377
|
section('3. Hard Invariants', compileInvariants(role, versionDir)),
|
|
295
378
|
section('4. Success Contracts', compileContracts(role, versionDir, objective)),
|
|
296
379
|
section('5. Project Judgment', compileProjectJudgment(role, versionDir, objective)),
|
|
297
|
-
section('6. Expertise Inputs', compileExpertiseInputs(role, objective)),
|
|
380
|
+
section('6. Expertise Inputs', compileExpertiseInputs(role, versionDir, objective)),
|
|
298
381
|
section('7. Working Facts', compileWorkingFacts(versionDir, objective)),
|
|
299
382
|
section('8. Role Contract / Output / Reflow / Stop', readRole(role)),
|
|
300
383
|
];
|