harnessed 4.32.22 → 4.36.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 (99) hide show
  1. package/README.md +6 -6
  2. package/bin/harnessed-inject-state.mjs +16 -0
  3. package/dist/cli.mjs +1201 -235
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/index.mjs +1 -1
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/schemas/index.mjs.map +1 -1
  8. package/manifests/optional/doc-discipline-gate.yaml +54 -0
  9. package/messages/en.json +8 -0
  10. package/messages/zh-Hans.json +8 -0
  11. package/package.json +1 -1
  12. package/routing/decision_rules.yaml +1 -1
  13. package/workflows/README.md +1 -1
  14. package/workflows/auto/SKILL.md +13 -9
  15. package/workflows/auto/SKILL.zh-Hans.md +13 -9
  16. package/workflows/capabilities.yaml +94 -39
  17. package/workflows/defaults.yaml +8 -2
  18. package/workflows/disciplines/karpathy.yaml +29 -0
  19. package/workflows/disciplines/karpathy.zh-Hans.yaml +27 -0
  20. package/workflows/disciplines/language.yaml +15 -10
  21. package/workflows/disciplines/operational.yaml +1 -1
  22. package/workflows/disciplines/operational.zh-Hans.yaml +1 -1
  23. package/workflows/disciplines/output-style.yaml +10 -2
  24. package/workflows/disciplines/output-style.zh-Hans.yaml +10 -2
  25. package/workflows/disciplines/priority.yaml +15 -2
  26. package/workflows/disciplines/priority.zh-Hans.yaml +15 -2
  27. package/workflows/discuss/auto/SKILL.md +4 -4
  28. package/workflows/discuss/auto/SKILL.zh-Hans.md +4 -4
  29. package/workflows/discuss/auto/workflow.yaml +16 -3
  30. package/workflows/discuss/phase/SKILL.md +1 -1
  31. package/workflows/discuss/phase/SKILL.zh-Hans.md +1 -1
  32. package/workflows/discuss/strategic/SKILL.md +1 -1
  33. package/workflows/discuss/strategic/SKILL.zh-Hans.md +1 -1
  34. package/workflows/discuss/subtask/SKILL.md +1 -1
  35. package/workflows/discuss/subtask/SKILL.zh-Hans.md +1 -1
  36. package/workflows/judgments/parallelism-gate.yaml +11 -6
  37. package/workflows/judgments/phase-gate.yaml +5 -1
  38. package/workflows/judgments/stage-routing.yaml +21 -26
  39. package/workflows/judgments/strategic-gate.yaml +30 -0
  40. package/workflows/judgments/user-overrides.yaml +7 -3
  41. package/workflows/judgments/web-testing-routing.yaml +19 -7
  42. package/workflows/plan/architecture/SKILL.md +7 -3
  43. package/workflows/plan/architecture/SKILL.zh-Hans.md +7 -3
  44. package/workflows/plan/auto/SKILL.md +11 -7
  45. package/workflows/plan/auto/SKILL.zh-Hans.md +11 -7
  46. package/workflows/plan/phase/SKILL.md +7 -3
  47. package/workflows/plan/phase/SKILL.zh-Hans.md +7 -3
  48. package/workflows/research/SKILL.md +24 -9
  49. package/workflows/research/SKILL.zh-Hans.md +23 -9
  50. package/workflows/research/workflow.yaml +43 -3
  51. package/workflows/retro/SKILL.md +7 -3
  52. package/workflows/retro/SKILL.zh-Hans.md +7 -3
  53. package/workflows/role-prompts.yaml +28 -21
  54. package/workflows/role-prompts.zh-Hans.yaml +22 -17
  55. package/workflows/ship/auto/SKILL.md +11 -7
  56. package/workflows/ship/auto/SKILL.zh-Hans.md +11 -7
  57. package/workflows/ship/preflight/SKILL.md +7 -3
  58. package/workflows/ship/preflight/SKILL.zh-Hans.md +7 -3
  59. package/workflows/task/auto/SKILL.md +26 -16
  60. package/workflows/task/auto/SKILL.zh-Hans.md +26 -16
  61. package/workflows/task/auto/workflow.yaml +11 -4
  62. package/workflows/task/clarify/SKILL.md +1 -1
  63. package/workflows/task/clarify/SKILL.zh-Hans.md +1 -1
  64. package/workflows/task/code/SKILL.md +7 -3
  65. package/workflows/task/code/SKILL.zh-Hans.md +7 -3
  66. package/workflows/task/deliver/SKILL.md +53 -35
  67. package/workflows/task/deliver/SKILL.zh-Hans.md +54 -36
  68. package/workflows/task/deliver/workflow.yaml +32 -24
  69. package/workflows/task/test/SKILL.md +7 -3
  70. package/workflows/task/test/SKILL.zh-Hans.md +7 -3
  71. package/workflows/task/test/workflow.yaml +13 -0
  72. package/workflows/verify/auto/SKILL.md +12 -8
  73. package/workflows/verify/auto/SKILL.zh-Hans.md +12 -8
  74. package/workflows/verify/auto/workflow.yaml +3 -1
  75. package/workflows/verify/code-review/SKILL.md +7 -3
  76. package/workflows/verify/code-review/SKILL.zh-Hans.md +7 -3
  77. package/workflows/verify/design/SKILL.md +24 -10
  78. package/workflows/verify/design/SKILL.zh-Hans.md +24 -10
  79. package/workflows/verify/design/workflow.yaml +36 -7
  80. package/workflows/verify/eval-review/SKILL.md +7 -3
  81. package/workflows/verify/eval-review/SKILL.zh-Hans.md +7 -3
  82. package/workflows/verify/multispec/SKILL.md +17 -10
  83. package/workflows/verify/multispec/SKILL.zh-Hans.md +16 -10
  84. package/workflows/verify/multispec/workflow.yaml +7 -5
  85. package/workflows/verify/paranoid/SKILL.md +7 -3
  86. package/workflows/verify/paranoid/SKILL.zh-Hans.md +7 -3
  87. package/workflows/verify/progress/SKILL.md +7 -3
  88. package/workflows/verify/progress/SKILL.zh-Hans.md +7 -3
  89. package/workflows/verify/qa/SKILL.md +33 -14
  90. package/workflows/verify/qa/SKILL.zh-Hans.md +33 -14
  91. package/workflows/verify/qa/workflow.yaml +55 -2
  92. package/workflows/verify/security/SKILL.md +7 -3
  93. package/workflows/verify/security/SKILL.zh-Hans.md +7 -3
  94. package/workflows/verify/simplify/SKILL.md +7 -3
  95. package/workflows/verify/simplify/SKILL.zh-Hans.md +7 -3
  96. package/workflows/verify/validate-phase/SKILL.md +7 -3
  97. package/workflows/verify/validate-phase/SKILL.zh-Hans.md +7 -3
  98. package/manifests/skill-packs/karpathy-skills.yaml +0 -65
  99. package/manifests/tools/ralph-loop.yaml +0 -46
@@ -24,7 +24,8 @@
24
24
  # gstack-design-review
25
25
  # 4. 核心 capability 4 — tdd (D-13 alias) / planning-with-files (D-15 +
26
26
  # Q-AUDIT-5a claude-code-plugin reframe) /
27
- # ralph-loop (D-10) / superpowers-brainstorming
27
+ # completion-gate (4.36.0 内置化,原 D-10
28
+ # ralph-loop 上游 plugin) / superpowers-brainstorming
28
29
  # 5. Agent Teams 3 (D-11 + Q-AUDIT-5b) — agent-teams-create / agent-teams-send-message /
29
30
  # agent-teams-shutdown
30
31
  schema_version: harnessed.capabilities.v1
@@ -137,12 +138,24 @@ capabilities:
137
138
  category: tool-slash-cmd
138
139
  description: verify-work parallel fan-out (multi-agent high-confidence findings)
139
140
  # ADR-0034 Finding 1 — ECC per-language reviewers收编 as verify-dimension aliases
140
- # (NOT a parallel Bucket 11 entry; runtime/priority.yaml picks the language-matching
141
- # one → single fire, no triple-review). Opt-in: no-op when ECC absent.
141
+ # (NOT parallel Bucket 11 entries — those would triple-fire in verify).
142
+ # 4.32.23 — the selection mechanism is now REAL and prose-level: `harnessed
143
+ # prompt` renders this alias list into the subagent's `## Tools` section with
144
+ # a single-fire + fallback instruction (src/cli/prompt.ts buildToolsSection),
145
+ # and the model matches the diff's language itself. (The pre-4.32.23 comment
146
+ # here promised a `runtime/priority.yaml` arbiter that never existed.)
147
+ # 4.32.23 — names corrected to the UPSTREAM AGENT FACE (ECC 2.1.0 实拉):
148
+ # `ecc:<lang>-review` is a thin COMMAND shell whose body just invokes the
149
+ # `<lang>-reviewer` agent, and the command face has coverage holes
150
+ # (no typescript/java/swift/php/csharp/fsharp) while the agent face covers
151
+ # 11 languages uniformly. Build-resolvers have NO command face at all, so the
152
+ # agent face is also the only way to keep review/build consistent.
153
+ # BONUS TIER: no-op when ECC absent — base `/code-review` is the chain tail.
142
154
  aliases:
143
- - { impl: ecc, cmd: "ecc:python-review" }
144
- - { impl: ecc, cmd: "ecc:rust-review" }
145
- - { impl: ecc, cmd: "ecc:go-review" }
155
+ - { impl: ecc, cmd: "ecc:python-reviewer" }
156
+ - { impl: ecc, cmd: "ecc:rust-reviewer" }
157
+ - { impl: ecc, cmd: "ecc:go-reviewer" }
158
+ - { impl: ecc, cmd: "ecc:typescript-reviewer" }
146
159
  fires_when:
147
160
  - phase.stage == 'verify'
148
161
 
@@ -332,16 +345,21 @@ capabilities:
332
345
  category: tool-slash-cmd
333
346
  description: GSD systematic debugging (overlap with mattpocock /diagnosing-bugs + superpowers systematic-debugging — alias)
334
347
  # ADR-0034 Finding 1 — ECC per-language build-resolvers收编 as debug/verify-dimension
335
- # aliases (build-failure fix; runtime picks language-matching one). Opt-in: no-op
336
- # when ECC absent.
348
+ # aliases (build-failure fix). Selection is prose-level per 4.32.23 (see the
349
+ # code-review entry above). Opt-in: no-op when ECC absent.
350
+ # 4.32.23 — the three ecc names below were WRONG: `ecc:rust-build` /
351
+ # `ecc:go-build` / `ecc:build-fix` do not exist upstream (ECC 2.1.0 实拉).
352
+ # Real agent names are `<lang>-build-resolver`, plus the generic
353
+ # `build-error-resolver` (build/TypeScript). Upstream has NO
354
+ # python-build-resolver (django/pytorch resolvers split that role).
337
355
  aliases:
338
356
  # v4.16.3 — 上游改名 diagnose → diagnosing-bugs
339
357
  - { impl: mattpocock-skills, cmd: /diagnosing-bugs }
340
358
  # v13.0 P43 — superpowers-native debug alias (双 impl 备选, sister tdd superpowers主/mattpocock备)
341
359
  - { impl: superpowers, cmd: "superpowers:systematic-debugging" }
342
- - { impl: ecc, cmd: "ecc:rust-build" }
343
- - { impl: ecc, cmd: "ecc:go-build" }
344
- - { impl: ecc, cmd: "ecc:build-fix" }
360
+ - { impl: ecc, cmd: "ecc:rust-build-resolver" }
361
+ - { impl: ecc, cmd: "ecc:go-build-resolver" }
362
+ - { impl: ecc, cmd: "ecc:build-error-resolver" }
345
363
  fires_when:
346
364
  - subtask.type == 'debug'
347
365
 
@@ -504,21 +522,23 @@ capabilities:
504
522
  fires_when:
505
523
  - phase.stage == 'plan' AND phase.requires_persisted_plan == true
506
524
 
