harnessed 4.7.0 → 4.9.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 (44) hide show
  1. package/bin/harnessed-inject-state.mjs +35 -4
  2. package/dist/cli.mjs +190 -85
  3. package/dist/cli.mjs.map +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/index.mjs.map +1 -1
  6. package/manifests/optional/perturn-inject.yaml +49 -0
  7. package/messages/zh-Hans.json +16 -2
  8. package/package.json +1 -1
  9. package/workflows/auto/SKILL.zh-Hans.md +129 -0
  10. package/workflows/disciplines/doc-discipline.zh-Hans.yaml +49 -0
  11. package/workflows/disciplines/karpathy.yaml +5 -5
  12. package/workflows/disciplines/karpathy.zh-Hans.yaml +47 -0
  13. package/workflows/disciplines/operational.yaml +6 -6
  14. package/workflows/disciplines/operational.zh-Hans.yaml +79 -0
  15. package/workflows/disciplines/output-style.yaml +7 -7
  16. package/workflows/disciplines/output-style.zh-Hans.yaml +62 -0
  17. package/workflows/disciplines/priority.yaml +2 -2
  18. package/workflows/disciplines/priority.zh-Hans.yaml +28 -0
  19. package/workflows/discuss/auto/SKILL.zh-Hans.md +75 -0
  20. package/workflows/discuss/phase/SKILL.zh-Hans.md +73 -0
  21. package/workflows/discuss/strategic/SKILL.zh-Hans.md +78 -0
  22. package/workflows/discuss/subtask/SKILL.zh-Hans.md +79 -0
  23. package/workflows/plan/architecture/SKILL.zh-Hans.md +74 -0
  24. package/workflows/plan/auto/SKILL.zh-Hans.md +75 -0
  25. package/workflows/plan/phase/SKILL.zh-Hans.md +76 -0
  26. package/workflows/research/SKILL.zh-Hans.md +81 -0
  27. package/workflows/retro/SKILL.zh-Hans.md +71 -0
  28. package/workflows/role-prompts.zh-Hans.yaml +501 -0
  29. package/workflows/ship/auto/SKILL.zh-Hans.md +46 -0
  30. package/workflows/ship/preflight/SKILL.zh-Hans.md +38 -0
  31. package/workflows/task/auto/SKILL.zh-Hans.md +80 -0
  32. package/workflows/task/clarify/SKILL.zh-Hans.md +79 -0
  33. package/workflows/task/code/SKILL.zh-Hans.md +85 -0
  34. package/workflows/task/deliver/SKILL.zh-Hans.md +113 -0
  35. package/workflows/task/test/SKILL.zh-Hans.md +90 -0
  36. package/workflows/verify/auto/SKILL.zh-Hans.md +89 -0
  37. package/workflows/verify/code-review/SKILL.zh-Hans.md +71 -0
  38. package/workflows/verify/design/SKILL.zh-Hans.md +74 -0
  39. package/workflows/verify/multispec/SKILL.zh-Hans.md +88 -0
  40. package/workflows/verify/paranoid/SKILL.zh-Hans.md +74 -0
  41. package/workflows/verify/progress/SKILL.zh-Hans.md +69 -0
  42. package/workflows/verify/qa/SKILL.zh-Hans.md +76 -0
  43. package/workflows/verify/security/SKILL.zh-Hans.md +70 -0
  44. package/workflows/verify/simplify/SKILL.zh-Hans.md +70 -0
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // package.json
2
2
  var package_default = {
3
- version: "4.7.0"};
3
+ version: "4.9.0"};
4
4
 
5
5
  // src/index.ts
