@nurix/etna 0.3.1 → 0.3.2

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: 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,13 +11,13 @@ 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
@@ -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 + `boundaries` skill, 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 (detects the stack + IA, emits typed files) and the **`boundaries`** skill (the per-technology Application Boundary Scale). 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
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: introspect
3
- description: Pre-implementation impact analyzer. Reads a plan in docs/history/plans/ and checks every Proposed Change against docs/operations/guardrails.md to surface cascading risks before coding starts. Produces a severity-ranked violation report with suggested plan additions. Read-only. Triggers on "introspect", "check this plan", "impact analysis", "/introspect", "what could break", "guardrail check before I start".
3
+ description: Pre-implementation impact analyzer. Reads a plan in docs/history/plans/ and checks every Proposed Change against the typed boundaries in docs/boundaries/ to surface cascading risks before coding starts. Produces a severity-ranked violation report with suggested plan additions. Read-only. Triggers on "introspect", "check this plan", "impact analysis", "/introspect", "what could break", "boundary check before I start".
4
4
  plugins: [nurix-harness]
5
5
  ---
6
6
 
7
7
  # Introspect Skill
8
8
 
9
- Pre-implementation impact analysis. Reads a plan, intersects every proposed change with documented guardrails, and surfaces cascading risk _before_ implementation. The complement to `contract-monitor`, which scans the live codebase _after_ changes land.
9
+ Pre-implementation impact analysis. Reads a plan, intersects every proposed change with the documented boundaries in `docs/boundaries/`, and surfaces cascading risk _before_ implementation. The complement to `contract-monitor`, which scans the live codebase _after_ changes land.
10
10
 
11
11
  The skill is read-only. It does not edit the plan, modify code, or write to memory. Output is a report the user reviews and acts on.
12
12
 
@@ -18,11 +18,11 @@ Trigger this skill when:
18
18
 
19
19
  - The user types `/introspect`, "introspect", "check this plan", "impact analysis", "what could break"
20
20
  - A plan exists in `docs/history/plans/` and the user is about to start implementation
21
- - A plan was recently revised and the user wants to re-check guardrail impact
21
+ - A plan was recently revised and the user wants to re-check boundary impact
22
22
 
23
23
  Do not run it when:
24
24
 
25
- - No `docs/operations/guardrails.md` exists — tell the user to create guardrails first via the documentation skill (`add guardrail`)
25
+ - No `docs/boundaries/` exists, or it's empty — tell the user to baseline the typed boundaries first via the `boundary-mapper` agent (`baseline boundaries`)
26
26
  - No plan exists — tell the user to write a plan first (documentation skill, `create plan`)
27
27
  - The user wants post-implementation auditing — that's the `contract-monitor` agent
28
28
 
@@ -31,7 +31,7 @@ Do not run it when:
31
31
  ## Inputs
32
32
 
33
33
  - **Plan path**: user-provided. If unspecified, use the most recent file in `docs/history/plans/` (sorted by filename date).
34
- - **Guardrails**: `docs/operations/guardrails.md` is mandatory. Stop if missing.
34
+ - **Boundaries**: every file in `docs/boundaries/` is mandatory input. Stop if the folder is missing or empty (suggest `boundary-mapper`).
35
35
  - **Source files**: read on demand to verify intersections — never guess from plan text alone.
36
36
 
37
37
  ---
@@ -43,7 +43,7 @@ Do not run it when:
43
43
  1. Resolve the plan path. If the user named a feature, glob `docs/history/plans/*{feature}*.md` and pick the newest.
44
44
  2. Read the plan in full.
45
45
  3. Confirm it has a `Status:` field. If `Complete` or `Abandoned`, ask the user whether they want to introspect a frozen plan anyway — it's usually a mistake.
46
- 4. Read `docs/operations/guardrails.md`. Parse each guardrail section into: name, canonical source location, consumer paths, violation description.
46
+ 4. Read every file in `docs/boundaries/`. For each boundary, parse the `[BOUNDARY: type · severity]` header plus: **Bounds** (the modules on each side of the contract), **Shape** (the transcribed contract, or a `file:line` pointer to self-locating code), **Invariants** (what must hold), **Blast radius** (what breaks if violated), and the **Safe-change checklist**. The severity (CRITICAL / HIGH / MED / LOW) sets the review depth for any change that touches that boundary.
47
47
 
