create-harness-vibe-coding 0.8.13 → 0.8.17

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 (133) hide show
  1. package/CHANGELOG.md +174 -0
  2. package/README-CN.md +110 -107
  3. package/README.md +93 -44
  4. package/package.json +2 -1
  5. package/src/generator.js +609 -489
  6. package/src/index.js +5 -5
  7. package/templates/common/.claude/agents/architect-manager.md +1 -0
  8. package/templates/common/.claude/agents/architect.md +2 -1
  9. package/templates/common/.claude/agents/codebase-explorer.md +1 -0
  10. package/templates/common/.claude/agents/context-master.md +2 -1
  11. package/templates/common/.claude/agents/debugger.md +1 -0
  12. package/templates/common/.claude/agents/docs-researcher.md +2 -1
  13. package/templates/common/.claude/agents/explore-manager.md +1 -0
  14. package/templates/common/.claude/agents/implement-manager.md +1 -0
  15. package/templates/common/.claude/agents/implementer.md +1 -0
  16. package/templates/common/.claude/agents/memory-master.md +2 -1
  17. package/templates/common/.claude/agents/planner.md +3 -2
  18. package/templates/common/.claude/agents/reflector.md +1 -0
  19. package/templates/common/.claude/agents/researcher.md +1 -0
  20. package/templates/common/.claude/agents/review-manager.md +1 -0
  21. package/templates/common/.claude/agents/reviewer.md +2 -1
  22. package/templates/common/.claude/agents/task-scribe.md +1 -0
  23. package/templates/common/.claude/agents/tdd-guide.md +5 -4
  24. package/templates/common/.claude/agents/test-writer.md +6 -5
  25. package/templates/common/.claude/agents/verifier.md +1 -0
  26. package/templates/common/.claude/commands/wf-auto-spark.md +16 -0
  27. package/templates/common/.claude/commands/wf-auto.md +16 -0
  28. package/templates/{optional/skills/browser-e2e/.opencode → common/.claude}/commands/wf-browser.md +3 -2
  29. package/templates/common/.claude/commands/wf-help.md +9 -5
  30. package/templates/common/.claude/commands/wf-learn.md +16 -0
  31. package/templates/common/.claude/commands/wf-max.md +20 -0
  32. package/templates/common/.claude/commands/wf-readme.md +16 -0
  33. package/templates/common/.claude/commands/wf-remove.md +16 -0
  34. package/templates/common/.claude/commands/wf-review.md +16 -0
  35. package/templates/common/.claude/commands/wf-update.md +68 -10
  36. package/templates/common/.claude/commands/wf.md +16 -0
  37. package/templates/common/.claude/rules/ecc/common.md +6 -5
  38. package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +12 -6
  39. package/templates/common/.claude/skills/tdd/SKILL.md +5 -5
  40. package/templates/common/.claude/skills/wf/SKILL.md +13 -5
  41. package/templates/common/.claude/skills/wf-agents-docs/SKILL.md +119 -0
  42. package/templates/common/.claude/skills/wf-auto/SKILL.md +27 -7
  43. package/templates/common/.claude/skills/wf-auto-spark/SKILL.md +12 -5
  44. package/templates/common/.claude/skills/wf-browser/SKILL.md +176 -0
  45. package/templates/common/.claude/skills/wf-help/SKILL.md +30 -0
  46. package/templates/common/.claude/skills/wf-learn/SKILL.md +6 -0
  47. package/templates/common/.claude/skills/wf-max/SKILL.md +43 -14
  48. package/templates/common/.claude/skills/wf-readme/SKILL.md +8 -2
  49. package/templates/common/.claude/skills/wf-remove/SKILL.md +6 -0
  50. package/templates/common/.claude/skills/wf-review/SKILL.md +10 -3
  51. package/templates/common/.claude/skills/wf-update/SKILL.md +41 -4
  52. package/templates/common/.codex/config.toml +3 -5
  53. package/templates/common/.harness-version +326 -131
  54. package/templates/common/.opencode/agents/architect-manager.md +8 -1
  55. package/templates/common/.opencode/agents/architect.md +2 -1
  56. package/templates/common/.opencode/agents/codebase-explorer.md +1 -0
  57. package/templates/common/.opencode/agents/context-master.md +2 -1
  58. package/templates/common/.opencode/agents/debugger.md +1 -0
  59. package/templates/common/.opencode/agents/docs-researcher.md +2 -1
  60. package/templates/common/.opencode/agents/explore-manager.md +11 -1
  61. package/templates/common/.opencode/agents/implement-manager.md +6 -3
  62. package/templates/common/.opencode/agents/implementer.md +1 -0
  63. package/templates/common/.opencode/agents/memory-master.md +2 -1
  64. package/templates/common/.opencode/agents/planner.md +3 -2
  65. package/templates/common/.opencode/agents/reflector.md +1 -0
  66. package/templates/common/.opencode/agents/researcher.md +1 -0
  67. package/templates/common/.opencode/agents/review-manager.md +6 -2
  68. package/templates/common/.opencode/agents/reviewer.md +2 -1
  69. package/templates/common/.opencode/agents/task-scribe.md +1 -0
  70. package/templates/common/.opencode/agents/tdd-guide.md +5 -4
  71. package/templates/common/.opencode/agents/test-writer.md +6 -5
  72. package/templates/common/.opencode/agents/verifier.md +1 -0
  73. package/templates/common/.opencode/commands/wf-auto-spark.md +3 -2
  74. package/templates/common/.opencode/commands/wf-auto.md +3 -2
  75. package/templates/common/.opencode/commands/wf-browser.md +16 -0
  76. package/templates/common/.opencode/commands/wf-help.md +9 -5
  77. package/templates/common/.opencode/commands/wf-learn.md +3 -2
  78. package/templates/common/.opencode/commands/wf-max.md +12 -6
  79. package/templates/common/.opencode/commands/wf-readme.md +3 -2
  80. package/templates/common/.opencode/commands/wf-remove.md +3 -2
  81. package/templates/common/.opencode/commands/wf-review.md +3 -2
  82. package/templates/common/.opencode/commands/wf-update.md +68 -10
  83. package/templates/common/.opencode/commands/wf.md +3 -2
  84. package/templates/common/CLAUDE.md +15 -13
  85. package/templates/common/Harness/MEMORY.md +24 -21
  86. package/templates/common/Harness/README.md +50 -47
  87. package/templates/common/Harness/ownership.manifest.json +878 -0
  88. package/templates/common/Harness/{architecture.md → project/architecture.md} +1 -1
  89. package/templates/common/Harness/research/README.md +3 -3
  90. package/templates/common/Harness/scripts/archive-tasks.mjs +12 -220
  91. package/templates/common/Harness/scripts/context-budget.mjs +95 -0
  92. package/templates/common/Harness/scripts/l2-cache-telemetry.mjs +703 -0
  93. package/templates/common/Harness/scripts/scan-clean.mjs +16 -12
  94. package/templates/common/Harness/scripts/task-state.mjs +889 -0
  95. package/templates/common/Harness/scripts/validate-harness.mjs +553 -191
  96. package/templates/common/Harness/scripts/wf-remove.mjs +61 -35
  97. package/templates/common/Harness/scripts/wf-update-check.mjs +358 -45
  98. package/templates/common/Harness/settings.json +43 -0
  99. package/templates/common/Harness/{ECC-GUIDE.md → specs/guides/ECC-GUIDE.md} +4 -4
  100. package/templates/common/Harness/{SETUP.md → specs/guides/SETUP.md} +34 -37
  101. package/templates/common/Harness/{extension.md → specs/guides/extension.md} +3 -3
  102. package/templates/common/Harness/{lifecycle.md → specs/guides/lifecycle.md} +2 -2
  103. package/templates/common/Harness/specs/protocols/TASK_ARCHIVE.md +76 -0
  104. package/templates/common/Harness/{agent-workflow.md → specs/runtime/agent-workflow.md} +6 -6
  105. package/templates/common/Harness/{context-loading.md → specs/runtime/context-loading.md} +85 -21
  106. package/templates/common/Harness/{dispatch.md → specs/runtime/dispatch.md} +4 -3
  107. package/templates/common/Harness/{subagents.md → specs/runtime/subagents.md} +19 -10
  108. package/templates/common/Harness/{WF-AUTO-SPARK.md → specs/workflows/WF-AUTO-SPARK.md} +2 -2
  109. package/templates/common/Harness/{WF-AUTO.md → specs/workflows/WF-AUTO.md} +12 -7
  110. package/templates/common/Harness/{WF-KERNEL.md → specs/workflows/WF-KERNEL.md} +11 -1
  111. package/templates/common/Harness/{WF-MAX.md → specs/workflows/WF-MAX.md} +40 -7
  112. package/templates/common/Harness/specs/workflows/WF-STATE.md +141 -0
  113. package/templates/common/Harness/{WF.md → specs/workflows/WF.md} +12 -1
  114. package/templates/common/README.md +8 -6
  115. package/templates/common/memory/startup-hints.md +19 -17
  116. package/templates/common/opencode.json +1 -0
  117. package/templates/optional/catalog.json +2 -9
  118. package/templates/optional/skills/github-pr-review/.claude/skills/github-pr-review/SKILL.md +1 -1
  119. package/templates/optional/skills/python-backend/.claude/skills/python-backend/SKILL.md +1 -1
  120. package/templates/optional/skills/ts-react-frontend/.claude/skills/ts-react-frontend/SKILL.md +1 -1
  121. package/templates/optional/skills/ui-ux-review/.claude/skills/ui-ux-review/SKILL.md +1 -1
  122. package/templates/common/Harness/TASK_ARCHIVE.md +0 -56
  123. package/templates/common/Harness/WF-STATE.md +0 -83
  124. package/templates/optional/skills/browser-e2e/.claude/skills/browser-e2e/SKILL.md +0 -42
  125. package/templates/optional/skills/browser-e2e/.claude/skills/wf-browser/SKILL.md +0 -194
  126. package/templates/optional/skills/browser-e2e/Harness/workflows/browser-e2e.md +0 -119
  127. /package/templates/common/Harness/{ACCEPTANCE_PROTOCOL.md → specs/protocols/ACCEPTANCE_PROTOCOL.md} +0 -0
  128. /package/templates/common/Harness/{AGENT_ISOLATION.md → specs/protocols/AGENT_ISOLATION.md} +0 -0
  129. /package/templates/common/Harness/{DEBUG_PROTOCOL.md → specs/protocols/DEBUG_PROTOCOL.md} +0 -0
  130. /package/templates/common/Harness/{HARNESS_BRIDGE.md → specs/protocols/HARNESS_BRIDGE.md} +0 -0
  131. /package/templates/common/Harness/{MEMORY_PROTOCOL.md → specs/protocols/MEMORY_PROTOCOL.md} +0 -0
  132. /package/templates/common/Harness/{TDD-GUIDE.md → specs/protocols/TDD-GUIDE.md} +0 -0
  133. /package/templates/common/Harness/{WF-AUTO-ANGLES.md → specs/workflows/WF-AUTO-ANGLES.md} +0 -0