507
- # D-10: ralph-loop 真接 SDK wrapper (NOT mock reference; sister Phase 2.2 v0.2.0 ship)
508
- # v3.4.2: ralph-loop is a claude-plugins-official plugin; cmd is the bare `/ralph-loop`
509
- # (verified: ralph-loop@claude-plugins-official in installed_plugins.json).
510
- # v4.15.0 (ADR 0036 amends D-10 interactive surface): 三级偏好链 — plugin 优先
511
- # (fail-closed verbatim match + 硬 max-iterations) → 未装时 native `/goal` gate
512
- # (CC 2.1.139+ / Codex 双平台内置) → self-loop 兜底。链条语义由各 workflow SKILL.md
513
- # 指令文本承载(不加 schema 字段);SDK 路径 ralphLoopWrap 不参与该链。
514
- ralph-loop:
515
- impl: plugin
516
- install_type: plugin
517
- plugin_id: ralph-loop
518
- cmd: /ralph-loop
519
- since: v2.0
520
- category: tool-bundled-skill
521
- description: Sub-task completion gate (plugin preferred; native /goal fallback on CC 2.1.139+ & Codex; self-loop last resort)
525
+ # 完成保证 (原 D-10 `ralph-loop`) — 4.35.0 起完全内置,4.36.0 摘除上游 plugin 依赖。
526
+ # 交互面 = harnessed 自己的 CLI,不再是 slash command:
527
+ # `harnessed checkpoint complete <sub> --result-file <path>` — 对 declared evidence
528
+ # artifacts / TDD boundary (src/checkpoint/tddBoundary.ts) / verbatim completion
529
+ # promise (src/checkpoint/completionClaim.ts) 三者 fail-closed。
530
+ # `harnessed checkpoint fail <sub> --failing-tests <n>` — 记一次 attempt 并在到达停机
531
+ # 条件时打印 BUDGET-EXHAUSTED (budget.ts) / NO-PROGRESS (progress.ts) / BREAK-LOOP
532
+ # (breakLoop.ts)。这三条停机理由 == 上游 `/ralph-loop --max-iterations
533
+ # --completion-promise` 曾提供的全部语义,且没有"装没装 plugin"这个可用性问题。
534
+ # SDK 路径 (src/workflow/lib/ralphLoop.ts ralphLoopWrap 硬上界) 是 harnessed 自有代码,
535
+ # 与上游 plugin 无关,保留不动;completionClaim.ts 复用其 isComplete。
536
+ completion-gate:
537
+ impl: harnessed-bundled
538
+ cmd: harnessed checkpoint complete
539
+ since: v4.36
540
+ category: tool-cli
541
+ description: 子任务完成保证 (fail-closed evidence + TDD boundary + verbatim COMPLETE; `checkpoint fail` 出 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP)
522
542
  sdk_ref: src/workflow/lib/ralphLoop.ts
523
543
  fires_when:
524
544
  - subtask.completion_required == true
@@ -537,7 +557,7 @@ capabilities:
537
557
 
538
558
  # v13.0 P42 (upstream re-sync) — superpowers task 级 per-claim 证据门 (evidence before
539
559
  # claims): 子任务声明 done/fixed/passing 前强制跑验证命令并贴 output。Pairs with
540
- # ralph-loop COMPLETE + karpathy 完成=验收通过 (sister CLAUDE.md 子任务交付铁律)。
560
+ # completion-gate COMPLETE + karpathy 完成=验收通过 (sister CLAUDE.md 子任务交付铁律)。
541
561
  verification-before-completion:
542
562
  impl: superpowers
543
563
  cmd: "superpowers:verification-before-completion"
@@ -549,12 +569,28 @@ capabilities:
549
569
 
550
570
  # ============================================================================
551
571
  # Bucket 5 — Agent Teams 3 升级触发 (per D-11 + Q-AUDIT-5b schema fix +
552
- # bundled Agent Teams prerequisite: CC 2.1.133+ + env var)
572
+ # bundled Agent Teams prerequisite: CC 2.1.178+ + env var)
553
573
  # ============================================================================
554
574
  #
555
575
  # Q-AUDIT-5b 2026-05-20 fix: settings_env_var root-level `env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`
556
576
  # (NOT nested experimental.* — Wave A 本地 settings.json 实证修正 prior schema 错误)。
557
- # Per Q-AUDIT-2 D-11: harnessed doctor + setup 检查 env var present + cc_version ≥2.1.133。
577
+ # Per Q-AUDIT-2 D-11: harnessed doctor + setup 检查 env var present + cc_version ≥2.1.178。
578
+ #
579
+ # 2026-07-30 UPSTREAM API MIGRATION (code.claude.com/docs/en/agent-teams, CC v2.1.178):
580
+ # `TeamCreate` / `TeamDelete` 两个工具**已被上游删除**("Both tools no longer exist")。
581
+ # 新机制:
582
+ # - 建团:无建团步骤、无建团工具。设好 env var 后**第一个 spawn 出来的 teammate 即隐式成团**,
583
+ # 主 session = lead。`Agent` 工具的 `team_name` 入参"accepted but ignored"(团名由 session
584
+ # 派生 `session-<sessionId 前 8 位>`)。
585
+ # - 关闭:lead **按名**请求 teammate shut down;teammate 可 approve 优雅退出 / reject 带理由。
586
+ # - 清理:"cleaned up automatically when the session ends, so there's no separate cleanup step"。
587
+ # - 一 session 一团;无嵌套团队(teammate 不能再 spawn teammate)。
588
+ # 因此本 bucket 的 `cmd` 不再是"工具名":create = 一种 spawn 调用形态,shutdown = 一句按名请求。
589
+ #
590
+ # `requires.cc_version` 是 free-form String(src/workflow/schema/capabilities.ts L25),
591
+ # 目前**没有任何 consumer 解析它** —— 它是给人/模型读的声明。旧路径(2.1.133 ≤ v < 2.1.178,
592
+ # 走已删除的 TeamCreate/TeamDelete)harnessed 不再支持,故这里只声明新下界 `>=2.1.178`,
593
+ # 不写区间(区间会暗示存在双路径 dispatch,而引擎里并不存在)。
558
594
  #
559
595
  # 5 fires_when OR-chain (multi-select; Agent Teams upgrade triggers):
560
596
  # 1. teammate_send_message_needed — teammate 间需 SendMessage 互通 (NOT fire-and-forget)
@@ -564,13 +600,16 @@ capabilities:
564
600
  # 5. fullstack_three_way — 全栈三路协同 (前端 + 后端 + 测试同步 + API contract)
