@nurix/etna 0.3.6 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/harnesses/code/CLAUDE.md +25 -16
- package/data/harnesses/code/agents/brainstorm.md +3 -3
- package/data/harnesses/code/agents/change-review.md +190 -21
- package/data/harnesses/code/agents/harness-manager.md +154 -0
- package/data/harnesses/code/agents/maintenance.md +5 -31
- package/data/harnesses/code/agents/performance-review.md +219 -0
- package/data/harnesses/code/agents/spec-mode.md +1 -1
- package/data/harnesses/code/skills/boundary/SKILL.md +245 -0
- package/data/harnesses/code/skills/boundary/references/boundary-taxonomy.md +666 -0
- package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/README.md +14 -14
- package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/SKILL.md +14 -14
- package/data/harnesses/code/skills/documentation/SKILL.md +8 -122
- package/data/harnesses/code/skills/documentation/references/templates.md +14 -27
- package/data/harnesses/kb-agi/CLAUDE.md +1 -1
- package/package.json +1 -1
- package/data/harnesses/code/agents/boundary-mapper.md +0 -114
- package/data/harnesses/code/agents/contract-monitor.md +0 -66
- package/data/harnesses/code/agents/dep-health.md +0 -149
- package/data/harnesses/code/agents/git-history.md +0 -202
- package/data/harnesses/code/agents/review.md +0 -110
- package/data/harnesses/code/scripts/build-ownership-index.sh +0 -148
- package/data/harnesses/code/scripts/check-doc-drift.sh +0 -135
- package/data/harnesses/code/skills/introspect/SKILL.md +0 -136
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/greenfield.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/backlog.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/decisions.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/doctrine.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/glossary.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/inventory.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/milestones.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/non-goals.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/plan-doc.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/questions.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/references.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/rejected.md +0 -0
- /package/data/harnesses/code/skills/{technical-brainstorm → brainstorm}/templates/state.md +0 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: performance-review
|
|
3
|
+
description: Combined dependency + code health audit. Part A audits the dependency supply chain — security CVEs, outdated packages, license compliance, abandoned packages, unwanted transitive dependencies, install size. Part B audits code-level health — bundle size, tree-shaking issues, performance anti-patterns, code-quality flags. Run weekly or before releases. Merges the former `dep-health` and `review` agents so the package tree and the code that uses it are audited together.
|
|
4
|
+
tools: Read, Glob, Grep, Bash
|
|
5
|
+
model: inherit
|
|
6
|
+
plugins: [nurix-harness]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Performance-Review Agent
|
|
10
|
+
|
|
11
|
+
You audit project health on two fronts that reinforce each other: the **dependency supply chain** (Part A) and the **code that consumes it** (Part B). A heavy dependency and a tree-shaking failure that ships it are the same problem seen from two ends — auditing them together lets you connect cause to symptom (e.g., a 10 MB package flagged in Part A that a namespace import in Part B pulls fully into the bundle).
|
|
12
|
+
|
|
13
|
+
## Before Starting
|
|
14
|
+
|
|
15
|
+
1. If `./docs/memory/performance-review.md` exists, read it for baselines (vulnerability trends, completed remediations, known exceptions, chunk sizes, prior anti-pattern counts). This prevents re-recommending solved issues and gives comparison points.
|
|
16
|
+
2. Read `./package.json` for direct dependencies, entry points, and scripts.
|
|
17
|
+
3. Detect the package manager by checking for lockfiles: `pnpm-lock.yaml` (pnpm), `package-lock.json` (npm), `yarn.lock` (yarn). Use the matching commands throughout.
|
|
18
|
+
4. If `.claude/rules/general.instructions.md` (or `.claude/rules/general.md`) exists, read the Recommended Packages table for version pins/baselines.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Part A — Dependency Health
|
|
23
|
+
|
|
24
|
+
## Step 1: Security Vulnerabilities
|
|
25
|
+
|
|
26
|
+
Run the audit command for the detected PM:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# pnpm
|
|
30
|
+
pnpm audit --json 2>/dev/null || pnpm audit
|
|
31
|
+
|
|
32
|
+
# npm
|
|
33
|
+
npm audit --json 2>/dev/null || npm audit
|
|
34
|
+
|
|
35
|
+
# yarn
|
|
36
|
+
yarn npm audit --json 2>/dev/null || yarn audit
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Parse results by severity (critical, high, moderate, low). For each critical/high CVE report:
|
|
40
|
+
|
|
41
|
+
- Package name and installed version
|
|
42
|
+
- CVE ID
|
|
43
|
+
- Affected version range
|
|
44
|
+
- Fixed version (if available)
|
|
45
|
+
- Which direct dependency pulls it in
|
|
46
|
+
|
|
47
|
+
Compare against the previous scan in `docs/memory/performance-review.md` — flag new vulnerabilities since last audit.
|
|
48
|
+
|
|
49
|
+
## Step 2: Outdated Dependencies
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pnpm outdated --format json 2>/dev/null || pnpm outdated
|
|
53
|
+
# or: npm outdated --json
|
|
54
|
+
# or: yarn outdated
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Classify into:
|
|
58
|
+
|
|
59
|
+
- **Major behind** (2+ majors) — highest risk
|
|
60
|
+
- **Minor behind** — moderate risk
|
|
61
|
+
- **Patch behind** — low risk
|
|
62
|
+
|
|
63
|
+
Cross-reference against the Recommended Packages table in the project rules — flag packages where the installed version is behind the pinned version. Report the top 10 most outdated by semver distance.
|
|
64
|
+
|
|
65
|
+
## Step 3: License Compliance
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm licenses list --json 2>/dev/null || pnpm licenses list
|
|
69
|
+
# npm: npx license-checker --json
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Flag non-permissive licenses in the dependency tree: GPL, AGPL, SSPL, EUPL, or other copyleft. For each: package name, license type, direct or transitive.
|
|
73
|
+
|
|
74
|
+
## Step 4: Abandoned Packages
|
|
75
|
+
|
|
76
|
+
For each direct dependency, check npm registry metadata:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm view {package} time --json 2>/dev/null
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Flag packages with no publish in 18+ months. Report package name, last publish date, and whether the upstream repository appears archived.
|
|
83
|
+
|
|
84
|
+
## Step 5: Unwanted Transitive Dependencies
|
|
85
|
+
|
|
86
|
+
Check for known-bloat packages in the dependency tree:
|
|
87
|
+
|
|
88
|
+
- `moment` (use date-fns instead)
|
|
89
|
+
- `lodash` (use subpath imports)
|
|
90
|
+
- `underscore`
|
|
91
|
+
- `request` (deprecated)
|
|
92
|
+
- `node-fetch` (when runtime has native fetch)
|
|
93
|
+
|
|
94
|
+
For each found:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pnpm why {package}
|
|
98
|
+
# or: npm ls {package}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Report which direct dependency pulls it in and the installed size. Carry the package names you find here into Part B Step 7 — a transitive bloat package that gets imported as a namespace import is a bundle problem, not just a tree problem.
|
|
102
|
+
|
|
103
|
+
## Step 6: Dependency Size Impact
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
du -sh node_modules/.pnpm/*/ 2>/dev/null | sort -rh | head -15
|
|
107
|
+
# or for npm: du -sh node_modules/*/ | sort -rh | head -15
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
List the 15 largest packages by installed size. Flag any single package over 10 MB. Compare against the previous snapshot.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
# Part B — Code Health
|
|
115
|
+
|
|
116
|
+
## Step 7: Bundle Size Analysis
|
|
117
|
+
|
|
118
|
+
1. Run the build (`pnpm build` / `npm run build` / `yarn build` per detected PM) to generate the production bundle
|
|
119
|
+
2. Parse build output to extract chunk sizes (raw and gzip)
|
|
120
|
+
3. Identify the top 10 largest chunks by raw size
|
|
121
|
+
4. Compare against known baselines in `docs/memory/performance-review.md`
|
|
122
|
+
5. Flag any chunk that grew >50 KB since last review
|
|
123
|
+
|
|
124
|
+
### Common bundle-bloat patterns
|
|
125
|
+
|
|
126
|
+
Search for anti-patterns that defeat tree-shaking:
|
|
127
|
+
|
|
128
|
+
- `import * as` namespace imports from large libraries (lucide-react, lodash, etc.)
|
|
129
|
+
- Dynamic string-based icon/component resolution (`Icons[name]`, `Components[type]`)
|
|
130
|
+
- Barrel file re-exports pulling in unused code
|
|
131
|
+
- Missing `React.lazy()` for heavy components (Monaco, Uppy, D3, Plotly, Mermaid)
|
|
132
|
+
- Full library imports where subpath imports exist (`import _ from 'lodash'` vs `import get from 'lodash/get'`)
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Find namespace imports from large libraries
|
|
136
|
+
grep -rn "import \* as" src/ --include="*.jsx" --include="*.tsx" --include="*.js" --include="*.ts"
|
|
137
|
+
|
|
138
|
+
# Find dynamic component/icon resolution
|
|
139
|
+
grep -rn "Icons\[" src/ --include="*.jsx" --include="*.tsx"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Step 8: Performance Anti-Patterns
|
|
143
|
+
|
|
144
|
+
Scan for React performance issues:
|
|
145
|
+
|
|
146
|
+
### Missing memoization
|
|
147
|
+
- Components rendering large lists without `React.memo`
|
|
148
|
+
- Expensive computations without `useMemo`
|
|
149
|
+
- Callback props without `useCallback` causing child re-renders
|
|
150
|
+
- Focus on components in tables, lists, grids, repeated rows
|
|
151
|
+
|
|
152
|
+
### Request waterfalls
|
|
153
|
+
- Sequential `await` calls that could be `Promise.all`
|
|
154
|
+
- `useEffect` chains where one fetch triggers another
|
|
155
|
+
- Component trees where parent fetches block child renders
|
|
156
|
+
|
|
157
|
+
### Missing virtualization
|
|
158
|
+
- Lists rendering >50 items without react-window or similar
|
|
159
|
+
- Tables with unbounded row counts
|
|
160
|
+
- Grids without lazy loading
|
|
161
|
+
|
|
162
|
+
## Step 9: Import Health
|
|
163
|
+
|
|
164
|
+
1. Check for circular dependencies using import chains
|
|
165
|
+
2. Identify unused exports (files exporting functions not imported elsewhere)
|
|
166
|
+
|
|
167
|
+
## Step 10: Code-Quality Flags
|
|
168
|
+
|
|
169
|
+
- `dangerouslySetInnerHTML` usage without sanitization context
|
|
170
|
+
- `// TODO` and `// FIXME` comments older than 30 days
|
|
171
|
+
- `console.log` / `console.warn` / `console.error` left in production code
|
|
172
|
+
- Hardcoded API URLs, credentials, or environment-specific values
|
|
173
|
+
- Missing error boundaries around async components
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
grep -rn "console\.\(log\|warn\|error\)" src/ --include="*.jsx" --include="*.tsx" --include="*.js" --include="*.ts" | grep -v "// eslint"
|
|
177
|
+
grep -rn "TODO\|FIXME\|HACK\|XXX" src/ --include="*.jsx" --include="*.tsx" --include="*.js" --include="*.ts"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Step 11: Report & Track
|
|
183
|
+
|
|
184
|
+
### Report format
|
|
185
|
+
|
|
186
|
+
**Dependencies**
|
|
187
|
+
- **Vulnerabilities**: critical/high CVEs, new since last audit
|
|
188
|
+
- **Outdated**: top outdated packages by semver distance
|
|
189
|
+
- **Licenses**: non-permissive license flags
|
|
190
|
+
- **Abandoned**: packages with no recent publishes
|
|
191
|
+
- **Transitive bloat**: unwanted packages pulled in transitively
|
|
192
|
+
- **Dependency size**: largest installed packages
|
|
193
|
+
|
|
194
|
+
**Code**
|
|
195
|
+
- **Bundle size**: total vendor size, top offenders, growth since last review
|
|
196
|
+
- **Tree-shaking issues**: namespace imports, barrel-file problems (cross-referenced with the heavy/bloat packages from Part A)
|
|
197
|
+
- **Performance**: missing memoization, request waterfalls, missing virtualization
|
|
198
|
+
- **Code quality**: console statements, TODOs, hardcoded values
|
|
199
|
+
|
|
200
|
+
**Recommendations**: a single prioritized list spanning both fronts, with estimated impact. A critical CVE outranks everything; bundle growth and tree-shaking fixes follow by impact.
|
|
201
|
+
|
|
202
|
+
### Update tracking
|
|
203
|
+
|
|
204
|
+
1. Write a snapshot to `docs/memory/performance-review.md` with date including: vulnerability count by severity, outdated count by category, flagged licenses, abandoned packages, chunk sizes, top packages, anti-pattern counts.
|
|
205
|
+
2. Append new items to `docs/history/backlog.md`:
|
|
206
|
+
- `- **[P0]** Critical CVE in \`{package}\`: {CVE-ID} — discovered by performance-review`
|
|
207
|
+
- `- **[P2]** Abandoned dependency: \`{package}\` (last published {date}) — discovered by performance-review`
|
|
208
|
+
- `- **[P2]** Bundle grew by 80KB in chunk \`{name}\` — discovered by performance-review`
|
|
209
|
+
3. Report summary to the user
|
|
210
|
+
|
|
211
|
+
## Rules
|
|
212
|
+
|
|
213
|
+
- Read-only for source code — never modify `src/` files
|
|
214
|
+
- Never run `npm install`, `pnpm install`, `yarn install`, or any command that modifies dependencies
|
|
215
|
+
- May write to `docs/memory/performance-review.md` and `docs/history/backlog.md`
|
|
216
|
+
- Be specific: include package names, byte sizes, CVE IDs, version numbers, file paths, line numbers
|
|
217
|
+
- Prioritize by impact — a critical CVE matters more than a patch update; trends matter more than absolutes when baselines exist
|
|
218
|
+
- If a command isn't available or applicable (e.g., audit unsupported, build fails on a non-JS project), skip that step and note it in the report
|
|
219
|
+
- A clean report is valid — do not invent issues
|
|
@@ -22,7 +22,7 @@ First, understand the documentation landscape:
|
|
|
22
22
|
2. Read `./docs/features/README.md` to see existing feature specs and where the new spec fits
|
|
23
23
|
3. If `./docs/memory/spec-mode.md` exists, read it for feature doc inventory, ownership conflict zones, and lessons from previous research
|
|
24
24
|
4. Read 1-2 existing specs in `./docs/features/` to calibrate format and depth
|
|
25
|
-
5.
|
|
25
|
+
5. Glob `./docs/{features,modules/*/features}/**/*.md` and read YAML frontmatter (`owns`, `touches`, `depends_on`) from each to build the ownership map.
|
|
26
26
|
|
|
27
27
|
This tells you what already exists, what's adjacent, how detailed the spec should be, and what code paths are already owned.
|
|
28
28
|
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: boundary
|
|
3
|
+
description: The single home for a repo's typed application boundaries — the cross-cutting contracts (db-schema, wire envelope, store shape, auth, tenancy, event schemas, edge bindings, …) where editing one module silently breaks another. One skill, four modes — `generate` (baseline all boundaries from the detected stack + IA), `create` (add/update one boundary), `check` (pre-implementation: does this plan touch a boundary? severity-ranked impact), `init` (reconcile: ensure files exist, scan live code for violations + drift, backfill new catalog types). All four read one shared knowledge root, `references/boundary-taxonomy.md`, so they can never drift apart. Triggers on "application boundary", "baseline boundaries", "map boundaries", "generate boundaries", "create a boundary", "introspect", "check this plan", "impact analysis", "what could break", "scan for boundary violations", "boundary drift", "/boundary".
|
|
4
|
+
plugins: [nurix-harness]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Application Boundary Skill
|
|
8
|
+
|
|
9
|
+
The one place a repo's **typed application boundaries** are produced, checked, and
|
|
10
|
+
maintained. A boundary is a horizontal cross-cutting contract — an *edge* between
|
|
11
|
+
modules, layers, services, or deploy units — where editing one side silently
|
|
12
|
+
breaks another. They live as one file per boundary in `docs/boundaries/`.
|
|
13
|
+
|
|
14
|
+
This skill merges what used to be three components — `boundary-mapper` (produce),
|
|
15
|
+
`introspect` (pre-impl check), `contract-monitor` (post-impl scan) — into one
|
|
16
|
+
skill with four modes. The reason they're one skill: **all four share a single
|
|
17
|
+
knowledge root** — [`references/boundary-taxonomy.md`](references/boundary-taxonomy.md),
|
|
18
|
+
the exhaustive catalog of *what an application boundary is* and *which kinds
|
|
19
|
+
exist* (≈170 types across persistence, wire/API, frontend, auth/tenancy,
|
|
20
|
+
async/messaging, config/build, runtime/infra). Three separate components meant
|
|
21
|
+
three copies of that mental model that drifted apart. One skill, one catalog,
|
|
22
|
+
zero drift.
|
|
23
|
+
|
|
24
|
+
> **Read [`references/boundary-taxonomy.md`](references/boundary-taxonomy.md)
|
|
25
|
+
> first, in every mode.** It carries the boundary-file anatomy, the
|
|
26
|
+
> `point`-vs-`transcribe` doc-mode, the technology/domain split, the per-type
|
|
27
|
+
> severities, and the safe-change checklists. This SKILL.md only orchestrates the
|
|
28
|
+
> four verbs over that knowledge.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Picking a mode
|
|
33
|
+
|
|
34
|
+
| You want to… | Mode | Old component |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| Baseline a repo — generate every boundary that exists from the stack + IA | **`generate`** | boundary-mapper (baseline) |
|
|
37
|
+
| Add or update **one** boundary file | **`create`** | boundary-mapper (create/update) |
|
|
38
|
+
| Before coding: does this **plan** touch a boundary? Severity-ranked impact | **`check`** | introspect |
|
|
39
|
+
| Reconcile: do files exist? scan **live code** for violations + drift; backfill new catalog types | **`init`** | contract-monitor + drift + catalog-sync |
|
|
40
|
+
|
|
41
|
+
If the user's intent is ambiguous, ask which mode. `generate` and `create` are the
|
|
42
|
+
same writer at different scope (`generate` = `create` over every detected
|
|
43
|
+
boundary).
|
|
44
|
+
|
|
45
|
+
## Execution model — pure skill
|
|
46
|
+
|
|
47
|
+
This skill runs **in the main session** — no standing sub-agents. `check` and
|
|
48
|
+
`create` are light and always run inline. `generate` and `init` sweep the
|
|
49
|
+
codebase; run that sweep inline too. **Only** for an unusually large repo (where
|
|
50
|
+
an inline full-codebase sweep would blow the context budget) may you dispatch a
|
|
51
|
+
**one-shot scan worker** sub-agent that reads this same taxonomy reference and
|
|
52
|
+
returns structured findings — the knowledge still lives in exactly one place.
|
|
53
|
+
Default to inline; reach for a worker only when the repo's size forces it.
|
|
54
|
+
|
|
55
|
+
## Before any mode
|
|
56
|
+
|
|
57
|
+
1. Read [`references/boundary-taxonomy.md`](references/boundary-taxonomy.md) — the
|
|
58
|
+
boundary types, doc-modes, default severities, and safe-change checklists for
|
|
59
|
+
the stack you're about to touch.
|
|
60
|
+
2. If `docs/memory/boundary.md` exists, read it for project-specific
|
|
61
|
+
boundary exceptions, known violations the user chose not to fix, where the IA
|
|
62
|
+
model actually lives, and stack quirks that change a doc-mode.
|
|
63
|
+
3. If `docs/routing.md` exists, read it for module-ownership context.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Mode: `generate` (baseline)
|
|
68
|
+
|
|
69
|
+
No `docs/boundaries/` yet (or a from-scratch re-baseline). Detect the stack + IA,
|
|
70
|
+
instantiate one file per boundary that actually exists.
|
|
71
|
+
|
|
72
|
+
1. **Detect the stack** — read `package.json` (deps), the lockfile, and skim the
|
|
73
|
+
source tree. Map detected technologies to their boundary types via the
|
|
74
|
+
taxonomy. (Detect the package manager from the lockfile; don't assume.)
|
|
75
|
+
2. **Detect the information architecture** — read `docs/architecture/`
|
|
76
|
+
(domain-model, ADRs), doctrine in any `docs/modules/*/pillars/`, and the
|
|
77
|
+
entity/contract definitions (a `@org/contracts` package, `schema.ts`,
|
|
78
|
+
`models.py`). The IA entity model is the flagship `domain` boundary
|
|
79
|
+
(`information-architecture`).
|
|
80
|
+
3. **For each boundary the repo exhibits**, write one file to `docs/boundaries/`
|
|
81
|
+
using the boundary-file anatomy. Decide `point` vs `transcribe` per the
|
|
82
|
+
taxonomy: `point` boundaries get a `file:line` pointer + invariants +
|
|
83
|
+
checklist (never a transcribed copy — it rots); `transcribe` boundaries (the
|
|
84
|
+
composed store tree, the response envelope, the IA topology, tenancy) get the
|
|
85
|
+
contract canonically in the file.
|
|
86
|
+
4. **Set severity** from the taxonomy default, adjusted by the concrete repo +
|
|
87
|
+
project memory. Severity is load-bearing — it drives `check` review depth and
|
|
88
|
+
`init` scan priority.
|
|
89
|
+
5. **Name the bounding code units** (paths / package names) in every `Bounds`
|
|
90
|
+
line. The distinct vertices named across all `Bounds` lines are the
|
|
91
|
+
**module-discovery feed** `harness-manager` reads to propose modules — name
|
|
92
|
+
them precisely.
|
|
93
|
+
6. **Write `docs/boundaries/README.md`** as the index: every boundary, its type,
|
|
94
|
+
severity, and which technology packs are active.
|
|
95
|
+
7. **Don't invent boundaries the repo doesn't have.** Only instantiate types the
|
|
96
|
+
detected stack/IA actually exhibits; `log()` what you skipped and why.
|
|
97
|
+
|
|
98
|
+
Write only under `docs/boundaries/` and `docs/memory/boundary.md`.
|
|
99
|
+
Read-only on production code.
|
|
100
|
+
|
|
101
|
+
## Mode: `create` (targeted)
|
|
102
|
+
|
|
103
|
+
Add or update a single boundary file (e.g. a new contract surfaced by `check`, or
|
|
104
|
+
a boundary the author asks for by name).
|
|
105
|
+
|
|
106
|
+
1. Identify the boundary type from the taxonomy; confirm the repo exhibits it.
|
|
107
|
+
2. Write/update the one file with the full anatomy (Bounds, Shape, Invariants,
|
|
108
|
+
Blast radius, Safe-change checklist), `point` or `transcribe` per the taxonomy.
|
|
109
|
+
3. Update `docs/boundaries/README.md` (add/refresh the index row).
|
|
110
|
+
4. For an **update** that fixes drift (the `maintenance` agent flags a boundary
|
|
111
|
+
file drifted from its source): re-read the source, refresh the `Shape` pointer
|
|
112
|
+
or transcription, leave invariants/checklist intact unless they changed.
|
|
113
|
+
|
|
114
|
+
## Mode: `check` (pre-implementation)
|
|
115
|
+
|
|
116
|
+
Read-only. Intersect a plan's proposed changes with the documented boundaries and
|
|
117
|
+
surface cascading risk *before* coding. (This is the old `introspect`.)
|
|
118
|
+
|
|
119
|
+
**Inputs.** Plan path (user-provided; else newest in `docs/history/plans/`). Every
|
|
120
|
+
file in `docs/boundaries/` is mandatory input — if the folder is missing/empty,
|
|
121
|
+
stop and tell the user to run `generate` first. Source files read on demand to
|
|
122
|
+
verify — never guess from plan text alone.
|
|
123
|
+
|
|
124
|
+
1. **Load.** Resolve + read the plan; confirm it has a `Status:` (warn if
|
|
125
|
+
`Complete`/`Abandoned`). Read every boundary file; parse the
|
|
126
|
+
`[BOUNDARY: type · severity]` header + Bounds / Shape / Invariants / Blast
|
|
127
|
+
radius / Safe-change checklist. Severity sets review depth.
|
|
128
|
+
2. **Parse proposed changes.** The plan template's **Proposed Changes**
|
|
129
|
+
subsections are load-bearing: New Files / Modified Files (check against the
|
|
130
|
+
modules each boundary **Bounds** and any `Shape` `file:line`) · New Entities /
|
|
131
|
+
State (vs `information-architecture` + `db-schema`) · API Changes (vs
|
|
132
|
+
`wire-response-envelope` / `rest-endpoint-shape` / `graphql-schema`) ·
|
|
133
|
+
Cross-Module Contracts Affected (the author's own admission — start there,
|
|
134
|
+
then verify). Note any missing subsection.
|
|
135
|
+
3. **Analyze each boundary × change pair** for: **Bounds overlap** (touches a
|
|
136
|
+
bounded module or a `Shape` pointer), **Invariant overlap** (introduces a
|
|
137
|
+
shape the invariants prohibit — raw literal where a shared constant is
|
|
138
|
+
required, entity type not in the canonical array, persisted field without
|
|
139
|
+
fallback), **Shape overlap** (modifies the canonical Shape). Read the actual
|
|
140
|
+
source to verify any plausible intersection.
|
|
141
|
+
4. **Assign severity.** Anchor to the boundary's own severity (the floor),
|
|
142
|
+
adjust by the concrete change. Critical = silent data loss / corrupted
|
|
143
|
+
persistence / broken cross-entity refs; High = stale state / broken lookups /
|
|
144
|
+
schema selectors without fallbacks; Medium = likely-to-drift string-coupling;
|
|
145
|
+
Low = code smell.
|
|
146
|
+
5. **Report** (in chat — never written to disk):
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
# Application Boundary — check — {plan filename}
|
|
150
|
+
|
|
151
|
+
Plan: {path}
|
|
152
|
+
Boundaries: {N} files evaluated
|
|
153
|
+
Intersections: {N} ({critical}/{high}/{medium}/{low})
|
|
154
|
+
|
|
155
|
+
## Violations
|
|
156
|
+
| # | Boundary | Risk | Severity | Plan step |
|
|
157
|
+
|
|
158
|
+
## Suggested Plan Additions
|
|
159
|
+
- Violation #1 → add step X to Implementation Steps / Done Criteria …
|
|
160
|
+
|
|
161
|
+
## Missing Subsections
|
|
162
|
+
## New Cross-Module Contracts Detected
|
|
163
|
+
{describe the proposed boundary (type, Bounds, Shape, suggested severity) and
|
|
164
|
+
recommend running `create` to formalize it — do not write the file from check}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The severity-ranked table is the load-bearing output. Suggestions are advisory —
|
|
168
|
+
the user folds them back into the plan; **`check` never edits the plan or code.**
|
|
169
|
+
|
|
170
|
+
## Mode: `init` (reconcile — ensure, scan, backfill)
|
|
171
|
+
|
|
172
|
+
Ensure boundaries are initialized and current. Three jobs in one pass:
|
|
173
|
+
|
|
174
|
+
1. **Ensure exist.** If `docs/boundaries/` is missing/empty → this is really a
|
|
175
|
+
baseline; run `generate` instead and stop.
|
|
176
|
+
2. **Scan live code for violations** (the old `contract-monitor`). For each
|
|
177
|
+
boundary file, parse its header + invariants, then scan the codebase for
|
|
178
|
+
violations of *that* boundary. Categories: **unregistered entity types**
|
|
179
|
+
(strings used as entity-type ids not in the canonical array) · **string-coupled
|
|
180
|
+
constants** (raw literals where a shared constant import is required) ·
|
|
181
|
+
**cross-entity references without propagation** (storing entity A's
|
|
182
|
+
slug/name/id by value in B with no documented propagation) · **schema
|
|
183
|
+
mismatches** (selectors hitting persisted fields without a fallback default) ·
|
|
184
|
+
**undocumented endpoints** (routes with no feature-doc / `api` boundary entry).
|
|
185
|
+
Verify by reading actual source — never guess.
|
|
186
|
+
3. **Detect drift + backfill the catalog.** (a) Flag any boundary file whose
|
|
187
|
+
`Shape` has drifted from its source (refresh it via `create`/update). (b)
|
|
188
|
+
Compare the taxonomy's boundary *types* against what the repo now exhibits —
|
|
189
|
+
if the repo gained a technology (or the catalog gained a type) that the repo
|
|
190
|
+
exhibits but `docs/boundaries/` lacks, surface it and offer to `generate` that
|
|
191
|
+
one boundary.
|
|
192
|
+
|
|
193
|
+
**Act on violations.** Mechanical fix (missing constant import, missing fallback,
|
|
194
|
+
missing canonical-array entry) → fix directly with an Edit. Design-decision fix
|
|
195
|
+
(new entity-type registration, new propagation mechanism, schema migration) →
|
|
196
|
+
append to `docs/history/backlog.md` as P0/P1 with the specific boundary + bounded
|
|
197
|
+
modules. Pre-existing exception (in `docs/memory/boundary.md`) → skip
|
|
198
|
+
silently.
|
|
199
|
+
|
|
200
|
+
**Report** a table `| # | Boundary | Violation | Location | Action taken |`, then
|
|
201
|
+
update `docs/memory/boundary.md` with scan date, per-boundary
|
|
202
|
+
violation counts, items fixed / backlogged, new exceptions, and any
|
|
203
|
+
newly-exhibited boundary types backfilled.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Rules
|
|
208
|
+
|
|
209
|
+
- **One knowledge root.** Every mode reads `references/boundary-taxonomy.md`.
|
|
210
|
+
Extend the catalog there, never inline a divergent copy in a mode.
|
|
211
|
+
- **`check` is read-only** — never edits the plan, source, boundaries, or memory.
|
|
212
|
+
The other modes write only under `docs/boundaries/`,
|
|
213
|
+
`docs/memory/boundary.md`, and (for `init` mechanical fixes) the
|
|
214
|
+
specific violating source line. Never touch frozen records
|
|
215
|
+
(`docs/history/plans/`, `docs/history/changelog/`) or feature docs.
|
|
216
|
+
- **Verify against source.** Never report a violation or intersection from text
|
|
217
|
+
alone — read the files the plan/boundary names.
|
|
218
|
+
- **One file per boundary.** Don't bundle unrelated boundaries.
|
|
219
|
+
- **Severity is load-bearing.** It feeds `check` review depth + `init` priority.
|
|
220
|
+
Default from the taxonomy; adjust from the repo + memory.
|
|
221
|
+
- **Name the bounding code units** in every `Bounds` line — they're the
|
|
222
|
+
module-discovery feed `harness-manager` reads. A workspace is *not* a module.
|
|
223
|
+
- **Don't invent boundaries the repo doesn't have.** Only instantiate exhibited
|
|
224
|
+
types; `log()` skips. **A clean report is valid** — empty violations/intersections
|
|
225
|
+
means say so, don't pad.
|
|
226
|
+
- **Docs never outrank code.** For `point` boundaries, mirror with `file:line`;
|
|
227
|
+
don't fork the shape.
|
|
228
|
+
- **Be specific** — file paths, line numbers, boundary names, the exact violating
|
|
229
|
+
string or code shape.
|
|
230
|
+
|
|
231
|
+
## Strategy memory
|
|
232
|
+
|
|
233
|
+
After a run you may append to `docs/memory/boundary.md` (git-tracked):
|
|
234
|
+
project-specific boundary exceptions, where the IA model actually lives in this
|
|
235
|
+
repo, stack quirks that change a doc-mode, recurring drift/violation zones,
|
|
236
|
+
historical violation counts. Never user preferences (those are `~/.claude/`);
|
|
237
|
+
never a transcription of a boundary's content (that's the boundary file). Date
|
|
238
|
+
each entry `## YYYY-MM-DD — {topic}`.
|
|
239
|
+
|
|
240
|
+
## Output locations
|
|
241
|
+
|
|
242
|
+
- `generate`/`create`/`init` write boundary files to `docs/boundaries/` + the
|
|
243
|
+
index `docs/boundaries/README.md`; memory to `docs/memory/boundary.md`.
|
|
244
|
+
- `check` returns its report in chat — never written to disk; the user folds
|
|
245
|
+
insights back into the plan.
|