@harness-engineering/cli 1.6.2 → 1.8.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 (180) hide show
  1. package/dist/agents/personas/documentation-maintainer.yaml +3 -1
  2. package/dist/agents/personas/performance-guardian.yaml +23 -0
  3. package/dist/agents/personas/planner.yaml +27 -0
  4. package/dist/agents/personas/verifier.yaml +30 -0
  5. package/dist/agents/skills/claude-code/align-documentation/SKILL.md +13 -0
  6. package/dist/agents/skills/claude-code/cleanup-dead-code/SKILL.md +25 -1
  7. package/dist/agents/skills/claude-code/cleanup-dead-code/skill.yaml +5 -2
  8. package/dist/agents/skills/claude-code/detect-doc-drift/SKILL.md +12 -0
  9. package/dist/agents/skills/claude-code/enforce-architecture/SKILL.md +67 -1
  10. package/dist/agents/skills/claude-code/enforce-architecture/skill.yaml +5 -2
  11. package/dist/agents/skills/claude-code/harness-accessibility/SKILL.md +281 -0
  12. package/dist/agents/skills/claude-code/harness-accessibility/skill.yaml +51 -0
  13. package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +119 -72
  14. package/dist/agents/skills/claude-code/harness-autopilot/skill.yaml +4 -2
  15. package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +76 -4
  16. package/dist/agents/skills/claude-code/harness-brainstorming/skill.yaml +2 -0
  17. package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +487 -234
  18. package/dist/agents/skills/claude-code/harness-code-review/skill.yaml +15 -2
  19. package/dist/agents/skills/claude-code/harness-codebase-cleanup/SKILL.md +226 -0
  20. package/dist/agents/skills/claude-code/harness-codebase-cleanup/skill.yaml +64 -0
  21. package/dist/agents/skills/claude-code/harness-dependency-health/SKILL.md +35 -6
  22. package/dist/agents/skills/claude-code/harness-dependency-health/skill.yaml +1 -1
  23. package/dist/agents/skills/claude-code/harness-design/SKILL.md +265 -0
  24. package/dist/agents/skills/claude-code/harness-design/skill.yaml +53 -0
  25. package/dist/agents/skills/claude-code/harness-design-mobile/SKILL.md +336 -0
  26. package/dist/agents/skills/claude-code/harness-design-mobile/skill.yaml +49 -0
  27. package/dist/agents/skills/claude-code/harness-design-system/SKILL.md +282 -0
  28. package/dist/agents/skills/claude-code/harness-design-system/skill.yaml +50 -0
  29. package/dist/agents/skills/claude-code/harness-design-web/SKILL.md +360 -0
  30. package/dist/agents/skills/claude-code/harness-design-web/skill.yaml +52 -0
  31. package/dist/agents/skills/claude-code/harness-docs-pipeline/SKILL.md +460 -0
  32. package/dist/agents/skills/claude-code/harness-docs-pipeline/skill.yaml +69 -0
  33. package/dist/agents/skills/claude-code/harness-execution/SKILL.md +73 -8
  34. package/dist/agents/skills/claude-code/harness-execution/skill.yaml +1 -0
  35. package/dist/agents/skills/claude-code/harness-hotspot-detector/SKILL.md +32 -6
  36. package/dist/agents/skills/claude-code/harness-hotspot-detector/skill.yaml +1 -1
  37. package/dist/agents/skills/claude-code/harness-i18n/SKILL.md +484 -0
  38. package/dist/agents/skills/claude-code/harness-i18n/skill.yaml +54 -0
  39. package/dist/agents/skills/claude-code/harness-i18n-process/SKILL.md +388 -0
  40. package/dist/agents/skills/claude-code/harness-i18n-process/skill.yaml +43 -0
  41. package/dist/agents/skills/claude-code/harness-i18n-workflow/SKILL.md +512 -0
  42. package/dist/agents/skills/claude-code/harness-i18n-workflow/skill.yaml +53 -0
  43. package/dist/agents/skills/claude-code/harness-impact-analysis/SKILL.md +51 -6
  44. package/dist/agents/skills/claude-code/harness-integrity/SKILL.md +35 -1
  45. package/dist/agents/skills/claude-code/harness-knowledge-mapper/SKILL.md +46 -5
  46. package/dist/agents/skills/claude-code/harness-knowledge-mapper/skill.yaml +1 -1
  47. package/dist/agents/skills/claude-code/harness-onboarding/SKILL.md +19 -1
  48. package/dist/agents/skills/claude-code/harness-perf/SKILL.md +37 -8
  49. package/dist/agents/skills/claude-code/harness-perf/skill.yaml +3 -0
  50. package/dist/agents/skills/claude-code/harness-perf-tdd/SKILL.md +17 -4
  51. package/dist/agents/skills/claude-code/harness-planning/SKILL.md +57 -3
  52. package/dist/agents/skills/claude-code/harness-planning/skill.yaml +2 -0
  53. package/dist/agents/skills/claude-code/harness-release-readiness/SKILL.md +29 -9
  54. package/dist/agents/skills/claude-code/harness-roadmap/SKILL.md +562 -0
  55. package/dist/agents/skills/claude-code/harness-roadmap/skill.yaml +43 -0
  56. package/dist/agents/skills/claude-code/harness-security-review/SKILL.md +36 -2
  57. package/dist/agents/skills/claude-code/harness-security-review/skill.yaml +8 -6
  58. package/dist/agents/skills/claude-code/harness-security-scan/skill.yaml +1 -1
  59. package/dist/agents/skills/claude-code/harness-soundness-review/SKILL.md +1267 -0
  60. package/dist/agents/skills/claude-code/harness-soundness-review/skill.yaml +48 -0
  61. package/dist/agents/skills/claude-code/harness-test-advisor/SKILL.md +35 -6
  62. package/dist/agents/skills/claude-code/harness-verification/SKILL.md +66 -0
  63. package/dist/agents/skills/claude-code/harness-verification/skill.yaml +1 -0
  64. package/dist/agents/skills/claude-code/harness-verify/SKILL.md +37 -0
  65. package/dist/agents/skills/claude-code/initialize-harness-project/SKILL.md +15 -1
  66. package/dist/agents/skills/claude-code/validate-context-engineering/SKILL.md +12 -0
  67. package/dist/agents/skills/gemini-cli/harness-accessibility/SKILL.md +281 -0
  68. package/dist/agents/skills/gemini-cli/harness-accessibility/skill.yaml +51 -0
  69. package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +119 -72
  70. package/dist/agents/skills/gemini-cli/harness-autopilot/skill.yaml +4 -2
  71. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/SKILL.md +226 -0
  72. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/skill.yaml +64 -0
  73. package/dist/agents/skills/gemini-cli/harness-dependency-health/SKILL.md +35 -6
  74. package/dist/agents/skills/gemini-cli/harness-dependency-health/skill.yaml +1 -1
  75. package/dist/agents/skills/gemini-cli/harness-design/SKILL.md +265 -0
  76. package/dist/agents/skills/gemini-cli/harness-design/skill.yaml +53 -0
  77. package/dist/agents/skills/gemini-cli/harness-design-mobile/SKILL.md +336 -0
  78. package/dist/agents/skills/gemini-cli/harness-design-mobile/skill.yaml +49 -0
  79. package/dist/agents/skills/gemini-cli/harness-design-system/SKILL.md +282 -0
  80. package/dist/agents/skills/gemini-cli/harness-design-system/skill.yaml +50 -0
  81. package/dist/agents/skills/gemini-cli/harness-design-web/SKILL.md +360 -0
  82. package/dist/agents/skills/gemini-cli/harness-design-web/skill.yaml +52 -0
  83. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/SKILL.md +460 -0
  84. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/skill.yaml +69 -0
  85. package/dist/agents/skills/gemini-cli/harness-hotspot-detector/SKILL.md +32 -6
  86. package/dist/agents/skills/gemini-cli/harness-hotspot-detector/skill.yaml +1 -1
  87. package/dist/agents/skills/gemini-cli/harness-i18n/SKILL.md +484 -0
  88. package/dist/agents/skills/gemini-cli/harness-i18n/skill.yaml +54 -0
  89. package/dist/agents/skills/gemini-cli/harness-i18n-process/SKILL.md +388 -0
  90. package/dist/agents/skills/gemini-cli/harness-i18n-process/skill.yaml +43 -0
  91. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/SKILL.md +512 -0
  92. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/skill.yaml +53 -0
  93. package/dist/agents/skills/gemini-cli/harness-impact-analysis/SKILL.md +51 -6
  94. package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/SKILL.md +46 -5
  95. package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/skill.yaml +1 -1
  96. package/dist/agents/skills/gemini-cli/harness-perf/SKILL.md +37 -8
  97. package/dist/agents/skills/gemini-cli/harness-perf/skill.yaml +3 -0
  98. package/dist/agents/skills/gemini-cli/harness-perf-tdd/SKILL.md +17 -4
  99. package/dist/agents/skills/gemini-cli/harness-release-readiness/SKILL.md +29 -9
  100. package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +562 -0
  101. package/dist/agents/skills/gemini-cli/harness-roadmap/skill.yaml +43 -0
  102. package/dist/agents/skills/gemini-cli/harness-security-review/skill.yaml +8 -6
  103. package/dist/agents/skills/gemini-cli/harness-security-scan/skill.yaml +1 -1
  104. package/dist/agents/skills/gemini-cli/harness-soundness-review/SKILL.md +1267 -0
  105. package/dist/agents/skills/gemini-cli/harness-soundness-review/skill.yaml +48 -0
  106. package/dist/agents/skills/gemini-cli/harness-test-advisor/SKILL.md +35 -6
  107. package/dist/agents/skills/node_modules/.bin/vitest +2 -2
  108. package/dist/agents/skills/shared/design-knowledge/anti-patterns/color.yaml +106 -0
  109. package/dist/agents/skills/shared/design-knowledge/anti-patterns/layout.yaml +109 -0
  110. package/dist/agents/skills/shared/design-knowledge/anti-patterns/motion.yaml +109 -0
  111. package/dist/agents/skills/shared/design-knowledge/anti-patterns/typography.yaml +112 -0
  112. package/dist/agents/skills/shared/design-knowledge/industries/creative.yaml +80 -0
  113. package/dist/agents/skills/shared/design-knowledge/industries/ecommerce.yaml +80 -0
  114. package/dist/agents/skills/shared/design-knowledge/industries/emerging-tech.yaml +83 -0
  115. package/dist/agents/skills/shared/design-knowledge/industries/fintech.yaml +80 -0
  116. package/dist/agents/skills/shared/design-knowledge/industries/healthcare.yaml +80 -0
  117. package/dist/agents/skills/shared/design-knowledge/industries/lifestyle.yaml +80 -0
  118. package/dist/agents/skills/shared/design-knowledge/industries/saas.yaml +80 -0
  119. package/dist/agents/skills/shared/design-knowledge/industries/services.yaml +80 -0
  120. package/dist/agents/skills/shared/design-knowledge/palettes/curated.yaml +234 -0
  121. package/dist/agents/skills/shared/design-knowledge/platform-rules/android.yaml +125 -0
  122. package/dist/agents/skills/shared/design-knowledge/platform-rules/flutter.yaml +144 -0
  123. package/dist/agents/skills/shared/design-knowledge/platform-rules/ios.yaml +106 -0
  124. package/dist/agents/skills/shared/design-knowledge/platform-rules/web.yaml +102 -0
  125. package/dist/agents/skills/shared/design-knowledge/typography/pairings.yaml +274 -0
  126. package/dist/agents/skills/shared/i18n-knowledge/accessibility/intersection.yaml +142 -0
  127. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/encoding.yaml +67 -0
  128. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/formatting.yaml +106 -0
  129. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/layout.yaml +80 -0
  130. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/pluralization.yaml +80 -0
  131. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/string-handling.yaml +106 -0
  132. package/dist/agents/skills/shared/i18n-knowledge/frameworks/android-resources.yaml +47 -0
  133. package/dist/agents/skills/shared/i18n-knowledge/frameworks/apple-strings.yaml +47 -0
  134. package/dist/agents/skills/shared/i18n-knowledge/frameworks/backend-patterns.yaml +50 -0
  135. package/dist/agents/skills/shared/i18n-knowledge/frameworks/flutter-intl.yaml +47 -0
  136. package/dist/agents/skills/shared/i18n-knowledge/frameworks/i18next.yaml +47 -0
  137. package/dist/agents/skills/shared/i18n-knowledge/frameworks/react-intl.yaml +47 -0
  138. package/dist/agents/skills/shared/i18n-knowledge/frameworks/vue-i18n.yaml +47 -0
  139. package/dist/agents/skills/shared/i18n-knowledge/industries/ecommerce.yaml +66 -0
  140. package/dist/agents/skills/shared/i18n-knowledge/industries/fintech.yaml +66 -0
  141. package/dist/agents/skills/shared/i18n-knowledge/industries/gaming.yaml +69 -0
  142. package/dist/agents/skills/shared/i18n-knowledge/industries/healthcare.yaml +66 -0
  143. package/dist/agents/skills/shared/i18n-knowledge/industries/legal.yaml +66 -0
  144. package/dist/agents/skills/shared/i18n-knowledge/locales/ar.yaml +41 -0
  145. package/dist/agents/skills/shared/i18n-knowledge/locales/de.yaml +35 -0
  146. package/dist/agents/skills/shared/i18n-knowledge/locales/en.yaml +32 -0
  147. package/dist/agents/skills/shared/i18n-knowledge/locales/es.yaml +35 -0
  148. package/dist/agents/skills/shared/i18n-knowledge/locales/fi.yaml +35 -0
  149. package/dist/agents/skills/shared/i18n-knowledge/locales/fr.yaml +35 -0
  150. package/dist/agents/skills/shared/i18n-knowledge/locales/he.yaml +41 -0
  151. package/dist/agents/skills/shared/i18n-knowledge/locales/hi.yaml +35 -0
  152. package/dist/agents/skills/shared/i18n-knowledge/locales/it.yaml +32 -0
  153. package/dist/agents/skills/shared/i18n-knowledge/locales/ja.yaml +38 -0
  154. package/dist/agents/skills/shared/i18n-knowledge/locales/ko.yaml +38 -0
  155. package/dist/agents/skills/shared/i18n-knowledge/locales/nl.yaml +32 -0
  156. package/dist/agents/skills/shared/i18n-knowledge/locales/pl.yaml +35 -0
  157. package/dist/agents/skills/shared/i18n-knowledge/locales/pt.yaml +32 -0
  158. package/dist/agents/skills/shared/i18n-knowledge/locales/ru.yaml +35 -0
  159. package/dist/agents/skills/shared/i18n-knowledge/locales/sv.yaml +32 -0
  160. package/dist/agents/skills/shared/i18n-knowledge/locales/th.yaml +35 -0
  161. package/dist/agents/skills/shared/i18n-knowledge/locales/tr.yaml +35 -0
  162. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hans.yaml +38 -0
  163. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hant.yaml +35 -0
  164. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/i18next-mcp.yaml +56 -0
  165. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lingo-dev.yaml +56 -0
  166. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lokalise.yaml +60 -0
  167. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/tolgee.yaml +60 -0
  168. package/dist/agents/skills/shared/i18n-knowledge/testing/locale-testing.yaml +107 -0
  169. package/dist/agents/skills/shared/i18n-knowledge/testing/pseudo-localization.yaml +86 -0
  170. package/dist/bin/harness.js +64 -4
  171. package/dist/{chunk-UDWGSL3T.js → chunk-3JWCBVUZ.js} +3 -3
  172. package/dist/{chunk-IUFFBBYV.js → chunk-LNI4T7R6.js} +179 -61
  173. package/dist/{chunk-USEYPS7F.js → chunk-SJECMKSS.js} +2250 -40
  174. package/dist/{dist-4MYPT3OE.js → dist-BDO5GFEM.js} +295 -14
  175. package/dist/{dist-RBZXXJHG.js → dist-NT3GXHQZ.js} +95 -1
  176. package/dist/index.d.ts +266 -7
  177. package/dist/index.js +7 -3
  178. package/dist/validate-cross-check-2OPGCGGU.js +7 -0
  179. package/package.json +7 -7
  180. package/dist/validate-cross-check-CPEPNLOD.js +0 -7
