@nurix/etna 0.3.1 → 0.3.6

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: change-review
3
- description: Velocity analysis — produces commit heatmap, risk-zone identification (high churn + low guardrail coverage), stabilization signals, team distribution. Consumes `git-history`'s CSV output rather than reanalyzing commits. Use when planning where to invest in better guardrails or rules.
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
4
  tools: Read, Glob, Grep, Bash
5
5
  model: inherit
6
6
  plugins: [nurix-harness]
@@ -8,15 +8,15 @@ plugins: [nurix-harness]
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 guardrail coverage matches the risk.
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.
12
12
 
13
- You answer: "where should the tech lead invest in better guardrails or rules next?"
13
+ You answer: "where should the tech lead invest in better boundaries or rules next?"
14
14
 
15
15
  ## Before Starting
16
16
 
17
17
  1. If `./docs/memory/change-review.md` exists, read it for historical velocity snapshots, prior risk-zone flags, and known concentration risks.
18
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 `./docs/operations/guardrails.md` if it exists. Risk-zone scoring is "high churn + low guardrail coverage" — without guardrails, you can only produce a heatmap, not risk zones.
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
20
  4. Read `./docs/OWNERSHIP_INDEX.md` if it exists, to map churn to owning feature docs.
21
21
 
22
22
  ## Step 1: Velocity Heatmap
@@ -36,9 +36,9 @@ Trend column: ↑ rising, ↓ falling, → steady, ↑↑ sharply rising, ↓↓
36
36
 
37
37
  ## Step 2: Risk Zones
38
38
 
39
- For each module with high churn (top quartile in 1m window), check guardrail coverage:
39
+ For each module with high churn (top quartile in 1m window), check boundary coverage:
40
40
 
41
- - Does `docs/operations/guardrails.md` mention this module?
41
+ - Does any `docs/boundaries/` file **Bound** this module (name it in its **Bounds** line)?
42
42
  - Is the module's `owns` doc up to date? (cross-reference with maintenance agent's last drift check if available)
43
43
  - Does the module appear in `docs/routing.md`?
44
44
 
@@ -46,30 +46,30 @@ Flag risk zones: high churn × low coverage. These are where silent breakage is
46
46
 
47
47
  ## Step 3: Stabilization Signals
48
48
 
49
- Identify modules where 1-week and 1-month velocity are both decreasing. Candidates for reducing review overhead — fewer guardrails needed where churn is dropping.
49
+ 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
50
 
51
51
  ## Step 4: Team Distribution
52
52
 
53
53
  Per module, list which authors made the most commits in the 3-month window. Surface concentration risks:
54
54
 
55
55
  - One author > 70% of commits in a critical module → bus-factor flag
56
- - One author owns all changes touching a guardrail → review-coverage flag
56
+ - One author owns all changes touching a boundary → review-coverage flag
57
57
 
58
58
  ## Step 5: Report & Track
59
59
 
60
60
  ### Report format
61
61
 
62
62
  - **Velocity heatmap** (table above)
63
- - **Risk zones**: top 5 high-churn / low-coverage modules with specific guardrails to consider adding
63
+ - **Risk zones**: top 5 high-churn / low-coverage modules with specific boundaries to consider adding (via `boundary-mapper`)
64
64
  - **Stabilization signals**: modules where review overhead can decrease
65
65
  - **Concentration risks**: bus-factor and review-coverage flags
66
- - **Recommendations**: prioritized list — typically "add guardrail for X", "update routing.md to cover Y", "spread reviews of Z across more authors"
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"
67
67
 
68
68
  ### Update tracking
69
69
 
70
70
  1. Write snapshot to `docs/memory/change-review.md` with date and all four sections above
71
71
  2. Append items to `docs/history/backlog.md`:
72
- - `- **[P1]** No guardrail coverage for high-churn module \`src/{name}/\` — discovered by change-review`
72
+ - `- **[P1]** No boundary coverage for high-churn module \`src/{name}/\` — discovered by change-review`
73
73
  3. Report summary to the user
74
74
 
75
75
  ## Rules
@@ -77,5 +77,5 @@ Per module, list which authors made the most commits in the 3-month window. Surf
77
77
  - Prefer git-history's CSV as input; only fall back to direct `git log` analysis if no recent CSV exists