565
601
  agent-teams-create:
566
602
  impl: claude-platform
567
- cmd: TeamCreate
603
+ cmd: 'Agent(name, run_in_background=true)'
568
604
  since: v2.0
569
605
  category: agent-platform
570
- description: Agent Teams team 创建 (CC 2.1.133+ experimental)
606
+ description: >-
607
+ Agent Teams 成团 = 直接 spawn 后台 teammate,团在 first teammate spawn 时隐式形成
608
+ (implicit — CC 2.1.178+ 删除了 TeamCreate,无建团步骤);主 session = lead。
609
+ `team_name` 入参被接受但忽略(团名由 session 派生)。一 session 一团、无嵌套团队。
571
610
  requires:
572
611
  settings_env_var: env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS == "1"
573
- cc_version: ">=2.1.133"
612
+ cc_version: ">=2.1.178"
574
613
  fires_when:
575
614
  - teammate_send_message_needed == true
576
615
  - subagent_context_overflow == true
@@ -583,20 +622,26 @@ capabilities:
583
622
  cmd: SendMessage
584
623
  since: v2.0
585
624
  category: agent-platform
586
- description: Agent Teams teammate 间通信 (round-trip 已验证 2026-05-19)
625
+ description: >-
626
+ Agent Teams teammate 间通信 (round-trip 已验证 2026-05-19)。工具本身早于 2.1.178 即存在,
627
+ 但 harnessed 只支持 2.1.178+ 的隐式成团路径,故与 bucket 同下界;无广播,每个 recipient 单发。
587
628
  requires:
588
629
  settings_env_var: env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS == "1"
589
- cc_version: ">=2.1.133"
630
+ cc_version: ">=2.1.178"
590
631
 
591
632
  agent-teams-shutdown:
592
633
  impl: claude-platform
593
- cmd: TeamDelete
634
+ cmd: 'ask the <teammate-name> teammate to shut down'
594
635
  since: v2.0
595
636
  category: agent-platform
596
- description: Agent Teams cleanup (shutdown_request 之后 TeamDelete; mandatory cleanup discipline)
637
+ description: >-
638
+ Agent Teams 关闭 = lead 按名请求 teammate shut down(不是工具调用 —— CC 2.1.178+ 删除了
639
+ TeamDelete,无等价工具);teammate 可 approve 优雅退出 / reject 带理由,且会先做完当前
640
+ tool call。团的共享目录在 session 退出时自动清理,无独立 cleanup 步骤 —— 剩下的纪律是
641
+ 「别把 teammate 落在运行态」(未关闭的 teammate 持续烧 token、可能挂起宿主)。
597
642
  requires:
598
643
  settings_env_var: env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS == "1"
599
- cc_version: ">=2.1.133"
644
+ cc_version: ">=2.1.178"
600
645
 
601
646
  # ============================================================================
602
647
  # Bucket 6 — L0 Discipline Substrate behavioral ref (D-09 NEW v3, 6 entry)
@@ -612,7 +657,17 @@ capabilities:
612
657
  cmd: '<not-applicable-behavioral>'
613
658
  since: v2.0
614
659
  category: behavioral
615
- description: 4 心法 + ≤200L hard limit + no-feature-creep + trust-internal-code + no-comments-default
660
+ # T2.7 (4.34.x) — description reconciles 1:1 with the rule ids in the
661
+ # discipline_ref file, and tests/workflow/karpathy-discipline.test.ts locks
662
+ # that reconciliation. The pre-T2.7 text advertised `trust-internal-code` +
663
+ # `no-comments-default` with no rule behind them; keep the `<N> rules: <id> /
664
+ # <id> / ...` suffix shape when editing or the guard fails.
665
+ description: >-
666
+ Bundled karpathy coding discipline, applied by every workflow via
667
+ disciplines_applied (no upstream plugin required) — 7 rules:
668
+ think-before-coding / simplicity-first / surgical-changes /
669
+ goal-driven-execution / file-length-200-hard-limit / trust-internal-code /
670
+ no-comments-default
616
671
  discipline_ref: workflows/disciplines/karpathy.yaml
617
672
 
618
673
  output-style-discipline:
@@ -1212,7 +1267,7 @@ capabilities:
1212
1267
  # at ~/.claude/skills/<skill_dir>/ (2026-06-09).
1213
1268
  #
1214
1269
  # KEYSTONE: gsd-execute-phase is deliberately NOT wired — the execute mechanism stays
1215
- # harnessed self-owned (CC-native spawn + ralph-loop + v4.2 checkpoint ledger).
1270
+ # harnessed self-owned (CC-native spawn + completion-gate + v4.2 checkpoint ledger).
1216
1271
  #
1217
1272
  # 4 design-contract phase skills (spec/ui/secure/ai-integration) pair with sister
1218
1273
  # judgments triggers in workflows/judgments/stage-phase-gate.yaml.
@@ -1,13 +1,19 @@
1
1
  # harnessed v3.0 workflow defaults
2
2
  # Phase v2.0-2.3 W1.2 ship — ralph_max_iterations table per R20.10 + D-10 fallback abort path
3
+ # (legacy key name retained on purpose — see the note above the table below)
3
4
  # Phase v3.0-3.4 W2.2 extend — 18 v3 sub-workflow + retro standalone × phase entries
4
5
  # Sister Phase 2.2 STRIDE T-2.2-05 DoS mitigation: hard_upper_limit = 100 caps any user override
5
6
  # Phase 2.4 workflow.yaml v2 interpolation: {{ defaults.ralph_max_iterations.<workflow>.<phase> }}
6
7
 
7
8
  schema_version: harnessed.defaults.v1
8
9
 
9
- # Per-workflow per-phase ralph-loop iteration ceiling
10
- # Values balance: completion guarantee vs DoS prevention; sister ADR 0011 v0.2.0 ralph-loop SDK pattern
10
+ # Per-workflow per-phase attempt ceiling (completion guarantee vs DoS prevention;
11
+ # sister ADR 0011 SDK pattern)
12
+ # 4.36.0 — the upstream ralph-loop plugin dependency is gone, but this key keeps its
13
+ # LEGACY NAME deliberately: it is read by exact string in src/checkpoint/budget.ts
14
+ # (resolveAttemptBudget) and interpolated by name from workflow yaml
15
+ # (`{{ defaults.ralph_max_iterations.<workflow>.<phase> }}`). A rename buys nothing
16
+ # user-visible and risks a silent lookup miss. Do NOT rename.
11
17
  ralph_max_iterations:
12
18
  # v3 standalone (research v3 schema bump + retro NEW per Phase 3.4 W1.1+W1.2)
13
19
  research:
@@ -45,3 +45,32 @@ rules:
45
45
  check_method: external-cmd
46
46
  auto_fix_cmd: 'wc -l <file> | awk ''{if ($1>200) exit 1}'''
47
47
  # 实装 split helper pattern (sister fallbackHandlers.ts / sdkReconcile.ts ≤80L)
48
+
49
+ # ── T2.7 (4.34.x) — the 2 rules the `karpathy-guidelines` capability description
50
+ # had been claiming since v2.0 without a rule behind them. Added as the
51
+ # precondition for dropping the upstream `karpathy-skills` plugin: the plugin
52
+ # was already redundant (0 call sites), but摘除 without these two would have
53
+ # silently dropped the ideas. Both are judgment calls with no deterministic
54
+ # check → `warn`, never `halt`.
55
+
56
+ - id: trust-internal-code
57
+ description: Trust internal code — validate at the trust boundary (external input, parsed config, user data), not at every internal layer; do not add defensive re-checks or redundant assertions on call sites you control
58
+ enforcement: warn
59
+ trigger: subtask.type == 'code-write'
60
+ check_method: heuristic
61
+ # sister role-prompts.yaml task-code checklist "Trust internal code: don't
62
+ # re-validate already-checked inputs at every layer"
63
+
64
+ - id: no-comments-default
65
+ description: Comments explain WHY, not WHAT — delete comments that restate the code or that have drifted out of sync with it; a comment must add context the code cannot carry (rationale, constraint, upstream reference)
66
+ enforcement: warn
67
+ trigger: subtask.type == 'code-write'
68
+ check_method: llm-judge
69
+ # check_method='llm-judge' — sister simplicity-first: verify phase 的
70
+ # code-simplifier review 承接 (role-prompts.yaml verify-simplify checklist
71
+ # "Comments that lie or duplicate the code → delete").
72
+ #
73
+ # 上游 karpathy 原条是「默认不写注释」,这里 REWRITE 不照搬 (T2.7 OQ3 裁决):
74
+ # 照搬会与本仓的高注释密度基线冲突,更会伤到 bundled 资产 —— 普通用户没有作者
75
+ # 本机那份 ~/.claude/CLAUDE.md,yaml / SKILL 里的注释是他们理解这些资产的唯一
76
+ # 途径。所以规则约束的是注释的「质量」(why 而非 what),不是注释的「有无」。
@@ -45,3 +45,30 @@ rules:
45
45
  check_method: external-cmd
46
46
  auto_fix_cmd: 'wc -l <file> | awk ''{if ($1>200) exit 1}'''
47
47
  # 实装 split helper pattern (sister fallbackHandlers.ts / sdkReconcile.ts ≤80L)
48
+
49
+ # ── T2.7 (4.34.x) — capability description 自 v2.0 起就在声称、但一直没有规则
50
+ # 落地的两条。补齐是摘除上游 `karpathy-skills` plugin 的前置:plugin 本身早已
51
+ # 冗余(仓内 0 处调用),但不补这两条就摘,等于静默丢掉这两个思想。
52
+ # 两条都是判断题、无确定性检查 → `warn`,不给 `halt`。
53
+
54
+ - id: trust-internal-code
55
+ description: 信任内部代码 —— 只在信任边界(外部输入 / 解析后的配置 / 用户数据)做校验,不在每一层内部调用上重复防御;不给自己控制的调用点加冗余断言
56
+ enforcement: warn
57
+ trigger: subtask.type == 'code-write'
58
+ check_method: heuristic
59
+ # sister role-prompts.zh-Hans.yaml task-code checklist「信任内部代码:不在每层
60
+ # 重复校验已经检查过的输入」
61
+
62
+ - id: no-comments-default
63
+ description: 注释解释 WHY 不解释 WHAT —— 删掉复述代码的注释、以及已经与代码脱节的注释;一条注释必须补上代码本身承载不了的信息(设计理由 / 约束 / 上游出处)
64
+ enforcement: warn
65
+ trigger: subtask.type == 'code-write'
66
+ check_method: llm-judge
67
+ # check_method='llm-judge' — sister simplicity-first:由 verify 阶段的
68
+ # code-simplifier review 承接(role-prompts.zh-Hans.yaml verify-simplify
69
+ # checklist「撒谎或重复代码的注释 → 删」)。
70
+ #
71
+ # 上游 karpathy 原条是「默认不写注释」,这里 REWRITE 不照搬(T2.7 OQ3 裁决):
72
+ # 照搬会与本仓的高注释密度基线冲突,更会伤到 bundled 资产 —— 普通用户没有作者
73
+ # 本机那份 ~/.claude/CLAUDE.md,yaml / SKILL 里的注释是他们理解这些资产的唯一
74
+ # 途径。所以规则约束的是注释的「质量」(why 而非 what),不是注释的「有无」。
@@ -22,20 +22,25 @@ rules:
22
22
  trigger: every Claude response
23
23
  check_method: read env.HARNESSED_USER_LANG, validate output lang matches
24
24
 
25
+ # The 8 categories are DATA, not a comment: src/cli/prompt.ts buildLanguageSection
26
+ # parses the numbered lines below and renders them into the spawn prompt's
27
+ # `## Language` section. Keep one category per numbered line (`N. <sentence>`),
28
+ # language-agnostic (they apply to any env.HARNESSED_USER_LANG).
25
29
  - id: preserve-english-categories
