@harness-engineering/cli 1.26.1 → 1.27.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 (149) hide show
  1. package/dist/agents/skills/claude-code/cleanup-dead-code/SKILL.md +3 -1
  2. package/dist/agents/skills/claude-code/detect-doc-drift/SKILL.md +3 -1
  3. package/dist/agents/skills/claude-code/harness-architecture-advisor/SKILL.md +4 -0
  4. package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +55 -24
  5. package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +16 -5
  6. package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +21 -6
  7. package/dist/agents/skills/claude-code/harness-codebase-cleanup/SKILL.md +2 -0
  8. package/dist/agents/skills/claude-code/harness-debugging/SKILL.md +13 -1
  9. package/dist/agents/skills/claude-code/harness-dependency-health/SKILL.md +4 -0
  10. package/dist/agents/skills/claude-code/harness-execution/SKILL.md +16 -6
  11. package/dist/agents/skills/claude-code/harness-impact-analysis/SKILL.md +2 -0
  12. package/dist/agents/skills/claude-code/harness-integration/SKILL.md +560 -0
  13. package/dist/agents/skills/claude-code/harness-integration/skill.yaml +65 -0
  14. package/dist/agents/skills/claude-code/harness-integrity/SKILL.md +2 -0
  15. package/dist/agents/skills/claude-code/harness-onboarding/SKILL.md +4 -0
  16. package/dist/agents/skills/claude-code/harness-perf/SKILL.md +9 -7
  17. package/dist/agents/skills/claude-code/harness-planning/SKILL.md +77 -10
  18. package/dist/agents/skills/claude-code/harness-refactoring/SKILL.md +13 -4
  19. package/dist/agents/skills/claude-code/harness-security-scan/SKILL.md +3 -1
  20. package/dist/agents/skills/claude-code/harness-soundness-review/SKILL.md +4 -0
  21. package/dist/agents/skills/claude-code/harness-tdd/SKILL.md +5 -2
  22. package/dist/agents/skills/claude-code/harness-verification/SKILL.md +4 -0
  23. package/dist/agents/skills/codex/cleanup-dead-code/SKILL.md +3 -1
  24. package/dist/agents/skills/codex/detect-doc-drift/SKILL.md +3 -1
  25. package/dist/agents/skills/codex/harness-architecture-advisor/SKILL.md +4 -0
  26. package/dist/agents/skills/codex/harness-autopilot/SKILL.md +55 -24
  27. package/dist/agents/skills/codex/harness-brainstorming/SKILL.md +16 -5
  28. package/dist/agents/skills/codex/harness-code-review/SKILL.md +21 -6
  29. package/dist/agents/skills/codex/harness-codebase-cleanup/SKILL.md +2 -0
  30. package/dist/agents/skills/codex/harness-debugging/SKILL.md +13 -1
  31. package/dist/agents/skills/codex/harness-dependency-health/SKILL.md +4 -0
  32. package/dist/agents/skills/codex/harness-execution/SKILL.md +16 -6
  33. package/dist/agents/skills/codex/harness-impact-analysis/SKILL.md +2 -0
  34. package/dist/agents/skills/codex/harness-integration/SKILL.md +560 -0
  35. package/dist/agents/skills/codex/harness-integration/skill.yaml +65 -0
  36. package/dist/agents/skills/codex/harness-integrity/SKILL.md +2 -0
  37. package/dist/agents/skills/codex/harness-onboarding/SKILL.md +4 -0
  38. package/dist/agents/skills/codex/harness-perf/SKILL.md +9 -7
  39. package/dist/agents/skills/codex/harness-planning/SKILL.md +77 -10
  40. package/dist/agents/skills/codex/harness-refactoring/SKILL.md +13 -4
  41. package/dist/agents/skills/codex/harness-security-scan/SKILL.md +3 -1
  42. package/dist/agents/skills/codex/harness-soundness-review/SKILL.md +4 -0
  43. package/dist/agents/skills/codex/harness-tdd/SKILL.md +5 -2
  44. package/dist/agents/skills/codex/harness-verification/SKILL.md +4 -0
  45. package/dist/agents/skills/cursor/cleanup-dead-code/SKILL.md +3 -1
  46. package/dist/agents/skills/cursor/detect-doc-drift/SKILL.md +3 -1
  47. package/dist/agents/skills/cursor/harness-architecture-advisor/SKILL.md +4 -0
  48. package/dist/agents/skills/cursor/harness-autopilot/SKILL.md +55 -24
  49. package/dist/agents/skills/cursor/harness-brainstorming/SKILL.md +16 -5
  50. package/dist/agents/skills/cursor/harness-code-review/SKILL.md +21 -6
  51. package/dist/agents/skills/cursor/harness-codebase-cleanup/SKILL.md +2 -0
  52. package/dist/agents/skills/cursor/harness-debugging/SKILL.md +13 -1
  53. package/dist/agents/skills/cursor/harness-dependency-health/SKILL.md +4 -0
  54. package/dist/agents/skills/cursor/harness-execution/SKILL.md +16 -6
  55. package/dist/agents/skills/cursor/harness-impact-analysis/SKILL.md +2 -0
  56. package/dist/agents/skills/cursor/harness-integration/SKILL.md +560 -0
  57. package/dist/agents/skills/cursor/harness-integration/skill.yaml +65 -0
  58. package/dist/agents/skills/cursor/harness-integrity/SKILL.md +2 -0
  59. package/dist/agents/skills/cursor/harness-onboarding/SKILL.md +4 -0
  60. package/dist/agents/skills/cursor/harness-perf/SKILL.md +9 -7
  61. package/dist/agents/skills/cursor/harness-planning/SKILL.md +77 -10
  62. package/dist/agents/skills/cursor/harness-refactoring/SKILL.md +13 -4
  63. package/dist/agents/skills/cursor/harness-security-scan/SKILL.md +3 -1
  64. package/dist/agents/skills/cursor/harness-soundness-review/SKILL.md +4 -0
  65. package/dist/agents/skills/cursor/harness-tdd/SKILL.md +5 -2
  66. package/dist/agents/skills/cursor/harness-verification/SKILL.md +4 -0
  67. package/dist/agents/skills/gemini-cli/cleanup-dead-code/SKILL.md +3 -1
  68. package/dist/agents/skills/gemini-cli/detect-doc-drift/SKILL.md +3 -1
  69. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/SKILL.md +4 -0
  70. package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +55 -24
  71. package/dist/agents/skills/gemini-cli/harness-brainstorming/SKILL.md +16 -5
  72. package/dist/agents/skills/gemini-cli/harness-code-review/SKILL.md +21 -6
  73. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/SKILL.md +2 -0
  74. package/dist/agents/skills/gemini-cli/harness-debugging/SKILL.md +13 -1
  75. package/dist/agents/skills/gemini-cli/harness-dependency-health/SKILL.md +4 -0
  76. package/dist/agents/skills/gemini-cli/harness-execution/SKILL.md +16 -6
  77. package/dist/agents/skills/gemini-cli/harness-impact-analysis/SKILL.md +2 -0
  78. package/dist/agents/skills/gemini-cli/harness-integration/SKILL.md +560 -0
  79. package/dist/agents/skills/gemini-cli/harness-integration/skill.yaml +65 -0
  80. package/dist/agents/skills/gemini-cli/harness-integrity/SKILL.md +2 -0
  81. package/dist/agents/skills/gemini-cli/harness-onboarding/SKILL.md +4 -0
  82. package/dist/agents/skills/gemini-cli/harness-perf/SKILL.md +9 -7
  83. package/dist/agents/skills/gemini-cli/harness-planning/SKILL.md +77 -10
  84. package/dist/agents/skills/gemini-cli/harness-refactoring/SKILL.md +13 -4
  85. package/dist/agents/skills/gemini-cli/harness-security-scan/SKILL.md +3 -1
  86. package/dist/agents/skills/gemini-cli/harness-soundness-review/SKILL.md +4 -0
  87. package/dist/agents/skills/gemini-cli/harness-tdd/SKILL.md +5 -2
  88. package/dist/agents/skills/gemini-cli/harness-verification/SKILL.md +4 -0
  89. package/dist/{agents-md-VI3HLR7E.js → agents-md-2RN666DE.js} +3 -3
  90. package/dist/{architecture-ZDDKEVID.js → architecture-ZR33YKJB.js} +4 -4
  91. package/dist/{assess-project-Y6W7YDUA.js → assess-project-LLWWEQEV.js} +1 -1
  92. package/dist/bin/harness-mcp.js +17 -16
  93. package/dist/bin/harness.js +27 -26
  94. package/dist/{business-knowledge-6RHYJOB3.js → business-knowledge-EISPR7FU.js} +1 -1
  95. package/dist/{check-phase-gate-CXR3VM22.js → check-phase-gate-ZVG56NT2.js} +4 -4
  96. package/dist/chunk-27AJKSQY.js +107 -0
  97. package/dist/{chunk-DBIX3X4H.js → chunk-2FOLD76X.js} +2 -2
  98. package/dist/{chunk-3AMQYWGT.js → chunk-3AJW7VQ3.js} +2 -2
  99. package/dist/{chunk-FUND5WJR.js → chunk-3XMOWLK3.js} +2 -2
  100. package/dist/{chunk-OLW7BJ5N.js → chunk-776JFSPK.js} +1 -1
  101. package/dist/{chunk-VKS3F46M.js → chunk-A4ETL34H.js} +7 -2
  102. package/dist/{chunk-JV4Y2U5F.js → chunk-BO4AJZRE.js} +1 -1
  103. package/dist/{chunk-WZ7UHPT3.js → chunk-BZZNYHRY.js} +9 -9
  104. package/dist/{chunk-ZN6ROTYP.js → chunk-C7RPQWBG.js} +1 -1
  105. package/dist/{chunk-RAVD7QLY.js → chunk-CJYNZMOP.js} +8 -8
  106. package/dist/{chunk-PNNFCVW4.js → chunk-EGRQHLDM.js} +5 -5
  107. package/dist/{chunk-2BPPS6YQ.js → chunk-EHTUWULH.js} +458 -363
  108. package/dist/{chunk-N6B6RKQQ.js → chunk-EICASBYP.js} +1 -1
  109. package/dist/{chunk-K56DTX7G.js → chunk-F3Y64VNF.js} +6 -6
  110. package/dist/{chunk-ORNEK65Y.js → chunk-FUS4OOGC.js} +1 -1
  111. package/dist/{chunk-2FPUPRCY.js → chunk-GAIOIINV.js} +594 -127
  112. package/dist/{chunk-YC4EYIER.js → chunk-IBTHD2UA.js} +132 -77
  113. package/dist/{chunk-RC5ZY3EV.js → chunk-IOW3MW2K.js} +2 -2
  114. package/dist/{chunk-B66LRB5M.js → chunk-L3Y7L4EG.js} +1 -1
  115. package/dist/{chunk-BK4DJIIY.js → chunk-MGPVA2EM.js} +27 -4
  116. package/dist/{chunk-NY7DTZ6K.js → chunk-Q5DKIL46.js} +3 -3
  117. package/dist/{chunk-TY2ESLVL.js → chunk-SDDQPMZK.js} +1 -1
  118. package/dist/{chunk-7GY6WNEI.js → chunk-SDPHFDQS.js} +1 -1
  119. package/dist/{chunk-56A6OXVA.js → chunk-T7UZOJF4.js} +9 -9
  120. package/dist/{chunk-AMRC4FU2.js → chunk-VCC47EXU.js} +109 -57
  121. package/dist/{chunk-Q3ZLVMQM.js → chunk-XKU37HGH.js} +10 -1
  122. package/dist/{chunk-TSVYBDDE.js → chunk-YZH4I4JO.js} +1 -1
  123. package/dist/{ci-workflow-EW37KVPS.js → ci-workflow-JFOL4YWW.js} +3 -3
  124. package/dist/{dist-NCNAXUFD.js → dist-BZS2XRLG.js} +5 -1
  125. package/dist/{dist-CJDGASPP.js → dist-CPKL5Y2R.js} +2 -2
  126. package/dist/{docs-4XI2FQW2.js → docs-FUTRJQHA.js} +4 -4
  127. package/dist/{engine-4L4CDTHU.js → engine-FB3HCNVT.js} +3 -3
  128. package/dist/{entropy-PBYSIQYS.js → entropy-FIEE4YDA.js} +3 -3
  129. package/dist/{feedback-OTIFW5MK.js → feedback-7EC4T6XG.js} +1 -1
  130. package/dist/{generate-agent-definitions-CZGUXIIN.js → generate-agent-definitions-FOSFADNR.js} +4 -4
  131. package/dist/{graph-loader-RDXSEBD7.js → graph-loader-QEI7SYOQ.js} +1 -1
  132. package/dist/hooks/adoption-tracker.js +36 -8
  133. package/dist/hooks/sentinel-pre.js +3 -2
  134. package/dist/hooks/telemetry-reporter.js +34 -15
  135. package/dist/index-builder-3AOQ3ZII.js +13 -0
  136. package/dist/index.d.ts +15 -0
  137. package/dist/index.js +29 -28
  138. package/dist/{loader-UZOXCWFC.js → loader-HXUOBTYA.js} +3 -3
  139. package/dist/{mcp-GWVVV6LH.js → mcp-NUG4BMKJ.js} +17 -16
  140. package/dist/{performance-5UQPP3XX.js → performance-TYXBCTR7.js} +4 -4
  141. package/dist/{review-pipeline-65V4EO6O.js → review-pipeline-B4WPU6BQ.js} +3 -3
  142. package/dist/{runtime-PXX7HNB3.js → runtime-HQQNOARD.js} +3 -3
  143. package/dist/{scan-WM7XDUF7.js → scan-M4EGDAQ2.js} +1 -1
  144. package/dist/{security-CAYDRZIZ.js → security-25VFLIAO.js} +1 -1
  145. package/dist/templates/orchestrator/harness.orchestrator.md +18 -8
  146. package/dist/{validate-CWGXR7QM.js → validate-EAVGKZQB.js} +4 -4
  147. package/dist/{validate-cross-check-BKCNLZYG.js → validate-cross-check-SPL3H4O5.js} +3 -3
  148. package/package.json +13 -5
  149. package/dist/hooks/profiles.ts +0 -48