78
78
  - Read-only for source code
79
79
  - May write to `docs/memory/change-review.md` and `docs/history/backlog.md`
80
- - Risk-zone identification requires guardrails — if `guardrails.md` doesn't exist, produce heatmap only and tell the user that risk-zone scoring needs documented guardrails
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`)
81
81
  - A clean report (no risk zones) is valid for a low-churn, well-covered project
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: contract-monitor
3
- description: Post-implementation contract auditor. Scans the live codebase for violations of cross-module contracts documented in `docs/operations/guardrails.md` — unregistered entity types, string-coupled constants, cross-entity references without propagation, schema mismatches, undocumented endpoints. Run on request after significant merges. Pairs with the `introspect` skill (which runs pre-implementation).
3
+ description: Post-implementation contract auditor. Scans the live codebase for violations of the typed cross-module boundaries documented in `docs/boundaries/` — unregistered entity types, string-coupled constants, cross-entity references without propagation, schema mismatches, undocumented endpoints. Run on request after significant merges. Pairs with the `introspect` skill (which runs pre-implementation).
4
4
  tools: Read, Glob, Grep, Edit, Write, Bash
5
5
  model: inherit
6
6
  plugins: [nurix-harness]
@@ -12,21 +12,21 @@ You scan the codebase for cross-module contract violations. Where the `introspec
12
12
 
13
13
  ## Before Starting
14
14
 
15
- 1. Read `./docs/operations/guardrails.md` — this is your source of truth for which contracts exist. If it doesn't exist, stop and tell the user a guardrails doc is required.
15
+ 1. Read every file in `./docs/boundaries/` — this is your source of truth for which contracts exist. If the folder is missing or empty, stop and tell the user to baseline boundaries first via the `boundary-mapper` agent.
16
16
  2. If `./docs/memory/contract-monitor.md` exists, read it for known exceptions, historical violation counts, and patterns the user has chosen not to fix.
17
17
  3. If `./docs/routing.md` exists, read it for module ownership context.
18
18
 
19
19
  ## Scan
20
20
 
21
- For each guardrail section in `guardrails.md`:
21
+ For each boundary file in `docs/boundaries/`:
22
22
 
23
- 1. Parse the section — extract contract name, canonical source location, consumer paths, violation description, checklist (if any)
24
- 2. Scan the codebase for violations of that specific contract. Categories to check:
23
+ 1. Parse the file — extract the `[BOUNDARY: type · severity]` header, the **Bounds** (modules on each side), the **Shape** (transcribed contract or `file:line` pointer), the **Invariants**, the **Blast radius**, and the **Safe-change checklist**
24
+ 2. Scan the codebase for violations of that specific boundary. Categories to check:
25
25
  - **Unregistered entity types** — strings used as entity-type identifiers that aren't in the canonical array
26
26
  - **String-coupled constants** — raw string literals used where shared constant imports are required
27
27
  - **Cross-entity references without propagation** — storing entity A's slug/name/id by value in entity B without documented propagation
28
28
  - **Schema mismatches** — selectors accessing persisted fields without fallback defaults
29
- - **Undocumented API endpoints** — routes in code with no corresponding feature doc or guardrail entry
29
+ - **Undocumented API endpoints** — routes in code with no corresponding feature doc or `api`/`wire-contracts` boundary entry
30
30
  3. Verify by reading actual source files — never guess.
31
31
 
32
32
  ## Act
@@ -34,29 +34,29 @@ For each guardrail section in `guardrails.md`:
34
34
  For each violation:
35
35
 
36
36
  - **Mechanical fix** (missing constant import, missing fallback default, missing entry in canonical array) → fix it directly with an Edit
37
- - **Design-decision fix** (new entity type registration, new cross-entity propagation mechanism, schema migration) → append to `docs/history/backlog.md` as P0 or P1 with the specific guardrail and consumer paths
37
+ - **Design-decision fix** (new entity type registration, new cross-entity propagation mechanism, schema migration) → append to `docs/history/backlog.md` as P0 or P1 with the specific boundary and bounded modules
38
38
  - **Pre-existing exception** (recorded in `docs/memory/contract-monitor.md`) → skip silently; don't re-flag
39
39
 
