create-harness-vibe-coding 0.1.9 → 0.2.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 (57) hide show
  1. package/README.md +177 -32
  2. package/package.json +5 -2
  3. package/src/generator.js +407 -53
  4. package/src/index.js +236 -22
  5. package/templates/common/.claude/agents/architect.md +4 -4
  6. package/templates/common/.claude/agents/debugger.md +1 -1
  7. package/templates/common/.claude/agents/docs-researcher.md +4 -4
  8. package/templates/common/.claude/agents/implementer.md +1 -1
  9. package/templates/common/.claude/agents/planner.md +3 -3
  10. package/templates/common/.claude/agents/researcher.md +4 -4
  11. package/templates/common/.claude/agents/reviewer.md +1 -1
  12. package/templates/common/.claude/agents/test-writer.md +2 -2
  13. package/templates/common/.claude/agents/verifier.md +1 -1
  14. package/templates/common/.claude/commands/wf.md +18 -0
  15. package/templates/common/.claude/rules/ecc/common.md +16 -6
  16. package/templates/common/.claude/skills/harness-build-loop/SKILL.md +4 -3
  17. package/templates/common/.claude/skills/harness-context/SKILL.md +4 -3
  18. package/templates/common/.claude/skills/harness-lifecycle/SKILL.md +3 -3
  19. package/templates/common/.claude/skills/harness-research/SKILL.md +4 -4
  20. package/templates/common/.claude/skills/harness-router/SKILL.md +7 -5
  21. package/templates/common/.claude/skills/readme-optimizer/SKILL.md +48 -0
  22. package/templates/common/.claude/skills/subagent-orchestrator/SKILL.md +36 -0
  23. package/templates/common/.claude/skills/wf-mode/SKILL.md +48 -0
  24. package/templates/common/AGENTS.md +2 -2
  25. package/templates/common/CLAUDE.md +39 -71
  26. package/templates/common/MEMORY.md +42 -33
  27. package/templates/common/README.md +41 -0
  28. package/templates/common/SETUP.md +149 -41
  29. package/templates/common/docs/README.md +72 -47
  30. package/templates/common/docs/domain/ports.md +1 -1
  31. package/templates/common/docs/features/_template.md +20 -10
  32. package/templates/common/docs/harness/PLAN.md +25 -2
  33. package/templates/common/docs/harness/WF.md +136 -0
  34. package/templates/common/docs/harness/agent-workflow.md +8 -8
  35. package/templates/common/docs/harness/context-loading.md +17 -14
  36. package/templates/common/docs/harness/data-flow.md +1 -1
  37. package/templates/common/docs/harness/dispatch.md +6 -0
  38. package/templates/common/docs/harness/extension.md +20 -8
  39. package/templates/common/docs/harness/lifecycle.md +2 -2
  40. package/templates/common/docs/harness/subagents.md +140 -0
  41. package/templates/common/docs/research/PRD.md +1 -1
  42. package/templates/common/docs/research/README.md +5 -5
  43. package/templates/common/memory/agent-lessons-patterns.md +21 -0
  44. package/templates/common/memory/tool-usage-reflections.md +21 -0
  45. package/templates/common/memory/user-corrections-preferences.md +21 -0
  46. package/templates/common/scripts/validate-harness.mjs +217 -46
  47. package/templates/optional/catalog.json +43 -0
  48. package/templates/optional/skills/browser-e2e/.claude/skills/browser-e2e/SKILL.md +42 -0
  49. package/templates/optional/skills/browser-e2e/docs/workflows/browser-e2e.md +42 -0
  50. package/templates/optional/skills/github-pr-review/.claude/skills/github-pr-review/SKILL.md +40 -0
  51. package/templates/optional/skills/github-pr-review/docs/workflows/github-pr-review.md +28 -0
  52. package/templates/optional/skills/python-backend/.claude/skills/python-backend/SKILL.md +40 -0
  53. package/templates/optional/skills/python-backend/docs/workflows/python-backend.md +34 -0
  54. package/templates/optional/skills/ts-react-frontend/.claude/skills/ts-react-frontend/SKILL.md +43 -0
  55. package/templates/optional/skills/ts-react-frontend/docs/workflows/ts-react-frontend.md +35 -0
  56. package/templates/optional/skills/ui-ux-review/.claude/skills/ui-ux-review/SKILL.md +40 -0
  57. package/templates/optional/skills/ui-ux-review/docs/workflows/ui-ux-review.md +26 -0