@@ -0,0 +1,43 @@
1
+ {
2
+ "schema": "harness-settings@1",
3
+ "language": {
4
+ "userFacing": "auto"
5
+ },
6
+ "context": {
7
+ "startupProfile": "thin",
8
+ "cacheFirst": true,
9
+ "budgetProfile": "auto"
10
+ },
11
+ "workflow": {
12
+ "defaultTier": "auto",
13
+ "taskCapsuleCap": 5
14
+ },
15
+ "wfMax": {
16
+ "mode": "useful",
17
+ "maxWorkersTotal": 15,
18
+ "maxWorkersPerWave": 7,
19
+ "maxReviewersPerWave": 4,
20
+ "maxManagersTotal": 4,
21
+ "reviewReservePercent": 30,
22
+ "stopDispatchBelowTokens": 50000
23
+ },
24
+ "wfAuto": {
25
+ "enabled": true,
26
+ "maxFilesPerCycle": 3,
27
+ "maxNetLinesPerCycle": 50,
28
+ "checkpointSchedule": [2, 5, 10]
29
+ },
30
+ "wfAutoSpark": {
31
+ "enabled": true,
32
+ "minNorthStarAlignmentPercent": 50,
33
+ "rollingAlignmentFloorPercent": 65,
34
+ "roadmapReviewEveryCycles": 10
35
+ },
36
+ "telemetry": {
37
+ "l2Cache": {
38
+ "claimMinWarmTurns": 10,
39
+ "claimMinReadRatioPercent": 95,
40
+ "claimMinUpliftPoints": 2
41
+ }
42
+ }
43
+ }
@@ -85,7 +85,7 @@ If rules are missing, the agent MUST install them before proceeding to step 1.
85
85
 
86
86
  Beyond coding style, ECC provides design-level guidance for both frontend and backend.
87
87
  These are NOT in Harness by default — the agent should consult them when filling
88
- `Harness/architecture.md` and `Harness/research/research-results.md`.
88
+ `Harness/project/architecture.md` and `Harness/research/research-results.md`.
89
89
 
90
90
  ### Frontend Design (web/ + typescript/)
91
91
 
@@ -111,7 +111,7 @@ These are NOT in Harness by default — the agent should consult them when filli
111
111
 
112
112
  ### Architecture Templates
113
113
 
114
- Write the project-specific structure in `Harness/architecture.md`. Use the ECC rule combinations above to decide which standards apply to each layer.
114
+ Write the project-specific structure in `Harness/project/architecture.md`. Use the ECC rule combinations above to decide which standards apply to each layer.
115
115
 
116
116
  ### API Contract
117
117
 
