create-harness-vibe-coding 0.2.0 → 0.3.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 (50) hide show
  1. package/README-CN.md +94 -0
  2. package/README.md +104 -21
  3. package/package.json +3 -2
  4. package/src/generator.js +2 -0
  5. package/templates/common/.claude/agents/context-master.md +78 -0
  6. package/templates/common/.claude/agents/debugger.md +1 -1
  7. package/templates/common/.claude/agents/docs-researcher.md +1 -1
  8. package/templates/common/.claude/agents/implementer.md +1 -1
  9. package/templates/common/.claude/agents/memory-master.md +67 -0
  10. package/templates/common/.claude/agents/planner.md +1 -1
  11. package/templates/common/.claude/agents/researcher.md +1 -1
  12. package/templates/common/.claude/agents/test-writer.md +1 -1
  13. package/templates/common/.claude/agents/verifier.md +1 -1
  14. package/templates/common/.claude/commands/update.md +11 -0
  15. package/templates/common/.claude/commands/wf.md +10 -4
  16. package/templates/common/.claude/rules/ecc/common.md +2 -2
  17. package/templates/common/.claude/skills/harness-build-loop/SKILL.md +2 -1
  18. package/templates/common/.claude/skills/harness-context/SKILL.md +2 -1
  19. package/templates/common/.claude/skills/harness-lifecycle/SKILL.md +2 -1
  20. package/templates/common/.claude/skills/harness-research/SKILL.md +2 -1
  21. package/templates/common/.claude/skills/harness-router/SKILL.md +2 -2
  22. package/templates/common/.claude/skills/readme-optimizer/SKILL.md +3 -2
  23. package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +9 -4
  24. package/templates/common/.claude/skills/wf-mode/SKILL.md +13 -6
  25. package/templates/common/.claude/skills/wf-update/SKILL.md +58 -0
  26. package/templates/common/.harness-version +8 -0
  27. package/templates/common/CLAUDE.md +15 -5
  28. package/templates/common/MEMORY.md +6 -1
  29. package/templates/common/README.md +2 -2
  30. package/templates/common/SETUP.md +34 -20
  31. package/templates/common/docs/README.md +24 -17
  32. package/templates/common/docs/domain/ports.md +3 -0
  33. package/templates/common/docs/features/_template.md +11 -1
  34. package/templates/common/docs/harness/PLAN.md +37 -88
  35. package/templates/common/docs/harness/PROGRESS.md +17 -0
  36. package/templates/common/docs/harness/WF.md +32 -14
  37. package/templates/common/docs/harness/agent-workflow.md +19 -7
  38. package/templates/common/docs/harness/architecture.md +31 -7
  39. package/templates/common/docs/harness/context-loading.md +17 -5
  40. package/templates/common/docs/harness/dispatch.md +9 -6
  41. package/templates/common/docs/harness/extension.md +4 -4
  42. package/templates/common/docs/harness/lifecycle.md +2 -2
  43. package/templates/common/docs/harness/state-machines.md +8 -0
  44. package/templates/common/docs/harness/subagents.md +50 -9
  45. package/templates/common/docs/research/README.md +3 -3
  46. package/templates/common/docs/tasks/_template/ARTIFACTS.md +3 -0
  47. package/templates/common/docs/tasks/_template/NOTES.md +3 -0
  48. package/templates/common/docs/tasks/_template/PLAN.md +40 -0
  49. package/templates/common/docs/tasks/_template/PROGRESS.md +29 -0
  50. package/templates/common/scripts/validate-harness.mjs +78 -7
@@ -34,7 +34,17 @@
34
34
  - [ ] {{ACCEPTANCE_CRITERION_2}}
35
35
  - [ ] {{ACCEPTANCE_CRITERION_3}}
36
36
 
37
- ### 1.5 UI Automation Hooks
37
+ ### 1.5 Optimistic UI Rollback
38
+
39
+ If any UI mutation happens before an async operation completes (DOM replacement,
40
+ state update, visual feedback), list the rollback path for when the operation fails:
41
+
42
+ | Mutation | Failure Recovery |
43
+ |----------|-----------------|
44
+ | {{MUTATION_1}} | {{ROLLBACK_1}} |
45
+ | Not applicable — no optimistic mutations are used. | |
46
+
47
+ ### 1.6 UI Automation Hooks
38
48
 
39
49
  For TS/React or browser workflows, define required stable accessible labels/roles and stable test hooks such as `data-testid` before implementation. These selectors must cover critical UI controls and states so CDP, Playwright, and manual verification can target inputs, buttons, filters, rows, empty/error/loading states, dialogs, navigation, and submitted/saved/error feedback without brittle DOM paths.
40
50
 
@@ -1,103 +1,52 @@
1
- # PLAN.md - Active Execution Plan
1
+ # PLAN.md DEPRECATED
2
2
 
3
- Use this file when work spans more than one step, one file, or one agent.
3
+ Workflow state has moved to task-capsule structure. Do not append new content here.
4
4
 