@@ -0,0 +1,460 @@
1
+ # Harness Docs Pipeline
2
+
3
+ > Orchestrator composing 4 documentation skills into a sequential pipeline with convergence-based remediation, producing a qualitative documentation health report.
4
+
5
+ ## When to Use
6
+
7
+ - When you want a single-command documentation health check across drift, coverage, links, and freshness
8
+ - After major refactoring that may have caused widespread documentation drift
9
+ - As a periodic hygiene check (weekly or per-sprint)
10
+ - When onboarding a new project that has no AGENTS.md (bootstrap mode)
11
+ - When `on_doc_check` triggers fire
12
+ - NOT for fixing a single known drift issue (use align-documentation directly)
13
+ - NOT for generating AGENTS.md from scratch when you know you have a graph (use harness-knowledge-mapper directly)
14
+ - NOT for validating a single file's context (use validate-context-engineering directly)
15
+
16
+ ## Relationship to Sub-Skills
17
+
18
+ | Skill | Pipeline Phase | Role |
19
+ | ---------------------------- | -------------- | ------------------------------------------- |
20
+ | detect-doc-drift | DETECT | Find drift between code and docs |
21
+ | align-documentation | FIX | Apply fixes for drift findings |
22
+ | validate-context-engineering | AUDIT | Find gaps in documentation coverage |
23
+ | harness-knowledge-mapper | FILL | Generate/regenerate AGENTS.md and fill gaps |
24
+
25
+ This orchestrator delegates to sub-skills — it never reimplements their logic. Each sub-skill retains full standalone functionality.
26
+
27
+ ## Iron Law
28
+
29
+ **The pipeline delegates, never reimplements.** If you find yourself writing drift detection logic, fix application logic, or gap analysis logic inside the pipeline, STOP. Delegate to the dedicated sub-skill.
30
+
31
+ **Safe fixes are silent, unsafe fixes surface.** Never apply a fix classified as `unsafe` without explicit user approval. Never prompt the user for a fix classified as `safe`.
32
+
33
+ ## Flags
34
+
35
+ | Flag | Effect |
36
+ | -------------- | ----------------------------------------------------------------- |
37
+ | `--fix` | Enable convergence-based auto-fix (default: detect + report only) |
38
+ | `--no-freshen` | Skip graph staleness check |
39
+ | `--bootstrap` | Force AGENTS.md regeneration even if one exists |
40
+ | `--ci` | Non-interactive: apply safe fixes only, report everything else |
41
+
42
+ ## Shared Context Object
43
+
44
+ All phases read from and write to a shared `DocPipelineContext`:
45
+
46
+ ```typescript
47
+ interface DocPipelineContext {
48
+ // Pipeline state
49
+ graphAvailable: boolean;
50
+ agentsMdExists: boolean;
51
+ bootstrapped: boolean; // true if AGENTS.md was created this run
52
+
53
+ // Phase outputs
54
+ driftFindings: DriftFinding[];
55
+ fixesApplied: DocFix[];
56
+ gapFindings: GapFinding[];
57
+ fillsApplied: DocFix[];
58
+ exclusions: Set<string>; // finding IDs already addressed
59
+
60
+ // Health verdict
61
+ verdict: 'pass' | 'warn' | 'fail';
62
+ summary: string;
63
+ }
64
+
65
+ interface DriftFinding {
66
+ id: string;
67
+ file: string;
68
+ line?: number;
69
+ driftType: 'renamed' | 'new-code' | 'deleted-code' | 'changed-behavior' | 'moved-code';
70
+ priority: 'critical' | 'high' | 'medium' | 'low';
71
+ staleText: string;
72
+ codeChange: string;
73
+ suggestedFix: string;
74
+ fixSafety: 'safe' | 'probably-safe' | 'unsafe';
75
+ }
76
+
77
+ interface GapFinding {
78
+ id: string;
79
+ file?: string;
80
+ gapType: 'undocumented' | 'broken-link' | 'stale-section' | 'missing-context';
81
+ priority: 'critical' | 'high' | 'medium' | 'low';
82
+ description: string;
83
+ suggestedFix: string;
84
+ fixSafety: 'safe' | 'probably-safe' | 'unsafe';
85
+ }
86
+
87
+ interface DocFix {
88
+ findingId: string;
89
+ file: string;
90
+ oldText: string;
91
+ newText: string;
92
+ safety: 'safe' | 'probably-safe';
93
+ verified: boolean; // harness check-docs passed after applying
94
+ }
95
+ ```
96
+
97
+ The context is passed to sub-skills via `handoff.json` with a `pipeline` field. Sub-skills check for this field; if absent, they run in standalone mode.
98
+
99
+ ## Process
100
+
101
+ ### Phase 1: FRESHEN — Graph Freshness and AGENTS.md Bootstrap
102
+
103
+ **Skip this phase if `--no-freshen` flag is set.**
104
+
105
+ 1. **Check graph existence.** Look for `.harness/graph/` directory.
106
+ - If exists: set `context.graphAvailable = true`
107
+ - If not: set `context.graphAvailable = false`, log notice: "No knowledge graph available. Pipeline will use static analysis fallbacks. Run `harness scan` for richer results."
108
+
109
+ 2. **Check graph staleness** (only if graph exists).
110
+ - Count commits since last graph update: `git rev-list --count HEAD ^$(cat .harness/graph/.last-scan-commit 2>/dev/null || echo HEAD)`
111
+ - If >10 commits behind: run `harness scan` to refresh
112
+ - If <=10 commits: proceed with current graph
113
+
114
+ 3. **Check AGENTS.md existence.**
115
+ - If exists and `--bootstrap` not set: set `context.agentsMdExists = true`, proceed to DETECT
116
+ - If exists and `--bootstrap` set: proceed to step 4 (regenerate)
117
+ - If not exists: proceed to step 4
118
+
119
+ 4. **Bootstrap AGENTS.md.**
120
+
121
+ **If graph available:**
122
+ - Invoke `harness-knowledge-mapper` to generate AGENTS.md
123
+ - Set `context.bootstrapped = true`
124
+ - Set `context.agentsMdExists = true`
125
+
126
+ **If no graph (directory structure fallback):**
127
+ - Glob source directories: `src/*/`, `packages/*/`, `lib/*/`
128
+ - Read `package.json` for project name and description
129
+ - Identify entry points: files matching `src/index.*`, `main` field in package.json
130
+ - List top-level modules: each immediate subdirectory of `src/` (or `packages/`) with its directory name as the module name
131
+ - Generate minimal AGENTS.md:
132
+
133
+ ```markdown
134
+ # AGENTS.md
135
+
136
+ > Generated from directory structure. Run `harness scan` for richer output.
137
+
138
+ ## Project
139
+
140
+ <name from package.json> — <description from package.json>
141
+
142
+ ## Entry Points
143
+
144
+ - <each identified entry point>
145
+
146
+ ## Modules
147
+
148
+ - **<dir-name>/** — <inferred from directory name>
149
+ ```
150
+
151
+ - Set `context.bootstrapped = true`
152
+ - Set `context.agentsMdExists = true`
153
+
154
+ 5. Proceed to DETECT phase.
155
+
156
+ ### Phase 2: DETECT — Find Documentation Drift
157
+
158
+ 1. **Write pipeline context to handoff.json.** Set the `pipeline` field in `.harness/handoff.json` with the current `DocPipelineContext` so detect-doc-drift can read it.
159
+
160
+ 2. **Invoke detect-doc-drift.** Run the skill's full process:
161
+ - Phase 1 (Scan): `harness check-docs` and `harness cleanup --type drift`
162
+ - Phase 2 (Identify): Classify each finding into drift types
163
+ - Phase 3 (Prioritize): Rank by impact (Critical > High > Medium > Low)
164
+ - Phase 4 (Report): Structured output
165
+
166
+ 3. **Populate context with DriftFinding objects.** For each finding from detect-doc-drift, create a `DriftFinding` with:
167
+ - `id`: deterministic hash of `file + line + driftType` (for dedup tracking)
168
+ - `driftType`: map to one of `renamed`, `new-code`, `deleted-code`, `changed-behavior`, `moved-code`
169
+ - `priority`: map to `critical`, `high`, `medium`, `low`
170
+ - `fixSafety`: classify using the safety table below
171
+
172
+ 4. **Store findings.** Set `context.driftFindings = <all DriftFinding objects>`.
173
+
174
+ 5. **If `--fix` flag is not set:** Skip to AUDIT phase (Phase 4).
175
+
176
+ ### Fix Safety Classification
177
+
178
+ | Category | Safe (apply silently) | Probably safe (present diff) | Unsafe (surface to user) |
179
+ | --------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
180
+ | **Drift fixes** | Update file path where rename is unambiguous; fix import reference | Rewrite description for simple rename/parameter change; update code examples | Rewrite behavioral explanations; remove sections for deleted code |
181
+ | **Gap fills** | Add entry for new file with obvious single-purpose name | Add entry for new file requiring description; update AGENTS.md section ordering | Write documentation for complex modules; create new doc pages |
182
+ | **Link fixes** | Redirect broken link where target is unambiguous | Redirect when multiple candidates exist (present options) | Remove link when target no longer exists |
183
+
184
+ ### Phase 3: FIX — Convergence-Based Drift Remediation
185
+
186
+ **This phase runs only when `--fix` flag is set.**
187
+
188
+ #### Convergence Loop
189
+
190
+ ```
191
+ previousCount = context.driftFindings.length
192
+ maxIterations = 5
193
+
194
+ while iteration < maxIterations:
195
+ 1. Partition findings by safety
196
+ 2. Apply safe fixes → verify → record
197
+ 3. Present probably-safe fixes → apply approved → verify → record
198
+ 4. Surface unsafe fixes to user (no auto-apply)
199
+ 5. Re-run detect-doc-drift
200
+ 6. newCount = remaining findings
201
+ 7. if newCount >= previousCount: STOP (converged)
202
+ 8. previousCount = newCount
203
+ 9. iteration++
204
+ ```
205
+
206
+ #### Step-by-step
207
+
208
+ 1. **Partition findings by fixSafety.**
209
+ - `safeFixes`: findings where `fixSafety === 'safe'`
210
+ - `probablySafeFixes`: findings where `fixSafety === 'probably-safe'`
211
+ - `unsafeFixes`: findings where `fixSafety === 'unsafe'`
212
+
213
+ 2. **Apply safe fixes silently.**
214
+ - Write pipeline context to handoff.json with `pipeline.fixBatch = safeFixes`
215
+ - Invoke align-documentation to apply the fixes
216
+ - Run `harness check-docs` after the batch
217
+ - If check passes: record each fix as a `DocFix` with `verified: true` in `context.fixesApplied`
218
+ - If check fails: revert the batch (`git checkout -- <files>`), record fixes as `verified: false`
219
+ - Add fixed finding IDs to `context.exclusions`
220
+
221
+ 3. **Present probably-safe fixes** (skip in `--ci` mode).
222
+ - For each fix, show the diff (oldText vs newText) to the user
223
+ - Apply user-approved fixes
224
+ - Run `harness check-docs` after the batch
225
+ - Same verify/revert logic as safe fixes
226
+ - Add fixed finding IDs to `context.exclusions`
227
+
228
+ 4. **Surface unsafe fixes.**
229
+ - List each unsafe finding with its `suggestedFix` text
230
+ - Do not apply — user must handle manually
231
+ - In `--ci` mode: log to report, do not prompt
232
+
233
+ 5. **Re-run detect-doc-drift** to check for cascading issues revealed by fixes.
234
+ - If new finding count < previous count: loop back to step 1
235
+ - If new finding count >= previous count: stop (converged or no progress)
236
+ - If max iterations reached: stop
237
+
238
+ 6. **Record remaining unfixed findings** for the REPORT phase.
239
+
240
+ ### Phase 4: AUDIT — Find Documentation Gaps
241
+
242
+ 1. **Write pipeline context to handoff.json.** Update the `pipeline` field with the current `DocPipelineContext` (including `exclusions` from FIX phase).
243
+
244
+ 2. **Invoke validate-context-engineering.** Run the skill's full process:
245
+ - Phase 1 (Audit): `harness validate` and `harness check-docs`
246
+ - Phase 2 (Detect Gaps): Classify into undocumented, broken-link, stale-section, missing-context
247
+ - Phase 3 (Suggest Updates): Generate specific suggestions
248
+ - Phase 4 (Apply): Deferred to FILL phase
249
+
250
+ 3. **Populate context with GapFinding objects.** For each finding, create a `GapFinding` with:
251
+ - `id`: deterministic hash of `file + gapType + description`
252
+ - `gapType`: map to `undocumented`, `broken-link`, `stale-section`, `missing-context`
253
+ - `priority`: map to `critical`, `high`, `medium`, `low`
254
+ - `fixSafety`: classify using the safety table from DETECT phase
255
+
256
+ 4. **Dedup against FIX phase.** Remove any `GapFinding` whose `id` appears in `context.exclusions`. This prevents double-counting items already fixed in the FIX phase.
257
+
258
+ 5. **Store findings.** Set `context.gapFindings = <deduplicated GapFinding objects>`.
259
+
260
+ 6. **If `--fix` flag is not set:** Skip to REPORT phase (Phase 6).
261
+
262
+ ### Phase 5: FILL — Convergence-Based Gap Remediation
263
+
264
+ **This phase runs only when `--fix` flag is set.**
265
+
266
+ 1. **Check if AGENTS.md needs regeneration.** If `context.bootstrapped === true` and gap findings include AGENTS.md coverage issues, invoke harness-knowledge-mapper (if graph available) or the directory-structure fallback to improve AGENTS.md quality.
267
+
268
+ 2. **Run convergence loop** (same pattern as FIX phase):
269
+
270
+ ```
271
+ previousCount = context.gapFindings.length
272
+ maxIterations = 5
273
+
274
+ while iteration < maxIterations:
275
+ 1. Partition findings by safety
276
+ 2. Apply safe fills → verify → record
277
+ 3. Present probably-safe fills → apply approved → verify → record
278
+ 4. Surface unsafe fills to user
279
+ 5. Re-run validate-context-engineering
280
+ 6. newCount = remaining gaps (after dedup against exclusions)
281
+ 7. if newCount >= previousCount: STOP (converged)
282
+ 8. previousCount = newCount
283
+ 9. iteration++
284
+ ```
285
+
286
+ 3. **Apply safe fills silently.**
287
+ - For `broken-link` with unambiguous target: redirect the link
288
+ - For `undocumented` with obvious single-purpose name: add minimal entry
289
+ - Run `harness check-docs` after each batch
290
+ - Record in `context.fillsApplied`
291
+ - Add filled finding IDs to `context.exclusions`
292
+
293
+ 4. **Present probably-safe fills** (skip in `--ci` mode).
294
+ - Show diff for: new file entries requiring description, AGENTS.md section reordering
295
+ - Apply approved fills, verify, record
296
+
297
+ 5. **Surface unsafe fills.**
298
+ - Documentation for complex modules, new doc pages
299
+ - Log for report, do not apply
300
+
301
+ 6. **Record remaining unfilled gaps** for the REPORT phase.
302
+
303
+ ### Phase 6: REPORT — Synthesize Health Verdict
304
+
305
+ 1. **Run final `harness check-docs`** to establish the post-pipeline state.
306
+
307
+ 2. **Compute verdict.**
308
+
309
+ **FAIL if any of:**
310
+ - Any critical drift findings remain unfixed
311
+ - `harness check-docs` fails after all fix attempts
312
+ - AGENTS.md does not exist and bootstrap failed
313
+
314
+ **WARN if any of:**
315
+ - High-priority drift or gap findings remain (user-deferred)
316
+ - > 30% of source modules are undocumented
317
+ - Graph not available (reduced accuracy notice)
318
+
319
+ **PASS if:**
320
+ - No critical or high findings remaining
321
+ - `harness check-docs` passes
322
+ - AGENTS.md exists and covers >70% of modules
323
+
324
+ 3. **Generate per-category breakdown:**
325
+
326
+ | Category | Metric |
327
+ | --------- | -------------------------------------- |
328
+ | Accuracy | Drift findings remaining (by priority) |
329
+ | Coverage | Undocumented modules remaining |
330
+ | Links | Broken references remaining |
331
+ | Freshness | Graph staleness status |
332
+
333
+ 4. **List actions taken:**
334
+ - Auto-fixes applied (safe): count and file list
335
+ - User-approved fixes (probably-safe): count and file list
336
+ - Findings deferred to user (unsafe): count and details
337
+ - AGENTS.md bootstrapped: yes/no and method (graph or directory structure)
338
+
339
+ 5. **Set context verdict and summary.** Write `context.verdict` and `context.summary`.
340
+
341
+ 6. **Output report** to console. Format:
342
+
343
+ ```
344
+ === Documentation Health Report ===
345
+
346
+ Verdict: PASS | WARN | FAIL
347
+
348
+ Accuracy: N drift findings remaining (0 critical, 0 high, N medium, N low)
349
+ Coverage: N/M modules documented (N%)
350
+ Links: N broken references remaining
351
+ Freshness: Graph current | Graph stale (N commits behind) | No graph
352
+
353
+ Actions:
354
+ - N safe fixes applied silently
355
+ - N probably-safe fixes applied (user-approved)
356
+ - N unsafe findings deferred to user
357
+ - AGENTS.md bootstrapped from <graph|directory structure>
358
+
359
+ Remaining findings:
360
+ [list of unfixed findings with priority and suggested action]
361
+ ```
362
+
363
+ ## Harness Integration
364
+
365
+ - **`harness check-docs`** — Run in DETECT, after each fix batch in FIX/FILL, and in REPORT for final state
366
+ - **`harness cleanup --type drift`** — Used by detect-doc-drift during DETECT phase
367
+ - **`harness scan`** — Used in FRESHEN to refresh stale graph
368
+ - **`harness validate`** — Run as final step in each task to verify project health
369
+
370
+ ## Success Criteria
371
+
372
+ - `harness-docs-pipeline` runs all 4 sub-skills in the right order with shared context
373
+ - FIX and FILL phases iterate until converged; cascading fixes are caught
374
+ - Safe fixes are applied silently; unsafe changes surface to user
375
+ - `harness check-docs` runs after every fix batch; failed fixes are reverted
376
+ - Bootstrap handles cold start (no AGENTS.md) with graph path and directory structure fallback
377
+ - Standalone skills work independently exactly as today when invoked without pipeline context
378
+ - Entire pipeline runs without graph using static analysis fallbacks
379
+ - PASS/WARN/FAIL report includes per-category breakdown and specific remaining findings
380
+ - Drift fixes in FIX phase are excluded from AUDIT findings (no double-counting)
381
+
382
+ ## Examples
383
+
384
+ ### Example: Full pipeline run with fixes
385
+
386
+ ```
387
+ Input: --fix flag set, graph available, AGENTS.md exists
388
+
389
+ 1. FRESHEN — Graph exists, 3 commits behind (< 10, skip refresh)
390
+ AGENTS.md exists, no bootstrap needed
391
+ 2. DETECT — detect-doc-drift found 8 findings:
392
+ 2 critical (deleted file still referenced)
393
+ 3 high (renamed functions)
394
+ 2 medium (stale descriptions)
395
+ 1 low (formatting)
396
+ 3. FIX — Iteration 1:
397
+ 3 safe fixes applied (renamed file paths)
398
+ 2 probably-safe presented, 2 approved
399
+ 2 unsafe surfaced to user
400
+ harness check-docs: pass
401
+ Re-detect: 1 new finding (cascading rename)
402
+ Iteration 2:
403
+ 1 safe fix applied
404
+ Re-detect: 0 new findings — converged
405
+ 4. AUDIT — validate-context-engineering found 5 gaps
406
+ 2 already in exclusions (fixed in FIX) → 3 remaining
407
+ 5. FILL — 1 safe fill (broken link redirect)
408
+ 1 probably-safe (new module entry) → approved
409
+ 1 unsafe (complex module docs) → deferred
410
+ Re-audit: converged
411
+ 6. REPORT — Verdict: WARN
412
+ Accuracy: 2 drift findings remaining (0 critical, 0 high, 1 medium, 1 low)
413
+ Coverage: 12/14 modules documented (86%)
414
+ Links: 0 broken references
415
+ Freshness: Graph current
416
+ ```
417
+
418
+ ### Example: CI mode (non-interactive)
419
+
420
+ ```
421
+ Input: --fix --ci flags set, no graph
422
+
423
+ 1. FRESHEN — No graph (notice logged), AGENTS.md exists
424
+ 2. DETECT — 4 findings (1 critical, 2 high, 1 medium)
425
+ 3. FIX — 2 safe fixes applied silently
426
+ probably-safe and unsafe: logged to report (no prompts)
427
+ 4. AUDIT — 2 gaps (1 deduped) → 1 remaining
428
+ 5. FILL — 0 safe fills, 1 probably-safe logged to report
429
+ 6. REPORT — Verdict: FAIL (1 critical finding remains)
430
+ ```
431
+
432
+ ### Example: Bootstrap from directory structure
433
+
434
+ ```
435
+ Input: --bootstrap flag set, no graph, no AGENTS.md
436
+
437
+ 1. FRESHEN — No graph, no AGENTS.md
438
+ Fallback bootstrap: glob src/*, read package.json
439
+ Generated minimal AGENTS.md (32 lines)
440
+ context.bootstrapped = true
441
+ 2. DETECT — 0 drift findings (fresh AGENTS.md, no stale refs)
442
+ 3. AUDIT — 6 gaps (4 undocumented modules, 2 missing context)
443
+ 4. REPORT — Verdict: WARN (>30% modules undocumented, no graph)
444
+ ```
445
+
446
+ ## Gates
447
+
448
+ - **No fix without verification.** Every fix batch must be followed by `harness check-docs`. If check fails, revert the batch.
449
+ - **No unsafe auto-apply.** Fixes classified as `unsafe` are never applied without explicit user approval. In `--ci` mode, they are logged but never applied.
450
+ - **No reimplementation of sub-skill logic.** The pipeline delegates to sub-skills. If the DETECT phase is writing drift detection code, the plan is wrong.
451
+ - **No convergence without progress.** If a convergence loop iteration does not reduce the finding count, stop immediately. Do not retry.
452
+ - **Max 5 iterations per convergence loop.** Hard cap to prevent runaway loops.
453
+
454
+ ## Escalation
455
+
456
+ - **When findings exceed 50:** Focus on critical and high priority only. Defer medium and low to a follow-up run.
457
+ - **When bootstrap produces low-quality AGENTS.md:** This is expected without a graph. Log a notice recommending `harness scan` and accept the reduced quality for the current run.
458
+ - **When convergence loop does not converge within 5 iterations:** Stop the loop, log remaining findings, and proceed to the next phase. The report will reflect the unconverged state.
459
+ - **When a sub-skill fails:** Log the failure, skip the phase, and continue the pipeline. The report will note the skipped phase with a WARN or FAIL verdict.
460
+ - **When `harness check-docs` is unavailable:** Fall back to file existence checks and link validation via grep. Log a notice about reduced verification accuracy.
@@ -0,0 +1,69 @@
1
+ name: harness-docs-pipeline
2
+ version: "1.0.0"
3
+ description: Orchestrator composing 4 documentation skills into a sequential pipeline with convergence-based remediation and qualitative health reporting
4
+ cognitive_mode: constructive-architect
5
+ triggers:
6
+ - manual
7
+ - on_doc_check
8
+ platforms:
9
+ - claude-code
10
+ - gemini-cli
11
+ tools:
12
+ - Bash
13
+ - Read
14
+ - Write
15
+ - Edit
16
+ - Glob
17
+ - Grep
18
+ cli:
19
+ command: harness skill run harness-docs-pipeline
20
+ args:
21
+ - name: path
22
+ description: Project root path
23
+ required: false
24
+ - name: fix
25
+ description: Enable convergence-based auto-fix (default detect + report only)
26
+ required: false
27
+ - name: no-freshen
28
+ description: Skip graph staleness check
29
+ required: false
30
+ - name: bootstrap
31
+ description: Force AGENTS.md regeneration even if one exists
32
+ required: false
33
+ - name: ci
34
+ description: Non-interactive mode — apply safe fixes only, report everything else
35
+ required: false
36
+ mcp:
37
+ tool: run_skill
38
+ input:
39
+ skill: harness-docs-pipeline
40
+ path: string
41
+ type: rigid
42
+ phases:
43
+ - name: freshen
44
+ description: Check graph freshness, detect AGENTS.md, trigger bootstrap if needed
45
+ required: true
46
+ - name: detect
47
+ description: Invoke detect-doc-drift, classify and prioritize findings
48
+ required: true
49
+ - name: fix
50
+ description: Convergence loop — classify, apply safe fixes, verify, re-detect
51
+ required: false
52
+ - name: audit
53
+ description: Invoke validate-context-engineering, find gaps, dedup against fixes
54
+ required: true
55
+ - name: fill
56
+ description: Convergence loop — fill gaps, regenerate AGENTS.md if needed, verify
57
+ required: false
58
+ - name: report
59
+ description: Synthesize verdict (PASS/WARN/FAIL) with per-category breakdown
60
+ required: true
61
+ state:
62
+ persistent: false
63
+ files:
64
+ - .harness/handoff.json
65
+ depends_on:
66
+ - detect-doc-drift
67
+ - align-documentation
68
+ - validate-context-engineering
69
+ - harness-knowledge-mapper
@@ -12,8 +12,21 @@
12
12
 
