@harness-engineering/cli 1.6.1 → 1.7.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 (72) hide show
  1. package/dist/agents/personas/planner.yaml +27 -0
  2. package/dist/agents/personas/verifier.yaml +30 -0
  3. package/dist/agents/skills/claude-code/enforce-architecture/SKILL.md +19 -0
  4. package/dist/agents/skills/claude-code/harness-accessibility/SKILL.md +274 -0
  5. package/dist/agents/skills/claude-code/harness-accessibility/skill.yaml +51 -0
  6. package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +111 -72
  7. package/dist/agents/skills/claude-code/harness-autopilot/skill.yaml +4 -2
  8. package/dist/agents/skills/claude-code/harness-dependency-health/skill.yaml +1 -1
  9. package/dist/agents/skills/claude-code/harness-design/SKILL.md +265 -0
  10. package/dist/agents/skills/claude-code/harness-design/skill.yaml +53 -0
  11. package/dist/agents/skills/claude-code/harness-design-mobile/SKILL.md +336 -0
  12. package/dist/agents/skills/claude-code/harness-design-mobile/skill.yaml +49 -0
  13. package/dist/agents/skills/claude-code/harness-design-system/SKILL.md +282 -0
  14. package/dist/agents/skills/claude-code/harness-design-system/skill.yaml +50 -0
  15. package/dist/agents/skills/claude-code/harness-design-web/SKILL.md +360 -0
  16. package/dist/agents/skills/claude-code/harness-design-web/skill.yaml +52 -0
  17. package/dist/agents/skills/claude-code/harness-hotspot-detector/skill.yaml +1 -1
  18. package/dist/agents/skills/claude-code/harness-impact-analysis/SKILL.md +16 -0
  19. package/dist/agents/skills/claude-code/harness-integrity/SKILL.md +19 -1
  20. package/dist/agents/skills/claude-code/harness-knowledge-mapper/skill.yaml +1 -1
  21. package/dist/agents/skills/claude-code/harness-onboarding/SKILL.md +19 -1
  22. package/dist/agents/skills/claude-code/harness-release-readiness/SKILL.md +13 -9
  23. package/dist/agents/skills/claude-code/harness-security-scan/skill.yaml +1 -1
  24. package/dist/agents/skills/claude-code/harness-verify/SKILL.md +26 -0
  25. package/dist/agents/skills/gemini-cli/harness-accessibility/SKILL.md +274 -0
  26. package/dist/agents/skills/gemini-cli/harness-accessibility/skill.yaml +51 -0
  27. package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +111 -72
  28. package/dist/agents/skills/gemini-cli/harness-autopilot/skill.yaml +4 -2
  29. package/dist/agents/skills/gemini-cli/harness-dependency-health/skill.yaml +1 -1
  30. package/dist/agents/skills/gemini-cli/harness-design/SKILL.md +265 -0
  31. package/dist/agents/skills/gemini-cli/harness-design/skill.yaml +53 -0
  32. package/dist/agents/skills/gemini-cli/harness-design-mobile/SKILL.md +336 -0
  33. package/dist/agents/skills/gemini-cli/harness-design-mobile/skill.yaml +49 -0
  34. package/dist/agents/skills/gemini-cli/harness-design-system/SKILL.md +282 -0
  35. package/dist/agents/skills/gemini-cli/harness-design-system/skill.yaml +50 -0
  36. package/dist/agents/skills/gemini-cli/harness-design-web/SKILL.md +360 -0
  37. package/dist/agents/skills/gemini-cli/harness-design-web/skill.yaml +52 -0
  38. package/dist/agents/skills/gemini-cli/harness-hotspot-detector/skill.yaml +1 -1
  39. package/dist/agents/skills/gemini-cli/harness-impact-analysis/SKILL.md +16 -0
  40. package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/skill.yaml +1 -1
  41. package/dist/agents/skills/gemini-cli/harness-release-readiness/SKILL.md +13 -9
  42. package/dist/agents/skills/gemini-cli/harness-security-scan/skill.yaml +1 -1
  43. package/dist/agents/skills/node_modules/.bin/vitest +2 -2
  44. package/dist/agents/skills/shared/design-knowledge/anti-patterns/color.yaml +106 -0
  45. package/dist/agents/skills/shared/design-knowledge/anti-patterns/layout.yaml +109 -0
  46. package/dist/agents/skills/shared/design-knowledge/anti-patterns/motion.yaml +109 -0
  47. package/dist/agents/skills/shared/design-knowledge/anti-patterns/typography.yaml +112 -0
  48. package/dist/agents/skills/shared/design-knowledge/industries/creative.yaml +80 -0
  49. package/dist/agents/skills/shared/design-knowledge/industries/ecommerce.yaml +80 -0
  50. package/dist/agents/skills/shared/design-knowledge/industries/emerging-tech.yaml +83 -0
  51. package/dist/agents/skills/shared/design-knowledge/industries/fintech.yaml +80 -0
  52. package/dist/agents/skills/shared/design-knowledge/industries/healthcare.yaml +80 -0
  53. package/dist/agents/skills/shared/design-knowledge/industries/lifestyle.yaml +80 -0
  54. package/dist/agents/skills/shared/design-knowledge/industries/saas.yaml +80 -0
  55. package/dist/agents/skills/shared/design-knowledge/industries/services.yaml +80 -0
  56. package/dist/agents/skills/shared/design-knowledge/palettes/curated.yaml +234 -0
  57. package/dist/agents/skills/shared/design-knowledge/platform-rules/android.yaml +125 -0
  58. package/dist/agents/skills/shared/design-knowledge/platform-rules/flutter.yaml +144 -0
  59. package/dist/agents/skills/shared/design-knowledge/platform-rules/ios.yaml +106 -0
  60. package/dist/agents/skills/shared/design-knowledge/platform-rules/web.yaml +102 -0
  61. package/dist/agents/skills/shared/design-knowledge/typography/pairings.yaml +274 -0
  62. package/dist/bin/harness.js +3 -2
  63. package/dist/{chunk-3U5VZYR7.js → chunk-4WUGOJQ7.js} +6 -3
  64. package/dist/{chunk-O6NEKDYP.js → chunk-FFIX3QVG.js} +697 -349
  65. package/dist/chunk-GA6GN5J2.js +6150 -0
  66. package/dist/dist-C4J67MPP.js +242 -0
  67. package/dist/dist-N4D4QWFV.js +2809 -0
  68. package/dist/index.d.ts +79 -0
  69. package/dist/index.js +3 -2
  70. package/dist/validate-cross-check-WGXQ7K62.js +7 -0
  71. package/package.json +12 -8
  72. package/dist/validate-cross-check-LNIZ7KGZ.js +0 -6