48
48
  ### Phase 2: Parse Proposed Changes
49
49
 
@@ -51,25 +51,25 @@ The plan template's **Proposed Changes** subsections are load-bearing — intros
51
51
 
52
52
  | Subsection | What introspect uses it for |
53
53
  |------------|------------------------------|
54
- | **New Files** | New paths to check against ownership and guardrail consumer paths |
55
- | **Modified Files** | Existing paths to check against guardrails referencing them |
56
- | **New Entities / State** | Entity strings, state slices, schema additions — checked against entity-type and schema-mismatch guardrails |
57
- | **API Changes** | New or modified routes, contracts, request/response shapes — checked against documented contracts |
58
- | **Cross-Module Contracts Affected** | The plan author's own admission of contracts touched — start here, then verify |
54
+ | **New Files** | New paths to check against ownership and the modules each boundary **Bounds** |
55
+ | **Modified Files** | Existing paths to check against boundaries that **Bound** them |
56
+ | **New Entities / State** | Entity strings, state slices, schema additions — checked against the `domain` and `db-schema` boundaries |
57
+ | **API Changes** | New or modified routes, contracts, request/response shapes — checked against the `api` / `wire-contracts` boundaries |
58
+ | **Cross-Module Contracts Affected** | The plan author's own admission of boundaries touched — start here, then verify |
59
59
 
60
60
  If a subsection is missing or empty, note it in the report (the plan may be incomplete) but continue with what's there.
61
61
 
62
62
  ### Phase 3: Analyze
63
63
 
64
- For each guardrail × proposed change pair, check intersection:
64
+ For each boundary × proposed change pair, check intersection:
65
65
 
66
- 1. **Path overlap** — does the change touch any file in the guardrail's consumer-paths set?
67
- 2. **Pattern overlap** — does the change introduce code shapes the guardrail prohibits (raw string literal where a shared constant is required, new entity type not in the canonical array, persisted field without selector fallback)?
68
- 3. **Contract overlap** — does the change modify the canonical source of a guardrail (the `ENTITY_TYPES` array, the shared constants file, the persistence schema)?
66
+ 1. **Bounds overlap** — does the change touch any module the boundary **Bounds**, or any file its **Shape** pointer (`file:line`) locates?
67
+ 2. **Invariant overlap** — does the change introduce code shapes the boundary's **Invariants** prohibit (raw string literal where a shared constant is required, new entity type not in the canonical array, persisted field without selector fallback)?
68
+ 3. **Shape overlap** — does the change modify the canonical **Shape** of a boundary (the `ENTITY_TYPES` array, the shared constants file, the persistence schema, the API envelope)?
69
69
 
70
70
  Whenever an intersection is plausible from plan text, **read the actual source files** to verify. Never guess from plan text alone.
71
71
 
72
- Assign severity:
72
+ Assign severity. Anchor it to the **boundary's own severity** (it sets the floor), then adjust by the concrete risk this change carries — a change against a CRITICAL/HIGH boundary starts at that floor; downgrade only with a stated reason. The boundary's **Blast radius** is the evidence for the rating:
73
73
 
74
74
  - **Critical** — silent data loss, corrupted persistence, broken cross-entity references
75
75
  - **High** — stale state, broken lookups, schema selectors without fallbacks
@@ -84,13 +84,13 @@ Produce a markdown report:
84
84
  # Introspect — {plan filename}
85
85
 
86
86
  Plan: {path}
87
- Guardrails: {N} sections evaluated
87
+ Boundaries: {N} files evaluated
88
88
  Intersections found: {N} ({critical}/{high}/{medium}/{low})
89
89
 
90
90
  ## Violations
91
91
 
92
- | # | Guardrail | Risk | Severity | Plan step |
93
- |---|-----------|------|----------|-----------|
92
+ | # | Boundary | Risk | Severity | Plan step |
93
+ |---|----------|------|----------|-----------|
94
94
 
95
95
  ## Suggested Plan Additions
96
96
 
@@ -106,7 +106,7 @@ For each violation, a specific recommendation:
106
106
 
107
107
  ## New Cross-Module Contracts Detected
108
108
 