13
13
  ## Prerequisites
14
14
 
15
- A knowledge graph must exist at `.harness/graph/` with git history ingested. Run `harness scan` if no graph is available.
16
- If the graph exists but code has changed since the last scan, re-run `harness scan` first — stale graph data leads to inaccurate results.
15
+ A knowledge graph at `.harness/graph/` with git history enables full analysis. If no graph exists,
16
+ the skill uses static analysis fallbacks (see Graph Availability section).
17
+ Run `harness scan` to enable graph-enhanced analysis.
18
+
19
+ ### Graph Availability
20
+
21
+ Before starting, check if `.harness/graph/graph.json` exists.
22
+
23
+ **If graph exists:** Use graph tools as primary strategy. (Staleness sensitivity: **Low** — never auto-refresh.
24
+ Git-based churn data in the graph remains useful even when slightly stale.)
25
+
26
+ **If graph exists and is fresh (or refreshed):** Use graph tools as primary strategy.
27
+
28
+ **If no graph exists:** Output "Running without graph (run `harness scan` to
29
+ enable full analysis)" and use fallback strategies for all subsequent steps.
17
30
 
18
31
  ## Process
19
32
 
@@ -48,6 +61,19 @@ Rank files by:
48
61
 
49
62
  High churn in shared utilities or core modules = high risk.
