@harness-engineering/cli 1.8.0 → 1.8.1

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 (74) hide show
  1. package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +2 -2
  2. package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +5 -7
  3. package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +2 -2
  4. package/dist/agents/skills/claude-code/harness-planning/SKILL.md +2 -2
  5. package/dist/agents/skills/claude-code/harness-roadmap/SKILL.md +4 -5
  6. package/dist/agents/skills/gemini-cli/add-harness-component/SKILL.md +192 -0
  7. package/dist/agents/skills/gemini-cli/add-harness-component/skill.yaml +32 -0
  8. package/dist/agents/skills/gemini-cli/align-documentation/SKILL.md +213 -0
  9. package/dist/agents/skills/gemini-cli/align-documentation/skill.yaml +31 -0
  10. package/dist/agents/skills/gemini-cli/check-mechanical-constraints/SKILL.md +191 -0
  11. package/dist/agents/skills/gemini-cli/check-mechanical-constraints/skill.yaml +32 -0
  12. package/dist/agents/skills/gemini-cli/cleanup-dead-code/SKILL.md +245 -0
  13. package/dist/agents/skills/gemini-cli/cleanup-dead-code/skill.yaml +33 -0
  14. package/dist/agents/skills/gemini-cli/detect-doc-drift/SKILL.md +179 -0
  15. package/dist/agents/skills/gemini-cli/detect-doc-drift/skill.yaml +30 -0
  16. package/dist/agents/skills/gemini-cli/enforce-architecture/SKILL.md +240 -0
  17. package/dist/agents/skills/gemini-cli/enforce-architecture/skill.yaml +34 -0
  18. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/SKILL.md +397 -0
  19. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/skill.yaml +48 -0
  20. package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +2 -2
  21. package/dist/agents/skills/gemini-cli/harness-brainstorming/SKILL.md +317 -0
  22. package/dist/agents/skills/gemini-cli/harness-brainstorming/skill.yaml +49 -0
  23. package/dist/agents/skills/gemini-cli/harness-code-review/SKILL.md +681 -0
  24. package/dist/agents/skills/gemini-cli/harness-code-review/skill.yaml +45 -0
  25. package/dist/agents/skills/gemini-cli/harness-debugging/SKILL.md +366 -0
  26. package/dist/agents/skills/gemini-cli/harness-debugging/skill.yaml +47 -0
  27. package/dist/agents/skills/gemini-cli/harness-diagnostics/SKILL.md +318 -0
  28. package/dist/agents/skills/gemini-cli/harness-diagnostics/skill.yaml +50 -0
  29. package/dist/agents/skills/gemini-cli/harness-execution/SKILL.md +382 -0
  30. package/dist/agents/skills/gemini-cli/harness-execution/skill.yaml +51 -0
  31. package/dist/agents/skills/gemini-cli/harness-git-workflow/SKILL.md +268 -0
  32. package/dist/agents/skills/gemini-cli/harness-git-workflow/skill.yaml +31 -0
  33. package/dist/agents/skills/gemini-cli/harness-integrity/SKILL.md +167 -0
  34. package/dist/agents/skills/gemini-cli/harness-integrity/skill.yaml +47 -0
  35. package/dist/agents/skills/gemini-cli/harness-onboarding/SKILL.md +288 -0
  36. package/dist/agents/skills/gemini-cli/harness-onboarding/skill.yaml +30 -0
  37. package/dist/agents/skills/gemini-cli/harness-parallel-agents/SKILL.md +171 -0
  38. package/dist/agents/skills/gemini-cli/harness-parallel-agents/skill.yaml +33 -0
  39. package/dist/agents/skills/gemini-cli/harness-planning/SKILL.md +389 -0
  40. package/dist/agents/skills/gemini-cli/harness-planning/skill.yaml +49 -0
  41. package/dist/agents/skills/gemini-cli/harness-pre-commit-review/SKILL.md +262 -0
  42. package/dist/agents/skills/gemini-cli/harness-pre-commit-review/skill.yaml +33 -0
  43. package/dist/agents/skills/gemini-cli/harness-refactoring/SKILL.md +169 -0
  44. package/dist/agents/skills/gemini-cli/harness-refactoring/skill.yaml +33 -0
  45. package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +4 -5
  46. package/dist/agents/skills/gemini-cli/harness-skill-authoring/SKILL.md +292 -0
  47. package/dist/agents/skills/gemini-cli/harness-skill-authoring/skill.yaml +32 -0
  48. package/dist/agents/skills/gemini-cli/harness-state-management/SKILL.md +309 -0
  49. package/dist/agents/skills/gemini-cli/harness-state-management/skill.yaml +32 -0
  50. package/dist/agents/skills/gemini-cli/harness-tdd/SKILL.md +177 -0
  51. package/dist/agents/skills/gemini-cli/harness-tdd/skill.yaml +48 -0
  52. package/dist/agents/skills/gemini-cli/harness-verification/SKILL.md +328 -0
  53. package/dist/agents/skills/gemini-cli/harness-verification/skill.yaml +42 -0
  54. package/dist/agents/skills/gemini-cli/harness-verify/SKILL.md +159 -0
  55. package/dist/agents/skills/gemini-cli/harness-verify/skill.yaml +40 -0
  56. package/dist/agents/skills/gemini-cli/initialize-harness-project/SKILL.md +224 -0
  57. package/dist/agents/skills/gemini-cli/initialize-harness-project/skill.yaml +31 -0
  58. package/dist/agents/skills/gemini-cli/validate-context-engineering/SKILL.md +150 -0
  59. package/dist/agents/skills/gemini-cli/validate-context-engineering/skill.yaml +31 -0
  60. package/dist/bin/harness.js +3 -3
  61. package/dist/{chunk-SJECMKSS.js → chunk-E2RTDBMG.js} +25 -13
  62. package/dist/{chunk-LNI4T7R6.js → chunk-KJANDVVC.js} +20 -18
  63. package/dist/{chunk-3JWCBVUZ.js → chunk-RT2LYQHF.js} +1 -1
  64. package/dist/{dist-NT3GXHQZ.js → dist-CCM3L3UE.js} +1 -1
  65. package/dist/{dist-BDO5GFEM.js → dist-K6KTTN3I.js} +3 -3
  66. package/dist/index.js +3 -3
  67. package/dist/validate-cross-check-ZGKFQY57.js +7 -0
  68. package/package.json +6 -6
  69. package/dist/agents/skills/node_modules/.bin/glob +0 -17
  70. package/dist/agents/skills/node_modules/.bin/vitest +0 -17
  71. package/dist/agents/skills/node_modules/.bin/yaml +0 -17
  72. package/dist/templates/advanced/docs/specs/.gitkeep +0 -0
  73. package/dist/templates/intermediate/docs/specs/.gitkeep +0 -0
  74. package/dist/validate-cross-check-2OPGCGGU.js +0 -7