6
6
  var VERSION = package_default.version;
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";AAAA,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,OAkGb,CAAA;;;AC/FO,IAAM,UAAU,eAAA,CAAI","file":"index.mjs","sourcesContent":["{\n \"name\": \"harnessed\",\n \"version\": \"4.7.0\",\n \"description\": \"AI coding harness package manager + composition orchestrator\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"author\": \"easyinplay\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/easyinplay/harnessed.git\"\n },\n \"homepage\": \"https://github.com/easyinplay/harnessed#readme\",\n \"bugs\": \"https://github.com/easyinplay/harnessed/issues\",\n \"keywords\": [\n \"claude-code\",\n \"ai-harness\",\n \"package-manager\",\n \"composition\",\n \"skill-pack\",\n \"mcp\",\n \"orchestrator\"\n ],\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"packageManager\": \"pnpm@10.12.0\",\n \"bin\": {\n \"harnessed\": \"./dist/cli.mjs\",\n \"harnessed-inject-state\": \"./bin/harnessed-inject-state.mjs\"\n },\n \"main\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"default\": \"./dist/index.mjs\"\n },\n \"./schemas\": {\n \"types\": \"./dist/schemas/index.d.ts\",\n \"import\": \"./dist/schemas/index.mjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"bin\",\n \"manifests\",\n \"messages\",\n \"workflows\",\n \"routing\",\n \"config-templates\",\n \"schemas\",\n \"README.md\",\n \"LICENSE\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.md\"\n ],\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"build\": \"tsc --noEmit && tsup\",\n \"build:schema\": \"node ./scripts/build-schema.mjs\",\n \"validate:schema\": \"node ./scripts/validate-schema.mjs\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run --passWithNoTests\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage --passWithNoTests\",\n \"bench\": \"vitest bench --run\",\n \"lint\": \"biome check .\",\n \"lint:fix\": \"biome check --write .\",\n \"format\": \"biome format --write .\"\n },\n \"dependencies\": {\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.142\",\n \"@clack/prompts\": \"^0.10.1\",\n \"@sinclair/typebox\": \"^0.34.49\",\n \"ajv\": \"^8.20.0\",\n \"ajv-errors\": \"^3.0.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"commander\": \"^13.0.0\",\n \"diff\": \"^9.0.0\",\n \"expr-eval\": \"^2.0.2\",\n \"picocolors\": \"^1.1.1\",\n \"proper-lockfile\": \"^4.1.2\",\n \"yaml\": \"^2.9.0\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.0.0\",\n \"@types/node\": \"^22.10.0\",\n \"@types/proper-lockfile\": \"^4.1.4\",\n \"@vitest/coverage-v8\": \"^4.0.0\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.0\",\n \"vitest\": \"^4.0.0\"\n },\n \"pnpm\": {\n \"onlyBuiltDependencies\": [\n \"esbuild\"\n ]\n }\n}\n","// Main library entry — re-exports public APIs.\n// phase 1.1 batch 1: skeleton only; schema validator wired in batch 2 (T3+).\n\nimport pkg from '../package.json' with { type: 'json' }\n\nexport const VERSION = pkg.version\n"]}
1
+ {"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";AAAA,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,OAkGb,CAAA;;;AC/FO,IAAM,UAAU,eAAA,CAAI","file":"index.mjs","sourcesContent":["{\n \"name\": \"harnessed\",\n \"version\": \"4.9.0\",\n \"description\": \"AI coding harness package manager + composition orchestrator\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"author\": \"easyinplay\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/easyinplay/harnessed.git\"\n },\n \"homepage\": \"https://github.com/easyinplay/harnessed#readme\",\n \"bugs\": \"https://github.com/easyinplay/harnessed/issues\",\n \"keywords\": [\n \"claude-code\",\n \"ai-harness\",\n \"package-manager\",\n \"composition\",\n \"skill-pack\",\n \"mcp\",\n \"orchestrator\"\n ],\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"packageManager\": \"pnpm@10.12.0\",\n \"bin\": {\n \"harnessed\": \"./dist/cli.mjs\",\n \"harnessed-inject-state\": \"./bin/harnessed-inject-state.mjs\"\n },\n \"main\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"default\": \"./dist/index.mjs\"\n },\n \"./schemas\": {\n \"types\": \"./dist/schemas/index.d.ts\",\n \"import\": \"./dist/schemas/index.mjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"bin\",\n \"manifests\",\n \"messages\",\n \"workflows\",\n \"routing\",\n \"config-templates\",\n \"schemas\",\n \"README.md\",\n \"LICENSE\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.md\"\n ],\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"build\": \"tsc --noEmit && tsup\",\n \"build:schema\": \"node ./scripts/build-schema.mjs\",\n \"validate:schema\": \"node ./scripts/validate-schema.mjs\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run --passWithNoTests\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage --passWithNoTests\",\n \"bench\": \"vitest bench --run\",\n \"lint\": \"biome check .\",\n \"lint:fix\": \"biome check --write .\",\n \"format\": \"biome format --write .\"\n },\n \"dependencies\": {\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.142\",\n \"@clack/prompts\": \"^0.10.1\",\n \"@sinclair/typebox\": \"^0.34.49\",\n \"ajv\": \"^8.20.0\",\n \"ajv-errors\": \"^3.0.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"commander\": \"^13.0.0\",\n \"diff\": \"^9.0.0\",\n \"expr-eval\": \"^2.0.2\",\n \"picocolors\": \"^1.1.1\",\n \"proper-lockfile\": \"^4.1.2\",\n \"yaml\": \"^2.9.0\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.0.0\",\n \"@types/node\": \"^22.10.0\",\n \"@types/proper-lockfile\": \"^4.1.4\",\n \"@vitest/coverage-v8\": \"^4.0.0\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.0\",\n \"vitest\": \"^4.0.0\"\n },\n \"pnpm\": {\n \"onlyBuiltDependencies\": [\n \"esbuild\"\n ]\n }\n}\n","// Main library entry — re-exports public APIs.\n// phase 1.1 batch 1: skeleton only; schema validator wired in batch 2 (T3+).\n\nimport pkg from '../package.json' with { type: 'json' }\n\nexport const VERSION = pkg.version\n"]}
@@ -0,0 +1,49 @@
1
+ # yaml-language-server: $schema=../../schemas/manifest.v1.schema.json
2
+ # Phase 35 (v5.0 Spec 3/G) — opt-in per-turn injection hook.
3
+ # Registers a UserPromptSubmit hook that runs bin/harnessed-inject-state.mjs each
4
+ # turn: the bin prints a <workflow-state> breadcrumb (you-are-here / next sub) +
5
+ # a relevance-filtered <project-context> block for the ACTIVE session's workflow
6
+ # (session-scoped via the composite ledger key — Phase 34/35). The bin exits 0
7
+ # silently when there is no active workflow, so an enabled hook in a non-workflow
8
+ # repo is a cheap no-op. Opt-in (manifests/optional/) because per-turn injection
9
+ # has a token cost (~1500 budget) and only matters in a harnessed-workflow repo.
10
+ # Idempotent — re-install on an existing matching entry → skip.
11
+ apiVersion: harnessed/v1
12
+ kind: Manifest
13
+ metadata:
14
+ name: perturn-inject
15
+ display_name: Per-Turn State Injection (UserPromptSubmit)
16
+ description: Opt-in UserPromptSubmit hook injecting the active session's workflow-state + project-context each turn (Spec 3/G).
17
+ upstream:
18
+ source: perturn-inject
19
+ homepage: https://github.com/easyinplay/harnessed
20
+ repository: https://github.com/easyinplay/harnessed.git
21
+ license: MIT
22
+ notice: First-party harnessed hook (Phase 35, v5.0 Spec 3/G).
23
+ spec:
24
+ type: cc-hook
25
+ component_type: command
26
+ category: meta
27
+ install_type: hook
28
+ install:
29
+ method: cc-hook-add
30
+ cmd: "node bin/harnessed-inject-state.mjs"
31
+ hook_event: UserPromptSubmit
32
+ hook_command: "node bin/harnessed-inject-state.mjs"
33
+ idempotent_check: "grep -q harnessed-inject-state ~/.claude/settings.json"
34
+ verify:
35
+ cmd: "grep -q harnessed-inject-state ~/.claude/settings.json"
36
+ timeout_ms: 5000
37
+ expected_exit_code: 0
38
+ uninstall:
39
+ cmd: "true"
40
+ upstream_health:
41
+ stability: beta
42
+ last_check: "2026-06-25"
43
+ last_known_good_version: "0.1.0"
44
+ fallback_action: warn
45
+ signed_by: easyinplay
46
+ platforms:
47
+ - linux
48
+ - darwin
49
+ - win32
@@ -39,8 +39,22 @@
39
39
  "uninstall.confirm.prompt": "Uninstall '{{name}}'? This cannot be undone.",