5
- ## Current Goal
5
+ Active state:
6
+ - `Harness/PROGRESS.md` — global task index and cross-task decisions
7
+ - `Harness/tasks/<task-id>/PROGRESS.md` — per-task progress, phase, heartbeat
8
+ - `Harness/tasks/<task-id>/PLAN.md` — per-task implementation plan, verification evidence
6
9
 
7
- {{CURRENT_GOAL}}
10
+ Templates:
11
+ - `Harness/tasks/_template/` — copy this directory to create a new task
8
12
 
9
- ## Phase
13
+ ## Legacy Content (historical reference only)
10
14
 
11
- Choose one: Idea / Research / PRD / Architecture / Plan / Build / Verify / Feedback.
15
+ The sections below are archived from the monolithic PLAN.md era. Active task data has been migrated to `Harness/tasks/`.
12
16
 
13
- Current: {{CURRENT_PHASE}}
17
+ ---
14
18
 
15
- ## Heartbeat
19
+ ### Historical: Dogfood Bootstrap
16
20
 
17
- Mode: normal
18
- Last beat: {{LAST_BEAT}}
19
- Current phase: {{CURRENT_PHASE}}
20
- Current blocker: {{CURRENT_BLOCKER_OR_NONE}}
21
- Next beat trigger: {{NEXT_BEAT_TRIGGER}}
22
- Failure count: 0
23
- Recovery action: {{RECOVERY_ACTION_OR_NONE}}
21
+ Goal: Dogfood the generated Harness scaffold inside this repository so future agents use root `Harness/` routing instead of stale `docs/harness/` guidance.
24
22
 
25
- Update this section before long commands, after long commands, before and after subagent handoffs, after failed verification, and before stopping for user input. In `wf-mode`, use this as the resume point after context loss or interruption.
23
+ **Success Criteria** (all verified):
24
+ - [x] Root `CLAUDE.md` routes through `Harness/MEMORY.md` and `Harness/README.md`
25
+ - [x] Root `MEMORY.md` no longer contains stale `docs/harness/` paths or template placeholders
26
+ - [x] Root `Harness/` and `.claude/` dogfood runtime assets exist
27
+ - [x] Harness strict validation passes
28
+ - [x] Repository tests pass
26
29
 
27
- ## Progress Rules
28
-
29
- - Phase tracks lifecycle progress.
30
- - Task status tracks execution progress.
31
- - Update before handoff, after verification, and when blocked.
32
-
33
- Allowed task statuses: Pending / In Progress / Blocked / Done / Verified.
34
-
35
- - Pending: not started.
36
- - In Progress: active work.
37
- - Blocked: needs user input or external change.
38
- - Done: task complete, evidence not final.
39
- - Verified: verification evidence is recorded.
40
-
41
- ## Success Criteria
42
-
43
- - [ ] {{CRITERION_1}}
44
- - [ ] {{CRITERION_2}}
45
- - [ ] {{CRITERION_3}}
46
-
47
- ## Scope
48
-
49
- Allowed write set:
50
- - `{{PATH_OR_GLOB}}`
51
-
52
- Forbidden:
53
- - {{OUT_OF_SCOPE}}
54
-
55
- ## Loaded Context
56
-
57
- Keep this list short. Add only docs/files used for the current phase.
58
-
59
- - `Harness/README.md`
60
- - `{{LOADED_DOC_OR_FILE}}`
61
-
62
- ## Tasks
63
-
64
- | # | Task | Owner | Verify | Status |
65
- | --- | --- | --- | --- | --- |
66
- | 1 | {{TASK}} | {{OWNER}} | `{{COMMAND_OR_CHECK}}` | Pending |
67
-
68
- ## Parallel Dispatch
69
-
70
- Use [subagents.md](subagents.md) and [dispatch.md](dispatch.md) when more than one agent or bounded pass is useful.
71
-
72
- | Task | Agent | Mode | Read Set | Write Set | Depends On | Output | Status |
73
- | --- | --- | --- | --- | --- | --- | --- | --- |
74
- | {{TASK}} | {{AGENT}} | Parallel Read / Serial Write / Isolated Worktree | `{{READ_SET}}` | `{{WRITE_SET_OR_NONE}}` | {{DEPENDENCY_OR_NONE}} | {{EXPECTED_OUTPUT}} | Pending |
75
-
76
- ## Subagent Synthesis
77
-
78
- Agents used:
79
- Findings accepted:
80
- Findings rejected:
81
- Conflicts:
82
- Decisions:
83
- Next write set:
84
- Verification path:
85
- Residual risk:
86
-
87
- ## Agent Handoffs
88
-
89
- | Agent | Role | Context Pack | Result |
90
- | --- | --- | --- | --- |
91
- | {{AGENT}} | {{ROLE}} | {{DOCS_OR_FILES}} | {{SUMMARY}} |
30
+ **Decisions:**
31
+ | Date | Decision | Reason |
32
+ |------|----------|--------|
33
+ | 2026-06-24 | Dogfood root `Harness/` while keeping templates under `templates/` | Separate package source from operating harness |
34
+ | 2026-06-24 | memory-master + context-master added to commonAgents | Global memory and context management |
92
35
 
