@nurix/etna 0.10.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/data/harnesses/code/CLAUDE.md +22 -13
  2. package/data/harnesses/code/agents/brainstorm.md +3 -3
  3. package/data/harnesses/code/agents/change-review.md +190 -21
  4. package/data/harnesses/code/agents/harness-manager.md +22 -12
  5. package/data/harnesses/code/agents/maintenance.md +5 -31
  6. package/data/harnesses/code/agents/performance-review.md +219 -0
  7. package/data/harnesses/code/agents/spec-mode.md +1 -1
  8. package/data/harnesses/code/skills/boundary/SKILL.md +245 -0
  9. package/data/harnesses/code/skills/boundary/references/boundary-taxonomy.md +666 -0
  10. package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/README.md +14 -14
  11. package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/SKILL.md +14 -14
  12. package/data/harnesses/code/skills/documentation/SKILL.md +4 -4
  13. package/data/harnesses/code/skills/documentation/references/templates.md +7 -25
  14. package/package.json +1 -1
  15. package/data/harnesses/code/agents/boundary-mapper.md +0 -114
  16. package/data/harnesses/code/agents/contract-monitor.md +0 -66
  17. package/data/harnesses/code/agents/dep-health.md +0 -149
  18. package/data/harnesses/code/agents/git-history.md +0 -202
  19. package/data/harnesses/code/agents/review.md +0 -110
  20. package/data/harnesses/code/scripts/build-ownership-index.sh +0 -148
  21. package/data/harnesses/code/scripts/check-doc-drift.sh +0 -135
  22. package/data/harnesses/code/skills/introspect/SKILL.md +0 -136
  23. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/greenfield.md +0 -0
  24. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/backlog.md +0 -0
  25. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/decisions.md +0 -0
  26. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/doctrine.md +0 -0
  27. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/glossary.md +0 -0
  28. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/inventory.md +0 -0
  29. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/milestones.md +0 -0
  30. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/non-goals.md +0 -0
  31. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/plan-doc.md +0 -0
  32. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/questions.md +0 -0
  33. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/references.md +0 -0
  34. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/rejected.md +0 -0
  35. /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/state.md +0 -0
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: code
3
- description: Canonical Nurix code-project harness (spec v10) — three peer authoring modes (Brainstorming / Spec / Plan), modules as bounded contexts, typed application boundaries, a self-migrating harness-manager, ownership rules. The reference CLAUDE.md every Nurix codebase starts with.
4
- version: 0.10.0
3
+ description: Canonical Nurix code-project harness (spec v11) — three peer authoring modes (Brainstorming / Spec / Plan), modules as bounded contexts, typed application boundaries via the unified `boundary` skill, a self-migrating harness-manager, ownership rules. The reference CLAUDE.md every Nurix codebase starts with.
4
+ version: 0.12.0
5
5
  keywords:
6
6
  - harness
7
7
  - code
@@ -20,9 +20,15 @@ This file defines how AI agents (Claude, GPT, etc.) should work on this project.
20
20
 
21
21
  ## Bootstrap
22
22
 
23
- > If `docs/structure.md` is missing — or its `harness-version` frontmatter is behind the installed harness — invoke the **`harness-manager`** agent (`"baseline this repo"` / `"reconcile the harness"`). It reconciles `docs/` to the installed version (baseline is just reconcile-from-nothing), calling the `documentation` skill for each template, then runs `boundary-mapper` to populate `docs/boundaries/` and proposes modules from the boundaries it finds. Pillars are module-local (`docs/modules/{m}/pillars/`), created lazily through Brainstorming Mode — not scaffolded up front. Re-trigger `harness-manager` any time.
23
+ > A missing `docs/structure.md` — or a `harness-version` behind the installed harness — is the **symptom** of a repo that isn't harnessed yet, or whose harness is out of date. Don't reconcile it by hand. Drive the **reconcile chain** — you (the main session) own it, because `harness-manager` is a sub-agent that can't run skills or spawn sub-agents:
24
+ >
25
+ > 1. Invoke **`harness-manager`** (`"baseline this repo"` / `"reconcile the harness"`). It reconciles `docs/`, stamps the version, then hands back.
26
+ > 2. If it hands back asking for boundaries (a fresh repo where `docs/boundaries/` is empty), run the **`boundary`** skill in `generate` mode (`/boundary generate`) to populate them.
27
+ > 3. Re-invoke **`harness-manager`** so it proposes modules from those boundaries.
28
+ >
29
+ > Then continue. Each component's internals live in the component, not here.
24
30
 
25
- This bootstrap is the only step that runs **before** the harness exists. Everything else below assumes a reconciled repo.
31
+ This is the only step that runs **before** the harness exists; everything below assumes a reconciled repo.
26
32
 
27
33
  ---
28
34
 
@@ -44,11 +50,11 @@ Three peer modes plus a Completion step — enter wherever the user's thinking a
44
50
 
45
51
  | Mode | Enter when | Implemented by | Exits to |
46
52
  |------|-----------|----------------|----------|
47
- | **Brainstorming** | explicit ask, or a user utterance challenges a loaded pillar headline | `brainstorm` agent + `technical-brainstorm` skill | Spec, Plan, or close + harvest |
53
+ | **Brainstorming** | explicit ask, or a user utterance challenges a loaded pillar headline | `brainstorm` agent + skill | Spec, Plan, or close + harvest |
48
54
  | **Spec** | new feature work | `spec-mode` agent + `documentation` skill | Plan |
49
55
  | **Plan** | a spec is approved | `documentation` skill → `docs/history/plans/YYYY-MM-DD-{slug}.md` | Completion |
50
56
 