40
40
  "uninstall.cancelled": "aborted: user cancelled",
41
41
  "uninstall.completed": "uninstalled {{name}}",
42
- "uninstall.yes_dryrun_conflict": "error: --yes is incompatible with --dry-run (dry-run does not mutate)",
43
- "uninstall.yes_dryrun_conflict.fix": " fix: harnessed uninstall {{name}} --yes (immediate) OR harnessed uninstall {{name}} --dry-run (preview)",
42
+ "uninstall.unified.nothing": "无需操作 未找到 harnessed 产物",
43
+ "uninstall.unified.header": "harnessed uninstall 将移除以下内容:",
44
+ "uninstall.unified.commands": " Commands: ~/.claude/commands/ 中 {{count}} 个 harnessed 生成的 slash command 文件",
45
+ "uninstall.unified.skills": " Skills: ~/.claude/skills/ 中 {{count}} 个 workflow skill 目录",
46
+ "uninstall.unified.settings": " Settings: ~/.claude/settings.json 中的 harnessed 环境变量(CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS、HARNESSED_USER_LANG)",
47
+ "uninstall.unified.state_dir": " State directory: ~/.claude/harnessed/(含 backups、audit log、state、lock)",
48
+ "uninstall.unified.upstream_note": "\nUpstream 组件(npm packages、MCP servers、CC plugins、git-cloned repos、npx skills)不受影响。",
49
+ "uninstall.unified.dry_run_hint": "\n(dry-run — 去掉 --dry-run 重新运行以实际移除)",
50
+ "uninstall.unified.confirm": "移除 harnessed 自身的文件?Upstream 组件(npm packages、MCP servers、CC plugins 等)不受影响。此操作不可撤销。",
51
+ "uninstall.unified.removing": "正在移除 harnessed 文件...",
52
+ "uninstall.unified.removed_commands": " 已移除 {{count}} 个 command 文件",
53
+ "uninstall.unified.removed_skills": " 已移除 {{count}} 个 skill 目录",
54
+ "uninstall.unified.removed_settings": " 已移除 ~/.claude/settings.json 中的 harnessed 环境变量",
55
+ "uninstall.unified.removed_state_dir": " 已移除 ~/.claude/harnessed/",
56
+ "uninstall.unified.partial_failure": "\n{{count}} 个条目无法移除(权限不足或已不存在):",
57
+ "uninstall.unified.complete": "uninstall 完成 — harnessed 自身的文件已移除",
44
58
 
45
59
  "gc.invalid_duration": "error: invalid --older-than '{{value}}'",
46
60
  "gc.invalid_duration.fix": " fix: use format <N>{d|h|m|w} e.g. 30d / 24h / 60m / 4w",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harnessed",
3
- "version": "4.7.0",
3
+ "version": "4.9.0",
4
4
  "description": "AI coding harness package manager + composition orchestrator",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: auto
