create-harness-vibe-coding 0.8.0 → 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 +40 -24
- package/README.md +44 -20
- package/package.json +1 -1
- package/src/generator.js +1 -1
- package/src/index.js +211 -11
- package/src/prompts.js +1 -1
- 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 +98 -63
- 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
- package/templates/optional/catalog.json +5 -5
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# ECC Rules Guide — Stack to Rule Set Mapping
|
|
2
|
+
|
|
3
|
+
ECC (Engineering Code Conventions) rules are organized by language/domain under `~/.claude/rules/ecc/`. The Harness bootstrap process MUST install the appropriate rule sets for the project's tech stack.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# From the ECC rules repository:
|
|
9
|
+
cp -r rules/common .claude/rules/ecc/
|
|
10
|
+
cp -r rules/<language> .claude/rules/ecc/
|
|
11
|
+
|
|
12
|
+
# Verify:
|
|
13
|
+
ls .claude/rules/ecc/
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Stack Detection (Automatic)
|
|
17
|
+
|
|
18
|
+
| File Found | Stack | Install These Rules |
|
|
19
|
+
|------------|-------|-------------------|
|
|
20
|
+
| `package.json` + `tsconfig.json` | TypeScript/Node | `common/`, `typescript/`, `web/` |
|
|
21
|
+
| `package.json` (no tsconfig) | JavaScript/Node | `common/`, `typescript/` (JS mode), `web/` |
|
|
22
|
+
| `go.mod` | Go | `common/`, `golang/` |
|
|
23
|
+
| `pyproject.toml` / `requirements.txt` | Python | `common/`, `python/` |
|
|
24
|
+
| `Cargo.toml` | Rust | `common/`, `rust/` |
|
|
25
|
+
| `Gemfile` | Ruby/Rails | `common/`, `ruby/` |
|
|
26
|
+
| `composer.json` | PHP | `common/`, `php/` |
|
|
27
|
+
| `build.gradle` / `pom.xml` | Java/Kotlin | `common/`, `java/` or `kotlin/` |
|
|
28
|
+
| `*.sln` / `*.csproj` | C#/.NET | `common/`, `csharp/` |
|
|
29
|
+
| `Package.swift` | Swift | `common/`, `swift/` |
|
|
30
|
+
| Multiple frontend files (`.vue`, `.tsx`, `.jsx`) | Web frontend | Add `web/` to any stack |
|
|
31
|
+
|
|
32
|
+
## Stack Detection (Ask User)
|
|
33
|
+
|
|
34
|
+
If no stack markers are found (empty/new repo), ask:
|
|
35
|
+
|
|
36
|
+
> "What's your tech stack? I need to install the right coding rules.
|
|
37
|
+
> Options: TypeScript/Node, Python, Go, Rust, Ruby, PHP, Java, Kotlin, C#, Swift, or other.
|
|
38
|
+
> Frontend framework? (React, Vue, Next.js, Nuxt, none)"
|
|
39
|
+
|
|
40
|
+
Based on answer, install matching rules.
|
|
41
|
+
|
|
42
|
+
## Rule Set Catalog
|
|
43
|
+
|
|
44
|
+
| Rule Set | What It Covers | Files |
|
|
45
|
+
|----------|---------------|-------|
|
|
46
|
+
| `common/` | **Required for all projects.** Immutability, error handling, file organization, git workflow, testing, security, agents, hooks, patterns. | `coding-style.md`, `git-workflow.md`, `testing.md`, `security.md`, `patterns.md`, `agents.md`, `hooks.md`, `performance.md`, `development-workflow.md` |
|
|
47
|
+
| `typescript/` | TS/JS types, interfaces, immutability patterns, error handling with try-catch, Zod validation, React props, custom hooks, repository pattern. | `coding-style.md`, `testing.md`, `security.md`, `patterns.md`, `hooks.md` |
|
|
48
|
+
| `web/` | Frontend: CSS custom properties, animation-only properties, semantic HTML, component composition, state management, image optimization, CSP, XSS, Core Web Vitals, bundle budgets. | `coding-style.md`, `design-quality.md`, `testing.md`, `security.md`, `patterns.md`, `performance.md`, `hooks.md` |
|
|
49
|
+
| `python/` | PEP 8, type hints, immutability, async patterns, pytest, input validation. | `coding-style.md`, `testing.md`, `security.md`, `patterns.md` |
|
|
50
|
+
| `golang/` | Idiomatic Go, error handling, concurrency patterns, table-driven tests, security. | `coding-style.md`, `testing.md`, `security.md`, `patterns.md` |
|
|
51
|
+
| `rust/` | Ownership, lifetimes, error handling, unsafe usage, cargo-llvm-cov. | `coding-style.md`, `testing.md`, `security.md`, `patterns.md` |
|
|
52
|
+
| `ruby/` | Ruby idioms, Rails patterns, RSpec, security. | `coding-style.md`, `testing.md`, `security.md` |
|
|
53
|
+
| `php/` | PSR-12, Eloquent ORM, security, testing. | `coding-style.md`, `testing.md`, `security.md` |
|
|
54
|
+
| `swift/` | Protocol-oriented design, value semantics, ARC, Swift Concurrency. | `coding-style.md`, `testing.md`, `security.md` |
|
|
55
|
+
| `arkts/` | HarmonyOS/ArkTS specific. | `coding-style.md`, `testing.md`, `security.md` |
|
|
56
|
+
| `angular/` | Angular specific patterns. | Extends `typescript/` and `web/` |
|
|
57
|
+
| `vue/` | Vue 3 Composition API, reactivity, Pinia. | Extends `typescript/` and `web/` |
|
|
58
|
+
| `nuxt/` | Nuxt 4 specific. | Extends `vue/` |
|
|
59
|
+
|
|
60
|
+
## Recommended Combinations
|
|
61
|
+
|
|
62
|
+
| Project Type | Rule Sets |
|
|
63
|
+
|-------------|-----------|
|
|
64
|
+
| React + TypeScript frontend | `common/`, `typescript/`, `web/` |
|
|
65
|
+
| Vue 3 frontend | `common/`, `typescript/`, `web/`, `vue/` |
|
|
66
|
+
| Next.js fullstack | `common/`, `typescript/`, `web/` |
|
|
67
|
+
| Python backend (FastAPI) | `common/`, `python/` |
|
|
68
|
+
| Go microservice | `common/`, `golang/` |
|
|
69
|
+
| Rust CLI tool | `common/`, `rust/` |
|
|
70
|
+
| Electron + React desktop | `common/`, `typescript/`, `web/` |
|
|
71
|
+
| React Native mobile | `common/`, `typescript/`, `web/` |
|
|
72
|
+
|
|
73
|
+
## Bootstrap Verification
|
|
74
|
+
|
|
75
|
+
After installing ECC rules, verify:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
ls .claude/rules/ecc/common/ # MUST exist
|
|
79
|
+
ls .claude/rules/ecc/<language>/ # MUST exist for detected/declared stack
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If rules are missing, the agent MUST install them before proceeding to step 1.
|
|
83
|
+
|
|
84
|
+
## ECC Design Rules — Frontend + Backend Architecture
|
|
85
|
+
|
|
86
|
+
Beyond coding style, ECC provides design-level guidance for both frontend and backend.
|
|
87
|
+
These are NOT in Harness by default — the agent should consult them when filling
|
|
88
|
+
`Harness/architecture.md` and `Harness/research/research-results.md`.
|
|
89
|
+
|
|
90
|
+
### Frontend Design (web/ + typescript/)
|
|
91
|
+
|
|
92
|
+
| Rule File | Design Guidance | When to Apply |
|
|
93
|
+
|-----------|----------------|---------------|
|
|
94
|
+
| `web/design-quality.md` | Anti-template policy, required qualities (hierarchy, depth, typography, motion, color semantics), banned patterns (stock hero, default card grids, safe gray-on-white) | Before writing any frontend code |
|
|
95
|
+
| `web/patterns.md` | Compound components, render props, container/presentational split, state management (server/client/URL/form), URL as state, stale-while-revalidate, optimistic updates | When architecting frontend data flow |
|
|
96
|
+
| `web/performance.md` | Core Web Vitals targets, bundle budgets, loading strategy, image optimization, font loading, animation performance | Before production build |
|
|
97
|
+
| `web/security.md` | CSP (nonce-based), XSS prevention, third-party script SRI, HTTPS headers, CSRF protection | Before any user-facing deploy |
|
|
98
|
+
| `web/testing.md` | Visual regression (320/768/1024/1440), a11y, Lighthouse, cross-browser, responsive | Before launch |
|
|
99
|
+
| `web/hooks.md` | PostToolUse format/lint/type-check, PreToolUse file size guard, Stop build verification | CI setup |
|
|
100
|
+
| `typescript/patterns.md` | API response envelope, custom hooks, Repository pattern | Backend-frontend contract |
|
|
101
|
+
|
|
102
|
+
### Backend Design (python/ + golang/ + rust/)
|
|
103
|
+
|
|
104
|
+
| Rule File | Design Guidance | When to Apply |
|
|
105
|
+
|-----------|----------------|---------------|
|
|
106
|
+
| `python/fastapi.md` | FastAPI patterns: async correctness, dependency injection, Pydantic schemas, OpenAPI quality | Python API projects |
|
|
107
|
+
| `python/patterns.md` | Repository pattern, service layer, API response format | Any Python backend |
|
|
108
|
+
| `golang/patterns.md` | Idiomatic Go patterns, concurrency, error handling | Go microservices |
|
|
109
|
+
| `rust/patterns.md` | Ownership patterns, error handling, unsafe usage | Rust services |
|
|
110
|
+
| `common/patterns.md` | Skeleton projects, Repository pattern, API response format, design pattern guidance | All projects |
|
|
111
|
+
|
|
112
|
+
### Architecture Templates
|
|
113
|
+
|
|
114
|
+
Write the project-specific structure in `Harness/architecture.md`. Use the ECC rule combinations above to decide which standards apply to each layer.
|
|
115
|
+
|
|
116
|
+
### API Contract
|
|
117
|
+
|
|
118
|
+
See [Contract Rules](#contract-rules) below for the full spec.
|
|
119
|
+
|
|
120
|
+
## Agent Skills + ECC Rules
|
|
121
|
+
|
|
122
|
+
Dispatch packets MUST include `ecc` and SHOULD include `skills` fields (use `skills: none` when no skill applies). `Harness/context-loading.md#ecc-rules-per-role` owns the role-to-ECC mapping. This guide owns stack detection and the catalog of available ECC rule sets.
|
|
123
|
+
|
|
124
|
+
## API Contract Specification (Frontend ↔ Backend)
|
|
125
|
+
|
|
126
|
+
The single most important integration pattern. Without this, frontend and backend drift apart silently.
|
|
127
|
+
|
|
128
|
+
### Contract Rules
|
|
129
|
+
|
|
130
|
+
1. **Backend owns the schema.** Define types in the backend language, generate frontend types.
|
|
131
|
+
2. **Never duplicate types manually.** One source of truth, code-generated copies.
|
|
132
|
+
3. **Validate at both boundaries.** Backend validates input (Pydantic/Zod), frontend validates API responses.
|
|
133
|
+
4. **Error envelope is universal.** Use `common/patterns.md` format everywhere.
|
|
134
|
+
|
|
135
|
+
### OpenAPI 3.0 Example (Generator-Readable)
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
# api/openapi.yaml — Feed this to openapi-typescript or openapi-generator
|
|
139
|
+
openapi: "3.0.3"
|
|
140
|
+
info:
|
|
141
|
+
title: User API
|
|
142
|
+
version: "1.0.0"
|
|
143
|
+
paths:
|
|
144
|
+
/api/users:
|
|
145
|
+
get:
|
|
146
|
+
operationId: listUsers
|
|
147
|
+
parameters:
|
|
148
|
+
- name: page
|
|
149
|
+
in: query
|
|
150
|
+
schema: { type: integer, default: 1 }
|
|
151
|
+
- name: limit
|
|
152
|
+
in: query
|
|
153
|
+
schema: { type: integer, default: 20 }
|
|
154
|
+
responses:
|
|
155
|
+
"200":
|
|
156
|
+
description: OK
|
|
157
|
+
content:
|
|
158
|
+
application/json:
|
|
159
|
+
schema:
|
|
160
|
+
type: object
|
|
161
|
+
properties:
|
|
162
|
+
success: { type: boolean }
|
|
163
|
+
data:
|
|
164
|
+
type: object
|
|
165
|
+
properties:
|
|
166
|
+
users: { type: array, items: { $ref: "#/components/schemas/User" } }
|
|
167
|
+
meta:
|
|
168
|
+
type: object
|
|
169
|
+
properties:
|
|
170
|
+
total: { type: integer }
|
|
171
|
+
page: { type: integer }
|
|
172
|
+
post:
|
|
173
|
+
operationId: createUser
|
|
174
|
+
requestBody:
|
|
175
|
+
required: true
|
|
176
|
+
content:
|
|
177
|
+
application/json:
|
|
178
|
+
schema: { $ref: "#/components/schemas/CreateUserInput" }
|
|
179
|
+
responses:
|
|
180
|
+
"201":
|
|
181
|
+
description: Created
|
|
182
|
+
content:
|
|
183
|
+
application/json:
|
|
184
|
+
schema:
|
|
185
|
+
type: object
|
|
186
|
+
properties:
|
|
187
|
+
success: { type: boolean }
|
|
188
|
+
data:
|
|
189
|
+
type: object
|
|
190
|
+
properties:
|
|
191
|
+
user: { $ref: "#/components/schemas/User" }
|
|
192
|
+
components:
|
|
193
|
+
schemas:
|
|
194
|
+
User:
|
|
195
|
+
type: object
|
|
196
|
+
required: [id, email, name, role, createdAt]
|
|
197
|
+
properties:
|
|
198
|
+
id: { type: string, format: uuid }
|
|
199
|
+
email: { type: string, format: email }
|
|
200
|
+
name: { type: string }
|
|
201
|
+
role: { type: string, enum: [admin, member] }
|
|
202
|
+
createdAt: { type: string, format: date-time }
|
|
203
|
+
CreateUserInput:
|
|
204
|
+
type: object
|
|
205
|
+
required: [email, name]
|
|
206
|
+
properties:
|
|
207
|
+
email: { type: string, format: email }
|
|
208
|
+
name: { type: string, minLength: 1, maxLength: 100 }
|
|
209
|
+
role: { type: string, enum: [admin, member], default: member }
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# Generate TypeScript types from OpenAPI:
|
|
214
|
+
npx openapi-typescript api/openapi.yaml -o src/shared/api-types.ts
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Implementation Per Stack
|
|
218
|
+
|
|
219
|
+
| Stack | Backend Schema | Frontend Types | Validation |
|
|
220
|
+
|-------|---------------|----------------|------------|
|
|
221
|
+
| Python BE + TS FE | Pydantic models | `openapi-typescript` from OpenAPI | Pydantic (BE) + Zod (FE) |
|
|
222
|
+
| Go BE + TS FE | Go structs + OpenAPI | `openapi-generator` | Go validator (BE) + Zod (FE) |
|
|
223
|
+
| Next.js fullstack | Zod schemas in `shared/` | Same Zod schemas | Zod (both sides) |
|
|
224
|
+
| tRPC | tRPC router definitions | Auto-inferred from router | tRPC built-in |
|
|
225
|
+
| GraphQL | GraphQL schema | `graphql-codegen` | GraphQL middleware + Zod (FE) |
|
|
226
|
+
|
|
227
|
+
### Agent Dispatch with ECC + Skills
|
|
228
|
+
|
|
229
|
+
When dispatching a subagent, the dispatch packet MUST include:
|
|
230
|
+
|
|
231
|
+
```json
|
|
232
|
+
{
|
|
233
|
+
"agentRole": "worker",
|
|
234
|
+
"task": "Implement user profile page",
|
|
235
|
+
"writeSet": ["src/components/UserProfile.tsx", "src/hooks/useUser.ts"],
|
|
236
|
+
"forbidden": ["src/backend/", "database/"],
|
|
237
|
+
"verification": ["npm test", "npm run lint"],
|
|
238
|
+
"ecc": ["web/design-quality.md", "web/patterns.md", "typescript/patterns.md"],
|
|
239
|
+
"skills": ["react-review"],
|
|
240
|
+
"apiContract": "api/contract.yaml"
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Different subagents get different `ecc` and `skills` arrays.
|
|
245
|
+
A frontend implementer loads `web/` rules. A backend implementer loads `python/` or `golang/` rules.
|
|
246
|
+
A reviewer loads `security/` + `testing/` rules. See `Harness/context-loading.md` for the full per-role mapping.
|
|
@@ -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.
|