26
- description: 8 类强制保留英文原文,不翻译不音译 (语言无关 — 任何 user_lang 都适用)
30
+ description: |-
31
+ 8 categories always stay in their original English form — never translate,
32
+ transliterate, or rewrite them:
33
+ 1. Code, commands, shell snippets, config file contents, regex, SQL
34
+ 2. File / directory / path names (e.g. `src/components/Button.tsx`, `.planning/STATE.md`)
35
+ 3. Tool / framework / library / product / company names (e.g. Claude Code, GSD, subagent, React, Anthropic)
36
+ 4. API / function / class / variable / field names, env vars, config keys (e.g. `buildAgentDef`, `HARNESSED_USER_LANG`)
37
+ 5. Error messages, stack traces, log output
38
+ 6. URLs, commit hashes, issue / PR numbers, version numbers, git refs
39
+ 7. Industry abbreviations and standard terms (TDD, CRUD, API, MCP, PR, CI/CD, a11y, ORM, RAG, token, context window, prompt, subagent)
40
+ 8. Quoted material — documents, errors, config examples, the user's own words — reproduced verbatim, with any explanation kept outside the quote
27
41
  enforcement: warn
28
42
  trigger: always-on
29
43
  check_method: heuristic
30
- # 8 类 (verbatim CLAUDE.md, language-agnostic):
31
- # 1. 代码/命令/shell/配置/正则/SQL / code / cmd / shell / config / regex / SQL
32
- # 2. 文件/目录/路径名 (src/components/Button.tsx 等)
33
- # 3. 工具/框架/库/产品/公司名 (Claude Code / GSD / React 等)
34
- # 4. API/函数/类/变量/字段/环境变量/配置键
35
- # 5. 错误信息/stack trace/log 输出
36
- # 6. URL / commit hash / issue / PR 编号 / 版本号 / git ref
37
- # 7. 业内固定缩写与通用术语 (TDD / CRUD / API / MCP / token 等)
38
- # 8. 引用原文 verbatim
39
44
 
40
45
  - id: cross-cultural-humor
41
46
  description: |-
@@ -36,7 +36,7 @@ rules:
36
36
  enforcement: halt
37
37
  trigger: cmd.type == 'git-push'
38
38
  check_method: external-cmd
39
- # ralph-loop / subagent 自动调 git push → halt;user explicit `git push` 在主 session 允许
39
+ # completion-gate loop / subagent 自动调 git push → halt;user explicit `git push` 在主 session 允许
40
40
 
41
41
  - id: no-skip-hooks
42
42
  description: |
@@ -36,7 +36,7 @@ rules:
36
36
  enforcement: halt
37
37
  trigger: cmd.type == 'git-push'
38
38
  check_method: external-cmd
39
- # ralph-loop / subagent 自动调 git push → halt;user explicit `git push` 在主 session 允许
39
+ # completion-gate loop / subagent 自动调 git push → halt;user explicit `git push` 在主 session 允许
40
40
 
41
41
  - id: no-skip-hooks
42
42
  description: |
@@ -9,10 +9,14 @@ enforcement_layer: output
9
9
  auto_enforce: true
10
10
 
11
11
  rules:
12
+ # Scope note (2026-07-30) — chat-scope rules carry `trigger: response.target == 'chat'`
13
+ # so src/cli/prompt.ts renders them under an explicit "chat replies ONLY" sub-block.
14
+ # `harnessed prompt` is the only channel through which a subagent receives these rules,
15
+ # so a wrong scope means the rule gets misapplied to the files the subagent authors.
12
16
  - id: bluf-conclusion-first
13
17
  description: Conclusion first (BLUF); each paragraph leads with one sentence giving the answer/judgment/recommendation, then expands the reasoning
14
18
  enforcement: warn
15
- trigger: always-on
19
+ trigger: response.target == 'chat'
16
20
  check_method: heuristic
17
21
  # heuristic — 第一句长度 ≤ 100 char + 含答案动词 ('是' / '不是' / '推荐' / '应该' / 'use X')
18
22
  # 失败 → warn 'BLUF missing: first sentence is not a conclusion'
@@ -20,7 +24,9 @@ rules:
20
24
  - id: no-sycophantic-open-close
21
25
  description: Remove opening/closing filler phrases like "good question / awesome / perfect / hope this helps / anything else"
22
26
  enforcement: auto-fix
23
- trigger: always-on
27
+ # chat-scope is load-bearing here: enforcement=auto-fix means strip-sycophantic
28
+ # rewrites text, and an unconditional trigger would let it rewrite delivered artifacts.
29
+ trigger: response.target == 'chat'
24
30
  check_method: regex
25
31
  auto_fix_cmd: 'strip-sycophantic'
26
32
  # NEW src/discipline/enforcement/strip-sycophantic.ts — regex strip 13 known phrase
@@ -40,6 +46,8 @@ rules:
40
46
  auto_fix_cmd: 'replace-em-dash'
41
47
  # auto-replace '——' → ', ' (单段内逗号);'—' → ':' OR ','
42
48
 
49
+ # Deliberately always-on (not chat-scope): project files want precise quantifiers too,
50
+ # and the rule only tightens a requirement — it never produces a wrong artifact.
43
51
  - id: precise-quantifier
44
52
  description: Precise quantifiers; when a concrete number/filename/line number/commit hash is available, do not say "some/a few/several"
45
53
  enforcement: info
@@ -9,10 +9,14 @@ enforcement_layer: output
9
9
  auto_enforce: true
10
10
 
11
11
  rules:
12
+ # scope 说明 (2026-07-30) — 对话层规则带 `trigger: response.target == 'chat'`,
13
+ # src/cli/prompt.ts 会把它们渲染到独立的 "chat replies ONLY" 子块下。
14
+ # `harnessed prompt` 是 subagent 拿到这批规则的唯一通道,scope 写错就等于让规则
15
+ # 被误用到 subagent 自己写的产物文件上。
12
16
  - id: bluf-conclusion-first
13
17
  description: 结论先行 (BLUF),每段先一句给答案/判断/推荐,再展开理由
14
18
  enforcement: warn
15
- trigger: always-on
19
+ trigger: response.target == 'chat'
16
20
  check_method: heuristic
17
21
  # heuristic — 第一句长度 ≤ 100 char + 含答案动词 ('是' / '不是' / '推荐' / '应该' / 'use X')
18
22
  # 失败 → warn 'BLUF missing: first sentence is not a conclusion'
@@ -20,7 +24,9 @@ rules:
20
24
  - id: no-sycophantic-open-close
21
25
  description: 删除"好问题/太棒了/完美/希望对你有帮助/还需要别的吗"等开场闭合套话
22
26
  enforcement: auto-fix