3
+ description: |
4
+ 超级主控编排器 — 一行命令跑完整 6-stage 功能开发流 (research conditional →
5
+ discuss → plan → task → verify → retro mandatory), 适合 trivial / well-defined feature OR 你
6
+ 想 hands-off。每 stage 内部仍 fan-out sub-workflow per 现有 stage-master orchestrator pattern。
7
+ v3.2.0 强化:Phase 0 AI 1-shot complexity assessment + Phase 0.5 understanding check prompt
8
+ + Phase 5 `/retro` mandatory。
9
+ schema_version: harnessed.workflow.v3 with delegates_to (6 sub: research conditional order 0 +
10
+ 4 stage-master order 1-4 + retro mandatory order 5) + disciplines_applied (6 default)
11
+ + tools_available (agent-teams-create + planning-with-files)。Fail-fast default; opt-in
12
+ `--staged` flag 重现 stage gate UX (每 stage 完停 user review)。
13
+ Triggered by slash command `/auto` (bare per ADR 0030 namespace policy D-02 LOCK)
14
+ after `harnessed setup`.
15
+ trigger_phrases:
16
+ - "auto"
17
+ - "自动跑完"
18
+ - "完整流程"
19
+ - "一键开发"
20
+ - "auto chain"
21
+ - "super master"
22
+ ---
23
+
24
+ # auto 超级主控编排器 (v3.2.0 增强版)
25
+
26
+ ## 概述
27
+
28
+ v3.2.0 新增 — 6-stage 节奏 (research conditional → discuss → plan → task → verify → retro
29
+ mandatory), sister 四个 stage-master `/discuss /plan /task /verify` 仍可独立调用;
30
+ `/auto` 是可选的一行命令 chain。
31
+
32
+ | order | sub | gate ref | mode | when fires |
33
+ | ----- | --- | -------- | ---- | ---------- |
34
+ | 0 | `research` | `judgments.stage-routing.auto-research-unclear.fires` | serial | user_understanding_unclear == true (Phase 0.5 prompt n) |
35
+ | 1 | `discuss` | (unconditional — 4-stage chain 起点) | serial | always |
36
+ | 2 | `plan` | (unconditional — stage 2) | serial | always |
37
+ | 3 | `task` | (unconditional — stage 3) | serial | always |
38
+ | 4 | `verify` | (unconditional — stage 4 收尾) | serial | always |
39
+ | 5 | `retro` | (unconditional — auto mode mandatory) | serial | always |
40
+
41
+ 引擎运行时通过 `runMasterOrchestrator` 依次 spawn 6 个子工作流 yaml,遵循
42
+ T3.5.W0.1 — 递归单层抽象 (super-master → stage-master OR standalone → sub-workflow):
43
+
44
+ - 顶层调用 `/auto` → 加载 `workflows/auto/workflow.yaml` → runAutoPreFlight hook
45
+ - pre-flight Phase 0: `assessComplexity(taskDescription)` → small/medium 自动 continue;
46
+ large → 提示用户切 `--staged` (y) OR abort 建议手动 (n)
47
+ - pre-flight Phase 0.5: `promptUserUnderstanding()` → y 跳过 research;n 设置
48
+ `user_understanding_unclear = true` 进 ctx → research 关卡触发
49
+ - spawn order 0: `workflows/research/workflow.yaml` (if gate fires)
50
+ - spawn order 1-4: 4 个 stage-master `workflows/<sub>/auto/workflow.yaml`
51
+ - spawn order 5: `workflows/retro/workflow.yaml` (mandatory unconditional)
52
+
53
+ K8 ctx single snapshot:auto 顶层调用 1 个 snapshot,传递给全部 6 个 spawn
54
+ (sister Phase 3.5 W0.1 pattern verbatim,1 snapshot per top-level invoke 跨整个 cycle)。
55
+
56
+ ## 默认行为
57
+
58
+ - **Pre-flight 关卡**: complexity assessment + understanding check (交互式提示)
59
+ - **连续 chain**: 6 个 stage 一行命令跑完,中间不停
60
+ - **Fail-fast**: 任一 stage 失败立即停止,`harnessed resume` 续跑
61
+ - **Context 自动传递**: planning-with-files `.planning/<phase>/` 喂给下游 stage
62
+ - **Retro mandatory**: auto mode hands-off 场景,末尾强制 `/retro` 总结 (无 opt-out flag)
63
+ - **沿用 sister planning-with-files /plan 持久化 cadence**
64
+
65
+ ## 可选 flag
66
+
67
+ - `--staged` opt-in: 每个 stage-master 跑完后停止,等用户 review/confirm 后跑下一个 stage (stage gate UX)
68
+
69
+ ## 何时用 `/auto` vs 4 个 stage-master 手动
70
+
71
+ ✅ **触发 `/auto`**:
72
+ - Trivial / well-defined feature (e.g. CRUD endpoint + standard pattern)
73
+ - Hands-off 场景 (你想"跑完再回来看")
74
+ - 跨 stage decision 都明显 (无 open question)
75
+ - AI 自动判断需求复杂度 small/medium → 直接 continue;large → 自动建议 `--staged`
76
+
77
+ ❌ **跳过 `/auto` → 分阶段手动 `/discuss` → `/plan` → `/task` → `/verify`**:
78
+ - 关键发布 / 大重构 (需 stage gate 审查)
79
+ - 跨 stage 有 open implementation decisions
80
+ - 你想在 stage 之间做 hands-on 审查
81
+ - 不确定整体方向 (此时手动 `/discuss` 强 grill)
82
+ - AI complexity gate 判定 large 且用户不切 `--staged` → 建议 abort 手动
83
+
84
+ ## Capability refs
85
+
86
+ Sister `workflows/capabilities.yaml`:
87
+ - `agent-teams-create` — Bucket 5 agent-platform (verify 阶段 multispec Pattern C 4-specialist team,当 critical-release-upgrade 关卡触发时)
88
+ - `planning-with-files` — Bucket 4 核心能力 (持久化 task_plan.md + progress.md
89
+ 跨 6 个 stage 自动传递 context)
90
+ - Downstream sub refs:
91
+ - sub `research` upstream → `workflows/research/workflow.yaml` (standalone)
92
+ - sub `discuss` upstream → `workflows/discuss/auto/workflow.yaml` (stage-master)
93
+ - sub `plan` upstream → `workflows/plan/auto/workflow.yaml` (stage-master)
94
+ - sub `task` upstream → `workflows/task/auto/workflow.yaml` (stage-master)
95
+ - sub `verify` upstream → `workflows/verify/auto/workflow.yaml` (stage-master)
96
+ - sub `retro` upstream → `workflows/retro/workflow.yaml` (standalone)
97
+
98
+ ## 调用方式
99
+
100
+ - Slash command: `/auto <feature description>` (bare per ADR 0030 namespace policy D-02 LOCK
101
+ after `harnessed setup`)
102
+ - 4 个 stage-master `/discuss /plan /task /verify` 仍可独立调用 — `/auto` 是可选的新工作流
103
+ - `--staged` opt-in 启用 stage gate UX (每 stage 跑完后停止等用户 review)
104
+
105
+ ## 如何调用
106
+
107
+ 使用 Bash 工具运行:
108
+
109
+ ```bash
110
+ echo "$ARGUMENTS" | harnessed run auto --task-stdin
111
+ ```
112
+
113
+ 如果 `$ARGUMENTS` 为空,运行 `harnessed run auto`(不带 stdin pipe)。
114
+
115
+ 完成后,Bash 输出会在 stderr 打印 `Next:` 提示,建议下一个阶段。根据对话上下文决定是否调用 — 该提示仅供参考,不作强制指引。
116
+ - 如需逐 stage 审查,追加 `--staged`(每个 stage 完成后暂停,等待用户 review)。
117
+
118
+ <!-- harnessed-generated:v3.4.4 -->
119
+
120
+ ## 参考文档
121
+
122
+ - D-01 master orchestrator 委托模式
123
+ - D-02 bare slash cmd 约定 (ADR 0030 namespace policy LOCK)
124
+ - D-13 declarative SoT (delegates_to[] 声明 + engine 消费)
125
+ - workflows/{research,retro}/workflow.yaml — 2 个 standalone (research conditional + retro mandatory)
126
+ - workflows/{discuss,plan,task,verify}/auto/workflow.yaml — 4 个 stage-master Phase 3.5 SHIPPED
127
+ - workflows/judgments/stage-routing.yaml — auto-research-unclear trigger (v3.2.0 新增)
128
+ - src/workflow/masterOrchestrator.ts — 'auto' literal + recursive spawn + runAutoPreFlight hook
129
+ - CHANGELOG [3.2.0] — complexity gate + research/retro flow + `--staged` rename
@@ -0,0 +1,49 @@
1
+ # workflows/disciplines/doc-discipline.yaml
2
+ # 文档纪律 — bundled discipline (STATE digest line-limit + one-fact-per-file +
3
+ # overview-pointer-no-inline-narrative + transient-consume-then-archive +
4
+ # status-derived-from-artifacts + responsibility-matrix-one-home)
5
+ # Phase v6.0 T11.1 — 7th L0 Discipline Substrate per D-09
6
+ # Codifies CLAUDE.md 文档纪律 section (三层渐进式结构 + 反腐防膨胀铁律)
7
+
8
+ schema_version: harnessed.discipline.v1
9
+ discipline: doc
10
+ enforcement_layer: commit
11
+ auto_enforce: true
12
+
13
+ rules:
14
+ - id: state-digest-line-limit
15
+ description: STATE.md 超过 100 行触发 halt;通过 `HARNESSED_ALLOW_LONG_STATE=1` override
16
+ enforcement: halt
17
+ trigger: "phase.type == 'commit' AND changed_files contains '.planning/STATE.md'"
18
+ check_method: external-cmd
19
+ # No auto_fix_cmd — halt rules do not auto-fix; override is env-based in TS
20
+
21
+ - id: one-fact-per-file
22
+ description: 决策类文档必须单一主题;同一事实跨文件重复散布违反 one-fact-per-file
23
+ enforcement: warn
24
+ trigger: "phase.type == 'commit' AND changed_files matches '\\.planning/'"
25
+ check_method: heuristic
26
+
27
+ - id: overview-pointer-no-inline-narrative
28
+ description: ROADMAP/概览类文档不得内联收尾叙事(叙事进 SUMMARY,而非 ROADMAP)
29
+ enforcement: warn
30
+ trigger: "phase.type == 'commit' AND changed_files matches 'ROADMAP\\.md|STATE\\.md'"
31
+ check_method: heuristic
32
+
33
+ - id: transient-consume-then-archive
34
+ description: HANDOFF 及其他 transient 产物必须在消费后归档,不得堆积在 .planning/ 根目录
35
+ enforcement: warn
36
+ trigger: "phase.type == 'commit' AND changed_files matches 'HANDOFF'"
37
+ check_method: heuristic
38
+
39
+ - id: status-derived-from-artifacts
40
+ description: Phase 状态必须从 VERIFICATION 产物 + 测试结果派生,而非在 STATE/ROADMAP 里手动维护布尔值
41
+ enforcement: warn
42
+ trigger: "phase.type == 'commit' AND changed_files contains '.planning/STATE.md'"
43
+ check_method: heuristic
44
+
45
+ - id: responsibility-matrix-one-home
46
+ description: 每个事实按责任矩阵只有唯一归处(决策→ADR,需求→REQUIREMENTS 等);跨文件重复即违规
47
+ enforcement: info
48
+ trigger: "phase.type == 'commit' AND changed_files matches '\\.planning/'"
49
+ check_method: heuristic
@@ -10,7 +10,7 @@ auto_enforce: true
10
10
 