@@ -13,18 +13,23 @@
13
13
 
14
14
  ## Relationship to Other Skills
15
15
 
16
- | Skill | Role in Autopilot |
17
- | -------------------- | -------------------------------------------- |
18
- | harness-planning | Delegated to for phase plan creation |
19
- | harness-execution | Delegated to for task-by-task implementation |
20
- | harness-verification | Delegated to for post-execution validation |
21
- | harness-code-review | Delegated to for post-verification review |
16
+ | Skill | Persona Agent (`subagent_type`) | Role in Autopilot |
17
+ | -------------------- | ------------------------------- | -------------------------------------------- |
18
+ | harness-planning | `harness-planner` | Delegated to for phase plan creation |
19
+ | harness-execution | `harness-task-executor` | Delegated to for task-by-task implementation |
20
+ | harness-verification | `harness-verifier` | Delegated to for post-execution validation |
21
+ | harness-code-review | `harness-code-reviewer` | Delegated to for post-verification review |
22
22
 
23
- Autopilot orchestrates these skills — it never reimplements their logic.
23
+ Autopilot orchestrates these persona agents — it never reimplements their logic. Each agent is dispatched via the Agent tool with the corresponding `subagent_type`, which isolates it to the harness methodology and prevents it from using unrelated skills.
24
24
 
25
25
  ## Iron Law
26
26
 
27
- **Autopilot delegates, never reimplements.** If you find yourself writing planning logic, execution logic, or review logic inside the autopilot loop, STOP. Delegate to the appropriate skill via subagent.
27
+ **Autopilot delegates, never reimplements.** If you find yourself writing planning logic, execution logic, or review logic inside the autopilot loop, STOP. Delegate to the dedicated persona agent.
28
+
29
+ **Always use dedicated persona agents, never general-purpose agents.** Every dispatch MUST target the specific harness persona (`harness-planner`, `harness-task-executor`, `harness-verifier`, `harness-code-reviewer`). General-purpose agents see all globally registered skills and may use unrelated workflows instead of the harness methodology.
30
+
31
+ - **Claude Code:** Use the Agent tool with `subagent_type` set to the persona name.
32
+ - **Gemini CLI:** Use the `run_agent` tool targeting the persona by name, or dispatch via `harness persona run <name>`.
28
33
 
29
34
  **Human always approves plans.** No plan executes without explicit human sign-off, regardless of complexity level. The difference is whether autopilot generates the plan automatically or asks the human to drive planning interactively.
30
35
 
@@ -44,20 +49,32 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
44
49
 
45
50
  ### Phase 1: INIT — Load Spec and Restore State
46
51
 
47
- 1. **Check for existing state.** Read `.harness/autopilot-state.json`. If it exists and `currentState` is not `DONE`:
52
+ 1. **Resolve spec path.** The spec file is provided as an argument, or ask the user for the spec path.
53
+
54
+ 2. **Derive session slug and directory:**
55
+ - Derive the session slug from the spec path:
56
+ 1. If the path starts with `docs/`, strip the `docs/` prefix. Otherwise, use the full relative path.
57
+ 2. Drop the trailing `.md` extension
58
+ 3. Replace all `/` and `.` characters with `--`
59
+ 4. Lowercase the result
60
+ - Set `sessionDir = .harness/sessions/<slug>/`
61
+ - Create the session directory if it does not exist
62
+
63
+ 3. **Check for existing state.** Read `{sessionDir}/autopilot-state.json`. If it exists and `currentState` is not `DONE`:
48
64
  - Report: "Resuming autopilot from state `{currentState}`, phase {currentPhase}: {phaseName}."
49
65
  - Skip to the recorded `currentState` and continue from there.
50
66
 
51
- 2. **If no existing state (fresh start):**
52
- - Read the spec file (provided as argument or found via `.harness/handoff.json`). If neither is available, ask the user for the spec path.
67
+ 4. **If no existing state (fresh start):**
68
+ - Read the spec file.
53
69
  - Parse the `## Implementation Order` section to extract phases.
54
70
  - For each phase heading (`### Phase N: Name`), extract:
55
71
  - Phase name
56
72
  - Complexity annotation (`<!-- complexity: low|medium|high -->`, default: `medium`)
57
- - Create `.harness/autopilot-state.json`:
73
+ - Create `{sessionDir}/autopilot-state.json`:
58
74
  ```json
59
75
  {
60
- "schemaVersion": 1,
76
+ "schemaVersion": 2,
77
+ "sessionDir": ".harness/sessions/<slug>",
61
78
  "specPath": "<path to spec>",
62
79
  "currentState": "ASSESS",
63
80
  "currentPhase": 0,
@@ -78,15 +95,15 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
78
95
  }
79
96
  ```
80
97
 
81
- 3. **Load context.** Read `.harness/learnings.md` and `.harness/failures.md` if they exist. Note any relevant learnings or known dead ends for the current phase.
98
+ 5. **Load context.** Read `.harness/learnings.md` and `.harness/failures.md` (global, at `.harness/` root) if they exist. Note any relevant learnings or known dead ends for the current phase.
82
99
 
83
- 4. **Transition to ASSESS.**
100
+ 6. **Transition to ASSESS.**
84
101
 
85
102
  ---
86
103
 
87
104
  ### ASSESS — Determine Phase Approach
88
105
 
89
- 1. **Read the current phase** from `autopilot-state.json` at index `currentPhase`.
106
+ 1. **Read the current phase** from `{sessionDir}/autopilot-state.json` at index `currentPhase`.
90
107
 
91
108
  2. **Check if plan already exists.** If `planPath` is set and the file exists, skip to `APPROVE_PLAN`.
92
109
 
@@ -97,8 +114,8 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
97
114
 
98
115
  | Effective Complexity | Action |
99
116
  | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
100
- | `low` | Auto-plan via subagent. Proceed to PLAN. |
101
- | `medium` | Auto-plan via subagent. Proceed to PLAN. Present with extra scrutiny note. |
117
+ | `low` | Auto-plan via `harness-planner` agent. Proceed to PLAN. |
118
+ | `medium` | Auto-plan via `harness-planner` agent. Proceed to PLAN. Present with extra scrutiny note. |
102
119
  | `high` | Pause. Tell the user: "Phase {N}: {name} is marked high-complexity. Run `/harness:planning` interactively for this phase, then re-invoke `/harness:autopilot` to continue." Transition to PLAN with `awaitingInteractivePlan: true`. |
103
120
 
104
121
  4. **Update state** with `currentState: "PLAN"` and save.
@@ -109,22 +126,27 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
109
126
 
110
127
  **If auto-planning (low/medium complexity):**
111
128
 
112
- 1. Dispatch a subagent with the following prompt:
129
+ 1. Dispatch a planning agent using the Agent tool:
113
130
 
114
131
  ```
115
- You are running harness-planning for phase {N}: {name}.
116
-
117
- Spec: {specPath}
118
- Phase description: {phase description from spec}
119
- Previous phase learnings: {relevant learnings from .harness/learnings.md}
120
- Known failures to avoid: {relevant entries from .harness/failures.md}
121
-
122
- Follow the harness-planning skill process exactly. Write the plan to
123
- docs/plans/{date}-{phase-name}-plan.md. Write .harness/handoff.json when done.
132
+ Agent tool parameters:
133
+ subagent_type: "harness-planner"
134
+ description: "Plan phase {N}: {name}"
135
+ prompt: |
136
+ You are running harness-planning for phase {N}: {name}.
137
+
138
+ Spec: {specPath}
139
+ Session directory: {sessionDir}
140
+ Phase description: {phase description from spec}
141
+ Previous phase learnings (global): {relevant learnings from .harness/learnings.md}
142
+ Known failures to avoid (global): {relevant entries from .harness/failures.md}
143
+
144
+ Follow the harness-planning skill process exactly. Write the plan to
145
+ docs/plans/{date}-{phase-name}-plan.md. Write {sessionDir}/handoff.json when done.
124
146
  ```
125
147
 
126
- 2. When the subagent returns:
127
- - Read the generated plan path from `.harness/handoff.json`.
148
+ 2. When the agent returns:
149
+ - Read the generated plan path from `{sessionDir}/handoff.json`.
128
150
  - **Apply complexity override check:**
129
151
  - Count tasks in the plan.
130
152
  - Count `[checkpoint:*]` markers.
@@ -138,7 +160,7 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
138
160
  **If awaiting interactive plan (high complexity):**
139
161
 
140
162
  1. Check if a plan file now exists for this phase (user ran planning separately).
141
- - Look for files matching `docs/plans/*{phase-name}*` or check `.harness/handoff.json` for a planning handoff.
163
+ - Look for files matching `docs/plans/*{phase-name}*` or check `{sessionDir}/handoff.json` for a planning handoff.
142
164
  2. If found: update `planPath` in state, transition to `APPROVE_PLAN`.
143
165
  3. If not found: remind the user and wait.
144
166
 
@@ -170,27 +192,32 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
170
192
 
171
193
  ### EXECUTE — Run the Plan
172
194
 
173
- 1. **Dispatch execution subagent:**
195
+ 1. **Dispatch execution agent using the Agent tool:**
174
196
 
175
197
  ```
176
- You are running harness-execution for phase {N}: {name}.
177
-
178
- Plan: {planPath}
179
- State: .harness/state.json
180
- Learnings: .harness/learnings.md
181
- Failures: .harness/failures.md
182
-
183
- Follow the harness-execution skill process exactly.
184
- Update .harness/state.json after each task.
185
- Write .harness/handoff.json when done or when blocked.
198
+ Agent tool parameters:
199
+ subagent_type: "harness-task-executor"
200
+ description: "Execute phase {N}: {name}"
201
+ prompt: |
202
+ You are running harness-execution for phase {N}: {name}.
203
+
204
+ Plan: {planPath}
205
+ Session directory: {sessionDir}
206
+ State: {sessionDir}/state.json
207
+ Learnings (global): .harness/learnings.md
208
+ Failures (global): .harness/failures.md
209
+
210
+ Follow the harness-execution skill process exactly.
211
+ Update {sessionDir}/state.json after each task.
212
+ Write {sessionDir}/handoff.json when done or when blocked.
186
213
  ```
187
214
 
188
- 2. **When the subagent returns, check the outcome:**
215
+ 2. **When the agent returns, check the outcome:**
189
216
  - **All tasks complete:** Transition to VERIFY.
190
217
  - **Checkpoint reached:** Surface the checkpoint to the user in the main conversation. Handle the checkpoint type:
191
- - `[checkpoint:human-verify]` — Show output, ask for confirmation, then resume execution subagent.
192
- - `[checkpoint:decision]` — Present options, record choice, resume execution subagent.
193
- - `[checkpoint:human-action]` — Instruct user, wait for confirmation, resume execution subagent.
218
+ - `[checkpoint:human-verify]` — Show output, ask for confirmation, then resume execution agent.
219
+ - `[checkpoint:decision]` — Present options, record choice, resume execution agent.
220
+ - `[checkpoint:human-action]` — Instruct user, wait for confirmation, resume execution agent.
194
221
  - **Task failed:** Enter retry logic (see below).
195
222
 