@@ -119,7 +119,7 @@ See [Contract Rules](#contract-rules) below for the full spec.
119
119
 
120
120
  ## Agent Skills + ECC Rules
121
121
 
122
- Dispatch packets MUST include `ecc` and SHOULD include `skills` fields (use `skills: none` when no skill applies). `Harness/context-loading.md#ecc-rules-per-role` owns the role-to-ECC mapping. This guide owns stack detection and the catalog of available ECC rule sets.
122
+ Dispatch packets MUST include `ecc` and SHOULD include `skills` fields (use `skills: none` when no skill applies). `Harness/specs/runtime/context-loading.md#ecc-rules-per-role` owns the role-to-ECC mapping. This guide owns stack detection and the catalog of available ECC rule sets.
123
123
 
124
124
  ## API Contract Specification (Frontend ↔ Backend)
125
125
 
@@ -243,4 +243,4 @@ When dispatching a subagent, the dispatch packet MUST include:
243
243
 
244
244
  Different subagents get different `ecc` and `skills` arrays.
245
245
  A frontend implementer loads `web/` rules. A backend implementer loads `python/` or `golang/` rules.
246
- A reviewer loads `security/` + `testing/` rules. See `Harness/context-loading.md` for the full per-role mapping.
246
+ A reviewer loads `security/` + `testing/` rules. See `Harness/specs/runtime/context-loading.md` for the full per-role mapping.
@@ -1,6 +1,9 @@
1
1
  # SETUP.md - Bootstrap This Product Harness
2
2
 
3
- Temporary file. Delete after the first vertical slice is verified.
3
+ Retained install/bootstrap reference. Keep this file available for setup,
4
+ migration, upgrade decisions, and explicit bootstrap requests. Normal sessions
5
+ start from `CLAUDE.md`; `Harness/README.md` is the Harness workflow router when
6
+ a routed task needs it.
4
7
 
5
8
  ## What This Is
6
9
 
@@ -24,7 +27,7 @@ It does not guess your stack or business domain. The agent MUST detect or ask, t
24
27
  Start Claude Code or Codex, then say:
25
28
 
26
29
  ```text
27
- Read Harness/SETUP.md. Bootstrap this project as a 0-1 product harness.
30
+ Read Harness/specs/guides/SETUP.md. Bootstrap this project as a 0-1 product harness.
28
31
  Use Harness/README.md as the router. Keep context small.
29
32
  First clarify the idea, then create Mini PRD, acceptance criteria, UI/API contracts, test plan, research, architecture, Harness/PROGRESS.md, the first per-task plan, and the first vertical-slice task.
30
33
  ```
@@ -33,18 +36,18 @@ First clarify the idea, then create Mini PRD, acceptance criteria, UI/API contra
33
36
 
34
37
  Claude or Codex must follow this order during bootstrap. This sequence is broader than installation; if the user only asked to install/configure the harness in an existing project, follow the "Existing Project Fast Path" below and stop after the non-strict validator passes.
35
38
 
36
- 0. **ECC Stack Configuration** — Detect the project's tech stack. If the repo is empty or has no stack markers (`package.json`, `go.mod`, `pyproject.toml`, `Cargo.toml`, `Gemfile`, `composer.json`, `build.gradle`, etc.), ask the user: "What's your tech stack? (language/framework)" Then install the matching ECC rule sets from `~/.claude/rules/ecc/`. See `Harness/ECC-GUIDE.md` for the stack→rules mapping. Minimum: always install `common/`. Verify with `ls .claude/rules/ecc/`.
37
- 1. Read `CLAUDE.md`, `Harness/MEMORY.md`, `Harness/README.md`, `Harness/lifecycle.md`, and `Harness/ACCEPTANCE_PROTOCOL.md`. Load `Harness/memory/*` only when the router or memory trigger applies.
39
+ 0. **ECC Stack Configuration** — Detect the project's tech stack. If the repo is empty or has no stack markers (`package.json`, `go.mod`, `pyproject.toml`, `Cargo.toml`, `Gemfile`, `composer.json`, `build.gradle`, etc.), ask the user: "What's your tech stack? (language/framework)" Then install the matching ECC rule sets from `~/.claude/rules/ecc/`. See `Harness/specs/guides/ECC-GUIDE.md` for the stack→rules mapping. Minimum: always install `common/`. Verify with `ls .claude/rules/ecc/`.
40
+ 1. Read `CLAUDE.md`, `Harness/MEMORY.md`, `Harness/README.md`, `Harness/specs/guides/lifecycle.md`, and `Harness/specs/protocols/ACCEPTANCE_PROTOCOL.md`. Load `Harness/memory/*` only when the router or memory trigger applies.
38
41
  2. Ask up to 3 blocking product questions. If not blocked, record assumptions in `Harness/tasks/<task-id>/PLAN.md`.
39
42
  3. Fill `Harness/research/PRD.md` or the first task PLAN with Mini PRD fields: goal, scope, non-scope, user flow, UI elements, API behavior, acceptance criteria, and verification commands.
40
43
  4. Read `Harness/research/README.md`, then fill `Harness/research/research-results.md` with adopted/rejected research choices.
41
44
  5. Create AC IDs, UI/API contract tables, and a test plan before implementation. Use `Harness/templates/*` when helpful.
42
- 6. Fill `Harness/architecture.md`.
45
+ 6. Fill `Harness/project/architecture.md`.
43
46
  7. Create a task capsule from `Harness/tasks/_template/` and fill the first vertical-slice plan in `Harness/tasks/<task-id>/PLAN.md`.
44
- 8. Use `Harness/AGENT_ISOLATION.md`, `Harness/subagents.md`, `Harness/context-loading.md`, and `Harness/dispatch.md` when explicit WF/WK mode or any spawned subagents are involved.
47
+ 8. Use `Harness/specs/protocols/AGENT_ISOLATION.md`, `Harness/specs/runtime/subagents.md`, `Harness/specs/runtime/context-loading.md`, and `Harness/specs/runtime/dispatch.md` when explicit WF/WK mode or any spawned subagents are involved.
45
48
  9. Implement only after PRD-GATE, AC-GATE, CONTRACT-GATE, and TEST-GATE pass.
46
- 10. Independently validate with an AC-by-AC result matrix; use `Harness/HARNESS_BRIDGE.md` for browser/API/CDP flows.
47
- 11. For `/wf-auto` or memory scenario hints, read `Harness/WF-AUTO.md` and `Harness/MEMORY_PROTOCOL.md`; do not enable a background runner by default. The only allowed runtime hook is the optional `/wf-auto` bounded tick hook.
49
+ 10. Independently validate with an AC-by-AC result matrix; use `Harness/specs/protocols/HARNESS_BRIDGE.md` for browser/API/CDP flows.
50
+ 11. For `/wf-auto` or memory scenario hints, read `Harness/specs/workflows/WF-AUTO.md` and `Harness/specs/protocols/MEMORY_PROTOCOL.md`; do not enable a background runner by default. The only allowed runtime hook is the optional `/wf-auto` bounded tick hook.
48
51
  12. Run `node Harness/scripts/validate-harness.mjs --strict` after project-fact placeholders are resolved.
49
52
  13. Record final verification and next feedback step in `Harness/tasks/<task-id>/PROGRESS.md`. If repeated tool failures, repeated user corrections, or reusable review/debug lessons appeared, record the concise reflection in the relevant `Harness/memory/` file.
50
53
 
@@ -69,7 +72,7 @@ Use this path when the user asks only to install or configure the harness in an
69
72
  2. Run the JSON `agent.safeMergeCommand` to create only missing files.
70
73
  3. Record discovered facts in the final install summary. Create or update task capsules only when bootstrap or multi-step implementation work begins.
71
74
  4. Existing configuration is project fact. Do not overwrite `CLAUDE.md`, `AGENTS.md`, `.claude/`, `.agents/`, `.codex/`, `.gitignore`, settings, package files, CI, docs routers, workflow docs, or installed skills/plugins/rules unless the user explicitly approves that exact overwrite.
72
- 5. When a harness file conflicts with an existing file, preserve the existing file and register any missing harness guidance manually using `Harness/extension.md`.
75
+ 5. When a harness file conflicts with an existing file, preserve the existing file and register any missing harness guidance manually using `Harness/specs/guides/extension.md`.
73
76
  6. Run `node Harness/scripts/validate-harness.mjs` as the install-complete gate.
74
77
  7. Defer `node Harness/scripts/validate-harness.mjs --strict` until bootstrap removes project-fact placeholders. If placeholders intentionally remain, report strict validation as deferred rather than treating install as failed.
75
78
 
@@ -132,24 +135,24 @@ The harness validator checks for specific structural invariants. When comparing
132
135
 
133
136
  | File | Required check |
134
137
  |------|----------------|
135
- | `CLAUDE.md` | Must be merged only after user confirmation when it already exists. Required contract: `## 1. Harness Binding & Startup` with the `Harness/SETUP.md` bootstrap contract line; `## 6. Memory & Self-Learning` section; the tool reflection trigger text (`same tool/use pattern fails 3+ times`); the user correction trigger text (`user corrects the same assumption/pattern 2+ times`); `Never bulk-read Harness/` in Startup |
138
+ | `CLAUDE.md` | Must be merged only after user confirmation when it already exists. Required contract: `## 1. Harness Binding & Startup`; `## 6. Memory & Self-Learning` section; the tool reflection trigger text (`same tool/use pattern fails 3+ times`); the user correction trigger text (`user corrects the same assumption/pattern 2+ times`); startup-hints routing; no startup dependency on this setup reference |
136
139
  | `AGENTS.md` | Root agent entry points to `CLAUDE.md` and `Harness/README.md`; for existing projects, merge only after explicit user consent |
137
140
  | `README.md` | Existing README is project-owned. Preserve by default; ask whether to append only Development notes or run `wf-readme` for a structure pass with tables/diagrams before broad edits |
138
141
  | `Harness/MEMORY.md` | All common agents registered under `## Agents`; all common harness skills registered under `## Skills`; all 3 `Harness/memory/` files registered under `## Memory Folder`; `Harness/memory/` folder usage guidance; `Project Resource Index` in title |
139
142
  | `.claude/rules/ecc/common.md` | Required project-local universal rules. Keep it even when global `~/.claude/rules/ecc/common/` exists; that directory and this file have different scopes. Required sections: `## Context` with the durable communication invariant (`project files are the only durable communication channel`); `## Memory` with three reflection file entries; `## Security` |
140
143
  | `Harness/README.md` | `## Keyword Routing` heading; `## Load By Task` table with at minimum the rows: "Need WF mode (explicit only)", "Adding harness to existing project", "Need implementation plan", "Need parallel agents", "Need subagents", "Need durable memory or reflection"; WF routing keywords include `/wf`, `$wf`, `/skills wf`, `/wf-max`, `$wf-max`, `/skills wf-max`; explicit WF entry only — no auto-triggering from task complexity, failure count, or old aliases; `## Doc Map` with `memory/` and `subagents.md` entries; the durable communication invariant text; `Harness/README.md is the primary Harness documentation router` |
141
- | `Harness/WF.md` | `WF is explicit only`; tier-aware contract: `WF-Light` (planner/test/verifier, no mandatory cross-review/reflector), `WF-Standard` (adds research + one review lens), `WF-Full` (complete role chain with cross-review + reflector PASS); `Collaboration tier guide`; `Heartbeat Protocol` |
142
- | `Harness/WF-MAX.md` | `WF-MAX is explicit only`; `WF-Max-Useful` (default, fan-out only where independent); `WF-Max-Strict` (explicit strict override); three-layer architecture; D-GATE; span formula |
143
- | `Harness/extension.md` | `## Non-Invasive Extension Rules` section with the "Preserve existing" rule; `## Agent Contract` section; `## Registration` section |
144
- | `Harness/dispatch.md` | The durable communication invariant; registered common agent entries; `## Handoff Format` heading |
145
- | `Harness/context-loading.md` | The durable communication invariant; `Harness/README.md is the primary Harness documentation router`; all 12 subagent context packs (Explorer Pass, Planner, Researcher, Docs Researcher, Architect, Test Writer, Implementer, Reviewer, Debugger, Verifier, Memory Master, Context Master) |
146
- | `Harness/subagents.md` | `## Source Attribution`; `## Built-in Agent Roster`; `## WF Default Fan-Out`; `Controller Role`; `Efficiency Ladder`; `Review Gates`; `collaboration decision tree`; source markers for `npx skills find`, `dispatching-parallel-agents`, and `subagent-driven-development` |
147
- | `Harness/architecture.md` | `## 2. Interface Decoupling`; `## 3. State Design`; `Avoid speculative abstraction`; layer constraints derived from actual project facts |
144
+ | `Harness/specs/workflows/WF.md` | `WF is explicit only`; tier-aware contract: `WF-Light` (planner/test/verifier, no mandatory cross-review/reflector), `WF-Standard` (adds research + one review lens), `WF-Full` (complete role chain with cross-review + reflector PASS); `Collaboration tier guide`; `Heartbeat Protocol` |
145
+ | `Harness/specs/workflows/WF-MAX.md` | `WF-MAX is explicit only`; `WF-Max-Useful` (default, fan-out only where independent); `WF-Max-Strict` (explicit strict override); three-layer architecture; D-GATE; span formula |
146
+ | `Harness/specs/guides/extension.md` | `## Non-Invasive Extension Rules` section with the "Preserve existing" rule; `## Agent Contract` section; `## Registration` section |
147
+ | `Harness/specs/runtime/dispatch.md` | The durable communication invariant; registered common agent entries; `## Handoff Format` heading |
148
+ | `Harness/specs/runtime/context-loading.md` | The durable communication invariant; `Harness/README.md is the primary Harness documentation router`; all 12 subagent context packs (Explorer Pass, Planner, Researcher, Docs Researcher, Architect, Test Writer, Implementer, Reviewer, Debugger, Verifier, Memory Master, Context Master) |
149
+ | `Harness/specs/runtime/subagents.md` | `## Source Attribution`; `## Built-in Agent Roster`; `## WF Default Fan-Out`; `Controller Role`; `Efficiency Ladder`; `Review Gates`; `collaboration decision tree`; source markers for `npx skills find`, `dispatching-parallel-agents`, and `subagent-driven-development` |
150
+ | `Harness/project/architecture.md` | `## 2. Interface Decoupling`; `## 3. State Design`; `Avoid speculative abstraction`; layer constraints derived from actual project facts |
148
151
  | `Harness/PROGRESS.md` | global task index with Active Task and task history; cross-task decisions |
149
152
  | `Harness/tasks/<id>/PROGRESS.md` | `## Current Goal`, `## Phase`, `## Heartbeat`, `## Loaded Context` headings |
150
153
  | `Harness/tasks/<id>/PLAN.md` | `## Tasks`, `## Parallel Dispatch`, `## Subagent Synthesis`, `## Verification` headings |
151
- | `Harness/SETUP.md` | Temporary install/bootstrap guide for new projects, existing projects, legacy upgrades, and Harness update decisions. If kept, ensure "Install or Upgrade Path" is present. |
152
- | `Harness/workflows/browser-e2e.md` (if installed as optional) | `data-testid`, `accessible labels/roles`, and `inputs, buttons, filters, rows, empty/error/loading states` requirement |
154
+ | `Harness/specs/guides/SETUP.md` | Retained install/bootstrap guide for new projects, existing projects, legacy upgrades, and Harness update decisions. Keep "Install or Upgrade Path" present. |
155
+ | `.claude/skills/wf-browser/SKILL.md` and `.agents/skills/wf-browser/SKILL.md` | Built-in browser workflow requires `data-testid`, `accessible labels/roles`, and `inputs, buttons, filters, rows, empty/error/loading states` guidance |
153
156
  | `Harness/workflows/ts-react-frontend.md` (if installed as optional) | Same UI selector contract as above |
154
157
 
155
158
  **Files that do NOT need manual merge when the path does not already exist (auto-created by harness):**
@@ -161,7 +164,7 @@ The generated file list is authoritative by path, not by stale count labels. Cur
161
164
  - `.claude/skills/*.md` and mirrored `.agents/skills/*.md` — Claude Code and Codex skill adapters over the same Harness docs
162
165
  - `.claude/rules/ecc/common.md` - required project-local universal rules. Do not delete this file as a duplicate of a global `~/.claude/rules/ecc/common/` directory; they are different scopes.
163
166
  - `.claude/settings.json` — harness settings
164
- - `Harness/WF.md`, `Harness/lifecycle.md`, `Harness/subagents.md`, `Harness/agent-workflow.md`, `Harness/architecture.md` — harness runtime docs
167
+ - `Harness/specs/workflows/WF.md`, `Harness/specs/guides/lifecycle.md`, `Harness/specs/runtime/subagents.md`, `Harness/specs/runtime/agent-workflow.md`, `Harness/project/architecture.md` — harness runtime docs
165
168
  - `Harness/research/*.md` — research protocol and templates
166
169
  - `AGENTS.md` — agent registry; if it already exists, ask for user consent before merging or replacing it
167
170
  - `Harness/scripts/validate-harness.mjs` and `tests/.gitkeep` — tooling
@@ -169,7 +172,7 @@ The generated file list is authoritative by path, not by stale count labels. Cur
169
172
  Optional workflow examples:
170
173
 
171
174
  ```bash
172
- npx create-harness-vibe-coding@latest my-app ./my-app -y --with browser-e2e,ts-react-frontend
175
+ npx create-harness-vibe-coding@latest my-app ./my-app -y --with ts-react-frontend,ui-ux-review
173
176
  npx create-harness-vibe-coding@latest my-app ./my-app -y --preset web-app
174
177
  npx create-harness-vibe-coding@latest my-app ./my-app -y --recommend superpowers,codegraph
175
178
  ```
@@ -196,7 +199,7 @@ Each template doc contains `{{PLACEHOLDER}}` markers. Below is what every placeh
196
199
  - `{{CONSTRAINT_1..3}}`: hard technical constraints derived from research.
197
200
  - `{{ALTERNATIVE_1..2}}`: rejected candidates worth watching for future.
198
201
 
199
- **`Harness/architecture.md`** — Layer structure. Derive from research-results:
202
+ **`Harness/project/architecture.md`** — Layer structure. Derive from research-results:
200
203
  - Fill the ASCII layer diagram with actual layer names. Do NOT add layers without a proven need.
201
204
  - `Interface Decoupling`: document only real boundaries and ports. Do not add speculative factories, plugin systems, generic repositories, or config layers.
202
205
  - `State Design`: name state owners, persistence level, legal transitions, and recovery behavior for long-running workflows.
@@ -261,7 +264,7 @@ ECC and Superpowers overlap ~80% in topic coverage but serve different purposes:
261
264
  | **Unique** | Design quality, performance budgets, security CSP, per-language idioms | Brainstorming, git worktrees |
262
265
 
263
266
  **Installation rule:**
264
- 1. **ECC is mandatory.** Install `common/` + stack-specific rules during bootstrap step 0. See `Harness/ECC-GUIDE.md`.
267
+ 1. **ECC is mandatory.** Install `common/` + stack-specific rules during bootstrap step 0. See `Harness/specs/guides/ECC-GUIDE.md`.
265
268
  2. **Superpowers is recommended.** Install after ECC. It adds ~14 workflow skills that teach agents *how* to execute ECC standards.
266
269
  3. **No duplicates from other sources.** If a Superpowers skill has an ECC equivalent, keep both — they don't conflict. ECC sets the bar, Superpowers shows the path.
267
270
  4. **Priority**: ECC rules take precedence when there's a conflict. ECC is the contract; Superpowers is the training manual.
@@ -274,13 +277,13 @@ ECC and Superpowers overlap ~80% in topic coverage but serve different purposes:
274
277
  3. Selected external GitHub links - let the user's agent read that project's README and install only after approval.
275
278
  4. GitHub search - when the first three miss niche domains.
276
279
 
277
- **What to install**: after finding skills, add the canonical copy to `.claude/skills/<name>/SKILL.md` and mirror the same file to `.agents/skills/<name>/SKILL.md` when Codex should discover it. Follow `Harness/extension.md` for compatibility. Start with 1-2 skills per stack area; more is not better.
280
+ **What to install**: after finding skills, add the canonical copy to `.claude/skills/<name>/SKILL.md` and mirror the same file to `.agents/skills/<name>/SKILL.md` when Codex should discover it. Follow `Harness/specs/guides/extension.md` for compatibility. Start with 1-2 skills per stack area; more is not better.
278
281
 
279
282
  This scaffold includes built-in harness skills in `.claude/skills/*` and mirrored Codex repo skills in `.agents/skills/*`. Keep those. Add stack-specific ones alongside them.
280
283
 
281
284
  ## Optional Agent Assets
282
285
 
283
- After the product shape is known, Claude Code may also install or copy stack-specific agents and rules into `.claude/`. Codex-discoverable workflow skills belong in `.agents/skills/`. Follow `Harness/extension.md` for every added asset.
286
+ After the product shape is known, Claude Code may also install or copy stack-specific agents and rules into `.claude/`. Codex-discoverable workflow skills belong in `.agents/skills/`. Follow `Harness/specs/guides/extension.md` for every added asset.
284
287
 
285
288
  Examples:
286
289
 
@@ -290,18 +293,12 @@ This is a Python data product. Add data pipeline and pytest workflow agents.
290
293
  This is a Go service. Add API, security, and integration-test agents.
291
294
  ```
292
295
 
293
- ## Cleanup (Isolate & Remove)
296
+ ## Retention
294
297
 
295
- This file is designed to be orphaned. When all configuration is complete:
296
-
297
- 1. Open `CLAUDE.md`. Confirm the setup line reads the bootstrap-only contract (starts with: ``Harness/SETUP.md` is a bootstrap-only document``). It stays valid after this file is deleted.
298
- 2. Delete this file.
299
-
300
- ```bash
301
- rm Harness/SETUP.md
302
- ```
303
-
304
- After both steps, `Harness/SETUP.md` is fully isolated — no file references it, no trace remains. You are free to delete it at any time. It is a bootstrap scaffold, not a permanent fixture.
298
+ Keep this file as a setup reference. It is not part of the normal startup path:
299
+ routine sessions start at `CLAUDE.md` and `Harness/memory/startup-hints.md`;
300
+ `Harness/README.md` is the workflow router when routed. Re-open this file only for install/bootstrap,
301
+ migration, upgrade decisions, or explicit user requests for setup guidance.
305
302
 
306
303
  ---
307
304
 
@@ -324,4 +321,4 @@ After scaffolding, use the JSON output first. Files in `plan.create[]` were hand
324
321
  1. Read `CLAUDE.md`, `Harness/MEMORY.md`, and `Harness/README.md`.
325
322
  2. Follow the Required Bootstrap Sequence above.
326
323
  3. Run `node Harness/scripts/validate-harness.mjs` after install. Run `node Harness/scripts/validate-harness.mjs --strict` after bootstrap resolves project-fact placeholders.
327
- 4. Delete `Harness/SETUP.md`.
324
+ 4. Keep `Harness/specs/guides/SETUP.md` as a setup reference; normal sessions start at `CLAUDE.md`, and routed workflow work uses `Harness/README.md` as the router.
@@ -12,7 +12,7 @@ Extensions must preserve project and harness ownership boundaries.
12
12
  - Treat existing project config as project fact. Read it before adding assets, then adapt new assets to the project instead of replacing the project.
13
13
  - Register added agents, skills, workflows, and rules in `Harness/MEMORY.md` and this docs router where applicable.
14
14
  - Added assets may extend `.claude/skills/`, `.claude/agents/`, `.claude/rules/`, or `Harness/workflows/`, but they must not replace core harness docs.
15
- - Core harness docs are `Harness/README.md`, `Harness/PROGRESS.md`, `Harness/subagents.md`, `Harness/context-loading.md`, `Harness/dispatch.md`, `Harness/agent-workflow.md`, and this file.
15
+ - Core harness docs are `Harness/README.md`, `Harness/PROGRESS.md`, `Harness/specs/runtime/subagents.md`, `Harness/specs/runtime/context-loading.md`, `Harness/specs/runtime/dispatch.md`, `Harness/specs/runtime/agent-workflow.md`, and this file.
16
16
  - If an optional workflow needs a new command or tool, document the command and fallback in `Harness/workflows/<name>.md` instead of changing core harness behavior.
17
17
 
18
18
  ## Agent Contract
@@ -35,7 +35,7 @@ Agent body must state:
35
35
  - allowed write set or read-only
36
36
  - forbidden scope
37
37
  - verification or evidence
38
- - return format from [subagents.md](subagents.md) and [dispatch.md](dispatch.md)
38
+ - return format from [subagents.md](../runtime/subagents.md) and [dispatch.md](../runtime/dispatch.md)
39
39
 
40
40
  ## Skill Contract
41
41
 
@@ -47,7 +47,7 @@ Every added skill must state:
47
47
  - allowed writes
48
48
  - output format
49
49
  - whether to update `Harness/PROGRESS.md` and task files
50
- - whether to use [subagents.md](subagents.md) and [dispatch.md](dispatch.md)
50
+ - whether to use [subagents.md](../runtime/subagents.md) and [dispatch.md](../runtime/dispatch.md)
51
51
 
52
52
  Skills should extend the harness. They should not replace `Harness/README.md`, `Harness/PROGRESS.md`, `subagents.md`, `context-loading.md`, `dispatch.md`, or `agent-workflow.md`.
53
53
 
@@ -12,8 +12,8 @@ Use when starting a new product, clarifying a vague idea, or deciding the next p
12
12
  | Acceptance | PRD | AC IDs in `ACCEPTANCE.md` section, feature doc, or task PLAN | every user-visible behavior has Given/When/Then and evidence method |