50
63
 
64
+ #### Fallback (without graph)
65
+
66
+ When no graph is available, git log provides nearly all the data needed (~90% completeness):
67
+
68
+ 1. **Per-file churn**: `git log --format="%H" -- <file>` for each source file (use glob to enumerate). Count commits per file. Sort descending to rank by churn.
69
+ 2. **Recent velocity**: `git log --since="30 days ago" --format="%H" -- <file>` vs `git log --since="60 days ago" --until="30 days ago" --format="%H" -- <file>` to compare recent vs prior 30-day windows.
70
+ 3. **Co-change detection**: `git log --format="%H %n" --name-only` to build a map of which files changed together in the same commit. File pairs that appear together in >3 commits are co-change candidates.
71
+ 4. **Distant co-change identification**: For co-change pairs, check if they share a parent directory (co-located = normal) or are in different modules (distant = suspicious).
72
+ 5. **Complexity proxy**: Use line count (`wc -l`) as a rough proxy for complexity when graph complexity metrics are unavailable.
73
+ 6. **Hidden dependency detection**: Cross-reference co-change pairs against import parsing (grep for import statements). Co-change pairs with no import relationship indicate hidden dependencies.
74
+
75
+ > Fallback completeness: ~90% — git log provides nearly all the data the graph stores for this use case.
76
+
51
77
  ### Phase 3: COUPLING — Detect Hidden Dependencies
52
78
 
53
79
  Cross-reference co-change data with structural data:
@@ -90,7 +116,7 @@ Use `get_relationships` to check structural edges between co-change pairs.
90
116
 
91
117
  ## Harness Integration
92
118
 
93
- - **`harness scan`** — Must run before this skill to ensure graph is current.
119
+ - **`harness scan`** — Recommended before this skill for full graph-enhanced analysis. If graph is missing, skill uses git log fallbacks.
94
120
  - **`harness validate`** — Run after acting on findings to verify project health.
95
121
  - **Graph tools** — This skill uses `query_graph`, `get_impact`, and `get_relationships` MCP tools.
96
122
 
@@ -100,7 +126,7 @@ Use `get_relationships` to check structural edges between co-change pairs.
100
126
  - Hidden dependencies identified (high co-change, no structural edge)
101
127
  - Co-change patterns detected and classified (co-located vs distant)
102
128
  - Report follows the structured output format
103
- - All findings are backed by graph query evidence, not heuristics
129
+ - All findings are backed by graph query evidence (with graph) or git log analysis (without graph)
104
130
 
105
131
  ## Examples
106
132
 
@@ -126,8 +152,8 @@ Output:
126
152
 
127
153
  ## Gates
128
154
 
129
- - **No analysis without graph + git data.** Both code structure and git history must be ingested.
130
- - **No guessing at co-change patterns.** Use graph `co_changes_with` edges, not manual git log parsing.
155
+ - **Graph preferred, fallback available.** If no graph exists, use git log for churn and co-change analysis. Do not stop — git log provides ~90% of the data needed.
156
+ - **Systematic analysis required.** Use graph `co_changes_with` edges when available; use `git log` commit analysis when not. Do not guess — parse actual git history.
131
157
 
132
158
  ## Escalation
133
159
 
@@ -4,7 +4,7 @@ description: Identify structural risk hotspots via co-change and churn analysis
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