@nurix/etna 0.2.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.
Files changed (45) hide show
  1. package/bin/etna.js +17 -3
  2. package/data/harnesses/code/CLAUDE.md +77 -114
  3. package/data/harnesses/code/agents/boundary-mapper.md +91 -0
  4. package/data/harnesses/code/agents/brainstorm.md +110 -0
  5. package/data/harnesses/code/agents/change-review.md +13 -12
  6. package/data/harnesses/code/agents/contract-monitor.md +15 -14
  7. package/data/harnesses/code/agents/dep-health.md +1 -0
  8. package/data/harnesses/code/agents/git-history.md +1 -0
  9. package/data/harnesses/code/agents/maintenance.md +4 -3
  10. package/data/harnesses/code/agents/review.md +1 -0
  11. package/data/harnesses/code/agents/spec-mode.md +1 -0
  12. package/data/harnesses/code/rules/general.md +1 -0
  13. package/data/harnesses/code/rules/nomenclature.md +1 -0
  14. package/data/harnesses/code/scripts/build-ownership-index.sh +1 -0
  15. package/data/harnesses/code/scripts/check-doc-drift.sh +1 -0
  16. package/data/harnesses/code/skills/boundaries/SKILL.md +86 -0
  17. package/data/harnesses/code/skills/documentation/SKILL.md +21 -17
  18. package/data/harnesses/code/skills/documentation/references/templates.md +36 -48
  19. package/data/harnesses/code/skills/introspect/SKILL.md +24 -23
  20. package/data/harnesses/code/skills/technical-brainstorm/README.md +287 -0
  21. package/data/harnesses/code/skills/technical-brainstorm/SKILL.md +601 -0
  22. package/data/harnesses/code/skills/technical-brainstorm/greenfield.md +99 -0
  23. package/data/harnesses/code/skills/technical-brainstorm/templates/backlog.md +39 -0
  24. package/data/harnesses/code/skills/technical-brainstorm/templates/decisions.md +42 -0
  25. package/data/harnesses/code/skills/technical-brainstorm/templates/doctrine.md +31 -0
  26. package/data/harnesses/code/skills/technical-brainstorm/templates/glossary.md +19 -0
  27. package/data/harnesses/code/skills/technical-brainstorm/templates/inventory.md +44 -0
  28. package/data/harnesses/code/skills/technical-brainstorm/templates/milestones.md +43 -0
  29. package/data/harnesses/code/skills/technical-brainstorm/templates/non-goals.md +21 -0
  30. package/data/harnesses/code/skills/technical-brainstorm/templates/plan-doc.md +61 -0
  31. package/data/harnesses/code/skills/technical-brainstorm/templates/questions.md +84 -0
  32. package/data/harnesses/code/skills/technical-brainstorm/templates/references.md +28 -0
  33. package/data/harnesses/code/skills/technical-brainstorm/templates/rejected.md +29 -0
  34. package/data/harnesses/code/skills/technical-brainstorm/templates/state.md +8 -0
  35. package/data/harnesses/code/skills/workflow-mapper/SKILL.md +1 -0
  36. package/data/harnesses/kb-agi/CLAUDE.md +16 -1
  37. package/data/harnesses/kb-agi/agents/kb-agi-init.md +3 -2
  38. package/data/harnesses/kb-agi/agents/kb-catch-stale.md +2 -1
  39. package/data/harnesses/kb-agi/agents/kb-find-gaps.md +3 -2
  40. package/data/harnesses/kb-agi/agents/kb-fix-links.md +2 -1
  41. package/data/harnesses/kb-agi/agents/kb-refresh-frontdoor.md +2 -1
  42. package/data/harnesses/kb-agi/agents/kb-refresh-summaries.md +2 -1
  43. package/data/harnesses/kb-agi/agents/kb-sync-metadata.md +2 -1
  44. package/data/harnesses/kb-agi/rules/kb.md +4 -0
  45. package/package.json +1 -1
@@ -1,8 +1,9 @@
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
+ plugins: [nurix-harness]
6
7
  ---
7
8
 
8
9
  # Contract Monitor
