pi-jev-wiki 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,52 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0 — 2026-09-19
4
+
5
+ First public release. A pi package that builds and maintains a project mental-model wiki,
6
+ with [Jev](https://typesafe.ai) (TypeSafe System One) as the calibrated decision layer.
7
+
8
+ ### Intake
9
+
10
+ - Research ingest (`wiki_ingest`): immutable raw sources, claim extraction with verbatim quote
11
+ validation, Jev adjudication, and a placement brief.
12
+ - Agent insight capture (`wiki_insights`): agent-authored insight lists with evidence pointers,
13
+ Jev-filtered and placed; sessions stored as ordinary raw sources.
14
+ - `derivable_from_code` gate: implementation detail visible in the repository is rejected rather
15
+ than duplicated in the wiki.
16
+ - Trust tiers: `verified_in_repo`, `source_document`, `user_stated`, `inference`, `speculation`.
17
+ - Automated capture on `agent_settled` and `session_before_compact`, with a Jev pre-screen,
18
+ turn-count minimum, debounce, and in-process guard; pending-capture handoff when no follow-up
19
+ turn can run. Recurrence promotion from the session log.
20
+
21
+ ### Maintenance
22
+
23
+ - `wiki_sync`: file-linked claims re-verified against commits since the last baseline; verdicts
24
+ `no_impact`, `needs_recheck`, `supersede`, `contradict`, with review queueing.
25
+ - Two-way invalidation at ingest (new supersedes old, old supersedes new, conflicts).
26
+ - Corroboration counting on reinforcement and explicit supersession records.
27
+ - `wiki_review`: agent-managed queue with criticality-gated user escalation.
28
+ - `wiki_lint`: TOC reconciliation, broken links, age-gated orphans, raw backlog, unbacked claims,
29
+ Jev contradiction checks, and duplicate/consolidation candidates.
30
+ - `wiki_remove` for retiring obsolete pages.
31
+
32
+ ### Writing
33
+
34
+ - Guided (default), draft, and auto writer modes; autonomy downgrades as claim criticality rises.
35
+ - Nested-LLM writer returns prose only; code assembles frontmatter from adjudication results.
36
+ - Writer grounding check flags auto-written numbers/URLs absent from evidence.
37
+
38
+ ### Retrieval and scale
39
+
40
+ - `wiki_toc`: compact agent-facing TOC above 60 pages, per-topic tables, complete `index.md`.
41
+ - Search engines: `index`, in-process BM25 with cache invalidation, and a qmd CLI adapter.
42
+ - Paged-choice tournament for placement beyond 255 candidates.
43
+ - Verified at 1,000 pages: BM25 first search ~170 ms, deterministic lint ~2.6 s.
44
+
45
+ ### Safety and operations
46
+
47
+ - Cross-process wiki lock with stale takeover; shared-state mutations are atomic across sessions.
48
+ - Best-effort secret/PII redaction before content is written or sent to a model.
49
+ - `wiki_doctor`: config, endpoint, key, `.env` gitignore, layout, lock, ledger, queue, sync, search.
50
+ - `wiki_setup`: key status/guide/write-env/test for TypeSafe and OpenRouter; never echoes the key.
51
+ - Decision ledger (`.jev-wiki/decisions.jsonl`) recording agent, Jev, and code decisions.
52
+ - Offline unit tests with a fake Jev client, plus smoke, paging, and scale test scripts.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 jev-wiki contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # pi-jev-wiki
2
+
3
+ [![npm version](https://img.shields.io/npm/v/pi-jev-wiki.svg)](https://www.npmjs.com/package/pi-jev-wiki)
4
+ [![license](https://img.shields.io/npm/l/pi-jev-wiki.svg)](LICENSE)
5
+
6
+ A pi package that gives coding agents a maintained **mental model of a project**: module
7
+ responsibilities, boundaries, data flow, invariants, decisions, and change impact — stored as a
8
+ markdown wiki and maintained with **Jev** (TypeSafe's calibrated decision model).
9
+
10
+ The npm package is **`pi-jev-wiki`** (matching the repository); the extension, tools, and config
11
+ files keep the `jev-wiki` name.
12
+
13
+ Jev decides what is grounded, derivable, durable, and where it belongs. The agent writes. Code
14
+ owns every threshold.
15
+
16
+ - Read [`PLAN.md`](docs/plans/PLAN.md) for the design and phases.
17
+ - Read [`CRITIQUE.md`](docs/CRITIQUE.md) for the risk analysis and efficiency evaluation.
18
+ - Research sources live in [`research/`](research/README.md).
19
+
20
+ ## What it does
21
+
22
+ | Tool | Purpose |
23
+ |---|---|
24
+ | `wiki_toc` | the wiki table of contents (compact above 60 pages, per-topic tables) |
25
+ | `wiki_ask` | find pages and excerpts (index / BM25 / qmd engine) |
26
+ | `wiki_ingest` | ingest a document: raw source → claims → Jev verdicts → placement brief |
27
+ | `wiki_insights` | capture agent insights, Jev-filtered and placed |
28
+ | `wiki_finalize` | update TOC/log after writing pages, check links |
29
+ | `wiki_sync` | re-verify file-linked claims against commits since the last sync |
30
+ | `wiki_review` | list or resolve review items; critical items escalate to the user |
31
+ | `wiki_lint` | health checks: TOC, links, orphans, unbacked claims, contradictions, duplicates |
32
+ | `wiki_remove` | delete obsolete pages and their TOC entries |
33
+ | `wiki_structure` | deterministic module/dependency map and architecture coverage |
34
+ | `wiki_doctor` | config, key, lock, ledger, queue, git/sync, search health |
35
+ | `wiki_setup` | inspect or configure the Jev API key (TypeSafe or OpenRouter) |
36
+ | `wiki_status` | pages, raw sources, ledger, consultations, Jev usage |
37
+ | `/wiki:ingest`, `/wiki:capture`, `/wiki:sync`, `/wiki:review`, `/wiki:lint`, `/wiki:status` | user-facing commands |
38
+
39
+ The wiki is **never injected** into sessions. The table of contents is available like a skill
40
+ (`wiki_toc` + the `llm-wiki` skill); the agent consults it on demand.
41
+
42
+ ## Install
43
+
44
+ ```bash
45
+ pi install /path/to/jev-wiki # local folder
46
+ pi install npm:pi-jev-wiki # once published
47
+ pi install git:github.com/xAndreiLi/pi-jev-wiki@v0.2.0
48
+ ```
49
+
50
+ For development, load it directly:
51
+
52
+ ```bash
53
+ pi -e ./src/extension.ts --skill ./skills/llm-wiki
54
+ ```
55
+
56
+ ## API keys
57
+
58
+ Both supported providers speak the same Jev Decisions schema:
59
+
60
+ | Provider | Env var | Endpoint | Context | Notes |
61
+ |---|---|---|---|---|
62
+ | **TypeSafe** (official, default) | `TYPESAFE_API_KEY` (or `JEV_TOKEN`) | `https://api.typesafe.ai/v1/systemone` | 64k | $0.042/Mtok input, output free |
63
+ | **OpenRouter** | `OPENROUTER_API_KEY` | `https://openrouter.ai/api/alpha/decisions` | 32k advertised | set `provider: "openrouter"`; or reuse pi's `/login openrouter` credential |
64
+
65
+ Put the key in a project-root `.env` (gitignored — `wiki_doctor` verifies):
66
+
67
+ ```bash
68
+ TYPESAFE_API_KEY=... # TypeSafe
69
+ # or
70
+ OPENROUTER_API_KEY=... # OpenRouter
71
+ ```
72
+
73
+ Or reference it from config with `$VAR` indirection:
74
+
75
+ ```json
76
+ { "provider": "openrouter", "apiKey": "$OPENROUTER_API_KEY", "model": "~typesafe/jev-latest" }
77
+ ```
78
+
79
+ When a key is missing, ask the agent to run `wiki_setup`:
80
+
81
+ - `action=status` — provider, endpoint, and where the key came from (never the value)
82
+ - `action=guide provider=typesafe|openrouter` — exact env var, file, and config steps
83
+ - `action=write-env provider=... apiKey=...` — writes to `.env` after checking gitignore
84
+ - `action=test` — one tiny live call to verify connectivity and auth
85
+
86
+ ## Configuration
87
+
88
+ Optional overrides in `~/.pi/agent/jev-wiki.json` or project `.pi/jev-wiki.json`
89
+ (see `src/config.ts` for all keys):
90
+
91
+ ```json
92
+ {
93
+ "provider": "typesafe",
94
+ "model": "jev-latest",
95
+ "wikiRoot": "docs/wiki",
96
+ "writer": { "mode": "guided" },
97
+ "thresholds": { "autoAccept": 0.8, "minDerivable": 0.5 }
98
+ }
99
+ ```
100
+
101
+ ## Wiki layout
102
+
103
+ ```
104
+ docs/wiki/
105
+ ├── raw/<topic>/YYYY-MM-DD-slug.md # immutable sources (documents + session captures)
106
+ └── wiki/
107
+ ├── index.md # generated table of contents
108
+ ├── log.md # generated append-only log
109
+ ├── architecture/ # module-*, flow-*, layer-*
110
+ ├── invariants/ # invariant-*
111
+ ├── decisions/ # decision-* (ADR-style)
112
+ ├── impact/ # impact-* (derived)
113
+ └── <topic>/ # gotcha-*, glossary-*, concept-*, summary-*
114
+ ```
115
+
116
+ Runtime state lives in `docs/wiki/.jev-wiki/` (gitignored): the decision ledger
117
+ (`decisions.jsonl`), raw-source hash index, and session log.
118
+
119
+ ## Development
120
+
121
+ ```bash
122
+ npm install
123
+ npx tsc --noEmit # typecheck
124
+ npm run smoke # deterministic checks + live Jev round-trips
125
+ ```
126
+
127
+ ## Repository layout
128
+
129
+ ```text
130
+ src/ pi extension, Jev client, pipelines, wiki primitives
131
+ skills/ llm-wiki skill + page templates (the schema layer)
132
+ scripts/ unit, smoke, paging, and scale tests
133
+ docs/
134
+ plans/ PLAN.md (master plan) + plans index
135
+ DESIGN.md detailed technical design
136
+ CRITIQUE.md pre-implementation critique and efficiency evaluation
137
+ HARDENING.md hardening roadmap with statuses
138
+ notes/ source notes used for dogfooding
139
+ wiki/ this project's own knowledge wiki (dogfood)
140
+ RELEASING.md release runbook
141
+ research/ source material gathered during design
142
+ ```
143
+
144
+ The published npm package ships only `src/`, `skills/`, `README.md`, and `LICENSE`; everything
145
+ under `docs/` and `research/` stays in the repository.
146
+
147
+ ## Status
148
+
149
+ P0 (walking skeleton) implemented: both intake channels (research ingest + agent insights),
150
+ architecture-first pages, TOC/log, decision ledger, Jev client with retries and usage accounting,
151
+ guided writing. See `docs/plans/PLAN.md` §9 for P1–P3 (change-driven invalidation, paged routing beyond 250
152
+ pages, agent-managed review queue, lint, decision-quality evaluation).
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "pi-jev-wiki",
3
+ "version": "0.2.0",
4
+ "description": "Project mental-model wiki for pi, maintained by agent insights and Jev decisions",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "xAndreiLi",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/xAndreiLi/pi-jev-wiki.git"
11
+ },
12
+ "homepage": "https://github.com/xAndreiLi/pi-jev-wiki#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/xAndreiLi/pi-jev-wiki/issues"
15
+ },
16
+ "engines": {
17
+ "node": ">=22"
18
+ },
19
+ "files": [
20
+ "src",
21
+ "skills",
22
+ "README.md",
23
+ "CHANGELOG.md",
24
+ "LICENSE"
25
+ ],
26
+ "keywords": [
27
+ "pi-package",
28
+ "pi",
29
+ "wiki",
30
+ "jev",
31
+ "knowledge-base"
32
+ ],
33
+ "pi": {
34
+ "extensions": [
35
+ "./src/extension.ts"
36
+ ],
37
+ "skills": [
38
+ "./skills"
39
+ ]
40
+ },
41
+ "scripts": {
42
+ "typecheck": "tsc --noEmit",
43
+ "smoke": "jiti scripts/smoke.ts",
44
+ "test:paging": "jiti scripts/paging-test.ts",
45
+ "test:scale": "jiti scripts/scale-test.ts",
46
+ "test:unit": "jiti scripts/unit-test.ts",
47
+ "test:all": "tsc --noEmit && jiti scripts/unit-test.ts && jiti scripts/scale-test.ts",
48
+ "prepublishOnly": "npm run typecheck && npm run test:unit"
49
+ },
50
+ "peerDependencies": {
51
+ "@earendil-works/pi-ai": "*",
52
+ "@earendil-works/pi-coding-agent": "*",
53
+ "typebox": "*"
54
+ },
55
+ "devDependencies": {
56
+ "@earendil-works/pi-ai": "0.85.1",
57
+ "@earendil-works/pi-coding-agent": "0.85.1",
58
+ "@types/node": "^26.6.2",
59
+ "jiti": "^2.7.0",
60
+ "typebox": "^1.3.34",
61
+ "typescript": "^5.5.4"
62
+ }
63
+ }
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: llm-wiki
3
+ description: "Use when working with the project knowledge wiki: consulting architecture/decisions before changes, ingesting documents, capturing session insights, or maintaining the wiki. Triggers: 'wiki', 'what do we know about', 'why is it built this way', 'ingest', 'capture insights', 'add to wiki'."
4
+ ---
5
+
6
+ # Project Wiki (jev-wiki)
7
+
8
+ The project has a knowledge wiki at `docs/wiki/` (configurable) holding the **mental model** of
9
+ the system: how it is structured, why, and what a change touches. It is not a copy of the code.
10
+ Jev (a calibrated decision model) judges whether claims are grounded, derivable, durable, and
11
+ where they belong; you do the writing.
12
+
13
+ ## Setup (when no key is configured)
14
+
15
+ If Jev calls fail with an authentication error, or the user asks how to connect a provider:
16
+
17
+ 1. `wiki_setup action=status` — shows the provider, endpoint, and where the key came from (never the value).
18
+ 2. `wiki_setup action=guide provider=typesafe|openrouter` — exact env var, file, and config steps.
19
+ 3. Ask the user for the key, then either have them add it to the project `.env` or write it with
20
+ `wiki_setup action=write-env provider=... apiKey=...` (this checks that `.env` is gitignored first).
21
+ 4. `wiki_setup action=test` — one tiny live call to verify connectivity and auth.
22
+
23
+ Never print the key value. TypeSafe uses `TYPESAFE_API_KEY` (`JEV_TOKEN` also works); OpenRouter
24
+ uses `OPENROUTER_API_KEY` with provider `openrouter`, or pi's own `/login openrouter` credential.
25
+
26
+ ## The quality bar
27
+
28
+ File only what the repository cannot answer cheaply:
29
+
30
+ - **Delete test** — if deleting the page would just send a future agent back to reading code, it
31
+ does not belong.
32
+ - **Decision test** — does it help decide *where a change belongs* or *what a change breaks*?
33
+
34
+ Good: module responsibilities and boundaries, dependency direction, data flow, invariants,
35
+ decisions with rationale, change-impact knowledge, historical attempts, external constraints,
36
+ domain glossary. Bad: function bodies, obvious implementation, transient task state, code excerpts.
37
+
38
+ ## Layout
39
+
40
+ ```
41
+ docs/wiki/
42
+ ├── raw/<topic>/YYYY-MM-DD-slug.md # immutable sources (never edit)
43
+ └── wiki/
44
+ ├── index.md # TOC — generated, never hand-edit
45
+ ├── log.md # append-only, generated
46
+ ├── architecture/ # module-*.md · flow-*.md · layer-*.md
47
+ ├── invariants/ # invariant-*.md
48
+ ├── decisions/ # decision-*.md (ADR-style)
49
+ ├── impact/ # impact-*.md (derived)
50
+ └── <topic>/ # gotcha-*.md · glossary-*.md · concept-*.md · summary-*.md
51
+ ```
52
+
53
+ ## When to consult
54
+
55
+ Before architectural, cross-cutting, or unfamiliar changes; when planning work; when a project
56
+ term is unclear; before answering "how does X work here?".
57
+
58
+ 1. `wiki_toc` — browse the table of contents (filter by topic/tag/query).
59
+ 2. `wiki_ask` — find relevant pages for a question.
60
+ 3. `read` the pages it returns, then cite them (`docs/wiki/wiki/...`) in your answer.
61
+ 4. Never invent wiki content; if it is not there, say so and consider whether it should be.
62
+
63
+ ## Operating the wiki
64
+
65
+ ### Respect the verdicts
66
+
67
+ Jev's adjudication is binding: write only claims the brief marks **File** or **Reinforce**.
68
+ Rejected claims are **not** written to the wiki — even when the user explicitly asks for that
69
+ content. Report what was rejected and why, so the user can supply better evidence or a stronger
70
+ artifact. Never hand-write a rejected claim into a page.
71
+
72
+ ### Ingest a document (research channel)
73
+
74
+ 1. `wiki_ingest` with `path` (or `text`) — it stores the raw source, extracts claims, and returns
75
+ a Jev-verified brief.
76
+ 2. Write or merge the **accepted** pages (guided mode: you write).
77
+ 3. `wiki_finalize` with every touched page.
78
+
79
+ ### Capture session insights (work channel)
80
+
81
+ 1. Compose atomic insights with evidence pointers (files, commits, tests, user statements).
82
+ No transient state, no code snippets, nothing derivable from the repo.
83
+ 2. `wiki_insights` with the list — Jev filters (derivable/durable/sensitive), relates them to
84
+ existing knowledge, and chooses placement. Include file/commit evidence: file evidence is read
85
+ and excerpted for Jev, which grounds the decision.
86
+ 3. Write or merge the **accepted** pages, then `wiki_finalize`.
87
+
88
+ ## Page format
89
+
90
+ ```markdown
91
+ ---
92
+ title: Auth module
93
+ type: architecture/module
94
+ topic: architecture
95
+ summary: Owns token validation and session issuance.
96
+ tags: [auth, security]
97
+ updated: 2026-09-19
98
+ sources: [raw/auth/2026-09-19-auth-notes.md]
99
+ claims:
100
+ - id: c1
101
+ text: "Token validation lives in the auth module and is the only issuer of sessions."
102
+ status: verified # verified | user-stated | unsupported | contradicted | disputed | superseded
103
+ support: 0.96
104
+ evidence: ["raw/auth/2026-09-19-auth-notes.md"]
105
+ files: [src/auth/index.ts]
106
+ ---
107
+
108
+ # Auth module
109
+
110
+ Responsibility, public surface, dependencies, invariants, and key files.
111
+
112
+ ## Invariants
113
+ - ...
114
+
115
+ ## Change impact
116
+ - ...
117
+
118
+ ## See also
119
+ - [Session flow](../architecture/flow-session.md)
120
+ ```
121
+
122
+ Rules:
123
+
124
+ - Every load-bearing claim points at raw evidence or a file/commit/test; numbers and quotes must
125
+ exist verbatim in the source.
126
+ - Never silently rewrite history. Superseded or contradicted claims keep their text, get
127
+ `status: superseded|disputed`, and link the newer claim/source.
128
+ - Relative links inside the wiki; project-relative paths when citing in conversation.
129
+ - One level of topic subdirectories; page names are kebab-case and describe the subject, not the
130
+ source file.
131
+ - Prefer updating an existing page over creating a new one — but if nothing fits, create one and
132
+ let the TOC absorb it.
133
+
134
+ ## Maintenance
135
+
136
+ - If a page's claim is invalidated by code you changed this session, update it (or mark it
137
+ `needs_recheck`) and mention it in your summary.
138
+ - When you notice a contradiction between pages, mark both with `status: disputed` and cross-link
139
+ them; do not silently pick a winner.
140
+ - Report broken links and orphans to the user; `wiki_finalize` checks links on touched pages.
141
+
142
+ Templates live in `references/` next to this skill: `module.md`, `flow.md`, `invariant.md`,
143
+ `decision.md`, `gotcha.md`.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: decision-page
3
+ description: Template for ADR-style decision records.
4
+ ---
5
+
6
+ # <Decision title>
7
+
8
+ **Status.** accepted | superseded by [link] | deprecated
9
+
10
+ **Date.** YYYY-MM-DD
11
+
12
+ ## Context
13
+
14
+ - The forces at play: constraints, requirements, prior art, deadlines.
15
+
16
+ ## Options considered
17
+
18
+ 1. Option A — pros, cons.
19
+ 2. Option B — pros, cons.
20
+
21
+ ## Decision
22
+
23
+ - What was chosen and the decisive reasons.
24
+
25
+ ## Consequences
26
+
27
+ - What becomes easy, what becomes hard, what must now be maintained.
28
+ - What would trigger revisiting this decision.
29
+
30
+ ## Evidence
31
+
32
+ - Sources, discussions, experiments, or commits that support the rationale.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: flow-page
3
+ description: Template for end-to-end data or control flow wiki pages.
4
+ ---
5
+
6
+ # <Flow name>
7
+
8
+ **Trigger.** What starts this flow.
9
+
10
+ **Participants.** The modules/services involved, in order.
11
+
12
+ ## Steps
13
+
14
+ 1. Entry point (`src/...`) — input shape.
15
+ 2. Transformation / hand-off — what changes and where.
16
+ 3. Exit — output shape, side effects, storage.
17
+
18
+ ## Invariants
19
+
20
+ - Ordering guarantees, idempotency, exactly-once/at-least-once properties.
21
+
22
+ ## Failure modes
23
+
24
+ - Where it can stall, retry, or duplicate; how errors surface.
25
+
26
+ ## Change impact
27
+
28
+ - Steps and modules affected by changes to each stage.
29
+
30
+ ## See also
31
+
32
+ - Related module, invariant, and decision pages.
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: gotcha-page
3
+ description: Template for footguns and non-obvious failure modes.
4
+ ---
5
+
6
+ # <Gotcha>
7
+
8
+ **Symptom.** What a developer observes when they hit this.
9
+
10
+ **Cause.** The non-obvious mechanism behind it.
11
+
12
+ **Avoidance.** What to do instead; the safe pattern.
13
+
14
+ **Detection.** How to tell you are about to hit it (tests, lints, logs).
15
+
16
+ **Related.** Invariants, decisions, or modules involved.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: invariant-page
3
+ description: Template for rules that must always hold.
4
+ ---
5
+
6
+ # <Invariant statement>
7
+
8
+ **Statement.** One sentence, testable, ideally in "must / must never" form.
9
+
10
+ **Why it exists.** The failure it prevents; the decision that created it.
11
+
12
+ **Where it is enforced.** Code locations, tests, checks (pointers only).
13
+
14
+ **What breaks if violated.** Symptoms and blast radius.
15
+
16
+ **How to verify.** The test or command that proves it holds.
17
+
18
+ ## Related
19
+
20
+ - Decisions, modules, and gotchas that interact with this invariant.
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: architecture-page
3
+ description: Template for architecture module/flow/layer wiki pages.
4
+ ---
5
+
6
+ # <Subject>
7
+
8
+ **Responsibility.** What this module/flow/layer owns, in one or two sentences.
9
+
10
+ **Public surface.** The contracts other parts of the system rely on.
11
+
12
+ **Dependencies.** What it depends on, and the direction (never the reverse).
13
+
14
+ **Key files.** `src/...` — pointers only, no code.
15
+
16
+ ## Invariants
17
+
18
+ - Rules that must always hold; each linked to evidence in the claim frontmatter.
19
+
20
+ ## Failure modes
21
+
22
+ - What breaks, how it surfaces, and what to do.
23
+
24
+ ## Change impact
25
+
26
+ - If you change X, these parts are affected; tests/owners to consult.
27
+
28
+ ## See also
29
+
30
+ - Relative links to related pages.