13
13
  | Contract | acceptance criteria | UI/API/state contract tables | UI selectors, API payloads, state changes, and negative assertions are testable |
14
14
  | Test Plan | contracts | `TEST_PLAN.md` section or task PLAN verification matrix | tests map to AC IDs before implementation starts |
15
- | Architecture | PRD and contracts | `Harness/architecture.md` | boundaries and first ports are defined |
16
- | Plan | PRD, AC, contracts, architecture | `Harness/tasks/<task-id>/PLAN.md`, optional `Harness/dispatch.md` | tasks have owners, write sets, forbidden truth files, and verification |
15
+ | Architecture | PRD and contracts | `Harness/project/architecture.md` | boundaries and first ports are defined |
16
+ | Plan | PRD, AC, contracts, architecture | `Harness/tasks/<task-id>/PLAN.md`, optional `Harness/specs/runtime/dispatch.md` | tasks have owners, write sets, forbidden truth files, and verification |
17
17
  | Build | plan and tests | minimal vertical slice | implementation satisfies AC IDs without modifying truth files |
18
18
  | Independent Validation | running slice | acceptance result matrix, screenshots/traces/logs | validator is not implementer; no unresolved critical/high findings |
19
19
  | Debug | failed AC evidence | root-cause handoff and smallest fix | failing layer identified before edits |
@@ -0,0 +1,76 @@
1
+ # TASK_ARCHIVE - Task Archive Mechanism
2
+
3
+ Purpose: keep `Harness/tasks/` lean by archiving completed/abandoned tasks while
4
+ preserving all evidence.
5
+
6
+ ## Archive Location
7
+
8
+ Active tasks stay in `Harness/tasks/<task-id>/`.
9
+ Archived tasks move to `Harness/tasks/_archive/YYYY/<task-id>/`.
10
+
11
+ ## What Is Never Archived
12
+
13
+ - `Harness/tasks/_template/` - scaffold template, never moved.
14
+ - `Harness/tasks/auto/` - WF-AUTO permanent state capsule, never moved unless
15
+ explicitly allowed by WF-AUTO docs.
16
+ - `Harness/tasks/_archive/` - the archive directory itself.
17
+ - Active, blocked, in-progress, running, pending, or needs-user-decision tasks.
18
+ - Tasks whose STATE.json status is `active`, `blocked`, `in_progress`,
19
+ `running`, `pending`, or `needs-user-decision`.
20
+
21
+ ## What May Be Archived
22
+
23
+ Tasks whose STATE.json or reconciled phase is: `complete`, `verified`,
24
+ `archived`, `abandoned`, `obsolete`, `done`, `closed`, or `closeout`.
25
+
26
+ `Harness/scripts/task-state.mjs` reads STATE.json `status`/`phase` first, then
27
+ uses root/task PROGRESS phases only as reconciliation evidence. Missing or
28
+ invalid STATE.json is skipped until
29
+ `node Harness/scripts/task-state.mjs reconcile --apply` creates or repairs
30
+ machine state.
31
+
32
+ ## Archive Process
33
+
34
+ 1. Verify the task is not active/blocked/running/pending.
35
+ 2. Ensure `Harness/tasks/_archive/YYYY/` exists.
36
+ 3. Move `Harness/tasks/<task-id>/` to
37
+ `Harness/tasks/_archive/YYYY/<task-id>/`.
38
+ 4. Update the moved STATE.json: `status` to `archived`, `phase` to `archived`.
39
+ 5. Update `Harness/tasks/_archive/INDEX.md`.
40
+ 6. Rewrite `Harness/PROGRESS.md` Task Index from the remaining non-archived
41
+ task capsules.
42
+
43
+ ## Retention
44
+
45
+ - Archived tasks retain: PLAN, PROGRESS, STATE, ARTIFACTS, NOTES.
46
+ - Do NOT delete historical evidence.
47
+ - `Harness/PROGRESS.md` keeps the last 5 non-archived task entries in the Task
48
+ Index.
49
+ - When outer task capsules exceed 5 completed/abandoned/obsolete tasks, archive
50
+ the oldest safe tasks.
51
+ - The validator (`Harness/scripts/validate-harness.mjs`) warns when
52
+ `Harness/tasks/` holds more than 5 outer task capsules (excluding `_archive`,
53
+ `_template`, `auto`) and fails in `--strict` mode.
54
+
55
+ ## Script
56
+
57
+ Use `Harness/scripts/task-state.mjs archive`:
58
+
59
+ - Default: dry-run.
60
+ - `--apply` to execute.
61
+ - `--keep 5` to set the non-archived task threshold.
62
+ - `--task <task-id>` to archive a specific task.
63
+ - `--json` for machine-readable output.
64
+ - Run `node Harness/scripts/task-state.mjs archive --dry-run --json` before
65
+ applying a risky cleanup.
66
+
67
+ Compatibility entry: `Harness/scripts/archive-tasks.mjs` delegates to
68
+ `task-state.mjs archive` and accepts the same archive flags.
69
+
70
+ ## Safety Rules
71
+
72
+ - Windows path safe. Use `path.resolve()` before moving.
73
+ - Confirm target is within `Harness/tasks/` before any move.
74
+ - Do NOT recursively delete.
75
+ - Tasks with `needs-user-decision` status are never auto-archived.
76
+ - Missing or invalid STATE.json is never archived without reconciliation.
@@ -4,10 +4,10 @@ Use when implementing, reviewing, debugging, or coordinating subagents.
4
4
 
5
5
  This workflow is acceptance-driven. PRD-derived Acceptance Criteria are the
6
6
  source of truth; implementation, tests, review, validation, debug, and memory
7
- must trace to AC IDs. Load [ACCEPTANCE_PROTOCOL.md](ACCEPTANCE_PROTOCOL.md) for
8
- gate rules, [TDD-GUIDE.md](TDD-GUIDE.md) for AC-linked RED tests,
9
- [HARNESS_BRIDGE.md](HARNESS_BRIDGE.md) for UI/API/browser evidence, and
10
- [AGENT_ISOLATION.md](AGENT_ISOLATION.md) before role splits.
7
+ must trace to AC IDs. Load [ACCEPTANCE_PROTOCOL.md](../protocols/ACCEPTANCE_PROTOCOL.md) for
8
+ gate rules, [TDD-GUIDE.md](../protocols/TDD-GUIDE.md) for AC-linked RED tests,
9
+ [HARNESS_BRIDGE.md](../protocols/HARNESS_BRIDGE.md) for UI/API/browser evidence, and
10
+ [AGENT_ISOLATION.md](../protocols/AGENT_ISOLATION.md) before role splits.
11
11
 
12
12
  ## ReAct Loop
13
13
 
@@ -118,8 +118,8 @@ Use [subagents.md](subagents.md) and [dispatch.md](dispatch.md) for multi-agent
118
118
  | Mode | Agent Count Rule | Source |
119
119
  |------|-----------------|--------|
