@namewta/speculo 0.8.11 → 1.0.1
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/README.md +10 -6
- package/dist/src/cli.js +12 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/doctor.d.ts +10 -0
- package/dist/src/doctor.js +70 -0
- package/dist/src/doctor.js.map +1 -0
- package/dist/src/index.js +105 -56
- package/dist/src/index.js.map +1 -1
- package/dist/src/kernel.d.ts +98 -0
- package/dist/src/kernel.js +29 -0
- package/dist/src/kernel.js.map +1 -0
- package/dist/src/refresh.js +55 -24
- package/dist/src/refresh.js.map +1 -1
- package/dist/src/structured.d.ts +2 -2
- package/dist/src/structured.js +114 -241
- package/dist/src/structured.js.map +1 -1
- package/package.json +3 -2
- package/template/.speculo/README.md +1 -1
- package/template/.speculo/capabilities.json +14 -0
- package/template/.speculo/kernel/README.md +10 -0
- package/template/.speculo/kernel/capability-profile.schema.json +14 -0
- package/template/.speculo/kernel/checkpoint.schema.json +7 -0
- package/template/.speculo/kernel/trace-event.schema.json +8 -0
- package/template/.speculo/kernel/workflow-manifest.schema.json +13 -0
- package/template/.speculo/kernel.json +10 -0
- package/template/.speculo/refresh-contract.json +4 -1
- package/template/AGENTS.md +0 -3
- package/template/canonical/canonical-specdev-goal-plan.md +13 -7
- package/template/canonical/canonical-specdev-grill-with-docs.md +1 -1
- package/template/canonical/canonical-specdev-orchestrate-implementation.md +29 -11
- package/template/canonical/canonical-specdev-spec.md +1 -1
- package/template/canonical/canonical-specdev-tickets.md +38 -4
- package/template/commands/archive-and-consolidate.md +13 -40
- package/template/commands/status.md +3 -3
- package/template/skills/engineering-standards-builder/README.md +6 -28
- package/template/skills/engineering-standards-builder/SKILL.md +88 -163
- package/template/skills/engineering-standards-builder/examples/README.md +2 -0
- package/template/skills/engineering-standards-builder/manifest.txt +4 -0
- package/template/skills/engineering-standards-builder/references/rules/00-governance-and-precedence.md +22 -29
- package/template/skills/engineering-standards-builder/references/rules/01-project-discovery.md +26 -59
- package/template/skills/engineering-standards-builder/references/rules/02-evidence-topology-and-scope.md +28 -55
- package/template/skills/engineering-standards-builder/references/rules/03-interview-and-decisions.md +4 -3
- package/template/skills/engineering-standards-builder/references/rules/14-generation-contract.md +64 -80
- package/template/skills/engineering-standards-builder/references/rules/15-validation-contract.md +24 -47
- package/template/skills/engineering-standards-builder/references/rules/16-language-adapter-contract.md +11 -48
- package/template/skills/engineering-standards-builder/references/rules/README.md +3 -3
- package/template/skills/engineering-standards-builder/scripts/self-test.mjs +51 -5
- package/template/skills/engineering-standards-builder/scripts/validate-builder.mjs +16 -4
- package/template/skills/engineering-standards-builder/scripts/validate-generated-skill.mjs +166 -64
- package/template/skills/engineering-standards-builder/templates/README.md +12 -3
- package/template/skills/engineering-standards-builder/templates/domain-skill/SKILL.md.template +32 -0
- package/template/skills/engineering-standards-builder/templates/project-skill/SKILL.md.template +16 -11
- package/template/skills/engineering-standards-builder/templates/project-skill/generated-skill-set.json.template +7 -0
- package/template/skills/engineering-standards-builder/templates/project-skill/references/project/00-project-profile.md.template +3 -1
- package/template/skills/engineering-standards-builder/templates/project-skill/references/project/01-module-map.md.template +4 -0
- package/template/skills/engineering-standards-builder/templates/project-skill/references/project/02-decisions-and-exceptions.md.template +1 -1
- package/template/skills/engineering-standards-builder/templates/project-skill/references/project/03-skill-map.md.template +19 -0
- package/template/skills/engineering-standards-builder/templates/project-skill/references/project/04-source-and-template-map.md.template +22 -0
- package/template/skills/engineering-standards-builder/templates/project-skill/references/project/review-checklist.md.template +2 -0
- package/template/skills/git-history-squash/SKILL.md +100 -0
- package/template/skills/git-history-squash/assets/request-template.json +18 -0
- package/template/skills/git-history-squash/references/recovery-contract.md +50 -0
- package/template/skills/git-history-squash/references/rewrite-contract.md +123 -0
- package/template/skills/git-history-squash/references/submodule-contract.md +54 -0
- package/template/skills/git-history-squash/scripts/git-history-squash.mjs +1171 -0
- package/template/workflows/learning/A-archive/A-archive.md +25 -0
- package/template/workflows/learning/A-assess-and-plan/A-assess-and-plan.md +17 -23
- package/template/workflows/learning/A-assess-and-plan/background-template.md +13 -0
- package/template/workflows/learning/A-assess-and-plan/change-status-template.json +21 -14
- package/template/workflows/learning/A-assess-and-plan/course-template.md +28 -0
- package/template/workflows/learning/C-consolidate/C-consolidate.md +33 -0
- package/template/workflows/learning/H-homework/H-homework.md +31 -0
- package/template/workflows/learning/H-homework/homework-template.md +63 -0
- package/template/workflows/learning/I-init-setup/I-init-setup.md +14 -19
- package/template/workflows/learning/I-init-setup/context-index-template.md +3 -3
- package/template/workflows/learning/I-init-setup/learner-profile-template.md +12 -10
- package/template/workflows/learning/I-init-setup/review-index-template.md +1 -1
- package/template/workflows/learning/INDEX.md +7 -9
- package/template/workflows/learning/L-lesson/L-lesson.md +32 -0
- package/template/workflows/learning/L-lesson/lesson-template.md +51 -0
- package/template/workflows/learning/R-review/R-review.md +13 -18
- package/template/workflows/learning/R-review/review-template.md +13 -6
- package/template/workflows/learning/README.md +86 -81
- package/template/workflows/learning/_state/status.json +1 -1
- package/template/workflows/learning/common/rules/artifact-contract.md +11 -25
- package/template/workflows/learning/common/rules/assessment-policy.md +9 -4
- package/template/workflows/learning/common/rules/knowledge-organization.md +4 -6
- package/template/workflows/learning/common/rules/mastery-policy.md +3 -19
- package/template/workflows/learning/common/rules/path-reference-contract.md +3 -5
- package/template/workflows/learning/common/rules/teaching-policy.md +9 -9
- package/template/workflows/learning/common/schemas/change-status.schema.json +46 -18
- package/template/workflows/learning/common/schemas/status.schema.json +25 -24
- package/template/workflows/learning/common/skills/topic-synthesis/SKILL.md +17 -0
- package/template/workflows/learning/common/skills/topic-synthesis/claim-template.md +15 -0
- package/template/workflows/learning/common/tools/relocate-learning.mjs +208 -0
- package/template/workflows/learning/common/tools/validate-learning.mjs +195 -297
- package/template/workflows/learning/manifest.json +1 -0
- package/template/workflows/learning/runtime-contract.json +3 -2
- package/template/workflows/ops/manifest.json +1 -0
- package/template/workflows/person/manifest.json +1 -0
- package/template/workflows/specdev/I-implement/I-implement.md +12 -4
- package/template/workflows/specdev/I-implement/execution-preflight.md +4 -0
- package/template/workflows/specdev/README.md +1 -1
- package/template/workflows/specdev/T-tickets/T-tickets.md +16 -3
- package/template/workflows/specdev/T-tickets/ticket-readiness.md +3 -0
- package/template/workflows/specdev/T-tickets/ticket-template.md +3 -0
- package/template/workflows/specdev/T-tickets/tickets-map-template.md +15 -0
- package/template/workflows/specdev/common/rules/artifact-contract.md +1 -1
- package/template/workflows/specdev/common/skills/subagent-delivery/SKILL.md +4 -2
- package/template/workflows/specdev/common/skills/subagent-delivery/references/external-web-subagent.md +2 -1
- package/template/workflows/specdev/common/skills/subagent-delivery/references/native-subagent.md +2 -1
- package/template/workflows/specdev/common/skills/subagent-delivery/references/source-package.md +4 -2
- package/template/workflows/specdev/common/tools/validate-specdev.mjs +143 -3
- package/template/workflows/specdev/manifest.json +1 -0
- package/template/workflows/workflow-manifest.schema.json +14 -0
- package/template/workflows/learning/A-archive-and-consolidate/A-archive-and-consolidate.md +0 -38
- package/template/workflows/learning/A-archive-and-consolidate/promotion-plan-template.md +0 -23
- package/template/workflows/learning/A-assess-and-plan/learning-plan-template.md +0 -28
- package/template/workflows/learning/E-eli5/E-eli5.md +0 -37
- package/template/workflows/learning/E-eli5/lesson-template.md +0 -31
- package/template/workflows/learning/P-practice/P-practice.md +0 -34
- package/template/workflows/learning/P-practice/practice-template.md +0 -16
- package/template/workflows/learning/Q-quiz/Q-quiz.md +0 -34
- package/template/workflows/learning/Q-quiz/quiz-artifact-template.md +0 -16
- package/template/workflows/learning/common/skills/knowledge-promotion/SKILL.md +0 -46
- package/template/workflows/learning/common/skills/knowledge-promotion/domain-index-template.md +0 -6
- package/template/workflows/learning/common/skills/knowledge-promotion/domain-overview-template.md +0 -19
- package/template/workflows/learning/common/skills/knowledge-promotion/knowledge-template.md +0 -25
|
@@ -3,58 +3,31 @@ id: archive-and-consolidate
|
|
|
3
3
|
type: command
|
|
4
4
|
name: Archive and Consolidate
|
|
5
5
|
description: >
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
keywords: [archive, consolidate, knowledge, cleanup, adr, 归档, 知识合并, 清理, 收尾]
|
|
6
|
+
统一入口:Learning 先做用户确认的主题整合或冷归档,其他 workflow 继续使用各自的归档合同。
|
|
7
|
+
keywords: [archive, consolidate, learning, topic, cold-archive, 归档, 综合]
|
|
9
8
|
---
|
|
10
9
|
|
|
11
10
|
# Archive and Consolidate 命令
|
|
12
11
|
|
|
13
12
|
## 报告
|
|
14
13
|
|
|
15
|
-
统一写入:`<Path>{roots.state}/commands/archive-and-consolidate/{date}-{scope}-{topic}[-NN].md</Path
|
|
14
|
+
统一写入:`<Path>{roots.state}/commands/archive-and-consolidate/{date}-{scope}-{topic}[-NN].md</Path>`。报告记录 workflow、source/root IDs、dry-run 清单、用户确认、relocation manifest、synthesis revision 或 archive locator 和验证结果。
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
## Learning 路由
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
目标 workflow 为 Learning 时,读取 `<Path>{roots.workflows}/learning/README.md</Path>`,由用户明确选择一个 Work:
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
- `C-consolidate`:生成 source manifest 和 dry-run;确认后调用 `<Path>{roots.workflows}/learning/common/tools/relocate-learning.mjs</Path>` 物理移动 active/closed Change 到父 Change 的 `children/`,再生成带 provenance 的 synthesis。未确认时不得移动或更新 context。
|
|
21
|
+
- `A-archive`:只处理用户 close/confirm 的 root Change 树,以最新源更新时间决定 `archive/YYYY-MM/`,不要求 Homework、R 或 mastery,也不写 context。
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
- `archive-batch`:只读列出全部 completed Ops tuples 和各自复盘/提升状态,生成 command 报告后停止。知识合并与归档必须逐 change 进入 A 并分别批准,不能用一次跨项目确认替代多个精确 promotion manifest。
|
|
23
|
+
不得把 Learning 交给共享的根级机械归档 skill;该 skill 不能理解递归 locator、parent lock 或单文件 Homework 证据。已冷归档树保持只读,需先由用户显式恢复才能作为 C 的可移动 source。
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
## 其他 workflow
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### archive-single
|
|
31
|
-
|
|
32
|
-
归档并合并单个已完成 change 的知识。
|
|
33
|
-
|
|
34
|
-
1. 读取 `<Path>{roots.skills}/archive-and-consolidate/SKILL.md</Path>`,执行路径解析(Step 0),解析 `<Path>{roots.config}</Path>`(不存在时静默降级)。
|
|
35
|
-
2. 选择一个 `change_status: completed` 的 change。
|
|
36
|
-
3. 目标为 SpecDev 时先读取 `<Path>{roots.workflows}/specdev/common/rules/change-completion.md</Path>` 与当前 change 的 `<Path>{roots.state}/specdev/changes/{change}/triage.md</Path>`:完成门必须通过,`external_action` 必须为 `closed | waived | not-applicable`;pending/failed 返回 Triage,不生成可执行归档计划。
|
|
37
|
-
4. 执行 Step 1-5:扫描 stores、扫描 change、生成归档计划、生成合并计划、生成清理候选。
|
|
38
|
-
5. 默认 dry-run:将完整计划写入报告文件,展示摘要并等待用户显式确认。
|
|
39
|
-
6. 确认后以 mode=`confirmed` 执行 Step 7-8:归档移动、合并写入、清理、重读验证。
|
|
40
|
-
7. 执行结果作为补遗追加到原报告。
|
|
41
|
-
|
|
42
|
-
### archive-batch
|
|
43
|
-
|
|
44
|
-
批量归档并合并所有已完成 change 的知识。
|
|
45
|
-
|
|
46
|
-
1. 读取 `<Path>{roots.skills}/archive-and-consolidate/SKILL.md</Path>`,执行路径解析。
|
|
47
|
-
2. 扫描目标 workflow 下所有 `change_status: completed` 的 change。不接受 active 或 broken 状态。
|
|
48
|
-
3. SpecDev 候选逐个通过 change completion 与 external reconcile 门;任一 pending/failed 阻塞整批。
|
|
49
|
-
4. 执行 Step 1-5:扫描 stores、逐 change 扫描、批量预检、合并计划、清理候选。
|
|
50
|
-
5. 批量原子性:任一预检失败阻塞整批。
|
|
51
|
-
6. 默认 dry-run:将完整计划写入报告文件,展示摘要并等待用户显式确认。
|
|
52
|
-
7. 确认后逐项执行:归档移动 → 合并写入 → 清理 → 重读验证。失败时报告已完成/未完成清单。
|
|
27
|
+
非 Learning 目标继续读取自身 README 和归档 Work,Command 报告只记录选择和 owning Work 返回的 manifest,不成为知识 writer。
|
|
53
28
|
|
|
54
29
|
## 完成标准
|
|
55
30
|
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
- 合并写入的每条知识有来源 change 标注。
|
|
60
|
-
- 每个清理候选有分类和理由。
|
|
31
|
+
- dry-run、确认、移动、回滚和最终验证均有报告;
|
|
32
|
+
- 原始 Markdown 内容不被覆盖,跨路径引用通过 stable ID/locations 解析;
|
|
33
|
+
- 未确认或失败事务不留下部分移动或 context 写入。
|
|
@@ -10,8 +10,8 @@ keywords: [status, 状态, active, blocked]
|
|
|
10
10
|
|
|
11
11
|
1. 读取 `<Path>{roots.state}/workspace.json</Path>`,解析 `<Path>{roots.config}</Path>`(不存在时以默认值静默降级),获取全部已安装 workflow/state 根。
|
|
12
12
|
2. 扫描 `<Path>{roots.workflows}/{workflow}/INDEX.md</Path>`,得到已安装 workflow ids。
|
|
13
|
-
3. 对每个 id 读取 `<Path>{roots.state}/{workflow}/status.json</Path>`,按该 workflow 自己的 schema 解释,不把 SpecDev 字段套到其他 workflow。
|
|
14
|
-
4. 报告 active 数量、各
|
|
15
|
-
5. 报告 archived 数量和完整 scope/project/change locator;Learning 同时读取 `context/REVIEW.md`
|
|
13
|
+
3. 对每个 id 读取 `<Path>{roots.state}/{workflow}/status.json</Path>`,按该 workflow 自己的 schema 解释,不把 SpecDev 字段套到其他 workflow。Learning schema v2 的 active/archived entry 携带 stable `change_id`、kind、parent/root、current locator、current_work、Homework 和 retention projection;递归 Change 位于 `changes/**` 或 `archive/**`,位置历史读取 `<Path>{roots.state}/learning/locations.json</Path>`。SpecDev 继续使用 schema v5 根级 `changes/<change>`/`archive/YYYY-MM/<change>`;Ops schema v2 仍使用 `<Path>{roots.state}/ops/projects/{project_id}/changes/{change}/.status.json</Path>` 或对应 `archive/YYYY-MM/{change}/.status.json`。不得按 change 名跨 workflow 合并。
|
|
14
|
+
4. 报告 active 数量、各 Change 的 `current_work`、去重后的 `works_run`、生命周期、parent/root、最近更新时间和停滞 Change(`.status.json` 超过 14 天未更新)。SpecDev 额外报告调查 claims 与 triage `external_action`;Learning 额外报告 domain/topic、Lesson/Homework、immediate/retention 和 synthesis 状态;Ops 额外报告 scope/project、phase、outcome、current plan/approval、latest attempt 和 blockers,并把同名不同项目 Change 分行展示。
|
|
15
|
+
5. 报告 archived 数量和完整 scope/project/change locator;Learning 同时读取 `context/REVIEW.md` 汇总到期 Review、topic evidence status 和需要刷新内容。预期归档目录或 `.status.json` 缺失、active/archived 重叠、parent cycle、位置登记不一致、未知 schema、断开链接和 malformed 目录均列为异常,不自动修复。
|
|
16
16
|
6. 报告没有 workflow 资产的孤立状态根,以及缺少状态根的已安装 workflow;不自动修复。
|
|
17
17
|
7. 用户要求持久化时写入 `<Path>{roots.state}/commands/status/{date}-workspace-{topic}[-NN].md</Path>`,并在报告中列出本次扫描的 workflow 选择。
|
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
# Engineering Standards Builder
|
|
1
|
+
# Engineering Standards Builder
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
稳定 Skill ID:`engineering-standards-builder`。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
这是一个由用户手动启动的项目规范生成器。它先审计当前项目的代码、目录、配置、测试、CI 与模板,再把证据编译为持久化在 `.agents/skills/` 的最小项目 Skill Set。
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- 支持单项目、Workspace、Monorepo 和多语言 Monorepo。
|
|
9
|
-
- 内置 TypeScript/JavaScript、React、Vue、Java、Spring Boot、Go、Rust 规则包。
|
|
10
|
-
- 通用规则位于 `references/rules/`;语言规则物理隔离。
|
|
11
|
-
- 只生成当前项目实际适用的规则,不复制无关技术栈内容。
|
|
12
|
-
- 通过 `scripts/` 提供只读发现、manifest 校验、Builder 校验和生成结果校验。
|
|
13
|
-
- `examples/` 是自测试 fixture,不是装饰样例。
|
|
7
|
+
核心产物是 `.agents/skills/engineering-standards/` 根路由和按需生成的领域 Skill。Builder 通过 `generated-skill-set.json` 记录所有权;刷新只管理清单内路径,不接管用户维护的其他 Skill。
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
删除仓库中的旧目录:
|
|
18
|
-
|
|
19
|
-
```text
|
|
20
|
-
template/skills/engineering-standards-builder
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
将本目录完整复制到相同位置。不要只复制 `SKILL.md`,因为 references、scripts、templates 和 examples 都是运行合同的一部分。
|
|
9
|
+
内置 TypeScript/JavaScript、React、Vue、Java、Spring Boot、Go 与 Rust references 只提供发现与审计 fallback。项目代码、模板、测试、配置、CI 及用户决定始终优先。
|
|
24
10
|
|
|
25
11
|
## 自校验
|
|
26
12
|
|
|
@@ -32,12 +18,4 @@ node scripts/validate-builder.mjs --root .
|
|
|
32
18
|
node scripts/self-test.mjs --root .
|
|
33
19
|
```
|
|
34
20
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
新 canonical 项目规范为:
|
|
38
|
-
|
|
39
|
-
```text
|
|
40
|
-
.agents/skills/engineering-standards/
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
旧的 `typescript-standards` 与 `typescript--standards` 仅作为需要时生成的单向兼容入口。这样既保留旧项目可用性,又避免继续把跨语言规范命名为 TypeScript 规范。
|
|
21
|
+
`examples/` 是扫描器与生成结果验证器的 fixtures,不是复制到项目中的示例工程。
|
|
@@ -1,228 +1,153 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: engineering-standards-builder
|
|
3
|
-
description:
|
|
3
|
+
description: 探索当前项目并生成或刷新项目专属工程 Skill Set,持久化到项目 .agents/skills/。
|
|
4
|
+
disable-model-invocation: true
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Engineering Standards Builder
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
本 Skill 只在用户明确调用时运行。它不会在新项目中自动启动,也不把 Builder 自带的通用建议直接复制成项目规范。
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
目标是先理解当前项目真实的代码、目录、配置、测试、CI 与模板,再生成一组可长期复用的项目专属 Skill:一个稳定的工程规范路由入口,以及零个或多个有独立触发价值的领域 Skill。
|
|
11
12
|
|
|
12
13
|
```text
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- 不适用规则
|
|
18
|
-
- 已记录例外
|
|
19
|
-
= 当前项目专属工程规范 Skill
|
|
14
|
+
项目事实 + 用户指定的重点范围 + 已确认目标
|
|
15
|
+
-> 证据审计与冲突收敛
|
|
16
|
+
-> 最小充分 Skill Set
|
|
17
|
+
-> .agents/skills/
|
|
20
18
|
```
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
## 产物与所有权
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
默认 canonical 输出:
|
|
22
|
+
始终生成根路由:
|
|
27
23
|
|
|
28
24
|
```text
|
|
29
|
-
.agents/skills/
|
|
30
|
-
├──
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
.agents/skills/
|
|
26
|
+
├── engineering-standards/
|
|
27
|
+
│ ├── SKILL.md
|
|
28
|
+
│ ├── generated-skill-set.json
|
|
29
|
+
│ └── references/project/
|
|
30
|
+
│ ├── 00-project-profile.md
|
|
31
|
+
│ ├── 01-module-map.md
|
|
32
|
+
│ ├── 02-decisions-and-exceptions.md
|
|
33
|
+
│ ├── 03-skill-map.md
|
|
34
|
+
│ ├── 04-source-and-template-map.md
|
|
35
|
+
│ └── review-checklist.md
|
|
36
|
+
└── <optional-domain-skill>/
|
|
37
|
+
├── SKILL.md
|
|
38
|
+
└── references/...
|
|
41
39
|
```
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
`engineering-standards` 是规范权威与路由器;领域 Skill 负责可独立触发的实现导航,不重复定义冲突规则。`generated-skill-set.json` 只登记 Builder 拥有的 `.agents/skills/*` 路径。刷新时不得改动或删除清单之外的 Skill。
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
.agents/skills/typescript-standards/SKILL.md
|
|
47
|
-
.agents/skills/typescript--standards/SKILL.md
|
|
48
|
-
.claude/skills/engineering-standards/SKILL.md
|
|
49
|
-
.claude/skills/typescript-standards/SKILL.md
|
|
50
|
-
```
|
|
43
|
+
## 最小原则
|
|
51
44
|
|
|
52
|
-
|
|
45
|
+
- 不按语言、目录或 Agent 数量机械拆 Skill。
|
|
46
|
+
- 能由根路由和少量 references 清楚表达时,不新增领域 Skill。
|
|
47
|
+
- 没有项目证据的规则不生成;Builder references 只提供审计维度与 fallback。
|
|
48
|
+
- 不复制项目源码、FM 模板或脚手架正文;引用其真实路径并说明适用条件、集成步骤和验证方式。
|
|
49
|
+
- 不新增配置文件、参数、时间戳、hash 或模型元数据来制造形式化负担。
|
|
50
|
+
- 扫描深度、文件数和字节限制只是脚本内部资源保护,不是用户需要决策的项目规范。
|
|
53
51
|
|
|
54
|
-
##
|
|
52
|
+
## 执行流程
|
|
55
53
|
|
|
56
|
-
### 1.
|
|
54
|
+
### 1. 确定项目根与学习范围
|
|
57
55
|
|
|
58
|
-
|
|
56
|
+
从用户当前工作目录、Git/Workspace 边界和用户指定的代码或目录确定真实项目根。记录需要重点学习的模块、代码、目录、模板或脚手架;未指定时覆盖所有可编辑模块。
|
|
59
57
|
|
|
60
|
-
-
|
|
61
|
-
- 覆盖整个仓库、指定模块还是指定路径;
|
|
62
|
-
- `create`、`refresh`、`merge` 或 `dry-run` 模式;
|
|
63
|
-
- 生成代码、第三方镜像、Vendor、构建输出与冻结区域;
|
|
64
|
-
- 已存在的工程规范、`AGENTS.md`、`CLAUDE.md`、`CONTRIBUTING.md` 和架构文档。
|
|
58
|
+
读取现有 `AGENTS.md`、`CLAUDE.md`、贡献文档、架构文档和 `.agents/skills/`,但将它们视为待验证证据。识别 generated、vendor、build、cache、fixture 与冻结目录。发现已有 `generated-skill-set.json` 时进入 refresh;只有 legacy `engineering-standards` 时,在计划中声明接管该根 Skill,其他现有 Skill 一律视为非 Builder 所有。
|
|
65
59
|
|
|
66
|
-
|
|
60
|
+
冲突优先级见 [治理与证据优先级](references/rules/00-governance-and-precedence.md),路径和 scope 见 [证据、拓扑与作用域](references/rules/02-evidence-topology-and-scope.md)。本阶段只读。
|
|
67
61
|
|
|
68
|
-
|
|
62
|
+
**完成标准**:项目根、重点范围、排除范围、现有规范和 Builder 写入边界明确。
|
|
69
63
|
|
|
70
|
-
|
|
64
|
+
### 2. 建立确定性事实基线
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
先运行确定性扫描器,再进行人工语义抽样:
|
|
66
|
+
运行扫描器并捕获 stdout;默认不在项目中持久化 inventory:
|
|
75
67
|
|
|
76
68
|
```bash
|
|
77
|
-
node <skill-root>/scripts/discover-project.mjs
|
|
78
|
-
--root <project-root> \
|
|
79
|
-
--pretty \
|
|
80
|
-
--output .engineering/project-inventory.json
|
|
69
|
+
node <skill-root>/scripts/discover-project.mjs --root <project-root> --pretty
|
|
81
70
|
```
|
|
82
71
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
必须建立:
|
|
72
|
+
扫描合同见 [项目发现合同](references/rules/01-project-discovery.md)。扫描器只提供拓扑基线,不能替代源码审计。继续读取真实 manifest/build 配置、CI 命令、公共入口、代表性实现、测试、消费者与项目模板。
|
|
86
73
|
|
|
87
|
-
|
|
88
|
-
- 每个模块的路径、语言、框架、运行时、构建系统、测试系统和交付物;
|
|
89
|
-
- 源码根、测试根、公开入口、生成目录和边界;
|
|
90
|
-
- 已生效的格式化、静态检查、类型检查、测试、构建与 CI 命令;
|
|
91
|
-
- 每项判断的证据路径、置信度、冲突和未知项;
|
|
92
|
-
- 代表性源码样本,而不是只读取 manifest。
|
|
74
|
+
**完成标准**:每个可编辑模块有路径、技术栈、入口、质量门禁和证据;扫描限制、冲突与未知项已记录。
|
|
93
75
|
|
|
94
|
-
|
|
76
|
+
### 3. 用 Agent Team 分域取证
|
|
95
77
|
|
|
96
|
-
|
|
78
|
+
当运行环境支持 Agent Team 且存在两个以上可独立审计的证据域时,默认由 leader 并行派发只读 scout。证据域按项目真实边界划分,例如架构与公共 API、后端、前端、公共复用、测试与 CI、FM/脚手架;不得套用固定角色表。
|
|
97
79
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
装配顺序:
|
|
80
|
+
leader 是唯一写入者。每个 scout 必须返回同一份精简证据合同:
|
|
101
81
|
|
|
102
82
|
```text
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
83
|
+
Scope
|
|
84
|
+
Observed capability
|
|
85
|
+
Canonical source paths
|
|
86
|
+
Mature implementations
|
|
87
|
+
Template paths
|
|
88
|
+
Consumers and tests
|
|
89
|
+
Applicable conditions
|
|
90
|
+
Legacy/counterexamples
|
|
91
|
+
Conflicts/unknowns
|
|
92
|
+
Recommended skill boundary
|
|
109
93
|
```
|
|
110
94
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
- [通用规则](references/rules/README.md)
|
|
114
|
-
- [TypeScript / JavaScript](references/typescript/README.md)
|
|
115
|
-
- [Java](references/java/README.md)
|
|
116
|
-
- [Go](references/go/README.md)
|
|
117
|
-
- [Rust](references/rust/README.md)
|
|
118
|
-
|
|
119
|
-
分支路由:
|
|
120
|
-
|
|
121
|
-
| 识别事实 | 读取 |
|
|
122
|
-
|---|---|
|
|
123
|
-
| 所有项目 | `references/rules/04`~`13` 中与任务相关的文件 |
|
|
124
|
-
| TypeScript/JavaScript | `references/typescript/00`~`04` |
|
|
125
|
-
| React | `references/typescript/frameworks/react.md` |
|
|
126
|
-
| Vue | `references/typescript/frameworks/vue.md` |
|
|
127
|
-
| 浏览器、Node、Electron | 对应 `references/typescript/runtimes/*` |
|
|
128
|
-
| CLI 或发布库 | 对应 `references/typescript/app-types/*` |
|
|
129
|
-
| Java | `references/java/00`~`04` |
|
|
130
|
-
| Spring Boot | `references/java/frameworks/spring-boot.md` |
|
|
131
|
-
| Go | `references/go/00`~`04` |
|
|
132
|
-
| Rust | `references/rust/00`~`04` |
|
|
133
|
-
| 未内置语言 | `references/rules/16-language-adapter-contract.md` 的 fallback |
|
|
95
|
+
leader 必须复读高影响路径,检查跨域冲突,并把同一事实的重复报告合并。Agent Team 不可用或任务不可合理拆分时,leader 按相同合同顺序审计;结果标准不变。
|
|
134
96
|
|
|
135
|
-
|
|
97
|
+
**完成标准**:重要规范均有真实路径、消费者或测试支撑;反例、旧实现和未知项没有被“多数模式”掩盖。
|
|
136
98
|
|
|
137
|
-
|
|
99
|
+
### 4. 收敛规范与 Skill 边界
|
|
138
100
|
|
|
139
|
-
|
|
101
|
+
先识别项目已经声明的 canonical 模板或代码样板,例如 `docs/fm/**`、scaffold、generator assets。模板与成熟代码冲突时,判断它是目标模板、过期模板还是仅负责骨架,并记录 current、target 与 migration;不得静默任选一方。
|
|
140
102
|
|
|
141
|
-
|
|
103
|
+
只有同时满足以下条件才创建领域 Skill:
|
|
142
104
|
|
|
143
|
-
|
|
105
|
+
1. 有可独立描述的触发场景;
|
|
106
|
+
2. 会在多次开发中复用;
|
|
107
|
+
3. 有充分的项目源码、模板、测试或配置证据;
|
|
108
|
+
4. 与根路由或其他领域 Skill 边界清晰;
|
|
109
|
+
5. 独立后能明显减少无关上下文。
|
|
144
110
|
|
|
145
|
-
-
|
|
146
|
-
- 模块边界、公开 API 和允许的依赖方向;
|
|
147
|
-
- 仓库中真实存在冲突的目录、命名、测试或工具链选择;
|
|
148
|
-
- React/Vue、Spring Boot、Go 或 Rust 的版本迁移与兼容边界;
|
|
149
|
-
- 临时例外的所有者、到期条件和删除条件。
|
|
111
|
+
否则内容留在 `engineering-standards`。领域 Skill 名称来自项目语义,不使用固定列表或固定数量。高影响未知项按 [决策收敛合同](references/rules/03-interview-and-decisions.md) 询问;用户已授权直接生成时,将无法安全推断的事项记为 `pending-decision`。
|
|
150
112
|
|
|
151
|
-
|
|
113
|
+
只读取与项目事实匹配的 [通用规则索引](references/rules/README.md)、[TypeScript/JavaScript](references/typescript/README.md)、[Java](references/java/README.md)、[Go](references/go/README.md) 或 [Rust](references/rust/README.md) references。内置语言包和 [未内置语言 fallback](references/rules/16-language-adapter-contract.md) 是检查清单,不是高于项目代码的规范来源。
|
|
152
114
|
|
|
153
|
-
|
|
154
|
-
2. 给出推荐默认值及理由;
|
|
155
|
-
3. 提供 2~4 个可执行选项;
|
|
156
|
-
4. 记录用户选择、适用 scope 和来源;
|
|
157
|
-
5. 不重复询问已回答或已由仓库确认的事项。
|
|
115
|
+
**完成标准**:每个生成 Skill 都有独立价值和证据边界;没有为了覆盖目录或技术栈而过度拆分。
|
|
158
116
|
|
|
159
|
-
|
|
117
|
+
### 5. 计划、生成与刷新
|
|
160
118
|
|
|
161
|
-
|
|
119
|
+
先展示精简计划:模块与证据摘要、Skill Map、每个 Skill 的来源路径、保留/更新/新增/删除项、冲突决策和验证命令。用户已在当前请求中授权实施时,展示后直接执行。
|
|
162
120
|
|
|
163
|
-
|
|
121
|
+
按 [Skill Set 生成合同](references/rules/14-generation-contract.md) 和 [模板索引](templates/README.md) 生成。所有项目引用使用项目根相对路径,并说明:何时读取、它负责什么、输出位置、需要哪些手工集成、运行什么验证。
|
|
164
122
|
|
|
165
|
-
|
|
123
|
+
先准备完整候选内容并校验,再替换 Builder 拥有的文件。刷新规则:
|
|
166
124
|
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
-
|
|
125
|
+
- 只更新或删除旧 `generated-skill-set.json` 登记的路径;
|
|
126
|
+
- 名称与未登记 Skill 冲突时停止覆盖并重新命名或询问;
|
|
127
|
+
- 保留仍有效的用户决策、例外和项目特有知识;
|
|
128
|
+
- 删除或重命名必须在计划中显式列出;
|
|
129
|
+
- 候选验证失败时保留旧 Skill Set;发布后验证失败时恢复旧内容;
|
|
130
|
+
- 相同项目事实与决策重复运行应无无意义 diff。
|
|
173
131
|
|
|
174
|
-
|
|
132
|
+
**完成标准**:根路由、领域 Skill、项目引用与所有权清单一致,清单外 Skill 未发生变化。
|
|
175
133
|
|
|
176
|
-
|
|
134
|
+
### 6. 验证与报告
|
|
177
135
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
读取:
|
|
181
|
-
|
|
182
|
-
- [`references/rules/14-generation-contract.md`](references/rules/14-generation-contract.md)
|
|
183
|
-
- [生成模板索引](templates/README.md)
|
|
184
|
-
- 对应的语言/框架 references
|
|
185
|
-
|
|
186
|
-
生成原则:
|
|
187
|
-
|
|
188
|
-
- canonical 只有 `.agents/skills/engineering-standards/` 一份;
|
|
189
|
-
- `SKILL.md` 只保留每次执行必须读取的流程、作用域和路由;
|
|
190
|
-
- 详细规则按 `project/`、`rules/`、语言与框架分层;
|
|
191
|
-
- 只生成当前项目实际使用的语言、框架与运行时目录;
|
|
192
|
-
- 每条重要规则包含 `Scope`、`Level`、`Source`、`Verification`;
|
|
193
|
-
- 项目真实命令来自仓库事实或用户确认,不能凭空创造;
|
|
194
|
-
- `refresh`/`merge` 保留用户决策、公共 API、项目特有规则和未到期例外;
|
|
195
|
-
- 存量代码采用 Ratchet,不借生成规范发动无关的大规模重写。
|
|
196
|
-
|
|
197
|
-
**完成标准**:生成树可由项目事实和决策完整解释;没有不适用章节;canonical 内容仅存在一份;所有旧入口单向路由。
|
|
198
|
-
|
|
199
|
-
### 7. 验证并报告
|
|
200
|
-
|
|
201
|
-
先运行生成 Skill 验证器:
|
|
136
|
+
运行:
|
|
202
137
|
|
|
203
138
|
```bash
|
|
204
|
-
node <skill-root>/scripts/validate-generated-skill.mjs
|
|
205
|
-
--root <project-root> \
|
|
206
|
-
--strict
|
|
139
|
+
node <skill-root>/scripts/validate-generated-skill.mjs --root <project-root> --strict
|
|
207
140
|
```
|
|
208
141
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
随后只运行仓库已经定义且本次允许执行的质量门禁。不得为获得通过而删除测试、关闭核心规则、放宽类型/编译配置或扩大例外。
|
|
212
|
-
|
|
213
|
-
最终报告:
|
|
142
|
+
再按 [验证合同](references/rules/15-validation-contract.md) 执行项目已存在且本次允许的质量门禁。不得通过删除测试、放宽编译配置或扩大例外获取通过。
|
|
214
143
|
|
|
215
|
-
|
|
216
|
-
- 实际采用与排除的规则包;
|
|
217
|
-
- 运行的命令、退出码和关键结果;
|
|
218
|
-
- 未执行或无法验证的项目门禁及原因;
|
|
219
|
-
- 待确认决策、临时例外与后续删除条件。
|
|
144
|
+
最终报告生成/更新/保留/删除的 Skill,关键证据与模板路径,运行命令及退出码,未验证项、待确认决策和临时例外。
|
|
220
145
|
|
|
221
|
-
|
|
146
|
+
**完成标准**:所有权、frontmatter、Skill 路由、项目内引用、选择性适配和规则字段通过;项目门禁通过或留下可复现阻塞证据。
|
|
222
147
|
|
|
223
148
|
## Builder 自校验
|
|
224
149
|
|
|
225
|
-
维护本 Skill
|
|
150
|
+
维护本 Skill 时读取 [fixture 合同](examples/README.md),并运行:
|
|
226
151
|
|
|
227
152
|
```bash
|
|
228
153
|
node scripts/sync-manifest.mjs --root . --check
|
|
@@ -230,4 +155,4 @@ node scripts/validate-builder.mjs --root .
|
|
|
230
155
|
node scripts/self-test.mjs --root .
|
|
231
156
|
```
|
|
232
157
|
|
|
233
|
-
|
|
158
|
+
这些脚本无第三方依赖、接受显式根目录、拒绝路径越界,并提供 `--help`。
|
|
@@ -104,9 +104,13 @@ templates/compatibility/agents-typescript--standards.md
|
|
|
104
104
|
templates/compatibility/agents-typescript-standards.md
|
|
105
105
|
templates/compatibility/claude-engineering-standards.md
|
|
106
106
|
templates/compatibility/claude-typescript-standards.md
|
|
107
|
+
templates/domain-skill/SKILL.md.template
|
|
108
|
+
templates/project-skill/generated-skill-set.json.template
|
|
107
109
|
templates/project-skill/references/project/00-project-profile.md.template
|
|
108
110
|
templates/project-skill/references/project/01-module-map.md.template
|
|
109
111
|
templates/project-skill/references/project/02-decisions-and-exceptions.md.template
|
|
112
|
+
templates/project-skill/references/project/03-skill-map.md.template
|
|
113
|
+
templates/project-skill/references/project/04-source-and-template-map.md.template
|
|
110
114
|
templates/project-skill/references/project/review-checklist.md.template
|
|
111
115
|
templates/project-skill/SKILL.md.template
|
|
112
116
|
templates/README.md
|
|
@@ -1,52 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 治理、规则级别与证据优先级
|
|
2
2
|
|
|
3
3
|
## 规则级别
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- **MUST**:正确性、安全、协议、公共 API、数据、资源生命周期或已生效门禁要求;必须有可执行检查或精确 review 证据。
|
|
6
|
+
- **SHOULD**:项目证据支持的常规做法;偏离时记录理由和 scope。
|
|
7
|
+
- **MAY**:可选模式,不作为伪门禁。
|
|
8
|
+
- **EXCEPTION**:例外;记录所有者、原因、范围、风险、到期或删除条件。
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
- **SHOULD**:大多数场景适用;偏离时需要记录理由、scope 和恢复条件。
|
|
9
|
-
- **MAY**:允许的模式,不作为伪门禁。
|
|
10
|
-
- **EXCEPTION**:临时或永久例外;必须写明所有者、原因、范围、风险、到期或删除条件。
|
|
11
|
-
|
|
12
|
-
不要把偏好包装成 MUST。无法验证的规则最多为 SHOULD,并给出具体 review 证据。
|
|
10
|
+
不要把偏好包装成 MUST。无法验证的规则最多为 SHOULD。
|
|
13
11
|
|
|
14
12
|
## 冲突优先级
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
按以下顺序判断,但任何冲突都要显式记录:
|
|
15
|
+
|
|
16
|
+
1. 安全、协议、编译器、运行时、监管和数据正确性硬约束;
|
|
17
|
+
2. 用户明确指定为 canonical 的代码、目录、模板及目标状态;
|
|
18
|
+
3. 当前生效的测试、构建、CI、公共 API、运行时配置和发布合同;
|
|
19
|
+
4. 同一 owner/scope 下成熟、受测试且有真实消费者的实现;
|
|
20
|
+
5. 项目声明的 FM、scaffold 或 generator 在其责任范围内的合同;
|
|
21
|
+
6. 项目 `AGENTS.md`、架构文档、贡献文档和现有 Skills;
|
|
22
|
+
7. Builder 内置语言规则与通用 baseline。
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
2. 用户针对本项目明确确认的目标状态;
|
|
20
|
-
3. 当前生效的构建配置、CI 合同、发布合同与公共 API;
|
|
21
|
-
4. 当前模块稳定且占主导、能被证据证明的实践;
|
|
22
|
-
5. 对应语言、框架和工具的当前官方文档;
|
|
23
|
-
6. 团队选定的风格 profile;
|
|
24
|
-
7. Builder 默认建议。
|
|
24
|
+
“代码数量更多”不是优先级。大量 legacy 实现不能自动成为新代码规范。
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
模板与成熟实现不一致时,要判定:模板是否表达目标状态、模板是否过期、或模板是否只负责骨架。必要时生成“当前状态 -> 迁移阶段 -> 目标状态”,而不是把冲突藏起来。
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## 来源标记
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
重要规则使用以下来源,并附精确路径或命令:
|
|
31
31
|
|
|
32
32
|
```text
|
|
33
33
|
repository-fact
|
|
34
|
+
project-template
|
|
34
35
|
user-decision
|
|
35
36
|
official-guidance
|
|
36
37
|
builder-baseline
|
|
37
38
|
compatibility-exception
|
|
38
39
|
```
|
|
39
40
|
|
|
40
|
-
`
|
|
41
|
+
`builder-baseline` 只用于项目证据缺失时的待确认建议,不得伪装为项目既有事实。官方文档也不能覆盖项目版本和真实配置。
|
|
41
42
|
|
|
42
43
|
## 不可被历史惯例弱化的底线
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- 外部输入未经验证;
|
|
47
|
-
- 密钥、Token、密码或个人敏感数据泄露;
|
|
48
|
-
- 资源、线程、goroutine、任务、监听器、连接或子进程没有所有者和关闭路径;
|
|
49
|
-
- 错误被静默吞掉或只记录后继续假装成功;
|
|
50
|
-
- 公共边界使用无约束动态类型;
|
|
51
|
-
- 依赖方向绕过模块边界;
|
|
52
|
-
- 删除测试、关闭核心规则或放宽编译配置以隐藏失败。
|
|
45
|
+
外部输入验证、秘密与敏感数据、错误传播、资源/任务关闭路径、公共边界类型、依赖方向和测试门禁等正确性问题,即使仓库中普遍违规,也只能采用 Ratchet 或迁移方案,不能继续扩散。
|