11
11
  rules:
12
12
  - id: think-before-coding
13
- description: 先思考后写代码,不直接 dump 代码;每个子任务前 brainstorm 设计意图
13
+ description: Think before coding; do not dump code directly; brainstorm the design intent before each subtask
14
14
  enforcement: warn
15
15
  trigger: subtask.type == 'code-write'
16
16
  check_method: heuristic
@@ -18,14 +18,14 @@ rules:
18
18
  # (e.g., 'Plan:' / 'Approach:' / '设计:' / '思路:'),若全是 code block → warn
19
19
 
20
20
  - id: simplicity-first
21
- description: 追求最小有效代码,避免不必要复杂度;YAGNI / 不为假设场景写代码
21
+ description: Pursue the minimal effective code, avoid unnecessary complexity; YAGNI / do not write code for hypothetical scenarios
22
22
  enforcement: warn
23
23
  trigger: always-on
24
24
  check_method: llm-judge
25
25
  # check_method='llm-judge' — verify phase 调用 code-simplifier review
26
26
 
27
27
  - id: surgical-changes
28
- description: 小步原子修改,每个 commit 单一职责;不大段重写
28
+ description: Small atomic changes, single responsibility per commit; no large-scale rewrites
29
29
  enforcement: warn
30
30
  trigger: phase.type == 'execute'
31
31
  check_method: external-cmd
@@ -33,13 +33,13 @@ rules:
33
33
  # 单 commit > 300 line diff → warn (rough heuristic, override allowed via task spec)
34
34
 
35
35
  - id: goal-driven-execution
36
- description: 目标驱动,不发散 / 不无关重构;只解决当前任务 + 不夹带 cleanup
36
+ description: Goal-driven, do not diverge / do no unrelated refactoring; solve only the current task and do not smuggle in cleanup
37
37
  enforcement: warn
38
38
  trigger: phase.type == 'execute'
39
39
  check_method: heuristic
40
40
 
41
41
  - id: file-length-200-hard-limit
42
- description: 单文件 ≤200L 硬限 (per project CLAUDE.md karpathy 心法 reminder);超过 → split helper
42
+ description: Single-file ≤200L hard limit (per project CLAUDE.md karpathy guideline reminder); over the limit → split into a helper
43
43
  enforcement: halt