120
120
  | Default (non-WF) | up to 3 active agents by default | This file |
121
- | `/wf` | WF-KERNEL tier selection (Light/Standard/Full) by risk and scope; full role chain only at WF-Full | [WF.md](WF.md) |
122
- | `/wf-max` | WF kernel plus maximum useful fan-out (WF-Max-Useful default; WF-Max-Strict explicit only) | [WF-MAX.md](WF-MAX.md) |
121
+ | `/wf` | WF-KERNEL tier selection (Light/Standard/Full) by risk and scope; full role chain only at WF-Full | [WF.md](../workflows/WF.md) |
122
+ | `/wf-max` | WF kernel plus maximum useful fan-out (WF-Max-Useful default; WF-Max-Strict explicit only) | [WF-MAX.md](../workflows/WF-MAX.md) |
123
123
 
124
124
  Prefer parallel read-only work first, then serial writes.
125
125
 
@@ -10,33 +10,97 @@ If this file and `Harness/README.md` disagree, follow `Harness/README.md`, recor
10
10
 
11
11
  project files are the only durable communication channel; chat/subagent transcript state is non-authoritative. Important assumptions, decisions, blockers, evidence, and handoffs must be written to `Harness/tasks/<task-id>/PROGRESS.md` and `Harness/tasks/<task-id>/PLAN.md`, the current feature doc, `Harness/MEMORY.md`, or `Harness/memory/*` as appropriate.
12
12
 
13
- ## Main Context
14
-
15
- Always keep:
16
-
17
- - `CLAUDE.md`
18
- - `Harness/MEMORY.md`
19
- - `Harness/README.md`
20
- - `Harness/PROGRESS.md` when active
21
- - `Harness/tasks/<task-id>/PROGRESS.md` when active
22
- - `Harness/tasks/<task-id>/PLAN.md` when active
23
- - current feature doc when active
24
-
25
- Load other docs only by trigger.
13
+ ## Context Tiers
14
+
15
+ These tiers are automatic route profiles, not user-selected modes. The agent
16
+ selects a profile from the explicit command, user request, active task state,
17
+ router row, skill trigger, and concrete file references.
18
+
19
+ Budgets are regression guards, not exclusion rules. If correctness requires a
20
+ file outside the current profile, load that file and record the reason in the
21
+ task notes/progress when the work is in WF. Do not skip required rules, source
22
+ files, contracts, tests, or evidence to stay under budget.
23
+
24
+ | Tier | When | Keep | Do Not Load |
25
+ | --- | --- | --- | --- |
26
+ | Thin startup | New installed-project session before task routing | `CLAUDE.md`, `Harness/memory/startup-hints.md` | `Harness/MEMORY.md`, `Harness/README.md`, `Harness/PROGRESS.md`, workflow docs, skill bodies |
27
+ | Direct task | Simple, single-step, low-risk request | `CLAUDE.md` plus only files needed for the task | full router, task capsules, unrelated Harness docs |
28
+ | Router prefix | Explicit `/wf-*`, `$wf-*`, or `/skills wf-*` command | `CLAUDE.md`, `Harness/MEMORY.md` index, `Harness/README.md`, `Harness/PROGRESS.md` only when active | unrelated workflow docs, all skills, all agents, unused tool schemas |
29
+ | Active task scope | Router found an active task | `STATE.json` first, then task `PROGRESS.md`, task `PLAN.md` only when decisions/scope need review, current feature doc when active | archived tasks, unrelated task directories, broad task history |
30
+ | Routed skill/doc | Router, command, or `tool_search` selects a specific capability | selected skill body and adjacent docs named by that skill/doc | all skill bodies, all tool schemas, whole `Harness/` tree |
31
+
32
+ After the tier is selected, load other docs only by trigger.
33
+
34
+ Escalation rule: when unsure whether a file is required, prefer targeted
35
+ keyword search or a one-file read over guessing from memory. Escalate from a
36
+ smaller profile to the next targeted profile only when the new file directly
37
+ proves or disproves the current decision.
38
+
39
+ ## Cache-First Context Contract
40
+
41
+ Prompt-cache hit rate is a context-layout constraint. Preserve this order for
42
+ WF commands, skill adapters, and subagent packets:
43
+
44
+ 1. Stable prefix: `CLAUDE.md`, `Harness/MEMORY.md` index, `Harness/README.md`,
45
+ selected workflow docs, and stable skill/agent indexes in deterministic
46
+ order.
47
+ 2. Scoped references: task `STATE.json`, `PLAN.md`, contracts, selected source
48
+ files, and selected docs only.
49
+ 3. Dynamic suffix: newest user message, active question, current heartbeat,
50
+ current date/time, cwd/runtime/model/channel, fresh search results, tool
51
+ output, command logs, screenshots, and validation evidence.
52
+
53
+ Rules:
54
+
55
+ - Do not reorder stable loads during a task.
56
+ - Put volatile values after the stable prefix; do not place timestamps, request
57
+ IDs, latest tool output, or fresh search results in startup/router text.
58
+ - Load skill bodies and tool schemas only when routed by the explicit command,
59
+ `Harness/README.md`, or `tool_search`; do not preload all skills or tools.
60
+ - Keep dispatch packets deterministic: canonical field order, stable tool/skill
61
+ list order, bounded `MaxReturnTokens`, and short `ReturnSchema`.
62
+ - Prefer file paths and compact task-state summaries over pasted logs or
63
+ transcripts. Append-only `PROGRESS.md`/`STATE.json` beats rewritten summaries
64
+ until compaction is required.
65
+ - Treat a model switch, reasoning/context-size change, enabled-tool/MCP change,
66
+ or compaction as a cache boundary and record it in task progress.
67
+
68
+ ## Cache Validation Levels
69
+
70
+ - **L0 structure**: `validate-harness.mjs` proves the Harness still preserves
71
+ stable-prefix/dynamic-suffix routing, deferred skills/tools, and bounded
72
+ summaries. This is regression protection only.
73
+ - **L1 prefix simulation**: compare two serialized dispatch/context packets and
74
+ prove the stable prefix bytes are identical while only the dynamic suffix
75
+ changes. Use this when a runtime exposes prompt assembly locally.
76
+ Covered by `tests/l1-prefix-simulation.test.js` (positive match + negative
77
+ controls + anti-pollution detection).
78
+ - **L2 provider telemetry**: prove real cache behavior from model response
79
+ usage fields, such as OpenAI `cached_tokens` / `cache_write_tokens` or
80
+ Anthropic `cache_read_input_tokens` / `cache_creation_input_tokens`, across a
81
+ warm-up request and repeated same-prefix requests.
82
+ For Claude Code scripted probes, use
83
+ `node Harness/scripts/l2-cache-telemetry.mjs`; it records the exact CLI
84
+ flags, session IDs, usage fields, cost, duration, and claim-gate result in
85
+ `$HOME/.claude/cache-telemetry/`.
86
+
87
+ Do not claim real cache hits or hit-rate improvement from structure checks
88
+ alone. A real cache-hit claim requires L2 telemetry, or an explicit statement
89
+ that the current runtime does not expose provider cache metrics.
26
90
 
27
91
  ## Trigger Matrix
28
92
 
29
93
  | Trigger | Load |
30
94
  | --- | --- |
31
- | idea, scope, MVP | `Harness/lifecycle.md`, `Harness/research/PRD.md`, `Harness/ACCEPTANCE_PROTOCOL.md` |
32
- | acceptance, AC, criteria, contract, validation matrix | `Harness/ACCEPTANCE_PROTOCOL.md`, `Harness/AGENT_ISOLATION.md`, `Harness/HARNESS_BRIDGE.md` as needed |
95
+ | idea, scope, MVP | `Harness/specs/guides/lifecycle.md`, `Harness/research/PRD.md`, `Harness/specs/protocols/ACCEPTANCE_PROTOCOL.md` |
96
+ | acceptance, AC, criteria, contract, validation matrix | `Harness/specs/protocols/ACCEPTANCE_PROTOCOL.md`, `Harness/specs/protocols/AGENT_ISOLATION.md`, `Harness/specs/protocols/HARNESS_BRIDGE.md` as needed |
33
97
  | research, competitors, stack choice | `Harness/research/README.md`, `Harness/research/research-results.md` |