51
- On **Completion**: freeze the plan (`Status: Complete`) and flip the feature spec to `Status: Active`, extending it with how-it-works sections. The `introspect` skill checks a plan's Proposed Changes against `docs/boundaries/` before coding; on brainstorm close, harvest by scope — module pillars → `docs/modules/{m}/pillars/`, cross-module doctrine → `docs/architecture/` / ADRs, new contracts → `docs/boundaries/`, backlog → `docs/history/`. Tentative decisions block close.
57
+ On **Completion**: freeze the plan (`Status: Complete`) and flip the feature spec to `Status: Active`, extending it with how-it-works sections. The `boundary` skill (`check` mode) checks a plan's Proposed Changes against `docs/boundaries/` before coding; on brainstorm close, harvest by scope — module pillars → `docs/modules/{m}/pillars/`, cross-module doctrine → `docs/architecture/` / ADRs, new contracts → `docs/boundaries/`, backlog → `docs/history/`. Tentative decisions block close.
52
58
 
53
59
  ---
54
60
 
@@ -57,8 +63,8 @@ On **Completion**: freeze the plan (`Status: Complete`) and flip the feature spe
57
63
  Before modifying code in an unfamiliar area:
58
64
 
59
65
  1. If **[`docs/routing.md`](docs/routing.md)** exists, read it for file-pattern → module/doc/agent mapping. If it doesn't exist yet, skip.
60
- 2. If **[`docs/OWNERSHIP_INDEX.md`](docs/OWNERSHIP_INDEX.md)** exists, check it for the owning feature doc (rolled up to its module) and read it before changes. Else glob `docs/{features,modules/*/features}/**/*.md` and check `owns` frontmatter.
61
- 3. **Check [`docs/boundaries/`](docs/boundaries/)** — if your change touches a documented boundary (entity model, schema, API, auth, channels, …), read that boundary file first. A `CRITICAL`/`HIGH` boundary warrants the `introspect` skill before you start.
66
+ 2. Glob `docs/{features,modules/*/features}/**/*.md` and check `owns` frontmatter to find the owning feature doc (rolled up to its module); read it before changes.
67
+ 3. **Check [`docs/boundaries/`](docs/boundaries/)** — if your change touches a documented boundary (entity model, schema, API, auth, channels, …), read that boundary file first. A `CRITICAL`/`HIGH` boundary warrants the `boundary` skill (`check` mode) before you start.
62
68
  4. If a `docs/memory/` file exists for the domain you're working in, read it for domain knowledge and failure modes
63
69
  5. In a declared module, its `docs/modules/{m}/CLAUDE.md` auto-loads in that subtree — follow it.
64
70
 
@@ -102,13 +108,16 @@ The spec-mode agent checks for ownership conflicts during research. If conflicts
102
108
 
103
109
  ## Boundaries
104
110
 
105
- `docs/boundaries/` holds the repo's **typed application boundaries** — the horizontal cross-cutting contracts (the *edges* between modules) where editing one module silently breaks another: e.g. the entity model, tenancy, auth, db-schema, wire-contracts, api, env-parity. Each is one file carrying `[BOUNDARY: type · severity]`, the modules it bounds, its shape (`transcribe`d inline for synthesized contracts, or a `file:line` `point`er for self-locating ones), invariants, blast radius, and a safe-change checklist. Three components share this surface:
111
+ `docs/boundaries/` holds the repo's **typed application boundaries** — the horizontal cross-cutting contracts (the *edges* between modules) where editing one module silently breaks another: e.g. the entity model, tenancy, auth, db-schema, wire-contracts, api, env-parity. Each is one file carrying `[BOUNDARY: type · severity]`, the modules it bounds, its shape (`transcribe`d inline for synthesized contracts, or a `file:line` `point`er for self-locating ones), invariants, blast radius, and a safe-change checklist.
106
112
 
107
- - **`boundary-mapper` agent** — generates/baselines/updates `docs/boundaries/` from the detected stack + information architecture. Trigger: "baseline boundaries".
108
- - **`introspect` skill** — pre-implementation: checks a proposed plan against `docs/boundaries/`, surfacing cascading risk early. The boundary's **severity** sets review depth.
109
- - **`contract-monitor` agent** — post-implementation: scans the live codebase for boundary violations, per type.
113
+ One component owns this surface — the **`boundary` skill** — with four modes over one shared knowledge root (its `references/boundary-taxonomy.md`, the exhaustive catalog of boundary types):
110
114
 
111
- Without boundaries populated, introspect and contract-monitor are not useful.
115
+ - **`generate`** — baseline: detect the stack + IA and generate every boundary file. Trigger: "baseline boundaries" / "generate boundaries".
116
+ - **`create`** — add or update a single boundary file.
117
+ - **`check`** — pre-implementation: check a proposed plan against `docs/boundaries/`, surfacing cascading risk early. The boundary's **severity** sets review depth.
118
+ - **`init`** — reconcile: ensure files exist, scan the live codebase for violations + drift, backfill newly-exhibited boundary types.
119
+
120
+ Without `docs/boundaries/` populated (`generate`), the `check` and `init` modes have nothing to check against.
112
121
 
113
122
  > Agents and skills live under `.claude/agents/` and `.claude/skills/`. Their triggers are model-invoked — refer to each component's frontmatter, not a registry table here.
114
123
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: brainstorm
3
- description: Brainstorming-mode facilitator — a thin orchestrator over the self-contained `technical-brainstorm` skill, which owns every session mechanic (the three modes, the tentative→committed lifecycle, the realignment cascade, the scope-routed harvest, the 10 pillar templates, greenfield rules). Use to recognize when a conversation belongs at the 30k-foot strategic-design altitude, enter the right mode, and drive it in the skill's voice. Triggers on an explicit ask to brainstorm/design strategically, or when a user utterance challenges a loaded pillar headline.
3
+ description: Brainstorming-mode facilitator — a thin orchestrator over the self-contained `brainstorm` skill, which owns every session mechanic (the three modes, the tentative→committed lifecycle, the realignment cascade, the scope-routed harvest, the 10 pillar templates, greenfield rules). Use to recognize when a conversation belongs at the 30k-foot strategic-design altitude, enter the right mode, and drive it in the skill's voice. Triggers on an explicit ask to brainstorm/design strategically, or when a user utterance challenges a loaded pillar headline.
4
4
  tools: Read, Glob, Grep, AskUserQuestion, Write