23
- trigger: always-on
27
+ # 这条的 chat-scope 是承重的:enforcement=auto-fix 意味着 strip-sycophantic 会真改文本,
28
+ # trigger 无条件生效就等于允许它改写已交付的产物文件文案。
29
+ trigger: response.target == 'chat'
24
30
  check_method: regex
25
31
  auto_fix_cmd: 'strip-sycophantic'
26
32
  # NEW src/discipline/enforcement/strip-sycophantic.ts — regex strip 13 known phrase
@@ -40,6 +46,8 @@ rules:
40
46
  auto_fix_cmd: 'replace-em-dash'
41
47
  # auto-replace '——' → ', ' (单段内逗号);'—' → ':' OR ','
42
48
 
49
+ # 故意保持 always-on (不改 chat-scope):产物文件也该用精确量词,
50
+ # 且这条只是把要求收紧,不会主动产生错误产物。
43
51
  - id: precise-quantifier
44
52
  description: 量词精确,能给具体数字/文件名/行号/commit hash 就不用"一些/几个/多个"
45
53
  enforcement: info
@@ -14,8 +14,21 @@ priority_hierarchy:
14
14
  - superpowers # 子任务执行质量
15
15
  - planning-with-files # 计划持久化
16
16
  - karpathy # 编码行为
17
- - mattpocock # 招式 by-demand
18
- - parallel # subagent / Agent Teams / ralph-loop 执行机制
17
+ # `mattpocock` = 「按需召唤的招式」层的落位 (/grill-with-docs、/diagnosing-bugs、
18
+ # /to-spec、/to-tickets、/tdd、/improve-codebase-architecture 等),排在 karpathy 与
19
+ # parallel 之间。
20
+ #
21
+ # 它 NOT 属于方法论优先级句原文的 6 tier
22
+ # (gstack > GSD > superpowers > planning-with-files > andrej-karpathy-skills >
23
+ # 子任务并行机制) —— 那句话不是穷举式 tier 定义,招式层需要一个显式 rank 才能
24
+ # 参与 before-spawn 仲裁。
25
+ #
26
+ # 请勿当作「偏差」删除:删掉后这批招式 capability 会 fall through 到
27
+ # MAX_SAFE_INTEGER rank,排到 parallel 之下变成全局最低优先。而
28
+ # workflows/discuss/subtask/workflow.yaml 与 workflows/task/code/workflow.yaml
29
+ # 真在消费同 tier 并发。
30
+ - mattpocock # 招式 by-demand (rationale 见上方注释)
31
+ - parallel # subagent / Agent Teams 执行机制 (完成保证是正交 wrapper, 见 judgments/parallelism-gate.yaml completion-gate-wrapper.wraps)
19
32
 
20
33
  rules:
21
34
  - id: multi-capability-arbitration
@@ -14,8 +14,21 @@ priority_hierarchy:
14
14
  - superpowers # 子任务执行质量
15
15
  - planning-with-files # 计划持久化
16
16
  - karpathy # 编码行为
17
- - mattpocock # 招式 by-demand
18
- - parallel # subagent / Agent Teams / ralph-loop 执行机制
17
+ # `mattpocock` = 「按需召唤的招式」层的落位 (/grill-with-docs、/diagnosing-bugs、
18
+ # /to-spec、/to-tickets、/tdd、/improve-codebase-architecture 等),排在 karpathy 与
19
+ # parallel 之间。
20
+ #
21
+ # 它 NOT 属于方法论优先级句原文的 6 tier
22
+ # (gstack > GSD > superpowers > planning-with-files > andrej-karpathy-skills >
23
+ # 子任务并行机制) —— 那句话不是穷举式 tier 定义,招式层需要一个显式 rank 才能
24
+ # 参与 before-spawn 仲裁。
25
+ #
26
+ # 请勿当作「偏差」删除:删掉后这批招式 capability 会 fall through 到
27
+ # MAX_SAFE_INTEGER rank,排到 parallel 之下变成全局最低优先。而
28
+ # workflows/discuss/subtask/workflow.yaml 与 workflows/task/code/workflow.yaml
29
+ # 真在消费同 tier 并发。
30
+ - mattpocock # 招式 by-demand (rationale 见上方注释)
31
+ - parallel # subagent / Agent Teams 执行机制 (完成保证是正交 wrapper, 见 judgments/parallelism-gate.yaml completion-gate-wrapper.wraps)
19
32
 
20
33
  rules:
21
34
  - id: multi-capability-arbitration
@@ -24,9 +24,9 @@ trigger_phrases:
24
24
 
25
25
  | sub | gate ref | mode | when fires |
26
26
  | --- | -------- | ---- | ---------- |
27
- | `strategic` | `judgments.stage-routing.discuss-strategic-delegate.fires` | parallel | new_project / new_milestone / new_feature / is_major_release |
28
- | `phase` | `judgments.stage-routing.discuss-phase-delegate.fires` | parallel | open_decisions ≥ 2 / cross_phase_data_flow / scope_days > 1 |
29
- | `subtask` | `judgments.stage-routing.discuss-subtask-delegate.fires` | parallel | approaches ≥ 2 / core_algorithm / has_api_contract / error_cost=high |
27
+ | `strategic` | `judgments.strategic-gate.strategic-tier-delegate.fires` | parallel | new_project / new_milestone / new_feature / is_major_release |
28
+ | `phase` | `judgments.phase-gate.gsd-discuss-phase.fires` | parallel | open_decisions ≥ 2 / cross_phase_data_flow / scope_days > 1 / files_touched > 5 |
29
+ | `subtask` | `judgments.subtask-gate.brainstorming.fires` | parallel | approaches ≥ 2 / core_algorithm / has_api_contract / error_cost=high |
30
30
 
31
31
  Engine runtime spawns 3 sub-workflow phases via `runMasterOrchestrator` per