@@ -11,21 +12,21 @@ You scan the codebase for cross-module contract violations. Where the `introspec
11
12
 
12
13
  ## Before Starting
13
14
 
14
- 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.
15
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.
16
17
  3. If `./docs/routing.md` exists, read it for module ownership context.
17
18
 
18
19
  ## Scan
19
20
 
20
- For each guardrail section in `guardrails.md`:
21
+ For each boundary file in `docs/boundaries/`:
21
22
 
22
- 1. Parse the section — extract contract name, canonical source location, consumer paths, violation description, checklist (if any)
23
- 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:
24
25
  - **Unregistered entity types** — strings used as entity-type identifiers that aren't in the canonical array
25
26
  - **String-coupled constants** — raw string literals used where shared constant imports are required
26
27
  - **Cross-entity references without propagation** — storing entity A's slug/name/id by value in entity B without documented propagation
27
28
  - **Schema mismatches** — selectors accessing persisted fields without fallback defaults
28
- - **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
29
30
  3. Verify by reading actual source files — never guess.
30
31
 
31
32
  ## Act
@@ -33,29 +34,29 @@ For each guardrail section in `guardrails.md`:
33
34
  For each violation:
34
35
 
35
36
  - **Mechanical fix** (missing constant import, missing fallback default, missing entry in canonical array) → fix it directly with an Edit
36
- - **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
37
38
  - **Pre-existing exception** (recorded in `docs/memory/contract-monitor.md`) → skip silently; don't re-flag
38
39
 
39
40
  ## Report
40
41
 
41
42
  Present a structured report:
42
43
 
43
- | # | Guardrail | Violation | Location | Action taken |
44
- |---|-----------|-----------|----------|--------------|
44
+ | # | Boundary | Violation | Location | Action taken |
45
+ |---|----------|-----------|----------|--------------|
45
46
 
46
47
  Then update `docs/memory/contract-monitor.md` with:
47
48
  - Scan date
48
- - Violation counts per guardrail
49
+ - Violation counts per boundary
49
50
  - Items fixed mechanically (with file paths)
50
51
  - Items backlogged (with P-level and rationale)
51
52
  - New exceptions added (if any)
52
53
 
53
- ## Optional: extend guardrails
54
+ ## Optional: suggest a new boundary
54
55
 
55
- 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:
56
57
 
57
- 1. Surface the candidate guardrail to the user with a draft entry
58
- 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
59
60
 
60
61
  ## Rules
61
62
 
@@ -3,6 +3,7 @@ name: dep-health
3
3
  description: Dependency supply-chain audit — security CVEs, outdated packages, license compliance, abandoned packages, unwanted transitive dependencies, install size. Run before releases or monthly. Pairs with `review` (which audits code, not deps).
4
4
  tools: Read, Glob, Grep, Bash
5
5
  model: inherit
6
+ plugins: [nurix-harness]
6
7
  ---
7
8
 
8
9
  # Dependency Health Agent
@@ -3,6 +3,7 @@ name: git-history
3
3
  description: Analyze git history by dispatching parallel sub-agents to classify commits into a pipe-delimited CSV with module, feature, impact, severity, and velocity dimensions.
4
4
  tools: Bash, Read, Write, Glob, Grep, Task
5
5
  model: sonnet
6
+ plugins: [nurix-harness]
6
7
  ---
7
8
 
8
9
  # Git History Agent
@@ -3,6 +3,7 @@ name: maintenance
3
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.
4
4
  tools: Read, Glob, Grep, Edit, Write, Bash
5
5
  model: inherit
6
+ plugins: [nurix-harness]
6
7
  ---
7
8
 
8
9
  # Maintenance Agent
@@ -10,13 +11,13 @@ model: inherit
10
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.
11
12
 
12
13
  Out of scope (handled by sibling components):
13
- - **Code drifted from docs** (contract/guardrail violations in live code) → `contract-monitor` agent
14
- - **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
15
16
 
16
17
  ## Before Starting
17
18
 
18
19
  1. If `./docs/memory/maintenance.md` exists, read it for last review state, ownership snapshots, high-churn paths, and known failure modes.
19
- 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.
20
21
  3. If `./docs/routing.md` exists, read it for the current file-pattern-to-doc mapping.
21
22
 
22
23
  ## Step 0: Regenerate Ownership Index
@@ -3,6 +3,7 @@ name: review
3
3
  description: Code-level health audit — bundle size, tree-shaking issues, performance anti-patterns, code-quality flags. Run weekly or after major code changes. Pairs with `dep-health` (which audits dependencies, not code that uses them).
4
4
  tools: Read, Glob, Grep, Bash
5
5
  model: inherit
6
+ plugins: [nurix-harness]
6
7
  ---
7
8
 
8
9
  # Review Agent
@@ -5,6 +5,7 @@ tools: Read, Glob, Grep, WebSearch, WebFetch
5
5
  model: inherit
6
6
  skills:
7
7
  - documentation
8
+ plugins: [nurix-harness]
8
9
  ---
9
10
 
10
11
  # Spec Mode Agent
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  applyTo: "**"
3
+ plugins: [nurix-harness]
3
4
  ---
4
5
 
5
6
  # Technology Choices & Standards
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  applyTo: "**"
3
+ plugins: [nurix-harness]
3
4
  ---
4
5
 
5
6
  # Nomenclature Guidelines
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # scripts/build-ownership-index.sh - Generate docs/OWNERSHIP_INDEX.md from feature doc frontmatter
3
+ # plugins: [nurix-harness]
3
4
 
4
5
  set -euo pipefail
5
6
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # scripts/check-doc-drift.sh - Detect potentially stale docs based on recent code changes
3
+ # plugins: [nurix-harness]
3
4
 
4
5
  set -euo pipefail
5
6
 
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: boundaries
3
+ description: The technology-aware Application Boundary Scale — the knowledge the boundary-mapper agent applies when generating docs/boundaries/. Maps each technology to its application boundaries (what ripples when touched), a doc-mode (point vs transcribe), and a default severity that drives introspect's review depth. Seeded for react-router, redux-toolkit, vite, shadcn/ui, express, django, fastapi, plus the stack-independent `domain` category (the information-architecture entity model). Use when baselining or extending a repo's boundary set, or when deciding whether a change touches a protected boundary.
4
+ plugins: [nurix-harness]
5
+ ---
6
+
7
+ # Boundaries — the Application Boundary Scale
8
+
9
+ A **boundary** is a horizontal cross-cutting contract that multiple modules touch. Touching it ripples outward, so it must be documented and protected. This skill is the *knowledge*; the `boundary-mapper` agent is the *process* that applies it to a repo, writing one file per boundary into `docs/boundaries/`.
10
+
11
+ This skill exists because the dangerous boundaries are the invisible ones. A team writes a guardrail for "auth" but never for "the Redux store shape" or "the entity model" — because those read as *just how the app is built*. The scale names them so they can't hide.
12
+
13
+ ## Two categories
14
+
15
+ | Category | Determined by | How `boundary-mapper` finds it |
16
+ |---|---|---|
17
+ | **technology** | the stack | detect from `package.json` + source tree |
18
+ | **domain** | the product's information architecture, independent of stack | read ADRs, doctrine, the entity/contracts definitions — **not** stack detection |
19
+
20
+ The **domain** boundary (the IA entity model) is usually the *highest-severity boundary in the whole repo* and is the cleanest bridge from Brainstorming Mode (which shapes the IA) to the boundary set (which `introspect`/`contract-monitor` enforce).
21
+
22
+ ## doc-mode: `point` vs `transcribe`
23
+
24
+ - **`point`** — *self-locating* shapes a reader finds unaided (DB schema → `schema.ts`/`models.py`; routes → the router file). The boundary file is **pointer (`file:line`) + invariants + checklist**. Never transcribe — the code is source-of-truth and a copy rots on the next push/codegen.
25
+ - **`transcribe`** — *synthesized* contracts with no single code home (the composed Redux store tree, the API response envelope, the IA relationship/topology, tenancy). Transcribe canonically; the boundary file then owns the shape and feature docs link up.
26
+
27
+ ## The scale
28
+
29
+ Each entry: boundary type(s) · where it lives · doc-mode · default severity · what a change triggers.
30
+
31
+ ### domain (stack-independent)
32
+
33
+ | Boundary | Lives in | doc-mode | Severity | A change triggers |
34
+ |---|---|---|---|---|
35
+ | **information architecture** — entity model + topology (e.g. Brief→Plan→Persona→Audience→Match→Campaign→Run; service planes) | synthesized — ADRs / doctrine / contracts pkg | `transcribe` | **CRITICAL** | re-relating or renaming an entity ripples across *every* module; check all consumers, migrations, wire types |
36
+ | **tenancy** — the workspace/tenant scoping invariant | query layer (a rule, not a file) | `transcribe` | **CRITICAL** | a missing scope = cross-tenant leak; audit every read/write path |
37
+
38
+ ### technology
39
+
40
+ | Tech | Boundary | Lives in | doc-mode | Severity | A change triggers |
41
+ |---|---|---|---|---|---|
42
+ | `react-router` | route tree | router config (self-locating) | `point` | MED | deep-linking, auth guards, redirects, lazy boundaries |
43
+ | `redux-toolkit` | composed store shape + **persisted keys** + selectors | spread across `store/` slices (no single file) | `transcribe` | HIGH | renamed/removed key breaks selectors + rehydration; persisted keys = CRITICAL |
44
+ | `vite` | dev proxy list, `VITE_` env prefix, path aliases | `vite.config` (self-locating) | HIGH | `point` | a new backend mount must be added to the proxy list; env prefix governs what reaches the client |
45
+ | `shadcn/ui` | `components.json`, generated `ui/` primitives, theme tokens | self-locating | LOW | `point` | `ui/` is generated — don't hand-edit, re-run the CLI; tokens in `:root`/`.dark` are the contract |
46
+ | `express` | middleware order, error-handler position, response envelope, route surface | order/envelope = convention; routes self-locating | `transcribe` (order+envelope) / `point` (routes) | HIGH | order is parsers→custom→routes→error-handler-**last**; envelope `{status,message,data}` is the contract |
47
+ | `django` | `settings.py` MIDDLEWARE order + INSTALLED_APPS, models, URLconf, DRF serializers | models/urls self-locating; middleware = convention | `point` + `transcribe` | HIGH (serializers/models CRITICAL) | serializer = wire contract; migration forward-only; middleware order changes request handling globally |
48
+ | `fastapi` | Pydantic request/response models, APIRouter surface, `Depends` graph | schemas/routers self-locating | `point` | HIGH | a response-model change = wire-contract change; the dependency-injection graph shifts auth/session resolution |
49
+ | `temporal` | workflow/activity signatures, signal/query names, task queues | workflow defs (self-locating) | `point` | HIGH | the starter references by name; a signature mismatch = stuck runs |
50
+ | `@org/contracts` (shared wire types) | persisted shapes + envelopes shared across SPA/BFF/worker | the contracts package (self-locating) | `point` | CRITICAL | 3-way drift; update the package first, then consumers |
51
+
52
+ Extend the scale by adding a row (and, for a new technology, a short pack describing where its boundaries live and the safe-change checklist). The instructions must be **technology-specific, never vague** — "middleware order is parsers→custom→routes→error-handler-last" beats "be careful with middleware."
53
+
54
+ ## Boundary file template
55
+
56
+ `boundary-mapper` writes one file per boundary using this shape:
57
+
58
+ ```markdown
59
+ # <Boundary name>
60
+
61
+ [BOUNDARY: <type> · <CRITICAL|HIGH|MED|LOW>]
62
+
63
+ **Bounds.** <which modules / planes sit on each side>
64
+
65
+ ## Shape
66
+ <transcribed contract, OR a `file:line` pointer with one-line orientation>
67
+
68
+ ## Invariants
69
+ <what must hold>
70
+
71
+ ## Blast radius
72
+ <what breaks, and where, if violated>
73
+
74
+ ## Safe-change checklist
75
+ - [ ] <step>
76
+ - [ ] <step>
77
+ ```
78
+
79
+ `docs/boundaries/README.md` indexes every boundary (name · type · severity) and records which technology packs are active.
80
+
81
+ ## How the pieces connect
82
+
83
+ - `boundary-mapper` (agent) detects the stack + IA and applies this scale to write `docs/boundaries/`.
84
+ - `introspect` (skill) reads `docs/boundaries/` before implementation; the boundary **severity** sets its review depth.
85
+ - `contract-monitor` (agent) scans the live codebase against `docs/boundaries/` after changes land, per boundary type.
86
+ - The **maintenance** agent flags when a boundary file drifts from code; `boundary-mapper` update-mode fixes it.
@@ -1,6 +1,7 @@
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
+ plugins: [nurix-harness]
4
5
  ---
5
6
 
6
7
  # Technical Documentation Skill
@@ -28,7 +29,7 @@ User request
28
29
  │
29
30
  ├─ "Add to protected files" ───────▶ Protected Files Template
30
31
  │
31
- ├─ "Create/update guardrails" ─────▶ Guardrails Template
32
+ ├─ "Create/update a boundary" ─────▶ boundary-mapper agent (this skill holds only the boundary-file template)
32
33
  │
33
34
  ├─ "Record architecture decision" ─▶ ADR Template
34
35
  │
@@ -45,7 +46,7 @@ User request
45
46
 
46
47
  ## Baseline Audit
47
48
 
48
- 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.
49
50
 
50
51
  ### Target Structure
51
52
 
@@ -53,24 +54,28 @@ When asked to "baseline", "audit", or "review" docs, enforce the canonical 6-fol
53
54
  docs/
54
55
  ├── README.md # Documentation root — quick links table, section index
55
56
  ├── structure.md # Authority map, folder rules, health log
56
- ├── CODEBASE_MAP.md # Auto-generated directory map (optional)
57
- ├── faq.md # Common issues (optional)
58
- ├── architecture/ # System-wide decisions, patterns, technical references
59
- │ ├── adr/ # Architecture Decision Records (numbered, immutable)
60
- │ └── core/ # Core module internals (auth, state, routing)
61
- ├── 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
62
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
63
67
  ├── operations/ # Setup, development, deployment, CI/CD
64
- │ └── guardrails.md # Cascading failure boundaries (cross-module contracts)
65
68
  ├── history/ # Frozen/append-only records
66
69
  │ ├── CHANGELOG.md # Master changelog index
67
70
  │ ├── changelog/ # Individual changelog entries
68
71
  │ ├── plans/ # Historical implementation plans (Status field required)
69
72
  │ └── backlog.md # Tracked work items by priority (P0-P3)
70
- ├── memory/ # Agent memory files
73
+ ├── memory/ # Agent memory files (index.md = baseline record)
71
74
  └── tests/ # Test plans and automation docs (optional)
72
75
  ```