40
40
  ## Report
41
41
 
42
42
  Present a structured report:
43
43
 
44
- | # | Guardrail | Violation | Location | Action taken |
45
- |---|-----------|-----------|----------|--------------|
44
+ | # | Boundary | Violation | Location | Action taken |
45
+ |---|----------|-----------|----------|--------------|
46
46
 
47
47
  Then update `docs/memory/contract-monitor.md` with:
48
48
  - Scan date
49
- - Violation counts per guardrail
49
+ - Violation counts per boundary
50
50
  - Items fixed mechanically (with file paths)
51
51
  - Items backlogged (with P-level and rationale)
52
52
  - New exceptions added (if any)
53
53
 
54
- ## Optional: extend guardrails
54
+ ## Optional: suggest a new boundary
55
55
 
56
- If you discover patterns in code that should be guardrails but aren't yet documented:
56
+ If you discover patterns in code that should be a typed boundary but aren't yet documented:
57
57
 
58
- 1. Surface the candidate guardrail to the user with a draft entry
59
- 2. Wait for approval before writing to `guardrails.md` — never add a guardrail unilaterally
58
+ 1. Surface the candidate boundary to the user with a draft (type, Bounds, Shape, suggested severity)
59
+ 2. Recommend running the `boundary-mapper` agent to formalize it — never write to `docs/boundaries/` yourself
60
60
 
61
61
  ## Rules
62
62
 
@@ -11,18 +11,18 @@ plugins: [nurix-harness]
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
13
  Out of scope (handled by sibling components):
14
- - **Code drifted from docs** (contract/guardrail violations in live code) → `contract-monitor` agent
15
- - **Pre-implementation impact analysis** (checking a plan against guardrails before coding) → `introspect` skill
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
16
16
 
17
17
  ## Before Starting
18
18
 
19
19
  1. If `./docs/memory/maintenance.md` exists, read it for last review state, ownership snapshots, high-churn paths, and known failure modes.
20
- 2. If `./docs/operations/guardrails.md` exists, read it for context on cross-module contracts the docs should reflect.
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
23
  ## Step 0: Regenerate Ownership Index
24
24
 