93
- ## Decisions
36
+ ### Historical: WF Conflict Fix
94
37
 
95
- | Date | Decision | Reason |
96
- | --- | --- | --- |
97
- | {{YYYY-MM-DD}} | {{DECISION}} | {{REASON}} |
38
+ Goal: Fix WF-mode orphaned files and conflicts: align commands/wf.md, resolve subagent count tension, fix README "may" vs "MUST", add memory-master and context-master agents.
98
39
 
99
- ## Verification
40
+ **Subagent Dispatch:**
41
+ | Agent | Mode | Purpose | Status |
42
+ |-------|------|---------|--------|
43
+ | Subagent 1 | Serial Write | Create memory-master.md, context-master.md, update commands/wf.md | Verified |
44
+ | Subagent 2 | Serial Write | Fix agent-workflow.md, dispatch.md, README.md conflicts | Verified |
45
+ | Subagent 3 | Serial Write | Update WF.md, wf-mode/SKILL.md, subagents.md, MEMORY.md, context-loading.md, CLAUDE.md, validate-harness.mjs | Verified |
46
+ | Subagent 4 | Serial Write | Sync template changes to dogfood runtime files | Verified |
100
47
 
48
+ **Verification:**
101
49
  | Check | Result | Notes |
102
- | --- | --- | --- |
103
- | `{{CHECK}}` | Not run | {{NOTES}} |
50
+ |-------|--------|-------|
51
+ | `node Harness/scripts/validate-harness.mjs --strict` | Pass | all invariants preserved |
52
+ | `npm test` | Pass | 58/58 tests passed |
@@ -0,0 +1,17 @@
1
+ # PROGRESS.md
2
+
3
+ Global task index. Load at session start to see what is active and what was done.
4
+
5
+ ## Active Task
6
+
7
+ None — create a new task from `Harness/tasks/_template/` when work spans more than one step.
8
+
9
+ ## Task Index
10
+
11
+ | ID | Goal | Phase | Closed |
12
+ |----|------|-------|--------|
13
+
14
+ ## Cross-Task Decisions
15
+
16
+ | Date | Decision | Reason |
17
+ |------|----------|--------|
@@ -1,6 +1,6 @@
1
1
  # WF Mode - Long Task Workflow
2
2
 
3
- Use this when work is long, difficult, uncertain, multi-file, multi-agent, or user-triggered with `/wf`, `wf mode`, or `workflow mode`.
3
+ Use this when work is long, difficult, uncertain, multi-file, multi-agent, or user-triggered with `/wf`, `wf mode`, `workflow mode`, or `wk mode`.
4
4
 
5
5
  This is a Ralph-style harness loop: keep moving through evidence, bounded exploration, second planning, implementation, review, verification, and recovery instead of stalling on the first obstacle.
6
6
 
@@ -8,18 +8,28 @@ This is a Ralph-style harness loop: keep moving through evidence, bounded explor
8
8
 
9
9
  Enter WF mode when any of these are true:
10
10
 
11
- - The user explicitly says `/wf`, `wf mode`, or asks for the full workflow.
11
+ - The user explicitly says `/wf`, `wf mode`, `workflow mode`, `wk mode`, or asks for the full workflow.
12
12
  - The task needs more than one step, more than three files, or more than one subsystem.
13
13
  - The task needs research, architecture judgment, browser/API validation, or migration planning.
14
14
  - Confidence in intent, architecture, or implementation is below 95%.
15
15
  - The same command, test, tool, or approach fails twice.
16
16
 
17
+ ## Multi-Subagent Requirement
18
+
19
+ WF mode requires multi-subagent orchestration by default.
20
+
21
+ - Explicit `/wf`, `wf mode`, `workflow mode`, or `wk mode` MUST spawn at least 3 distinct subagents from `.claude/agents/` before second planning unless the runtime cannot spawn subagents.
22
+ - Use a 7:3 collaboration bias: prefer multi-agent collaboration for long, uncertain, cross-file, cross-layer, browser/API, migration, or repeated-failure work; reserve solo mode for clearly local, low-risk, one-file tasks outside explicit WF/WK mode.
23
+ - Default initial fan-out: `planner`, `researcher` or `docs-researcher`, and `architect`. Add `test-writer`, `reviewer`, `debugger`, or `verifier` when the phase needs them.
24
+ - Record every dispatch or bounded-pass fallback in `Harness/tasks/<task-id>/PLAN.md#Subagent Dispatch`.
25
+ - If subagents are unavailable, emulate the same roles as separate bounded passes and record why the fallback was used.
26
+
17
27
  ## WF Loop
18
28
 