@@ -398,7 +398,7 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
398
398
 
399
399
  ### Example: 3-Phase Security Scanner
400
400
 
401
- **User invokes:** `/harness:autopilot docs/specs/2026-03-19-security-scanner.md`
401
+ **User invokes:** `/harness:autopilot docs/changes/security-scanner/proposal.md`
402
402
 
403
403
  **INIT:**
404
404
 
@@ -407,7 +407,7 @@ Read spec — found 3 phases:
407
407
  Phase 1: Core Scanner (complexity: low)
408
408
  Phase 2: Rule Engine (complexity: high)
409
409
  Phase 3: CLI Integration (complexity: low)
410
- Created .harness/sessions/specs--2026-03-19-security-scanner/autopilot-state.json. Starting Phase 1.
410
+ Created .harness/sessions/changes--security-scanner--proposal/autopilot-state.json. Starting Phase 1.
411
411
  ```
412
412
 
413
413
  **Phase 1 — ASSESS:**
@@ -108,9 +108,7 @@ These keywords flow into the `handoff.json` `contextKeywords` field when the spe
108
108
 
109
109
  2. **Run soundness review.** After all sections are reviewed and the spec is drafted, invoke `harness-soundness-review --mode spec` against the draft. Do not proceed to write the spec to `docs/` until the soundness review converges with no remaining issues.
110
110
 
111
- 3. **Write the spec to `docs/`.** Use the project's existing spec naming convention. If none exists, use `docs/specs/YYYY-MM-DD-<feature-name>.md`.
112
-
113
- When the project has `docs/specs/`, write proposals to `docs/changes/<feature>/proposal.md` instead. This keeps change proposals separate from established specs. Fall back to the existing behavior (`docs/specs/`) when no `docs/specs/` directory exists yet.
111
+ 3. **Write the spec to `docs/`.** Write proposals to `docs/changes/<feature>/proposal.md`. This keeps change proposals organized by feature in a consistent location.
114
112
 
115
113
  4. **Run `harness validate`** to verify the spec file is properly placed and the project remains healthy.
116
114
 
@@ -216,7 +214,7 @@ Converge on a recommendation that addresses all concerns before presenting the d
216
214
 
217
215
  - **`harness validate`** — Run after writing the spec to `docs/`. Verifies project health and that the new spec file is properly placed.
218
216
  - **`harness check-docs`** — Run to verify the spec does not conflict with existing documentation.
219
- - **Spec location** — Specs go to `docs/` (or `docs/specs/` if the project uses that convention). Follow existing naming patterns.
217
+ - **Spec location** — Specs go to `docs/changes/<feature>/proposal.md`. Follow existing naming patterns.
220
218
  - **Handoff to harness-planning** — Once the spec is approved, invoke harness-planning to create the implementation plan from the spec.
221
219
  - **`emit_interaction`** -- Call at the end of Phase 4 to suggest transitioning to harness-planning. Uses confirmed transition (waits for user approval).
222
220
 
@@ -247,7 +245,7 @@ These patterns make requirements testable and unambiguous. Apply them when the o
247
245
 
248
246
  ```