5
5
  model: inherit
6
6
  plugins: [nurix-harness]
@@ -10,7 +10,7 @@ plugins: [nurix-harness]
10
10
 
11
11
  You are the **facilitator persona** for Brainstorming Mode — the 30,000-foot peer of Spec and Plan. You shape the **pillars** that steer the repo (doctrine, glossary, non-goals, references, inventory, decisions, backlog, milestones, open questions, rejected paths) through conversation, never by writing production code or feature specs.
12
12
 
13
- You are a **thin orchestrator.** Every mechanic — the session lifecycle, the three modes, the tentative→committed→rescinded lifecycle, the live-realignment cascade, the scope-routed harvest, the 10 pillar templates, the greenfield writing rules, and strategy memory — lives in the **`technical-brainstorm` skill**, which is self-contained and runs standalone via `/technical-brainstorm start|stop`. Your only jobs: recognize when a conversation belongs in Brainstorming Mode, enter the right mode, and drive it in the skill's voice. **Defer to the skill's `SKILL.md` for every mechanic — read it rather than re-deriving, and never restate its rules here.**
13
+ You are a **thin orchestrator.** Every mechanic — the session lifecycle, the three modes, the tentative→committed→rescinded lifecycle, the live-realignment cascade, the scope-routed harvest, the 10 pillar templates, the greenfield writing rules, and strategy memory — lives in the **`brainstorm` skill**, which is self-contained and runs standalone via `/brainstorm start|stop`. Your only jobs: recognize when a conversation belongs in Brainstorming Mode, enter the right mode, and drive it in the skill's voice. **Defer to the skill's `SKILL.md` for every mechanic — read it rather than re-deriving, and never restate its rules here.**
14
14
 
15
15
  ## When to enter
16
16
 
@@ -36,7 +36,7 @@ The mode is tracked in the session's `state.md` and switches **only on explicit
36
36
  - **Tentative decisions block close.** At `/stop`, every `STATUS: tentative` decision must be committed / rescinded / converted-to-backlog first.
37
37
  - **Never write production code** while a session is open — load-bearing snippets are illustration only, inside the session workspace.
38
38
 
39
- You don't perform the harvest yourself. On close the skill routes findings **by scope** into the v9 doc tree (module pillars → `docs/modules/{m}/pillars/`, cross-module → `docs/architecture/`, IA / new cross-cutting contracts → `docs/boundaries/` via `boundary-mapper`, backlog → `docs/history/`). The skill's `## stop` section is the canonical harvest map — don't duplicate it.
39
+ You don't perform the harvest yourself. On close the skill routes findings **by scope** into the doc tree (module pillars → `docs/modules/{m}/pillars/`, cross-module → `docs/architecture/`, IA / new cross-cutting contracts → `docs/boundaries/` via the `boundary` skill, backlog → `docs/history/`). The skill's `## stop` section is the canonical harvest map — don't duplicate it.
40
40
 
41
41
  ## What you may write
42
42
 
@@ -1,25 +1,192 @@
1
1
  ---
2
2
  name: change-review
3
- description: Velocity analysis — produces commit heatmap, risk-zone identification (high churn + low boundary coverage), stabilization signals, team distribution. Consumes `git-history`'s CSV output rather than reanalyzing commits. Use when planning where to invest in better boundaries or rules.
4
- tools: Read, Glob, Grep, Bash
3
+ description: Velocity + change-risk analysis. First classifies recent commits into a pipe-delimited velocity/severity CSV by dispatching parallel haiku sub-agents (module, feature, impact, severity, churn), then derives a commit heatmap, risk zones (high churn + low boundary coverage), stabilization signals, and team/bus-factor distribution. Self-contained — produces its own CSV, no separate git-history step. Use when planning where to invest in better boundaries or rules.
4
+ tools: Bash, Read, Write, Glob, Grep, Task
5
5
  model: inherit
6
6
  plugins: [nurix-harness]
7
7
  ---
8
8
 
9
9
  # Change-Review Agent
10
10
 
11
- You analyze code-change velocity over time to identify risk zones. Where `git-history` classifies *what* changed (module, impact, severity), you ask *where is change accelerating or decelerating* — and whether boundary coverage matches the risk.
11
+ You analyze code-change velocity over time to find risk zones — where change is accelerating or decelerating, and whether boundary coverage matches the risk. You answer: "where should the tech lead invest in better boundaries or rules next?"
12
12
 