19
29
  ```text
20
30
  Intake
21
31
  -> confidence gate
22
- -> parallel explorer / researcher / docs-researcher / architect passes
32
+ -> parallel planner / researcher / docs-researcher / architect subagents
23
33
  -> synthesis
24
34
  -> second plan
25
35
  -> test-writer
@@ -32,30 +42,31 @@ Intake
32
42
 
33
43
  ## Intake
34
44
 
35
- 1. Read `CLAUDE.md`, `Harness/MEMORY.md`, `Harness/README.md`, and `Harness/PLAN.md`.
45
+ 1. Read `CLAUDE.md`, `Harness/MEMORY.md`, `Harness/README.md`, `Harness/PROGRESS.md`, and the current task's `PROGRESS.md` and `PLAN.md` under `Harness/tasks/<task-id>/`.
36
46
  2. State the goal, non-goals, confidence level, known risks, and write boundaries.
37
47
  3. Ask up to three blocking questions only when the next action cannot reach 95% confidence.
38
- 4. Update `Harness/PLAN.md#Heartbeat` before dispatching agents or running long commands.
39
- 5. Load `Harness/subagents.md` before coordinating multiple agents.
48
+ 4. Update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat` before dispatching agents or running long commands.
49
+ 5. Load `Harness/subagents.md` before coordinating multiple agents; explicit WF/WK mode always coordinates multiple roles.
40
50
 
41
51
  ## Exploration
42
52
 
43
- Use parallel read-only passes first. Prefer three or fewer active agents.
53
+ Use parallel read-only subagents first. Explicit WF/WK mode starts with at least three distinct `.claude/agents/` roles before the second plan. For automatic WF triggers, default to 3-5 active agents unless the task is clearly small enough for the solo exception.
44
54
 
45
55
  | Agent | Purpose | Writes |
46
56
  | --- | --- | --- |
47
- | Explorer Pass | map local project facts, commands, app entry points, existing docs | none |
57
+ | `planner` | map local project facts, commands, app entry points, existing docs, and initial decomposition | none |
48
58
  | `researcher` | product, ecosystem, dependency, and external context | none unless returning a docs patch |
49
59
  | `docs-researcher` | official docs, SDK/API versions, browser/tool limits | none unless returning a docs patch |
50
60
  | `architect` | boundaries, ports, data flow, state impact, migration risks | none unless returning a docs patch |
51
61
 
52
- Use local files first. Use web search, Tavily, TinyFish, GitHub, official docs, or user-provided links only when the decision needs current or external evidence. Record tool choice and limitations in `Harness/research/research-results.md` or `Harness/PLAN.md`.
62
+ Use local files first. Use web search, Tavily, TinyFish, GitHub, official docs, or user-provided links only when the decision needs current or external evidence. Record tool choice and limitations in `Harness/research/research-results.md` or `Harness/tasks/<task-id>/PLAN.md`.
53
63
 
54
64
  ## Subagent Orchestration
55
65
 
56
66
  Use `Harness/subagents.md` as the orchestration methodology and `Harness/dispatch.md` as the dispatch table protocol.
57
67
 
58
68
  - The main agent is the controller and owns synthesis, integration, and final verification.
69
+ - Subagents are readers and reporters. Only the main agent writes to task PROGRESS.md and PLAN.md. Subagents return PLAN patch suggestions which the main agent reviews before committing.
59
70
  - Parallelize read-only exploration; serialize writers unless write sets are disjoint and isolated.
60
71
  - Every subagent gets a dispatch pack with role, goal, read set, write set, forbidden scope, injected docs, evidence, stop condition, and return format.
61
72
  - After implementation, run spec review before code-quality or architecture review.
@@ -74,7 +85,7 @@ After exploration, synthesize:
74
85
  - verification path
75
86
  - rollback or recovery plan
76
87
 
77
- Write the result to `Harness/PLAN.md` before implementation.
88
+ Write the result to `Harness/tasks/<task-id>/PLAN.md` before implementation. Update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat`.
78
89
 
79
90
  ## Build And Review
80
91
 
@@ -101,20 +112,20 @@ For API changes, run the project API/integration test path or a documented real
101
112
 
102
113
  If verification fails:
103
114
 
104
- 1. Update `Harness/PLAN.md#Heartbeat` with failure count and blocker.
115
+ 1. Update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat` with failure count and blocker.
105
116
  2. Dispatch `debugger` with the failing command, error output, and smallest relevant files.
106
117
  3. Fix the smallest reproduced failure.
107
118
  4. Run reviewer again.
108
119
  5. Run verifier again.
109
120
  6. Repeat until verified or blocked by missing user input/external state.
110
121
 
111
- If the same failure class happens three times, stop blind fixes. Record evidence, likely root causes, attempted paths, and ask the user to choose among clear options.
122
+ If the same failure class happens three times, stop blind fixes. Before asking the user, dispatch `memory-master` to record the failure pattern, attempted paths, and root cause hypothesis to `Harness/memory/agent-lessons-patterns.md`. Then present evidence-backed options to the user.
112
123
 
113
124
  ## Heartbeat Protocol
114
125
 
115
126
  Heartbeat is a lightweight recovery protocol, not a background daemon.
116
127
 
117
- Update `Harness/PLAN.md#Heartbeat`:
128
+ Update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat`:
118
129
 
119
130
  - before a long command
120
131
  - after a long command
@@ -125,6 +136,8 @@ Update `Harness/PLAN.md#Heartbeat`:
125
136
 
