@harness-engineering/cli 1.26.0 → 1.26.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 (179) hide show
  1. package/dist/agents/skills/README.md +1 -0
  2. package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +33 -5
  3. package/dist/agents/skills/claude-code/harness-execution/SKILL.md +6 -0
  4. package/dist/agents/skills/claude-code/harness-planning/SKILL.md +25 -1
  5. package/dist/agents/skills/claude-code/initialize-harness-project/SKILL.md +22 -6
  6. package/dist/agents/skills/claude-code/initialize-harness-project/skill.yaml +2 -1
  7. package/dist/agents/skills/claude-code/initialize-test-suite-project/SKILL.md +415 -0
  8. package/dist/agents/skills/claude-code/initialize-test-suite-project/skill.yaml +35 -0
  9. package/dist/agents/skills/codex/harness-brainstorming/SKILL.md +33 -5
  10. package/dist/agents/skills/codex/harness-execution/SKILL.md +6 -0
  11. package/dist/agents/skills/codex/harness-planning/SKILL.md +25 -1
  12. package/dist/agents/skills/codex/initialize-harness-project/SKILL.md +22 -6
  13. package/dist/agents/skills/codex/initialize-harness-project/skill.yaml +2 -1
  14. package/dist/agents/skills/codex/initialize-test-suite-project/SKILL.md +415 -0
  15. package/dist/agents/skills/codex/initialize-test-suite-project/skill.yaml +35 -0
  16. package/dist/agents/skills/cursor/harness-brainstorming/SKILL.md +33 -5
  17. package/dist/agents/skills/cursor/harness-execution/SKILL.md +6 -0
  18. package/dist/agents/skills/cursor/harness-planning/SKILL.md +25 -1
  19. package/dist/agents/skills/cursor/initialize-harness-project/SKILL.md +22 -6
  20. package/dist/agents/skills/cursor/initialize-harness-project/skill.yaml +2 -1
  21. package/dist/agents/skills/cursor/initialize-test-suite-project/SKILL.md +415 -0
  22. package/dist/agents/skills/cursor/initialize-test-suite-project/skill.yaml +35 -0
  23. package/dist/agents/skills/gemini-cli/harness-brainstorming/SKILL.md +33 -5
  24. package/dist/agents/skills/gemini-cli/harness-execution/SKILL.md +6 -0
  25. package/dist/agents/skills/gemini-cli/harness-planning/SKILL.md +25 -1
  26. package/dist/agents/skills/gemini-cli/initialize-harness-project/SKILL.md +22 -6
  27. package/dist/agents/skills/gemini-cli/initialize-harness-project/skill.yaml +2 -1
  28. package/dist/agents/skills/gemini-cli/initialize-test-suite-project/SKILL.md +415 -0
  29. package/dist/agents/skills/gemini-cli/initialize-test-suite-project/skill.yaml +35 -0
  30. package/dist/agents/skills/tests/initialize-test-suite-project.test.ts +152 -0
  31. package/dist/{agents-md-OPOZA5L7.js → agents-md-VI3HLR7E.js} +3 -3
  32. package/dist/{architecture-PMVMO6SF.js → architecture-ZDDKEVID.js} +4 -4
  33. package/dist/{assess-project-ZW7EKNIT.js → assess-project-Y6W7YDUA.js} +1 -1
  34. package/dist/bin/harness-mcp.js +16 -15
  35. package/dist/bin/harness.js +27 -27
  36. package/dist/{check-phase-gate-NTLAU3LO.js → check-phase-gate-CXR3VM22.js} +4 -4
  37. package/dist/{chunk-CAS3TS4Y.js → chunk-2BPPS6YQ.js} +793 -94
  38. package/dist/{chunk-VV2PJT4K.js → chunk-2FPUPRCY.js} +777 -598
  39. package/dist/{chunk-IFHAUFJX.js → chunk-3AMQYWGT.js} +2 -2
  40. package/dist/{chunk-FI3D6D7U.js → chunk-56A6OXVA.js} +9 -9
  41. package/dist/{chunk-QYSWNPXZ.js → chunk-7GY6WNEI.js} +1 -1
  42. package/dist/{chunk-ZBQ3ZY75.js → chunk-AMRC4FU2.js} +44 -41
  43. package/dist/{chunk-JZ6GORAK.js → chunk-B66LRB5M.js} +1 -1
  44. package/dist/{chunk-KFE2X7LG.js → chunk-BK4DJIIY.js} +4 -4
  45. package/dist/{chunk-G6SYTGOH.js → chunk-DBIX3X4H.js} +2 -2
  46. package/dist/{chunk-KXIAHHHP.js → chunk-FUND5WJR.js} +2 -2
  47. package/dist/{chunk-JWSVLC4I.js → chunk-JV4Y2U5F.js} +1 -1
  48. package/dist/{chunk-RNAGPTKF.js → chunk-K56DTX7G.js} +6 -6
  49. package/dist/{chunk-EXTWTJRF.js → chunk-N6B6RKQQ.js} +1 -1
  50. package/dist/{chunk-JBJ4AVE4.js → chunk-NY7DTZ6K.js} +3 -3
  51. package/dist/{chunk-Z2JORLRT.js → chunk-OLW7BJ5N.js} +1 -1
  52. package/dist/{chunk-HAOBHL3W.js → chunk-ORNEK65Y.js} +1 -1
  53. package/dist/{chunk-7JNZXJKY.js → chunk-PNNFCVW4.js} +5 -5
  54. package/dist/{chunk-NIOB6FTG.js → chunk-Q3ZLVMQM.js} +1 -1
  55. package/dist/{chunk-NVGQO4VM.js → chunk-RAVD7QLY.js} +8 -8
  56. package/dist/{chunk-J3O64D2A.js → chunk-TSVYBDDE.js} +1 -1
  57. package/dist/{chunk-KSFUJT5B.js → chunk-TY2ESLVL.js} +1 -1
  58. package/dist/{chunk-4KSKV5MK.js → chunk-VKS3F46M.js} +1 -1
  59. package/dist/{chunk-UBRD5FH4.js → chunk-WZ7UHPT3.js} +9 -9
  60. package/dist/{chunk-77EZGPSR.js → chunk-YC4EYIER.js} +8 -2
  61. package/dist/{chunk-6SCA4NEZ.js → chunk-ZN6ROTYP.js} +1 -1
  62. package/dist/{ci-workflow-H52EMCL6.js → ci-workflow-EW37KVPS.js} +3 -3
  63. package/dist/{create-skill-6QWJHQYS.js → create-skill-4T5CBSJ2.js} +2 -2
  64. package/dist/{dist-TG63OKA5.js → dist-CJDGASPP.js} +2 -2
  65. package/dist/{dist-PGQ32ZI7.js → dist-NCNAXUFD.js} +1 -1
  66. package/dist/{docs-GP4VUSIB.js → docs-4XI2FQW2.js} +4 -4
  67. package/dist/{engine-KQG5RVXX.js → engine-4L4CDTHU.js} +3 -3
  68. package/dist/{entropy-RXESIYKC.js → entropy-PBYSIQYS.js} +3 -3
  69. package/dist/{feedback-HS7ZYXOU.js → feedback-OTIFW5MK.js} +1 -1
  70. package/dist/{generate-agent-definitions-I4B7CVOB.js → generate-agent-definitions-CZGUXIIN.js} +4 -4
  71. package/dist/{graph-loader-TIVI6NQ7.js → graph-loader-RDXSEBD7.js} +1 -1
  72. package/dist/index.js +27 -27
  73. package/dist/{loader-CWAH6B4H.js → loader-UZOXCWFC.js} +3 -3
  74. package/dist/{mcp-KHK5KYER.js → mcp-GWVVV6LH.js} +16 -15
  75. package/dist/{performance-WDW5WS3J.js → performance-5UQPP3XX.js} +4 -4
  76. package/dist/{review-pipeline-QOZGWCTY.js → review-pipeline-65V4EO6O.js} +3 -3
  77. package/dist/{runtime-SFEFRPLX.js → runtime-PXX7HNB3.js} +3 -3
  78. package/dist/{scan-IJ7EYTF7.js → scan-WM7XDUF7.js} +1 -1
  79. package/dist/{security-2K7UUK6T.js → security-CAYDRZIZ.js} +1 -1
  80. package/dist/{validate-HXM6DXRZ.js → validate-CWGXR7QM.js} +4 -4
  81. package/dist/{validate-cross-check-ULQLEOME.js → validate-cross-check-BKCNLZYG.js} +3 -3
  82. package/package.json +4 -4
  83. package/dist/agents/commands/claude-code/harness/harness.md +0 -36
  84. package/dist/agents/commands/codex/AGENTS.md +0 -39
  85. package/dist/agents/commands/codex/harness/add-harness-component/SKILL.md +0 -204
  86. package/dist/agents/commands/codex/harness/add-harness-component/agents/openai.yaml +0 -3
  87. package/dist/agents/commands/codex/harness/cleanup-dead-code/SKILL.md +0 -257
  88. package/dist/agents/commands/codex/harness/cleanup-dead-code/agents/openai.yaml +0 -3
  89. package/dist/agents/commands/codex/harness/detect-doc-drift/SKILL.md +0 -191
  90. package/dist/agents/commands/codex/harness/detect-doc-drift/agents/openai.yaml +0 -3
  91. package/dist/agents/commands/codex/harness/enforce-architecture/SKILL.md +0 -289
  92. package/dist/agents/commands/codex/harness/enforce-architecture/agents/openai.yaml +0 -3
  93. package/dist/agents/commands/codex/harness/harness-architecture-advisor/SKILL.md +0 -442
  94. package/dist/agents/commands/codex/harness/harness-architecture-advisor/agents/openai.yaml +0 -3
  95. package/dist/agents/commands/codex/harness/harness-autopilot/SKILL.md +0 -929
  96. package/dist/agents/commands/codex/harness/harness-autopilot/agents/openai.yaml +0 -3
  97. package/dist/agents/commands/codex/harness/harness-brainstorming/SKILL.md +0 -418
  98. package/dist/agents/commands/codex/harness/harness-brainstorming/agents/openai.yaml +0 -3
  99. package/dist/agents/commands/codex/harness/harness-code-review/SKILL.md +0 -850
  100. package/dist/agents/commands/codex/harness/harness-code-review/agents/openai.yaml +0 -3
  101. package/dist/agents/commands/codex/harness/harness-codebase-cleanup/SKILL.md +0 -236
  102. package/dist/agents/commands/codex/harness/harness-codebase-cleanup/agents/openai.yaml +0 -3
  103. package/dist/agents/commands/codex/harness/harness-debugging/SKILL.md +0 -378
  104. package/dist/agents/commands/codex/harness/harness-debugging/agents/openai.yaml +0 -3
  105. package/dist/agents/commands/codex/harness/harness-dependency-health/SKILL.md +0 -190
  106. package/dist/agents/commands/codex/harness/harness-dependency-health/agents/openai.yaml +0 -3
  107. package/dist/agents/commands/codex/harness/harness-docs-pipeline/SKILL.md +0 -472
  108. package/dist/agents/commands/codex/harness/harness-docs-pipeline/agents/openai.yaml +0 -3
  109. package/dist/agents/commands/codex/harness/harness-execution/SKILL.md +0 -522
  110. package/dist/agents/commands/codex/harness/harness-execution/agents/openai.yaml +0 -3
  111. package/dist/agents/commands/codex/harness/harness-hotspot-detector/SKILL.md +0 -172
  112. package/dist/agents/commands/codex/harness/harness-hotspot-detector/agents/openai.yaml +0 -3
  113. package/dist/agents/commands/codex/harness/harness-impact-analysis/SKILL.md +0 -195
  114. package/dist/agents/commands/codex/harness/harness-impact-analysis/agents/openai.yaml +0 -3
  115. package/dist/agents/commands/codex/harness/harness-integrity/SKILL.md +0 -178
  116. package/dist/agents/commands/codex/harness/harness-integrity/agents/openai.yaml +0 -3
  117. package/dist/agents/commands/codex/harness/harness-onboarding/SKILL.md +0 -299
  118. package/dist/agents/commands/codex/harness/harness-onboarding/agents/openai.yaml +0 -3
  119. package/dist/agents/commands/codex/harness/harness-perf/SKILL.md +0 -272
  120. package/dist/agents/commands/codex/harness/harness-perf/agents/openai.yaml +0 -3
  121. package/dist/agents/commands/codex/harness/harness-planning/SKILL.md +0 -592
  122. package/dist/agents/commands/codex/harness/harness-planning/agents/openai.yaml +0 -3
  123. package/dist/agents/commands/codex/harness/harness-refactoring/SKILL.md +0 -181
  124. package/dist/agents/commands/codex/harness/harness-refactoring/agents/openai.yaml +0 -3
  125. package/dist/agents/commands/codex/harness/harness-release-readiness/SKILL.md +0 -701
  126. package/dist/agents/commands/codex/harness/harness-release-readiness/agents/openai.yaml +0 -3
  127. package/dist/agents/commands/codex/harness/harness-roadmap/SKILL.md +0 -607
  128. package/dist/agents/commands/codex/harness/harness-roadmap/agents/openai.yaml +0 -3
  129. package/dist/agents/commands/codex/harness/harness-security-scan/SKILL.md +0 -147
  130. package/dist/agents/commands/codex/harness/harness-security-scan/agents/openai.yaml +0 -3
  131. package/dist/agents/commands/codex/harness/harness-skill-authoring/SKILL.md +0 -314
  132. package/dist/agents/commands/codex/harness/harness-skill-authoring/agents/openai.yaml +0 -3
  133. package/dist/agents/commands/codex/harness/harness-soundness-review/SKILL.md +0 -1280
  134. package/dist/agents/commands/codex/harness/harness-soundness-review/agents/openai.yaml +0 -3
  135. package/dist/agents/commands/codex/harness/harness-supply-chain-audit/SKILL.md +0 -255
  136. package/dist/agents/commands/codex/harness/harness-supply-chain-audit/agents/openai.yaml +0 -3
  137. package/dist/agents/commands/codex/harness/harness-tdd/SKILL.md +0 -189
  138. package/dist/agents/commands/codex/harness/harness-tdd/agents/openai.yaml +0 -3
  139. package/dist/agents/commands/codex/harness/harness-test-advisor/SKILL.md +0 -171
  140. package/dist/agents/commands/codex/harness/harness-test-advisor/agents/openai.yaml +0 -3
  141. package/dist/agents/commands/codex/harness/harness-verification/SKILL.md +0 -433
  142. package/dist/agents/commands/codex/harness/harness-verification/agents/openai.yaml +0 -3
  143. package/dist/agents/commands/codex/harness/harness-verify/SKILL.md +0 -170
  144. package/dist/agents/commands/codex/harness/harness-verify/agents/openai.yaml +0 -3
  145. package/dist/agents/commands/codex/harness/initialize-harness-project/SKILL.md +0 -244
  146. package/dist/agents/commands/codex/harness/initialize-harness-project/agents/openai.yaml +0 -3
  147. package/dist/agents/commands/cursor/harness/add-harness-component.mdc +0 -200
  148. package/dist/agents/commands/cursor/harness/cleanup-dead-code.mdc +0 -253
  149. package/dist/agents/commands/cursor/harness/detect-doc-drift.mdc +0 -187
  150. package/dist/agents/commands/cursor/harness/enforce-architecture.mdc +0 -304
  151. package/dist/agents/commands/cursor/harness/harness-architecture-advisor.mdc +0 -457
  152. package/dist/agents/commands/cursor/harness/harness-autopilot.mdc +0 -924
  153. package/dist/agents/commands/cursor/harness/harness-brainstorming.mdc +0 -414
  154. package/dist/agents/commands/cursor/harness/harness-code-review.mdc +0 -865
  155. package/dist/agents/commands/cursor/harness/harness-codebase-cleanup.mdc +0 -232
  156. package/dist/agents/commands/cursor/harness/harness-debugging.mdc +0 -374
  157. package/dist/agents/commands/cursor/harness/harness-dependency-health.mdc +0 -187
  158. package/dist/agents/commands/cursor/harness/harness-docs-pipeline.mdc +0 -468
  159. package/dist/agents/commands/cursor/harness/harness-execution.mdc +0 -518
  160. package/dist/agents/commands/cursor/harness/harness-hotspot-detector.mdc +0 -169
  161. package/dist/agents/commands/cursor/harness/harness-impact-analysis.mdc +0 -192
  162. package/dist/agents/commands/cursor/harness/harness-integrity.mdc +0 -175
  163. package/dist/agents/commands/cursor/harness/harness-onboarding.mdc +0 -296
  164. package/dist/agents/commands/cursor/harness/harness-perf.mdc +0 -268
  165. package/dist/agents/commands/cursor/harness/harness-planning.mdc +0 -587
  166. package/dist/agents/commands/cursor/harness/harness-refactoring.mdc +0 -177
  167. package/dist/agents/commands/cursor/harness/harness-release-readiness.mdc +0 -697
  168. package/dist/agents/commands/cursor/harness/harness-roadmap.mdc +0 -603
  169. package/dist/agents/commands/cursor/harness/harness-security-scan.mdc +0 -162
  170. package/dist/agents/commands/cursor/harness/harness-skill-authoring.mdc +0 -300
  171. package/dist/agents/commands/cursor/harness/harness-soundness-review.mdc +0 -1275
  172. package/dist/agents/commands/cursor/harness/harness-supply-chain-audit.mdc +0 -252
  173. package/dist/agents/commands/cursor/harness/harness-tdd.mdc +0 -185
  174. package/dist/agents/commands/cursor/harness/harness-test-advisor.mdc +0 -168
  175. package/dist/agents/commands/cursor/harness/harness-verification.mdc +0 -429
  176. package/dist/agents/commands/cursor/harness/harness-verify.mdc +0 -167
  177. package/dist/agents/commands/cursor/harness/initialize-harness-project.mdc +0 -240
  178. package/dist/agents/commands/gemini-cli/harness/harness.toml +0 -277
  179. package/dist/{chunk-RRHUCDRD.js → chunk-ZP5E7YET.js} +3 -3
@@ -1,36 +0,0 @@
1
- ---
2
- name: harness
3
- description: Natural language router to harness skills — classifies intent, confirms, dispatches
4
- argument-hint: "--intent <intent>"
5
- allowed-tools:
6
- - Read
7
- - Glob
8
- - Grep
9
- ---
10
-
11
- <!-- Generated by harness generate-slash-commands. Do not edit. -->
12
-
13
- <context>
14
- Cognitive mode: analytical-classifier
15
- Type: rigid
16
- </context>
17
-
18
- <objective>
19
- Natural language router to harness skills — classifies intent, confirms, dispatches
20
-
21
- Phases:
22
- - classify: Parse intent and search skills index for matches
23
- - confirm: Present routing decision with scope and reasoning
24
- - dispatch: Invoke selected skill via run_skill with original intent
25
- </objective>
26
-
27
- <execution_context>
28
- @agents/skills/claude-code/harness-router/SKILL.md
29
- @agents/skills/claude-code/harness-router/skill.yaml
30
- </execution_context>
31
-
32
- <process>
33
- 1. Try: invoke mcp__harness__run_skill with skill: "harness-router"
34
- 2. If MCP unavailable: read SKILL.md and follow its workflow directly
35
- 3. Pass through any arguments provided by the user
36
- </process>
@@ -1,39 +0,0 @@
1
- <!-- Generated by harness generate-slash-commands. Do not edit. -->
2
-
3
- # Harness Skills
4
-
5
- This file bootstraps harness context for Codex CLI. Each skill is available as a structured workflow in the `harness/` directory.
6
-
7
- ## Available Skills
8
-
9
- - **add-harness-component** — Add a component to an existing harness project
10
- - **cleanup-dead-code** — Detect and auto-fix dead code including dead exports, commented-out code, and orphaned dependencies
11
- - **detect-doc-drift** — Detect documentation that has drifted from code
12
- - **enforce-architecture** — Validate architectural layer boundaries, detect violations, and auto-fix import ordering and forbidden import replacement
13
- - **harness-architecture-advisor** — Interactive architecture advisor that surfaces trade-offs and helps humans choose
14
- - **harness-autopilot** — Autonomous phase execution loop — chains planning, execution, verification, and review, pausing only at human decision points
15
- - **harness-brainstorming** — Structured ideation and exploration with harness methodology
16
- - **harness-code-review** — Multi-phase code review pipeline with mechanical checks, graph-scoped context, and parallel review agents
17
- - **harness-codebase-cleanup** — Orchestrate dead code removal and architecture violation fixes with shared convergence loop
18
- - **harness-debugging** — Systematic debugging with harness validation and state tracking
19
- - **harness-dependency-health** — Analyze structural health of the codebase using graph metrics
20
- - **harness-docs-pipeline** — Orchestrator composing 4 documentation skills into a sequential pipeline with convergence-based remediation and qualitative health reporting
21
- - **harness-execution** — Execute a planned set of tasks with harness validation and state tracking
22
- - **harness-hotspot-detector** — Identify structural risk hotspots via co-change and churn analysis
23
- - **harness-impact-analysis** — Graph-based impact analysis — answers "if I change X, what breaks?"
24
- - **harness-integrity** — Unified integrity gate — chains verify (quick gate) with AI review into a single report
25
- - **harness-onboarding** — Onboard a new developer to a harness-managed project
26
- - **harness-perf** — Performance enforcement and benchmark management
27
- - **harness-planning** — Structured project planning with harness constraints and validation
28
- - **harness-refactoring** — Safe refactoring with validation before and after changes
29
- - **harness-release-readiness** — Audit npm release readiness, run maintenance checks, offer auto-fixes, track progress across sessions
30
- - **harness-roadmap** — Create and manage a unified project roadmap from existing specs and plans
31
- - **harness-security-scan** — Lightweight mechanical security scan for health checks
32
- - **harness-skill-authoring** — Create and maintain harness skills following the rich skill format
33
- - **harness-soundness-review** — Deep soundness analysis of specs and plans with auto-fix and convergence loop
34
- - **harness-supply-chain-audit** — 6-factor dependency risk evaluation for supply chain security
35
- - **harness-tdd** — Test-driven development integrated with harness validation
36
- - **harness-test-advisor** — Graph-based test selection — answers "what tests should I run?"
37
- - **harness-verification** — Comprehensive harness verification of project health and compliance
38
- - **harness-verify** — Binary pass/fail quick gate — runs test, lint, typecheck commands and returns structured result
39
- - **initialize-harness-project** — Scaffold a new harness-compliant project
@@ -1,204 +0,0 @@
1
- <!-- Generated by harness generate-slash-commands. Do not edit. -->
2
-
3
- # Add Harness Component
4
-
5
- > Add layers, documentation, components, or skills to an existing harness project with proper integration. Validate against existing constraints, wire into architecture, and verify the result.
6
-
7
- ## When to Use
8
-
9
- - Adding a new layer to the project's architecture
10
- - Adding a new documentation file that harness should track
11
- - Adding a new component (module, service, package) that must be wired into existing layer boundaries
12
- - Adding a new skill to the project's skill library
13
- - When a plan calls for introducing a new architectural boundary or module
14
- - NOT when initializing a project from scratch (use initialize-harness-project)
15
- - NOT when modifying an existing component (use standard editing workflows)
16
- - NOT when removing components (manual process — removing requires careful dependency analysis)
17
-
18
- ## Process
19
-
20
- ### Phase 1: DETERMINE — Identify What to Add
21
-
22
- 1. **Clarify the component type.** Ask if not obvious from context:
23
- - **Layer:** A new architectural boundary (e.g., adding an "infrastructure" layer to a project that only has "business" and "data")
24
- - **Document:** A documentation file that harness should track for drift detection (e.g., API docs, architecture decision records)
25
- - **Component:** A code module, service, or package that lives within an existing layer
26
- - **Skill:** A new harness skill definition for the project's workflow
27
-
28
- 2. **Gather requirements.** For each type:
29
- - **Layer:** Name, which directories belong to it, which layers it can import from, which layers can import from it
30
- - **Document:** Path, what it documents, which code files it relates to
31
- - **Component:** Name, which layer it belongs to, what it depends on, what will depend on it
32
- - **Skill:** Name, purpose, type (rigid or flexible), triggers
33
-
34
- 3. **Check prerequisites.** The project must already be initialized with harness. If `harness.config.json` does not exist, stop and run initialize-harness-project first.
35
-
36
- ### Phase 2: VALIDATE — Check Against Existing Constraints
37
-
38
- 1. **Read the current configuration.** Load `harness.config.json` and `AGENTS.md` to understand existing layers, constraints, and architecture.
39
-
40
- 2. **Verify the new component does not conflict:**
41
- - Does the layer name already exist?
42
- - Does the component directory already exist?
43
- - Would the new dependency relationships create circular imports?
44
- - Does the component violate any existing forbidden-import rules?
45
-
46
- 3. **If conflicts are found,** report them clearly: "Adding layer X would conflict with existing layer Y because [reason]. Options: [A] rename, [B] merge into existing layer, [C] restructure. Which do you prefer?"
47
-
48
- 4. **Run `harness check-deps`** on the current state to establish a clean baseline. If it already fails, fix existing violations before adding new components.
49
-
50
- ### Phase 3: ADD — Create the Component
51
-
52
- 1. **Run `harness add` with appropriate arguments:**
53
- - Layer: `harness add layer <name> --dirs <dir1,dir2> --imports <allowed-layers>`
54
- - Document: `harness add doc <path> --tracks <related-code-paths>`
55
- - Component: `harness add component <name> --layer <layer-name>`
56
- - Skill: `harness add skill <name> --type <rigid|flexible>`
57
-
58
- 2. **Review generated files and configuration changes.** `harness add` modifies `harness.config.json` and may generate template files. Check that the changes look correct.
59
-
60
- 3. **Create the actual code or content.** `harness add` creates the configuration entry but not necessarily the implementation. Create the directories, files, and initial code as needed.
61
-
62
- ### Phase 4: WIRE — Integrate into Architecture
63
-
64
- 1. **Update imports and exports.** If the new component needs to be imported by existing code, add the imports. If existing code needs to be aware of the new layer, update barrel files or index modules.
65
-
66
- 2. **Update `AGENTS.md`.** Add the new component to the architecture section. Document its purpose, boundaries, and relationships to other components. This keeps agent instructions accurate.
67
-
68
- 3. **Update layer configuration** if the new component changes dependency relationships. Ensure `harness.config.json` reflects the actual import graph.
69
-
70
- 4. **For new skills:** Write the `skill.yaml` and `SKILL.md` files following the harness skill format. Use harness-skill-authoring for guidance on writing good skill content.
71
-
72
- ### Phase 5: VERIFY — Confirm Integration
73
-
74
- 1. **Run `harness validate`** to verify the full project configuration is still valid after the addition.
75
-
76
- 2. **Run `harness check-deps`** to verify no dependency violations were introduced. The new component's imports must respect layer boundaries.
77
-
78
- ### Graph Refresh
79
-
80
- If a knowledge graph exists at `.harness/graph/`, refresh it after code changes to keep graph queries accurate:
81
-
82
- ```
83
- harness scan [path]
84
- ```
85
-
86
- Skipping this step means subsequent graph queries (impact analysis, dependency health, test advisor) may return stale results.
87
-
88
- 3. **If validation fails,** fix the issues before committing. Common causes:
89
- - New layer not properly registered in `harness.config.json`
90
- - Component placed in wrong directory for its declared layer
91
- - Imports from forbidden layers
92
- - `AGENTS.md` references outdated architecture
93
-
94
- 4. **Commit the addition.** All new and modified files in a single atomic commit.
95
-
96
- ## Harness Integration
97
-
98
- - **`harness add layer <name>`** — Register a new architectural layer with directory mappings and import rules.
99
- - **`harness add doc <path>`** — Register a documentation file for drift tracking.
100
- - **`harness add component <name> --layer <layer>`** — Register a new code component within an existing layer.
101
- - **`harness add skill <name> --type <type>`** — Scaffold a new skill definition.
102
- - **`harness validate`** — Verify project configuration after the addition.
103
- - **`harness check-deps`** — Verify dependency constraints are respected after the addition.
104
-
105
- ## Success Criteria
106
-
107
- - The new component is properly registered in `harness.config.json`
108
- - The component's files exist in the correct directories for its declared layer
109
- - `AGENTS.md` is updated to reflect the new component
110
- - `harness validate` passes after the addition
111
- - `harness check-deps` passes after the addition (no new violations)
112
- - No circular dependencies were introduced
113
- - The addition is committed as a single atomic commit
114
-
115
- ## Rationalizations to Reject
116
-
117
- | Rationalization | Reality |
118
- | --- | --- |
119
- | "I will add the component and fix any constraint violations later" | Phase 2 requires running harness check-deps for a clean baseline BEFORE adding. Phase 5 requires it to pass AFTER adding. |
120
- | "AGENTS.md does not need updating for a small internal component" | Phase 4 explicitly requires updating AGENTS.md for every new component. Without it, AI agents have no context. |
121
- | "The new layer imports are obvious, so I do not need to check for circularity" | Phase 2 checks whether new dependency relationships create circular imports. Circular dependencies are invisible until they cause runtime failures. |
122
- | "I will commit the config change and the code separately for cleaner history" | The success criteria require a single atomic commit. Splitting creates a window where config references a nonexistent component. |
123
-
124
- ## Examples
125
-
126
- ### Example: Adding a New Layer
127
-
128
- ```
129
- Human: "We need an infrastructure layer for external API clients."
130
-
131
- DETERMINE: Adding a layer. Name: infrastructure. Dirs: src/infrastructure/.
132
- Imports from: (none — infrastructure is a leaf layer, no internal dependencies).
133
- Imported by: business layer (services call external APIs through infrastructure).
134
-
135
- VALIDATE:
136
- Read harness.config.json — existing layers: presentation, business, data.
137
- No conflict with "infrastructure" name.
138
- Run: harness check-deps — passes (clean baseline).
139
-
140
- ADD:
141
- harness add layer infrastructure --dirs src/infrastructure --imports none
142
- mkdir -p src/infrastructure
143
-
144
- WIRE:
145
- Update harness.config.json: allow business → infrastructure imports.
146
- Update AGENTS.md: document infrastructure layer purpose and boundaries.
147
-
148
- VERIFY:
149
- harness validate # Pass
150
- harness check-deps # Pass
151
- git add harness.config.json AGENTS.md src/infrastructure/
152
- git commit -m "feat: add infrastructure layer for external API clients"
153
- ```
154
-
155
- ### Example: Adding a Document for Drift Tracking
156
-
157
- ```
158
- Human: "Track our API specification for documentation drift."
159
-
160
- DETERMINE: Adding a document. Path: docs/api-spec.md.
161
- Tracks: src/routes/, src/models/response.ts.
162
-
163
- ADD:
164
- harness add doc docs/api-spec.md --tracks src/routes,src/models/response.ts
165
-
166
- WIRE:
167
- Update AGENTS.md: note that docs/api-spec.md is tracked for drift.
168
-
169
- VERIFY:
170
- harness validate # Pass
171
- git add harness.config.json AGENTS.md
172
- git commit -m "feat: track API spec for documentation drift detection"
173
- ```
174
-
175
- ### Example: Adding a Component to an Existing Layer
176
-
177
- ```
178
- Human: "Add a notification service to the business layer."
179
-
180
- DETERMINE: Adding a component. Name: notification-service. Layer: business.
181
- Depends on: data layer (notification repository). Depended on by: presentation layer (routes).
182
-
183
- VALIDATE:
184
- Read harness.config.json — business layer exists, maps to src/services/.
185
- No existing notification-service directory.
186
- business → data is an allowed import. Presentation → business is allowed.
187
- Run: harness check-deps — passes.
188
-
189
- ADD:
190
- harness add component notification-service --layer business
191
- Create src/services/notification-service.ts
192
- Create src/services/notification-service.test.ts
193
-
194
- WIRE:
195
- Add export to src/services/index.ts (if barrel file exists).
196
- Update AGENTS.md: add notification service to business layer component list.
197
-
198
- VERIFY:
199
- harness validate # Pass
200
- harness check-deps # Pass
201
- git add harness.config.json AGENTS.md src/services/notification-service.*
202
- git commit -m "feat: add notification service to business layer"
203
- ```
204
-
@@ -1,3 +0,0 @@
1
- # Reserved for Phase B native integration
2
- name: add-harness-component
3
- version: "1.0.0"
@@ -1,257 +0,0 @@
1
- <!-- Generated by harness generate-slash-commands. Do not edit. -->
2
-
3
- # Cleanup Dead Code
4
-
5
- > Entropy analysis and safe cleanup. Find unused exports, dead files, and pattern violations — then remove them without breaking anything.
6
-
7
- ## When to Use
8
-
9
- - After a major refactoring or feature removal
10
- - When the codebase feels "heavy" — too many files, unclear what is used
11
- - As a periodic hygiene task (monthly or per-quarter)
12
- - When `on_entropy_check` triggers fire
13
- - After deleting a feature flag and its associated code paths
14
- - When `harness cleanup` reports growing entropy in the project health dashboard
15
- - NOT during active feature development — dead code cleanup is a separate, focused task
16
- - NOT when tests are failing — fix tests first, then clean up
17
- - NOT under time pressure — dead code removal requires careful verification
18
-
19
- ## Process
20
-
21
- ### Phase 1: Analyze — Run Entropy Report
22
-
23
- 1. **Run `harness cleanup`** to generate a full entropy report. This analyzes:
24
- - **Dead exports** — functions, classes, and constants that are exported but never imported anywhere
25
- - **Unused files** — files that are not imported by any other file in the project
26
- - **Pattern violations** — code that violates established project patterns (e.g., a service file without a corresponding test file)
27
- - **Orphaned dependencies** — npm packages listed in package.json but never imported
28
-
29
- 2. **Run `harness cleanup --type dead-code --json`** for machine-readable output focused specifically on unused code.
30
-
31
- 3. **Review the report summary.** Note the total count and distribution. A few dead exports are normal; dozens suggest accumulated entropy from incomplete refactorings.
32
-
33
- ### Graph-Enhanced Context (when available)
34
-
35
- When a knowledge graph exists at `.harness/graph/`, use graph queries for faster, more accurate dead code detection:
36
-
37
- - `query_graph` — perform graph reachability analysis from entry point nodes to identify truly unreachable code
38
- - `get_relationships` — distinguish dynamic imports from genuinely unused code by checking edge types
39
-
40
- Graph reachability reduces false positives compared to static analysis alone, since it traces the full transitive import graph including re-exports. Fall back to file-based commands if no graph is available.
41
-
42
- ### Phase 2: Categorize — Safe vs. Needs Review
43
-
44
- **Safe to auto-fix (remove without further analysis):**
45
-
46
- - Exports that are not imported anywhere AND not referenced in any config file
47
- - Files that are not imported anywhere AND have no side effects (no top-level execution)
48
- - Dead exports (non-public, zero importers) -- remove `export` keyword or delete entirely if zero internal callers
49
- - Commented-out code blocks -- delete commented block (dead by definition, code is in git history)
50
- - Orphaned npm dependencies -- remove from package.json (probably safe; needs install+test verification)
51
- - Unused local variables and imports within a file (linter can catch these)
52
-
53
- **Needs human review before removal:**
54
-
55
- - Exports that APPEAR unused but might be consumed dynamically (see "What NOT to Delete" below)
56
- - Files that appear unused but are entry points (CLI scripts, test fixtures, config files)
57
- - Code that is only used in specific build configurations or environments
58
- - Exports from a public package — external consumers may depend on them
59
-
60
- ### Phase 3: Apply Safe Fixes
61
-
62
- For each item categorized as safe:
63
-
64
- 1. **Remove the dead code.** Delete the export, function, file, or import.
65
-
66
- 2. **Run `harness fix-drift`** to update any documentation references that pointed to the deleted code.
67
-
68
- 3. **Run the full test suite.** All tests must pass. If any test fails:
69
- - **STOP.** The code was not actually dead — something depends on it.
70
- - **Undo the deletion immediately.**
71
- - **Reclassify** the item as "needs human review" and investigate the hidden dependency.
72
-
73
- 4. **Run `harness validate` and `harness check-deps`.** Both must pass.
74
-
75
- 5. **Commit the cleanup.** Group related removals into logical commits (e.g., "remove unused shipping utilities" not "delete dead code").
76
-
77
- **New fix types:**
78
-
79
- - **Dead exports (non-public):** Use `detect_entropy` with `autoFix: true, fixTypes: ['dead-exports']`. The tool removes the `export` keyword. If the function/class has zero internal callers too, delete the entire declaration.
80
- - **Commented-out code:** Use `detect_entropy` with `autoFix: true, fixTypes: ['commented-code']`. The tool deletes commented-out code blocks. This is cosmetic and only needs lint verification.
81
- - **Orphaned dependencies:** Use `detect_entropy` with `autoFix: true, fixTypes: ['orphaned-deps']`. The tool removes the dep from package.json. **Must run `pnpm install && pnpm test` after** to verify nothing breaks.
82
-
83
- ### Phase 3.5: Convergence Loop (Standalone)
84
-
85
- When running standalone (not through the orchestrator), apply a single-concern convergence loop:
86
-
87
- 1. **Re-run detection.** After applying all safe fixes, run `harness cleanup --type dead-code` again.
88
- 2. **Check if issue count decreased.** Compare the new count to the previous count.
89
- 3. **If decreased: loop.** New dead code may have been exposed by the fixes (e.g., removing a dead export made a file fully unused). Go back to Phase 2 (Categorize) with the new report.
90
- 4. **If unchanged: stop.** No more cascading fixes are possible. Proceed to Phase 4 (Report).
91
- 5. **Maximum iterations: 5.** To prevent infinite loops, stop after 5 convergence cycles regardless.
92
-
93
- **Why convergence matters:** Removing dead code can create more dead code. For example:
94
-
95
- - Removing a dead export may make all remaining exports in a file dead, making the file itself dead.
96
- - Removing a dead file removes its imports, which may make other files' exports dead.
97
- - Removing an orphaned dep may cause lint warnings that reveal unused imports.
98
-
99
- ### Phase 4: Report Remaining Items
100
-
101
- ### Graph Refresh
102
-
103
- If a knowledge graph exists at `.harness/graph/`, refresh it after code changes to keep graph queries accurate:
104
-
105
- ```
106
- harness scan [path]
107
- ```
108
-
109
- Dead code removal changes graph topology — skipping this step means subsequent graph queries (impact analysis, dependency health, test advisor) may return stale results.
110
-
111
- For items that need human review, report:
112
-
113
- 1. **What it is** — file path, export name, what it does
114
- 2. **Why it appears dead** — no static imports found
115
- 3. **Why it might not be dead** — dynamic import patterns, external consumers, test utilities
116
- 4. **Recommended action** — delete with confidence, delete with caution, or keep
117
-
118
- ## What NOT to Delete
119
-
120
- These patterns make code APPEAR dead when it is actually in use:
121
-
122
- ### Dynamically imported modules
123
-
124
- ```typescript
125
- // This import won't show up in static analysis
126
- const module = await import(`./plugins/${pluginName}`);
127
- ```
128
-
129
- Files in a `plugins/` directory may appear unused but are loaded dynamically at runtime. Check for `import()` calls, `require()` with variables, and glob-based loading patterns.
130
-
131
- ### Test utilities and fixtures
132
-
133
- ```typescript
134
- // test-helpers.ts — only imported by test files
135
- export function createMockUser() { ... }
136
- ```
137
-
138
- Test utility files may appear unused if the analysis excludes test files. Verify that `harness cleanup` includes test files in its import graph.
139
-
140
- ### Type-only exports
141
-
142
- ```typescript
143
- // Only used as a type, never as a value
144
- export interface UserConfig { ... }
145
- ```
146
-
147
- Some analysis tools miss type-only imports (`import type { UserConfig }`). Verify before deleting any exported interface or type alias.
148
-
149
- ### Package entry points
150
-
151
- ```typescript
152
- // index.ts — re-exports for external consumers
153
- export { createClient } from './client';
154
- ```
155
-
156
- The entry point of a package re-exports things for external consumers. These exports may have zero internal imports but are the public API.
157
-
158
- ### Side-effect files
159
-
160
- ```typescript
161
- // polyfills.ts — imported for side effects, not for exports
162
- import './polyfills';
163
- ```
164
-
165
- Some files are imported for their side effects (polyfills, global registrations, CSS). They have no exports but are not dead.
166
-
167
- ### Environment-specific code
168
-
169
- ```typescript
170
- // Only used when FEATURE_FLAG_X is enabled
171
- if (process.env.FEATURE_FLAG_X) {
172
- const handler = require('./experimental-handler');
173
- }
174
- ```
175
-
176
- Code behind feature flags or environment checks may appear dead in the default configuration.
177
-
178
- ## Harness Integration
179
-
180
- - **`harness cleanup`** — Full entropy analysis. Reports dead exports, unused files, pattern violations, and orphaned dependencies.
181
- - **`harness cleanup --type dead-code`** — Focused analysis on unused code specifically.
182
- - **`harness cleanup --type dead-code --json`** — Machine-readable output for automation.
183
- - **`harness fix-drift`** — Update documentation after removing dead code. Ensures deleted items are not still referenced in docs.
184
- - **`harness validate`** — Run after cleanup to verify project structure remains valid.
185
- - **`harness check-deps`** — Run after cleanup to verify no dependency violations were introduced.
186
-
187
- ## Success Criteria
188
-
189
- - `harness cleanup` reports zero dead exports and zero unused files (or all remaining items are documented as intentional)
190
- - All tests pass after every deletion
191
- - `harness validate` and `harness check-deps` pass after cleanup
192
- - Documentation references to deleted code are updated or removed
193
- - No dynamically-imported, type-only, or side-effect code was accidentally deleted
194
- - Each cleanup commit is atomic and has a descriptive message explaining what was removed and why
195
-
196
- ## Examples
197
-
198
- ### Example: Removing unused utility functions
199
-
200
- **Entropy report:**
201
-
202
- ```
203
- DEAD EXPORT: src/utils/string-helpers.ts
204
- - capitalizeFirst() — 0 imports found
205
- - truncateWithEllipsis() — 0 imports found
206
- - slugify() — 3 imports found (ACTIVE, not dead)
207
- ```
208
-
209
- **Action:** Remove `capitalizeFirst` and `truncateWithEllipsis` from the file. Keep `slugify`. Run tests — all pass. Commit: "remove unused capitalizeFirst and truncateWithEllipsis from string-helpers"
210
-
211
- ### Example: Detecting a false positive
212
-
213
- **Entropy report:**
214
-
215
- ```
216
- UNUSED FILE: src/plugins/markdown-renderer.ts
217
- - 0 static imports found
218
- - File contains: export default class MarkdownRenderer
219
- ```
220
-
221
- **Investigation:** Check for dynamic imports:
222
-
223
- ```typescript
224
- // src/plugins/index.ts
225
- const renderer = await import(`./${format}-renderer`);
226
- ```
227
-
228
- **Result:** False positive. The file is loaded dynamically based on the `format` variable. Mark as intentional and add a comment in the file explaining the dynamic loading pattern.
229
-
230
- ### Example: Orphaned npm dependency
231
-
232
- **Entropy report:**
233
-
234
- ```
235
- ORPHANED DEPENDENCY: moment (package.json)
236
- - 0 imports of 'moment' found in src/
237
- - Last imported in commit abc123 (removed 3 months ago)
238
- ```
239
-
240
- **Action:** Remove `moment` from package.json dependencies. Run `npm install` to update lockfile. Run tests — all pass. Commit: "remove unused moment dependency"
241
-
242
- ## Rationalizations to Reject
243
-
244
- | Rationalization | Reality |
245
- | --- | --- |
246
- | "This export has zero static imports, so it is definitely dead and safe to remove" | Zero static imports does not mean zero consumers. Dynamic imports, type-only imports, side-effect imports, and package entry points all create false positives. |
247
- | "I removed the dead code and the tests pass, so I do not need to run harness validate and check-deps" | Both harness validate and harness check-deps must pass after every cleanup. Dead code removal can introduce dependency violations. |
248
- | "The convergence loop found new dead code after my fixes, but it is probably just noise from the tool" | Removing dead code creates more dead code. The convergence loop exists to catch these cascades. If the issue count decreased, loop back. |
249
- | "The entropy report has 60 items but I can clean them all up in one pass to be thorough" | When the report is very large (>50 items), pick the highest-confidence dead code first. Attempting everything at once risks compound errors. |
250
-
251
- ## Escalation
252
-
253
- - **When removing code causes unexpected test failures:** The code has a hidden dependency. Undo the deletion, investigate the dependency chain, and document the finding. The code is not dead — it is just hard to trace.
254
- - **When the entropy report is very large (>50 items):** Do not attempt to clean everything at once. Pick the highest-confidence dead code (files with zero imports, no dynamic patterns) and clean those first. Schedule the rest across multiple sessions.
255
- - **When you are unsure if an export is used externally:** Check if the code is in a published package. If so, removing an export is a breaking change. Deprecate first, then remove in a major version.
256
- - **When dead code is tangled with live code in the same file:** Extract the live code first (using harness-refactoring), then delete the remaining dead code. Do not try to surgically remove dead code from a complex file in one step.
257
-
@@ -1,3 +0,0 @@
1
- # Reserved for Phase B native integration
2
- name: cleanup-dead-code
3
- version: "1.0.0"