@harness-engineering/cli 1.8.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 (74) hide show
  1. package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +2 -2
  2. package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +5 -7
  3. package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +2 -2
  4. package/dist/agents/skills/claude-code/harness-planning/SKILL.md +2 -2
  5. package/dist/agents/skills/claude-code/harness-roadmap/SKILL.md +4 -5
  6. package/dist/agents/skills/gemini-cli/add-harness-component/SKILL.md +192 -0
  7. package/dist/agents/skills/gemini-cli/add-harness-component/skill.yaml +32 -0
  8. package/dist/agents/skills/gemini-cli/align-documentation/SKILL.md +213 -0
  9. package/dist/agents/skills/gemini-cli/align-documentation/skill.yaml +31 -0
  10. package/dist/agents/skills/gemini-cli/check-mechanical-constraints/SKILL.md +191 -0
  11. package/dist/agents/skills/gemini-cli/check-mechanical-constraints/skill.yaml +32 -0
  12. package/dist/agents/skills/gemini-cli/cleanup-dead-code/SKILL.md +245 -0
  13. package/dist/agents/skills/gemini-cli/cleanup-dead-code/skill.yaml +33 -0
  14. package/dist/agents/skills/gemini-cli/detect-doc-drift/SKILL.md +179 -0
  15. package/dist/agents/skills/gemini-cli/detect-doc-drift/skill.yaml +30 -0
  16. package/dist/agents/skills/gemini-cli/enforce-architecture/SKILL.md +240 -0
  17. package/dist/agents/skills/gemini-cli/enforce-architecture/skill.yaml +34 -0
  18. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/SKILL.md +397 -0
  19. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/skill.yaml +48 -0
  20. package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +2 -2
  21. package/dist/agents/skills/gemini-cli/harness-brainstorming/SKILL.md +317 -0
  22. package/dist/agents/skills/gemini-cli/harness-brainstorming/skill.yaml +49 -0
  23. package/dist/agents/skills/gemini-cli/harness-code-review/SKILL.md +681 -0
  24. package/dist/agents/skills/gemini-cli/harness-code-review/skill.yaml +45 -0
  25. package/dist/agents/skills/gemini-cli/harness-debugging/SKILL.md +366 -0
  26. package/dist/agents/skills/gemini-cli/harness-debugging/skill.yaml +47 -0
  27. package/dist/agents/skills/gemini-cli/harness-diagnostics/SKILL.md +318 -0
  28. package/dist/agents/skills/gemini-cli/harness-diagnostics/skill.yaml +50 -0
  29. package/dist/agents/skills/gemini-cli/harness-execution/SKILL.md +382 -0
  30. package/dist/agents/skills/gemini-cli/harness-execution/skill.yaml +51 -0
  31. package/dist/agents/skills/gemini-cli/harness-git-workflow/SKILL.md +268 -0
  32. package/dist/agents/skills/gemini-cli/harness-git-workflow/skill.yaml +31 -0
  33. package/dist/agents/skills/gemini-cli/harness-integrity/SKILL.md +167 -0
  34. package/dist/agents/skills/gemini-cli/harness-integrity/skill.yaml +47 -0
  35. package/dist/agents/skills/gemini-cli/harness-onboarding/SKILL.md +288 -0
  36. package/dist/agents/skills/gemini-cli/harness-onboarding/skill.yaml +30 -0
  37. package/dist/agents/skills/gemini-cli/harness-parallel-agents/SKILL.md +171 -0
  38. package/dist/agents/skills/gemini-cli/harness-parallel-agents/skill.yaml +33 -0
  39. package/dist/agents/skills/gemini-cli/harness-planning/SKILL.md +389 -0
  40. package/dist/agents/skills/gemini-cli/harness-planning/skill.yaml +49 -0
  41. package/dist/agents/skills/gemini-cli/harness-pre-commit-review/SKILL.md +262 -0
  42. package/dist/agents/skills/gemini-cli/harness-pre-commit-review/skill.yaml +33 -0
  43. package/dist/agents/skills/gemini-cli/harness-refactoring/SKILL.md +169 -0
  44. package/dist/agents/skills/gemini-cli/harness-refactoring/skill.yaml +33 -0
  45. package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +4 -5
  46. package/dist/agents/skills/gemini-cli/harness-skill-authoring/SKILL.md +292 -0
  47. package/dist/agents/skills/gemini-cli/harness-skill-authoring/skill.yaml +32 -0
  48. package/dist/agents/skills/gemini-cli/harness-state-management/SKILL.md +309 -0
  49. package/dist/agents/skills/gemini-cli/harness-state-management/skill.yaml +32 -0
  50. package/dist/agents/skills/gemini-cli/harness-tdd/SKILL.md +177 -0
  51. package/dist/agents/skills/gemini-cli/harness-tdd/skill.yaml +48 -0
  52. package/dist/agents/skills/gemini-cli/harness-verification/SKILL.md +328 -0
  53. package/dist/agents/skills/gemini-cli/harness-verification/skill.yaml +42 -0
  54. package/dist/agents/skills/gemini-cli/harness-verify/SKILL.md +159 -0
  55. package/dist/agents/skills/gemini-cli/harness-verify/skill.yaml +40 -0
  56. package/dist/agents/skills/gemini-cli/initialize-harness-project/SKILL.md +224 -0
  57. package/dist/agents/skills/gemini-cli/initialize-harness-project/skill.yaml +31 -0
  58. package/dist/agents/skills/gemini-cli/validate-context-engineering/SKILL.md +150 -0
  59. package/dist/agents/skills/gemini-cli/validate-context-engineering/skill.yaml +31 -0
  60. package/dist/bin/harness.js +3 -3
  61. package/dist/{chunk-SJECMKSS.js → chunk-E2RTDBMG.js} +25 -13
  62. package/dist/{chunk-LNI4T7R6.js → chunk-KJANDVVC.js} +20 -18
  63. package/dist/{chunk-3JWCBVUZ.js → chunk-RT2LYQHF.js} +1 -1
  64. package/dist/{dist-NT3GXHQZ.js → dist-CCM3L3UE.js} +1 -1
  65. package/dist/{dist-BDO5GFEM.js → dist-K6KTTN3I.js} +3 -3
  66. package/dist/index.js +3 -3
  67. package/dist/validate-cross-check-ZGKFQY57.js +7 -0
  68. package/package.json +6 -6
  69. package/dist/agents/skills/node_modules/.bin/glob +0 -17
  70. package/dist/agents/skills/node_modules/.bin/vitest +0 -17
  71. package/dist/agents/skills/node_modules/.bin/yaml +0 -17
  72. package/dist/templates/advanced/docs/specs/.gitkeep +0 -0
  73. package/dist/templates/intermediate/docs/specs/.gitkeep +0 -0
  74. package/dist/validate-cross-check-2OPGCGGU.js +0 -7
@@ -0,0 +1,224 @@
1
+ # Initialize Harness Project
2
+
3
+ > Scaffold a new harness-compliant project or migrate an existing project to the next adoption level. Assess current state, configure personas, generate AGENTS.md, and validate the result.
4
+
5
+ ## When to Use
6
+
7
+ - Starting a brand new project that should be harness-managed from day one
8
+ - Migrating an existing project to harness for the first time
9
+ - Upgrading an existing harness project from one adoption level to the next (basic to intermediate, intermediate to advanced)
10
+ - When `on_project_init` triggers fire
11
+ - NOT when the project is already at the desired adoption level (use harness-onboarding to orient instead)
12
+ - NOT when adding a single component to an existing harness project (use add-harness-component)
13
+ - NOT when the project has no clear owner or maintainer — harness setup requires someone to own the constraints
14
+
15
+ ## Process
16
+
17
+ ### Phase 1: ASSESS — Determine Current State
18
+
19
+ 1. **Check for existing harness configuration.** Look for `.harness/` directory, `AGENTS.md`, `harness.yaml`, and any skill definitions. Their presence determines whether this is a new project or a migration.
20
+
21
+ 2. **For new projects:** Gather project context — language, framework, test runner, build tool. Ask the human if any of these are undecided. Do not assume defaults.
22
+
23
+ 3. **For existing projects:** Run `harness validate` to see what is already configured and what is missing. Read `AGENTS.md` if it exists. Identify the current adoption level:
24
+ - **Basic:** Has `AGENTS.md` and `harness.yaml` with project metadata. No layers, no skills, no dependency constraints.
25
+ - **Intermediate:** Has layers defined, dependency constraints between layers, at least one custom skill. `harness check-deps` runs and passes.
26
+ - **Advanced:** Has full persona configuration, custom skills for the team's workflows, state management, learnings capture, and CI integration for `harness validate`.
27
+
28
+ 4. **Recommend the target adoption level.** For new projects, start with basic unless the team has harness experience. For existing projects, recommend one level up from current. Present the recommendation and wait for confirmation.
29
+
30
+ ### Phase 2: SCAFFOLD — Generate Project Structure
31
+
32
+ 1. **Run `harness init` with the appropriate flags:**
33
+ - New basic project: `harness init --level basic --framework <framework>`
34
+ - New intermediate project: `harness init --level intermediate --framework <framework>`
35
+ - Migration to intermediate: `harness init --level intermediate --migrate`
36
+ - Migration to advanced: `harness init --level advanced --migrate`
37
+
38
+ 2. **Review generated files.** `harness init` creates:
39
+ - `harness.yaml` — Project configuration (name, stack, adoption level)
40
+ - `.harness/` directory — State and learnings storage
41
+ - `AGENTS.md` — Agent instructions (template, needs customization)
42
+ - Layer definitions (intermediate and above)
43
+ - Dependency constraints (intermediate and above)
44
+
45
+ 3. **Do not blindly accept generated content.** Read the generated `AGENTS.md` and `harness.yaml`. Flag anything that looks wrong or incomplete. The scaffolded output is a starting point, not a finished product.
46
+
47
+ ### Phase 3: CONFIGURE — Customize for the Project
48
+
49
+ 1. **Configure personas.** Run `harness persona generate` to create persona definitions based on the project's stack and team structure. Personas define how agents should behave in this project — coding style, communication preferences, constraint strictness.
50
+
51
+ 2. **Customize AGENTS.md.** The generated template needs project-specific content:
52
+ - Project description and purpose
53
+ - Architecture overview (components, layers, data flow)
54
+ - Key conventions the team follows
55
+ - Known constraints and forbidden patterns
56
+ - Links to relevant documentation
57
+
58
+ 3. **For intermediate and above:** Define layer boundaries. Which modules belong to which layers? What are the allowed import directions? Document these in `harness.yaml` and ensure they match the actual codebase structure.
59
+
60
+ 4. **For advanced:** Configure state management (`.harness/state.json` schema), learnings capture (`.harness/learnings.md` conventions), and CI integration hooks.
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
+
67
+ ### Phase 4: VALIDATE — Confirm Everything Works
68
+
69
+ 1. **Run `harness validate`** to verify the full configuration. This checks:
70
+ - `harness.yaml` schema validity
71
+ - `AGENTS.md` presence and required sections
72
+ - Layer definitions (if intermediate+)
73
+ - Dependency constraints (if intermediate+)
74
+ - Persona configuration (if configured)
75
+
76
+ 2. **Fix any validation errors before finishing.** Do not leave the project in a half-configured state.
77
+
78
+ 3. **Run `harness check-deps`** (intermediate and above) to verify dependency constraints match the actual codebase. If there are violations, decide with the human: update the constraints or fix the code.
79
+
80
+ ### Build the Initial Knowledge Graph
81
+
82
+ If the project will use graph-based queries, build the initial knowledge graph now:
83
+
84
+ ```
85
+ harness scan [path]
86
+ ```
87
+
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.
89
+
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.
93
+
94
+ ## Harness Integration
95
+
96
+ - **`harness init --level <level> --framework <framework>`** — Scaffold a new project at the specified adoption level.
97
+ - **`harness init --level <level> --migrate`** — Migrate an existing project to the next adoption level, preserving existing configuration.
98
+ - **`harness persona generate`** — Generate persona definitions based on project stack and team structure.
99
+ - **`harness validate`** — Verify the full project configuration is valid and complete.
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.
103
+
104
+ ## Success Criteria
105
+
106
+ - `harness.yaml` exists and passes schema validation
107
+ - `AGENTS.md` exists with project-specific content (not just the template)
108
+ - `.harness/` directory exists with appropriate state files
109
+ - `harness validate` passes with zero errors
110
+ - `harness check-deps` passes (intermediate and above)
111
+ - Personas are configured if the project uses them
112
+ - The adoption level matches what was agreed upon with the human
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
115
+
116
+ ## Examples
117
+
118
+ ### Example: New TypeScript Project (Basic Level)
119
+
120
+ **ASSESS:**
121
+
122
+ ```
123
+ Human: "I'm starting a new TypeScript API project using Express and Vitest."
124
+ Check for .harness/ — not found. This is a new project.
125
+ Recommend: basic level (new project, start simple).
126
+ Human confirms: "Basic is fine for now."
127
+ ```
128
+
129
+ **SCAFFOLD:**
130
+
131
+ ```bash
132
+ harness init --level basic --framework express
133
+ # Creates: harness.yaml, .harness/, AGENTS.md (template)
134
+ ```
135
+
136
+ **CONFIGURE:**
137
+
138
+ ```
139
+ Edit AGENTS.md:
140
+ - Add project description: "REST API for widget management"
141
+ - Add stack: TypeScript, Express, Vitest, PostgreSQL
142
+ - Add conventions: "Use zod for validation, repository pattern for data access"
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)
148
+ ```
149
+
150
+ **VALIDATE:**
151
+
152
+ ```bash
153
+ harness validate # Pass — basic level checks satisfied
154
+ git add harness.yaml .harness/ AGENTS.md
155
+ git commit -m "feat: initialize harness project at basic level"
156
+ ```
157
+
158
+ ### Example: Migrating Existing Project from Basic to Intermediate
159
+
160
+ **ASSESS:**
161
+
162
+ ```
163
+ Read harness.yaml — level: basic
164
+ Read AGENTS.md — exists, has project-specific content
165
+ Run: harness validate — passes at basic level
166
+ Recommend: intermediate (add layers and dependency constraints)
167
+ Human confirms: "Yes, we're ready for layers."
168
+ ```
169
+
170
+ **SCAFFOLD:**
171
+
172
+ ```bash
173
+ harness init --level intermediate --migrate
174
+ # Preserves existing harness.yaml and AGENTS.md
175
+ # Adds: layer definitions template, dependency constraints template
176
+ ```
177
+
178
+ **CONFIGURE:**
179
+
180
+ ```
181
+ Define layers in harness.yaml:
182
+ - presentation: src/routes/, src/middleware/
183
+ - business: src/services/, src/models/
184
+ - data: src/repositories/, src/db/
185
+
186
+ Define constraints:
187
+ - presentation → business (allowed)
188
+ - business → data (allowed)
189
+ - data → presentation (forbidden)
190
+ - presentation → data (forbidden — must go through business)
191
+
192
+ Update AGENTS.md with layer documentation.
193
+ ```
194
+
195
+ **VALIDATE:**
196
+
197
+ ```bash
198
+ harness validate # Pass — intermediate level checks satisfied
199
+ harness check-deps # Pass — no constraint violations in existing code
200
+ git add -A
201
+ git commit -m "feat: migrate harness project to intermediate level with layers"
202
+ ```
203
+
204
+ ### Example: Adoption Level Progression
205
+
206
+ **Basic (start here):**
207
+
208
+ - `AGENTS.md` with project context
209
+ - `harness.yaml` with metadata
210
+ - `harness validate` runs in development
211
+
212
+ **Intermediate (add structure):**
213
+
214
+ - Layer definitions and boundaries
215
+ - Dependency constraints enforced by `harness check-deps`
216
+ - At least one custom skill for team workflows
217
+
218
+ **Advanced (full integration):**
219
+
220
+ - Persona configuration for consistent agent behavior
221
+ - State management across sessions
222
+ - `.harness/learnings.md` capturing institutional knowledge
223
+ - `harness validate` runs in CI pipeline
224
+ - Custom skills for all common team workflows
@@ -0,0 +1,31 @@
1
+ name: initialize-harness-project
2
+ version: "1.0.0"
3
+ description: Scaffold a new harness-compliant project
4
+ cognitive_mode: constructive-architect
5
+ triggers:
6
+ - manual
7
+ - on_project_init
8
+ platforms:
9
+ - claude-code
10
+ - gemini-cli
11
+ tools:
12
+ - Bash
13
+ - Read
14
+ - Write
15
+ - Glob
16
+ cli:
17
+ command: harness skill run initialize-harness-project
18
+ args:
19
+ - name: path
20
+ description: Project root path
21
+ required: false
22
+ mcp:
23
+ tool: run_skill
24
+ input:
25
+ skill: initialize-harness-project
26
+ path: string
27
+ type: flexible
28
+ state:
29
+ persistent: false
30
+ files: []
31
+ depends_on: []
@@ -0,0 +1,150 @@
1
+ # Validate Context Engineering
2
+
3
+ > Validate AGENTS.md quality and evolve it as the codebase changes. Good context engineering means AI agents always have accurate, current knowledge about the project.
4
+
5
+ ## When to Use
6
+
7
+ - After adding new files, modules, or packages to the project
8
+ - After renaming, moving, or deleting significant files
9
+ - After changing public APIs, architectural patterns, or conventions
10
+ - When onboarding a new contributor (human or AI) and want to verify context is current
11
+ - When `on_context_check` or `on_pre_commit` triggers fire
12
+ - Periodically (weekly or per-sprint) as a hygiene check
13
+ - NOT when making trivial changes (typo fixes, comment updates, formatting)
14
+ - NOT during active feature development — run this between features or at cycle boundaries
15
+
16
+ ## Process
17
+
18
+ ### Phase 1: Audit — Run Automated Checks
19
+
20
+ 1. **Run `harness validate`** to check overall project health. Review any context-related warnings or errors in the output.
21
+
22
+ 2. **Run `harness check-docs`** to detect documentation gaps, broken links, and stale references. Capture the full output for analysis.
23
+
24
+ 3. **Review AGENTS.md manually.** Automated tools catch structural issues but miss semantic drift. Read each section and ask: "Is this still true?"
25
+
26
+ ### Graph-Enhanced Context (when available)
27
+
28
+ When a knowledge graph exists at `.harness/graph/`, use graph queries for faster, more accurate auditing:
29
+
30
+ - `query_graph` — find all undocumented code nodes (file nodes without `documents` edges), replacing manual cross-referencing
31
+ - `search_similar` — detect stale references in AGENTS.md by matching section text against current code entities
32
+
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
+
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
+
47
+ ### Phase 2: Detect Gaps
48
+
49
+ Categorize findings into four types:
50
+
51
+ 1. **Undocumented files.** New source files, modules, or packages that are not mentioned in AGENTS.md or any knowledge map section. These are the highest priority — an AI agent encountering these files has no context.
52
+
53
+ 2. **Broken links.** References to files, functions, or URLs that no longer exist. These actively mislead agents.
54
+
55
+ 3. **Stale sections.** Content that was accurate when written but no longer reflects reality. Examples: renamed functions still referenced by old name, removed features still described, changed conventions not updated.
56
+
57
+ 4. **Missing context.** Sections that exist but lack critical information. A module is listed but its purpose, constraints, or relationships are not explained. An AI agent can find the file but does not understand why it exists or how to use it correctly.
58
+
59
+ ### Phase 3: Suggest Updates
60
+
61
+ For each gap, generate a specific suggestion:
62
+
63
+ - **Undocumented files:** Draft a new section or entry with the file path, purpose, key exports, and relationship to existing modules. Use the existing AGENTS.md style and structure.
64
+ - **Broken links:** Identify the correct target (renamed file, moved function) or recommend removal if the target was deleted.
65
+ - **Stale sections:** Draft replacement text that reflects current reality. Show the diff between old and new.
66
+ - **Missing context:** Draft additional content that fills the gap. Focus on what an AI agent needs to know: purpose, constraints, relationships, and gotchas.
67
+
68
+ ### Phase 4: Apply with Approval
69
+
70
+ 1. **Present all suggestions as a grouped list.** Organize by section of AGENTS.md for easy review.
71
+
72
+ 2. **Apply approved changes.** Update AGENTS.md with the approved suggestions. Preserve existing formatting and style.
73
+
74
+ 3. **Re-run `harness check-docs`** to verify all fixes are clean. No new issues should be introduced.
75
+
76
+ 4. **Commit the update.** Use a descriptive commit message that summarizes what was updated and why.
77
+
78
+ ## What Makes Good AGENTS.md Content
79
+
80
+ Good context engineering treats AGENTS.md as a **dynamic knowledge base**, not a static document.
81
+
82
+ - **Accuracy over completeness.** A small, accurate AGENTS.md is better than a comprehensive but stale one. Every statement must be verifiable against the current codebase.
83
+ - **Purpose-first descriptions.** Do not just list files. Explain WHY each module exists, what problem it solves, and what constraints apply to it.
84
+ - **Relationship mapping.** Show how modules connect. Which modules depend on which? What are the boundaries? An agent reading one section should understand how it fits into the whole.
85
+ - **Gotchas and constraints.** Document the non-obvious. What will break if someone does X? What patterns must be followed? What is forbidden and why?
86
+ - **Change-friendly structure.** Organize so that adding a new module means adding one section, not updating ten places. Use consistent formatting so automated tools can parse it.
87
+ - **Actionable guidance.** Every section should help an agent make correct decisions. "This module handles authentication" is less useful than "This module handles authentication. All auth changes must go through the AuthService class. Direct database access for auth data is forbidden — use the repository layer."
88
+
89
+ ## Harness Integration
90
+
91
+ - **`harness validate`** — Full project health check. Reports context gaps as part of overall validation.
92
+ - **`harness check-docs`** — Focused documentation audit. Detects broken links, missing references, stale sections, and undocumented files.
93
+ - **`harness fix-drift`** — Auto-fix simple drift issues (broken links, renamed references). Use after manual review confirms the fixes are correct.
94
+
95
+ ## Success Criteria
96
+
97
+ - `harness check-docs` passes with zero errors and zero warnings
98
+ - Every source file that contains public API or architectural significance is referenced in AGENTS.md
99
+ - All file paths and function names in AGENTS.md match the current codebase
100
+ - All links (internal and external) resolve correctly
101
+ - AGENTS.md sections accurately describe current module purposes, constraints, and relationships
102
+ - A new AI agent reading AGENTS.md can navigate the codebase and make correct decisions without additional guidance
103
+
104
+ ## Examples
105
+
106
+ ### Example: New module added but not documented
107
+
108
+ **Audit output from `harness check-docs`:**
109
+
110
+ ```
111
+ WARNING: Undocumented file detected: src/services/notification-service.ts
112
+ - File contains 3 public exports: NotificationService, NotificationType, sendNotification
113
+ - File is imported by 4 other modules
114
+ - No AGENTS.md section references this file
115
+ ```
116
+
117
+ **Suggested update:**
118
+
119
+ ```markdown
120
+ ### Notification Service (`src/services/notification-service.ts`)
121
+
122
+ Handles all outbound notifications (email, Slack, webhook). All notification delivery
123
+ must go through `NotificationService` — direct use of transport libraries (nodemailer,
124
+ Slack SDK) outside this module is forbidden.
125
+
126
+ - `NotificationType` — enum of supported notification channels
127
+ - `sendNotification()` — primary entry point; routes to the correct transport
128
+ - Requires `NOTIFICATION_CONFIG` environment variables to be set
129
+ - Respects rate limits defined in `harness.config.json` under `notifications`
130
+ ```
131
+
132
+ **Apply:** Add the section under the Services heading in AGENTS.md. Re-run `harness check-docs` to confirm the warning is resolved.
133
+
134
+ ### Example: Renamed function still referenced by old name
135
+
136
+ **Audit output:**
137
+
138
+ ```
139
+ ERROR: Broken reference in AGENTS.md line 47: `calculateShipping()`
140
+ - Function was renamed to `computeShippingCost()` in commit abc123
141
+ - Located in src/services/shipping.ts
142
+ ```
143
+
144
+ **Fix:** Replace `calculateShipping()` with `computeShippingCost()` in AGENTS.md. Verify no other references to the old name exist.
145
+
146
+ ## Escalation
147
+
148
+ - **When AGENTS.md is severely outdated (>20 issues):** Do not attempt to fix everything at once. Prioritize: broken links first, then undocumented public APIs, then stale descriptions. Batch the work across multiple commits.
149
+ - **When you are unsure whether a section is stale:** Check git blame for the section and compare against recent changes to the referenced files. If the section has not been updated since the referenced files changed, it is likely stale.
150
+ - **When the project has no AGENTS.md:** Escalate to the human. Creating an AGENTS.md from scratch is a significant decision about project structure and should be done intentionally, not automatically.
@@ -0,0 +1,31 @@
1
+ name: validate-context-engineering
2
+ version: "1.0.0"
3
+ description: Validate repository context engineering practices (AGENTS.md, doc coverage, knowledge map)
4
+ cognitive_mode: meticulous-verifier
5
+ triggers:
6
+ - manual
7
+ - on_pr
8
+ - on_commit
9
+ platforms:
10
+ - claude-code
11
+ - gemini-cli
12
+ tools:
13
+ - Bash
14
+ - Read
15
+ - Glob
16
+ cli:
17
+ command: harness skill run validate-context-engineering
18
+ args:
19
+ - name: path
20
+ description: Project root path
21
+ required: false
22
+ mcp:
23
+ tool: run_skill
24
+ input:
25
+ skill: validate-context-engineering
26
+ path: string
27
+ type: flexible
28
+ state:
29
+ persistent: false
30
+ files: []
31
+ depends_on: []
@@ -3,8 +3,8 @@ import {
3
3
  createProgram,
4
4
  findConfigFile,
5
5
  loadConfig
6
- } from "../chunk-LNI4T7R6.js";
7
- import "../chunk-3JWCBVUZ.js";
6
+ } from "../chunk-KJANDVVC.js";
7
+ import "../chunk-RT2LYQHF.js";
8
8
  import {
9
9
  VERSION,
10
10
  getUpdateNotification,
@@ -12,7 +12,7 @@ import {
12
12
  readCheckState,
13
13
  shouldRunCheck,
14
14
  spawnBackgroundCheck
15
- } from "../chunk-SJECMKSS.js";
15
+ } from "../chunk-E2RTDBMG.js";
16
16
  import {
17
17
  handleError
18
18
  } from "../chunk-ACMDUQJG.js";
@@ -805,13 +805,17 @@ var PHASE_PRIORITIES = {
805
805
  priority: 2
806
806
  },
807
807
  { category: "tests", patterns: ["tests/**/*.test.ts", "**/*.spec.ts"], priority: 3 },
808
- { category: "specs", patterns: ["docs/specs/**/*.md"], priority: 4 },
808
+ { category: "specs", patterns: ["docs/changes/*/proposal.md"], priority: 4 },
809
809
  { category: "config", patterns: ["package.json", "tsconfig.json"], priority: 5 }
810
810
  ],
811
811
  review: [
812
812
  { category: "diff", patterns: [], priority: 1 },
813
813
  // Diff is provided, not globbed
814
- { category: "specs", patterns: ["docs/specs/**/*.md", "docs/plans/**/*.md"], priority: 2 },
814
+ {
815
+ category: "specs",
816
+ patterns: ["docs/changes/*/proposal.md", "docs/plans/**/*.md"],
817
+ priority: 2
818
+ },
815
819
  { category: "learnings", patterns: [".harness/review-learnings.md"], priority: 3 },
816
820
  { category: "types", patterns: ["src/**/types.ts", "src/**/interfaces.ts"], priority: 4 },
817
821
  { category: "tests", patterns: ["tests/**/*.test.ts"], priority: 5 }
@@ -824,7 +828,11 @@ var PHASE_PRIORITIES = {
824
828
  { category: "types", patterns: ["src/**/types.ts"], priority: 5 }
825
829
  ],
826
830
  plan: [
827
- { category: "specs", patterns: ["docs/specs/**/*.md", "docs/plans/**/*.md"], priority: 1 },
831
+ {
832
+ category: "specs",
833
+ patterns: ["docs/changes/*/proposal.md", "docs/plans/**/*.md"],
834
+ priority: 1
835
+ },
828
836
  { category: "architecture", patterns: ["AGENTS.md", "docs/standard/**/*.md"], priority: 2 },
829
837
  { category: "handoffs", patterns: [".harness/handoff.md"], priority: 3 },
830
838
  { category: "types", patterns: ["src/**/types.ts", "src/**/interfaces.ts"], priority: 4 },
@@ -872,7 +880,7 @@ function resolveImportPath(importSource, fromFile, _rootDir) {
872
880
  if (!resolved.endsWith(".ts") && !resolved.endsWith(".tsx")) {
873
881
  resolved = resolved + ".ts";
874
882
  }
875
- return resolved;
883
+ return resolved.replace(/\\/g, "/");
876
884
  }
877
885
  function getImportType(imp) {
878
886
  if (imp.kind === "type") return "type-only";
@@ -885,9 +893,10 @@ async function buildDependencyGraph(files, parser, graphDependencyData) {
885
893
  edges: graphDependencyData.edges
886
894
  });
887
895
  }
888
- const nodes = [...files];
896
+ const nodes = files.map((f) => f.replace(/\\/g, "/"));
889
897
  const edges = [];
890
898
  for (const file of files) {
899
+ const normalizedFile = file.replace(/\\/g, "/");
891
900
  const parseResult = await parser.parseFile(file);
892
901
  if (!parseResult.ok) {
893
902
  continue;
@@ -900,7 +909,7 @@ async function buildDependencyGraph(files, parser, graphDependencyData) {
900
909
  const resolvedPath = resolveImportPath(imp.source, file, "");
901
910
  if (resolvedPath) {
902
911
  edges.push({
903
- from: file,
912
+ from: normalizedFile,
904
913
  to: resolvedPath,
905
914
  importType: getImportType(imp),
906
915
  line: imp.location.line
@@ -3847,7 +3856,7 @@ var CriticalPathResolver = class {
3847
3856
  return;
3848
3857
  }
3849
3858
  const lines = content.split("\n");
3850
- const relativePath = path.relative(this.projectRoot, filePath);
3859
+ const relativePath = path.relative(this.projectRoot, filePath).replace(/\\/g, "/");
3851
3860
  for (let i = 0; i < lines.length; i++) {
3852
3861
  const line = lines[i];
3853
3862
  if (!line.includes("@perf-critical")) continue;
@@ -7322,8 +7331,10 @@ function extractCrossFileRefs(finding) {
7322
7331
  }
7323
7332
  function normalizePath(filePath, projectRoot) {
7324
7333
  let normalized = filePath;
7334
+ normalized = normalized.replace(/\\/g, "/");
7335
+ const normalizedRoot = projectRoot.replace(/\\/g, "/");
7325
7336
  if (path8.isAbsolute(normalized)) {
7326
- const root = projectRoot.endsWith(path8.sep) ? projectRoot : projectRoot + path8.sep;
7337
+ const root = normalizedRoot.endsWith("/") ? normalizedRoot : normalizedRoot + "/";
7327
7338
  if (normalized.startsWith(root)) {
7328
7339
  normalized = normalized.slice(root.length);
7329
7340
  }
@@ -7331,7 +7342,7 @@ function normalizePath(filePath, projectRoot) {
7331
7342
  if (normalized.startsWith("./")) {
7332
7343
  normalized = normalized.slice(2);
7333
7344
  }
7334
- return path8.normalize(normalized);
7345
+ return normalized;
7335
7346
  }
7336
7347
  function followImportChain(fromFile, fileContents, maxDepth = 2) {
7337
7348
  const visited = /* @__PURE__ */ new Set();
@@ -7348,11 +7359,11 @@ function followImportChain(fromFile, fileContents, maxDepth = 2) {
7348
7359
  const importPath = match[1];
7349
7360
  if (!importPath.startsWith(".")) continue;
7350
7361
  const dir = path8.dirname(current.file);
7351
- let resolved = path8.join(dir, importPath);
7362
+ let resolved = path8.join(dir, importPath).replace(/\\/g, "/");
7352
7363
  if (!resolved.match(/\.(ts|tsx|js|jsx)$/)) {
7353
7364
  resolved += ".ts";
7354
7365
  }
7355
- resolved = path8.normalize(resolved);
7366
+ resolved = path8.normalize(resolved).replace(/\\/g, "/");
7356
7367
  if (!visited.has(resolved) && current.depth + 1 <= maxDepth) {
7357
7368
  queue.push({ file: resolved, depth: current.depth + 1 });
7358
7369
  }
@@ -7369,7 +7380,7 @@ async function validateFindings(options) {
7369
7380
  if (exclusionSet.isExcluded(normalizedFile, finding.lineRange) || exclusionSet.isExcluded(finding.file, finding.lineRange)) {
7370
7381
  continue;
7371
7382
  }
7372
- const absoluteFile = path8.isAbsolute(finding.file) ? finding.file : path8.join(projectRoot, finding.file);
7383
+ const absoluteFile = path8.isAbsolute(finding.file) ? finding.file : path8.join(projectRoot, finding.file).replace(/\\/g, "/");
7373
7384
  if (exclusionSet.isExcluded(absoluteFile, finding.lineRange)) {
7374
7385
  continue;
7375
7386
  }
@@ -8106,7 +8117,8 @@ var EmitInteractionInputSchema = z5.object({
8106
8117
  transition: TransitionSchema.optional()
8107
8118
  });
8108
8119
  function getStatePath() {
8109
- return path10.join(os.homedir(), ".harness", "update-check.json");
8120
+ const home = process.env["HOME"] || os.homedir();
8121
+ return path10.join(home, ".harness", "update-check.json");
8110
8122
  }
8111
8123
  function isUpdateCheckEnabled(configInterval) {
8112
8124
  if (process.env["HARNESS_NO_UPDATE_CHECK"] === "1") return false;