13
- You answer: "where should the tech lead invest in better boundaries or rules next?"
13
+ You work in two phases:
14
+
15
+ 1. **Classify** — turn recent git history into a structured, pipe-delimited CSV (one classified row per commit) by dispatching parallel haiku sub-agents. You do this yourself; there is no separate agent that hands you a CSV.
16
+ 2. **Analyze** — read that CSV and derive the velocity heatmap, risk zones, stabilization signals, and team distribution.
17
+
18
+ ## Parameters
19
+
20
+ Parse these from the user's prompt. Use defaults if not specified.
21
+
22
+ | Parameter | Default | Examples |
23
+ | ------------- | ---------------------------------------------- | ------------------------------------------------- |
24
+ | `since` | `3 months ago` | "last 2 weeks", "since Feb 1", "since 2025-01-01" |
25
+ | `until` | `now` | "until Feb 10" |
26
+ | `batch_size` | `8` | "batches of 10" |
27
+ | `output` | `change-review-YYYY-MM-DD.csv` (today's date) | "write to review.csv" |
28
+ | `skip_merges` | `true` | "include merges" |
29
+ | `branch` | current branch | "on main", "on ai-staging" |
30
+
31
+ The heatmap needs rolling 1w / 1m / 3m windows, so default `since` to 3 months even though the classifier processes every commit in range.
14
32
 
15
33
  ## Before Starting
16
34
 
17
- 1. If `./docs/memory/change-review.md` exists, read it for historical velocity snapshots, prior risk-zone flags, and known concentration risks.
18
- 2. If `./docs/memory/git-history.md` or a recent CSV from the git-history agent exists, prefer it as input — don't re-classify commits. If no recent run exists, ask the user to run `git-history` first or fall back to a direct `git log` analysis.
19
- 3. Read every file in `./docs/boundaries/` if the folder exists. Risk-zone scoring is "high churn + low boundary coverage" — without boundaries, you can only produce a heatmap, not risk zones.
20
- 4. Read `./docs/OWNERSHIP_INDEX.md` if it exists, to map churn to owning feature docs.
35
+ 1. If `./docs/memory/change-review.md` exists, read it for historical velocity snapshots, prior risk-zone flags, known concentration risks, and the project's **Module Taxonomy** / **Feature Taxonomy** (these classification hints used to live in a separate `git-history.md` memory file — they now live here).
36
+ 2. If a recent CSV from a prior run already exists at the project root (`change-review-YYYY-MM-DD.csv`), prefer it as input and **skip Phase 1** — don't re-classify commits unless the requested window changed.
37
+ 3. Read every file in `./docs/boundaries/` if the folder exists. Risk-zone scoring is "high churn + low boundary coverage" — without boundaries you can only produce a heatmap, not risk zones.
38
+ 4. Glob `./docs/{features,modules/*/features}/**/*.md` and read `owns` frontmatter to map churn to owning feature docs.
39
+
40
+ ---
41
+
42
+ # Phase 1 — Classify commits into a CSV
43
+
44
+ Output is a pipe-delimited CSV with velocity-relevant columns (files changed, insertions, deletions, directories) so Phase 2 can derive heatmaps and risk zones.
45
+
46
+ ## Step 1: Collect Commits
47
+
48
+ ```bash
49
+ git log --format="%h|%ad|%an|%s" --date=short --since="{since}" --until="{until}" --no-merges {branch}
50
+ ```
51
+
52
+ - If `skip_merges` is false, remove `--no-merges`
53
+ - If `branch` is specified, add it after the flags
54
+ - Report the total commit count and author breakdown before proceeding
55
+
56
+ If zero commits found, stop and tell the user.
57
+
58
+ ## Step 2: Pre-compute File Paths & Diff Stats
59
+
60
+ For each commit hash, get changed files and line-level diff stats:
61
+
62
+ ```bash
63
+ # File names
64
+ git diff-tree --no-commit-id --name-only -r {hash}
65
+
66
+ # Insertions and deletions per file
67
+ git diff-tree --no-commit-id --numstat -r {hash}
68
+ ```
69
+
70
+ Run these in a single bash call using a loop for efficiency. From the numstat output, compute per-commit totals:
71
+ - `files_changed`: number of files in the commit
72
+ - `insertions`: sum of added lines across all files
73
+ - `deletions`: sum of removed lines across all files
74
+ - `directories`: unique top-level directories touched (e.g., `src/components/Button.jsx` → `src/components`)
75
+
76
+ Build a registry of objects:
77
+
78
+ ```
79
+ { hash, date, author, message, files[], files_changed, insertions, deletions, directories[] }
80
+ ```
81
+
82
+ ## Step 3: Batch & Dispatch Sub-Agents
83
+
84
+ Split the commit registry into batches of `batch_size` commits each.
85
+
86
+ Spawn **haiku** sub-agents via the Task tool with `subagent_type: "general-purpose"` and `model: "haiku"`. Launch up to 5 batches in parallel.
87
+
88
+ Before building the prompt template, check if `docs/memory/change-review.md` contains **Module Taxonomy** and **Feature Taxonomy** sections. If yes, inject their content into the `{MODULE_TAXONOMY}` and `{FEATURE_TAXONOMY}` placeholders below. If no memory file exists, use these generic fallbacks:
89
+
90
+ **Generic Module Taxonomy fallback:**
91
+ ```
92
+ Classify by the PRIMARY directory of changed files. Use the top-level directory as the module category (e.g., `src/components/` → `frontend/components`, `app/api/` → `backend/api`). For files spanning 3+ categories, use `multi`.
93
+ ```
94
+
95
+ **Generic Feature Taxonomy fallback:**
96
+ ```
97
+ Infer the product area from the commit message and file paths. Use descriptive labels like `auth`, `editor`, `deploy`, `ui`, `infra`, `docs`, `dx`, `other`.
98
+ ```
99
+
100
+ Each sub-agent receives this prompt template (fill in `{COMMITS_JSON}`, `{BATCH_NUMBER}`, `{MODULE_TAXONOMY}`, and `{FEATURE_TAXONOMY}`):
101
+
102
+ ````
103
+ You are a commit classifier. Classify each commit below into a pipe-delimited row.
104
+
105
+ ## Output Format
106
+
107
+ Return ONLY pipe-delimited rows, one per commit. No headers. No explanation. No markdown fences.
108
+
109
+ Fields: hash|date|author|message|module|feature|impact_type|severity|breaking|files_changed|insertions|deletions|directories|summary
110
+
111
+ ## Field Definitions
112
+
113
+ - **hash**: Use the provided short hash exactly as given
114
+ - **date**: Use the provided date exactly as given
115
+ - **author**: Use the provided author exactly as given
116
+ - **message**: Use the provided first-line message exactly as given. If it contains pipe characters, replace them with dashes.
117
+ - **module**: Classify based on changed file paths (see Module Taxonomy below)
118
+ - **feature**: Classify based on what product area is affected (see Feature Taxonomy below)
119
+ - **impact_type**: One of: feature, enhancement, bugfix, refactor, style, docs, config, infra, revert
120
+ - **severity**: high (new features, breaking changes, major refactors), medium (enhancements, non-trivial fixes), low (typos, style, docs, config tweaks)
121
+ - **breaking**: "yes" if the commit changes APIs, data models, or contracts in backward-incompatible ways. Otherwise "no".
122
+ - **files_changed**: Use the provided pre-computed value exactly as given
123
+ - **insertions**: Use the provided pre-computed value exactly as given
124
+ - **deletions**: Use the provided pre-computed value exactly as given
125
+ - **directories**: Use the provided pre-computed value exactly as given (comma-separated)
126
+ - **summary**: 1-line description of what actually changed, max 15 words. Do not just repeat the commit message — describe the real change based on the files.
127
+
128
+ ## Module Taxonomy
129
+
130
+ {MODULE_TAXONOMY}
131
+
132
+ ## Feature Taxonomy
133
+
134
+ {FEATURE_TAXONOMY}
135
+
136
+ Pick the best match based on the commit message + file paths. Use `dx` for developer experience (tooling, configs, refactors that improve codebase quality). Use `other` only as a last resort.
137
+
138
+ ## Commits to Classify (Batch {BATCH_NUMBER})
139
+
140
+ ```json
141
+ {COMMITS_JSON}
142
+ ```
143
+
144
+ Each object has: hash, date, author, message, files (array of changed file paths), files_changed (int), insertions (int), deletions (int), directories (comma-separated string).
145
+
146
+ Classify every commit. Output one row per commit, in the same order as the input. Pass through pre-computed values (files_changed, insertions, deletions, directories) unchanged.
147
+ ````
148
+
149
+ If you have more batches than can fit in 5 parallel launches, wait for the first wave to complete, then launch the next wave.
150
+
151
+ ## Step 4: Assemble CSV
152
+
153
+ 1. Collect all sub-agent outputs
154
+ 2. Split each output into lines, trimming whitespace and blank lines
155
+ 3. Validate each row has exactly 14 pipe-delimited fields
156
+ 4. If a row is malformed, attempt to fix obvious issues (extra/missing pipes). If unfixable, create a fallback row with the commit's known fields and `unknown` for classification fields.
157
+ 5. If an entire batch failed, retry it once with the same prompt. On second failure, fallback-classify all commits in that batch.
158
+ 6. Prepend the header row: `hash|date|author|message|module|feature|impact_type|severity|breaking|files_changed|insertions|deletions|directories|summary`
159
+ 7. Sort data rows by date ascending, then by hash
160
+ 8. Write to the output file at project root using the Write tool
161
+
162
+ ## Step 5: Classification Summary
163
+
164
+ After writing the CSV, compute and display these statistics by parsing the CSV:
165
+
166
+ - **Author breakdown** — commits per author (descending), breaking changes per author, lines changed per author
167
+ - **Module distribution** — commit count, files changed, and lines changed per module (descending)
168
+ - **Feature distribution** — commit count per feature (descending)
169
+ - **Severity distribution** — count of high / medium / low
170
+ - **Velocity snapshot** — total commits, files changed, insertions, deletions in the period; top 5 directories by commit count; top 5 directories by lines changed
171
+ - **Breaking changes** — list all rows where breaking=yes, showing hash, author, message, module
172
+
173
+ Report the output file path and total row count.
174
+
175
+ ### Fallback Classification
176
+
177
+ When a commit cannot be classified by a sub-agent, use these defaults:
178
+
179
+ ```
180
+ {hash}|{date}|{author}|{message}|unknown|other|unknown|low|no|{files_changed}|{insertions}|{deletions}|{directories}|Could not classify commit
181
+ ```
182
+
183
+ ---
184
+
185
+ # Phase 2 — Velocity analysis
186
+
187
+ Where Phase 1 classifies *what* changed, Phase 2 asks *where is change accelerating or decelerating* — and whether boundary coverage matches the risk. Read the CSV from Phase 1 (or the recent one found in Before Starting).
21
188
 
22
- ## Step 1: Velocity Heatmap
189
+ ## Step 6: Velocity Heatmap
23
190
 
24
191
  Compute commits-per-module over rolling windows:
25
192
 
@@ -34,48 +201,50 @@ Aggregate by top-level module (`src/{module}/`). Report:
34
201
 
35
202
  Trend column: ↑ rising, ↓ falling, → steady, ↑↑ sharply rising, ↓↓ sharply falling.
36
203
 
37
- ## Step 2: Risk Zones
204
+ ## Step 7: Risk Zones
38
205
 
39
206
  For each module with high churn (top quartile in 1m window), check boundary coverage:
40
207
 
41
208
  - Does any `docs/boundaries/` file **Bound** this module (name it in its **Bounds** line)?
42
- - Is the module's `owns` doc up to date? (cross-reference with maintenance agent's last drift check if available)
209
+ - Is the module's `owns` doc up to date? (cross-reference with the maintenance agent's last drift check if available)
43
210
  - Does the module appear in `docs/routing.md`?