@@ -0,0 +1,136 @@
1
+ # WF Mode - Long Task Workflow
2
+
3
+ Use this when work is long, difficult, uncertain, multi-file, multi-agent, or user-triggered with `/wf`, `wf mode`, or `workflow mode`.
4
+
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
+
7
+ ## Trigger
8
+
9
+ Enter WF mode when any of these are true:
10
+
11
+ - The user explicitly says `/wf`, `wf mode`, or asks for the full workflow.
12
+ - The task needs more than one step, more than three files, or more than one subsystem.
13
+ - The task needs research, architecture judgment, browser/API validation, or migration planning.
14
+ - Confidence in intent, architecture, or implementation is below 95%.
15
+ - The same command, test, tool, or approach fails twice.
16
+
17
+ ## WF Loop
18
+
19
+ ```text
20
+ Intake
21
+ -> confidence gate
22
+ -> parallel explorer / researcher / docs-researcher / architect passes
23
+ -> synthesis
24
+ -> second plan
25
+ -> test-writer
26
+ -> implementer
27
+ -> reviewers
28
+ -> verifier
29
+ -> if failed: debugger -> review -> e2e/API verification -> loop
30
+ -> close with evidence
31
+ ```
32
+
33
+ ## Intake
34
+
35
+ 1. Read `CLAUDE.md`, `Harness/MEMORY.md`, `Harness/README.md`, and `Harness/PLAN.md`.
36
+ 2. State the goal, non-goals, confidence level, known risks, and write boundaries.
37
+ 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.
40
+
41
+ ## Exploration
42
+
43
+ Use parallel read-only passes first. Prefer three or fewer active agents.
44
+
45
+ | Agent | Purpose | Writes |
46
+ | --- | --- | --- |
47
+ | Explorer Pass | map local project facts, commands, app entry points, existing docs | none |
48
+ | `researcher` | product, ecosystem, dependency, and external context | none unless returning a docs patch |
49
+ | `docs-researcher` | official docs, SDK/API versions, browser/tool limits | none unless returning a docs patch |
50
+ | `architect` | boundaries, ports, data flow, state impact, migration risks | none unless returning a docs patch |
51
+
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`.
53
+
54
+ ## Subagent Orchestration
55
+
56
+ Use `Harness/subagents.md` as the orchestration methodology and `Harness/dispatch.md` as the dispatch table protocol.
57
+
58
+ - The main agent is the controller and owns synthesis, integration, and final verification.
59
+ - Parallelize read-only exploration; serialize writers unless write sets are disjoint and isolated.
60
+ - Every subagent gets a dispatch pack with role, goal, read set, write set, forbidden scope, injected docs, evidence, stop condition, and return format.
61
+ - After implementation, run spec review before code-quality or architecture review.
62
+ - If subagents are unavailable, emulate the same roles as bounded passes and record the fallback.
63
+
64
+ ## Second Plan
65
+
66
+ After exploration, synthesize:
67
+
68
+ - facts found
69
+ - assumptions
70
+ - risks
71
+ - accepted/rejected options
72
+ - tasks
73
+ - read/write sets
74
+ - verification path
75
+ - rollback or recovery plan
76
+
77
+ Write the result to `Harness/PLAN.md` before implementation.
78
+
79
+ ## Build And Review
80
+
81
+ 1. `test-writer` defines a failing test or written manual check first.
82
+ 2. `implementer` changes only the declared write set.
83
+ 3. At least one `reviewer` checks diff, architecture, risks, and missing tests.
84
+ 4. For cross-layer or risky work, run separate reviewers for architecture and test adequacy.
85
+ 5. `verifier` runs the declared checks and records exact evidence.
86
+
87
+ ## Browser And API Evidence
88
+
89
+ For browser-visible changes, typecheck/build/unit tests are not enough. Use Chrome DevTools, CDP, Playwright, or a documented real-browser run:
90
+
91
+ - start the app and record URL/port
92
+ - click through the critical flow
93
+ - capture frontend console/runtime errors
94
+ - capture failed network requests
95
+ - collect backend logs when the flow crosses an API
96
+ - record screenshot, trace, video, or manual evidence path
97
+
98
+ For API changes, run the project API/integration test path or a documented real request against a local service and record request, response, logs, and failure behavior.
99
+
100
+ ## Recovery Loop
101
+
102
+ If verification fails:
103
+
104
+ 1. Update `Harness/PLAN.md#Heartbeat` with failure count and blocker.
105
+ 2. Dispatch `debugger` with the failing command, error output, and smallest relevant files.
106
+ 3. Fix the smallest reproduced failure.
107
+ 4. Run reviewer again.
108
+ 5. Run verifier again.
109
+ 6. Repeat until verified or blocked by missing user input/external state.
110
+
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.
112
+
113
+ ## Heartbeat Protocol
114
+
115
+ Heartbeat is a lightweight recovery protocol, not a background daemon.
116
+
117
+ Update `Harness/PLAN.md#Heartbeat`:
118
+
119
+ - before a long command
120
+ - after a long command
121
+ - before spawning subagents
122
+ - after integrating subagent returns
123
+ - after each failed verification
124
+ - before stopping for user input
125
+
126
+ 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
+
128
+ ## Closeout
129
+
130
+ Close only when:
131
+
132
+ - acceptance criteria are satisfied
133
+ - reviewer has no unresolved critical/high findings
134
+ - test/API/browser evidence is recorded
135
+ - affected Harness docs are synced
136
+ - `Harness/PLAN.md#Heartbeat` says the task is verified or lists the exact next recovery action
@@ -5,14 +5,14 @@ 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 docs/harness/PLAN.md
8
+ Observe -> Load minimal context -> Plan -> Act -> Verify -> Update Harness/PLAN.md
9
9
  ```
10
10
 
11
- If context grows, load [context-loading.md](context-loading.md) and split the work. If more than one agent is useful, load [dispatch.md](dispatch.md).
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 `docs/features/<name>.md` created from `docs/features/_template.md`. One feature = one doc = one implementation unit. Do not code without a feature doc.
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.
16
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
18
 
@@ -32,7 +32,7 @@ PRD/feature packet
32
32
 
33
33
  ## Subagent Use
34
34
 
35
- Use subagents when a task needs broad reading, parallel work, cross-layer changes, independent review, or isolated debugging.
35
+ Use subagents when a task needs broad reading, parallel work, cross-layer changes, independent review, or isolated debugging. Follow [subagents.md](subagents.md) for controller-led orchestration and [dispatch.md](dispatch.md) for the dispatch table.
36
36
 
37
37
  Before spawn, define:
38
38
 
@@ -58,16 +58,16 @@ Rules:
58
58
 
59
59
  ## Parallel Dispatch
60
60
 
61
- Use [dispatch.md](dispatch.md) for multi-agent work. Default to at most three active agents. Prefer parallel read-only work first, then serial writes.
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.
62
62
 
63
63
  Every dispatched agent returns the handoff format defined in [dispatch.md](dispatch.md).
64
64
 
65
65
  ## Conflict Rule
66
66
 
67
- If PRD, docs/harness/PLAN.md, architecture, ports, tests, or code disagree:
67
+ If PRD, Harness/PLAN.md, architecture, ports, tests, or code disagree:
68
68
 
69
69
  1. stop implementation
70
- 2. record the conflict in `docs/harness/PLAN.md` or the feature doc
70
+ 2. record the conflict in `Harness/PLAN.md` or the feature doc
71
71
  3. choose the smallest reversible decision
72
72
  4. ask the maintainer when user-visible behavior or security is affected
73
73
 
@@ -79,4 +79,4 @@ Close only when:
79
79
  - verification evidence is recorded
80
80
  - architecture, ports, data-flow, or state docs are synced if affected
81
81
  - no unresolved critical/high review findings remain
82
- - `docs/harness/PLAN.md` states the final status or next iteration
82
+ - `Harness/PLAN.md` states the final status or next iteration
@@ -4,18 +4,20 @@ Use when context is growing, subagents are needed, or an agent is unsure which h
4
4
 
5
5
  ## Routing Authority
6
6
 
7
- `docs/README.md` is the primary router. This file is a secondary context-splitting protocol for subagents and long tasks.
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 `docs/README.md` disagree, follow `docs/README.md`, record the assumption in `docs/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/PLAN.md`, and update this file later.
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.
10
12
 
11
13
  ## Main Context
12
14
 
13
15
  Always keep:
14
16
 
15
17
  - `CLAUDE.md`
16
- - `MEMORY.md`
17
- - `docs/README.md`
18
- - `docs/harness/PLAN.md` when active
18
+ - `Harness/MEMORY.md`
19
+ - `Harness/README.md`
20
+ - `Harness/PLAN.md` when active
19
21
  - current feature doc when active
20
22
 
21
23
  Load other docs only by trigger.
@@ -24,15 +26,16 @@ Load other docs only by trigger.
24
26
 
25
27
  | Trigger | Load |
26
28
  | --- | --- |
27
- | idea, scope, MVP | `docs/harness/lifecycle.md`, `docs/research/PRD.md` |
28
- | research, competitors, stack choice | `docs/research/README.md`, `docs/research/research-results.md` |
29
- | official docs, API, SDK, version, limits | `docs/research/README.md`, `docs/harness/architecture.md`, `docs/domain/ports.md` as needed |
30
- | layer, dependency, module boundary | `docs/harness/architecture.md`, `docs/domain/ports.md` |
31
- | task split, owner, write set | `docs/harness/PLAN.md`, `docs/harness/agent-workflow.md` |
32
- | parallel agents, dispatch, worktree decision | `docs/harness/dispatch.md`, `docs/harness/PLAN.md` |
33
- | event, retry, failure path | `docs/harness/data-flow.md` |
34
- | status, transition, resume | `docs/harness/state-machines.md` |
35
- | subagent spawn | this file plus the role pack below |
29
+ | idea, scope, MVP | `Harness/lifecycle.md`, `Harness/research/PRD.md` |
30
+ | research, competitors, stack choice | `Harness/research/README.md`, `Harness/research/research-results.md` |
31
+ | official docs, API, SDK, version, limits | `Harness/research/README.md`, `Harness/architecture.md`, `Harness/domain/ports.md` as needed |
32
+ | 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
+ | memory, repeated tool failure, repeated user correction, reusable lesson | `Harness/MEMORY.md`, the relevant `Harness/memory/*.md` file |
36
+ | event, retry, failure path | `Harness/data-flow.md` |
37
+ | status, transition, resume | `Harness/state-machines.md` |
38
+ | subagent spawn | `Harness/subagents.md`, this file plus the role pack below |
36
39
 
37
40
  ## Subagent Packs
38
41
 
@@ -1,7 +1,7 @@
1
1
  # Data Flow — {{projectName}}
2
2
 
3
3
  > **Purpose**: Define the complete lifecycle of each event/request — happy path + all failure branches.
4
- > **This is the most important file in the entire docs folder** — what AI most often invents during implementation is failure-path behavior. Write it clearly and it won't.
4
+ > **This is the most important runtime-flow file in `Harness/`** — what AI most often invents during implementation is failure-path behavior. Write it clearly and it won't.
5
5
  >
6
6
  > Philosophy source: EventCatalog pattern + arc42 Chapter 6 (Runtime View).
7
7
 
@@ -2,11 +2,15 @@
2
2
 
3
3
  Purpose: coordinate a small set of subagents without building a scheduler.
4
4
 
5
+ Use [subagents.md](subagents.md) for orchestration strategy. Use this file for the dispatch table, handoff format, and status protocol.
6
+
5
7
  Use when work needs parallel reading, independent review, cross-layer analysis, or more than one bounded implementation pass.
6
8
 
7
9
  ## Principles
8
10
 
9
11
  - Main agent owns the final decision, integration, and verification.
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.
10
14
  - Prefer three or fewer active agents.
11
15
  - Read-only agents may run in parallel.
12
16
  - Writing agents run serially unless write sets are disjoint.
@@ -18,6 +22,7 @@ Use when work needs parallel reading, independent review, cross-layer analysis,
18
22
  ```text
19
23
  Goal
20
24
  -> Fill PLAN tasks and Parallel Dispatch
25
+ -> Apply subagents.md efficiency ladder
21
26
  -> Run parallel read-only agents
22
27
  -> Main agent integrates findings
23
28
  -> Test Writer defines failing test or manual check
@@ -76,6 +81,7 @@ PLAN patch:
76
81
  ```
77
82
 
78
83
  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.
79
85
 
80
86
  ## Statuses
81
87
 
@@ -4,6 +4,17 @@ Purpose: keep stack-specific agents, skills, rules, and hooks compatible with th
4
4
 
5
5
  Use during setup whenever adding assets from ECC, SuperClaude, toolboxes, or local project conventions.
6
6
 
7
+ ## Non-Invasive Extension Rules
8
+
9
+ Extensions must preserve project and harness ownership boundaries.
10
+
11
+ - Preserve existing `.claude/`, `CLAUDE.md`, `AGENTS.md`, `.gitignore`, `Harness/README.md`, `Harness/workflows/*.md`, settings, hooks, and local rules unless the user explicitly requests an overwrite.
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
+ - Register added agents, skills, workflows, rules, and hooks in `Harness/MEMORY.md` and this docs router where applicable.
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.
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
+
7
18
  ## Agent Contract
8
19
 
9
20
  Every added agent must have frontmatter:
@@ -33,7 +44,7 @@ Agent body must state:
33
44
  - allowed write set or read-only
34
45
  - forbidden scope
35
46
  - verification or evidence
36
- - return format from [dispatch.md](dispatch.md)
47
+ - return format from [subagents.md](subagents.md) and [dispatch.md](dispatch.md)
37
48
 
38
49
  ## Skill Contract
39
50
 
@@ -44,10 +55,10 @@ Every added skill must state:
44
55
  - required inputs
45
56
  - allowed writes
46
57
  - output format
47
- - whether to update `docs/harness/PLAN.md`
48
- - whether to use [dispatch.md](dispatch.md)
58
+ - whether to update `Harness/PLAN.md`
59
+ - whether to use [subagents.md](subagents.md) and [dispatch.md](dispatch.md)
49
60
 
50
- Skills should extend the harness. They should not replace `docs/README.md`, `PLAN.md`, `context-loading.md`, `dispatch.md`, or `agent-workflow.md`.
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`.
51
62
 
52
63
  ## Rules
53
64
 
@@ -61,7 +72,8 @@ Skills should extend the harness. They should not replace `docs/README.md`, `PLA
61
72
 
62
73
  After adding assets:
63
74
 
64
- - list agents in `MEMORY.md#Agents`
65
- - list skills in `MEMORY.md#Skills`
66
- - update `docs/harness/PLAN.md` when the asset affects current work
67
- - run `node scripts/validate-harness.mjs`
75
+ - list agents in `Harness/MEMORY.md#Agents`
76
+ - list skills in `Harness/MEMORY.md#Skills`
77
+ - list workflows by path in `Harness/MEMORY.md` or `Harness/README.md`
78
+ - update `Harness/PLAN.md` when the asset affects current work
79
+ - run `node Harness/scripts/validate-harness.mjs`
@@ -9,8 +9,8 @@ Use when starting a new product, clarifying a vague idea, or deciding the next p
9
9
  | Idea | user intent | problem, target user, non-goals | unclear points asked or assumptions recorded |
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
- | Architecture | PRD | `harness/architecture.md`, `domain/ports.md` | boundaries and first ports are defined |
13
- | Plan | PRD and architecture | `docs/harness/PLAN.md`, optional `docs/harness/dispatch.md`, one `docs/features/<name>.md` per PRD scope item | tasks have owners, write sets, verification |
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 |
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
16
  | Feedback | verified slice | next iteration or release decision | learnings recorded in PRD, PLAN, or MEMORY |
@@ -0,0 +1,140 @@
1
+ # Subagent Orchestration
2
+
3
+ Purpose: coordinate subagents for speed without losing control of scope, evidence, or integration.
4
+
5
+ Use this file when work needs multiple roles, parallel reading, independent review, broad context, repeated failures, or `/wf`.
6
+
7
+ 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.
8
+
9
+ ## Source Attribution
10
+
11
+ This harness distills ideas from these sources. Keep the protocol local and conservative; do not import external runtimes by default.
12
+
13
+ | Source | Found By | Adopted Idea |
14
+ | --- | --- | --- |
15
+ | `superpowers:dispatching-parallel-agents` | local skill | Dispatch one agent per independent problem domain; give focused scope and exact context. |
16
+ | `superpowers:subagent-driven-development` | local skill | Fresh implementer per task; spec review before code-quality review; handle `DONE`, `DONE_WITH_CONCERNS`, `NEEDS_CONTEXT`, and `BLOCKED`. |
17
+ | [`flc1125/skills@subagent-orchestrator`](https://skills.sh/flc1125/skills/subagent-orchestrator) | `npx skills find "subagent orchestration"` | Explicit subagent invocation, role-specific prompts, tool permission awareness. |
18
+ | [`davila7/claude-code-templates@parallel-agents`](https://skills.sh/davila7/claude-code-templates/parallel-agents) | `npx skills find "parallel agents"` | Discovery -> domain agents -> synthesis; one unified synthesis instead of scattered reports. |
19
+ | [`ruvnet/ruflo@agent-workflow`](https://skills.sh/ruvnet/ruflo/agent-workflow) | `npx skills find "agent workflow"` | Workflow thinking: triggers, agent assignments, parallel processing, and stateful handoffs. |
20
+ | [`pcvelz/superpowers@subagent-driven-development`](https://skills.sh/pcvelz/superpowers/subagent-driven-development) | `npx skills find "subagent driven development"` | Implementer plus review gates for spec compliance and code quality. |
21
+ | [`oimiragieo/agent-studio`](https://skills.sh/oimiragieo/agent-studio/dispatching-parallel-agents) | Skills CLI / public docs | Router-subordinate architecture and durable handoff discipline. |
22
+ | [`subagent-orchestration-skill`](https://skills.rest/rjtaryn/skills/subagent-orchestration-skill) | public docs | Multi-stage executor, spec reviewer, code reviewer, circuit breaker, and escalation pattern. |
23
+
24
+ ## Controller Role
25
+
26
+ The main agent is the controller. It owns:
27
+
28
+ - intent confidence and user questions
29
+ - task decomposition
30
+ - read/write set boundaries
31
+ - dispatch table in `Harness/PLAN.md`
32
+ - integration of returned summaries
33
+ - final verification and closeout
34
+
35
+ Subagents provide bounded work. They do not own final scope, architecture, release claims, or user-facing decisions.
36
+
37
+ ## Efficiency Ladder
38
+
39
+ Choose the cheapest coordination level that is safe.
40
+
41
+ | Level | Use When | Pattern |
42
+ | --- | --- | --- |
43
+ | Solo pass | one file, low risk, clear intent | no subagent |
44
+ | Single reviewer | small change with meaningful risk | implement, then reviewer |
45
+ | Parallel read-only | broad reading, research, architecture, multiple independent failures | 2-3 read-only agents |
46
+ | Serial build lane | normal feature or fix | test-writer -> implementer -> reviewers -> verifier |
47
+ | Isolated lanes | disjoint write sets or competing approaches | separate worktrees, then review and merge |
48
+
49
+ Default: at most three active subagents. More agents increase coordination cost and conflict risk.
50
+
51
+ ## WF Orchestration Shape
52
+
53
+ ```text
54
+ controller intake
55
+ -> parallel explorer/researcher/docs-researcher/architect passes
56
+ -> controller synthesis
57
+ -> second plan with dependencies and write sets
58
+ -> test-writer
59
+ -> implementer
60
+ -> spec reviewer
61
+ -> code/architecture reviewer
62
+ -> verifier
63
+ -> if failed: debugger/fixer -> review -> verify -> loop
64
+ -> close with evidence
65
+ ```
66
+
67
+ Use this shape for `/wf`, long tasks, multi-file changes, architecture work, migrations, browser/API behavior, or repeated failures.
68
+
69
+ ## Dispatch Pack
70
+
71
+ Every subagent dispatch must be self-contained:
72
+
73
+ ```text
74
+ Role:
75
+ Goal:
76
+ Mode: read-only | write
77
+ Read set:
78
+ Write set:
79
+ Forbidden scope:
80
+ Injected docs:
81
+ Dependencies:
82
+ Expected evidence:
83
+ Stop condition:
84
+ Return format:
85
+ ```
86
+
87
+ Do not make a subagent rediscover the entire project or read the whole harness. Inject only the docs selected by `Harness/README.md` and `Harness/context-loading.md`.
88
+
89
+ ## Parallelism Rules
90
+
91
+ - Read-only agents may run in parallel.
92
+ - Writing agents run serially unless write sets are disjoint and the controller has chosen an isolated worktree.
93
+ - Reviewers may run in parallel after implementation, but spec compliance is evaluated before code-quality approval.
94
+ - Do not let two agents edit `Harness/PLAN.md`, `Harness/MEMORY.md`, or `Harness/memory/*` concurrently. The controller writes durable state.
95
+ - If two agents disagree, the controller records the conflict in `Harness/PLAN.md` and chooses the smallest reversible next step.
96
+
97
+ ## Review Gates
98
+
99
+ Implementation is not complete until both gates pass:
100
+
101
+ 1. **Spec review**: confirms the result matches the user request, PRD, feature doc, acceptance criteria, and non-goals. Extra features are failures.
102
+ 2. **Code-quality review**: checks correctness, maintainability, architecture, tests, security, and integration risk.
103
+
104
+ If either reviewer finds issues, the implementer or debugger fixes them and the same gate runs again. Do not move to verifier with open critical/high findings.
105
+
106
+ ## Subagent Status Handling
107
+
108
+ | Status | Controller Action |
109
+ | --- | --- |
110
+ | `DONE` | start review gates |
111
+ | `DONE_WITH_CONCERNS` | read concerns, decide whether to address before review, record in `PLAN.md` |
112
+ | `NEEDS_CONTEXT` | provide only missing context and re-dispatch |
113
+ | `BLOCKED` | change something: add context, split task, upgrade reasoning, use debugger, or ask user |
114
+
115
+ Never retry the same failed prompt unchanged.
116
+
117
+ ## Failure Recovery
118
+
119
+ - First failed verification: record evidence, dispatch debugger with the smallest reproduced failure.
120
+ - Second same-class failure: narrow scope, update `PLAN.md#Heartbeat`, and add a reviewer before another fix.
121
+ - Third same-class failure: stop blind fixes. Present evidence-backed options to the user.
122
+
123
+ The recovery loop must preserve the same evidence standard as the main workflow: real commands, real browser/API checks when applicable, and recorded logs or artifacts.
124
+
125
+ ## Synthesis Output
126
+
127
+ After subagents return, the controller writes one synthesis into `Harness/PLAN.md`:
128
+
129
+ ```text
130
+ Agents used:
131
+ Findings accepted:
132
+ Findings rejected:
133
+ Conflicts:
134
+ Decisions:
135
+ Next write set:
136
+ Verification path:
137
+ Residual risk:
138
+ ```
139
+
140
+ Only the synthesis and named files enter main context. Do not replay full subagent conversations.
@@ -15,7 +15,7 @@
15
15
 
16
16
  ### v0.1 Must Be Able To
17
17
 
18
- > Each item below must be split into a separate `docs/features/<name>.md` created from `docs/features/_template.md` before implementation begins. One feature = one doc = one implementation unit.
18
+ > Each item below must be split into a separate `Harness/features/<name>.md` created from `Harness/features/_template.md` before implementation begins. One feature = one doc = one implementation unit.
19
19
 
20
20
  - [ ] {{MUST_1}}
21
21
  - [ ] {{MUST_2}}
@@ -6,7 +6,7 @@ Purpose: guide agent research. Record conclusions in [research-results.md](resea
6
6
 
7
7
  Use this before PRD, stack choice, external API use, public dependency choice, pricing/legal/security assumptions, or any fact likely to change.
8
8
 
9
- Skip only when the task is local, narrow, and fully answerable from existing project files. Record the skip reason in `docs/harness/PLAN.md`.
9
+ Skip only when the task is local, narrow, and fully answerable from existing project files. Record the skip reason in `Harness/PLAN.md`.
10
10
 
11
11
  ## Research Agent
12
12
 
@@ -21,7 +21,7 @@ Built-in agents:
21
21
  - `.claude/agents/researcher.md`: product, market, open-source, dependency, pricing, policy, and ecosystem research.
22
22
  - `.claude/agents/docs-researcher.md`: official docs, API, SDK, config, limits, errors, and examples verification.
23
23
 
24
- For multi-agent research plus build work, create the dispatch table in `docs/harness/PLAN.md` and follow `docs/harness/dispatch.md`.
24
+ For multi-agent research plus build work, create the dispatch table in `Harness/PLAN.md` and follow `Harness/dispatch.md`.
25
25
 
26
26
  Research Agent input:
27
27
 
@@ -104,14 +104,14 @@ Use these patterns when turning research into PRD or feature docs:
104
104
 
105
105
  ## Write Target
106
106
 
107
- - Research process, queries, and limitations: this file or `docs/harness/PLAN.md`.
107
+ - Research process, queries, and limitations: this file or `Harness/PLAN.md`.
108
108
  - Final research decisions: [research-results.md](research-results.md).
109
109
  - Product scope: [PRD.md](PRD.md).
110
- - Architecture consequences: `docs/harness/architecture.md` and `docs/domain/ports.md`.
110
+ - Architecture consequences: `Harness/architecture.md` and `Harness/domain/ports.md`.
111
111
 
112
112
  ## Architecture Decision References
113
113
 
114
- When filling `docs/harness/architecture.md`, `docs/domain/ports.md`, and `docs/research/research-results.md`, use these high-trust sources as starting points. Search within them; do not read them whole.
114
+ When filling `Harness/architecture.md`, `Harness/domain/ports.md`, and `Harness/research/research-results.md`, use these high-trust sources as starting points. Search within them; do not read them whole.
115
115
 
116
116
  ### System Design & Architecture Patterns
117
117
 
@@ -0,0 +1,21 @@
1
+ # Agent Lessons And Patterns
2
+
3
+ Purpose: record reusable lessons from review, debugging, validation, and handoff loops.
4
+
5
+ Write here when:
6
+ - A review/debug loop reveals a reusable prevention pattern.
7
+ - A validation failure exposes a missing regression check.
8
+ - A handoff, dispatch, or context-loading pattern should be repeated or avoided.
9
+
10
+ Entry format, newest first:
11
+
12
+ ```markdown
13
+ ## YYYY-MM-DD - Short Lesson Name
14
+
15
+ - Lesson: the reusable pattern.
16
+ - Source: review finding, debug loop, failed verification, or handoff.
17
+ - Apply when: the task shape or files where this matters.
18
+ - Regression guard: test, validator check, docs update, or manual evidence to keep it from recurring.
19
+ ```
20
+
21
+ Keep entries lightweight and actionable. Avoid secrets and speculative lessons.
@@ -0,0 +1,21 @@
1
+ # Tool Usage Reflections
2
+
3
+ Purpose: record repeated tool failures, better command patterns, and environment-specific fixes.
4
+
5
+ Write here when:
6
+ - The same tool/use pattern fails 3+ times in one task or across repeated tasks.
7
+ - A more reliable command pattern replaces a brittle one.
8
+ - The environment needs a durable fix, flag, path rule, shell syntax, or startup sequence.
9
+
10
+ Entry format, newest first:
11
+
12
+ ```markdown
13
+ ## YYYY-MM-DD - Short Pattern Name
14
+
15
+ - Trigger: what failed or repeated.
16
+ - Better pattern: the command, tool usage, or sequence to use next time.
17
+ - Evidence: command output summary, error text, or affected environment.
18
+ - Scope: when this applies and when it does not.
19
+ ```
20
+
21
+ Keep entries concise. Do not record secrets, credentials, private tokens, or one-off noise.
@@ -0,0 +1,21 @@
1
+ # User Corrections And Preferences
2
+
3
+ Purpose: record repeated user corrections, durable preferences, and common-sense course corrections.
4
+
5
+ Write here when:
6
+ - The user says "remember", "never", "next time", "always", or "I prefer".
7
+ - The user corrects the same assumption/pattern 2+ times.
8
+ - A correction changes how future work should be scoped, explained, verified, or handed off.
9
+
10
+ Entry format, newest first:
11
+
12
+ ```markdown
13
+ ## YYYY-MM-DD - Short Preference Name
14
+
15
+ - Correction/preference: the durable instruction.
16
+ - Trigger: what prompted the correction.
17
+ - Apply when: future contexts where this should guide behavior.
18
+ - Avoid: contexts where this should not be over-applied.
19
+ ```
20
+
21
+ Do not record ordinary chat. If the preference is ambiguous, ask before writing it. Never store secrets.