44
44
  trigger: phase.type == 'execute' AND file.lines > 200
45
45
  check_method: external-cmd
@@ -0,0 +1,47 @@
1
+ # workflows/disciplines/karpathy.yaml
2
+ # karpathy 心法 + 编码硬限 — bundled discipline (think-before-coding / simplicity-first / surgical-changes / goal-driven)
3
+ # Phase v3.0-3.3 W0.4 ship per D-09 (L0 Discipline Substrate)
4
+ # Snapshot of CLAUDE.md as of v3.0 ship date (K7 mitigation, verbatim)
5
+
6
+ schema_version: harnessed.discipline.v1
7
+ discipline: karpathy
8
+ enforcement_layer: code-writing
9
+ auto_enforce: true
10
+
11
+ rules:
12
+ - id: think-before-coding
13
+ description: 先思考后写代码,不直接 dump 代码;每个子任务前 brainstorm 设计意图
14
+ enforcement: warn
15
+ trigger: subtask.type == 'code-write'
16
+ check_method: heuristic
17
+ # check_method='heuristic' — runtime engine 检查 subagent 输出 first 200 char 是否含设计意图 marker
18
+ # (e.g., 'Plan:' / 'Approach:' / '设计:' / '思路:'),若全是 code block → warn
19
+
20
+ - id: simplicity-first
21
+ description: 追求最小有效代码,避免不必要复杂度;YAGNI / 不为假设场景写代码
22
+ enforcement: warn
23
+ trigger: always-on
24
+ check_method: llm-judge
25
+ # check_method='llm-judge' — verify phase 调用 code-simplifier review
26
+
27
+ - id: surgical-changes
28
+ description: 小步原子修改,每个 commit 单一职责;不大段重写
29
+ enforcement: warn
30
+ trigger: phase.type == 'execute'
31
+ check_method: external-cmd
32
+ auto_fix_cmd: 'git diff --stat HEAD~1 | awk ''{lines+=$3} END {if (lines>300) exit 1}'''
33
+ # 单 commit > 300 line diff → warn (rough heuristic, override allowed via task spec)
34
+
35
+ - id: goal-driven-execution
36
+ description: 目标驱动,不发散 / 不无关重构;只解决当前任务 + 不夹带 cleanup
37
+ enforcement: warn
38
+ trigger: phase.type == 'execute'
39
+ check_method: heuristic
40
+
41
+ - id: file-length-200-hard-limit
42
+ description: 单文件 ≤200L 硬限 (per project CLAUDE.md karpathy 心法 reminder);超过 → split helper
43
+ enforcement: halt
44
+ trigger: phase.type == 'execute' AND file.lines > 200
45
+ check_method: external-cmd
46
+ auto_fix_cmd: 'wc -l <file> | awk ''{if ($1>200) exit 1}'''
47
+ # 实装 split helper pattern (sister fallbackHandlers.ts / sdkReconcile.ts ≤80L)
@@ -12,7 +12,7 @@ auto_enforce: true
12
12
  rules:
13
13
  - id: biome-preempt
14
14
  description: |
15
- TS/JS commit 前必跑 `pnpm exec biome check --write` (3 CI-red recurrences Phase 2.1.1/2.2/2.3 project memory)
15
+ Before any TS/JS commit you must run `pnpm exec biome check --write` (3 CI-red recurrences Phase 2.1.1/2.2/2.3 project memory)
16
16
  enforcement: auto-fix
17
17
  trigger: |
18
18
  phase.type == 'commit' AND
@@ -23,8 +23,8 @@ rules:
23
23
 
24
24
  - id: a7-adr-conservation
25
25
  description: |
26
- ADR 不动旧 ADR main body,baseline tag iterate,CI A7 step 守恒
27
- (sister Phase 1.3-2.6 ADR errata 路径)
26
+ A new ADR does not touch the main body of old ADRs; iterate via baseline tag, conserved by the CI A7 step
27
+ (sister Phase 1.3-2.6 ADR errata path)
28
28
  enforcement: warn
29
29
  trigger: phase.type == 'commit' AND changed_files contains 'docs/adr/'
30
30
  check_method: external-cmd
@@ -40,14 +40,14 @@ rules:
40
40
 
41
41
  - id: no-skip-hooks
42
42
  description: |
43
- 不允许 --no-verify / --no-gpg-sign skip hook flag,除非用户明确要求
43
+ Skip-hook flags such as --no-verify / --no-gpg-sign are not allowed, unless the user explicitly requests them
44
44
  enforcement: halt
45
45
  trigger: cmd.type == 'git-commit' AND args contains '--no-verify'
46
46
  check_method: regex
47
47
 
48
48
  - id: destructive-ops-explicit
49
49
  description: |
50
- Destructive ops (git reset --hard / push --force / rm -rf / drop table) 必须用户 explicit 确认
50
+ Destructive ops (git reset --hard / push --force / rm -rf / drop table) require explicit user confirmation
51
51
  enforcement: halt
52
52
  trigger: cmd.is_destructive == true
53
53
  check_method: heuristic
@@ -55,7 +55,7 @@ rules:
55
55
 
56
56
  - id: authorization-not-transitive
57
57
  description: |
58
- 用户 approve 一次 push ≠ 全程 approve;每个 destructive / shared-state 操作单独确认
58
+ A user approving one push ≠ approval for the whole session; each destructive / shared-state operation needs separate confirmation
59
59
  enforcement: warn
60
60
  trigger: cmd.requires_approval == true AND session.has_prior_approval == true
61
61
  check_method: heuristic
