@harness-engineering/cli 1.7.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) 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 +11 -3
  11. package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +81 -11
  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 +59 -5
  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 +561 -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/add-harness-component/SKILL.md +192 -0
  51. package/dist/agents/skills/gemini-cli/add-harness-component/skill.yaml +32 -0
  52. package/dist/agents/skills/gemini-cli/align-documentation/SKILL.md +213 -0
  53. package/dist/agents/skills/gemini-cli/align-documentation/skill.yaml +31 -0
  54. package/dist/agents/skills/gemini-cli/check-mechanical-constraints/SKILL.md +191 -0
  55. package/dist/agents/skills/gemini-cli/check-mechanical-constraints/skill.yaml +32 -0
  56. package/dist/agents/skills/gemini-cli/cleanup-dead-code/SKILL.md +245 -0
  57. package/dist/agents/skills/gemini-cli/cleanup-dead-code/skill.yaml +33 -0
  58. package/dist/agents/skills/gemini-cli/detect-doc-drift/SKILL.md +179 -0
  59. package/dist/agents/skills/gemini-cli/detect-doc-drift/skill.yaml +30 -0
  60. package/dist/agents/skills/gemini-cli/enforce-architecture/SKILL.md +240 -0
  61. package/dist/agents/skills/gemini-cli/enforce-architecture/skill.yaml +34 -0
  62. package/dist/agents/skills/gemini-cli/harness-accessibility/SKILL.md +7 -0
  63. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/SKILL.md +397 -0
  64. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/skill.yaml +48 -0
  65. package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +11 -3
  66. package/dist/agents/skills/gemini-cli/harness-brainstorming/SKILL.md +317 -0
  67. package/dist/agents/skills/gemini-cli/harness-brainstorming/skill.yaml +49 -0
  68. package/dist/agents/skills/gemini-cli/harness-code-review/SKILL.md +681 -0
  69. package/dist/agents/skills/gemini-cli/harness-code-review/skill.yaml +45 -0
  70. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/SKILL.md +226 -0
  71. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/skill.yaml +64 -0
  72. package/dist/agents/skills/gemini-cli/harness-debugging/SKILL.md +366 -0
  73. package/dist/agents/skills/gemini-cli/harness-debugging/skill.yaml +47 -0
  74. package/dist/agents/skills/gemini-cli/harness-dependency-health/SKILL.md +35 -6
  75. package/dist/agents/skills/gemini-cli/harness-diagnostics/SKILL.md +318 -0
  76. package/dist/agents/skills/gemini-cli/harness-diagnostics/skill.yaml +50 -0
  77. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/SKILL.md +460 -0
  78. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/skill.yaml +69 -0
  79. package/dist/agents/skills/gemini-cli/harness-execution/SKILL.md +382 -0
  80. package/dist/agents/skills/gemini-cli/harness-execution/skill.yaml +51 -0
  81. package/dist/agents/skills/gemini-cli/harness-git-workflow/SKILL.md +268 -0
  82. package/dist/agents/skills/gemini-cli/harness-git-workflow/skill.yaml +31 -0
  83. package/dist/agents/skills/gemini-cli/harness-hotspot-detector/SKILL.md +32 -6
  84. package/dist/agents/skills/gemini-cli/harness-i18n/SKILL.md +484 -0
  85. package/dist/agents/skills/gemini-cli/harness-i18n/skill.yaml +54 -0
  86. package/dist/agents/skills/gemini-cli/harness-i18n-process/SKILL.md +388 -0
  87. package/dist/agents/skills/gemini-cli/harness-i18n-process/skill.yaml +43 -0
  88. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/SKILL.md +512 -0
  89. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/skill.yaml +53 -0
  90. package/dist/agents/skills/gemini-cli/harness-impact-analysis/SKILL.md +35 -6
  91. package/dist/agents/skills/gemini-cli/harness-integrity/SKILL.md +167 -0
  92. package/dist/agents/skills/gemini-cli/harness-integrity/skill.yaml +47 -0
  93. package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/SKILL.md +46 -5
  94. package/dist/agents/skills/gemini-cli/harness-onboarding/SKILL.md +288 -0
  95. package/dist/agents/skills/gemini-cli/harness-onboarding/skill.yaml +30 -0
  96. package/dist/agents/skills/gemini-cli/harness-parallel-agents/SKILL.md +171 -0
  97. package/dist/agents/skills/gemini-cli/harness-parallel-agents/skill.yaml +33 -0
  98. package/dist/agents/skills/gemini-cli/harness-perf/SKILL.md +37 -8
  99. package/dist/agents/skills/gemini-cli/harness-perf/skill.yaml +3 -0
  100. package/dist/agents/skills/gemini-cli/harness-perf-tdd/SKILL.md +17 -4
  101. package/dist/agents/skills/gemini-cli/harness-planning/SKILL.md +389 -0
  102. package/dist/agents/skills/gemini-cli/harness-planning/skill.yaml +49 -0
  103. package/dist/agents/skills/gemini-cli/harness-pre-commit-review/SKILL.md +262 -0
  104. package/dist/agents/skills/gemini-cli/harness-pre-commit-review/skill.yaml +33 -0
  105. package/dist/agents/skills/gemini-cli/harness-refactoring/SKILL.md +169 -0
  106. package/dist/agents/skills/gemini-cli/harness-refactoring/skill.yaml +33 -0
  107. package/dist/agents/skills/gemini-cli/harness-release-readiness/SKILL.md +16 -0
  108. package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +561 -0
  109. package/dist/agents/skills/gemini-cli/harness-roadmap/skill.yaml +43 -0
  110. package/dist/agents/skills/gemini-cli/harness-security-review/skill.yaml +8 -6
  111. package/dist/agents/skills/gemini-cli/harness-skill-authoring/SKILL.md +292 -0
  112. package/dist/agents/skills/gemini-cli/harness-skill-authoring/skill.yaml +32 -0
  113. package/dist/agents/skills/gemini-cli/harness-soundness-review/SKILL.md +1267 -0
  114. package/dist/agents/skills/gemini-cli/harness-soundness-review/skill.yaml +48 -0
  115. package/dist/agents/skills/gemini-cli/harness-state-management/SKILL.md +309 -0
  116. package/dist/agents/skills/gemini-cli/harness-state-management/skill.yaml +32 -0
  117. package/dist/agents/skills/gemini-cli/harness-tdd/SKILL.md +177 -0
  118. package/dist/agents/skills/gemini-cli/harness-tdd/skill.yaml +48 -0
  119. package/dist/agents/skills/gemini-cli/harness-test-advisor/SKILL.md +35 -6
  120. package/dist/agents/skills/gemini-cli/harness-verification/SKILL.md +328 -0
  121. package/dist/agents/skills/gemini-cli/harness-verification/skill.yaml +42 -0
  122. package/dist/agents/skills/gemini-cli/harness-verify/SKILL.md +159 -0
  123. package/dist/agents/skills/gemini-cli/harness-verify/skill.yaml +40 -0
  124. package/dist/agents/skills/gemini-cli/initialize-harness-project/SKILL.md +224 -0
  125. package/dist/agents/skills/gemini-cli/initialize-harness-project/skill.yaml +31 -0
  126. package/dist/agents/skills/gemini-cli/validate-context-engineering/SKILL.md +150 -0
  127. package/dist/agents/skills/gemini-cli/validate-context-engineering/skill.yaml +31 -0
  128. package/dist/agents/skills/shared/i18n-knowledge/accessibility/intersection.yaml +142 -0
  129. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/encoding.yaml +67 -0
  130. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/formatting.yaml +106 -0
  131. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/layout.yaml +80 -0
  132. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/pluralization.yaml +80 -0
  133. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/string-handling.yaml +106 -0
  134. package/dist/agents/skills/shared/i18n-knowledge/frameworks/android-resources.yaml +47 -0
  135. package/dist/agents/skills/shared/i18n-knowledge/frameworks/apple-strings.yaml +47 -0
  136. package/dist/agents/skills/shared/i18n-knowledge/frameworks/backend-patterns.yaml +50 -0
  137. package/dist/agents/skills/shared/i18n-knowledge/frameworks/flutter-intl.yaml +47 -0
  138. package/dist/agents/skills/shared/i18n-knowledge/frameworks/i18next.yaml +47 -0
  139. package/dist/agents/skills/shared/i18n-knowledge/frameworks/react-intl.yaml +47 -0
  140. package/dist/agents/skills/shared/i18n-knowledge/frameworks/vue-i18n.yaml +47 -0
  141. package/dist/agents/skills/shared/i18n-knowledge/industries/ecommerce.yaml +66 -0
  142. package/dist/agents/skills/shared/i18n-knowledge/industries/fintech.yaml +66 -0
  143. package/dist/agents/skills/shared/i18n-knowledge/industries/gaming.yaml +69 -0
  144. package/dist/agents/skills/shared/i18n-knowledge/industries/healthcare.yaml +66 -0
  145. package/dist/agents/skills/shared/i18n-knowledge/industries/legal.yaml +66 -0
  146. package/dist/agents/skills/shared/i18n-knowledge/locales/ar.yaml +41 -0
  147. package/dist/agents/skills/shared/i18n-knowledge/locales/de.yaml +35 -0
  148. package/dist/agents/skills/shared/i18n-knowledge/locales/en.yaml +32 -0
  149. package/dist/agents/skills/shared/i18n-knowledge/locales/es.yaml +35 -0
  150. package/dist/agents/skills/shared/i18n-knowledge/locales/fi.yaml +35 -0
  151. package/dist/agents/skills/shared/i18n-knowledge/locales/fr.yaml +35 -0
  152. package/dist/agents/skills/shared/i18n-knowledge/locales/he.yaml +41 -0
  153. package/dist/agents/skills/shared/i18n-knowledge/locales/hi.yaml +35 -0
  154. package/dist/agents/skills/shared/i18n-knowledge/locales/it.yaml +32 -0
  155. package/dist/agents/skills/shared/i18n-knowledge/locales/ja.yaml +38 -0
  156. package/dist/agents/skills/shared/i18n-knowledge/locales/ko.yaml +38 -0
  157. package/dist/agents/skills/shared/i18n-knowledge/locales/nl.yaml +32 -0
  158. package/dist/agents/skills/shared/i18n-knowledge/locales/pl.yaml +35 -0
  159. package/dist/agents/skills/shared/i18n-knowledge/locales/pt.yaml +32 -0
  160. package/dist/agents/skills/shared/i18n-knowledge/locales/ru.yaml +35 -0
  161. package/dist/agents/skills/shared/i18n-knowledge/locales/sv.yaml +32 -0
  162. package/dist/agents/skills/shared/i18n-knowledge/locales/th.yaml +35 -0
  163. package/dist/agents/skills/shared/i18n-knowledge/locales/tr.yaml +35 -0
  164. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hans.yaml +38 -0
  165. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hant.yaml +35 -0
  166. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/i18next-mcp.yaml +56 -0
  167. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lingo-dev.yaml +56 -0
  168. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lokalise.yaml +60 -0
  169. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/tolgee.yaml +60 -0
  170. package/dist/agents/skills/shared/i18n-knowledge/testing/locale-testing.yaml +107 -0
  171. package/dist/agents/skills/shared/i18n-knowledge/testing/pseudo-localization.yaml +86 -0
  172. package/dist/bin/harness.js +64 -4
  173. package/dist/{chunk-GA6GN5J2.js → chunk-E2RTDBMG.js} +2263 -41
  174. package/dist/{chunk-FFIX3QVG.js → chunk-KJANDVVC.js} +141 -49
  175. package/dist/{chunk-4WUGOJQ7.js → chunk-RT2LYQHF.js} +1 -1
  176. package/dist/{dist-C4J67MPP.js → dist-CCM3L3UE.js} +95 -1
  177. package/dist/{dist-N4D4QWFV.js → dist-K6KTTN3I.js} +4 -4
  178. package/dist/index.d.ts +187 -7
  179. package/dist/index.js +7 -3
  180. package/dist/validate-cross-check-ZGKFQY57.js +7 -0
  181. package/package.json +9 -9
  182. package/dist/agents/skills/node_modules/.bin/glob +0 -17
  183. package/dist/agents/skills/node_modules/.bin/vitest +0 -17
  184. package/dist/agents/skills/node_modules/.bin/yaml +0 -17
  185. package/dist/templates/advanced/docs/specs/.gitkeep +0 -0
  186. package/dist/templates/intermediate/docs/specs/.gitkeep +0 -0
  187. package/dist/validate-cross-check-WGXQ7K62.js +0 -7