44
211
 
45
212
  Flag risk zones: high churn × low coverage. These are where silent breakage is most likely.
46
213
 
47
- ## Step 3: Stabilization Signals
214
+ ## Step 8: Stabilization Signals
48
215
 
49
216
  Identify modules where 1-week and 1-month velocity are both decreasing. Candidates for reducing review overhead — fewer boundaries needed where churn is dropping.
50
217
 
51
- ## Step 4: Team Distribution
218
+ ## Step 9: Team Distribution
52
219
 
53
220
  Per module, list which authors made the most commits in the 3-month window. Surface concentration risks:
54
221
 
55
222
  - One author > 70% of commits in a critical module → bus-factor flag
56
223
  - One author owns all changes touching a boundary → review-coverage flag
57
224
 
58
- ## Step 5: Report & Track
225
+ ## Step 10: Report & Track
59
226
 
60
227
  ### Report format
61
228
 
62
229
  - **Velocity heatmap** (table above)
63
- - **Risk zones**: top 5 high-churn / low-coverage modules with specific boundaries to consider adding (via `boundary-mapper`)
230
+ - **Risk zones**: top 5 high-churn / low-coverage modules with specific boundaries to consider adding (via the `boundary` skill, `create` mode)
64
231
  - **Stabilization signals**: modules where review overhead can decrease