25
- If `./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.
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
26
 
27
27
  If the script doesn't exist, build the index inline:
28
28
 
@@ -4,7 +4,16 @@
4
4
 
5
5
  set -euo pipefail
6
6
 
7
- REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
7
+ # Resolve the repo root from this script's own location — it lives at either
8
+ # <root>/scripts/ (kit source) or <root>/.claude/scripts/ (installed into a
9
+ # project). Strip whichever suffix applies; works regardless of git or cwd,
10
+ # and stays correct when the harness sits in a monorepo subdirectory.
11
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
12
+ case "$SCRIPT_DIR" in
13
+ */.claude/scripts) REPO_ROOT="${SCRIPT_DIR%/.claude/scripts}" ;;
14
+ */scripts) REPO_ROOT="${SCRIPT_DIR%/scripts}" ;;
15
+ *) REPO_ROOT="$(dirname "$SCRIPT_DIR")" ;;
16
+ esac
8
17
  OUTPUT="$REPO_ROOT/docs/OWNERSHIP_INDEX.md"
9
18
  FEATURES_DIR="$REPO_ROOT/docs/features"
10
19
  TMP_OWNS=$(mktemp)
@@ -81,7 +90,7 @@ cat > "$OUTPUT" << 'HEADER'
81
90
  # Ownership Index
82
91
 
83
92
  > **Generated file** — do not edit manually.
84
- > Regenerate with: `bash scripts/build-ownership-index.sh`
93
+ > Regenerate with the `build-ownership-index.sh` script (the maintenance agent runs it).
85
94
 
86
95
  Machine-readable lookup table generated from feature doc frontmatter.
87
96
 
@@ -5,7 +5,16 @@
5
5
  set -euo pipefail
6
6
 
7
7
  DAYS="${1:-14}"
8
- REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
8
+ # Resolve the repo root from this script's own location — it lives at either
9
+ # <root>/scripts/ (kit source) or <root>/.claude/scripts/ (installed into a
10
+ # project). Strip whichever suffix applies; works regardless of git or cwd,
11
+ # and stays correct when the harness sits in a monorepo subdirectory.
12
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
13
+ case "$SCRIPT_DIR" in
14
+ */.claude/scripts) REPO_ROOT="${SCRIPT_DIR%/.claude/scripts}" ;;
15
+ */scripts) REPO_ROOT="${SCRIPT_DIR%/scripts}" ;;
16
+ *) REPO_ROOT="$(dirname "$SCRIPT_DIR")" ;;
17
+ esac
9
18
  FEATURES_DIR="$REPO_ROOT/docs/features"
10
19
  TMP_OWNS=$(mktemp)
11
20
  TMP_STALE=$(mktemp)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: documentation
3
- description: Create and maintain technical documentation. Use when the user asks to (1) baseline, audit, or reorganize docs — enforces an opinionated 6-folder structure (architecture, features, operations, history, memory, tests) with ownership frontmatter and scaffold files, (2) document a feature or module, (3) create or update a changelog entry, (4) document data flows or Redux state, (5) add to protected files, (6) create or update guardrails (cascading failure boundaries), (7) record an architecture decision (ADR), (8) create or update the project root README, (9) create or update a plan, or (10) co-author any technical doc. Triggers on "document this", "create docs", "update changelog", "baseline docs", "audit docs", "add to protected files", "guardrails", "ADR", "architecture decision", "root README", "plan".
3
+ description: Create and maintain technical documentation. Use when the user asks to (1) baseline, audit, or reorganize docs — enforces the opinionated v9 structure (architecture, features, operations, history, memory; + boundaries/, modules/, tests/ as the repo grows) with ownership frontmatter and scaffold files, (2) document a feature or module, (3) create or update a changelog entry, (4) document data flows or Redux state, (5) add to protected files, (6) provide the generic boundary-file template (typed-boundary *generation* is the `boundary-mapper` agent, not this skill), (7) record an architecture decision (ADR), (8) create or update the project root README, (9) create or update a plan, or (10) co-author any technical doc. Triggers on "document this", "create docs", "update changelog", "baseline docs", "audit docs", "add to protected files", "ADR", "architecture decision", "root README", "plan".
4
4
  plugins: [nurix-harness]
5
5
  ---
6
6
 
@@ -29,7 +29,7 @@ User request
29
29
  │
30
30
  ├─ "Add to protected files" ───────▶ Protected Files Template
31
31
  │
32
- ├─ "Create/update guardrails" ─────▶ Guardrails Template
32
+ ├─ "Create/update a boundary" ─────▶ boundary-mapper agent (this skill holds only the boundary-file template)
33
33
  │
34
34
  ├─ "Record architecture decision" ─▶ ADR Template
35
35
  │
@@ -46,7 +46,7 @@ User request
46
46
 
47
47
  ## Baseline Audit
48
48
 
49
- When asked to "baseline", "audit", or "review" docs, enforce the canonical 6-folder documentation structure. This is an opinionated reorganization — the target structure is non-negotiable.
49
+ When asked to "baseline", "audit", or "review" docs, enforce the canonical v9 documentation structure. This is an opinionated reorganization — the target structure is non-negotiable.
50
50
 
51
51
  ### Target Structure
52
52
 
@@ -54,24 +54,28 @@ When asked to "baseline", "audit", or "review" docs, enforce the canonical 6-fol
54
54
  docs/
55
55
  ├── README.md # Documentation root — quick links table, section index
56
56
  ├── structure.md # Authority map, folder rules, health log
57
- ├── CODEBASE_MAP.md # Auto-generated directory map (optional)
58
- ├── faq.md # Common issues (optional)
59
- ├── architecture/ # System-wide decisions, patterns, technical references
60
- │ ├── adr/ # Architecture Decision Records (numbered, immutable)
61
- │ └── core/ # Core module internals (auth, state, routing)
62
- ├── features/ # Living feature specs with ownership frontmatter
57
+ ├── routing.md # File-pattern → module/doc/agent map (scaled — see CLAUDE.md)
58
+ ├── OWNERSHIP_INDEX.md # Generated: code path → owning feature doc
59
+ ├── architecture/ # Cross-module design + the steering layer
60
+ │ │ # domain-model, glossary, non-goals, references, open-questions
61
+ │ └── adr/ # Architecture Decision Records (numbered, immutable)
62
+ ├── features/ # Flat default — feature specs with ownership frontmatter
63
63
  │ └── {feature}/ # Subfolder for deep features (e.g., editor/)
64
+ ├── modules/ # Graduation (≥2 bounded contexts) — NOT scaffolded at baseline
65
+ │ └── {module}/ # CLAUDE.md + features/ + pillars/ (module-local doctrine, lazy)
66
+ ├── boundaries/ # Typed application boundaries — generated by boundary-mapper
64
67
  ├── operations/ # Setup, development, deployment, CI/CD
65
- │ └── guardrails.md # Cascading failure boundaries (cross-module contracts)
66
68
  ├── history/ # Frozen/append-only records
67
69
  │ ├── CHANGELOG.md # Master changelog index
68
70
  │ ├── changelog/ # Individual changelog entries
69
71
  │ ├── plans/ # Historical implementation plans (Status field required)
70
72
  │ └── backlog.md # Tracked work items by priority (P0-P3)
71
- ├── memory/ # Agent memory files
73
+ ├── memory/ # Agent memory files (index.md = baseline record)
72
74
  └── tests/ # Test plans and automation docs (optional)
73
75
  ```