@@ -0,0 +1,79 @@
1
+ # workflows/disciplines/operational.yaml
2
+ # 操作纪律 — bundled discipline (biome preempt + commit safety +
3
+ # A7 ADR + no-skip-hooks + authorization-not-transitive + destructive-ops-explicit)
4
+ # Phase v3.0-3.3 W0.4 ship per D-09
5
+ # Snapshot of CLAUDE.md as of v3.0 ship date (K7 mitigation, verbatim)
6
+
7
+ schema_version: harnessed.discipline.v1
8
+ discipline: operational
9
+ enforcement_layer: commit
10
+ auto_enforce: true
11
+
12
+ rules:
13
+ - id: biome-preempt
14
+ description: |
15
+ TS/JS commit 前必跑 `pnpm exec biome check --write` (3 CI-red recurrences Phase 2.1.1/2.2/2.3 project memory)
16
+ enforcement: auto-fix
17
+ trigger: |
18
+ phase.type == 'commit' AND
19
+ changed_files matches '\\.(ts|tsx|js|mjs)$'
20
+ check_method: external-cmd
21
+ auto_fix_cmd: 'corepack pnpm exec biome check --write'
22
+ # NEW src/discipline/enforcement/before-commit.ts hook; exit 0 才允许 commit
23
+
24
+ - id: a7-adr-conservation
25
+ description: |
26
+ 新 ADR 不动旧 ADR main body,baseline tag iterate,CI A7 step 守恒
27
+ (sister Phase 1.3-2.6 ADR errata 路径)
28
+ enforcement: warn
29
+ trigger: phase.type == 'commit' AND changed_files contains 'docs/adr/'
30
+ check_method: external-cmd
31
+ auto_fix_cmd: 'scripts/check-adr-conservation.sh'
32
+
33
+ - id: no-push-without-approval
34
+ description: |
35
+ NEVER push to remote without user explicit approval (project CLAUDE.md commit safety)
36
+ enforcement: halt
37
+ trigger: cmd.type == 'git-push'
38
+ check_method: external-cmd
39
+ # ralph-loop / subagent 自动调 git push → halt;user explicit `git push` 在主 session 允许
40
+
41
+ - id: no-skip-hooks
42
+ description: |
43
+ 不允许 --no-verify / --no-gpg-sign 等 skip hook flag,除非用户明确要求
44
+ enforcement: halt
45
+ trigger: cmd.type == 'git-commit' AND args contains '--no-verify'
46
+ check_method: regex
47
+
48
+ - id: destructive-ops-explicit
49
+ description: |
50
+ Destructive ops (git reset --hard / push --force / rm -rf / drop table) 必须用户 explicit 确认
51
+ enforcement: halt
52
+ trigger: cmd.is_destructive == true
53
+ check_method: heuristic
54
+ # heuristic — 命令含 'rm -rf' / 'reset --hard' / '--force' / 'DROP TABLE' / 'delete from'
55
+
56
+ - id: authorization-not-transitive
57
+ description: |
58
+ 用户 approve 一次 push ≠ 全程 approve;每个 destructive / shared-state 操作单独确认
59
+ enforcement: warn
60
+ trigger: cmd.requires_approval == true AND session.has_prior_approval == true
61
+ check_method: heuristic
62
+
63
+ # v3.6.0 Phase 3 — transparent-skip discipline (P0b 下半,Audit § fallback
64
+ # 三条铁律 "拿不准 → 倾向跳过 + 透明声明"). prompt-inject method delivered
65
+ # via src/workflow/run.ts TRANSPARENT_SKIP_RULES const appended to
66
+ # criticalSystemReminder_EXPERIMENTAL alongside ESCALATION_RULES (v3.5.0
67
+ # Phase 2 sister). Spawned subagent reads the rule + emits the verbatim
68
+ # skip message when gate context is ambiguous instead of silent execution.
69
+ - id: transparent-skip-on-low-confidence
70
+ description: |
71
+ When a phase gate condition cannot be confidently evaluated (e.g.
72
+ expected context fields missing, default-valued, or contradictory),
73
+ prefer skip + transparent explanation over silent execution.
74
+ Verbatim format: "这次跳过了 <phase>, 因为 <reason>. 如果你认为
75
+ 需要请明说" / English: "Skipped <phase> because <reason>. Tell me
76
+ if you actually need it."
77
+ enforcement: warn
78
+ trigger: gate_evaluation_low_confidence
79
+ check_method: prompt-inject
@@ -10,7 +10,7 @@ auto_enforce: true
10
10
 
11
11
  rules:
12
12
  - id: bluf-conclusion-first
13
- description: 结论先行 (BLUF),每段先一句给答案/判断/推荐,再展开理由
13
+ description: Conclusion first (BLUF); each paragraph leads with one sentence giving the answer/judgment/recommendation, then expands the reasoning
14
14
  enforcement: warn
15
15
  trigger: always-on
16
16
  check_method: heuristic
@@ -18,7 +18,7 @@ rules:
18
18
  # 失败 → warn 'BLUF missing: first sentence is not a conclusion'
19
19
 
20
20
  - id: no-sycophantic-open-close
21
- description: 删除"好问题/太棒了/完美/希望对你有帮助/还需要别的吗"等开场闭合套话
21
+ description: Remove opening/closing filler phrases like "good question / awesome / perfect / hope this helps / anything else"
22
22
  enforcement: auto-fix
23
23
  trigger: always-on
24
24
  check_method: regex
@@ -26,14 +26,14 @@ rules:
26
26
  # NEW src/discipline/enforcement/strip-sycophantic.ts — regex strip 13 known phrase
27
27
 
28
28
  - id: no-emoji-unless-requested
29
- description: 禁用 emoji,除非用户明确要求 (项目 markdown 文件如 README/PR/CHANGELOG 不约束)
29
+ description: No emoji unless the user explicitly requests it (project markdown files such as README/PR/CHANGELOG are not constrained)
30
30
  enforcement: warn
31
31
  trigger: response.target == 'chat' AND user.requested_emoji == false
32
32
  check_method: regex
33
33
  # regex /\p{Emoji_Presentation}/u; 命中 + trigger fires → warn