73
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
+
74
79
  ### Workflow
75
80
 
76
81
  **Step 1: Inventory existing docs**
@@ -125,7 +130,6 @@ After approval:
125
130
  8. Scaffold standard files if missing:
126
131
  - `docs/README.md` — from template (see `references/templates.md`)
127
132
  - `docs/structure.md` — from template (see `references/templates.md`)
128
- - `docs/operations/guardrails.md` — cascading failure boundaries (see `references/templates.md` for what to include/exclude)
129
133
  - `docs/history/CHANGELOG.md` — master changelog index (header + table linking to entries)
130
134
  - `docs/history/backlog.md` — work items by priority (P0-P3 sections, empty if nothing to merge)
131
135
  - `docs/memory/index.md` — agent memory index (empty scaffold with section headers)
@@ -137,19 +141,19 @@ After approval:
137
141
 
138
142
  **Step 5: Verify**
139
143
 
140
- 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.
141
145
  2. Confirm no dead links in `docs/README.md`
142
146
  3. Confirm every plan file has a `Status:` field
143
147
  4. Confirm feature docs have ownership frontmatter
144
148
  5. Confirm `docs/OWNERSHIP_INDEX.md` rows match the frontmatter on disk (no orphans, no missing entries)
145
- 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`)
146
150
  7. Confirm duplicates are eliminated — each topic has one canonical source
147
151
 
148
152
  ### Rules
149
153
 
150
- - 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
151
155
  - Guides about how-to-run → `operations/`. Guides about a feature → `features/`
152
- - 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/`)
153
157
  - Only `CLAUDE.md`, `AGENTS.md`, and `README.md` are allowed in the repository root (not inside `docs/`)
154
158
  - Root-level `README.md` is for humans. `docs/README.md` is the agent/doc entry point
155
159
  - One canonical source per topic — link, don't copy
@@ -233,6 +237,6 @@ For docs that don't match templates:
233
237
 
234
238
  | File | Use For |
235
239
  |------|---------|
236
- | `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 |
237
241
  | `references/style-guide.md` | Writing rules, formatting conventions |
238
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