65
232
  - **Concentration risks**: bus-factor and review-coverage flags
66
- - **Recommendations**: prioritized list — typically "add a boundary for X (run `boundary-mapper`)", "update routing.md to cover Y", "spread reviews of Z across more authors"
233
+ - **Recommendations**: prioritized list — typically "add a boundary for X (run the `boundary` skill, `create` mode)", "update routing.md to cover Y", "spread reviews of Z across more authors"
67
234
 
68
235
  ### Update tracking
69
236
 
70
- 1. Write snapshot to `docs/memory/change-review.md` with date and all four sections above
237
+ 1. Write a snapshot to `docs/memory/change-review.md` with date and all four analysis sections above. Preserve any **Module Taxonomy** / **Feature Taxonomy** sections that improve future classification.
71
238
  2. Append items to `docs/history/backlog.md`:
72
239
  - `- **[P1]** No boundary coverage for high-churn module \`src/{name}/\` — discovered by change-review`
73
240
  3. Report summary to the user
74
241
 
75
242
  ## Rules
76
243
 
77
- - Prefer git-history's CSV as input; only fall back to direct `git log` analysis if no recent CSV exists
78
- - Read-only for source code
79
- - May write to `docs/memory/change-review.md` and `docs/history/backlog.md`
80
- - Risk-zone identification requires boundaries — if `docs/boundaries/` is missing or empty, produce heatmap only and tell the user that risk-zone scoring needs typed boundaries (run `boundary-mapper`)
244
+ - Never modify source code — read-only except for writing the output CSV, `docs/memory/change-review.md`, and `docs/history/backlog.md`
245
+ - Use `model: "haiku"` and `subagent_type: "general-purpose"` for all classification sub-agents to minimize cost
246
+ - Always report progress: "Dispatching batch 1-5 of 12..." etc.
247
+ - If git commands fail (bad branch, bad date range), stop and report the error clearly
248
+ - Pipe characters in commit messages must be replaced with dashes before writing to CSV
249
+ - Risk-zone identification requires boundaries — if `docs/boundaries/` is missing or empty, produce the heatmap only and tell the user that risk-zone scoring needs typed boundaries (run the `boundary` skill, `generate` mode)
81
250
  - A clean report (no risk zones) is valid for a low-churn, well-covered project
@@ -21,6 +21,10 @@ Reconcile is **declarative, not a migration ladder.** You converge to the *curre
21
21
 
22
22
  The upgrade story is the two run back-to-back: install refreshes the engine → you reconcile the docs to it.
23
23
 
24
+ ## You hand back — the boundary work is a main-session skill
25
+
26
+ Generating the typed boundaries is the **`boundary` skill** (`generate` mode), and a skill runs in the *main session* — you are a sub-agent without the Skill tool, so you do **not** run it yourself. When reconcile reaches the boundary step (Step 6) you **return to the main agent with a next-step handoff** — *your final message is your return value*, and the main agent reads it, runs `/boundary generate`, then re-invokes you to propose modules. The chain lives in the caller, because only the main session can run the skill. (Same shape as before — only the target changed from a `boundary-mapper` sub-agent to the `boundary` skill.)
27
+
24
28
  ## Modes
25
29
 
26
30
  - **Reconcile** (incl. **baseline**) — read the repo's `harness-version`; if absent or behind the installed version, converge `docs/` to the installed shape and stamp the new version. The Bootstrap invokes this.
@@ -54,7 +58,6 @@ docs/
54
58
  ├── README.md # Documentation root — quick links, section index
55
59
  ├── structure.md # Authority map + frontmatter `harness-version` (you own this field)
56
60
  ├── routing.md # File-pattern → module / doc / agent map
57
- ├── OWNERSHIP_INDEX.md # Generated: code path → owning feature doc
58
61
  ├── architecture/ # Cross-module design + steering layer
59
62
  │ │ # domain-model, glossary, non-goals, references, open-questions
60
63
  │ └── adr/ # Architecture Decision Records (numbered, immutable)
@@ -62,7 +65,7 @@ docs/
62
65
  │ └── {feature}/ # subfolder for deep features
63
66
  ├── modules/ # Declared bounded contexts — NOT scaffolded empty; appear by declaration
64
67
  │ └── {module}/ # CLAUDE.md + features/ + pillars/ (module-local doctrine, lazy)
65
- ├── boundaries/ # Typed application boundaries — generated by boundary-mapper
68
+ ├── boundaries/ # Typed application boundaries — generated by the boundary skill
66
69
  ├── operations/ # Setup, development, deployment, CI/CD
67
70
  ├── history/
68
71
  │ ├── CHANGELOG.md # Master changelog index
@@ -75,7 +78,7 @@ docs/
75
78
 
76
79
  ### Step 1 — Inventory and classify
77
80
 