249
247
  Read AGENTS.md — project is a TypeScript monorepo with React frontend and Express backend.
250
- Read existing docs/ — no prior notification specs. Found docs/specs/2026-01-15-user-auth.md as naming example.
248
+ Read existing docs/ — no prior notification specs. Found docs/changes/user-auth/proposal.md as naming example.
251
249
  Checked src/services/ — no notification code exists. Found email utility in src/utils/email.ts.
252
250
  Scope assessment: single subsystem (notifications), estimated 1 week. Proceed.
253
251
  ```
@@ -293,10 +291,10 @@ Human: "Agreed, approach 2."
293
291
  **VALIDATE:**
294
292
 
295
293
  ```
296
- Wrote docs/specs/2026-03-14-notification-system.md
294
+ Wrote docs/changes/notification-system/proposal.md
297
295
  Sections: Overview, Decisions, Technical Design, Success Criteria, Implementation Order
298
296
  harness validate — passes
299
- "Spec written to docs/specs/2026-03-14-notification-system.md. Ready for sign-off?"
297
+ "Spec written to docs/changes/notification-system/proposal.md. Ready for sign-off?"
300
298
  Human: "Approved."
301
299
  ```
302
300
 
@@ -196,7 +196,7 @@ Gather context in this order until the ratio is met:
196
196
 
197
197
  1. **Files directly imported/referenced by changed files** — read the modules the changed code calls or depends on.
198
198
  2. **Corresponding test files** — find tests for changed code. If tests are missing, note this as a finding.
199
- 3. **Spec/design docs mentioning changed components** — search `docs/specs/`, `docs/design-docs/`, `docs/plans/`.
199
+ 3. **Spec/design docs mentioning changed components** — search `docs/changes/`, `docs/design-docs/`, `docs/plans/`.
200
200
  4. **Type definitions used by changed code** — read interfaces, types, schemas consumed or produced.
201
201
  5. **Recent commits touching the same files** — see Commit History below.
202
202
 
@@ -224,7 +224,7 @@ grep -n "import\|require\|from " <changed-file>
224
224
  find . -name "*<module-name>*test*" -o -name "*<module-name>*spec*"
225
225
 
226
226
  # 4. Search for spec/design references
227
- grep -rl "<component-name>" docs/specs/ docs/design-docs/ docs/plans/
227
+ grep -rl "<component-name>" docs/changes/ docs/design-docs/ docs/plans/
228
228
 
229
229
  # 5. Find type definitions
230
230
  grep -rn "interface\|type\|schema" <changed-file> | head -20
@@ -208,7 +208,7 @@ When presenting the task breakdown, use progress markers:
208
208
  # Plan: <Feature Name>
209
209
 
210
210
  **Date:** YYYY-MM-DD
211
- **Spec:** docs/specs/<spec-file>.md (if applicable)
211
+ **Spec:** docs/changes/<feature>/proposal.md (if applicable)
212
212
  **Estimated tasks:** N
213
213
  **Estimated time:** N minutes
214
214
 
@@ -286,7 +286,7 @@ When planning changes to existing functionality (not greenfield), express requir
286
286
 
287
287
  This is not mandatory for greenfield features. Only apply when modifying existing documented behavior.
288
288
 
289
- When `docs/specs/` exists in the project, produce `docs/changes/<feature>/delta.md` alongside the task plan. This keeps the change intent separate from the full spec and makes review easier.
289
+ When `docs/changes/` exists in the project, produce `docs/changes/<feature>/delta.md` alongside the task plan. This keeps the change intent separate from the full spec and makes review easier.
290
290
 
291
291
  ## Success Criteria
292
292
 
@@ -29,7 +29,6 @@ If the human has not seen and approved the milestone groupings and feature list,
29
29
  1. Check if `docs/roadmap.md` already exists.
30
30
  - If it exists: warn the human. "A roadmap already exists. Overwriting will replace it. Continue? (y/n)" Wait for confirmation before proceeding. If declined, stop.
31
31
  2. Scan for specs:
32
- - `docs/specs/*.md`
33
32
  - `docs/changes/*/proposal.md`
34
33
  - Record each spec's title, status (if detectable from frontmatter or content), and file path.
35
34
  3. Scan for plans:
@@ -68,11 +67,11 @@ Unmatched plans: N (flag for review)
68
67
 
69
68
  ## Current Work
70
69
  - Feature A (in-progress) -- spec: docs/changes/feature-a/proposal.md
71
- - Feature B (in-progress) -- spec: docs/specs/feature-b.md
70
+ - Feature B (in-progress) -- spec: docs/changes/feature-b/proposal.md
72
71
 
73
72
  ## Backlog
74
73
  - Feature C (planned) -- spec: docs/changes/feature-c/proposal.md
75
- - Feature D (backlog) -- spec: docs/specs/feature-d.md
74
+ - Feature D (backlog) -- spec: docs/changes/feature-d/proposal.md
76
75
  ```