126
137
  The agent may set the next beat interval by event instead of time, such as "after next test run", "after reviewer returns", or "after browser evidence is captured".
127
138
 
139
+ When context approaches ~85% of the window, dispatch `context-master` to analyze and append a compression suggestion to `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat`. The suggestion is non-blocking; the controller checks it at the next natural pause point.
140
+
128
141
  ## Closeout
129
142
 
130
143
  Close only when:
@@ -133,4 +146,9 @@ Close only when:
133
146
  - reviewer has no unresolved critical/high findings
134
147
  - test/API/browser evidence is recorded
135
148
  - affected Harness docs are synced
136
- - `Harness/PLAN.md#Heartbeat` says the task is verified or lists the exact next recovery action
149
+ - `context-master` has analyzed the session and extracted durable knowledge
150
+ - `memory-master` has consolidated extracted knowledge into `Harness/memory/*` and `Harness/MEMORY.md`
151
+ - Current task PROGRESS.md and PLAN.md are archived under `Harness/tasks/<task-id>/` with Phase set to Verified
152
+ - `Harness/PROGRESS.md` task index is updated (Closed column filled, Active Task cleared or set to next task)
153
+ - `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat` says the task is verified or lists the exact next recovery action
154
+ - `Harness/PROGRESS.md` task index reflects the closed task
@@ -5,16 +5,26 @@ Use when implementing, reviewing, debugging, or coordinating subagents.
5
5
  ## ReAct Loop
6
6
 
7
7
  ```text
8
- Observe -> Load minimal context -> Plan -> Act -> Verify -> Update Harness/PLAN.md
8
+ Observe -> Load minimal context -> Plan -> Act -> Verify -> Update Harness/tasks/<task-id>/PROGRESS.md
9
9
  ```
10
10
 
11
11
  If context grows, load [context-loading.md](context-loading.md) and split the work. If more than one agent is useful, load [subagents.md](subagents.md) and [dispatch.md](dispatch.md).
12
12
 
13
13
  ## Feature Packet
14
14
 
15
- Every PRD scope item (`research/PRD.md` Section 2) must have its own feature doc at `Harness/features/<name>.md` created from `Harness/features/_template.md`. One feature = one doc = one implementation unit. Do not code without a feature doc.
15
+ Every PRD scope item must be covered by a feature doc at `Harness/features/<name>.md`
16
+ created from `Harness/features/_template.md`. Do not code without a feature doc.
16
17
 
17
- Small scope is not an exception a short feature doc is better than none. If the work is truly too small for a full feature doc (single-file fix, no behavior change), it is not a PRD scope item.
18
+ **Cohesion rule**: if multiple PRD scope items share the same write set, the same
19
+ test/verification path, and the same review boundary, group them into a single
20
+ feature doc. The PRD owns scope decomposition; the feature doc owns the
21
+ implementation unit. The number of feature docs should reflect the number of
22
+ distinguishable implementation units, not the number of PRD checkboxes.
23
+
24
+ **Minimum bar**: a feature doc is still required when the implementation touches
25
+ more than one file or changes user-visible behavior. Only skip a feature doc
26
+ entirely when the work is a single-file fix with no behavior change — in that
27
+ case, record the change in `Harness/tasks/<task-id>/PLAN.md` instead.
18
28
 
19
29
  **New vs iterate**: if a PRD scope item has ≥85% overlap with an existing feature doc, open the existing doc, bump `Version`, and add a `## Changelog` entry. Only create a new file when the scope is substantially different. When unsure, ask.
20
30
 
@@ -58,16 +68,16 @@ Rules:
58
68
 
59
69
  ## Parallel Dispatch
60
70
 
61
- Use [subagents.md](subagents.md) and [dispatch.md](dispatch.md) for multi-agent work. Default to at most three active agents. Prefer parallel read-only work first, then serial writes.
71
+ Use [subagents.md](subagents.md) and [dispatch.md](dispatch.md) for multi-agent work. Default to at most three active agents (WF mode overrides this; see [WF.md](WF.md)). Prefer parallel read-only work first, then serial writes.
62
72
 
63
73
  Every dispatched agent returns the handoff format defined in [dispatch.md](dispatch.md).
64
74
 
65
75
  ## Conflict Rule
66
76
 
67
- If PRD, Harness/PLAN.md, architecture, ports, tests, or code disagree:
77
+ If PRD, task PLAN.md, architecture, ports, tests, or code disagree:
68
78
 
69
79
  1. stop implementation
70
- 2. record the conflict in `Harness/PLAN.md` or the feature doc
80
+ 2. record the conflict in `Harness/tasks/<task-id>/PROGRESS.md` or the feature doc
71
81
  3. choose the smallest reversible decision
72
82
  4. ask the maintainer when user-visible behavior or security is affected
73
83
 
@@ -79,4 +89,6 @@ Close only when:
79
89
  - verification evidence is recorded
80
90
  - architecture, ports, data-flow, or state docs are synced if affected
81
91
  - no unresolved critical/high review findings remain