109
- {If the plan introduces a contract not yet in guardrails.md, show a diff-style proposed addition. Ask the user to approve adding it via the documentation skill — never write directly.}
109
+ {If the plan introduces a cross-cutting contract not yet in `docs/boundaries/`, describe the proposed boundary (type, Bounds, Shape, suggested severity) and recommend running the `boundary-mapper` agent to formalize it — never write a boundary file directly.}
110
110
  ```
111
111
 
112
112
  The severity-ranked table is the load-bearing output. Suggestions are advisory — the user decides which to fold back into the plan.
@@ -116,17 +116,17 @@ The severity-ranked table is the load-bearing output. Suggestions are advisory
116
116
  After producing the report:
117
117
 
118
118
  - If the user accepts a suggested plan addition, they edit the plan themselves (or invoke the documentation skill to do it). Introspect never edits plans.
119
- - If new contracts are detected, suggest invoking the documentation skill with `add guardrail` to formalize them — do not append to `guardrails.md` from this skill.
119
+ - If new contracts are detected, suggest running the `boundary-mapper` agent to formalize them as a typed boundary — do not write to `docs/boundaries/` from this skill.
120
120
 
121
121
  ---
122
122
 
123
123
  ## Rules
124
124
 
125
- - **Read-only**. Never edit the plan, source code, guardrails, or memory.
125
+ - **Read-only**. Never edit the plan, source code, boundaries, or memory.
126
126
  - **Verify against source**. Never report a violation purely from plan text — read the files the plan claims it will touch.
127
127
  - **Plan structure is load-bearing**. If a plan was not written using the documentation skill's plan template, the Proposed Changes subsections may be missing. Note this clearly rather than fabricating intersections.
128
128
  - **A clean report is valid**. Plans with no intersections produce an empty violations table — say so, don't pad.
129
- - **Be specific**. Cite file paths, plan-step numbers, guardrail names, and the exact code shape that breaks the contract.
129
+ - **Be specific**. Cite file paths, plan-step numbers, boundary names, and the exact code shape that breaks the contract.
130
130
  - **Don't replicate contract-monitor**. Introspect checks intent (plan text). Contract-monitor checks reality (code). If the user wants to scan live code, route them to contract-monitor.
131
131
 
132
132
  ---
@@ -20,11 +20,13 @@ Everything else happens **within** an active session, as natural conversation. T
20
20
 
21
21
  ## Folder layout
22
22
 
23
- ### Persistent pillars vs. session workspace (v8)
23
+ ### Persistent pillars vs. session workspace (v9)
24
24
 
25
- If the consuming repo has `docs/pillars/` (harnessed repos following the v8 three-peer-modes model — see [`nurix-harness/three-peer-modes.md`](../../docs/harness/nurix-harness/three-peer-modes.md)), the **persistent home** of pillars is `docs/pillars/`. Each brainstorming session opens a **transient working copy** at `./brainstorm/pillars/` (repo root, not inside `docs/`) that is *primed* from `docs/pillars/` on `/start`. The conversation mutates the working copy. On `/stop`, the harvest diffs the session pillars against `docs/pillars/` and writes the changes back (see Harvest destinations in `## stop` below).
25
+ In a v9-harnessed repo there is **no repo-wide `docs/pillars/`**. The persistent home of pillars is **dispersed by scope**: module-local doctrine / glossary / decisions live in each `docs/modules/{m}/pillars/`, and cross-module steering lives in `docs/architecture/` (`domain-model.md`, `glossary.md`, `non-goals.md`, `references.md`, `open-questions.md`). A change to the information architecture is captured as the `domain` boundary in `docs/boundaries/` (owned by the `boundary-mapper` agent, not written here).
26
26
 
27
- If `docs/pillars/` does **not** exist (legacy v7 repos, or first-time use), the skill creates `docs/pillars/` from the templates in this skill's `templates/` folder on first `/start`, so the harvest target exists by `/stop`.
27
+ Each brainstorming session still opens a **transient working copy** at `./brainstorm/pillars/` (repo root, not inside `docs/`) holding all ten pillar files — **that workspace and its templates are unchanged from v8**. On `/start` the working copy is *primed* from whatever dispersed v9 homes already exist (read the module pillars + the `docs/architecture/` steering files). The conversation mutates the working copy. On `/stop`, the harvest diffs the session pillars against the live docs and writes each change back **by scope** (see Harvest destinations in `## stop` below).
28
+
29
+ If none of those v9 homes exist yet (a freshly-baselined repo, or first-time use), the skill still runs the session from this skill's `templates/` folder; the harvest **creates** each destination file on `/stop`, so nothing needs to pre-exist.
28
30
 