34
34
 
35
35
  - id: no-em-dash
36
- description: 禁用 em-dash (—— / —);替代:补充用括号/冒号,并列用顿号,转折单独成句
36
+ description: No em-dash (—— / —); instead use parentheses or colons for asides, commas for lists, and a separate sentence for contrast
37
37
  enforcement: auto-fix
38
38
  trigger: response.target == 'chat'
39
39
  check_method: regex
@@ -41,13 +41,13 @@ rules:
41
41
  # auto-replace '——' → ', ' (单段内逗号);'—' → ':' OR ','
42
42
 
43
43
  - id: precise-quantifier
44
- description: 量词精确,能给具体数字/文件名/行号/commit hash 就不用"一些/几个/多个"
44
+ description: Precise quantifiers; when a concrete number/filename/line number/commit hash is available, do not say "some/a few/several"
45
45
  enforcement: info
46
46
  trigger: always-on
47
47
  check_method: llm-judge
48
48
 
49
49
  - id: no-end-recap
50
- description: 不做结尾总结,除非用户明确要求"汇总/recap"
50
+ description: No closing summary unless the user explicitly asks to "summarize/recap"
51
51
  enforcement: warn
52
52
  trigger: response.target == 'chat'
53
53
  check_method: heuristic
@@ -55,7 +55,7 @@ rules:
55
55
  # → warn 'redundant end recap'
56
56
 
57
57
  - id: no-empty-continuation-question
58
- description: 禁空洞续作询问 (要不要我帮你 X?/还需要别的吗?);保留工作流必要下一步指引
58
+ description: No empty continuation questions ("want me to help you X?" / "anything else?"); keep workflow-necessary next-step guidance
59
59
  enforcement: warn
60
60
  trigger: response.target == 'chat'
61
61
  check_method: regex
@@ -0,0 +1,62 @@
1
+ # workflows/disciplines/output-style.yaml
2
+ # 对话回答风格 — bundled discipline (BLUF + no-sycophantic + no-emoji + no-em-dash + 量词精确 + no-end-recap + no-empty-continuation-question)
3
+ # Phase v3.0-3.3 W0.4 ship per D-09
4
+ # Snapshot of CLAUDE.md as of v3.0 ship date (K7 mitigation, verbatim)
5
+
6
+ schema_version: harnessed.discipline.v1
7
+ discipline: output-style
8
+ enforcement_layer: output
9
+ auto_enforce: true
10
+
11
+ rules:
12
+ - id: bluf-conclusion-first
13
+ description: 结论先行 (BLUF),每段先一句给答案/判断/推荐,再展开理由
14
+ enforcement: warn
15
+ trigger: always-on
16
+ check_method: heuristic
17
+ # heuristic — 第一句长度 ≤ 100 char + 含答案动词 ('是' / '不是' / '推荐' / '应该' / 'use X')
18
+ # 失败 → warn 'BLUF missing: first sentence is not a conclusion'
19
+
20
+ - id: no-sycophantic-open-close
21
+ description: 删除"好问题/太棒了/完美/希望对你有帮助/还需要别的吗"等开场闭合套话
22
+ enforcement: auto-fix
23
+ trigger: always-on
24
+ check_method: regex
25
+ auto_fix_cmd: 'strip-sycophantic'
26
+ # NEW src/discipline/enforcement/strip-sycophantic.ts — regex strip 13 known phrase
27
+
28
+ - id: no-emoji-unless-requested
29
+ description: 禁用 emoji,除非用户明确要求 (项目 markdown 文件如 README/PR/CHANGELOG 不约束)
30
+ enforcement: warn
31
+ trigger: response.target == 'chat' AND user.requested_emoji == false
32
+ check_method: regex
33
+ # regex /\p{Emoji_Presentation}/u; 命中 + trigger fires → warn
34
+
35
+ - id: no-em-dash
36
+ description: 禁用 em-dash (—— / —);替代:补充用括号/冒号,并列用顿号,转折单独成句
37
+ enforcement: auto-fix
38
+ trigger: response.target == 'chat'
39
+ check_method: regex
40
+ auto_fix_cmd: 'replace-em-dash'
41
+ # auto-replace '——' → ', ' (单段内逗号);'—' → ':' OR ','
42
+
43
+ - id: precise-quantifier
44
+ description: 量词精确,能给具体数字/文件名/行号/commit hash 就不用"一些/几个/多个"
45
+ enforcement: info
46
+ trigger: always-on
47
+ check_method: llm-judge
48
+
49
+ - id: no-end-recap
50
+ description: 不做结尾总结,除非用户明确要求"汇总/recap"
51
+ enforcement: warn
52
+ trigger: response.target == 'chat'
53
+ check_method: heuristic
54
+ # heuristic — 末尾 200 char 含 '## 总结' / '## Summary' / 'In summary' / '综上所述'
55
+ # → warn 'redundant end recap'
56
+
57
+ - id: no-empty-continuation-question
58
+ description: 禁空洞续作询问 (要不要我帮你 X?/还需要别的吗?);保留工作流必要下一步指引
59
+ enforcement: warn
60
+ trigger: response.target == 'chat'
61
+ check_method: regex
62
+ # regex /要不要|还需要别的|希望对你有帮助/ + trigger fires → warn
@@ -20,8 +20,8 @@ priority_hierarchy:
20
20
  rules:
21
21
  - id: multi-capability-arbitration
22
22
  description: |
23
- capability fires_when 同时 true → priority_hierarchy order 选最高
24
- e.g., gstack /office-hours + GSD /gsd-discuss-phase fire → gstack 先跑
23
+ Multiple capabilities fires_when true at once pick the highest by priority_hierarchy order
24
+ e.g., gstack /office-hours + GSD /gsd-discuss-phase fire together → gstack runs first
25
25
  enforcement: warn
26
26
  trigger: capabilities.fired_count > 1
27
27
  check_method: heuristic