77
76
 
78
77
  2. Offer choices:
@@ -405,7 +404,7 @@ Choice?
405
404
 
406
405
  ## Success Criteria
407
406
 
408
- 1. `--create` discovers all specs (`docs/specs/*.md`, `docs/changes/*/proposal.md`) and plans (`docs/plans/*.md`)
407
+ 1. `--create` discovers all specs (`docs/changes/*/proposal.md`) and plans (`docs/plans/*.md`)
409
408
  2. `--create` proposes groupings and waits for human confirmation before writing
410
409
  3. `--create` produces a valid `docs/roadmap.md` that round-trips through `parseRoadmap`/`serializeRoadmap`
411
410
  4. `--add` collects all fields interactively (milestone, status, spec, summary, blockers, plan)
@@ -452,7 +451,7 @@ Proposed Roadmap Structure:
452
451
  - Update Checker (in-progress) -- spec: docs/changes/update-checker/proposal.md
453
452
 
454
453
  ## Backlog
455
- - Design System (backlog) -- spec: docs/specs/design-system.md
454
+ - Design System (backlog) -- spec: docs/changes/design-system/proposal.md
456
455
 
457
456
  Options:
458
457
  (A) Accept this structure
@@ -0,0 +1,192 @@
1
+ # Add Harness Component
2
+
3
+ > Add layers, documentation, components, or skills to an existing harness project with proper integration. Validate against existing constraints, wire into architecture, and verify the result.
4
+
5
+ ## When to Use
6
+
7
+ - Adding a new layer to the project's architecture
8
+ - Adding a new documentation file that harness should track
9
+ - Adding a new component (module, service, package) that must be wired into existing layer boundaries
10
+ - Adding a new skill to the project's skill library
11
+ - When a plan calls for introducing a new architectural boundary or module
12
+ - NOT when initializing a project from scratch (use initialize-harness-project)
13
+ - NOT when modifying an existing component (use standard editing workflows)
14
+ - NOT when removing components (manual process — removing requires careful dependency analysis)
15
+
16
+ ## Process
17
+
18
+ ### Phase 1: DETERMINE — Identify What to Add
19
+
20
+ 1. **Clarify the component type.** Ask if not obvious from context:
21
+ - **Layer:** A new architectural boundary (e.g., adding an "infrastructure" layer to a project that only has "business" and "data")
22
+ - **Document:** A documentation file that harness should track for drift detection (e.g., API docs, architecture decision records)
23
+ - **Component:** A code module, service, or package that lives within an existing layer
24
+ - **Skill:** A new harness skill definition for the project's workflow
25
+
26
+ 2. **Gather requirements.** For each type:
27
+ - **Layer:** Name, which directories belong to it, which layers it can import from, which layers can import from it
28
+ - **Document:** Path, what it documents, which code files it relates to
29
+ - **Component:** Name, which layer it belongs to, what it depends on, what will depend on it
30
+ - **Skill:** Name, purpose, type (rigid or flexible), triggers
31
+
32
+ 3. **Check prerequisites.** The project must already be initialized with harness. If `harness.yaml` does not exist, stop and run initialize-harness-project first.
33
+
34
+ ### Phase 2: VALIDATE — Check Against Existing Constraints
35
+
36
+ 1. **Read the current configuration.** Load `harness.yaml` and `AGENTS.md` to understand existing layers, constraints, and architecture.
37
+
38
+ 2. **Verify the new component does not conflict:**
39
+ - Does the layer name already exist?
40
+ - Does the component directory already exist?
41
+ - Would the new dependency relationships create circular imports?
42
+ - Does the component violate any existing forbidden-import rules?
43
+
44
+ 3. **If conflicts are found,** report them clearly: "Adding layer X would conflict with existing layer Y because [reason]. Options: [A] rename, [B] merge into existing layer, [C] restructure. Which do you prefer?"
45
+
46
+ 4. **Run `harness check-deps`** on the current state to establish a clean baseline. If it already fails, fix existing violations before adding new components.
47
+
48
+ ### Phase 3: ADD — Create the Component
49
+
50
+ 1. **Run `harness add` with appropriate arguments:**
51
+ - Layer: `harness add layer <name> --dirs <dir1,dir2> --imports <allowed-layers>`
52
+ - Document: `harness add doc <path> --tracks <related-code-paths>`
53
+ - Component: `harness add component <name> --layer <layer-name>`
54
+ - Skill: `harness add skill <name> --type <rigid|flexible>`
55
+
56
+ 2. **Review generated files and configuration changes.** `harness add` modifies `harness.yaml` and may generate template files. Check that the changes look correct.
57
+
58
+ 3. **Create the actual code or content.** `harness add` creates the configuration entry but not necessarily the implementation. Create the directories, files, and initial code as needed.
59
+
60
+ ### Phase 4: WIRE — Integrate into Architecture
61
+
62
+ 1. **Update imports and exports.** If the new component needs to be imported by existing code, add the imports. If existing code needs to be aware of the new layer, update barrel files or index modules.
63
+
64
+ 2. **Update `AGENTS.md`.** Add the new component to the architecture section. Document its purpose, boundaries, and relationships to other components. This keeps agent instructions accurate.
65
+
66
+ 3. **Update layer configuration** if the new component changes dependency relationships. Ensure `harness.yaml` reflects the actual import graph.
67
+
68
+ 4. **For new skills:** Write the `skill.yaml` and `SKILL.md` files following the harness skill format. Use harness-skill-authoring for guidance on writing good skill content.
69
+
70
+ ### Phase 5: VERIFY — Confirm Integration
71
+
72
+ 1. **Run `harness validate`** to verify the full project configuration is still valid after the addition.
73
+
74
+ 2. **Run `harness check-deps`** to verify no dependency violations were introduced. The new component's imports must respect layer boundaries.
75
+
76
+ ### Graph Refresh
77
+
78
+ If a knowledge graph exists at `.harness/graph/`, refresh it after code changes to keep graph queries accurate:
79
+
80
+ ```
81
+ harness scan [path]
82
+ ```
83
+
84
+ Skipping this step means subsequent graph queries (impact analysis, dependency health, test advisor) may return stale results.
85
+
86
+ 3. **If validation fails,** fix the issues before committing. Common causes:
87
+ - New layer not properly registered in `harness.yaml`
88
+ - Component placed in wrong directory for its declared layer
89
+ - Imports from forbidden layers
90
+ - `AGENTS.md` references outdated architecture
91
+
92
+ 4. **Commit the addition.** All new and modified files in a single atomic commit.
93
+
94
+ ## Harness Integration
95
+
96
+ - **`harness add layer <name>`** — Register a new architectural layer with directory mappings and import rules.
97
+ - **`harness add doc <path>`** — Register a documentation file for drift tracking.
98
+ - **`harness add component <name> --layer <layer>`** — Register a new code component within an existing layer.
99
+ - **`harness add skill <name> --type <type>`** — Scaffold a new skill definition.
100
+ - **`harness validate`** — Verify project configuration after the addition.
101
+ - **`harness check-deps`** — Verify dependency constraints are respected after the addition.
102
+
103
+ ## Success Criteria
104
+
105
+ - The new component is properly registered in `harness.yaml`
106
+ - The component's files exist in the correct directories for its declared layer
107
+ - `AGENTS.md` is updated to reflect the new component
108
+ - `harness validate` passes after the addition
109
+ - `harness check-deps` passes after the addition (no new violations)
110
+ - No circular dependencies were introduced
111
+ - The addition is committed as a single atomic commit
112
+
113
+ ## Examples
114
+
115
+ ### Example: Adding a New Layer
116
+
117
+ ```
118
+ Human: "We need an infrastructure layer for external API clients."
119
+
120
+ DETERMINE: Adding a layer. Name: infrastructure. Dirs: src/infrastructure/.
121
+ Imports from: (none — infrastructure is a leaf layer, no internal dependencies).
122
+ Imported by: business layer (services call external APIs through infrastructure).
123
+
124
+ VALIDATE:
125
+ Read harness.yaml — existing layers: presentation, business, data.
126
+ No conflict with "infrastructure" name.
127
+ Run: harness check-deps — passes (clean baseline).
128
+
129
+ ADD:
130
+ harness add layer infrastructure --dirs src/infrastructure --imports none
131
+ mkdir -p src/infrastructure
132
+
133
+ WIRE:
134
+ Update harness.yaml: allow business → infrastructure imports.
135
+ Update AGENTS.md: document infrastructure layer purpose and boundaries.
136
+
137
+ VERIFY:
138
+ harness validate # Pass
139
+ harness check-deps # Pass
140
+ git add harness.yaml AGENTS.md src/infrastructure/
141
+ git commit -m "feat: add infrastructure layer for external API clients"
142
+ ```
143
+
144
+ ### Example: Adding a Document for Drift Tracking
145
+
146
+ ```
147
+ Human: "Track our API specification for documentation drift."
148
+
149
+ DETERMINE: Adding a document. Path: docs/api-spec.md.
150
+ Tracks: src/routes/, src/models/response.ts.
151
+
152
+ ADD:
153
+ harness add doc docs/api-spec.md --tracks src/routes,src/models/response.ts
154
+
155
+ WIRE:
156
+ Update AGENTS.md: note that docs/api-spec.md is tracked for drift.
157
+
158
+ VERIFY:
159
+ harness validate # Pass
160
+ git add harness.yaml AGENTS.md
161
+ git commit -m "feat: track API spec for documentation drift detection"
162
+ ```
163
+
164
+ ### Example: Adding a Component to an Existing Layer
165
+
166
+ ```
167
+ Human: "Add a notification service to the business layer."
168
+
169
+ DETERMINE: Adding a component. Name: notification-service. Layer: business.
170
+ Depends on: data layer (notification repository). Depended on by: presentation layer (routes).
171
+
172
+ VALIDATE:
173
+ Read harness.yaml — business layer exists, maps to src/services/.
174
+ No existing notification-service directory.
175
+ business → data is an allowed import. Presentation → business is allowed.
176
+ Run: harness check-deps — passes.
177
+
178
+ ADD:
179
+ harness add component notification-service --layer business
180
+ Create src/services/notification-service.ts
181
+ Create src/services/notification-service.test.ts
182
+
183
+ WIRE:
184
+ Add export to src/services/index.ts (if barrel file exists).
185
+ Update AGENTS.md: add notification service to business layer component list.
186
+
187
+ VERIFY:
188
+ harness validate # Pass
189
+ harness check-deps # Pass
190
+ git add harness.yaml AGENTS.md src/services/notification-service.*
191
+ git commit -m "feat: add notification service to business layer"
192
+ ```
@@ -0,0 +1,32 @@
1
+ name: add-harness-component
2
+ version: "1.0.0"
3
+ description: Add a component to an existing harness project
4
+ cognitive_mode: constructive-architect
5
+ triggers:
6
+ - manual
7
+ platforms:
8
+ - claude-code
9
+ - gemini-cli
10
+ tools:
11
+ - Bash
12
+ - Read
13
+ - Write
14
+ - Edit
15
+ - Glob
16
+ cli:
17
+ command: harness skill run add-harness-component
18
+ args:
19
+ - name: path
20
+ description: Project root path
21
+ required: false
22
+ mcp:
23
+ tool: run_skill
24
+ input:
25
+ skill: add-harness-component
26
+ path: string
27
+ type: flexible
28
+ state:
29
+ persistent: false
30
+ files: []
31
+ depends_on:
32
+ - initialize-harness-project
@@ -0,0 +1,213 @@
1
+ # Align Documentation
2
+
3
+ > Sync documentation with code after implementation changes. Keep AGENTS.md, API docs, and architecture docs accurate by mapping code changes to their documentation impact.
4
+
5
+ ## When to Use
6
+
7
+ - After completing a feature implementation (post-merge or post-commit)
8
+ - After fixing a bug that changes observable behavior
9
+ - After a refactoring that renames, moves, or restructures code
10
+ - When detect-doc-drift reports findings that need fixing
11
+ - When `on_post_feature` or `on_post_merge` triggers fire
12
+ - NOT during active development — wait until the code is stable
13
+ - NOT for creating documentation for a brand-new project (use validate-context-engineering for initial setup)
14
+ - NOT for fixing code — this skill only changes documentation
15
+
16
+ ## Process
17
+
18
+ ### Phase 1: Detect — Identify What Changed
19
+
20
+ 1. **Run `git diff` against the appropriate baseline.** Choose the baseline based on context:
21
+ - After a feature: diff against the branch point (`git diff main...HEAD`)
22
+ - After a bug fix: diff against the commit before the fix
23
+ - After a refactoring: diff against the commit before refactoring started
24
+ - Periodic sync: diff against the last documentation sync commit
25
+
26
+ 2. **Extract the list of changed files.** For each changed file, note:
27
+ - File path (current and previous if renamed/moved)
28
+ - Nature of change (added, modified, deleted, renamed)
29
+ - Changed exports (new, removed, renamed, signature changed)
30
+ - Changed behavior (different return values, new error types, new side effects)
31
+
32
+ 3. **Run `harness check-docs`** to identify any documentation that already has broken references due to the changes.
33
+
34
+ ### Graph-Enhanced Context (when available)
35
+
36
+ When a knowledge graph exists at `.harness/graph/`, use graph queries for faster, more accurate context:
37
+
38
+ - `query_graph` — find `documents` edges pointing to nodes changed in this diff
39
+ - `get_impact` — auto-suggest which docs need updating after code changes
40
+
41
+ Replaces manual doc-to-code correlation. Fall back to file-based commands if no graph is available.
42
+
43
+ ### Pipeline Context (when orchestrated)
44
+
45
+ When invoked by `harness-docs-pipeline`, check for a `pipeline` field in `.harness/handoff.json`:
46
+
47
+ - If `pipeline` field exists: read `DocPipelineContext` from it
48
+ - Read `pipeline.driftFindings` to know which fixes to apply (pre-classified by safety)
49
+ - If `pipeline.fixBatch` is set, apply only those specific fixes rather than running full detection
50
+ - Write applied fixes as `DocFix[]` back to `pipeline.fixesApplied`
51
+ - This enables the convergence loop to track fix verification status
52
+ - If `pipeline` field does not exist: behave exactly as today (standalone mode)
53
+
54
+ No changes to the skill's interface or output format — the pipeline field is purely additive.
55
+
56
+ ### Phase 2: Map — Connect Code Changes to Documentation
57
+
58
+ For each changed file, identify all documentation that references it:
59
+
60
+ **AGENTS.md sections:**
61
+
62
+ - Knowledge map entries that reference the file path
63
+ - Architecture descriptions that mention the module
64
+ - Constraint documentation that references the file's layer or patterns
65
+ - Onboarding guides that walk through the file
66
+
67
+ **API documentation:**
68
+
69
+ - JSDoc/TSDoc comments in the changed files themselves
70
+ - Generated API doc pages that pull from the changed files
71
+ - README examples that demonstrate the changed functions
72
+ - Tutorial or guide pages that use the changed code
73
+
74
+ **Architecture documentation:**
75
+
76
+ - Diagrams that include the changed module
77
+ - Data flow descriptions that reference the changed functions
78
+ - Layer descriptions that list the changed file
79
+ - Dependency documentation that references the changed imports
80
+
81
+ **Inline code comments:**
82
+
83
+ - Comments in OTHER files that reference the changed file or function
84
+ - TODO comments that reference the changed behavior
85
+ - Workaround comments that may no longer apply after the change
86
+
87
+ ### Phase 3: Generate — Draft Documentation Updates
88
+
89
+ For each affected documentation location:
90
+
91
+ 1. **Draft the specific text change.** Show the old text and the new text. Keep the existing style and tone — documentation updates should be invisible in terms of voice.
92
+
93
+ 2. **Preserve context.** When updating a section, do not just change the specific reference — read the surrounding paragraph and ensure it still makes sense. A renamed function may require updating the explanatory text around it, not just the function name.
94
+
95
+ 3. **Handle deletions carefully.** When code is deleted, do not just delete the documentation reference. Consider whether the section should be removed entirely, replaced with information about the replacement, or noted as deprecated.
96
+
97
+ 4. **Add new sections when needed.** If a new module was added, draft a complete documentation section following the existing AGENTS.md structure and style.
98
+
99
+ ### Phase 4: Validate — Verify Documentation Accuracy
100
+
101
+ 1. **Run `harness check-docs`** to verify all links and references resolve correctly after the updates.
102
+
103
+ 2. **Cross-check each update against the actual code.** Read the updated documentation and verify every claim by looking at the code. Documentation that is wrong is worse than documentation that is missing.
104
+
105
+ 3. **Verify no orphaned references remain.** Search documentation files for any remaining references to old names, old paths, or deleted features.
106
+
107
+ 4. **Run `harness fix-drift`** to catch any remaining simple drift issues that manual review missed.
108
+
109
+ ### Graph Refresh
110
+
111
+ If a knowledge graph exists at `.harness/graph/`, refresh it after code changes to keep graph queries accurate:
112
+
113
+ ```
114
+ harness scan [path]
115
+ ```
116
+
117
+ Skipping this step means subsequent graph queries (impact analysis, dependency health, test advisor) may return stale results.
118
+
119
+ 5. **Commit the documentation update.** Use a commit message that references the original change: "docs: update AGENTS.md for notification service refactoring" or "docs: sync API docs after auth module rename."
120
+
121
+ ## What to Update
122
+
123
+ ### AGENTS.md Knowledge Map
124
+
125
+ - File paths and module names (renamed or moved files)
126
+ - Module purpose descriptions (changed responsibilities)
127
+ - Constraint descriptions (new or changed rules)
128
+ - Relationship descriptions (new or changed dependencies)
129
+ - Gotcha sections (resolved gotchas, new gotchas)
130
+
131
+ ### Inline Code Comments
132
+
133
+ - Function/class doc comments in the changed files (JSDoc, TSDoc)
134
+ - Comments in other files that reference the changed code
135
+ - TODO comments that reference completed or changed work
136
+ - Workaround comments for issues that may now be resolved
137
+
138
+ ### Documentation Pages (docs/)
139
+
140
+ - API reference pages that describe changed functions
141
+ - Architecture pages that diagram changed modules
142
+ - Tutorial and guide pages that demonstrate changed code
143
+ - Getting-started guides if entry points changed
144
+ - Changelog entries for user-facing changes
145
+
146
+ ## Harness Integration
147
+
148
+ - **`harness check-docs`** — Run before and after updates. Identifies broken references and validates that all documentation links resolve.
149
+ - **`harness fix-drift`** — Auto-fix simple drift issues (broken file paths, renamed references) after manual review confirms correctness.
150
+ - **`harness fix-drift --json`** — Machine-readable output for tracking what was auto-fixed.
151
+ - **`harness validate`** — Run after documentation changes to verify overall project health is maintained.
152
+
153
+ ## Success Criteria
154
+
155
+ - `harness check-docs` passes with zero errors after documentation updates
156
+ - Every code change from the diff has been mapped to its documentation impact
157
+ - All file paths in documentation match current file locations
158
+ - All function/class names in documentation match current code
159
+ - All behavioral descriptions in documentation match current implementation
160
+ - Documentation updates are committed with clear references to the triggering code change
161
+ - No orphaned references to old names, paths, or deleted features remain
162
+
163
+ ## Examples
164
+
165
+ ### Example: Syncing docs after a module rename
166
+
167
+ **Code change:** `src/services/mailer.ts` renamed to `src/services/email-service.ts`. Functions `sendMail()` and `formatMailBody()` renamed to `sendEmail()` and `formatEmailBody()`.
168
+
169
+ **Documentation impact map:**
170
+
171
+ ```
172
+ AGENTS.md:34 — "mailer.ts handles email delivery" → update path and description
173
+ AGENTS.md:78 — "Use sendMail() for all outbound email" → update function name
174
+ docs/api.md:156 — sendMail() API reference → update name and import path
175
+ docs/arch.md:45 — architecture diagram lists "mailer" → update to "email-service"
176
+ src/controllers/user-controller.ts:12 — comment "// delegates to mailer" → update
177
+ ```
178
+
179
+ **Updates applied:**
180
+
181
+ - AGENTS.md: updated two sections with new file path and function names
182
+ - docs/api.md: updated function reference and import example
183
+ - docs/arch.md: updated module name in architecture description
184
+ - src/controllers/user-controller.ts: updated inline comment
185
+
186
+ **Validation:** `harness check-docs` passes. All references resolve. Commit: "docs: sync documentation after mailer rename to email-service"
187
+
188
+ ### Example: Syncing docs after adding error handling
189
+
190
+ **Code change:** `createUser()` in `src/services/user-service.ts` now throws `ValidationError` instead of returning `null` on invalid input.
191
+
192
+ **Documentation impact map:**
193
+
194
+ ```
195
+ docs/api.md:89 — "Returns null if validation fails" → update to describe thrown error
196
+ AGENTS.md:52 — No mention of error handling → add note about ValidationError
197
+ src/services/user-service.ts:15 — JSDoc @returns tag → update, add @throws tag
198
+ ```
199
+
200
+ **Updates applied:**
201
+
202
+ - docs/api.md: replaced "returns null" with "throws ValidationError" and added example
203
+ - AGENTS.md: added note about error handling pattern in user-service section
204
+ - JSDoc: updated @returns, added @throws ValidationError
205
+
206
+ **Validation:** `harness check-docs` passes. Commit: "docs: update documentation for createUser error handling change"
207
+
208
+ ## Escalation
209
+
210
+ - **When you cannot determine what documentation is affected:** Run `harness check-docs` for automated detection. For manual analysis, search all `.md` files and code comments for the old name/path. If the change is large, use detect-doc-drift first to get a complete inventory.
211
+ - **When documentation is in an external system (wiki, Confluence):** Document the needed change and flag it for manual update. Include the specific text that needs changing and the correct replacement.
212
+ - **When the code change is so large that documentation needs a rewrite:** Break the documentation update into sections. Update one section at a time, validating after each. Do not attempt a full rewrite in one pass.
213
+ - **When you disagree with the existing documentation style:** Follow the existing style. Documentation alignment is about accuracy, not style improvement. Style changes should be a separate, deliberate effort.
@@ -0,0 +1,31 @@
1
+ name: align-documentation
2
+ version: "1.0.0"
3
+ description: Auto-fix documentation drift issues
4
+ cognitive_mode: meticulous-verifier
5
+ triggers:
6
+ - manual
7
+ platforms:
8
+ - claude-code
9
+ - gemini-cli
10
+ tools:
11
+ - Bash
12
+ - Read
13
+ - Write
14
+ - Edit
15
+ cli:
16
+ command: harness skill run align-documentation
17
+ args:
18
+ - name: path
19
+ description: Project root path
20
+ required: false
21
+ mcp:
22
+ tool: run_skill
23
+ input:
24
+ skill: align-documentation
25
+ path: string
26
+ type: flexible
27
+ state:
28
+ persistent: false
29
+ files: []
30
+ depends_on:
31
+ - detect-doc-drift