196
223
  3. **Retry logic on failure:**
@@ -198,7 +225,7 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
198
225
  - If `attemptsUsed < maxAttempts`:
199
226
  - Increment `attemptsUsed`.
200
227
  - Record the attempt (timestamp, error, fix attempted, result).
201
- - **Attempt 1:** Read error output, apply obvious fix, re-dispatch execution subagent for the failed task only.
228
+ - **Attempt 1:** Read error output, apply obvious fix, re-dispatch execution agent for the failed task only.
202
229
  - **Attempt 2:** Expand context — read related files, check `learnings.md` for similar failures, re-dispatch with additional context.
203
230
  - **Attempt 3:** Full context gather — read test output, imports, plan instructions for ambiguity. Re-dispatch with maximum context.
204
231
  - If budget exhausted:
@@ -213,16 +240,22 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
213
240
 
214
241
  ### VERIFY — Post-Execution Validation
215
242
 
216
- 1. **Dispatch verification subagent:**
243
+ 1. **Dispatch verification agent using the Agent tool:**
217
244
 
218
245
  ```
219
- You are running harness-verification for phase {N}: {name}.
246
+ Agent tool parameters:
247
+ subagent_type: "harness-verifier"
248
+ description: "Verify phase {N}: {name}"
249
+ prompt: |
250
+ You are running harness-verification for phase {N}: {name}.
220
251
 
221
- Follow the harness-verification skill process exactly.
222
- Report pass/fail with findings.
252
+ Session directory: {sessionDir}
253
+
254
+ Follow the harness-verification skill process exactly.
255
+ Report pass/fail with findings.
223
256
  ```
224
257
 
225
- 2. **When the subagent returns:**
258
+ 2. **When the agent returns:**
226
259
  - **All checks pass:** Transition to REVIEW.
227
260
  - **Failures found:** Surface findings to the user. Ask: "Fix these issues before review? (yes / skip verification / stop)"
228
261
  - **yes** — Re-enter EXECUTE with targeted fixes (retry budget resets for verification fixes).
@@ -235,16 +268,22 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
235
268
 
236
269
  ### REVIEW — Code Review
237
270
 
238
- 1. **Dispatch review subagent:**
271
+ 1. **Dispatch review agent using the Agent tool:**
239
272
 
240
273
  ```
241
- You are running harness-code-review for phase {N}: {name}.
274
+ Agent tool parameters:
275
+ subagent_type: "harness-code-reviewer"
276
+ description: "Review phase {N}: {name}"
277
+ prompt: |
278
+ You are running harness-code-review for phase {N}: {name}.
279
+
280
+ Session directory: {sessionDir}
242
281
 
243
- Follow the harness-code-review skill process exactly.
244
- Report findings with severity (blocking / warning / note).
282
+ Follow the harness-code-review skill process exactly.
283
+ Report findings with severity (blocking / warning / note).
245
284
  ```
246
285
 
247
- 2. **When the subagent returns:**
286
+ 2. **When the agent returns:**
248
287
  - **No blocking findings:** Report summary, transition to PHASE_COMPLETE.
249
288
  - **Blocking findings:** Surface to user. Ask: "Address blocking findings before completing this phase? (yes / override / stop)"
250
289
  - **yes** — Re-enter EXECUTE with review fixes.
@@ -303,7 +342,7 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
303
342
  - "Create a PR? (yes / no)"
304
343
  - If yes: assemble commit history, suggest PR title and description.
305
344
 
306
- 3. **Write final handoff:**
345
+ 3. **Write final handoff** to `{sessionDir}/handoff.json`:
307
346
 
308
347
  ```json
309
348
  {
@@ -326,20 +365,20 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
326
365
  - [skill:harness-autopilot] [outcome:observation] {any notable patterns from the run}
327
366
  ```
328
367
 
329
- 5. **Clean up state:** Set `currentState: "DONE"` in `autopilot-state.json`. Do not delete the file — it serves as a record.
368
+ 5. **Clean up state:** Set `currentState: "DONE"` in `{sessionDir}/autopilot-state.json`. Do not delete the file — it serves as a record.
330
369
 
331
370
  ## Harness Integration
332
371
 
333
372
  - **`harness validate`** — Run during INIT to verify project health. Included in every execution task via harness-execution delegation.
334
373
  - **`harness check-deps`** — Delegated to harness-execution (included in task steps).
335
- - **State file** — `.harness/autopilot-state.json` tracks the orchestration state machine. `.harness/state.json` tracks task-level execution state (managed by harness-execution).
336
- - **Handoff** — `.harness/handoff.json` is written by each delegated skill and read by the next. Autopilot writes a final handoff on DONE.
337
- - **Learnings** — `.harness/learnings.md` is appended by both delegated skills and autopilot itself.
374
+ - **State file** — `.harness/sessions/<slug>/autopilot-state.json` tracks the orchestration state machine. `.harness/sessions/<slug>/state.json` tracks task-level execution state (managed by harness-execution). The slug is derived from the spec path during INIT.
375
+ - **Handoff** — `.harness/sessions/<slug>/handoff.json` is written by each delegated skill and read by the next. Autopilot writes a final handoff on DONE.
376
+ - **Learnings** — `.harness/learnings.md` (global) is appended by both delegated skills and autopilot itself.
338
377
 
339
378
  ## Success Criteria
340
379
 
341
380
  - Single `/harness:autopilot` invocation executes all phases through to completion
342
- - Resume from any state after context reset via `.harness/autopilot-state.json`
381
+ - Resume from any state after context reset via session-scoped `autopilot-state.json`
343
382
  - Low-complexity phases auto-plan; high-complexity phases pause for interactive planning
344
383
  - Planning override bumps complexity upward when task signals disagree
345
384
  - Retry budget (3 attempts) with escalating context before surfacing failures
@@ -360,7 +399,7 @@ Read spec — found 3 phases:
360
399
  Phase 1: Core Scanner (complexity: low)
361
400
  Phase 2: Rule Engine (complexity: high)
362
401
  Phase 3: CLI Integration (complexity: low)