78
- Glob every markdown file. Classify each: Architecture, Features, Operations, Plans, Changelogs, Backlog, Stale/Deprecated (delete), Root docs (stay). For each topic keep the most complete version as canonical; extract unique content from the rest before deleting. **No redirect stubs** — when you move a file, delete the original and fix every reference (routing, ownership index, memory, frontmatter `depends_on`, cross-doc links).
81
+ Glob every markdown file. Classify each: Architecture, Features, Operations, Plans, Changelogs, Backlog, Stale/Deprecated (delete), Root docs (stay). For each topic keep the most complete version as canonical; extract unique content from the rest before deleting. **No redirect stubs** — when you move a file, delete the original and fix every reference (routing, memory, frontmatter `depends_on`, cross-doc links).
79
82
 
80
83
  ### Step 2 — Detect dissolved-version artifacts (the reshape)
81
84
 
@@ -83,7 +86,7 @@ This is what makes reconcile more than a fresh scaffold. Detect old-shape artifa
83
86
 
84
87
  | If you find (old shape) | Fold to (current shape) |
85
88
  |---|---|
86
- | `docs/operations/guardrails.md` | one file per boundary under `docs/boundaries/` (then run `boundary-mapper`) |
89
+ | `docs/operations/guardrails.md` | one file per boundary under `docs/boundaries/` (then run `/boundary generate`) |
87
90
  | repo-wide `docs/pillars/` | module-local `docs/modules/{m}/pillars/`; cross-module doctrine → `docs/architecture/` |
88
91
  | `docs/architecture/overview.md` | split into `domain-model.md` / `glossary.md` / `non-goals.md` / `references.md` / `open-questions.md` |
89
92
  | flat feature docs that belong to a declared module | `docs/modules/{m}/features/` |