29
31
  ### Session folder
30
32
 
@@ -309,21 +311,22 @@ The session is now in **Explore mode**. Resolution-style flows are opt-in from h
309
311
 
310
312
  6. **Refuse close on tentative (v8).** If step 4 didn't resolve every `STATUS: tentative` decision (commit / rescind / convert-to-backlog), block close and return to the conversation. Harvest does not run with unresolved tentatives.
311
313
 
312
- 7. **Harvest into `docs/pillars/` and v7/v8 destinations** (if the consuming repo has them — harnessed under v8). The harvest is a structured diff between the session pillars (`./brainstorm/pillars/*`) and the persistent pillars (`docs/pillars/*`). For each kind of mutation, write to the matching destination:
313
-
314
- | Session source | Persistent destination | Excerpt / propagation |
315
- |---|---|---|
316
- | `./brainstorm/pillars/doctrine.md` (additions / amendments) | `docs/pillars/doctrine.md` | Excerpt → `docs/architecture/overview.md §Doctrine`. If the principle names a cascading failure boundary, also propagate operational form to `docs/operations/guardrails.md`. |
317
- | `./brainstorm/pillars/glossary.md` | `docs/pillars/glossary.md` | Excerpt → `overview.md §Glossary`. |
318
- | `./brainstorm/pillars/non-goals.md` | `docs/pillars/non-goals.md` | Excerpt → `overview.md §Non-goals`. |
319
- | `./brainstorm/pillars/references.md` | `docs/pillars/references.md` | Excerpt → `overview.md §References`. |
320
- | `./brainstorm/pillars/inventory.md` | `docs/pillars/inventory.md` | If subsystems changed, also touch `overview.md §Subsystem index` and `OWNERSHIP_INDEX.md`. |
321
- | Committed decisions (`STATUS: committed` in `./brainstorm/pillars/decisions.md`) | New `docs/architecture/adr/NNN-{slug}.md` (one ADR per cohesive theme) + entry in `docs/pillars/decisions.md` | Add a row to `overview.md §Architecture decisions`. Rejected alternatives flow to `docs/pillars/rejected.md` + ADR §Alternatives. |
322
- | `./brainstorm/pillars/backlog.md` (new items) | `docs/history/backlog.md` (full operational tracking) | Update `docs/pillars/backlog.md` (steering view) headlines if a new bucket emerges. |
323
- | `./brainstorm/pillars/rejected.md` | `docs/pillars/rejected.md` | Referenced from ADR §Alternatives when tied to a committed decision. |
324
- | `./brainstorm/pillars/milestones.md` | `docs/pillars/milestones.md` | Mirror in `docs/structure.md §Health log` if the milestone is a structural change. |
325
- | `./brainstorm/pillars/questions.md` (still-open) | `docs/pillars/questions.md` | Each carries a *Resolution lands in* pointer. |
326
- | Plan docs (`NN-*.md` in session root) | `docs/history/plans/YYYY-MM-DD-{slug}.md` (Status: Draft) | Use the `documentation` skill's §8 Plan template format. |
314
+ 7. **Harvest into the v9 doc tree.** The harvest is a structured diff between the session pillars (`./brainstorm/pillars/*`) and the live docs, **routed by scope** — module-local findings to `docs/modules/{m}/pillars/`, cross-module to `docs/architecture/`, IA/contract changes to `docs/boundaries/` (via `boundary-mapper`), backlog to `docs/history/`. There is no single target and no repo-wide `docs/pillars/`. For each kind of mutation, write to the matching destination:
315
+
316
+ | Session source | v9 destination(s) |
317
+ |---|---|
318
+ | `./brainstorm/pillars/doctrine.md` (additions / amendments) | module-local → `docs/modules/{m}/pillars/doctrine.md`; cross-module → `docs/architecture/domain-model.md` |
319
+ | `./brainstorm/pillars/glossary.md` | module-local → `docs/modules/{m}/pillars/glossary.md`; cross-module → `docs/architecture/glossary.md` |
320
+ | `./brainstorm/pillars/non-goals.md` | `docs/architecture/non-goals.md` |
321
+ | `./brainstorm/pillars/references.md` | `docs/architecture/references.md` |
322
+ | `./brainstorm/pillars/inventory.md` | `docs/architecture/` (and regenerate `docs/OWNERSHIP_INDEX.md` if subsystems changed) |
323
+ | Committed decisions (`STATUS: committed` in `./brainstorm/pillars/decisions.md`) | 2+-module → new `docs/architecture/adr/NNN-{slug}.md` (one ADR per cohesive theme); module-local → `docs/modules/{m}/pillars/decisions.md`. Rejected alternatives flow to ADR §Alternatives. |
324
+ | IA / entity-model change, or a new cross-cutting contract, surfaced by a committed decision | the `domain` boundary `docs/boundaries/information-architecture.md` (or a new typed boundary) — **flag for the `boundary-mapper` agent; don't hand-write the boundary file** |
325
+ | `./brainstorm/pillars/backlog.md` (new items) | `docs/history/backlog.md` (P0–P3, full operational tracking) |
326
+ | `./brainstorm/pillars/rejected.md` | ADR §Alternatives when tied to a committed decision; else `docs/modules/{m}/pillars/rejected.md` |
327
+ | `./brainstorm/pillars/milestones.md` | `docs/architecture/` (mirror in `docs/structure.md §Health log` if the milestone is a structural change) |
328
+ | `./brainstorm/pillars/questions.md` (still-open) | `docs/architecture/open-questions.md` (each carries a *Resolution lands in* pointer) |
329
+ | Plan docs (`NN-*.md` in session root) | `docs/history/plans/YYYY-MM-DD-{slug}.md` (Status: Draft), using the `documentation` skill's §8 Plan template |
327
330
 