74
76
 
77
+ There is **no repo-wide `docs/pillars/`** (dissolved in v9 — pillars are module-local). `docs/boundaries/` is populated by the `boundary-mapper` agent (which the bootstrap runs immediately after this baseline), and `docs/modules/` appears only when the repo graduates to ≥2 bounded contexts — neither is scaffolded here. `docs/tests/` is optional and **author-maintained**: no agent, skill, or script owns it — create it only if test-plan or test-automation docs already exist, and never scaffold it empty.
78
+
75
79
  ### Workflow
76
80
 
77
81
  **Step 1: Inventory existing docs**
@@ -126,7 +130,6 @@ After approval:
126
130
  8. Scaffold standard files if missing:
127
131
  - `docs/README.md` — from template (see `references/templates.md`)
128
132
  - `docs/structure.md` — from template (see `references/templates.md`)
129
- - `docs/operations/guardrails.md` — cascading failure boundaries (see `references/templates.md` for what to include/exclude)
130
133
  - `docs/history/CHANGELOG.md` — master changelog index (header + table linking to entries)
131
134
  - `docs/history/backlog.md` — work items by priority (P0-P3 sections, empty if nothing to merge)
132
135
  - `docs/memory/index.md` — agent memory index (empty scaffold with section headers)
@@ -138,19 +141,19 @@ After approval:
138
141
 
139
142
  **Step 5: Verify**
140
143
 
141
- 1. Confirm all standard files exist: `docs/README.md`, `docs/structure.md`, `docs/operations/guardrails.md`, `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/index.md`, `docs/memory/main.md`, `docs/OWNERSHIP_INDEX.md`, `README.md` (repo root — must exist; either pre-existing untouched or freshly scaffolded)
144
+ 1. Confirm all standard files exist: `docs/README.md`, `docs/structure.md`, `docs/history/CHANGELOG.md`, `docs/history/backlog.md`, `docs/memory/index.md`, `docs/memory/main.md`, `docs/OWNERSHIP_INDEX.md`, `README.md` (repo root — must exist; either pre-existing untouched or freshly scaffolded). `docs/boundaries/` is the `boundary-mapper` agent's responsibility (the bootstrap runs it right after this baseline), not a scaffold target here.
142
145
  2. Confirm no dead links in `docs/README.md`
143
146
  3. Confirm every plan file has a `Status:` field
144
147
  4. Confirm feature docs have ownership frontmatter
145
148
  5. Confirm `docs/OWNERSHIP_INDEX.md` rows match the frontmatter on disk (no orphans, no missing entries)
146
- 6. Confirm no docs remain outside the 6-folder structure (except `README.md`, `structure.md`, `CODEBASE_MAP.md`, `faq.md`)
149
+ 6. Confirm no docs remain outside the v9 structure (except the docs-root files `README.md`, `structure.md`, `routing.md`, `OWNERSHIP_INDEX.md`)
147
150
  7. Confirm duplicates are eliminated — each topic has one canonical source
148
151
 
149
152
  ### Rules
150
153
 