32
32
  T3.5.W0.1 (sister sub-workflow `runWorkflow` SDK pattern, parallel fan-out via
@@ -71,7 +71,7 @@ execution stages.
71
71
 
72
72
  Output: a locked spec the execution stages (`/plan` → `/task` → `/verify`) consume without further user input.
73
73
 
74
- <!-- harnessed-generated:v4.9.3 -->
74
+ <!-- harnessed-generated:v4.12.0 -->
75
75
 
76
76
  ## References
77
77
 
@@ -24,9 +24,9 @@ trigger_phrases:
24
24
 
25
25
  | 子工作流 | gate ref | mode | 触发时机 |
26
26
  | --- | -------- | ---- | ---------- |
27
- | `strategic` | `judgments.stage-routing.discuss-strategic-delegate.fires` | parallel | new_project / new_milestone / new_feature / is_major_release |
28
- | `phase` | `judgments.stage-routing.discuss-phase-delegate.fires` | parallel | open_decisions ≥ 2 / cross_phase_data_flow / scope_days > 1 |
29
- | `subtask` | `judgments.stage-routing.discuss-subtask-delegate.fires` | parallel | approaches ≥ 2 / core_algorithm / has_api_contract / error_cost=high |
27
+ | `strategic` | `judgments.strategic-gate.strategic-tier-delegate.fires` | parallel | new_project / new_milestone / new_feature / is_major_release |
28
+ | `phase` | `judgments.phase-gate.gsd-discuss-phase.fires` | parallel | open_decisions ≥ 2 / cross_phase_data_flow / scope_days > 1 / files_touched > 5 |
29
+ | `subtask` | `judgments.subtask-gate.brainstorming.fires` | parallel | approaches ≥ 2 / core_algorithm / has_api_contract / error_cost=high |
30
30
 
31
31
  引擎运行时通过 `runMasterOrchestrator` 以
32
32
  T3.5.W0.1(sister sub-workflow `runWorkflow` SDK pattern,并行 fan-out 通过
@@ -70,7 +70,7 @@ Sister `workflows/capabilities.yaml`:
70
70
 
71
71
  产出:一份 locked spec,执行阶段(`/plan` → `/task` → `/verify`)无需再问用户即可消费。
72
72
 
73
- <!-- harnessed-generated:v4.9.3 -->
73
+ <!-- harnessed-generated:v4.12.0 -->
74
74
 
75
75
  ## 参考资料
76
76
 
@@ -29,11 +29,24 @@ tools_available: [planning-with-files]
29
29
 
30
30
  delegates_to:
31
31
  - sub: strategic
32
- gate: judgments.stage-routing.discuss-strategic-delegate.fires
32
+ # Aggregate of strategic-gate's two triggers (office-hours ∪ plan-ceo-review),
33
+ # now homed in that file rather than mirrored in stage-routing.yaml. Coarse by
34
+ # design: /discuss-strategic re-gates the two independently inside the sub.
35
+ gate: judgments.strategic-gate.strategic-tier-delegate.fires
33
36
  mode: parallel
34
37
  - sub: phase
35
- gate: judgments.stage-routing.discuss-phase-delegate.fires
38
+ # Gates on the CANONICAL phase-tier trigger. It used to gate on a
39
+ # stage-routing.yaml copy of this predicate, which silently lost the
40
+ # `phase.files_touched > 5` scope arm when that arm was added here — the
41
+ # criterion existed but could not decide anything at master tier.
42
+ gate: judgments.phase-gate.gsd-discuss-phase.fires
43
+ # T2.1 D-5 — phase-gate's declared skips (single self-contained task, or a
44
+ # sub-day scope) veto the phase-tier discussion even though fires_when
45
+ # matched. This is also the first consumer of phase-gate.yaml's ❌ half,
46
+ # which had been dead configuration since Phase 2.3.
47
+ skip_gate: judgments.phase-gate.gsd-discuss-phase.skips
36
48
  mode: parallel
37
49
  - sub: subtask
38
- gate: judgments.stage-routing.discuss-subtask-delegate.fires
50
+ # Canonical subtask-tier trigger (was a verbatim stage-routing copy).
51
+ gate: judgments.subtask-gate.brainstorming.fires
39
52
  mode: parallel
@@ -67,7 +67,7 @@ execution stages.
67
67
 
68
68
  Output: a locked spec the execution stages (`/plan` → `/task` → `/verify`) consume without further user input.
69
69
 
70
- <!-- harnessed-generated:v4.9.3 -->
70
+ <!-- harnessed-generated:v4.12.0 -->
71
71
 
72
72
  ## References
73
73
 
@@ -66,7 +66,7 @@ Sister `workflows/judgments/phase-gate.yaml`:
66
66
 
67
67
  产出:一份 locked spec,执行阶段(`/plan` → `/task` → `/verify`)无需再问用户即可消费。
68
68
 
69
- <!-- harnessed-generated:v4.9.3 -->
69
+ <!-- harnessed-generated:v4.12.0 -->
70
70
 
71
71
  ## 参考资料
72
72
 
@@ -71,7 +71,7 @@ execution stages.
71
71
 
72
72
  Output: a locked spec the execution stages (`/plan` → `/task` → `/verify`) consume without further user input.
73
73
 
74
- <!-- harnessed-generated:v4.9.3 -->
74
+ <!-- harnessed-generated:v4.12.0 -->
75
75
 
76
76
  ## References
77
77
 
@@ -70,7 +70,7 @@ Sister `workflows/judgments/strategic-gate.yaml`:
70
70
 
71
71
  产出:一份 locked spec,执行阶段(`/plan` → `/task` → `/verify`)无需再问用户即可消费。
72
72
 
73
- <!-- harnessed-generated:v4.9.3 -->
73
+ <!-- harnessed-generated:v4.12.0 -->
74
74
 
75
75
  ## 参考资料
76
76
 
@@ -72,7 +72,7 @@ execution stages.
72
72
 
73
73
  Output: a locked spec the execution stages (`/plan` → `/task` → `/verify`) consume without further user input.
74
74
 
75
- <!-- harnessed-generated:v4.9.3 -->
75
+ <!-- harnessed-generated:v4.12.0 -->
76
76
 
77
77
  ## References
78
78
 
@@ -71,7 +71,7 @@ Sister `workflows/judgments/subtask-gate.yaml`:
71
71
 
72
72
  产出:一份 locked spec,执行阶段(`/plan` → `/task` → `/verify`)无需再问用户即可消费。
73
73
 
74
- <!-- harnessed-generated:v4.9.3 -->
74
+ <!-- harnessed-generated:v4.12.0 -->
75
75
 
76
76
  ## 参考资料
77
77