82
- - `Harness/PLAN.md` states the final status or next iteration
92
+ - any optimistic UI mutation has a declared and verified rollback path
93
+ - any file declared as DONE in PLAN.md or PROGRESS.md exists on disk (chat output is not durable evidence)
94
+ - `Harness/tasks/<task-id>/PROGRESS.md` states the final status or next iteration
@@ -41,9 +41,33 @@
41
41
 
42
42
  ---
43
43
 
44
- ## 2. Harness Core Components
44
+ ## 2. Interface Decoupling
45
45
 
46
- ### 2.1 Runner / Loop
46
+ Use interfaces or ports to protect real boundaries, not to create abstraction for its own sake.
47
+
48
+ - Define a port when code crosses a layer, process, network, storage, SDK, browser, or permission boundary.
49
+ - Keep domain and application logic independent from infrastructure adapters.
50
+ - Pass data through explicit contracts instead of reaching into another feature's internals.
51
+ - Prefer direct calls inside the same cohesive module when there is only one caller, one implementation, and no boundary to protect.
52
+ - Avoid speculative abstraction: do not add factories, plugin systems, service locators, generic repositories, or config layers until the feature has a concrete second use or a real testability/replacement need.
53
+
54
+ ---
55
+
56
+ ## 3. State Design
57
+
58
+ State must have one owner, legal transitions, and observable recovery behavior.
59
+
60
+ - Identify durable state, runtime cache, derived UI state, external system state, and audit/event history separately.
61
+ - Name the owner of each state slice; do not let UI, application services, and infrastructure all mutate the same state directly.
62
+ - Model long-running workflows with explicit states, guards, and failure transitions in `Harness/state-machines.md`.
63
+ - Store resumable progress and recovery decisions in `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat` or project-owned durable storage, not only in chat.
64
+ - Keep state minimal: derive values when cheap, persist only what must survive reload, retry, or handoff.
65
+
66
+ ---
67
+
68
+ ## 4. Harness Core Components
69
+
70
+ ### 4.1 Runner / Loop
47
71
 
48
72
  - **Responsibility**: Drives a task from input to completion: loading context, calling application use-cases, handling stop conditions.
49
73
  - **Design Decision**:
@@ -51,28 +75,28 @@
51
75
  - Stop conditions are explicitly modeled — Rationale: prevents agent loops from running indefinitely or silently half-completing
52
76
  - **Does NOT handle**: Business rules, domain object creation details, external service implementations
53
77
 
54
- ### 2.2 Permission Policy
78
+ ### 4.2 Permission Policy
55
79
 
56
80
  - **Responsibility**: Decides whether a given tool, file, network, or external action is allowed to execute.
57
81
  - **Design Decision**:
58
82
  - High-risk actions are denied by default, allow rules are explicitly declared — Rationale: the platform must first guarantee security boundaries
59
83
  - **Does NOT handle**: Judging whether a business action is correct
60
84
 
61
- ### 2.3 Event Bus / Audit Trail
85
+ ### 4.3 Event Bus / Audit Trail
62
86
 
63
87
  - **Responsibility**: Records task lifecycle, tool invocations, failures, human approvals, and final results.
64
88
  - **Design Decision**:
65
89
  - Events are append-only, audit records cannot be overwritten in place — Rationale: facilitates replay, debugging, and post-mortem analysis
66
90
  - **Does NOT handle**: Saving final data on behalf of business systems
67
91
 
68
- ### 2.4 State / Checkpoint Store
92
+ ### 4.4 State / Checkpoint Store
69
93
 
70
94
  - **Responsibility**: Saves recoverable state, context summaries, task progress, and interrupt points.
71
95
  - **Design Decision**:
72
96
  - State format must be serializable — Rationale: enables replay, resume, testing, and migration
73
97
  - **Does NOT handle**: Long-term business database modeling
74
98
 
75
- ### 2.5 Tool Registry
99
+ ### 4.5 Tool Registry
76
100
 
77
101
  - **Responsibility**: Registers callable tools along with their input/output contracts, permission labels, and error semantics.
78
102
  - **Design Decision**:
@@ -81,7 +105,7 @@
81
105
 
82
106
  ---
83
107
 
84
- ## 3. Architectural Constraints (Non-Negotiable)
108
+ ## 5. Architectural Constraints (Non-Negotiable)
85
109
 
86
110
  - `domain/` only defines business models, business invariants, and port protocols; does not import `harness/`, `infrastructure/`, or `interfaces/`.
87
111
  - `harness/` may orchestrate workflows, security gates, auditing, and stop conditions, but must not determine business meaning.
@@ -6,9 +6,9 @@ Use when context is growing, subagents are needed, or an agent is unsure which h
6
6
 
7
7
  `Harness/README.md` is the primary router. This file is a secondary context-splitting protocol for subagents and long tasks.
8
8
 