151
- - The 6-folder structure is mandatory. No `docs/guides/`, `docs/core/`, `docs/editor/`, `docs/pt/`, or any other top-level folder
154
+ - The v9 structure is mandatory. No `docs/guides/`, `docs/core/`, `docs/editor/`, `docs/pt/`, no repo-wide `docs/pillars/` (dissolved in v9 — pillars are module-local under `docs/modules/{m}/pillars/`), or any other top-level folder beyond the v9 set
152
155
  - Guides about how-to-run → `operations/`. Guides about a feature → `features/`
153
- - Core module docs → `docs/architecture/core/`. Editor module docs → `docs/features/editor/`
156
+ - A genuine bounded context graduates to `docs/modules/{m}/` (owning `features/` + `pillars/`); ungraduated feature docs stay flat under `docs/features/` (deep features may nest, e.g. `docs/features/editor/`)
154
157
  - Only `CLAUDE.md`, `AGENTS.md`, and `README.md` are allowed in the repository root (not inside `docs/`)
155
158
  - Root-level `README.md` is for humans. `docs/README.md` is the agent/doc entry point
156
159
  - One canonical source per topic — link, don't copy
@@ -234,6 +237,6 @@ For docs that don't match templates:
234
237
 
235
238
  | File | Use For |
236
239
  |------|---------|
237
- | `references/templates.md` | docs/README.md, structure.md, frontmatter, scaffolds (CHANGELOG, backlog, memory, OWNERSHIP_INDEX), guardrails, feature, changelog, plan, protected files, ADR, project root README templates |
240
+ | `references/templates.md` | docs/README.md, structure.md, frontmatter, scaffolds (CHANGELOG, backlog, memory, OWNERSHIP_INDEX), boundary-file, feature, changelog, plan, protected files, ADR, project root README templates |
238
241
  | `references/style-guide.md` | Writing rules, formatting conventions |
239
242
  | `references/examples.md` | Good vs bad documentation examples |
@@ -86,8 +86,10 @@ Each topic has one canonical location. Read from here, not from plans or changel
86
86
 
87
87
  | Topic | Authority | Key Files |
88
88
  | ----- | --------- | --------- |
89
- | System architecture | `docs/architecture/` | {key files} |
90
- | Feature behavior | `docs/features/` | {key files} |
89
+ | System architecture + steering | `docs/architecture/` | domain-model, glossary, non-goals, references, adr/ |
90
+ | Feature behavior | `docs/features/` (or `docs/modules/{m}/features/`) | {key files} |
91
+ | Cross-module contracts | `docs/boundaries/` | one file per boundary (maintained by `boundary-mapper`) |
92
+ | Bounded contexts (graduated) | `docs/modules/{m}/` | `features/` + `pillars/` |
91
93
  | Setup & development | `docs/operations/` | {key files} |
92
94
  | Historical plans | `docs/history/plans/` | YYYY-MM-DD-name.md |
93
95
  | Change records | `docs/history/changelog/` | Individual entries |
@@ -104,7 +106,9 @@ Plan (Status: Draft) → Implementation → Feature Doc or Architecture Update
104
106
  ## Folder Rules
105
107
 
106
108
  - `docs/features/`: Living reference for implemented features. Each spec includes YAML frontmatter with `owns`, `touches`, `depends_on` fields declaring code ownership.
107
- - `docs/architecture/`: System-wide patterns and technical decisions. Update when cross-cutting concerns change.
109
+ - `docs/architecture/`: System-wide patterns and the cross-module steering layer (domain model, glossary, non-goals, references, ADRs). Update when cross-cutting concerns change.
110
+ - `docs/boundaries/`: Horizontal typed application boundaries — one file per cross-module contract. Generated/maintained by the `boundary-mapper` agent; read before touching a shape it defines.
111
+ - `docs/modules/{m}/`: Vertical bounded contexts (a graduation at ≥2 contexts). Each owns `features/` + module-local `pillars/` (doctrine, lazy). There is no repo-wide `docs/pillars/`.
108
112
  - `docs/operations/`: How-to procedures for setup, development, and deployment. Update when workflows change.
109
113
  - `docs/history/plans/`: Historical. Must have `Status:` field. Never modify after completion.
110
114
  - `docs/history/changelog/`: Historical. Append-only.