@@ -0,0 +1,560 @@
1
+ # Harness Integration
2
+
3
+ > Verify system wiring, materialize knowledge artifacts, and update project metadata. Integration is a gate, not a discovery phase -- it confirms that planned integration tasks completed.
4
+
5
+ ## When to Use
6
+
7
+ - After execution completes and verification passes (between VERIFY and REVIEW in the workflow)
8
+ - When the autopilot state machine reaches the INTEGRATE state
9
+ - When validating that a feature is properly wired into the system (barrel exports, skill discovery, route mounts)
10
+ - When materializing architectural decisions as durable ADRs
11
+ - When invoked standalone to check integration completeness of a feature branch
12
+ - NOT as a replacement for verification (verification checks code correctness; integration checks system connectivity)
13
+ - NOT for discovering integration work (integration work is planned upfront in brainstorming and planning)
14
+ - NOT for implementing fixes (integration identifies gaps; the executor fixes them)
15
+
16
+ ## Process
17
+
18
+ ### Iron Law
19
+
20
+ **No integration claim may be made without checking every planned integration task against the codebase.**
21
+
22
+ Integration checking is mechanical: did the planned task produce the expected artifact? "It should be there" is not evidence. Check the file, check the import, check the registration. Report what you observed.
23
+
24
+ The words "should", "probably", "seems to", and "I believe" are forbidden in integration reports. Replace with "verified: [evidence]" or "not verified: [what is missing]."
25
+
26
+ ---
27
+
28
+ ### Argument Resolution
29
+
30
+ When invoked by autopilot (or with explicit arguments), resolve paths before starting:
31
+
32
+ 1. **Session slug:** If `session-slug` argument provided, set `{sessionDir} = .harness/sessions/<session-slug>/`. Pass to `gather_context({ session: "<session-slug>" })`. All report writes go to `{sessionDir}/`.
33
+ 2. **Plan path:** Discover from `{sessionDir}/handoff.json` (read upstream execution/verification output). The plan contains integration tasks tagged `category: "integration"` and the `integrationTier` field.
34
+ 3. **Rigor level:** If `fast`/`thorough` argument provided, use it. Otherwise default to `standard`.
35
+
36
+ When no arguments are provided (standalone invocation), discover plan from `docs/plans/` or prompt. Global `.harness/` paths used as fallback.
37
+
38
+ ---
39
+
40
+ ### Tier Resolution
41
+
42
+ Before running sub-phases, resolve the effective integration tier:
43
+
44
+ 1. **Read plan-time tier.** Extract `integrationTier` from the plan header (small, medium, or large). If absent, default to `small`.
45
+
46
+ 2. **Derive execution-time tier.** Read the execution start commit from the session handoff (`startCommit` field in `{sessionDir}/handoff.json`). If unavailable, use the autopilot's `startingCommit` from `{sessionDir}/autopilot-state.json`. Diff `startCommit..HEAD` to analyze the execution phase:
47
+
48
+ ```
49
+ newPackages > 0 -> large
50
+ newPublicExports > 5 -> large (minimum)
51
+ filesChanged > 15 AND newExports -> medium (minimum)
52
+ else -> keep plan estimate
53
+ ```
54
+
55
+ To count these signals:
56
+ - `newPackages`: count new `package.json` files in the diff
57
+ - `newPublicExports`: count new `export` statements in barrel/index files
58
+ - `filesChanged`: count total files changed in the diff
59
+ - `newExports`: boolean, true if any new `export` statements exist
60
+
61
+ 3. **Apply max(planned, derived).** The effective tier is the higher of the two.
62
+
63
+ 4. **Notify on escalation.** If derived tier exceeds planned tier, notify the human:
64
+
65
+ ```
66
+ Tier escalated from `small` to `medium`: 8 new exports detected.
67
+ ```
68
+
69
+ Use `emit_interaction` with type `confirmation` to inform and get acknowledgment.
70
+
71
+ ---
72
+
73
+ ### Rigor Level Interaction
74
+
75
+ | Rigor | INTEGRATE behavior |
76
+ | ---------- | -------------------------------------------------------------------------------------- |
77
+ | `fast` | WIRE only (default checks), auto-approve, no ADR drafting |
78
+ | `standard` | Full tier-appropriate checks (WIRE for all; MATERIALIZE + UPDATE for medium and large) |
79
+ | `thorough` | Full checks + human reviews every ADR draft + force knowledge graph verification |
80
+
81
+ ---
82
+
83
+ ### Context Loading
84
+
85
+ Before running sub-phases, load session context:
86
+
87
+ ```json
88
+ gather_context({
89
+ path: "<project-root>",
90
+ intent: "Verify integration of executed plan",
91
+ skill: "harness-integration",
92
+ session: "<session-slug-if-provided>",
93
+ include: ["state", "learnings", "handoff", "graph", "businessKnowledge", "sessions", "validation"]
94
+ })
95
+ ```
96
+
97
+ Load the plan, identify integration tasks (tagged `category: "integration"`), and group them by sub-phase:
98
+
99
+ - **WIRE tasks:** Entry point registration, barrel exports, skill discovery, route mounts
100
+ - **MATERIALIZE tasks:** ADR writing, knowledge graph enrichment, documentation updates
101
+ - **UPDATE tasks:** Roadmap sync, changelog, spec cross-references
102
+
103
+ ---
104
+
105
+ ### Sub-Phase 1: WIRE (all tiers)
106
+
107
+ Report progress: `**[WIRE]** Checking system wiring`
108
+
109
+ WIRE always runs, regardless of tier. It has two parts: default checks (always) and task-specific checks (when integration tasks exist).
110
+
111
+ #### Default Checks (always run)
112
+
113
+ These run even with zero explicit integration tasks (D8: barrel exports and validation are cheap and catch real problems).
114
+
115
+ 1. **Barrel export check.** Run `pnpm run generate-barrel-exports --check`. If the `--check` flag is not supported, fall back to:
116
+ - Run `pnpm run generate-barrel-exports`
117
+ - Run `git diff --name-only`
118
+ - If barrel files changed, the previous execution missed this step. Record as FAIL with the list of changed barrel files.
119
+ - If no changes, barrel exports are current. Record as PASS.
120
+
121
+ 2. **Harness validate.** Run `pnpm harness validate`. Must pass. Record result.
122
+
123
+ #### Task-Specific Checks (when integration tasks exist)
124
+
125
+ For each integration task tagged `category: "integration"` that relates to wiring:
126
+
127
+ 3. **Entry point reachability.** Trace from known entry points to new code:
128
+ - CLI: search for the new command/function in the `createProgram()` registration chain
129
+ - MCP: search for the new tool in `getToolDefinitions()` or tool registration files
130
+ - Skill: verify `skill.yaml` + `SKILL.md` exist at the expected path and skill appears in `harness skill list` output or discovery glob results
131
+ - If the task claims a new entry point, verify it is reachable from at least one system entry point. An unreachable entry point is dead code.
132
+
133
+ 4. **Skill discovery verification.** If a new skill was created:
134
+ - Verify `agents/skills/claude-code/<skill-name>/skill.yaml` exists and has valid YAML
135
+ - Verify `agents/skills/claude-code/<skill-name>/SKILL.md` exists and is non-empty
136
+ - Verify the skill appears in `harness skill list` output (or would appear based on glob pattern)
137
+
138
+ 5. **Route mount verification.** If a new API route was added:
139
+ - Verify the route handler file exists
140
+ - Verify the route is imported and mounted in the router/app configuration
141
+ - Verify a request to the route path would be handled (trace the mount chain)
142
+
143
+ 6. **Produce wiring report.** Write `{sessionDir}/integration-wiring.json`:
144
+
145
+ ```json
146
+ {
147
+ "subPhase": "wire",
148
+ "tier": "<effective-tier>",
149
+ "timestamp": "<ISO-8601>",
150
+ "defaultChecks": {
151
+ "barrelExports": { "status": "pass|fail", "detail": "<description>" },
152
+ "harnessValidate": { "status": "pass|fail", "detail": "<output summary>" }
153
+ },
154
+ "taskChecks": [
155
+ {
156
+ "taskRef": "Task N: <name>",
157
+ "check": "<what was verified>",
158
+ "status": "pass|fail",
159
+ "evidence": "<file:line or command output>"
160
+ }
161
+ ],
162
+ "verdict": "pass|fail"
163
+ }
164
+ ```
165
+
166
+ ---
167
+
168
+ ### Sub-Phase 2: MATERIALIZE (medium + large tiers)
169
+
170
+ Report progress: `**[MATERIALIZE]** Checking knowledge materialization`
171
+
172
+ Skip this sub-phase for `small` tier or `fast` rigor. For medium and large tiers:
173
+
174
+ #### Decision Harvesting
175
+
176
+ 1. **Read handoff decisions.** Load `{sessionDir}/handoff.json` from all phases in this session. Collect all entries from the `decisions` array.
177
+
178
+ 2. **Classify decisions.** For each decision:
179
+ - **Architectural** (large tier): Decisions that affect system structure, introduce new patterns, or change integration boundaries. These warrant ADRs.
180
+ - **Minor** (medium + large tier): Decisions about implementation approach, naming, or local design. These enrich the knowledge graph directly without an ADR.
181
+
182
+ #### ADR Auto-Drafting (large tier only)
183
+
184
+ 3. **Auto-draft ADRs** from architectural decisions. For each architectural decision:
185
+
186
+ a. **Assign ADR number.** Scan `docs/knowledge/decisions/` for existing ADR files matching `NNNN-*.md`. Take the highest number and increment by 1. If the directory does not exist, create it and start at `0001`.
187
+
188
+ b. **Generate slug.** Convert the decision title to a URL-safe slug (lowercase, hyphens, no special characters).
189
+
190
+ c. **Write ADR** to `docs/knowledge/decisions/NNNN-<slug>.md`:
191
+
192
+ ```markdown
193
+ ---
194
+ number: NNNN
195
+ title: <decision title>
196
+ date: <ISO date>
197
+ status: accepted
198
+ tier: large
199
+ source: <spec path or session slug>
200
+ supersedes: <prior ADR number, if any>
201
+ ---
202
+
203
+ ## Context
204
+
205
+ <What situation prompted this decision? What constraints existed?>
206
+
207
+ ## Decision
208
+
209
+ <What was decided and why?>
210
+
211
+ ## Consequences
212
+
213
+ <What follows from this decision -- positive, negative, and neutral?>
214
+ ```
215
+
216
+ d. **Present for review.** In `thorough` rigor, present each ADR draft via `emit_interaction` (type: `confirmation`) and wait for human approval. In `standard` rigor, auto-approve but log the draft for review.
217
+
218
+ #### Knowledge Graph Enrichment (medium + large tiers)
219
+
220
+ 4. **Enrich knowledge graph.** For each decision (both architectural and minor):
221
+ - Call `ingest_source` with the decision metadata so decisions become queryable graph nodes
222
+ - For ADR-sourced decisions, the ADR file path is the source
223
+ - For minor decisions, the handoff.json decision text is the content
224
+
225
+ #### Documentation Task Verification
226
+
227
+ 5. **Verify documentation integration tasks.** For each integration task tagged `category: "integration"` that relates to documentation:
228
+ - Verify the specified document was updated (file exists, content includes expected additions)
229
+ - Verify AGENTS.md was updated if the task required it
230
+ - Verify guides were written if the task required it
231
+
232
+ 6. **Produce materialization report.** Write `{sessionDir}/integration-materialization.json`:
233
+
234
+ ```json
235
+ {
236
+ "subPhase": "materialize",
237
+ "tier": "<effective-tier>",
238
+ "timestamp": "<ISO-8601>",
239
+ "decisions": {
240
+ "total": 0,
241
+ "architectural": 0,
242
+ "minor": 0
243
+ },
244
+ "adrs": [
245
+ {
246
+ "number": "NNNN",
247
+ "title": "<title>",
248
+ "path": "docs/knowledge/decisions/NNNN-<slug>.md",
249
+ "status": "drafted|approved"
250
+ }
251
+ ],
252
+ "graphEnrichment": {
253
+ "nodesCreated": 0,
254
+ "status": "pass|fail|skipped"
255
+ },
256
+ "documentationChecks": [
257
+ {
258
+ "taskRef": "Task N: <name>",
259
+ "status": "pass|fail",
260
+ "evidence": "<description>"
261
+ }
262
+ ],
263
+ "verdict": "pass|fail|skipped"
264
+ }
265
+ ```
266
+
267
+ ---
268
+
269
+ ### Sub-Phase 3: UPDATE (medium + large tiers)
270
+
271
+ Report progress: `**[UPDATE]** Checking project metadata updates`
272
+
273
+ Skip this sub-phase for `small` tier or `fast` rigor. For medium and large tiers:
274
+
275
+ 1. **Roadmap sync.** If `docs/roadmap.md` exists, call `manage_roadmap` with `sync` and `apply: true` to update feature status. If `manage_roadmap` is unavailable, fall back to noting the roadmap needs manual sync.
276
+
277
+ 2. **Changelog verification.** If `CHANGELOG.md` exists at the project root:
278
+ - Read the file and check for a new entry matching the current feature
279
+ - If no entry exists, record as FAIL with instruction: "Add a changelog entry for this feature under the Unreleased section."
280
+ - If no `CHANGELOG.md` exists, skip silently (not all projects use changelogs)
281
+
282
+ 3. **Spec cross-reference annotation.** Read the spec at its path (from the plan or handoff):
283
+ - For each phase in the spec's Implementation Order, check if implementation files can be linked
284
+ - If the spec does not have file annotations, note this as an improvement suggestion (not a failure)
285
+
286
+ 4. **Produce update report.** Write `{sessionDir}/integration-updates.json`:
287
+
288
+ ```json
289
+ {
290
+ "subPhase": "update",
291
+ "tier": "<effective-tier>",
292
+ "timestamp": "<ISO-8601>",
293
+ "roadmap": { "status": "synced|skipped|failed", "detail": "<description>" },
294
+ "changelog": { "status": "pass|fail|skipped", "detail": "<description>" },
295
+ "specCrossRef": { "status": "annotated|skipped", "detail": "<description>" },
296
+ "verdict": "pass|fail|skipped"
297
+ }
298
+ ```
299
+
300
+ ---
301
+
302
+ ### Combined Report and Verdict
303
+
304
+ After all applicable sub-phases complete, produce the combined integration report:
305
+
306
+ 1. **Write combined report.** Write `{sessionDir}/phase-{N}-integration.json`:
307
+
308
+ ```json
309
+ {
310
+ "phase": "integration",
311
+ "tier": "<effective-tier>",
312
+ "rigor": "<fast|standard|thorough>",
313
+ "timestamp": "<ISO-8601>",
314
+ "subPhases": {
315
+ "wire": { "verdict": "pass|fail", "reportPath": "{sessionDir}/integration-wiring.json" },
316
+ "materialize": {
317
+ "verdict": "pass|fail|skipped",
318
+ "reportPath": "{sessionDir}/integration-materialization.json"
319
+ },
320
+ "update": {
321
+ "verdict": "pass|fail|skipped",
322
+ "reportPath": "{sessionDir}/integration-updates.json"
323
+ }
324
+ },
325
+ "verdict": "pass|fail",
326
+ "failures": [
327
+ {
328
+ "subPhase": "<wire|materialize|update>",
329
+ "taskRef": "Task N: <name>",
330
+ "issue": "<what is incomplete>",
331
+ "fix": "<specific fix instruction>"
332
+ }
333
+ ]
334
+ }
335
+ ```
336
+
337
+ 2. **Report verdict.** Summarize pass/fail per sub-phase. On failure, list exactly which integration tasks are incomplete with specific fix instructions.
338
+
339
+ 3. **On PASS:** Write handoff and emit transition to REVIEW:
340
+
341
+ ```json
342
+ emit_interaction({
343
+ path: "<project-root>",
344
+ type: "transition",
345
+ transition: {
346
+ completedPhase: "integration",
347
+ suggestedNext: "review",
348
+ reason: "Integration passed at all applicable sub-phases",
349
+ artifacts: ["<report paths>"],
350
+ requiresConfirmation: false,
351
+ summary: "Integration passed: tier <tier>. WIRE passed. MATERIALIZE <passed|skipped>. UPDATE <passed|skipped>.",
352
+ qualityGate: {
353
+ checks: [
354
+ { "name": "wire-checks", "passed": true },
355
+ { "name": "materialize-checks", "passed": true },
356
+ { "name": "update-checks", "passed": true },
357
+ { "name": "harness-validate", "passed": true }
358
+ ],
359
+ allPassed: true
360
+ }
361
+ }
362
+ })
363
+ ```
364
+
365
+ Immediately invoke harness-code-review without waiting for user input.
366
+
367
+ 4. **On FAIL:** Do NOT emit a transition. Report incomplete items with fix instructions. Present options via `emit_interaction`:
368
+
369
+ ```json
370
+ emit_interaction({
371
+ path: "<project-root>",
372
+ type: "question",
373
+ question: {
374
+ text: "Integration failed. <N> items incomplete. How to proceed?",
375
+ options: [
376
+ { "label": "fix -- Re-enter EXECUTE with integration-specific fix tasks, then re-VERIFY, re-INTEGRATE", "risk": "low", "effort": "medium" },
377
+ { "label": "skip -- Record decision and proceed to REVIEW (human override)", "risk": "medium", "effort": "low" },
378
+ { "label": "stop -- Save state and exit", "risk": "low", "effort": "low" }
379
+ ],
380
+ recommendation: { "optionIndex": 0, "reason": "Fixing integration gaps now prevents review rework.", "confidence": "high" }
381
+ }
382
+ })
383
+ ```
384
+
385
+ - **fix:** Record fix tasks in handoff. The autopilot re-enters EXECUTE with those tasks.
386
+ - **skip:** Record the skip decision in `decisions[]` in handoff. Proceed to REVIEW.
387
+ - **stop:** Write handoff with current state and stop.
388
+
389
+ ---
390
+
391
+ ### Handoff
392
+
393
+ Write handoff to the session-scoped path when session slug is known, otherwise fall back to global:
394
+
395
+ - Session-scoped (preferred): `.harness/sessions/<session-slug>/handoff.json`
396
+ - Global (fallback, **deprecated**): `.harness/handoff.json`
397
+
398
+ > **[DEPRECATED]** Writing to `.harness/handoff.json` is deprecated. In autopilot sessions, always write to `.harness/sessions/<slug>/handoff.json` to prevent cross-session contamination.
399
+
400
+ ```json
401
+ {
402
+ "fromSkill": "harness-integration",
403
+ "phase": "COMPLETE",
404
+ "summary": "<verdict summary>",
405
+ "tier": "<effective-tier>",
406
+ "artifacts": ["<report paths>", "<ADR paths if any>"],
407
+ "verdict": "pass | fail",
408
+ "gaps": ["<gap descriptions if any>"],
409
+ "decisions": [{ "what": "<decision>", "why": "<rationale>" }]
410
+ }
411
+ ```
412
+
413
+ **Session summary (if session known):** Update via `writeSessionSummary` with skill, status (`Integration <PASS|FAIL>. Tier: <tier>. <N> checks, <N> gaps.`), keyContext, and nextStep.
414
+
415
+ ## Session State
416
+
417
+ | Section | Read | Write | Purpose |
418
+ | ------------- | ---- | ----- | ------------------------------------------------------------------------ |
419
+ | terminology | yes | no | Consistent language in integration reports |
420
+ | decisions | yes | yes | Reads all phase decisions for ADR drafting; writes integration decisions |
421
+ | constraints | yes | no | Respect existing constraints during checks |
422
+ | risks | yes | yes | Reads risks; writes integration risks discovered during checks |
423
+ | openQuestions | yes | yes | Reads questions; resolves those answered by integration evidence |
424
+ | evidence | yes | yes | Prior evidence; writes wiring, materialization, and update evidence |
425
+
426
+ **When to write:** After each sub-phase, append evidence entries. After ADR drafting, write decisions.
427
+
428
+ **When to read:** During Context Loading via `gather_context` with `include: ["state", "learnings", "handoff", "graph", "businessKnowledge", "sessions", "validation"]`.
429
+
430
+ ## Evidence Requirements
431
+
432
+ Every pass/fail assertion in the integration report MUST include concrete evidence:
433
+
434
+ 1. **File reference:** `file:line` with observed content (e.g., `src/index.ts:12` -- "exports NotificationService")
435
+ 2. **Command output:** Actual command and output (e.g., `pnpm run generate-barrel-exports --check` -- "No changes detected")
436
+ 3. **Harness output:** `harness validate` output
437
+ 4. **Git diff evidence:** `git diff --name-only` output for barrel export checks
438
+ 5. **Discovery evidence:** `harness skill list` output for skill discovery verification
439
+ 6. **Session evidence:** Record evidence in the sub-phase report JSON files written to the session directory
440
+
441
+ **When to cite:** At every check. Each pass/fail in the wiring, materialization, and update reports must be backed by evidence.
442
+
443
+ **Uncited claims:** Any integration assertion without direct evidence is an integration failure. This skill does not use `[UNVERIFIED]` -- if evidence cannot be produced, verdict is FAIL.
444
+
445
+ ## Harness Integration
446
+
447
+ - **`gather_context`** -- Load session-scoped state, learnings, handoff, and validation before sub-phases. `session` parameter scopes to session directory.
448
+ - **`harness validate`** -- Run during WIRE default checks. Must pass.
449
+ - **`harness check-deps`** -- Run during WIRE if new modules were added.
450
+ - **`ingest_source`** -- Run during MATERIALIZE to enrich knowledge graph with decision nodes.
451
+ - **`manage_roadmap`** -- Run during UPDATE to sync roadmap status. Use `sync` with `apply: true`.
452
+ - **`emit_interaction`** -- Tier escalation notification, ADR review (thorough mode), fail/skip/stop decision, transition to REVIEW on pass.
453
+ - **Session directory** -- `.harness/sessions/<slug>/` contains all report files. Do not write to global `.harness/` when session slug is known.
454
+
455
+ ## Success Criteria
456
+
457
+ - WIRE default checks run for every tier (including small) -- barrel exports current, harness validate passes
458
+ - All planned integration tasks verified with evidence
459
+ - ADRs drafted for large-tier architectural decisions with correct format and sequential numbering
460
+ - Knowledge graph enriched with decision nodes (medium + large tiers)
461
+ - Documentation tasks verified as complete (medium + large tiers)
462
+ - Roadmap synced, changelog verified (medium + large tiers)
463
+ - Combined report written with pass/fail per sub-phase
464
+ - Tier derivation correctly escalates when execution exceeds plan estimates
465
+ - Fast rigor completes in seconds (WIRE only, no ADRs, no graph enrichment)
466
+ - Failure report includes specific fix instructions for each incomplete item
467
+
468
+ ## Red Flags
469
+
470
+ | Flag | Corrective Action |
471
+ | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
472
+ | "Barrel exports probably have not changed, so I will skip the check" | STOP. WIRE default checks always run. "Probably" is forbidden. Run the check and report the result. |
473
+ | "The ADR looks correct from the decision text, no need to present for review" | STOP. In thorough mode, every ADR draft requires human review. In standard mode, auto-approve but log. Do not skip the review protocol. |
474
+ | "Integration tasks are just bureaucracy, I will mark them as passed" | STOP. Integration tasks exist because brainstorming and planning identified real connection points. Each must be verified with evidence. |
475
+ | "The knowledge graph enrichment failed but it is not critical" | STOP. In thorough mode, graph enrichment failure is a FAIL. In standard mode, log the failure and include in the report. |
476
+ | "I will fix the missing barrel export myself to make WIRE pass" | STOP. Integration identifies gaps -- integration never fills them. Record as FAIL with fix instructions. The executor fixes it. |
477
+
478
+ ## Rationalizations to Reject
479
+
480
+ | Rationalization | Reality |
481
+ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
482
+ | "WIRE passed so the feature is properly integrated" | WIRE checks wiring only. For medium/large tiers, MATERIALIZE and UPDATE must also pass. Partial integration is not integration. |
483
+ | "This is a small change, so I can skip tier derivation and just use the plan estimate" | Tier derivation is mandatory. Even if the plan says small, execution may have produced more changes than expected. Always derive and compare. |
484
+ | "The ADR format is close enough, no need to match the exact frontmatter schema" | ADRs must match the spec format exactly (number, title, date, status, tier, source, supersedes). The knowledge pipeline depends on consistent frontmatter for parsing. |
485
+ | "Integration tasks were not in the plan, so there is nothing to check" | WIRE default checks always run regardless of planned integration tasks (D8). If the plan has no integration tasks, WIRE still checks barrel exports and runs validate. |
486
+ | "I found an integration gap but it is minor, so I will mark it as pass with a note" | A gap is a FAIL, not a conditional pass. Record the gap, report it, and let the human decide whether to fix or skip. |
487
+
488
+ ## Examples
489
+
490
+ ### Example: Small Tier Integration (Bug Fix)
491
+
492
+ ```
493
+ ## Integration Report
494
+
495
+ **Tier:** small (plan: small, derived: small)
496
+ **Rigor:** standard
497
+
498
+ ### WIRE
499
+ - [PASS] Barrel exports: `pnpm run generate-barrel-exports --check` -- no changes
500
+ - [PASS] Harness validate: passes
501
+ - No integration tasks to verify
502
+
503
+ ### MATERIALIZE
504
+ - [SKIPPED] Small tier -- no materialization required
505
+
506
+ ### UPDATE
507
+ - [SKIPPED] Small tier -- no updates required
508
+
509
+ ### Verdict: PASS
510
+ ```
511
+
512
+ ### Example: Large Tier Integration (New Skill)
513
+
514
+ ```
515
+ ## Integration Report
516
+
517
+ **Tier:** large (plan: medium, derived: large -- escalated due to new package)
518
+ **Rigor:** standard
519
+
520
+ ### WIRE
521
+ - [PASS] Barrel exports: regenerated, git diff shows no changes
522
+ - [PASS] Harness validate: passes
523
+ - [PASS] Skill discovery: harness-integration/skill.yaml exists, SKILL.md exists (420 lines)
524
+ - [PASS] Entry point: skill appears in harness skill list output
525
+ - [FAIL] Route mount: /api/integration not mounted in router
526
+
527
+ ### MATERIALIZE
528
+ - [PASS] ADR 0001-tiered-integration-rigor.md drafted and auto-approved
529
+ - [PASS] Knowledge graph: 3 decision nodes created via ingest_source
530
+ - [PASS] AGENTS.md updated with integration phase description
531
+
532
+ ### UPDATE
533
+ - [PASS] Roadmap synced: integration-phase moved to in-progress
534
+ - [FAIL] Changelog: no entry in CHANGELOG.md for integration phase
535
+ - [PASS] Spec cross-reference: annotated with implementation file links
536
+
537
+ ### Verdict: FAIL -- 2 items incomplete
538
+ 1. Route mount /api/integration not found in router configuration
539
+ Fix: Add route import and mount in src/api/routes/index.ts
540
+ 2. Changelog entry missing
541
+ Fix: Add entry under Unreleased: "Added integration phase with tiered wiring verification"
542
+ ```
543
+
544
+ ## Gates
545
+
546
+ - **No skipping WIRE defaults.** Barrel export check and harness validate run for every tier, every rigor level. No exceptions.
547
+ - **No skipping tier derivation.** Always derive tier from execution results and compare with plan estimate. Higher tier wins.
548
+ - **No fixing during integration.** Integration identifies gaps. Integration never fills them. Record as FAIL and report.
549
+ - **No auto-passing MATERIALIZE in thorough mode.** Every ADR draft must be presented for human review in thorough mode.
550
+ - **No integration without a plan.** If no plan exists, there are no integration tasks to verify. Run WIRE defaults only and note the absence.
551
+ - **No forbidden hedging language.** "Should", "probably", "seems to" are forbidden. Use evidence or state "not verified."
552
+
553
+ ## Escalation
554
+
555
+ - **Barrel export generation command not found:** Record as FAIL. Instruct: "The project does not have a `generate-barrel-exports` script. Add it to package.json or skip barrel export verification."
556
+ - **Knowledge graph tools unavailable:** If `ingest_source` is not available, record materialization as skipped with reason. Do not block on tooling absence for medium tier. For large tier in thorough mode, escalate.
557
+ - **ADR directory does not exist:** Create `docs/knowledge/decisions/` on first ADR write. This is expected for projects that have not used ADRs before.
558
+ - **Plan has no integration tier:** Default to small. Run WIRE defaults only.
559
+ - **Tier derivation signals ambiguous:** When git diff counts are borderline (e.g., exactly 5 new exports), use the plan estimate as tiebreaker.
560
+ - **Integration fails repeatedly after fix attempts:** After 2 fix cycles, escalate: "Integration has failed <N> times. The integration tasks may need redesign. Review the plan's integration section."
@@ -0,0 +1,65 @@
1
+ name: harness-integration
2
+ version: "1.0.0"
3
+ description: Verify system wiring, materialize knowledge artifacts, and update project metadata after execution
4
+ stability: static
5
+ cognitive_mode: meticulous-verifier
6
+ triggers:
7
+ - manual
8
+ platforms:
9
+ - claude-code
10
+ - gemini-cli
11
+ - cursor
12
+ - codex
13
+ tools:
14
+ - Bash
15
+ - Read
16
+ - Write
17
+ - Edit
18
+ - Glob
19
+ - Grep
20
+ - emit_interaction
21
+ - manage_state
22
+ cli:
23
+ command: harness skill run harness-integration
24
+ args:
25
+ - name: path
26
+ description: Project root path
27
+ required: false
28
+ - name: session-slug
29
+ description: Session slug for scoped state/handoff (passed by autopilot)
30
+ required: false
31
+ - name: fast
32
+ description: WIRE only -- defaults, auto-approve, no ADR drafting
33
+ required: false
34
+ - name: thorough
35
+ description: Full checks + human reviews every ADR draft + force knowledge graph verification
36
+ required: false
37
+ mcp:
38
+ tool: run_skill
39
+ input:
40
+ skill: harness-integration
41
+ path: string
42
+ # Autopilot dispatch: subagent_type: "harness-verifier" (reuses verification agent persona)
43
+ type: rigid
44
+ tier: 1
45
+ phases:
46
+ - name: wire
47
+ description: Verify barrel exports, entry point reachability, skill discovery, and route mounts
48
+ required: true
49
+ - name: materialize
50
+ description: Draft ADRs from decisions, enrich knowledge graph, verify documentation tasks
51
+ required: false
52
+ - name: update
53
+ description: Sync roadmap, verify changelog, annotate spec cross-references
54
+ required: false
55
+ - name: report
56
+ description: Produce combined integration report with pass/fail per sub-phase
57
+ required: true
58
+ state:
59
+ persistent: false
60
+ files:
61
+ - .harness/sessions/*/integration-wiring.json
62
+ - .harness/sessions/*/integration-materialization.json
63
+ - .harness/sessions/*/integration-updates.json
64
+ depends_on:
65
+ - harness-verification
@@ -109,6 +109,8 @@ Rules:
109
109
 
110
110
  - Chains harness-verify (mechanical) and harness-code-review (AI) into a unified pipeline
111
111
  - Follows Principle 7 — deterministic checks always run first
112
+ - **`check_traceability`** — Include as part of the integrity gate to verify requirement coverage (every spec requirement maps to an implemented artifact and test).
113
+ - **`validate_cross_check`** — Run against the plan to verify plan-to-implementation alignment before producing the final report.
112
114
  - Consumes change-type detection from harness-code-review for per-type checklists
113
115
  - Output can be written to `.harness/integrity-report.md` for CI integration
114
116
  - Invokes `harness-design` and `harness-accessibility` for design health when `design` config exists
@@ -37,6 +37,8 @@
37
37
 
38
38
  ### Phase 2: MAP — Understand the Codebase Structure
39
39
 
40
+ Use `code_outline` to get structural overviews of key modules (functions, classes, exports) without reading full source files. Use `code_search` to locate patterns, symbols, or conventions across the codebase.
41
+
40
42
  1. **Map the technology stack.** Identify from package files, configuration, and code:
41
43
  - Language(s) and version(s)
42
44
  - Framework(s) and major libraries
@@ -93,6 +95,8 @@ When a knowledge graph exists at `.harness/graph/`, use graph queries for faster
93
95
 
94
96
  Graph queries produce a complete architecture map in seconds, including transitive relationships that directory inspection misses. Fall back to file-based commands if no graph is available.
95
97
 
98
+ When deep-diving into specific modules to explain architecture, use `code_unfold` to expand specific symbols to their full implementation with dependency context.
99
+
96
100
  ### Phase 3: ORIENT — Identify Adoption Level and Maturity
97
101
 
98
102
  1. **Confirm the adoption level** matches what `harness.config.json` declares: