@harness-engineering/cli 1.7.0 → 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 (130) 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/skills/claude-code/align-documentation/SKILL.md +13 -0
  4. package/dist/agents/skills/claude-code/cleanup-dead-code/SKILL.md +25 -1
  5. package/dist/agents/skills/claude-code/cleanup-dead-code/skill.yaml +5 -2
  6. package/dist/agents/skills/claude-code/detect-doc-drift/SKILL.md +12 -0
  7. package/dist/agents/skills/claude-code/enforce-architecture/SKILL.md +48 -1
  8. package/dist/agents/skills/claude-code/enforce-architecture/skill.yaml +5 -2
  9. package/dist/agents/skills/claude-code/harness-accessibility/SKILL.md +7 -0
  10. package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +9 -1
  11. package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +76 -4
  12. package/dist/agents/skills/claude-code/harness-brainstorming/skill.yaml +2 -0
  13. package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +487 -234
  14. package/dist/agents/skills/claude-code/harness-code-review/skill.yaml +15 -2
  15. package/dist/agents/skills/claude-code/harness-codebase-cleanup/SKILL.md +226 -0
  16. package/dist/agents/skills/claude-code/harness-codebase-cleanup/skill.yaml +64 -0
  17. package/dist/agents/skills/claude-code/harness-dependency-health/SKILL.md +35 -6
  18. package/dist/agents/skills/claude-code/harness-docs-pipeline/SKILL.md +460 -0
  19. package/dist/agents/skills/claude-code/harness-docs-pipeline/skill.yaml +69 -0
  20. package/dist/agents/skills/claude-code/harness-execution/SKILL.md +73 -8
  21. package/dist/agents/skills/claude-code/harness-execution/skill.yaml +1 -0
  22. package/dist/agents/skills/claude-code/harness-hotspot-detector/SKILL.md +32 -6
  23. package/dist/agents/skills/claude-code/harness-i18n/SKILL.md +484 -0
  24. package/dist/agents/skills/claude-code/harness-i18n/skill.yaml +54 -0
  25. package/dist/agents/skills/claude-code/harness-i18n-process/SKILL.md +388 -0
  26. package/dist/agents/skills/claude-code/harness-i18n-process/skill.yaml +43 -0
  27. package/dist/agents/skills/claude-code/harness-i18n-workflow/SKILL.md +512 -0
  28. package/dist/agents/skills/claude-code/harness-i18n-workflow/skill.yaml +53 -0
  29. package/dist/agents/skills/claude-code/harness-impact-analysis/SKILL.md +35 -6
  30. package/dist/agents/skills/claude-code/harness-integrity/SKILL.md +17 -1
  31. package/dist/agents/skills/claude-code/harness-knowledge-mapper/SKILL.md +46 -5
  32. package/dist/agents/skills/claude-code/harness-perf/SKILL.md +37 -8
  33. package/dist/agents/skills/claude-code/harness-perf/skill.yaml +3 -0
  34. package/dist/agents/skills/claude-code/harness-perf-tdd/SKILL.md +17 -4
  35. package/dist/agents/skills/claude-code/harness-planning/SKILL.md +57 -3
  36. package/dist/agents/skills/claude-code/harness-planning/skill.yaml +2 -0
  37. package/dist/agents/skills/claude-code/harness-release-readiness/SKILL.md +16 -0
  38. package/dist/agents/skills/claude-code/harness-roadmap/SKILL.md +562 -0
  39. package/dist/agents/skills/claude-code/harness-roadmap/skill.yaml +43 -0
  40. package/dist/agents/skills/claude-code/harness-security-review/SKILL.md +36 -2
  41. package/dist/agents/skills/claude-code/harness-security-review/skill.yaml +8 -6
  42. package/dist/agents/skills/claude-code/harness-soundness-review/SKILL.md +1267 -0
  43. package/dist/agents/skills/claude-code/harness-soundness-review/skill.yaml +48 -0
  44. package/dist/agents/skills/claude-code/harness-test-advisor/SKILL.md +35 -6
  45. package/dist/agents/skills/claude-code/harness-verification/SKILL.md +66 -0
  46. package/dist/agents/skills/claude-code/harness-verification/skill.yaml +1 -0
  47. package/dist/agents/skills/claude-code/harness-verify/SKILL.md +11 -0
  48. package/dist/agents/skills/claude-code/initialize-harness-project/SKILL.md +15 -1
  49. package/dist/agents/skills/claude-code/validate-context-engineering/SKILL.md +12 -0
  50. package/dist/agents/skills/gemini-cli/harness-accessibility/SKILL.md +7 -0
  51. package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +9 -1
  52. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/SKILL.md +226 -0
  53. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/skill.yaml +64 -0
  54. package/dist/agents/skills/gemini-cli/harness-dependency-health/SKILL.md +35 -6
  55. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/SKILL.md +460 -0
  56. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/skill.yaml +69 -0
  57. package/dist/agents/skills/gemini-cli/harness-hotspot-detector/SKILL.md +32 -6
  58. package/dist/agents/skills/gemini-cli/harness-i18n/SKILL.md +484 -0
  59. package/dist/agents/skills/gemini-cli/harness-i18n/skill.yaml +54 -0
  60. package/dist/agents/skills/gemini-cli/harness-i18n-process/SKILL.md +388 -0
  61. package/dist/agents/skills/gemini-cli/harness-i18n-process/skill.yaml +43 -0
  62. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/SKILL.md +512 -0
  63. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/skill.yaml +53 -0
  64. package/dist/agents/skills/gemini-cli/harness-impact-analysis/SKILL.md +35 -6
  65. package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/SKILL.md +46 -5
  66. package/dist/agents/skills/gemini-cli/harness-perf/SKILL.md +37 -8
  67. package/dist/agents/skills/gemini-cli/harness-perf/skill.yaml +3 -0
  68. package/dist/agents/skills/gemini-cli/harness-perf-tdd/SKILL.md +17 -4
  69. package/dist/agents/skills/gemini-cli/harness-release-readiness/SKILL.md +16 -0
  70. package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +562 -0
  71. package/dist/agents/skills/gemini-cli/harness-roadmap/skill.yaml +43 -0
  72. package/dist/agents/skills/gemini-cli/harness-security-review/skill.yaml +8 -6
  73. package/dist/agents/skills/gemini-cli/harness-soundness-review/SKILL.md +1267 -0
  74. package/dist/agents/skills/gemini-cli/harness-soundness-review/skill.yaml +48 -0
  75. package/dist/agents/skills/gemini-cli/harness-test-advisor/SKILL.md +35 -6
  76. package/dist/agents/skills/shared/i18n-knowledge/accessibility/intersection.yaml +142 -0
  77. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/encoding.yaml +67 -0
  78. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/formatting.yaml +106 -0
  79. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/layout.yaml +80 -0
  80. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/pluralization.yaml +80 -0
  81. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/string-handling.yaml +106 -0
  82. package/dist/agents/skills/shared/i18n-knowledge/frameworks/android-resources.yaml +47 -0
  83. package/dist/agents/skills/shared/i18n-knowledge/frameworks/apple-strings.yaml +47 -0
  84. package/dist/agents/skills/shared/i18n-knowledge/frameworks/backend-patterns.yaml +50 -0
  85. package/dist/agents/skills/shared/i18n-knowledge/frameworks/flutter-intl.yaml +47 -0
  86. package/dist/agents/skills/shared/i18n-knowledge/frameworks/i18next.yaml +47 -0
  87. package/dist/agents/skills/shared/i18n-knowledge/frameworks/react-intl.yaml +47 -0
  88. package/dist/agents/skills/shared/i18n-knowledge/frameworks/vue-i18n.yaml +47 -0
  89. package/dist/agents/skills/shared/i18n-knowledge/industries/ecommerce.yaml +66 -0
  90. package/dist/agents/skills/shared/i18n-knowledge/industries/fintech.yaml +66 -0
  91. package/dist/agents/skills/shared/i18n-knowledge/industries/gaming.yaml +69 -0
  92. package/dist/agents/skills/shared/i18n-knowledge/industries/healthcare.yaml +66 -0
  93. package/dist/agents/skills/shared/i18n-knowledge/industries/legal.yaml +66 -0
  94. package/dist/agents/skills/shared/i18n-knowledge/locales/ar.yaml +41 -0
  95. package/dist/agents/skills/shared/i18n-knowledge/locales/de.yaml +35 -0
  96. package/dist/agents/skills/shared/i18n-knowledge/locales/en.yaml +32 -0
  97. package/dist/agents/skills/shared/i18n-knowledge/locales/es.yaml +35 -0
  98. package/dist/agents/skills/shared/i18n-knowledge/locales/fi.yaml +35 -0
  99. package/dist/agents/skills/shared/i18n-knowledge/locales/fr.yaml +35 -0
  100. package/dist/agents/skills/shared/i18n-knowledge/locales/he.yaml +41 -0
  101. package/dist/agents/skills/shared/i18n-knowledge/locales/hi.yaml +35 -0
  102. package/dist/agents/skills/shared/i18n-knowledge/locales/it.yaml +32 -0
  103. package/dist/agents/skills/shared/i18n-knowledge/locales/ja.yaml +38 -0
  104. package/dist/agents/skills/shared/i18n-knowledge/locales/ko.yaml +38 -0
  105. package/dist/agents/skills/shared/i18n-knowledge/locales/nl.yaml +32 -0
  106. package/dist/agents/skills/shared/i18n-knowledge/locales/pl.yaml +35 -0
  107. package/dist/agents/skills/shared/i18n-knowledge/locales/pt.yaml +32 -0
  108. package/dist/agents/skills/shared/i18n-knowledge/locales/ru.yaml +35 -0
  109. package/dist/agents/skills/shared/i18n-knowledge/locales/sv.yaml +32 -0
  110. package/dist/agents/skills/shared/i18n-knowledge/locales/th.yaml +35 -0
  111. package/dist/agents/skills/shared/i18n-knowledge/locales/tr.yaml +35 -0
  112. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hans.yaml +38 -0
  113. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hant.yaml +35 -0
  114. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/i18next-mcp.yaml +56 -0
  115. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lingo-dev.yaml +56 -0
  116. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lokalise.yaml +60 -0
  117. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/tolgee.yaml +60 -0
  118. package/dist/agents/skills/shared/i18n-knowledge/testing/locale-testing.yaml +107 -0
  119. package/dist/agents/skills/shared/i18n-knowledge/testing/pseudo-localization.yaml +86 -0
  120. package/dist/bin/harness.js +64 -4
  121. package/dist/{chunk-4WUGOJQ7.js → chunk-3JWCBVUZ.js} +1 -1
  122. package/dist/{chunk-FFIX3QVG.js → chunk-LNI4T7R6.js} +131 -41
  123. package/dist/{chunk-GA6GN5J2.js → chunk-SJECMKSS.js} +2244 -34
  124. package/dist/{dist-N4D4QWFV.js → dist-BDO5GFEM.js} +1 -1
  125. package/dist/{dist-C4J67MPP.js → dist-NT3GXHQZ.js} +95 -1
  126. package/dist/index.d.ts +187 -7
  127. package/dist/index.js +7 -3
  128. package/dist/validate-cross-check-2OPGCGGU.js +7 -0
  129. package/package.json +7 -7
  130. package/dist/validate-cross-check-WGXQ7K62.js +0 -7
@@ -0,0 +1,48 @@
1
+ name: harness-soundness-review
2
+ version: "1.0.0"
3
+ description: Deep soundness analysis of specs and plans with auto-fix and convergence loop
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
+ - Glob
16
+ - Grep
17
+ cli:
18
+ command: harness skill run harness-soundness-review
19
+ args:
20
+ - name: path
21
+ description: Project root path
22
+ required: false
23
+ - name: mode
24
+ description: Review mode — "spec" for spec soundness or "plan" for plan soundness
25
+ required: true
26
+ mcp:
27
+ tool: run_skill
28
+ input:
29
+ skill: harness-soundness-review
30
+ path: string
31
+ type: rigid
32
+ phases:
33
+ - name: check
34
+ description: Run all checks for the current mode and classify findings
35
+ required: true
36
+ - name: fix
37
+ description: Auto-fix inferrable issues and log changes
38
+ required: true
39
+ - name: converge
40
+ description: Re-run checks, compare issue counts, loop or stop
41
+ required: true
42
+ - name: surface
43
+ description: Present remaining issues to user for resolution
44
+ required: true
45
+ state:
46
+ persistent: false
47
+ files: []
48
+ depends_on: []
@@ -13,8 +13,23 @@
13
13
 
14
14
  ## Prerequisites
15
15
 
16
- A knowledge graph must exist at `.harness/graph/`. Run `harness scan` if no graph is available.
17
- If the graph exists but code has changed since the last scan, re-run `harness scan` first — stale graph data leads to inaccurate results.
16
+ A knowledge graph at `.harness/graph/` enables full analysis. If no graph exists,
17
+ the skill uses static analysis fallbacks (see Graph Availability section).
18
+ Run `harness scan` to enable graph-enhanced analysis.
19
+
20
+ ### Graph Availability
21
+
22
+ Before starting, check if `.harness/graph/graph.json` exists.
23
+
24
+ **If graph exists:** Check staleness — compare `.harness/graph/metadata.json`
25
+ scanTimestamp against `git log -1 --format=%ct` (latest commit timestamp).
26
+ If graph is more than 10 commits behind (`git log --oneline <scanTimestamp>..HEAD | wc -l`),
27
+ run `harness scan` to refresh before proceeding. (Staleness sensitivity: **Medium**)
28
+
29
+ **If graph exists and is fresh (or refreshed):** Use graph tools as primary strategy.
30
+
31
+ **If no graph exists:** Output "Running without graph (run `harness scan` to
32
+ enable full analysis)" and use fallback strategies for all subsequent steps.
18
33
 
19
34
  ## Process
20
35
 
@@ -43,6 +58,20 @@ For each changed file, use graph traversal to find test files:
43
58
 
44
59
  3. **Co-change tests**: Check `co_changes_with` edges for test files that historically change alongside the modified files.
45
60
 
61
+ #### Fallback (without graph)
62
+
63
+ When no graph is available, use naming conventions, import parsing, and git history:
64
+
65
+ 1. **Tier 1 — Filename convention matching**: For each changed file `foo.ts`, search for:
66
+ - `foo.test.ts`, `foo.spec.ts` (same directory)
67
+ - `__tests__/foo.ts`, `__tests__/foo.test.ts`
68
+ - Test files in a parallel `tests/` directory mirroring the source path
69
+ 2. **Tier 2 — Import-linked tests**: Parse test files' import statements (grep for `import.*from` in `*.test.*` and `*.spec.*` files). If a test file imports the changed file, it belongs in Tier 2 (if not already in Tier 1).
70
+ 3. **Tier 3 — Co-change correlated tests**: Use `git log --format="%H" --name-only` to find test files that frequently change in the same commit as the target file. Files that co-change in >2 commits are co-change correlated.
71
+ 4. **Rank**: Tier 1 = direct filename match, Tier 2 = import-linked tests, Tier 3 = co-change correlated tests. Output the same tiered format as the graph version.
72
+
73
+ > Fallback completeness: ~80% — naming conventions and imports catch most mappings; misses dynamic imports and indirect coverage.
74
+
46
75
  ### Phase 3: PRIORITIZE — Rank and Generate Commands
47
76
 
48
77
  Organize tests into three tiers:
@@ -85,7 +114,7 @@ npx vitest run tests/services/auth.test.ts tests/types/user.test.ts tests/routes
85
114
 
86
115
  ## Harness Integration
87
116
 
88
- - **`harness scan`** — Must run before this skill to ensure graph is current.
117
+ - **`harness scan`** — Recommended before this skill for full graph-enhanced analysis. If graph is missing, skill uses naming convention and import parsing fallbacks.
89
118
  - **`harness validate`** — Run after acting on findings to verify project health.
90
119
  - **Graph tools** — This skill uses `query_graph`, `get_impact`, and `get_relationships` MCP tools.
91
120
 
@@ -95,7 +124,7 @@ npx vitest run tests/services/auth.test.ts tests/types/user.test.ts tests/routes
95
124
  - Executable run commands generated for quick and full test runs
96
125
  - Coverage gaps flagged for changed files with no test coverage
97
126
  - Report follows the structured output format
98
- - All findings are backed by graph query evidence, not heuristics
127
+ - All findings are backed by graph query evidence (with graph) or systematic static analysis (without graph)
99
128
 
100
129
  ## Examples
101
130
 
@@ -122,8 +151,8 @@ Output:
122
151
 
123
152
  ## Gates
124
153
 
125
- - **No advice without graph.** If no graph exists, fall back to: "Run all tests in the same directory as changed files."
126
- - **Always include Tier 1.** Direct test coverage is non-negotiable — always recommend running these.
154
+ - **Graph preferred, fallback available.** If no graph exists, use naming conventions, import parsing, and git co-change analysis to identify relevant tests. Do not stop — produce the best test selection possible.
155
+ - **Always include Tier 1.** Direct test coverage is non-negotiable — always recommend running these (whether found via graph or naming conventions).
127
156
 
128
157
  ## Escalation
129
158
 
@@ -160,6 +160,70 @@ After running all three levels, produce a structured gap report:
160
160
  ### Verdict: INCOMPLETE — 2 gaps must be resolved
161
161
  ```
162
162
 
163
+ The verification report uses conventional markdown patterns for structured output:
164
+
165
+ ```
166
+ **[CRITICAL]** path/to/file.ts:22 — TODO: implement validation (anti-pattern)
167
+ **[IMPORTANT]** path/to/file.ts — exported but not imported by any other file
168
+ ```
169
+
170
+ ### Verification Sign-Off
171
+
172
+ After producing the verification report, request acceptance:
173
+
174
+ ```json
175
+ emit_interaction({
176
+ path: "<project-root>",
177
+ type: "confirmation",
178
+ confirmation: {
179
+ text: "Verification report: <VERDICT>. Accept and proceed?",
180
+ context: "<summary: N artifacts checked, N gaps found>"
181
+ }
182
+ })
183
+ ```
184
+
185
+ ### Handoff and Transition
186
+
187
+ After producing the verification report, write the handoff and conditionally transition:
188
+
189
+ Write `.harness/handoff.json`:
190
+
191
+ ```json
192
+ {
193
+ "fromSkill": "harness-verification",
194
+ "phase": "COMPLETE",
195
+ "summary": "<verdict summary>",
196
+ "artifacts": ["<verified file paths>"],
197
+ "verdict": "pass | fail",
198
+ "gaps": ["<gap descriptions if any>"]
199
+ }
200
+ ```
201
+
202
+ **If verdict is PASS (all levels passed, no gaps):**
203
+
204
+ Call `emit_interaction`:
205
+
206
+ ```json
207
+ {
208
+ "type": "transition",
209
+ "transition": {
210
+ "completedPhase": "verification",
211
+ "suggestedNext": "review",
212
+ "reason": "Verification passed at all 3 levels",
213
+ "artifacts": ["<verified file paths>"],
214
+ "requiresConfirmation": false,
215
+ "summary": "Verification passed: <N> artifacts checked. EXISTS, SUBSTANTIVE, WIRED all passed."
216
+ }
217
+ }
218
+ ```
219
+
220
+ The response will include `nextAction: "Invoke harness-code-review skill now"`.
221
+ Immediately invoke harness-code-review without waiting for user input.
222
+
223
+ **If verdict is FAIL or INCOMPLETE:**
224
+
225
+ Do NOT emit a transition. Surface gaps to the user for resolution. The handoff is written with the gaps recorded for future reference.
226
+
163
227
  ---
164
228
 
165
229
  ### Regression Test Verification
@@ -184,6 +248,8 @@ If step 4 passes (test does not fail without the fix), the test is not a valid r
184
248
 
185
249
  All commands must be run fresh in the current session. Do not rely on results from a previous session or a previous run in the same session if code has changed since.
186
250
 
251
+ - **`emit_interaction`** -- Call after verification passes to auto-transition to harness-code-review. Only emitted on PASS verdict. Uses auto-transition (proceeds immediately).
252
+
187
253
  ## Success Criteria
188
254
 
189
255
  - Every claimed deliverable has been verified at all 3 levels
@@ -13,6 +13,7 @@ tools:
13
13
  - Bash
14
14
  - Read
15
15
  - Glob
16
+ - emit_interaction
16
17
  cli:
17
18
  command: harness skill run harness-verification
18
19
  args:
@@ -89,6 +89,16 @@ Rules:
89
89
  - If all checks are SKIPPED, overall result is `PASS` (nothing to fail).
90
90
  - On FAIL, include a brief summary of what failed (e.g., "3 type errors", "2 lint errors", "5 tests failed") below the structured block.
91
91
 
92
+ ### Roadmap Sync (conditional)
93
+
94
+ When all non-skipped checks pass (overall `Verification: PASS`) and `docs/roadmap.md` exists:
95
+
96
+ 1. Trigger a roadmap sync to update feature statuses based on the verified state.
97
+ 2. Use the `manage_roadmap` MCP tool with `sync` action if available, or note to the caller that a roadmap sync is recommended.
98
+ 3. Features linked to plans whose tasks are all complete and verified may be marked as `done`.
99
+
100
+ If `docs/roadmap.md` does not exist, skip this step silently. If verification failed, do not sync — the roadmap should only reflect verified completions.
101
+
92
102
  ## Deterministic Checks
93
103
 
94
104
  This skill is entirely deterministic. There are no LLM judgment calls anywhere in the process.
@@ -106,6 +116,7 @@ This skill is entirely deterministic. There are no LLM judgment calls anywhere i
106
116
  - Output format is consumed by harness-integrity for the unified pipeline
107
117
  - Invokes `harness-accessibility` for design constraint checking when `design` config exists
108
118
  - Design violations respect `design.strictness` from `harness.config.json`
119
+ - **Roadmap sync** — When verification passes and `docs/roadmap.md` exists, triggers `manage_roadmap sync` to mark verified features as `done`. Only fires on overall PASS.
109
120
 
110
121
  ## Success Criteria
111
122
 
@@ -59,6 +59,11 @@
59
59
 
60
60
  4. **For advanced:** Configure state management (`.harness/state.json` schema), learnings capture (`.harness/learnings.md` conventions), and CI integration hooks.
61
61
 
62
+ 5. **Configure i18n (all levels).** Ask: "Will this project support multiple languages?" Based on the answer:
63
+ - **Yes:** Invoke `harness-i18n-workflow` configure phase to set up i18n config in `harness.config.json` (source locale, target locales, framework, strictness). Then invoke `harness-i18n-workflow` scaffold phase to create translation file structure and extraction config. Set `i18n.enabled: true`.
64
+ - **No:** Set `i18n.enabled: false` in `harness.config.json`. The `harness-i18n-process` skill will still fire gentle prompts for unconfigured projects when features touch user-facing strings.
65
+ - **Not sure yet:** Skip i18n configuration entirely. Do not set `i18n.enabled`. The project can enable i18n later by running `harness-i18n-workflow` directly.
66
+
62
67
  ### Phase 4: VALIDATE — Confirm Everything Works
63
68
 
64
69
  1. **Run `harness validate`** to verify the full configuration. This checks:
@@ -82,7 +87,9 @@ harness scan [path]
82
87
 
83
88
  This creates the `.harness/graph/` directory and populates it with the project's dependency and relationship data. Subsequent graph queries (impact analysis, dependency health, test advisor) depend on this initial scan.
84
89
 
85
- 4. **Commit the initialization.** All generated and configured files in a single commit.
90
+ 4. **Mention roadmap.** After validation passes, inform the user: "When you are ready to set up a project roadmap, run `/harness:roadmap --create`. This creates a unified `docs/roadmap.md` that tracks features, milestones, and status across your specs and plans." This is informational only — do not create the roadmap automatically.
91
+
92
+ 5. **Commit the initialization.** All generated and configured files in a single commit.
86
93
 
87
94
  ## Harness Integration
88
95
 
@@ -91,6 +98,8 @@ This creates the `.harness/graph/` directory and populates it with the project's
91
98
  - **`harness persona generate`** — Generate persona definitions based on project stack and team structure.
92
99
  - **`harness validate`** — Verify the full project configuration is valid and complete.
93
100
  - **`harness check-deps`** — Verify dependency constraints match the actual codebase (intermediate and above).
101
+ - **`harness-i18n-workflow configure` + `harness-i18n-workflow scaffold`** — Invoked during Phase 3 if the project will support multiple languages. Sets up i18n configuration and translation file structure.
102
+ - **Roadmap nudge** — After successful initialization, inform the user about `/harness:roadmap --create` for setting up project-level feature tracking. Informational only; does not create the roadmap.
94
103
 
95
104
  ## Success Criteria
96
105
 
@@ -102,6 +111,7 @@ This creates the `.harness/graph/` directory and populates it with the project's
102
111
  - Personas are configured if the project uses them
103
112
  - The adoption level matches what was agreed upon with the human
104
113
  - All generated files are committed in a single atomic commit
114
+ - i18n configuration is set if the human chose to enable it during init
105
115
 
106
116
  ## Examples
107
117
 
@@ -131,6 +141,10 @@ Edit AGENTS.md:
131
141
  - Add stack: TypeScript, Express, Vitest, PostgreSQL
132
142
  - Add conventions: "Use zod for validation, repository pattern for data access"
133
143
  - Add constraints: "No direct SQL queries outside repository layer"
144
+ - Ask: "Will this project support multiple languages?"
145
+ - Human: "Yes, Spanish and French."
146
+ - Run harness-i18n-workflow configure (source: en, targets: es, fr)
147
+ - Run harness-i18n-workflow scaffold (creates locales/ directory structure)
134
148
  ```
135
149
 
136
150
  **VALIDATE:**
@@ -32,6 +32,18 @@ When a knowledge graph exists at `.harness/graph/`, use graph queries for faster
32
32
 
33
33
  When a graph is available, it IS the source of truth for documentation coverage. Drift = stale or missing edges between code and doc nodes. Fall back to file-based commands if no graph is available.
34
34
 
35
+ ### Pipeline Context (when orchestrated)
36
+
37
+ When invoked by `harness-docs-pipeline`, check for a `pipeline` field in `.harness/handoff.json`:
38
+
39
+ - If `pipeline` field exists: read `DocPipelineContext` from it
40
+ - Use `pipeline.exclusions` to skip findings that were already addressed in the FIX phase
41
+ - Write `GapFinding[]` results back to `pipeline.gapFindings` in handoff.json
42
+ - This enables dedup across FIX and AUDIT phases
43
+ - If `pipeline` field does not exist: behave exactly as today (standalone mode)
44
+
45
+ No changes to the skill's interface or output format — the pipeline field is purely additive.
46
+
35
47
  ### Phase 2: Detect Gaps
36
48
 
37
49
  Categorize findings into four types:
@@ -25,6 +25,12 @@
25
25
  - `standard` -- warnings are visible, errors block (default behavior)
26
26
  - `permissive` -- all findings are informational (nothing blocks, but everything is reported)
27
27
 
28
+ 2.5. **Check for i18n skill overlap.** Read `harness.config.json` for `i18n.enabled`:
29
+
30
+ - If `i18n.enabled: true`, **defer** `lang` and `dir` attribute checks to `harness-i18n`. Do not scan for missing `lang` on `<html>` or missing `dir` on user-content containers -- those checks are covered by the i18n skill's scan phase with more context (locale-aware, RTL-aware).
31
+ - If `i18n.enabled` is false or absent, scan for `lang`/`dir` as normal (these remain part of the accessibility audit).
32
+ - This deduplication prevents the same finding from appearing in both the accessibility report and the i18n report.
33
+
28
34
  3. **Scan component files.** Search all files matching `.tsx`, `.jsx`, `.vue`, `.svelte`, `.html` for the following violations:
29
35
 
30
36
  **Images and media:**
@@ -176,6 +182,7 @@ This phase is optional. It applies fixes only for **mechanical issues** -- viola
176
182
  - **`DesignIngestor`** (`packages/graph/src/ingest/DesignIngestor.ts`) -- Provides token data used for contrast checking. The ingestor parses `tokens.json` so the accessibility scanner can compare code colors against declared tokens.
177
183
  - **`harness-impact-analysis`** -- When tokens change (palette update, new colors), impact analysis traces affected components. The accessibility skill uses this to determine which components need re-scanning.
178
184
  - **`harness-design-system`** -- Dependency. When contrast failures originate from token definitions (not component code), escalate to harness-design-system to fix at the source.
185
+ - **`harness-i18n` deduplication** -- When `i18n.enabled: true` in config, `lang` and `dir` attribute checks are deferred to the i18n skill. This prevents duplicate findings across the accessibility and i18n reports. When i18n is not enabled, these checks remain part of the accessibility scan.
179
186
 
180
187
  ## Success Criteria
181
188
 
@@ -97,7 +97,14 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
97
97
 
98
98
  5. **Load context.** Read `.harness/learnings.md` and `.harness/failures.md` (global, at `.harness/` root) if they exist. Note any relevant learnings or known dead ends for the current phase.
99
99
 
100
- 6. **Transition to ASSESS.**
100
+ 6. **Load roadmap context.** If `docs/roadmap.md` exists, read it to understand:
101
+ - Current project priorities (which features are `in-progress`)
102
+ - Blockers that may affect the upcoming phases
103
+ - Overall project status and milestone progress
104
+
105
+ This provides the autopilot with project-level context beyond the individual spec being executed. If the roadmap does not exist, skip this step — the autopilot operates normally without it.
106
+
107
+ 7. **Transition to ASSESS.**
101
108
 
102
109
  ---
103
110
 
@@ -374,6 +381,7 @@ INIT → ASSESS → PLAN → APPROVE_PLAN → EXECUTE → VERIFY → REVIEW →
374
381
  - **State file** — `.harness/sessions/<slug>/autopilot-state.json` tracks the orchestration state machine. `.harness/sessions/<slug>/state.json` tracks task-level execution state (managed by harness-execution). The slug is derived from the spec path during INIT.
375
382
  - **Handoff** — `.harness/sessions/<slug>/handoff.json` is written by each delegated skill and read by the next. Autopilot writes a final handoff on DONE.
376
383
  - **Learnings** — `.harness/learnings.md` (global) is appended by both delegated skills and autopilot itself.
384
+ - **Roadmap context** — During INIT, reads `docs/roadmap.md` (if present) for project-level priorities, blockers, and milestone status. Provides broader context for phase execution decisions.
377
385
 
378
386
  ## Success Criteria
379
387
 
@@ -0,0 +1,226 @@
1
+ # Harness Codebase Cleanup
2
+
3
+ > Orchestrate dead code removal and architecture violation fixes with a shared convergence loop. Catches cross-concern cascades that individual skills miss.
4
+
5
+ ## When to Use
6
+
7
+ - After a major refactoring or feature removal when both dead code and architecture violations are likely
8
+ - As a periodic comprehensive codebase hygiene task
9
+ - When `cleanup-dead-code` or `enforce-architecture` individually are not catching cascading issues
10
+ - When you want hotspot-aware safety classification
11
+ - NOT for quick single-concern checks -- use `cleanup-dead-code` or `enforce-architecture` directly
12
+ - NOT when tests are failing -- fix tests first
13
+ - NOT during active feature development
14
+
15
+ ## Flags
16
+
17
+ | Flag | Effect |
18
+ | --------------------- | ----------------------------------------------------------------- |
19
+ | `--fix` | Enable convergence-based auto-fix (default: detect + report only) |
20
+ | `--dead-code-only` | Skip architecture checks |
21
+ | `--architecture-only` | Skip dead code checks |
22
+ | `--dry-run` | Show what would be fixed without applying |
23
+ | `--ci` | Non-interactive: apply safe fixes only, report everything else |
24
+
25
+ ## Process
26
+
27
+ ### Phase 1: CONTEXT -- Build Hotspot Map
28
+
29
+ 1. **Run hotspot detection** via `harness skill run harness-hotspot-detector` or equivalent git log analysis:
30
+ ```bash
31
+ git log --format=format: --name-only --since="6 months ago" | sort | uniq -c | sort -rn | head -50
32
+ ```
33
+ 2. **Build churn map.** Parse output into a `file -> commit count` mapping.
34
+ 3. **Compute top 10% threshold.** Sort all files by commit count. The file at the 90th percentile defines the threshold. Files above this threshold are "high churn."
35
+ 4. **Store as HotspotContext** for use in Phase 3 (CLASSIFY).
36
+
37
+ ### Phase 2: DETECT -- Run Both Concerns in Parallel
38
+
39
+ 1. **Dead code detection** (skip if `--architecture-only`):
40
+ - Run `harness cleanup --type dead-code --json`
41
+ - Or use the `detect_entropy` MCP tool with `type: 'dead-code'`
42
+ - Captures: dead files, dead exports, unused imports, dead internals, commented-out code blocks, orphaned dependencies
43
+
44
+ 2. **Architecture detection** (skip if `--dead-code-only`):
45
+ - Run `harness check-deps --json`
46
+ - Captures: layer violations, forbidden imports, circular dependencies, import ordering issues
47
+
48
+ 3. **Merge findings.** Convert all raw findings into `CleanupFinding` objects using `classifyFinding()`. This normalizes both concerns into a shared schema.
49
+
50
+ ### Phase 3: CLASSIFY -- Safety Classification and Dedup
51
+
52
+ 1. **Apply safety classification.** Each `CleanupFinding` already has a safety level from `classifyFinding()`. Review the classification rules:
53
+
54
+ **Dead code safety:**
55
+
56
+ | Finding | Safety | Condition |
57
+ | ------------------------- | ------------- | ------------------------------------------- |
58
+ | Dead files | Safe | Not entry point, no side effects |
59
+ | Unused imports | Safe | Zero references |
60
+ | Dead exports (non-public) | Safe | Zero importers, not in package entry point |
61
+ | Dead exports (public API) | Unsafe | In package entry point or published package |
62
+ | Commented-out code | Safe | Always (code is in git history) |
63
+ | Orphaned npm deps | Probably safe | Needs install + test verification |
64
+ | Dead internals | Unsafe | Cannot reliably determine all callers |
65
+
66
+ **Architecture safety:**
67
+
68
+ | Violation | Safety | Condition |
69
+ | ----------------------------------- | ------------- | -------------------------- |
70
+ | Import ordering | Safe | Mechanical reorder |
71
+ | Forbidden import (with alternative) | Probably safe | 1:1 replacement configured |
72
+ | Forbidden import (no alternative) | Unsafe | Requires restructuring |
73
+ | Design token (unambiguous) | Probably safe | Single token match |
74
+ | Design token (ambiguous) | Unsafe | Multiple candidates |
75
+ | Upward dependency | Unsafe | Always |
76
+ | Skip-layer dependency | Unsafe | Always |
77
+ | Circular dependency | Unsafe | Always |
78
+
79
+ 2. **Apply hotspot downgrade.** For each finding, check if the file is in the top 10% by churn (from Phase 1 HotspotContext). If so, downgrade `safe` to `probably-safe`. Do not downgrade `unsafe` findings.
80
+
81
+ 3. **Cross-concern dedup.** Call `deduplicateFindings()` to merge overlapping findings:
82
+ - A dead import from a forbidden layer = one finding (dead-code concern, noting architecture overlap)
83
+ - A dead file that has architecture violations = one finding (dead-code, noting violations resolved by deletion)
84
+
85
+ ### Phase 4: FIX -- Convergence Loop
86
+
87
+ **Only runs when `--fix` flag is set.** Without `--fix`, skip to Phase 5 (REPORT).
88
+
89
+ ```
90
+ findings = classified findings from Phase 3
91
+ previousCount = findings.length
92
+ iteration = 0
93
+
94
+ while iteration < 5:
95
+ iteration++
96
+
97
+ # Batch 1: Apply safe fixes silently
98
+ safeFixes = findings.filter(f => f.safety === 'safe')
99
+ apply(safeFixes)
100
+
101
+ # Batch 2: Present probably-safe fixes
102
+ if --ci mode:
103
+ skip probably-safe fixes (report only)
104
+ else:
105
+ probablySafeFixes = findings.filter(f => f.safety === 'probably-safe')
106
+ presentAsDiffs(probablySafeFixes)
107
+ apply(approved fixes)
108
+
109
+ # Verify: lint + typecheck + test
110
+ verifyResult = run("pnpm lint && pnpm tsc --noEmit && pnpm test")
111
+
112
+ if verifyResult.failed:
113
+ revertBatch()
114
+ reclassify failed fixes as unsafe
115
+ continue
116
+
117
+ # Re-detect both concerns
118
+ newFindings = runDetection() # Phase 2 again
119
+ newFindings = classify(newFindings) # Phase 3 again
120
+
121
+ if newFindings.length >= previousCount:
122
+ break # No progress, stop
123
+
124
+ previousCount = newFindings.length
125
+ findings = newFindings
126
+ ```
127
+
128
+ **Verification gate:** Every fix batch must pass lint + typecheck + test. If verification fails:
129
+
130
+ 1. Revert the entire batch (use git: `git checkout -- .`)
131
+ 2. Reclassify all findings in the batch as `unsafe`
132
+ 3. Continue the loop with remaining findings
133
+
134
+ **Cross-concern cascade examples:**
135
+
136
+ - Dead import from forbidden layer: removing the dead import also resolves the architecture violation. Single fix, both resolved.
137
+ - Architecture fix creates dead code: replacing a forbidden import makes the old module's export dead. Next detect cycle catches it.
138
+ - Dead file resolves multiple violations: deleting a dead file that imports from wrong layers resolves those violations too.
139
+
140
+ ### Phase 5: REPORT -- Actionable Output
141
+
142
+ Generate a structured report with two sections:
143
+
144
+ **1. Fixes Applied:**
145
+ For each fix that was applied:
146
+
147
+ - File and line
148
+ - What was fixed (finding type and description)
149
+ - What action was taken (delete, replace, reorder)
150
+ - Verification status (pass/fail)
151
+
152
+ **2. Remaining Findings (requires human action):**
153
+ For each unsafe finding that was not auto-fixed:
154
+
155
+ - **What is wrong:** The finding type, file, line, and description
156
+ - **Why it cannot be auto-fixed:** The safety reason and classification logic
157
+ - **Suggested approach:** Concrete next steps for manual resolution
158
+
159
+ Example report output:
160
+
161
+ ```
162
+ === HARNESS CODEBASE CLEANUP REPORT ===
163
+
164
+ Fixes applied: 12
165
+ - 5 unused imports removed (safe)
166
+ - 3 dead exports de-exported (safe)
167
+ - 2 commented-out code blocks deleted (safe)
168
+ - 1 forbidden import replaced (probably-safe, approved)
169
+ - 1 orphaned dependency removed (probably-safe, approved)
170
+
171
+ Convergence: 3 iterations, 12 → 8 → 3 → 3 (stopped)
172
+
173
+ Remaining findings: 3 (require human action)
174
+
175
+ 1. UNSAFE: Circular dependency
176
+ File: src/services/order-service.ts <-> src/services/inventory-service.ts
177
+ Why: Circular dependencies require structural refactoring
178
+ Suggested: Extract shared logic into src/services/stock-calculator.ts
179
+
180
+ 2. UNSAFE: Dead internal function
181
+ File: src/utils/legacy.ts:45 — processLegacyFormat()
182
+ Why: Cannot reliably determine all callers (possible dynamic usage)
183
+ Suggested: Search for string references, check config files, then delete if confirmed unused
184
+
185
+ 3. UNSAFE: Public API dead export
186
+ File: packages/core/src/index.ts — legacyHelper
187
+ Why: Export is in package entry point; external consumers may depend on it
188
+ Suggested: Deprecate with @deprecated JSDoc tag, remove in next major version
189
+ ```
190
+
191
+ ## Examples
192
+
193
+ ### Example: Post-Refactoring Cleanup
194
+
195
+ After removing the `legacy-auth` module:
196
+
197
+ 1. **Phase 1 (CONTEXT):** Hotspot analysis shows `src/services/auth.ts` has 42 commits (top 5%).
198
+ 2. **Phase 2 (DETECT):** Dead code detects 3 dead exports in `src/utils/token.ts` (were only used by legacy-auth). Architecture detects 1 forbidden import in `src/services/session.ts` (still importing from removed module's location).
199
+ 3. **Phase 3 (CLASSIFY):** Dead exports classified as `safe` but downgraded to `probably-safe` because `token.ts` is in a high-churn file. Forbidden import classified as `unsafe` (no alternative configured).
200
+ 4. **Phase 4 (FIX):** First iteration removes 3 dead exports (approved as probably-safe). Re-detect finds `token.ts` now has zero exports and becomes a dead file. Second iteration deletes the dead file. Convergence stops -- the forbidden import requires manual restructuring.
201
+ 5. **Phase 5 (REPORT):** 4 fixes applied (3 dead exports + 1 dead file), 1 remaining finding (forbidden import requiring restructuring).
202
+
203
+ ## Harness Integration
204
+
205
+ - **`harness cleanup --type dead-code --json`** -- Dead code detection input
206
+ - **`harness check-deps --json`** -- Architecture violation detection input
207
+ - **`harness skill run harness-hotspot-detector`** -- Hotspot context for safety classification
208
+ - **`apply_fixes` MCP tool** -- Applies safe fixes via the MCP server
209
+ - **`harness validate`** -- Final validation after all fixes
210
+ - **`harness check-deps`** -- Final architecture check after all fixes
211
+
212
+ ## Success Criteria
213
+
214
+ - All safe fixes are applied without test failures
215
+ - Probably-safe fixes are presented as diffs for approval (or skipped in CI mode)
216
+ - Unsafe findings are never auto-fixed
217
+ - Convergence loop catches cross-concern cascades
218
+ - Report includes actionable guidance for every remaining finding
219
+ - `harness validate` passes after cleanup
220
+
221
+ ## Escalation
222
+
223
+ - **When convergence loop does not converge after 5 iterations:** The codebase has deeply tangled issues. Stop and report all remaining findings. Consider breaking the cleanup into focused sessions.
224
+ - **When a safe fix causes test failures:** The classification was wrong. Revert, reclassify as unsafe, and investigate the hidden dependency. Document the false positive for future improvement.
225
+ - **When the hotspot detector is unavailable:** Skip the hotspot downgrade. All safety classifications use their base level without churn context.
226
+ - **When dead code and architecture fixes conflict:** The convergence loop handles this naturally. If removing dead code creates an architecture issue (rare), the next detection cycle catches it.
@@ -0,0 +1,64 @@
1
+ name: harness-codebase-cleanup
2
+ version: "1.0.0"
3
+ description: Orchestrate dead code removal and architecture violation fixes with shared convergence loop
4
+ cognitive_mode: systematic-orchestrator
5
+ triggers:
6
+ - manual
7
+ platforms:
8
+ - claude-code
9
+ - gemini-cli
10
+ tools:
11
+ - Bash
12
+ - Read
13
+ - Glob
14
+ - Grep
15
+ cli:
16
+ command: harness skill run harness-codebase-cleanup
17
+ args:
18
+ - name: path
19
+ description: Project root path
20
+ required: false
21
+ - name: fix
22
+ description: Enable convergence-based auto-fix (default detect+report only)
23
+ required: false
24
+ - name: dead-code-only
25
+ description: Skip architecture checks
26
+ required: false
27
+ - name: architecture-only
28
+ description: Skip dead code checks
29
+ required: false
30
+ - name: dry-run
31
+ description: Show what would be fixed without applying
32
+ required: false
33
+ - name: ci
34
+ description: Non-interactive mode (safe fixes only, report everything else)
35
+ required: false
36
+ mcp:
37
+ tool: run_skill
38
+ input:
39
+ skill: harness-codebase-cleanup
40
+ path: string
41
+ type: flexible
42
+ phases:
43
+ - name: context
44
+ description: Run hotspot detection, build churn map
45
+ required: true
46
+ - name: detect
47
+ description: Run dead code and architecture detection in parallel
48
+ required: true
49
+ - name: classify
50
+ description: Classify findings, apply hotspot downgrade, cross-concern dedup
51
+ required: true
52
+ - name: fix
53
+ description: Convergence loop - apply safe fixes, verify, re-detect
54
+ required: false
55
+ - name: report
56
+ description: Generate actionable report of fixes applied and remaining findings
57
+ required: true
58
+ state:
59
+ persistent: false
60
+ files: []
61
+ depends_on:
62
+ - cleanup-dead-code
63
+ - enforce-architecture
64
+ - harness-hotspot-detector