@@ -115,7 +119,7 @@ Plan (Status: Draft) → Implementation → Feature Doc or Architecture Update
115
119
  <!-- Updated by maintenance agent -->
116
120
  | Date | Review Summary |
117
121
  | ---- | -------------- |
118
- | {today} | Initial baseline — 6-folder structure established |
122
+ | {today} | Initial baseline — v9 structure established |
119
123
  ```
120
124
 
121
125
  ---
@@ -231,7 +235,8 @@ description: Shared knowledge accumulated across agent sessions. All agents shou
231
235
  ## Documentation Baseline
232
236
 
233
237
  - **Baselined:** {today}
234
- - **Structure:** 6-folder (architecture, features, operations, history, memory, tests)
238
+ - **Structure:** v9 (architecture, features, operations, history, memory; + boundaries/, modules/, tests/ when present)
239
+ - **Spec version:** v9
235
240
 
236
241
  ## Learnings
237
242
 
@@ -282,15 +287,15 @@ Auto-generated by the maintenance agent (Step 0). Do not edit by hand.
282
287
 
283
288
  ---
284
289
 
285
- ## 5. docs/operations/guardrails.md (Cascading Failure Boundaries)
290
+ ## 5. Boundary File (docs/boundaries/{boundary}.md)
286
291
 
287
- Use for: documenting contracts, shapes, and coupling points where a change in one module silently breaks another. Created during baseline audit. Updated when new cross-module contracts are discovered.
292
+ > **This skill does not generate boundaries.** Typed-boundary generation is owned by the **`boundary-mapper`** agent, which detects the stack + IA and applies its built-in Application Boundary Scale to emit typed files. The baseline does **not** scaffold `docs/boundaries/` — `boundary-mapper` runs right after the baseline ("baseline boundaries"). This section is the generic **boundary-file template** plus the guidance for *recognizing* what deserves a boundary.
288
293
 
289
- ### What belongs in guardrails
294
+ ### What deserves a boundary
290
295
 
291
- A guardrail is something where **the failure is silent and crosses module boundaries**. The developer working in module A has no reason to know that module B will break. No import error, no runtime exception — just wrong behavior.
296
+ A boundary is a **horizontal, cross-module contract** where the failure is silent and crosses module boundaries — the developer in module A has no reason to know module B will break. No import error, no runtime exception — just wrong behavior.
292
297
 
293
- Test: "If an agent edits this while working on a single feature, could it silently break something in a different feature?" If yes, it's a guardrail.
298
+ Test: "If an agent edits this while working on a single feature, could it silently break something in a different feature?" If yes, it's a boundary.
294
299
 
295
300
  **Include:**
296
301
 
@@ -308,14 +313,14 @@ Test: "If an agent edits this while working on a single feature, could it silent
308
313
 
309
314
  - Module-internal architecture (well-encapsulated, no cross-module blast radius)
310
315
  - Authentication/authorization flows (behind adapters, feature code doesn't touch them)
311
- - Hook taxonomies and API reference (useful docs, but not guardrails — they don't cause cascading failures)
316
+ - Hook taxonomies and API reference (useful docs, but not boundaries — they don't cause cascading failures)
312
317
  - Networking details (WebSocket, HTTP client setup) — unless the event routing has cross-module string coupling
313
318
  - Feature folder conventions and code style (conventions, not breakage vectors)
314
- - Anything where failure produces an import error, a clear runtime exception, or a visible UI error — those are self-diagnosing and don't need guardrails
319
+ - Anything where failure produces an import error, a clear runtime exception, or a visible UI error — those are self-diagnosing and don't need a boundary
315
320
 
316
- ### How to research guardrails
321
+ ### How to research a boundary
317
322
 
318
- When creating or updating `docs/operations/guardrails.md`, use sub-agents to investigate:
323
+ When mapping a boundary (the `boundary-mapper` agent's job — this guidance is shared), use sub-agents to investigate:
319
324
 
320
325
  1. **Shared state consumers** — For each Redux slice/context, find all files that read from it. Flag any file reading a slice it doesn't own (cross-module dependency).
321
326
  2. **String-coupled actions** — Grep for Redux action type strings referenced as raw strings rather than imported constants. These are invisible breakage points.
@@ -324,46 +329,29 @@ When creating or updating `docs/operations/guardrails.md`, use sub-agents to inv
324
329
  5. **Pipeline data dependencies** — For multi-step processes, check what each step reads from shared state and what previous step wrote it. Test: "If I reorder these steps, does it fail loudly or silently?"
325
330
  6. **Persistence rehydration** — Check what reconciler is used, whether transforms exist, and what happens to existing users when a persisted shape changes.
326
331
 
327
- ### Template
328
-
329
- ```markdown
330
- # Guardrails
331
-
332
- Things that silently break across modules if touched wrong. Each section explains what the contract is, where it's consumed, and what goes wrong if violated.
333
-
334
- ---
335
-
336
- ## 1. [Contract Name]
337
-
338
- [One-line description of what this contract governs.]
339
-
340
- ### The contract
332
+ ### Generic boundary-file template
341
333
 