328
331
  Append a harvest changelog entry at `docs/history/changelog/YYYY-MM-DD-brainstorm-harvest-{slug}.md` listing what got written where. Then run `scripts/build-ownership-index.sh` and `scripts/check-doc-drift.sh` if present; surface any new findings.
329
332
 
@@ -331,7 +334,7 @@ The session is now in **Explore mode**. Resolution-style flows are opt-in from h
331
334
 
332
335
  9. **If versioned plan-doc drafts exist,** offer to prune older drafts. Default to keep.
333
336
 
334
- 10. Delete the session folder (`./brainstorm/` or `./plan/` — whichever was used). The persistent pillars in `docs/pillars/` are now updated; the next session primes from them.
337
+ 10. Delete the session folder (`./brainstorm/` or `./plan/` — whichever was used). The dispersed v9 homes (`docs/modules/*/pillars/`, `docs/architecture/`, and any `docs/boundaries/` flagged for `boundary-mapper`) are now updated; the next session primes from them.
335
338
 
336
339
  11. Print: "Run `/technical-brainstorm start` to resume."
337
340
 
@@ -13,7 +13,7 @@ keywords:
13
13
  plugin: kb-agi
14
14
  ---
15
15
 
16
- # nupilot Knowledge Hub — router
16
+ # nuStack Knowledge Hub — router
17
17
 
18
18
  This repo is a flat Obsidian vault that you read on the user's behalf. It's the bridge from the front (positioning, claims) to the back (product and service specs); detailed execution lives downstream in the service repos.
19
19
 
@@ -151,7 +151,7 @@ Upkeep is run by the kb-agi agents (invoked by name); there is no `meta/goals/`
151
151
  ````markdown
152
152
  # genre — Sales
153
153
 
154
- The reader is positioning nupilot to someone else: a prospect, a partner, a teammate who needs the pitch. They want the claim and the proof behind it, not the implementation.
154
+ The reader is positioning nuStack to someone else: a prospect, a partner, a teammate who needs the pitch. They want the claim and the proof behind it, not the implementation.
155
155
 
156
156
  **Default depth.** Start crisp. Lead with the answer in one or two sentences — what we can do, what makes it different — then offer the supporting detail rather than front-loading it. Go deeper only when the question reaches for it ("how exactly…", "what's underneath…").
157
157
 
@@ -213,7 +213,7 @@ This is a living index. It is hand-maintained today and kept fresh by the `kb-re
213
213
  ---
214
214
 
215
215
  ## "I want to understand the product"
216
- _What nupilot is, what it can do, the claims and their proof._
216
+ _What nuStack is, what it can do, the claims and their proof._
217
217
 
218
218
  - _populated on migration_
219
219