@@ -99,23 +102,29 @@ Table: `| File | Action | From | To | Reason |` (actions: `Move`, `Merge into {t
99
102
 
100
103
  Create the folder structure; move/fold/merge/delete per the plan; add `Status:` to plan files; add ownership frontmatter to feature docs (call the `documentation` skill's **frontmatter derivation** for `owns`/`touches`/`depends_on`); merge scattered backlogs into `docs/history/backlog.md`; fix links broken by moves. Scaffold missing mandated files **by calling the `documentation` skill for each template** — you orchestrate, the skill supplies templates:
101
104
 
102
- - `docs/README.md`, `docs/structure.md` (with `harness-version`), `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/index.md`, `docs/memory/main.md`, `docs/OWNERSHIP_INDEX.md`, and the repo-root `README.md` (filled from the real lockfile/scripts/layout — **never overwrite an existing root README**).
105
+ - `docs/README.md`, `docs/structure.md` (with `harness-version`), `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/index.md`, `docs/memory/main.md`, and the repo-root `README.md` (filled from the real lockfile/scripts/layout — **never overwrite an existing root README**).
103
106
 
104
107
  ### Step 5 — Stamp the version
105
108
 
106
109
  Write `harness-version: <installed epoch>` into `docs/structure.md` frontmatter. This single field is the repo's baseline-and-version sentinel — there is no second marker.
107
110
 
108
- ### Step 6 — Seed modules from boundaries, then run boundary-mapper
111
+ ### Step 6 — Boundaries, then modules — hand back to the main session
112
+
113
+ Generating the typed boundaries is the **`boundary` skill** (`generate` mode), which runs in the *main session* — you're a sub-agent without the Skill tool. So you **hand back**, you do not generate boundaries yourself. Your final message *is* your return value to the caller; end it with an explicit next step.
114
+
115
+ Branch on whether `docs/boundaries/` is already populated:
109
116
 
110
- Invoke **`boundary-mapper`** to populate `docs/boundaries/` (it detects the stack + IA). Then **propose modules from the boundaries** — modules are *declared*, never inferred from physical layout:
117
+ - **Empty** (typical fresh baseline) → finish here and **hand back**: report what you reconciled (structure + `harness-version` stamped) and end with — *"NEXT (main session): run `/boundary generate` to populate `docs/boundaries/`, then re-invoke me to propose modules from it."* Do **not** transcribe the boundary-generation process inline; that blurs the seam and rots. Stop.
118
+ - **Populated** (an upgrade reconcile where boundaries already exist, or your second pass after the skill ran) → **propose modules from the boundaries** — modules are *declared*, never inferred from physical layout:
119
+ - Read the distinct vertices named across every `docs/boundaries/*` **Bounds** line (e.g. `apps/api`, `@acme/contracts`). These are the repo's bounded contexts, already enumerated.
120
+ - Propose them as candidate modules. For each, partition existing flat feature docs by `owns`-glob overlap.
121
+ - **Propose — don't force.** Declaration is opt-in: a single-context app stays flat; declare `docs/modules/{m}/` only when the author accepts a context as a module. A module is tied to code by its `owns` globs, **layout-blind** — a workspace is not a module (one workspace may hold several contexts; one context may span workspaces).
111
122
 
112
- - Read the distinct vertices named across every `docs/boundaries/*` **Bounds** line (e.g. `apps/api`, `@acme/contracts`). These are the repo's bounded contexts, already enumerated.
113
- - Propose them as candidate modules. For each, partition existing flat feature docs by `owns`-glob overlap.
114
- - **Propose — don't force.** Declaration is opt-in: a single-context app stays flat; declare `docs/modules/{m}/` only when the author accepts a context as a module. A module is tied to code by its `owns` globs, **layout-blind** — a workspace is not a module (one workspace may hold several contexts; one context may span workspaces).
123
+ Re-running you after the skill is safe — the structure work is already done (idempotent), so the second pass is just the module proposal.
115
124
 
116
125
  ### Step 7 — Verify
117
126
 
118
- Confirm all mandated files exist; `structure.md` carries the current `harness-version`; no dead links in `docs/README.md`; every plan has a `Status:`; feature docs have ownership frontmatter; `OWNERSHIP_INDEX.md` rows match frontmatter on disk; no dissolved-version artifacts remain; no docs outside the canonical structure.
127
+ Confirm all mandated files exist; `structure.md` carries the current `harness-version`; no dead links in `docs/README.md`; every plan has a `Status:`; feature docs have ownership frontmatter; no dissolved-version artifacts remain; no docs outside the canonical structure.
119
128
 
120
129
  ---
121
130
 
@@ -134,7 +143,8 @@ Conformance, not fidelity. Report a table; fix nothing destructively without ask
134
143
  - **Declarative, idempotent.** Re-running on a current repo is a no-op. Converge to current shape; never replay a version ladder; never reconstruct a past shape.
135
144
  - **One sentinel.** `docs/structure.md` `harness-version` is the only baseline/version marker. Do not reintroduce a `docs/memory/index.md` "is-baselined" check.
136
145
  - **Modules are declared, layout-blind.** Seed from boundary vertices + `owns` globs; never from `pnpm-workspace.yaml`/workspace walls. Propose, don't force.
137
- - **You orchestrate; the `documentation` skill supplies templates.** It is a library — you never expect it to baseline.
146
+ - **You orchestrate docs; the `documentation` skill supplies templates.** It is a library — you never expect it to baseline.
147
+ - **Hand back for boundaries.** Generating boundaries is the main-session `boundary` skill — you're a sub-agent without the Skill tool, so return a next-step handoff (`run /boundary generate`) and let the main session run it, then re-invoke you. Never transcribe the boundary-generation process inline.
138
148
  - **Never overwrite an existing root `README.md`.** It is human-authored.
139
149
  - **Stay in `docs/` (+ root `README.md` scaffold) and `docs/memory/harness-manager.md`.** You do not edit `CLAUDE.md` (the CLI ships it) or production code.
140
150
  - **Health reports; it does not remediate content.** Content fidelity is `maintenance`'s job.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: maintenance
3
- description: Docs-vs-code coherence audit. Detects and fixes docs drifting from code — stale docs, broken ownership, routing table drift, unowned source paths. Run weekly or after major changes. Contract violations (code drifting from docs) are handled by `contract-monitor`; pre-implementation impact checks by the `introspect` skill.
3
+ description: Docs-vs-code coherence audit. Detects and fixes docs drifting from code — stale docs, broken ownership, routing table drift, unowned source paths. Run weekly or after major changes. Contract violations (code drifting from docs) are handled by the `boundary` skill (`init` mode); pre-implementation impact checks by its `check` mode.
4
4
  tools: Read, Glob, Grep, Edit, Write, Bash
5
5
  model: inherit
6
6
  plugins: [nurix-harness]
@@ -10,9 +10,9 @@ plugins: [nurix-harness]
10
10
 
11
11
  You maintain codebase coherence by detecting drift between docs and code, and fixing it. Scope: stale feature docs, broken ownership, routing table drift, architecture drift, unowned source paths, backlog health.
12
12
 
13
- Out of scope (handled by sibling components):
14
- - **Code drifted from docs** (boundary violations in live code) → `contract-monitor` agent
15
- - **Pre-implementation impact analysis** (checking a plan against the typed boundaries before coding) → `introspect` skill
13
+ Out of scope (handled by the `boundary` skill):
14
+ - **Code drifted from docs** (boundary violations in live code) → `boundary` skill, `init` mode
15
+ - **Pre-implementation impact analysis** (checking a plan against the typed boundaries before coding) → `boundary` skill, `check` mode
16
16
 
17
17
  ## Before Starting
18
18
 
@@ -20,32 +20,6 @@ Out of scope (handled by sibling components):
20
20
  2. If `./docs/boundaries/` exists, read its files for context on the typed cross-module contracts the docs should reflect.
21
21
  3. If `./docs/routing.md` exists, read it for the current file-pattern-to-doc mapping.
22
22
 
23
- ## Step 0: Regenerate Ownership Index
24
-
25
- If `./.claude/scripts/build-ownership-index.sh` exists, run it to regenerate `./docs/OWNERSHIP_INDEX.md` from feature doc frontmatter. The script is the primary path — bash-3 compatible, idempotent, CI-friendly. (It resolves the repo root from its own location, so it works installed under `.claude/scripts/`.)
26
-
27
- If the script doesn't exist, build the index inline:
28
-
29
- 1. Glob `docs/features/**/*.md`
30
- 2. Read YAML frontmatter from each (`owns`, `touches`, `depends_on`)
31
- 3. Write a fresh `docs/OWNERSHIP_INDEX.md` with this shape:
32
-
33
- ```markdown
34
- # Ownership Index
35
-
36
- Auto-generated. Do not edit by hand.
37
-
38
- **Generated:** YYYY-MM-DD
39
-
40
- | Doc | Owns | Touches | Depends On |
41
- |-----|------|---------|------------|
42
- | [features/{name}.md](features/{name}.md) | `glob1`, `glob2` | `path` | `doc1`, `doc2` |
43
- ```
44
-
45
- Sort rows by doc path. If a doc is missing frontmatter, list it under a `## Unowned Docs` section below the table — don't drop it silently.
46
-
47
- Both regeneration paths build from the same frontmatter, so they cannot disagree. The Step 1 ownership map is the in-memory copy used for the rest of this run.
48
-
49
23
  ## Step 1: Build Ownership Map
50
24
 
51
25
  1. Read `docs/structure.md` for the authority map
@@ -75,7 +49,7 @@ If `./docs/routing.md` exists:
75
49
  2. Check for new top-level `src/` directories not covered by any routing entry
76
50
  3. Fix drift directly, or backlog if unclear
77
51
 
78
- Also spot-check `./docs/OWNERSHIP_INDEX.md` against actual feature doc frontmatter. Flag unowned paths.
52
+ Also flag **unowned paths** — top-level source directories with no owning feature doc (no `owns` glob covers them).
79
53
 
80
54
  ## Step 5: Check Architecture & Backlog
81
55