@@ -0,0 +1,318 @@
1
+ # Harness Diagnostics
2
+
3
+ > Cognitive mode: **diagnostic-investigator**. Classify errors into taxonomy categories and route to deterministic resolution strategies. Evidence first, classification second, action third.
4
+
5
+ ## When to Use
6
+
7
+ - When an error occurs and the root cause category is unclear
8
+ - When a bug fix attempt failed and you need a structured re-approach
9
+ - When `on_bug_fix` triggers fire and the error does not match a known pattern
10
+ - When you need to decide whether to fix locally or escalate
11
+ - NOT for obvious typos or syntax errors with clear fixes (just fix them)
12
+ - NOT for feature development (use harness-tdd instead)
13
+ - NOT for deep multi-phase debugging (use harness-debugging instead — this skill classifies and routes)
14
+
15
+ ## Error Taxonomy
16
+
17
+ Every error falls into one of 7 categories. Each category has distinct signals and a distinct resolution strategy. Misclassification leads to wasted effort — a Logic error treated as Syntax will never be fixed by reading the compiler output.
18
+
19
+ ### Category 1: Syntax/Type
20
+
21
+ **Signals:** Compilation failures, type errors, parse errors, import resolution failures, "cannot find name", "expected X but got Y" from the compiler or type checker.
22
+
23
+ **Resolution strategy:** Read the error message. It tells you exactly what is wrong and where. Fix mechanically — match the type, fix the import, correct the syntax. No investigation needed. Run the type checker to confirm.
24
+
25
+ **Time budget:** Under 5 minutes. If it takes longer, you have misclassified.
26
+
27
+ ### Category 2: Logic
28
+
29
+ **Signals:** Tests fail with wrong output values, unexpected behavior at runtime, "expected X but received Y" from test assertions, correct types but incorrect results.
30
+
31
+ **Resolution strategy:** Write a failing test FIRST that isolates the incorrect behavior. Then trace the data flow from input to incorrect output. Find the exact line where the actual value diverges from the expected value. Fix that line. Run the test to confirm.
32
+
33
+ **Time budget:** 5-30 minutes. If it takes longer, consider reclassifying as Design.
34
+
35
+ ### Category 3: Design
36
+
37
+ **Signals:** Multiple related failures, fixes that break other things, circular dependencies, "everything is tangled", you cannot write a clean test because the code is not testable, the fix requires changing many files.
38
+
39
+ **Resolution strategy:** STOP. Do not attempt to fix locally. This is an architectural issue that requires human judgment. Document the symptoms, the attempted fixes, and the structural problem. Escalate to the human architect with a clear summary and 2-3 options.
40
+
41
+ **Time budget:** 15 minutes maximum for classification and documentation. Do not spend time attempting fixes.
42
+
43
+ ### Category 4: Performance
44
+
45
+ **Signals:** Slow responses, timeouts, high memory usage, "heap out of memory", operations that used to be fast are now slow, N+1 query patterns.
46
+
47
+ **Resolution strategy:** Profile FIRST. Do not guess at the bottleneck. Use the appropriate profiling tool for the runtime (browser devtools, `node --prof`, `py-spy`, database `EXPLAIN`). Identify the actual hotspot. Optimize only that hotspot. Measure again to confirm improvement.
48
+
49
+ **Time budget:** 15-60 minutes. Profiling takes time but prevents optimizing the wrong thing.
50
+
51
+ ### Category 5: Security
52
+
53
+ **Signals:** Vulnerability scanner findings, injection possibilities, authentication/authorization failures, exposed secrets, CORS issues, unsafe deserialization.
54
+
55
+ **Resolution strategy:** Check OWASP Top 10 for the vulnerability class. Apply the minimal fix that closes the vulnerability without changing unrelated behavior. Do not refactor surrounding code during a security fix — minimize the blast radius. Verify with a test that the vulnerability is closed.
56
+
57
+ **Time budget:** Variable, but the fix itself should be minimal. If the fix requires large changes, reclassify as Design and escalate.
58
+
59
+ ### Category 6: Environment
60
+
61
+ **Signals:** "Module not found" at runtime (not compile time), version mismatch errors, "connection refused", works on one machine but not another, Docker/CI failures that pass locally, missing environment variables.
62
+
63
+ **Resolution strategy:** Check versions first — runtime, dependencies, OS. Compare the failing environment to a working environment. Look at: Node/Python/Java version, dependency lock file freshness, environment variables, file permissions, network connectivity. Fix the environment, not the code.
64
+
65
+ **Time budget:** 5-30 minutes. Environment issues are usually fast once you compare configurations.
66
+
67
+ ### Category 7: Flaky
68
+
69
+ **Signals:** Test passes sometimes and fails sometimes, "works on retry", timing-dependent failures, failures that disappear when you add logging, race conditions, order-dependent test results.
70
+
71
+ **Resolution strategy:** Isolate the timing dependency. Run the failing test in isolation — does it still flake? Run it 20 times in a loop — what is the failure rate? Look for: shared mutable state between tests, missing `await` on async operations, time-dependent assertions (`setTimeout`, `Date.now()`), external service dependencies without mocking. Fix the non-determinism, do not add retries.
72
+
73
+ **Time budget:** 15-60 minutes. Flaky tests are deceptively hard. If you cannot isolate the timing dependency in 60 minutes, escalate.
74
+
75
+ ## Process
76
+
77
+ ### Phase 1: CLASSIFY — Collect Evidence and Categorize
78
+
79
+ **This phase must complete before any fix is attempted.**
80
+
81
+ #### Step 1: Run Deterministic Checks (Baseline)
82
+
83
+ Capture the current state before any changes:
84
+
85
+ ```bash
86
+ # Run type checker (adapt to project language)
87
+ npx tsc --noEmit 2>&1 | tail -50
88
+
89
+ # Run test suite
90
+ npm test 2>&1 | tail -100
91
+
92
+ # Record results
93
+ echo "Baseline captured at $(date)" >> .harness/diagnostics/current.md
94
+ ```
95
+
96
+ Record exact counts: how many type errors, how many test failures, which tests fail.
97
+
98
+ #### Step 2: Read the Complete Error
99
+
100
+ Read the ENTIRE error output. Not the first line. Not the summary. The complete message including:
101
+
102
+ - Error type/code
103
+ - Stack trace (every frame)
104
+ - Warnings that preceded the error
105
+ - Context about what operation was being attempted
106
+
107
+ #### Step 3: Match Signals to Category
108
+
109
+ Compare the error signals against the 7 categories above. Ask:
110
+
111
+ - Is this a compile-time or runtime error? (Compile-time -> likely Syntax/Type)
112
+ - Is the code syntactically valid but producing wrong results? (-> Logic)
113
+ - Does the error involve multiple components or layers? (-> Design)
114
+ - Is it about speed or resource consumption? (-> Performance)
115
+ - Is it about unauthorized access or unsafe data handling? (-> Security)
116
+ - Does it work in one environment but not another? (-> Environment)
117
+ - Does it fail intermittently? (-> Flaky)
118
+
119
+ #### Step 4: State the Classification Explicitly
120
+
121
+ ```
122
+ CLASSIFICATION: [Category Name]
123
+ CONFIDENCE: [High/Medium/Low]
124
+ SIGNALS: [List the specific signals that led to this classification]
125
+ ALTERNATIVE: [If confidence is Medium or Low, what other category could it be?]
126
+ ```
127
+
128
+ **Gate: Classification must be explicit and written down before proceeding. "I think it's a type error" is not sufficient. State the category, confidence, and signals.**
129
+
130
+ ---
131
+
132
+ ### Phase 2: ROUTE — Apply Category-Specific Strategy
133
+
134
+ Follow the resolution strategy for the classified category exactly. Do not mix strategies. Each category has a specific approach because each category has a specific failure mode.
135
+
136
+ If the category is **Design**, STOP HERE. Do not proceed to Phase 3. Document and escalate.
137
+
138
+ For all other categories, execute the resolution strategy as described in the taxonomy above.
139
+
140
+ ---
141
+
142
+ ### Phase 3: RESOLVE — Execute and Verify
143
+
144
+ #### Step 1: Apply the Fix
145
+
146
+ Implement the fix according to the resolution strategy for the classified category.
147
+
148
+ #### Step 2: Run Deterministic Checks (Verification)
149
+
150
+ Run the same checks from Phase 1 Step 1:
151
+
152
+ ```bash
153
+ # Run type checker
154
+ npx tsc --noEmit 2>&1 | tail -50
155
+
156
+ # Run test suite
157
+ npm test 2>&1 | tail -100
158
+ ```
159
+
160
+ Compare results to the baseline:
161
+
162
+ - Type errors: must be equal or fewer than baseline
163
+ - Test failures: the target failure must be resolved, no new failures introduced
164
+ - If new failures appeared, the fix is wrong. Revert and re-examine.
165
+
166
+ #### Step 3: Confirm Resolution
167
+
168
+ The error is resolved when:
169
+
170
+ 1. The original error no longer occurs
171
+ 2. No new errors were introduced
172
+ 3. The type checker count is equal or better than baseline
173
+ 4. The test suite count is equal or better than baseline
174
+
175
+ ---
176
+
177
+ ### Phase 4: RECORD — Capture Anti-Patterns (Optional)
178
+
179
+ This phase triggers only when the initial classification was wrong or the first fix attempt failed.
180
+
181
+ #### Step 1: Document What Went Wrong
182
+
183
+ ```markdown
184
+ # Diagnostic Record: <brief description>
185
+
186
+ Date: <timestamp>
187
+ Initial Classification: <what you thought it was>
188
+ Actual Classification: <what it turned out to be>
189
+ Misclassification Reason: <why the signals were misleading>
190
+ Resolution: <what actually fixed it>
191
+ Anti-Pattern: <what to watch for next time>
192
+ ```
193
+
194
+ #### Step 2: Save to Anti-Pattern Log
195
+
196
+ ```bash
197
+ # Append to diagnostics log
198
+ cat >> .harness/diagnostics/anti-patterns.md << 'ENTRY'
199
+ <the record from Step 1>
200
+ ENTRY
201
+ ```
202
+
203
+ This log accumulates over time and helps improve future classifications.
204
+
205
+ ## Harness Integration
206
+
207
+ - Follows Principle 7 — runs deterministic checks (typecheck, tests) before and after LLM reasoning
208
+ - Builds on harness-debugging but adds structured classification layer
209
+ - Writes to `.harness/anti-patterns.md` per Group B3 convention
210
+ - Category 3 (Design) escalates to human architect per human-architect model
211
+
212
+ ## Success Criteria
213
+
214
+ - [ ] Error is classified into exactly one of the 7 categories
215
+ - [ ] Resolution strategy matches the category playbook
216
+ - [ ] Post-execution checks pass (typecheck + tests)
217
+ - [ ] If initial approach failed, it is recorded in anti-pattern log
218
+
219
+ ## Gates
220
+
221
+ - **Classification must be explicit.** You must write down the category, confidence level, and signals before any fix attempt. Implicit classification ("I'll just fix this type error") skips the evidence step and leads to misclassification.
222
+ - **Design category MUST escalate.** If the error is classified as Design, you must stop and escalate to the human. Do not attempt a local fix for an architectural problem. Local fixes for architectural problems create more architectural problems.
223
+ - **Deterministic checks before AND after.** You must run the type checker and test suite both before and after the fix. Without a baseline, you cannot prove the fix helped and did not hurt.
224
+ - **No category mixing.** Follow the resolution strategy for one category. If you find yourself profiling (Performance) while also tracing data flow (Logic), you have not committed to a classification. Pick one.
225
+ - **Reclassify, do not force.** If the resolution strategy is not working, the classification is probably wrong. Go back to Phase 1 and reclassify. Do not force a Logic fix on what turns out to be an Environment issue.
226
+
227
+ ## Escalation
228
+
229
+ - **Design errors:** Always escalate. Provide: symptom summary, files affected, 2-3 architectural options if you can identify them.
230
+ - **Confidence is Low:** Escalate if you cannot decide between two categories after examining all signals. Present both possibilities and let the human decide.
231
+ - **Fix introduced new failures:** Revert the fix. Re-examine. If you cannot fix without side effects after 2 attempts, escalate.
232
+ - **Flaky test not isolated in 60 minutes:** The non-determinism source may be outside the codebase (infrastructure, external service). Escalate with your findings.
233
+ - **Security vulnerability with large blast radius:** If the minimal fix requires changing more than 3 files, reclassify as Design and escalate.
234
+
235
+ ## Examples
236
+
237
+ ### Example 1: Type Error in API Handler
238
+
239
+ **Phase 1 — CLASSIFY:**
240
+
241
+ ```
242
+ Error: src/handlers/users.ts(42,15): error TS2345:
243
+ Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
244
+
245
+ Baseline: 1 type error, 0 test failures.
246
+
247
+ CLASSIFICATION: Syntax/Type
248
+ CONFIDENCE: High
249
+ SIGNALS: Compile-time error, TypeScript error code TS2345, exact file and line provided
250
+ ALTERNATIVE: None — this is unambiguously a type error
251
+ ```
252
+
253
+ **Phase 2 — ROUTE:**
254
+ Following Syntax/Type strategy: read the error, fix mechanically.
255
+
256
+ The function `getUserById(id: string)` is called with `req.params.id` which is `string | undefined`. Add a guard or use non-null assertion after validation.
257
+
258
+ **Phase 3 — RESOLVE:**
259
+
260
+ ```typescript
261
+ // Fix: add guard before call
262
+ const id = req.params.id;
263
+ if (!id) {
264
+ return res.status(400).json({ error: 'id parameter is required' });
265
+ }
266
+ const user = await getUserById(id);
267
+ ```
268
+
269
+ Verification: 0 type errors (was 1), 0 test failures (unchanged). Fix confirmed.
270
+
271
+ ### Example 2: Flaky Integration Test
272
+
273
+ **Phase 1 — CLASSIFY:**
274
+
275
+ ```
276
+ Error: test/integration/queue.test.ts
277
+ "should process message within timeout"
278
+ Passes 7 out of 10 runs. Fails with: "Timeout — message not processed within 2000ms"
279
+
280
+ Baseline: 0 type errors, 1 flaky test failure (intermittent).
281
+
282
+ CLASSIFICATION: Flaky
283
+ CONFIDENCE: High
284
+ SIGNALS: Intermittent failure, timing-dependent assertion (2000ms timeout),
285
+ passes on retry, failure rate ~30%
286
+ ALTERNATIVE: Could be Environment if CI has different resource constraints,
287
+ but it also flakes locally
288
+ ```
289
+
290
+ **Phase 2 — ROUTE:**
291
+ Following Flaky strategy: isolate the timing dependency.
292
+
293
+ Run in isolation: still flakes (not order-dependent).
294
+ Run 20 times: fails 6/20 times (~30% failure rate, consistent).
295
+ Examine the test: it publishes a message and asserts it is processed within 2000ms.
296
+ Examine the handler: processing involves a database write that sometimes takes >2000ms under load.
297
+ Root cause: the timeout is too tight for the actual processing time, and there is no mechanism to signal completion — the test polls on a timer.
298
+
299
+ **Phase 3 — RESOLVE:**
300
+
301
+ ```typescript
302
+ // Before: polling with fixed timeout
303
+ await new Promise((resolve) => setTimeout(resolve, 2000));
304
+ const result = await db.query('SELECT * FROM processed WHERE id = ?', [msgId]);
305
+ expect(result.rows).toHaveLength(1);
306
+
307
+ // After: event-driven wait with generous timeout
308
+ const result = await waitForCondition(
309
+ () => db.query('SELECT * FROM processed WHERE id = ?', [msgId]).then((r) => r.rows.length > 0),
310
+ { timeout: 10000, interval: 100 }
311
+ );
312
+ expect(result).toBe(true);
313
+ ```
314
+
315
+ Verification: 0 type errors (unchanged), 20/20 test runs pass. Fix confirmed.
316
+
317
+ **Phase 4 — RECORD:**
318
+ Not needed — initial classification was correct and first fix attempt succeeded.
@@ -0,0 +1,50 @@
1
+ name: harness-diagnostics
2
+ version: "1.0.0"
3
+ description: Classify errors into taxonomy categories and route to resolution strategies
4
+ cognitive_mode: diagnostic-investigator
5
+ triggers:
6
+ - manual
7
+ - on_bug_fix
8
+ platforms:
9
+ - claude-code
10
+ - gemini-cli
11
+ tools:
12
+ - Bash
13
+ - Read
14
+ - Glob
15
+ - Grep
16
+ - Edit
17
+ - Write
18
+ cli:
19
+ command: harness skill run harness-diagnostics
20
+ args:
21
+ - name: path
22
+ description: Project root path
23
+ required: false
24
+ - name: error
25
+ description: Error message or description to diagnose
26
+ required: false
27
+ mcp:
28
+ tool: run_skill
29
+ input:
30
+ skill: harness-diagnostics
31
+ path: string
32
+ type: rigid
33
+ phases:
34
+ - name: classify
35
+ description: Categorize the error into one of 7 taxonomy categories
36
+ required: true
37
+ - name: route
38
+ description: Apply the resolution strategy for the error category
39
+ required: true
40
+ - name: resolve
41
+ description: Execute the resolution and verify the fix
42
+ required: true
43
+ - name: record
44
+ description: Record findings in anti-pattern log if initial approach failed
45
+ required: false
46
+ state:
47
+ persistent: true
48
+ files:
49
+ - .harness/diagnostics/
50
+ depends_on: []