363
- Created .harness/autopilot-state.json. Starting Phase 1.
402
+ Created .harness/sessions/specs--2026-03-19-security-scanner/autopilot-state.json. Starting Phase 1.
364
403
  ```
365
404
 
366
405
  **Phase 1 — ASSESS:**
@@ -372,7 +411,7 @@ Phase 1: Core Scanner — complexity: low. Auto-planning.
372
411
  **Phase 1 — PLAN:**
373
412
 
374
413
  ```
375
- [Subagent runs harness-planning]
414
+ [harness-planner agent runs harness-planning]
376
415
  Plan generated: docs/plans/2026-03-19-core-scanner-plan.md (8 tasks, ~24 min)
377
416
  ```
378
417
 
@@ -388,9 +427,9 @@ Approve this plan and begin execution? (yes / revise / skip / stop)
388
427
  **Phase 1 — EXECUTE → VERIFY → REVIEW:**
389
428
 
390
429
  ```
391
- [Subagent executes 8 tasks... all pass]
392
- [Subagent runs verification... pass]
393
- [Subagent runs code review... 0 blocking, 2 notes]
430
+ [harness-task-executor agent executes 8 tasks... all pass]
431
+ [harness-verifier agent runs verification... pass]
432
+ [harness-code-reviewer agent runs code review... 0 blocking, 2 notes]
394
433
  ```
395
434
 
396
435
  **Phase 1 — PHASE_COMPLETE:**
@@ -479,16 +518,16 @@ How should we proceed? (fix manually and continue / revise plan / stop)
479
518
 
480
519
  ## Gates
481
520
 
482
- - **No reimplementing delegated skills.** Autopilot orchestrates. If you are writing planning logic, execution logic, verification logic, or review logic, STOP. Delegate to the appropriate skill.
521
+ - **No reimplementing delegated skills.** Autopilot orchestrates. If you are writing planning logic, execution logic, verification logic, or review logic, STOP. Delegate to the appropriate persona agent via `subagent_type`.
483
522
  - **No executing without plan approval.** Every plan must be explicitly approved by the human before execution begins. No exceptions, regardless of complexity level.
484
523
  - **No skipping VERIFY or REVIEW.** Every phase goes through verification and review. The human can override findings, but the steps cannot be skipped.
485
524
  - **No infinite retries.** The retry budget is 3 attempts. If exhausted, STOP and surface to the human. Do not extend the budget without explicit human instruction.
486
- - **No modifying autopilot-state.json manually.** The state file is managed by the skill. If the state appears corrupted, start fresh rather than patching it.
525
+ - **No modifying session state files manually.** The session state files are managed by the skill. If the state appears corrupted, start fresh rather than patching it.
487
526
 
488
527
  ## Escalation
489
528
 
490
529
  - **When the spec has no Implementation Order section:** Cannot identify phases. Ask the user to add phase annotations to the spec or provide a roadmap file.
491
- - **When a delegated skill fails to produce expected output:** Check that handoff.json was written correctly. If the subagent failed, report the failure and ask the user whether to retry the entire phase step or stop.
492
- - **When the user wants to reorder phases mid-run:** Update the phases array in autopilot-state.json (mark skipped phases, adjust currentPhase). Do not re-run completed phases.
530
+ - **When a delegated skill fails to produce expected output:** Check that `{sessionDir}/handoff.json` was written correctly. If the agent failed, report the failure and ask the user whether to retry the entire phase step or stop.
531
+ - **When the user wants to reorder phases mid-run:** Update the phases array in the session-scoped `autopilot-state.json` (mark skipped phases, adjust currentPhase). Do not re-run completed phases.
493
532
  - **When context limits are approaching:** Persist state immediately and inform the user: "Context limit approaching. State saved. Re-invoke /harness:autopilot to continue from this point."
494
533
  - **When multiple phases fail in sequence:** After 2 consecutive phase failures (retry budget exhausted in both), suggest the user review the spec for systemic issues rather than continuing.
@@ -42,9 +42,11 @@ phases:
42
42
  state:
43
43
  persistent: true
44
44
  files:
45
- - .harness/autopilot-state.json
46
- - .harness/state.json
45
+ - .harness/sessions/*/autopilot-state.json
46
+ - .harness/sessions/*/state.json
47
+ - .harness/sessions/*/handoff.json
47
48
  - .harness/learnings.md
49
+ - .harness/failures.md
48
50
  depends_on:
49
51
  - harness-planning
50
52
  - harness-execution
@@ -4,7 +4,7 @@ description: Analyze structural health of the codebase using graph metrics
4
4
  cognitive_mode: analytical-reporter
5
5
  triggers:
6
6
  - manual
7
- - scheduled
7
+ - on_milestone
8
8
  platforms:
9
9
  - claude-code
10
10
  - gemini-cli
@@ -0,0 +1,265 @@
1
+ # Harness Design
2
+
3
+ > Aesthetic direction workflow. Capture design intent, generate DESIGN.md with anti-patterns and platform notes, review components against aesthetic guidelines, and enforce design constraints at configurable strictness levels.
4
+
5
+ ## When to Use
6
+
7
+ - Establishing aesthetic direction for a new or existing project (style, tone, differentiator)
8
+ - When `on_new_feature` triggers fire and the feature has design scope requiring aesthetic guidance
9
+ - Reviewing existing components against declared design intent and anti-patterns
10
+ - Enforcing design constraints via the knowledge graph with configurable strictness
11
+ - Generating or updating `design-system/DESIGN.md` with aesthetic direction, anti-patterns, and platform notes
12
+ - NOT for design token generation or palette selection (use harness-design-system)
13
+ - NOT for accessibility auditing or WCAG compliance (use harness-accessibility)
14
+ - NOT for platform-specific token implementation into CSS/Tailwind/etc. (use harness-design-web/mobile, Phase 5)
15
+
16
+ ## Process
17
+
18
+ ### Phase 1: INTENT -- Capture Aesthetic Intent
19
+
20
+ 1. **Read existing design artifacts.** Search for:
21
+ - `design-system/DESIGN.md` -- existing aesthetic direction documentation (from harness-design-system output)
22
+ - `design-system/tokens.json` -- existing W3C DTCG tokens (palette, typography, spacing defined by harness-design-system)
23
+ - `harness.config.json` -- project configuration for design settings
24
+
25
+ 2. **Check harness configuration.** Read `harness.config.json` for:
26
+ - `design.strictness` -- enforcement level (`strict`, `standard`, `permissive`). If not set, default to `standard`.
27
+ - `design.platforms` -- which platforms are enabled (web, mobile)
28
+ - `design.aestheticIntent` -- path to design intent doc (default: `design-system/DESIGN.md`)
29
+
30
+ 3. **Load industry profile.** If an industry is specified (via CLI `--industry` arg or config), read the industry profile from `agents/skills/shared/design-knowledge/industries/{industry}.yaml`. Available industries include: `saas`, `fintech`, `healthcare`, `ecommerce`, `creative`, `emerging-tech`, `lifestyle`, `services`. The profile provides sector-specific guidance on:
31
+ - Recommended visual style and tone
32
+ - Industry conventions and user expectations
33
+ - Regulatory or cultural considerations
34
+ - Common anti-patterns for the sector
35
+
36
+ 4. **Capture user intent.** Ask the user to define:
37
+ - **Style:** minimal, expressive, corporate, playful, editorial, or custom
38
+ - **Tone:** warm, cool, neutral, bold, muted, or custom
39
+ - **Key differentiator:** what makes this product's visual identity unique
40
+ - **Anti-patterns:** specific design choices to explicitly avoid (e.g., "no gradients on data elements," "no decorative borders on cards")
41
+
42
+ 5. **Load shared design knowledge.** Read anti-pattern awareness from `agents/skills/shared/design-knowledge/`:
43
+ - `palettes/curated.yaml` -- curated palettes to understand which aesthetic families are available
44
+ - `typography/pairings.yaml` -- typography pairings to understand which font combinations are recommended
45
+ - Industry-specific anti-pattern guidance from the loaded industry profile
46
+
47
+ 6. **Confirm intent before proceeding.** Present a summary of the captured aesthetic intent to the user. This is a hard gate -- no DESIGN.md generation without the user confirming their aesthetic intent.
48
+
49
+ ### Phase 2: DIRECTION -- Generate DESIGN.md
50
+
51
+ 1. **Generate or update `design-system/DESIGN.md`.** The document must contain the following sections:
52
+
53
+ **Aesthetic Direction:**
54
+ - Style declaration (the chosen style and what it means for this project)
55
+ - Tone description (how the tone manifests in color usage, typography weight, spacing density)
56
+ - Key differentiator (the unique visual identity aspect and how it is expressed)
57
+
58
+ **Anti-Patterns:**
59
+ - Project-specific anti-patterns (from user input in Phase 1)
60
+ - Industry-informed anti-patterns (from the loaded industry profile)
61
+ - Each anti-pattern includes: name, description, example of what NOT to do, and why it conflicts with the declared intent
62
+
63
+ **Platform Notes:**
64
+ - Web-specific guidance (CSS strategy, responsive behavior, animation preferences)
65
+ - Mobile-specific guidance (touch targets, native component usage, platform conventions)
66
+ - Cross-platform consistency rules (which elements must be identical vs. platform-adapted)
67
+
68
+ **Strictness Override:**
69
+ - Current `designStrictness` level and what it means
70
+ - Instructions for changing strictness in `harness.config.json`
71
+ - Behavior differences per level:
72
+ - `permissive` -- all design violations reported as `info` (nothing blocks)
73
+ - `standard` -- anti-pattern and accessibility violations are `warn`, critical violations are `error` (default)
74
+ - `strict` -- accessibility violations are `error` (blocks CI/PR merge), anti-pattern violations are `warn`
75
+
76
+ 2. **Populate the knowledge graph.** If a graph exists at `.harness/graph/`:
77
+ - Create an `AestheticIntent` node with properties: style, tone, differentiator, strictness level. Use `DesignIngestor` from `packages/graph/src/ingest/DesignIngestor.ts` for graph ingestion.
78
+ - Create a `DECLARES_INTENT` edge from the project node to the `AestheticIntent` node.
79
+ - This enables downstream skills (harness-accessibility, harness-impact-analysis) to query the declared design intent.
80
+
81
+ 3. **Run harness validate.** After generating DESIGN.md, verify the project still passes all constraints. The new file must not break existing validations.
82
+
83
+ ### Phase 3: REVIEW -- Review Components Against Design Intent
84
+
85
+ 1. **Scan for anti-pattern violations.** Use Grep to search the codebase for patterns that match declared anti-patterns:
86
+ - Hardcoded color values not present in `design-system/tokens.json` (suggests off-brand color usage)
87
+ - Font families flagged as anti-patterns in the design intent (e.g., decorative fonts in a minimal project)
88
+ - Layout patterns on the forbidden list (e.g., excessive drop shadows in a flat design, gradients on data elements)
89
+ - CSS properties or values that contradict the declared style (e.g., rounded corners in a sharp-edge design)
90
+
91
+ 2. **Load detection rules from shared design knowledge.** Read from `agents/skills/shared/design-knowledge/`:
92
+ - `anti-patterns/typography.yaml` — font combinations, size, weight, and line-height issues that clash with the declared style
93
+ - `anti-patterns/color.yaml` — hardcoded colors, insufficient contrast, color-only indicators that undermine the declared tone
94
+ - `anti-patterns/layout.yaml` — spacing inconsistencies, missing touch targets, fixed-width containers
95
+ - `anti-patterns/motion.yaml` — missing prefers-reduced-motion, long animations, scroll-jacking
96
+ - `industries/{industry}.yaml` — industry-specific rules from the loaded industry profile
97
+
98
+ 3. **Cross-reference with graph constraints.** If a graph exists at `.harness/graph/`:
99
+ - Query for existing `VIOLATES_DESIGN` edges using `DesignConstraintAdapter` from `packages/graph/src/constraints/DesignConstraintAdapter.ts`
100
+ - Compare current findings against previously recorded violations
101
+ - Identify new violations and resolved violations
102
+
103
+ 4. **Assign severity based on `designStrictness`:**
104
+ - `permissive` -- all findings are `info` severity
105
+ - `standard` -- anti-pattern violations and accessibility-related findings are `warn`, critical design constraint violations are `error`
106
+ - `strict` -- accessibility violations are `error` (blocks), anti-pattern violations are `warn`
107
+
108
+ 5. **Report findings.** Present each finding with:
109
+ - File path and line number
110
+ - Violation description and which anti-pattern or design constraint it violates
111
+ - Severity level (based on current strictness)
112
+ - Suggested remediation
113
+
114
+ ### Phase 4: ENFORCE -- Surface and Record Violations
115
+
116
+ 1. **Create constraint nodes in the graph.** For each violated design rule, if a graph exists at `.harness/graph/`:
117
+ - Create a `DesignConstraint` node for the rule being violated (if one does not already exist)
118
+ - Create a `VIOLATES_DESIGN` edge from the violating component to the `DesignConstraint` node
119
+ - Use `DesignConstraintAdapter` from `packages/graph/src/constraints/DesignConstraintAdapter.ts` to manage constraint creation and violation recording
120
+
121
+ 2. **Format violation output.** Each violation follows a numbered format:
122
+
123
+ ```
124
+ DESIGN-001 [warn] Anti-pattern: gradient used on data visualization element
125
+ File: src/components/Chart.tsx
126
+ Line: 42
127
+ Constraint: No gradients on data elements
128
+ Intent: Style "minimal" prohibits decorative effects on informational components
129
+ Fix: Replace linear-gradient with solid color from token "neutral.100"
130
+
131
+ DESIGN-002 [error] Off-brand color: hardcoded #ff6b35 not in token set
132
+ File: src/components/Alert.tsx
133
+ Line: 18
134
+ Constraint: All colors must reference design tokens
135
+ Intent: Tone "cool" conflicts with warm orange accent
136
+ Fix: Use token "semantic.warning" (#f59e0b) or add color to tokens.json via harness-design-system
137
+
138
+ DESIGN-003 [info] Typography: decorative font "Playfair Display" used in component
139
+ File: src/components/Hero.tsx
140
+ Line: 8
141
+ Constraint: Heading font must match declared typography pairing
142
+ Intent: Style "minimal" uses Inter for all headings
143
+ Fix: Replace with token "typography.heading.fontFamily"
144
+ ```
145
+
146
+ 3. **Control severity by `designStrictness`:**
147
+ - `permissive` -- all violations output as `info` (DESIGN-001 [info], DESIGN-002 [info], etc.)
148
+ - `standard` -- anti-patterns and a11y = `warn`, off-brand tokens = `error` (default)
149
+ - `strict` -- a11y violations = `error` (blocks CI), anti-patterns = `warn`, off-brand tokens = `error`
150
+
151
+ 4. **Run harness validate.** After recording violations in the graph, run validation to ensure the enforcement pass is consistent with the project state.
152
+
153
+ ## Harness Integration
154
+
155
+ - **`harness validate`** -- Run after generating DESIGN.md and after enforcement passes. Design violations surface as constraint violations at the configured strictness level.
156
+ - **`harness scan`** -- Run after changes to refresh the knowledge graph. Updated graph enables accurate violation detection and impact analysis.
157
+ - **`DesignIngestor`** (`packages/graph/src/ingest/DesignIngestor.ts`) -- Parses `tokens.json` and `DESIGN.md` to create graph nodes representing the design system. Creates `AestheticIntent` nodes and `DECLARES_INTENT` edges during the DIRECTION phase.
158
+ - **`DesignConstraintAdapter`** (`packages/graph/src/constraints/DesignConstraintAdapter.ts`) -- Manages `DesignConstraint` nodes and `VIOLATES_DESIGN` edges in the graph. Reads `design.strictness` to control violation severity. Used during REVIEW and ENFORCE phases.
159
+
160
+ **Graph naming convention:** This skill uses PascalCase for node types (`AestheticIntent`, `DesignToken`, `DesignConstraint`) and UPPER_SNAKE for edge types (`DECLARES_INTENT`, `VIOLATES_DESIGN`, `USES_TOKEN`, `PLATFORM_BINDING`) as conceptual labels. The graph schema registers these as snake_case identifiers (`aesthetic_intent`, `design_token`, `design_constraint`, `declares_intent`, `violates_design`, `uses_token`, `platform_binding`). The adapter classes (`DesignIngestor`, `DesignConstraintAdapter`) handle the mapping — always use the adapters rather than constructing graph queries with raw type names.
161
+
162
+ - **`harness-design-system`** -- Dependency. This skill reads tokens and design intent generated by harness-design-system. Token-level issues (palette changes, new colors) are resolved by running harness-design-system, not this skill.
163
+ - **`harness-impact-analysis`** -- When design tokens change, impact analysis traces which components consume affected tokens. Use this to determine which components need re-review after token updates.
164
+
165
+ ## Success Criteria
166
+
167
+ - `design-system/DESIGN.md` exists with all required sections: Aesthetic Direction, Anti-Patterns, Platform Notes, Strictness Override
168
+ - Anti-patterns are detected in the codebase and reported with file paths, line numbers, and severity
169
+ - `designStrictness` configuration is read from `harness.config.json` and respected in all severity assignments
170
+ - `AestheticIntent` node created in the knowledge graph with style, tone, differentiator, and strictness properties
171
+ - `DECLARES_INTENT` edge connects the project to the aesthetic intent node
172
+ - `DesignConstraint` nodes created for each violated design rule
173
+ - `VIOLATES_DESIGN` edges connect violating components to their constraint nodes
174
+ - Violations output in numbered format (DESIGN-001, DESIGN-002, etc.) with severity matching strictness level
175
+ - `harness validate` passes after DESIGN.md generation and enforcement
176
+ - User confirmed aesthetic intent before DESIGN.md generation (hard gate)
177
+
178
+ ## Examples
179
+
180
+ ### Example: SaaS Analytics Dashboard Aesthetic Direction
181
+
182
+ **Context:** A SaaS analytics dashboard project. Industry: `saas`. Design tokens already generated by harness-design-system. No existing DESIGN.md aesthetic direction.
183
+
184
+ **INTENT capture:**
185
+
186
+ ```
187
+ Industry profile: Loaded (saas) -- recommends professional, data-focused aesthetic
188
+ Style: Minimal
189
+ Tone: Cool, professional
190
+ Differentiator: Dense information display with generous whitespace between sections
191
+ Anti-patterns: No gradients on data elements, no decorative borders on cards,
192
+ no more than 2 font weights per component
193
+ Strictness: standard (from harness.config.json)
194
+ ```
195
+
196
+ **DIRECTION output (DESIGN.md excerpt):**
197
+
198
+ ```markdown
199
+ ## Aesthetic Direction
200
+
201
+ **Style:** Minimal -- clean lines, flat surfaces, no decorative elements that do not serve
202
+ an informational purpose. Every visual element must earn its place by conveying data or
203
+ guiding the user's eye.
204
+
205
+ **Tone:** Cool, professional -- slate and blue palette dominates. Warm colors reserved
206
+ exclusively for semantic states (warning, error). No warm accents in neutral UI.
207
+
208
+ **Differentiator:** Dense information display with generous whitespace between sections.
209
+ Components are compact internally but breathe externally. Card padding is tight (12px),
210
+ but gaps between cards are generous (24px+).
211
+
212
+ ## Anti-Patterns
213
+
214
+ | Pattern | Description | Why It Conflicts |
215
+ | -------------------------- | -------------------------------------------- | ------------------------------------------ |
216
+ | Gradients on data elements | linear-gradient on charts, tables, cards | Minimal style: flat surfaces only |
217
+ | Decorative card borders | border with color on .card elements | Minimal style: borders are structural only |
218
+ | Excess font weights | More than 2 font-weight values per component | Minimal style: typographic restraint |
219
+
220
+ ## Strictness Override
221
+
222
+ Current level: **standard**
223
+
224
+ To change, update `harness.config.json`:
225
+ "design": { "strictness": "strict" | "standard" | "permissive" }
226
+ ```
227
+
228
+ **REVIEW findings:**
229
+
230
+ ```
231
+ Found 3 anti-pattern violations in 2 files:
232
+
233
+ DESIGN-001 [warn] Gradient on data element
234
+ File: src/components/RevenueChart.tsx:42
235
+ Constraint: No gradients on data elements
236
+ Fix: Replace linear-gradient(#3b82f6, #1d4ed8) with solid token "primary.500"
237
+
238
+ DESIGN-002 [warn] Decorative border on card
239
+ File: src/components/MetricCard.tsx:15
240
+ Constraint: No decorative borders on cards
241
+ Fix: Remove border-color: #3b82f6, use border-color: transparent or remove border
242
+
243
+ DESIGN-003 [info] Three font weights in one component
244
+ File: src/components/MetricCard.tsx:8
245
+ Constraint: Max 2 font weights per component
246
+ Fix: Consolidate font-weight values to 400 (body) and 600 (heading) only
247
+ ```
248
+
249
+ ## Gates
250
+
251
+ These are hard stops. Violating any gate means the process has broken down.
252
+
253
+ - **No DESIGN.md generated without the user confirming aesthetic intent.** The INTENT phase must end with explicit user confirmation of style, tone, differentiator, and anti-patterns. Do not generate based on assumptions.
254
+ - **No enforcement without reading tokens from harness-design-system.** The REVIEW and ENFORCE phases require `design-system/tokens.json` to exist. If tokens have not been generated, instruct the user to run harness-design-system first.
255
+ - **Strictness must be read from configuration, not assumed.** Read `design.strictness` from `harness.config.json`. If the key does not exist, default to `standard` and report the default to the user. Never hardcode a strictness level.
256
+ - **No anti-pattern detection without a declared intent.** The REVIEW phase requires an existing DESIGN.md with declared anti-patterns. If no intent has been captured, run the INTENT and DIRECTION phases first.
257
+ - **No graph mutations without validating node types.** When creating `AestheticIntent`, `DesignConstraint`, or `VIOLATES_DESIGN` edges, verify the node and edge types are registered in the graph schema before writing.
258
+
259
+ ## Escalation
260
+
261
+ - **When the user cannot articulate a style or tone:** Suggest industry-based defaults from the loaded industry profile. Present 2-3 options with examples: "Based on the saas industry profile, common styles are: (1) Minimal -- clean, data-focused, (2) Corporate -- structured, trustworthy, (3) Expressive -- colorful, engaging. Which resonates most?"
262
+ - **When declared anti-patterns conflict with existing code:** Present a migration path rather than flagging every instance as a violation. Report: "Found 47 instances of gradients on data elements. Recommend a phased migration: (1) Update new components immediately, (2) Schedule legacy component updates over 3 sprints. Set strictness to 'permissive' during migration to avoid blocking CI."
263
+ - **When tokens do not exist yet:** Do not attempt to infer a token set. Instruct the user: "Design tokens have not been generated. Run harness-design-system first to create `design-system/tokens.json`, then re-run harness-design for aesthetic direction."
264
+ - **When strictness level conflicts with team velocity:** Explain the tradeoffs: "Strict mode blocks PRs on any design violation. If this is slowing the team, consider 'standard' mode which blocks only on critical violations (off-brand colors, accessibility) and warns on anti-patterns."
265
+ - **When the knowledge graph is unavailable:** Skip graph operations in DIRECTION and ENFORCE phases. Log: "Graph not available at `.harness/graph/` -- skipping AestheticIntent node creation and violation recording. Run `harness scan` later to populate." Continue with file-based operations.