9
- If this file and `Harness/README.md` disagree, follow `Harness/README.md`, record the assumption in `Harness/PLAN.md`, and update this file later.
9
+ If this file and `Harness/README.md` disagree, follow `Harness/README.md`, record the assumption in `Harness/tasks/<task-id>/PROGRESS.md`, and update this file later.
10
10
 
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/PLAN.md`, the current feature doc, `Harness/MEMORY.md`, or `Harness/memory/*` as appropriate.
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
13
  ## Main Context
14
14
 
@@ -17,7 +17,9 @@ Always keep:
17
17
  - `CLAUDE.md`
18
18
  - `Harness/MEMORY.md`
19
19
  - `Harness/README.md`
20
- - `Harness/PLAN.md` when active
20
+ - `Harness/PROGRESS.md` when active
21
+ - `Harness/tasks/<task-id>/PROGRESS.md` when active
22
+ - `Harness/tasks/<task-id>/PLAN.md` when active
21
23
  - current feature doc when active
22
24
 
23
25
  Load other docs only by trigger.
@@ -30,8 +32,8 @@ Load other docs only by trigger.
30
32
  | research, competitors, stack choice | `Harness/research/README.md`, `Harness/research/research-results.md` |
31
33
  | official docs, API, SDK, version, limits | `Harness/research/README.md`, `Harness/architecture.md`, `Harness/domain/ports.md` as needed |
32
34
  | layer, dependency, module boundary | `Harness/architecture.md`, `Harness/domain/ports.md` |
33
- | task split, owner, write set | `Harness/PLAN.md`, `Harness/agent-workflow.md` |
34
- | parallel agents, dispatch, worktree decision | `Harness/subagents.md`, `Harness/dispatch.md`, `Harness/PLAN.md` |
35
+ | task split, owner, write set | `Harness/tasks/<task-id>/PROGRESS.md`, `Harness/tasks/<task-id>/PLAN.md`, `Harness/agent-workflow.md` |
36
+ | parallel agents, dispatch, worktree decision | `Harness/subagents.md`, `Harness/dispatch.md`, `Harness/tasks/<task-id>/PLAN.md` |
35
37
  | memory, repeated tool failure, repeated user correction, reusable lesson | `Harness/MEMORY.md`, the relevant `Harness/memory/*.md` file |
36
38
  | event, retry, failure path | `Harness/data-flow.md` |
37
39
  | status, transition, resume | `Harness/state-machines.md` |
@@ -89,6 +91,16 @@ Verifier:
89
91
  - forbid: code changes
90
92
  - return: commands run, results, residual risk
91
93
 
94
+ Memory Master:
95
+ - inject: trigger reason, current failure/user-correction/closeout context, task PROGRESS.md section
96
+ - forbid: source code, unrelated Harness docs
97
+ - return: memory action summary, files written, cross-project flag
98
+
99
+ Context Master:
100
+ - inject: trigger reason (threshold % or closeout), current task PROGRESS.md, task phase
101
+ - forbid: source code, memory files, MEMORY.md writes
102
+ - return: context usage %, stale blocks, compressible blocks, durable knowledge candidates, compression suggestion
103
+
92
104
  ## Handoff Rule
93
105
 
94
106
  Only the subagent summary enters main context. If details are needed, load the named files directly instead of replaying the subagent conversation.
@@ -10,18 +10,19 @@ Use when work needs parallel reading, independent review, cross-layer analysis,
10
10
 
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
- - Important assumptions, decisions, blockers, evidence, and handoffs must be written to `Harness/PLAN.md`, the current feature doc, `Harness/MEMORY.md`, or `Harness/memory/*` as appropriate.
14
- - Prefer three or fewer active agents.
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
+ - Prefer three or fewer active agents (WF mode overrides this; see [WF.md](WF.md)).
15
15
  - Read-only agents may run in parallel.
16
16
  - Writing agents run serially unless write sets are disjoint.
17
17
  - Use a worktree when two agents may touch overlapping files or long-running branches.
18
18
  - Only summaries enter main context. Load named files directly when details are needed.
19
+ - Subagents read task files, return findings and PLAN patch suggestions. Only the main agent commits changes to PROGRESS.md and PLAN.md.
19
20
 
20
21
  ## Dispatch Loop
21
22
 
22
23
  ```text
23
24
  Goal
24
- -> Fill PLAN tasks and Parallel Dispatch
25
+ -> Fill task PROGRESS.md and PLAN.md
25
26
  -> Apply subagents.md efficiency ladder
26
27
  -> Run parallel read-only agents
27
28
  -> Main agent integrates findings
@@ -29,7 +30,7 @@ Goal
29
30
  -> Implementer makes bounded change
30
31
  -> Reviewer checks diff
31
32
  -> Verifier records evidence
32
- -> Main agent updates PLAN and closes or iterates
33
+ -> Main agent updates task files and closes or iterates
33
34
  ```
34
35
 
35
36
  ## Modes
@@ -54,6 +55,8 @@ Goal
54
55
  | `debugger` | Serial Write | smallest fix for a reproduced failure |
55
56
  | `reviewer` | Parallel Read | diff review, risks, missing tests |
56
57
  | `verifier` | Parallel Read | run checks and record evidence |
58
+ | `memory-master` | Serial Write | write/consolidate memory entries, dedup, cross-project extraction |
59
+ | `context-master` | Parallel Read | analyze context usage, recommend compression, extract session knowledge |
57
60
 
58
61
  ## Dispatch Rules
59
62
 
@@ -61,7 +64,7 @@ Goal
61
64
  - A write set of `none` means read-only.
62
65
  - If two write sets overlap, do not run those agents in parallel.
63
66
  - If an agent returns uncertainty, mark the row `Blocked` or add a follow-up row.
64
- - If docs, tests, and code disagree, stop implementation and record the conflict in `PLAN.md`.
67
+ - If docs, tests, and code disagree, stop implementation and record the conflict in `Harness/tasks/<task-id>/PROGRESS.md`.
65
68
 
66
69
  ## Handoff Format
67
70
 
@@ -81,7 +84,7 @@ PLAN patch:
81
84
  ```
82
85
 
83
86
  Use `Files changed: none` for read-only agents. Use `PLAN patch: none` when no state update is needed.
84
- If a handoff matters after context loss, write it to `Harness/PLAN.md`, the current feature doc, or `Harness/memory/*`; do not rely on chat transcript state.
87
+ If a handoff matters after context loss, write it to `Harness/tasks/<task-id>/PROGRESS.md`, `Harness/tasks/<task-id>/PLAN.md`, the current feature doc, or `Harness/memory/*`; do not rely on chat transcript state.
85
88
 
86
89
  ## Statuses
87
90
 
@@ -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, rules, and hooks 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/PLAN.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/subagents.md`, `Harness/context-loading.md`, `Harness/dispatch.md`, `Harness/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
@@ -55,10 +55,10 @@ Every added skill must state:
55
55
  - required inputs
56
56
  - allowed writes
57
57
  - output format
58
- - whether to update `Harness/PLAN.md`
58
+ - whether to update `Harness/PROGRESS.md` and task files
59
59
  - whether to use [subagents.md](subagents.md) and [dispatch.md](dispatch.md)
60
60
 
61
- Skills should extend the harness. They should not replace `Harness/README.md`, `PLAN.md`, `subagents.md`, `context-loading.md`, `dispatch.md`, or `agent-workflow.md`.
61
+ 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`.
62
62
 
63
63
  ## Rules
64
64
 
@@ -75,5 +75,5 @@ After adding assets:
75
75
  - list agents in `Harness/MEMORY.md#Agents`
76
76
  - list skills in `Harness/MEMORY.md#Skills`
77
77
  - list workflows by path in `Harness/MEMORY.md` or `Harness/README.md`
78
- - update `Harness/PLAN.md` when the asset affects current work
78
+ - update `Harness/PROGRESS.md` and `Harness/tasks/<task-id>/PROGRESS.md` when the asset affects current work
79
79
  - run `node Harness/scripts/validate-harness.mjs`
@@ -10,10 +10,10 @@ Use when starting a new product, clarifying a vague idea, or deciding the next p
10
10
  | Research | problem and constraints | `research/research-results.md` | `research/README.md` followed; at least 3 references or explicit reason not possible |
11
11
  | PRD | research decision | `research/PRD.md` | MVP, non-goals, acceptance criteria are verifiable |
12
12
  | Architecture | PRD | `Harness/architecture.md`, `Harness/domain/ports.md` | boundaries and first ports are defined |
13
- | Plan | PRD and architecture | `Harness/PLAN.md`, optional `Harness/dispatch.md`, one `Harness/features/<name>.md` per PRD scope item | tasks have owners, write sets, verification |
13
+ | Plan | PRD and architecture | `Harness/PROGRESS.md`, `Harness/tasks/<task-id>/PLAN.md`, optional `Harness/dispatch.md`, one `Harness/features/<name>.md` per PRD scope item | tasks have owners, write sets, verification |
14
14
  | Build | plan and tests | minimal vertical slice | tests or manual checks prove behavior |
15
15
  | Verify | implementation | review findings, test evidence | no unresolved critical/high findings |
16
- | Feedback | verified slice | next iteration or release decision | learnings recorded in PRD, PLAN, or MEMORY |
16
+ | Feedback | verified slice | next iteration or release decision | learnings recorded in PRD, `Harness/tasks/<task-id>/PROGRESS.md`, or MEMORY |
17
17
 
18
18
  ## Operating Rules
19
19
 
@@ -10,6 +10,14 @@
10
10
 
11
11
  Fill out each stateful component using this format:
12
12
 
13
+ Before defining states, name the state owner and persistence level. State that crosses agent handoff, retry, browser session, API workflow, or release boundary must have explicit transitions; temporary derived state should stay local and should not become a new state machine.
14
+
15
+ ### State Ownership
16
+
17
+ | State Slice | Owner | Persistence | Notes |
18
+ | --- | --- | --- | --- |
19
+ | `{{STATE_SLICE}}` | `{{OWNER}}` | durable / runtime / derived / external | {{NOTES}} |
20
+
13
21
  ### State Enumeration
14
22
 
15
23
  | State | Description | Entry Condition | Exit Condition |