34
- | task split, owner, write set | `Harness/tasks/<task-id>/PROGRESS.md`, `Harness/tasks/<task-id>/PLAN.md`, `Harness/agent-workflow.md` |
35
- | parallel agents, dispatch, worktree decision | `Harness/subagents.md`, `Harness/dispatch.md`, `Harness/tasks/<task-id>/PLAN.md` |
36
- | `/wf` mode (explicit only) | [Harness/WF.md](WF.md), [Harness/subagents.md](subagents.md), [Harness/dispatch.md](dispatch.md), [Harness/tasks/<task-id>/PLAN.md](tasks/<task-id>/PLAN.md) |
37
- | `/wf-max` (explicit only) | [Harness/WF-MAX.md](WF-MAX.md), [Harness/subagents.md](subagents.md), [Harness/dispatch.md](dispatch.md), [Harness/tasks/<task-id>/PLAN.md](tasks/<task-id>/PLAN.md) |
38
- | memory, scenario memory, repeated tool failure, repeated user correction, reusable lesson | `Harness/MEMORY.md`, `Harness/MEMORY_PROTOCOL.md`, the relevant `Harness/memory/*.md` file |
39
- | subagent spawn | `Harness/subagents.md`, `Harness/AGENT_ISOLATION.md`, this file plus the role pack below |
98
+ | task split, owner, write set | `Harness/tasks/<task-id>/PROGRESS.md`, `Harness/tasks/<task-id>/PLAN.md`, `Harness/specs/runtime/agent-workflow.md` |
99
+ | parallel agents, dispatch, worktree decision | `Harness/specs/runtime/subagents.md`, `Harness/specs/runtime/dispatch.md`, `Harness/tasks/<task-id>/PLAN.md` |
100
+ | `/wf` mode (explicit only) | [Harness/specs/workflows/WF.md](../workflows/WF.md), [Harness/specs/runtime/subagents.md](subagents.md), [Harness/specs/runtime/dispatch.md](dispatch.md), [Harness/tasks/<task-id>/PLAN.md](../../tasks/<task-id>/PLAN.md) |
101
+ | `/wf-max` (explicit only) | [Harness/specs/workflows/WF-MAX.md](../workflows/WF-MAX.md), [Harness/specs/runtime/subagents.md](subagents.md), [Harness/specs/runtime/dispatch.md](dispatch.md), [Harness/tasks/<task-id>/PLAN.md](../../tasks/<task-id>/PLAN.md) |
102
+ | memory, scenario memory, repeated tool failure, repeated user correction, reusable lesson | `Harness/MEMORY.md`, `Harness/specs/protocols/MEMORY_PROTOCOL.md`, the relevant `Harness/memory/*.md` file |
103
+ | subagent spawn | `Harness/specs/runtime/subagents.md`, `Harness/specs/protocols/AGENT_ISOLATION.md`, this file plus the role pack below |
40
104
 
41
105
  ## ECC Rules Per Role
42
106
 
@@ -11,14 +11,15 @@ Use when work needs parallel reading, independent review, cross-layer analysis,
11
11
  - Main agent owns the final decision, integration, and verification.
12
12
  - project files are the only durable communication channel; chat/subagent transcript state is non-authoritative.
13
13
  - Important assumptions, decisions, blockers, evidence, and handoffs must be written to `Harness/tasks/<task-id>/PROGRESS.md` and `Harness/tasks/<task-id>/PLAN.md`, the current feature doc, `Harness/MEMORY.md`, or `Harness/memory/*` as appropriate.
14
- - Resumable state is governed by [WF-STATE.md](WF-STATE.md). On session start, the controller reads STATE.json before building a fresh dispatch table.
14
+ - Resumable state is governed by [WF-STATE.md](../workflows/WF-STATE.md). On session start, the controller reads STATE.json before building a fresh dispatch table.
15
15
  - PRD-derived Acceptance Criteria are the source of truth. Dispatch packets must carry the relevant AC IDs and contracts.
16
- - Agent count: default (non-WF) <=3 active agents; `/wf` selects a tier dynamically per [WF-KERNEL.md](WF-KERNEL.md) (Light/Standard/Full); `/wf-max` inherits the selected tier and adds maximum safe fan-out (WF-Max-Useful default; WF-Max-Strict explicit only), removing the Harness default cap through the span formula. Real concurrency is still bounded by runtime thread budget, config, billing, and local resources. Use current runtime subagents first, close completed agents, then peer-CLI overflow (`claude -p`, `codex exec`, or `opencode run --agent <role> --dir .`). Generated Codex config defaults to `agents.max_threads = 12` and `agents.max_depth = 1`; ask the user before raising `agents.max_threads` above that default. See [WF.md](WF.md) and [WF-MAX.md](WF-MAX.md).
16
+ - Agent count: default (non-WF) <=3 active agents; `/wf` selects a tier dynamically per [WF-KERNEL.md](../workflows/WF-KERNEL.md) (Light/Standard/Full); `/wf-max` inherits the selected tier and adds maximum safe fan-out (WF-Max-Useful default; WF-Max-Strict explicit only), removing the Harness default cap through the span formula. WF-MAX must attempt native subagent fan-out and record `fanoutAttempted: true` before any solo fallback. Real concurrency is still bounded by runtime thread budget, config, billing, and local resources. Use current runtime subagents first, close completed agents, then peer-CLI overflow (`claude -p`, `codex exec`, or `opencode run --agent <role> --dir .`). Do not scaffold Codex scalar `[agents]` capacity fields into project `.codex/config.toml`; probe the installed runtime and manage Codex caps through the dispatch ledger unless the installed version accepts the config shape. Generated OpenCode config defaults to `subagent_depth = 2` for manager -> worker nesting. See [WF.md](../workflows/WF.md) and [WF-MAX.md](../workflows/WF-MAX.md).
17
17
  - Read-only agents may run in parallel.
18
18
  - Writing agents run serially unless write sets are disjoint.
19
19
  - Use a worktree when two agents may touch overlapping files or long-running branches.
20
20
  - Only summaries enter main context. Load named files directly when details are needed.
21
21
  - Only the controller or task-scribe writes task state (PROGRESS.md, PLAN.md). Production source agents (implementer, debugger, test-writer) never write task state unless explicitly dispatched as task-scribe.
22
+ - Cache-first dispatch follows `Harness/specs/runtime/context-loading.md#Cache-First Context Contract`: canonical field order, stable tool/skill list order, dynamic evidence/logs last, and bounded `MaxReturnTokens`/`ReturnSchema`.
22
23
 
23
24
  ## Scope
24
25
 
@@ -67,7 +68,7 @@ Objective: <one-sentence goal>
67
68
  TaskType: ui-browser | api-backend | architecture-migration | docs-readme | dependency-sdk | bug-fix | refactor | chore
68
69
  ModelTier: small-fast | standard | high-reasoning
69
70
  AgentName: <the agent file name, e.g. task-scribe, codebase-explorer, implementer>
70
- Skills: <which skills to activate, e.g. tdd, browser-e2e>
71
+ Skills: <which skills to activate, e.g. tdd, wf-browser>
71
72
  ECC: <which ECC rules to load, e.g. web/design-quality.md, python/fastapi.md>
72
73
  PRD: <path or task PLAN section containing Mini PRD>
73
74
  Acceptance IDs: <AC-001, AC-002, or "none" for non-behavioral work>