create-harness-vibe-coding 0.8.1 → 0.8.2
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.
- package/README-CN.md +15 -11
- package/README.md +21 -12
- package/package.json +1 -1
- package/src/index.js +210 -10
- package/templates/common/.claude/agents/tdd-guide.md +55 -0
- package/templates/common/.claude/settings.json +22 -0
- package/templates/common/.claude/skills/tdd/SKILL.md +30 -0
- package/templates/common/.claude/skills/wf-auto/SKILL.md +107 -0
- package/templates/common/.claude/skills/wf-auto-spark/SKILL.md +39 -0
- package/templates/common/.claude/skills/wf-max/SKILL.md +10 -2
- package/templates/common/.claude/skills/wf-remove/SKILL.md +12 -5
- package/templates/common/.claude/skills/wf-update/SKILL.md +12 -5
- package/templates/common/.codex/hooks.json +59 -37
- package/templates/common/.harness-version +48 -25
- package/templates/common/AGENTS.md +5 -5
- package/templates/common/CLAUDE.md +12 -17
- package/templates/common/Harness/ECC-GUIDE.md +246 -0
- package/templates/common/Harness/README.md +129 -130
- package/templates/common/Harness/TDD-GUIDE.md +83 -0
- package/templates/common/Harness/WF-AUTO-SPARK.md +297 -0
- package/templates/common/Harness/WF-AUTO.md +508 -0
- package/templates/common/Harness/WF-MAX.md +24 -0
- package/templates/common/Harness/context-loading.md +38 -1
- package/templates/common/Harness/dispatch.md +40 -40
- package/templates/common/Harness/subagents.md +7 -21
- package/templates/common/Harness/tasks/_template/NAMING.md +47 -0
- package/templates/common/MEMORY.md +73 -66
- package/templates/common/SETUP.md +100 -78
- package/templates/common/scripts/validate-harness.mjs +92 -58
- package/templates/common/scripts/wf-mode-hook.mjs +895 -318
- package/templates/common/scripts/wf-remove.mjs +301 -81
- package/templates/common/scripts/wf-statusline.ps1 +62 -38
- package/templates/common/scripts/wf-statusline.sh +67 -48
- package/templates/common/scripts/wf-update-check.mjs +179 -81
|
@@ -1,132 +1,131 @@
|
|
|
1
|
-
# create-harness-vibe-coding - Harness Router
|
|
2
|
-
|
|
3
|
-
Purpose: route humans and agents to the smallest useful context. `Harness/README.md` is the primary router.
|
|
4
|
-
|
|
5
|
-
Default load: `CLAUDE.md`, `Harness/MEMORY.md`, this file, and `Harness/PROGRESS.md` when work is active. Do not read the whole `Harness/` tree.
|
|
6
|
-
|
|
7
|
-
## 0-1 Flow
|
|
8
|
-
|
|
9
|
-
```text
|
|
10
|
-
Idea -> Research -> PRD -> Architecture -> Plan -> Build -> Verify -> Feedback
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
For the full phase contract, load [lifecycle.md](lifecycle.md).
|
|
14
|
-
|
|
15
|
-
## Development Contract
|
|
16
|
-
|
|
17
|
-
- This file is a router, not a full spec.
|
|
18
|
-
- If the task does not clearly match a row below, search by keywords before loading more docs.
|
|
19
|
-
- project files are the only durable communication channel; chat/subagent transcript state is non-authoritative.
|
|
20
|
-
- Important assumptions, decisions, blockers, evidence, and handoffs must be written to the current task's `tasks/<id>/PROGRESS.md` and `tasks/<id>/PLAN.md`, the current feature doc, `Harness/MEMORY.md`, or `Harness/memory/*` as appropriate.
|
|
21
|
-
- Build commands, git conventions, and release notes belong in root `README.md`, not `CLAUDE.md`.
|
|
22
|
-
- README rewrites are optional project-doc work. Use `wf-readme` and preserve existing public docs unless the user approves a broader restructure.
|
|
23
|
-
- Code architecture belongs in [architecture.md](architecture.md) or the current feature doc, not `CLAUDE.md`.
|
|
24
|
-
- Core rules live in `CLAUDE.md` and `.claude/rules/ecc/common.md`.
|
|
25
|
-
- WF mode rules live in [WF.md](WF.md).
|
|
26
|
-
- Phase rules live in [lifecycle.md](lifecycle.md).
|
|
27
|
-
- Build, review, test, and subagent rules live in [agent-workflow.md](agent-workflow.md).
|
|
28
|
-
- Parallel dispatch rules live in [dispatch.md](dispatch.md).
|
|
29
|
-
- Subagent orchestration methodology lives in [subagents.md](subagents.md).
|
|
30
|
-
- Extension rules live in [extension.md](extension.md).
|
|
31
|
-
- Context-loading rules live in [context-loading.md](context-loading.md).
|
|
32
|
-
- Progress lives in `Harness/PROGRESS.md`, `Harness/tasks/<task-id>/PROGRESS.md`, `Harness/tasks/<task-id>/PLAN.md`, and the current feature doc.
|
|
33
|
-
|
|
34
|
-
## Keyword Routing
|
|
35
|
-
|
|
36
|
-
Use this only when the task is ambiguous or the matching row is unclear.
|
|
37
|
-
|
|
38
|
-
1. Extract 2-5 concrete keywords from the user request.
|
|
39
|
-
2. Search the project docs first:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
rg -n "keyword1|keyword2|keyword3" CLAUDE.md README.md Harness
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
3. Load only the top matching doc or the smallest matching doc pair.
|
|
46
|
-
4. If keyword search conflicts with the table below, follow the table and record the assumption in `Harness/tasks/<task-id>/PROGRESS.md`.
|
|
47
|
-
|
|
48
|
-
Keywords are retrieval hints, not project facts.
|
|
49
|
-
|
|
50
|
-
## Load By Task
|
|
51
|
-
|
|
52
|
-
Load the matching row only. Add adjacent docs only when the loaded doc directly names them.
|
|
53
|
-
|
|
54
|
-
Routing priority: if a request explicitly says `/wf <task>`, `$wf`, `wf mode`, `workflow mode`, or `wk mode`, or is long, difficult, uncertain, repeated-failure, migration, architecture-heavy, browser-visible, or broad multi-agent implementation work, choose the WF row first. Load `Harness/WF.md` directly, then delegate subagent coordination to `subagent-orchestrator`.
|
|
55
|
-
|
|
56
|
-
| When to Read | Keywords | Load | Output |
|
|
57
|
-
| --- | --- | --- | --- |
|
|
58
|
-
| Raw idea or vague product request | idea, vague, clarify, goal, non-goal, lifecycle | [lifecycle.md](lifecycle.md), [research/PRD.md](research/PRD.md) | clarified goal, non-goals, first questions |
|
|
59
|
-
| Need market/tech direction | research, market, competitor, stack, library, pricing, policy | [research/README.md](research/README.md), [research/research-results.md](research/research-results.md) | research protocol, adopted/rejected choices |
|
|
60
|
-
| Need MVP/spec | PRD, MVP, scope, requirement, acceptance, non-goal | [research/PRD.md](research/PRD.md) | one-page PRD with verifiable acceptance criteria |
|
|
61
|
-
| Need architecture or boundaries | architecture, boundary, layer, port, adapter, dependency | [architecture.md](architecture.md) | layer map, ports, constraints |
|
|
1
|
+
# create-harness-vibe-coding - Harness Router
|
|
2
|
+
|
|
3
|
+
Purpose: route humans and agents to the smallest useful context. `Harness/README.md` is the primary router.
|
|
4
|
+
|
|
5
|
+
Default load: `CLAUDE.md`, `Harness/MEMORY.md`, this file, and `Harness/PROGRESS.md` when work is active. Do not read the whole `Harness/` tree.
|
|
6
|
+
|
|
7
|
+
## 0-1 Flow
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
Idea -> Research -> PRD -> Architecture -> Plan -> Build -> Verify -> Feedback
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For the full phase contract, load [lifecycle.md](lifecycle.md).
|
|
14
|
+
|
|
15
|
+
## Development Contract
|
|
16
|
+
|
|
17
|
+
- This file is a router, not a full spec.
|
|
18
|
+
- If the task does not clearly match a row below, search by keywords before loading more docs.
|
|
19
|
+
- project files are the only durable communication channel; chat/subagent transcript state is non-authoritative.
|
|
20
|
+
- Important assumptions, decisions, blockers, evidence, and handoffs must be written to the current task's `tasks/<id>/PROGRESS.md` and `tasks/<id>/PLAN.md`, the current feature doc, `Harness/MEMORY.md`, or `Harness/memory/*` as appropriate.
|
|
21
|
+
- Build commands, git conventions, and release notes belong in root `README.md`, not `CLAUDE.md`.
|
|
22
|
+
- README rewrites are optional project-doc work. Use `wf-readme` and preserve existing public docs unless the user approves a broader restructure.
|
|
23
|
+
- Code architecture belongs in [architecture.md](architecture.md) or the current feature doc, not `CLAUDE.md`.
|
|
24
|
+
- Core rules live in `CLAUDE.md` and `.claude/rules/ecc/common.md`.
|
|
25
|
+
- WF mode rules live in [WF.md](WF.md).
|
|
26
|
+
- Phase rules live in [lifecycle.md](lifecycle.md).
|
|
27
|
+
- Build, review, test, and subagent rules live in [agent-workflow.md](agent-workflow.md).
|
|
28
|
+
- Parallel dispatch rules live in [dispatch.md](dispatch.md).
|
|
29
|
+
- Subagent orchestration methodology lives in [subagents.md](subagents.md).
|
|
30
|
+
- Extension rules live in [extension.md](extension.md).
|
|
31
|
+
- Context-loading rules live in [context-loading.md](context-loading.md).
|
|
32
|
+
- Progress lives in `Harness/PROGRESS.md`, `Harness/tasks/<task-id>/PROGRESS.md`, `Harness/tasks/<task-id>/PLAN.md`, and the current feature doc.
|
|
33
|
+
|
|
34
|
+
## Keyword Routing
|
|
35
|
+
|
|
36
|
+
Use this only when the task is ambiguous or the matching row is unclear.
|
|
37
|
+
|
|
38
|
+
1. Extract 2-5 concrete keywords from the user request.
|
|
39
|
+
2. Search the project docs first:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
rg -n "keyword1|keyword2|keyword3" CLAUDE.md README.md Harness
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
3. Load only the top matching doc or the smallest matching doc pair.
|
|
46
|
+
4. If keyword search conflicts with the table below, follow the table and record the assumption in `Harness/tasks/<task-id>/PROGRESS.md`.
|
|
47
|
+
|
|
48
|
+
Keywords are retrieval hints, not project facts.
|
|
49
|
+
|
|
50
|
+
## Load By Task
|
|
51
|
+
|
|
52
|
+
Load the matching row only. Add adjacent docs only when the loaded doc directly names them.
|
|
53
|
+
|
|
54
|
+
Routing priority: if a request explicitly says `/wf <task>`, `$wf`, `wf mode`, `workflow mode`, or `wk mode`, or is long, difficult, uncertain, repeated-failure, migration, architecture-heavy, browser-visible, or broad multi-agent implementation work, choose the WF row first. Load `Harness/WF.md` directly, then delegate subagent coordination to `subagent-orchestrator`. If the request says `/wf-auto`, `$wf-auto`, `wf auto`, or `auto mode`, choose the WF-AUTO row and load `Harness/WF-AUTO.md`.
|
|
55
|
+
|
|
56
|
+
| When to Read | Keywords | Load | Output |
|
|
57
|
+
| --- | --- | --- | --- |
|
|
58
|
+
| Raw idea or vague product request | idea, vague, clarify, goal, non-goal, lifecycle | [lifecycle.md](lifecycle.md), [research/PRD.md](research/PRD.md) | clarified goal, non-goals, first questions |
|
|
59
|
+
| Need market/tech direction | research, market, competitor, stack, library, pricing, policy | [research/README.md](research/README.md), [research/research-results.md](research/research-results.md) | research protocol, adopted/rejected choices |
|
|
60
|
+
| Need MVP/spec | PRD, MVP, scope, requirement, acceptance, non-goal | [research/PRD.md](research/PRD.md) | one-page PRD with verifiable acceptance criteria |
|
|
61
|
+
| Need architecture or boundaries | architecture, boundary, layer, port, adapter, dependency | [architecture.md](architecture.md) | layer map, ports, constraints |
|
|
62
62
|
| Need WF mode | wf, /wf, $wf, wf mode, workflow mode, wk mode, long task, difficult, stuck, repeated failure | [WF.md](WF.md), [PROGRESS.md](PROGRESS.md), the current task `tasks/<id>/PROGRESS.md` and `tasks/<id>/PLAN.md` | exploration plan, second plan, heartbeat, recovery loop; explicit WF/WK loads subagent docs immediately |
|
|
63
|
-
| Need
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
| Need
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
| Need
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
| Need
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
63
|
+
| Need perpetual auto-optimization | /wf-auto, $wf-auto, wf auto, auto mode, never stop, self-improve, continuous optimize | [WF-AUTO.md](WF-AUTO.md), [subagents.md](subagents.md), [dispatch.md](dispatch.md) | perpetual loop, 8-angle scan, spark search, intent checkpoint, evidence ledger; CEO never writes code |
|
|
64
|
+
| Need perpetual inspiration mode | /wf-auto-spark, $wf-auto-spark, wf auto spark, spark mode, external inspiration, discover mode, never stop | [WF-AUTO-SPARK.md](WF-AUTO-SPARK.md), [WF-AUTO.md](WF-AUTO.md), [subagents.md](subagents.md), [dispatch.md](dispatch.md) | roadmap-anchored: North Star + milestones; external spark search; ≤50% deviation guard; never auto-stops |
|
|
65
|
+
| Need WF-MAX mode | /wf-max, $wf-max, wf max, maximum parallelism, CEO, Manager, Worker, fan-out | [WF-MAX.md](WF-MAX.md), [subagents.md](subagents.md), [dispatch.md](dispatch.md) | CEO-only dispatch, W0 fan-out, D-GATE, wave evidence |
|
|
66
|
+
| Need peer review | /wf-review, $wf-review, peer review, second opinion, cross-check, stuck | `.claude/skills/wf-review/SKILL.md`, `.agents/skills/wf-review/SKILL.md`, `Harness/README.md` | cross-model multi-dimension review with severity classification |
|
|
67
|
+
| Adding harness to existing project | existing project, onboarding, migrate, bootstrap, preserve, conflict | [extension.md](extension.md), [PROGRESS.md](PROGRESS.md), root `README.md` and package/CI files | discovered project facts, preserved config, manual registration plan |
|
|
68
|
+
| README optimization | README, docs, quickstart, install docs, architecture diagram, command table, documentation polish | root `README.md`, `.claude/skills/wf-readme/SKILL.md`, [PROGRESS.md](PROGRESS.md), [architecture.md](architecture.md) as needed | approved README mode, preserved sections, proposed diff plan |
|
|
69
|
+
| Need implementation plan | plan, task, write set, verify, milestone, progress | [PROGRESS.md](PROGRESS.md), the current task `tasks/<id>/PROGRESS.md` and `tasks/<id>/PLAN.md`, [agent-workflow.md](agent-workflow.md) | tasks, write set, verification commands |
|
|
70
|
+
| Browser E2E testing or automation | /wf-browser, browser, e2e, web automation, form fill, screenshot verify, page test, browser test, Playwright AI, Browser Use | browser-e2e workflow, wf-browser skill, Browser Use skill | CLI commands, screenshots, agent history, verification pass/fail evidence |
|
|
71
|
+
| Optional workflow installed | workflow, optional, ui-ux-review, github-pr-review, python-backend, ts-react-frontend | matching `workflows/*.md` (if installed), [extension.md](extension.md) | workflow-specific evidence, commands, fallback path |
|
|
72
|
+
| Need durable memory or reflection | memory, remember, preference, correction, tool failure, lesson, reflection | [MEMORY.md](MEMORY.md), `Harness/memory/tool-usage-reflections.md`, `Harness/memory/user-corrections-preferences.md`, `Harness/memory/agent-lessons-patterns.md` | concise newest-first memory entry or no-op rationale |
|
|
73
|
+
| Need subagents | subagent, role pack, context, inject, return format, orchestrator | [subagents.md](subagents.md), [context-loading.md](context-loading.md), [dispatch.md](dispatch.md) | controller plan, role-specific context pack, dispatch pack |
|
|
74
|
+
| Need feature work | feature, implementation, TDD, test, review, closeout | [tasks/_template/PLAN.md](tasks/_template/PLAN.md), [agent-workflow.md](agent-workflow.md) | task plan, tests, implementation loop |
|
|
75
|
+
| Review or release check | review, release, finding, risk, evidence, verification | [agent-workflow.md](agent-workflow.md), current feature doc | findings, verification evidence |
|
|
76
|
+
| Harness readiness check | validate, readiness, placeholder, missing file, release gate | `Harness/scripts/validate-harness.mjs`, `Harness/scripts/validate-harness.mjs --strict` | missing files and unresolved project placeholders |
|
|
77
|
+
| Need harness update | /wf-update, $wf-update, update, check for updates, harness version | `.claude/skills/wf-update/SKILL.md`, `.agents/skills/wf-update/SKILL.md`, `Harness/.harness-version`, `Harness/scripts/wf-update-check.mjs` | script-driven comparison, SAFE/CONFLICT/PRESERVE classification, user decides conflicts |
|
|
78
|
+
| Need harness removal | /wf-remove, $wf-remove, wf remove, remove harness, uninstall harness | `.claude/skills/wf-remove/SKILL.md`, `.agents/skills/wf-remove/SKILL.md`, `Harness/scripts/wf-remove.mjs` | safe removal plan: auto-remove SAFE, confirm MODIFIED, never touch USER DATA |
|
|
79
|
+
|
|
80
|
+
## Gates
|
|
81
|
+
|
|
82
|
+
- Move phases in order unless the user asks for a fast lane.
|
|
79
83
|
- Use `/wf <task>` in Claude Code, `$wf` in Codex, `/wf-max [task]` or `$wf-max`, `wf mode`, `workflow mode`, or `wk mode` when a task is long, difficult, uncertain, multi-file, or repeatedly failing.
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
- Do not
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
.
|
|
105
|
-
.
|
|
106
|
-
|
|
107
|
-
.
|
|
108
|
-
.
|
|
109
|
-
.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
.claude/skills/wf-readme/SKILL.md README preservation and optional structure pass
|
|
129
|
-
.claude/skills/wf-update/SKILL.md GitHub-based harness update
|
|
130
|
-
.agents/skills/wf-update/SKILL.md Codex harness update skill
|
|
131
|
-
Harness/.harness-version scaffold version and file checksums
|
|
132
|
-
```
|
|
84
|
+
- Use `/wf-auto` for perpetual self-directed optimization that never stops until 8-angle exhaustion.
|
|
85
|
+
- **WF-MAX Role Contract**: Three-layer architecture — global mode (`wf-max`), agent role (`ceo|manager|worker|reviewer`), dispatch permission (`writeSet`, `forbidden`, `verification`). CEO never writes source code. Workers edit only dispatch.writeSet. Edit/Write/MultiEdit enforced by PreToolUse hook per agentRole. See `CLAUDE.md` §1a.
|
|
86
|
+
- **WF-REVIEW Anti-Self-Review**: Must invoke the OTHER CLI (Codex↔Claude). Same-model simulation is forbidden.
|
|
87
|
+
- Mode state persists in `Harness/.runtime/current-mode.json` (gitignored). SessionStart hook injects role-aware context (CEO/Worker/Manager/Reviewer). Stale modes (>30 min) auto-clear. Per-turn reinforcement prevents drift after compression.
|
|
88
|
+
- Do not code before the PRD has MVP, non-goals, and acceptance criteria.
|
|
89
|
+
- Unsure whether to open a task? Read [agent-workflow.md](agent-workflow.md) Section 1.
|
|
90
|
+
- Do not spawn a subagent without a role, read boundary, write boundary, and return contract.
|
|
91
|
+
- Do not run writing agents in parallel unless write sets are disjoint.
|
|
92
|
+
- Before coordinating multiple agents, fill `Harness/tasks/<task-id>/PLAN.md#Subagent Dispatch` and follow `subagents.md` plus `dispatch.md`; if the work also matches WF triggers, enter WF mode first.
|
|
93
|
+
- In WF mode, update `Harness/tasks/<task-id>/PROGRESS.md#Heartbeat` before long commands, after failures, and at closeout.
|
|
94
|
+
- In WF Max mode, never dispatch two implementers with overlapping file claims. Verify disjointness before each wave.
|
|
95
|
+
- In WF Max mode, D-GATE (Dispatch Table + Self-Audit Checklist) is mandatory before W2 implementation dispatch.
|
|
96
|
+
- Do not add stack-specific agents or skills without following `extension.md`.
|
|
97
|
+
- Do not close work without tests or recorded manual verification.
|
|
98
|
+
- Do not mark work `Verified` until evidence is recorded in the current task's `tasks/<id>/PROGRESS.md` and `tasks/<id>/PLAN.md` or the feature doc.
|
|
99
|
+
- Run `node Harness/scripts/validate-harness.mjs` for scaffold structure; run `node Harness/scripts/validate-harness.mjs --strict` after bootstrap and before release.
|
|
100
|
+
- Run `node tests/e2e-wf-hooks.test.mjs` to verify hook enforcement works before deploying WF-MAX.
|
|
101
|
+
- If a doc still has `{{...}}`, treat that section as a template, not project fact.
|
|
102
|
+
|
|
103
|
+
## Doc Map
|
|
104
|
+
|
|
105
|
+
| Category | Files |
|
|
106
|
+
|----------|-------|
|
|
107
|
+
| **Router + Index** | `README.md`, `MEMORY.md`, `PROGRESS.md` |
|
|
108
|
+
| **Task Capsule** | `tasks/<id>/PROGRESS.md`, `tasks/<id>/PLAN.md`, `tasks/_template/` |
|
|
109
|
+
| **Workflows** | `WF.md`, `WF-MAX.md`, `WF-AUTO.md`, `WF-AUTO-SPARK.md` |
|
|
110
|
+
| **Guides** | `ECC-GUIDE.md`, `TDD-GUIDE.md`, `lifecycle.md`, `architecture.md` |
|
|
111
|
+
| **Orchestration** | `subagents.md`, `context-loading.md`, `dispatch.md`, `agent-workflow.md`, `extension.md` |
|
|
112
|
+
| **Research** | `research/README.md`, `research/PRD.md`, `research/research-results.md` |
|
|
113
|
+
| **Memory** | `memory/tool-usage-reflections.md`, `memory/user-corrections-preferences.md`, `memory/agent-lessons-patterns.md` |
|
|
114
|
+
| **Scripts** | `scripts/wf-mode-hook.mjs`, `scripts/validate-harness.mjs`, `scripts/wf-update-check.mjs`, `scripts/wf-remove.mjs` |
|
|
115
|
+
| **Runtime** | `.runtime/current-mode.json` (gitignored, hook-managed), `.harness-version` |
|
|
116
|
+
| **Agents + Skills** | `.claude/agents/*`, `.claude/skills/*`, `.agents/skills/*` |
|
|
117
|
+
|
|
118
|
+
## Skill Commands
|
|
119
|
+
|
|
120
|
+
| Claude Code | Codex | Purpose |
|
|
121
|
+
|---|---|---|
|
|
122
|
+
| `/wf <task>` | `$wf <task>` | Long-task workflow: explore -> plan -> implement -> review -> verify |
|
|
123
|
+
| `/wf-max [task]` | `$wf-max [task]` | Maximum parallelism: CEO -> Manager -> Worker hierarchy |
|
|
124
|
+
| `/wf-auto` | `$wf-auto` | Perpetual auto-optimization: never stops until 8-angle exhaustion |
|
|
125
|
+
| `/wf-auto-spark` | `$wf-auto-spark` | Perpetual inspiration: spark search, roadmap-anchored, ≤50% deviation guard, never auto-stops |
|
|
126
|
+
| `/wf-review [focus]` | `$wf-review [focus]` | Cross-model peer review via Codex <-> Claude |
|
|
127
|
+
| `/wf-learn` | `$wf-learn` | Force learning cycle: context-master -> memory-master |
|
|
128
|
+
| `/wf-browser [task]` | `$wf-browser [task]` | AI-driven browser automation for E2E testing |
|
|
129
|
+
| `/wf-update` | `$wf-update` | Script-driven harness update: fetch + compare + apply |
|
|
130
|
+
| `/wf-remove` | `$wf-remove` | Safe harness removal: auto-delete SAFE, confirm MODIFIED, preserve USER DATA |
|
|
131
|
+
```
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# TDD Guide — Test-Driven Development in Harness
|
|
2
|
+
|
|
3
|
+
TDD is NOT optional in Harness. The agent-workflow loop requires a failing test before implementation.
|
|
4
|
+
This guide specifies when, how, and what to test.
|
|
5
|
+
|
|
6
|
+
## When TDD is Mandatory
|
|
7
|
+
|
|
8
|
+
| Trigger | Action |
|
|
9
|
+
|---------|--------|
|
|
10
|
+
| New feature | Write failing test first. Implementation MUST NOT start without it. |
|
|
11
|
+
| Bug fix | Write failing regression test that reproduces the bug. Fix only after test fails. |
|
|
12
|
+
| Refactor | Existing tests MUST be green before refactoring. Keep green throughout. |
|
|
13
|
+
| API endpoint | Integration test first (request → expected response). |
|
|
14
|
+
| UI component | Visual regression or behavior test first (render → user action → expected state). |
|
|
15
|
+
| Database change | Migration test first (apply → verify schema → rollback → verify). |
|
|
16
|
+
|
|
17
|
+
## TDD Cycle (Red-Green-Refactor)
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
RED: Write minimal failing test
|
|
21
|
+
→ Run test → FAILS (if it passes, test is wrong)
|
|
22
|
+
GREEN: Write minimal code to make test pass
|
|
23
|
+
→ Run test → PASSES
|
|
24
|
+
→ Run ALL tests → ALL GREEN
|
|
25
|
+
IMPROVE: Refactor while keeping green
|
|
26
|
+
→ Run ALL tests → ALL GREEN
|
|
27
|
+
→ Coverage check (≥80%)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## ECC Testing Rules
|
|
31
|
+
|
|
32
|
+
Coverage thresholds, AAA structure, test naming, and per-stack setup live in ECC testing rules (`common/testing.md` + stack-specific). This guide defines Harness sequencing only: failing test/manual check first, implementation second, verification last.
|
|
33
|
+
|
|
34
|
+
## Agent Dispatch — TDD Gate
|
|
35
|
+
|
|
36
|
+
Before dispatching an Implementer, the Planner MUST verify:
|
|
37
|
+
|
|
38
|
+
1. [ ] Test file exists for the target module
|
|
39
|
+
2. [ ] Test is RED (fails) for new feature / bug fix
|
|
40
|
+
3. [ ] Test covers acceptance criteria
|
|
41
|
+
4. [ ] Test covers error paths (not just happy path)
|
|
42
|
+
5. [ ] Coverage threshold declared in PLAN.md
|
|
43
|
+
|
|
44
|
+
If any check fails → dispatch Test Writer first, then Implementer.
|
|
45
|
+
|
|
46
|
+
## TDD Anti-Patterns
|
|
47
|
+
|
|
48
|
+
| Anti-Pattern | Symptom | Fix |
|
|
49
|
+
|-------------|---------|-----|
|
|
50
|
+
| **Test-last** | Writing implementation first, then tests "to verify" | Reverse order. Tests first. |
|
|
51
|
+
| **Test-the-test** | Test passes immediately (testing nothing) | Add real assertion. Delete and rewrite. |
|
|
52
|
+
| **Giant test** | One test covering entire feature | Split into unit (logic) + integration (API) + E2E (flow) |
|
|
53
|
+
| **Mock everything** | All dependencies mocked, no real behavior tested | Mock only external I/O (network, disk). Test real logic. |
|
|
54
|
+
| **Skip coverage** | "80% is too hard, let's move on" | Coverage is a gate. Don't merge without it. |
|
|
55
|
+
|
|
56
|
+
## TDD in WF-MAX Mode
|
|
57
|
+
|
|
58
|
+
In `/wf-max`, tests and implementation are dispatched in SEPARATE waves.
|
|
59
|
+
Test Writers MUST complete before Implementers start. No parallel overlap.
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
W2a — TEST WAVE (Test Writers, parallel):
|
|
63
|
+
1. Test Writer (FE) → write failing tests for UserProfile
|
|
64
|
+
2. Test Writer (BE) → write failing API tests for GET /users
|
|
65
|
+
↓ BARRIER: all tests written and confirmed RED ↓
|
|
66
|
+
|
|
67
|
+
W2b — IMPLEMENTATION WAVE (Implementers, parallel):
|
|
68
|
+
3. Implementer (FE) → make FE tests pass
|
|
69
|
+
4. Implementer (BE) → make BE tests pass
|
|
70
|
+
↓ BARRIER: all tests GREEN ↓
|
|
71
|
+
|
|
72
|
+
W2R — REVIEW WAVE:
|
|
73
|
+
5. Reviewer → verify test coverage + implementation correctness
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Why separate waves:** Workers in the same WF-MAX wave run in parallel.
|
|
77
|
+
If Test Writers and Implementers share a wave, Implementers start before RED
|
|
78
|
+
tests exist — violating the TDD gate. Two waves with an explicit barrier
|
|
79
|
+
ensures tests exist before any implementation begins.
|
|
80
|
+
|
|
81
|
+
## Verification
|
|
82
|
+
|
|
83
|
+
Run the verification commands declared in the task PLAN or dispatch packet. Do not claim TDD completion until RED, GREEN, and full-check evidence are recorded.
|