342
- [Describe the shape, format, or protocol. Show code if it's a data shape.]
334
+ One file per boundary in `docs/boundaries/`. `boundary-mapper` emits typed files using the Application Boundary Scale; this is the generic fallback shape.
343
335
 
344
- ### Where it's consumed
345
-
346
- [Table or list of every file/module that depends on this contract.]
347
-
348
- ### What breaks if violated
349
-
350
- [Specific failure modes. "Silent data loss", "lookup returns undefined", "pipeline hangs", etc.]
351
-
352
- ### Checklist (if applicable)
353
-
354
- [Step-by-step list of files to touch when extending this contract. Mark which steps cause silent failures if skipped.]
336
+ ```markdown
337
+ # {Boundary Name}
355
338
 
356
- ---
339
+ [BOUNDARY: {type} · {severity}] <!-- type from the Application Boundary Scale; severity CRITICAL | HIGH | MED | LOW -->
357
340
 
358
- ## N. [Next Contract]
341
+ **Bounds:** {module A} ↔ {module B} <!-- which modules sit on each side -->
359
342
 
360
- ...
343
+ ## Shape
344
+ <!-- `transcribe`: a synthesized contract with no single code home (composed store tree, API envelope, the IA entity model, tenancy) — written inline, canonical here.
345
+ `point`: a self-locating shape (DB schema, route table) — a `file:line` pointer + invariants. Never copy a self-locating shape; it rots on the next change. -->
361
346
 
362
- ---
347
+ ## Invariants
348
+ <!-- The rules that must hold across the boundary. -->
363
349
 
364
- ## Reference: [Shapes / Enums / Defaults]
350
+ ## Blast radius
351
+ <!-- What breaks, and where, if an invariant is violated. -->
365
352
 
366
- [Put stable reference material (store shapes, entity defaults, API envelopes) at the bottom. These support the guardrails above but aren't guardrails themselves.]
353
+ ## Safe-change checklist
354
+ <!-- Ordered steps to change this contract without silent breakage. Mark steps that fail silently if skipped. -->
367
355
  ```
368
356
 
369
357
  ---
@@ -570,7 +558,7 @@ Brief description of what changed and why.
570
558
 
571
559
  Use for: every implementation plan. Plans are created here directly with `Status: Draft`, flip to `Status: In Progress` when work starts, and freeze at `Status: Complete` or `Status: Abandoned`. Once frozen, never edit — write a new dated plan if scope changes.
572
560
 
573
- The `introspect` skill parses the **Proposed Changes** sections to check guardrail impact. Keep that structure stable — section headings and bullet shape are load-bearing for the parser.
561
+ The `introspect` skill parses the **Proposed Changes** sections to check boundary impact. Keep that structure stable — section headings and bullet shape are load-bearing for the parser.
574
562
 
575
563
  ```
576
564
  # {Feature Name}
@@ -606,7 +594,7 @@ Why this work is happening *now*. Link to the spec for *what* we're building; th
606
594
 
607
595
  ### Cross-Module Contracts Affected
608
596
 
609
- - List which guardrails (from `docs/operations/guardrails.md`) this plan touches by name
597
+ - List which boundaries (from `docs/boundaries/`) this plan touches by name
610
598
  - "None" is a valid answer and means introspect will pass cleanly
611
599
 
612
600
  ## Implementation Steps