the-grimoire-cli 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 (103) hide show
  1. package/.agents/AGENTS.md +112 -0
  2. package/.agents/NAVIGATOR.md +168 -0
  3. package/.agents/VERSION +4 -0
  4. package/.agents/agents/INDEX.md +7 -0
  5. package/.agents/agents/verifier.md +50 -0
  6. package/.agents/commands/INDEX.md +11 -0
  7. package/.agents/commands/checkpoint.md +15 -0
  8. package/.agents/commands/grimoire.md +14 -0
  9. package/.agents/commands/onboard.md +56 -0
  10. package/.agents/commands/present.md +23 -0
  11. package/.agents/commands/verify.md +20 -0
  12. package/.agents/grimoire.manifest +18 -0
  13. package/.agents/rules/00-always.md +42 -0
  14. package/.agents/rules/05-code-quality.md +28 -0
  15. package/.agents/rules/10-working-process.md +31 -0
  16. package/.agents/rules/15-skills.md +27 -0
  17. package/.agents/rules/20-modes.md +41 -0
  18. package/.agents/rules/25-surgical-changes.md +29 -0
  19. package/.agents/rules/30-verification.md +36 -0
  20. package/.agents/rules/35-context-economy.md +41 -0
  21. package/.agents/rules/40-handoff.md +25 -0
  22. package/.agents/rules/45-presentation.md +35 -0
  23. package/.agents/rules/50-security.md +30 -0
  24. package/.agents/rules/60-commit-style.md +14 -0
  25. package/.agents/rules/INDEX.md +18 -0
  26. package/.agents/skills/INDEX.md +8 -0
  27. package/.agents/skills/README.md +6 -0
  28. package/.agents/skills/catalog.md +106 -0
  29. package/.agents/skills/find-skills/SKILL.md +142 -0
  30. package/.agents/stack/INDEX.md +9 -0
  31. package/.agents/stack/README.md +66 -0
  32. package/.agents/stack/desktop.md +36 -0
  33. package/.agents/stack/library.md +16 -0
  34. package/.agents/stack/web-app.md +32 -0
  35. package/.agents/standards/INDEX.md +23 -0
  36. package/.agents/standards/accessibility.md +50 -0
  37. package/.agents/standards/architecture.md +39 -0
  38. package/.agents/standards/attribution.md +39 -0
  39. package/.agents/standards/clean-code.md +121 -0
  40. package/.agents/standards/codex.md +69 -0
  41. package/.agents/standards/error-codes.md +41 -0
  42. package/.agents/standards/general.md +46 -0
  43. package/.agents/standards/guardrail-tests.md +40 -0
  44. package/.agents/standards/knowledge-management.md +35 -0
  45. package/.agents/standards/launch-security-checklist.md +45 -0
  46. package/.agents/standards/observability.md +35 -0
  47. package/.agents/standards/release-versioning.md +53 -0
  48. package/.agents/standards/requirements.md +75 -0
  49. package/.agents/standards/security-scanners.md +42 -0
  50. package/.agents/standards/testing-strategy.md +61 -0
  51. package/.agents/standards/typescript.md +19 -0
  52. package/.agents/standards/writing.md +58 -0
  53. package/.agents/tooling.json +19 -0
  54. package/LICENSE +21 -0
  55. package/README.md +139 -0
  56. package/bin/grimoire.mjs +598 -0
  57. package/package.json +32 -0
  58. package/templates/CLAUDE.md +7 -0
  59. package/templates/ci/ci.yml +49 -0
  60. package/templates/ci/sast.yml +44 -0
  61. package/templates/codex/INDEX.md +18 -0
  62. package/templates/codex/README.md +28 -0
  63. package/templates/codex/decisions/0000-template.md +36 -0
  64. package/templates/codex/decisions/INDEX.md +11 -0
  65. package/templates/codex/decisions/README.md +25 -0
  66. package/templates/codex/domain/INDEX.md +14 -0
  67. package/templates/codex/domain/README.md +10 -0
  68. package/templates/codex/evidence/0000-extraction-template.md +36 -0
  69. package/templates/codex/evidence/INDEX.md +11 -0
  70. package/templates/codex/evidence/README.md +15 -0
  71. package/templates/codex/reference/INDEX.md +11 -0
  72. package/templates/codex/reference/README.md +15 -0
  73. package/templates/codex/reference/confirmed-values.md +18 -0
  74. package/templates/codex/requirements/INDEX.md +11 -0
  75. package/templates/codex/requirements/README.md +22 -0
  76. package/templates/codex/requirements/addons/0000-template.md +35 -0
  77. package/templates/codex/requirements/base.md +36 -0
  78. package/templates/codex/requirements/changes/0000-template.md +39 -0
  79. package/templates/codex/resources/INDEX.md +11 -0
  80. package/templates/codex/resources/README.md +17 -0
  81. package/templates/codex/resources/manifest.md +11 -0
  82. package/templates/codex/runbooks/INDEX.md +9 -0
  83. package/templates/codex/runbooks/README.md +8 -0
  84. package/templates/codex/runbooks/incident-runbook-template.md +58 -0
  85. package/templates/gitignore-snippet.txt +12 -0
  86. package/templates/journal/backlog/README.md +18 -0
  87. package/templates/journal/backlog/done/.gitkeep +0 -0
  88. package/templates/journal/memory/MEMORY.md +15 -0
  89. package/templates/journal/session/.gitkeep +0 -0
  90. package/templates/journal/session/archive/.gitkeep +1 -0
  91. package/templates/journal/session/artifacts/.gitkeep +1 -0
  92. package/templates/journal/session/current.md +12 -0
  93. package/templates/lint/README.md +25 -0
  94. package/templates/lint/eslint.config.mjs +33 -0
  95. package/templates/lint/tsconfig.base.json +11 -0
  96. package/templates/local/AGENTS.local.md +33 -0
  97. package/templates/local/README.md +55 -0
  98. package/templates/local/commands/.gitkeep +0 -0
  99. package/templates/local/rules/.gitkeep +0 -0
  100. package/templates/local/skills/.gitkeep +0 -0
  101. package/templates/local/stack/.gitkeep +0 -0
  102. package/templates/local/standards/.gitkeep +0 -0
  103. package/templates/tests/guardrail.invariants.test.ts +59 -0
@@ -0,0 +1,49 @@
1
+ # CI — lint, typecheck, test, build. Copy to .github/workflows/ci.yml.
2
+ # This is the correctness gate; security scanning lives in the sibling sast.yml.
3
+ # Commands here must match the active stack profile's `verify` (.agents/stack/<profile>.md) —
4
+ # keep them in sync so local `verify` and CI run the same checks.
5
+ name: ci
6
+
7
+ on:
8
+ pull_request:
9
+ push:
10
+ branches: [main, master]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ verify:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-node@v4
21
+ with:
22
+ node-version: "20"
23
+ cache: npm # change to pnpm/yarn to match the project
24
+
25
+ - run: npm ci
26
+
27
+ # --- The four gates. Drop any line a profile doesn't have; order is cheapest-first. ---
28
+ - name: Lint
29
+ run: npm run lint
30
+
31
+ - name: Typecheck
32
+ run: npx tsc --noEmit
33
+
34
+ - name: Test
35
+ run: npm test # node --test / vitest / jest per profile
36
+
37
+ - name: Build
38
+ run: npm run build
39
+
40
+ # --- Contract guard: agent docs/index must not drift (.agents/) ---
41
+ - name: Grimoire index check
42
+ run: npx github:nuttchanon/the-grimoire index --check
43
+ # Remove this step if the project does not vendor Grimoire's INDEX.md generation.
44
+
45
+ # Per stack profile (.agents/stack/):
46
+ # web-app : lint + typecheck + test (vitest) + build (next build). Add the e2e job when present.
47
+ # desktop : lint + typecheck + test + build (electron-builder --dir for PR; full pack on release).
48
+ # library : lint + typecheck + test + build (tsup/unbuild) + a changesets status check on PRs.
49
+ # Accessibility: add an axe/Lighthouse job for user-facing apps (.agents/standards/accessibility.md).
@@ -0,0 +1,44 @@
1
+ # SAST — static application security testing. Copy to .github/workflows/sast.yml.
2
+ # Linters find what is ugly; SAST finds what is exploitable (SQLi, XSS, RCE, secrets, weak crypto).
3
+ # Fail the build on High/Critical. Scanner choice is per stack profile — see notes at the bottom.
4
+ name: sast
5
+
6
+ on:
7
+ pull_request:
8
+ push:
9
+ branches: [main, master]
10
+
11
+ permissions:
12
+ contents: read
13
+ security-events: write # for SARIF upload to GitHub code scanning
14
+
15
+ jobs:
16
+ semgrep:
17
+ # Pattern-based, 30+ languages. Default for every profile.
18
+ runs-on: ubuntu-latest
19
+ container: { image: semgrep/semgrep }
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - run: semgrep ci --config auto --error
23
+ env:
24
+ # Optional: set SEMGREP_APP_TOKEN to use org rules + the Semgrep dashboard.
25
+ SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
26
+
27
+ njsscan:
28
+ # JS / Node / React / React Native / Electron. Drop this job for non-JS profiles.
29
+ runs-on: ubuntu-latest
30
+ steps:
31
+ - uses: actions/checkout@v4
32
+ - uses: actions/setup-python@v5
33
+ with: { python-version: "3.12" }
34
+ - run: pip install njsscan
35
+ - run: njsscan --exit-on-warn .
36
+
37
+ # Per stack profile (standards/security-scanners.md):
38
+ # web-app (Next.js) : semgrep + njsscan here, AND enable CodeQL code scanning (js/ts).
39
+ # desktop (Electron) : semgrep + njsscan here (njsscan flags Electron sinks), AND CodeQL.
40
+ # library : semgrep here; add the language's native scanner (bandit/gosec/…) if not JS/TS.
41
+ # any Python service : add a bandit job (pip install bandit; bandit -r src -ll).
42
+ #
43
+ # CodeQL is configured separately — GitHub → Security → Code scanning → enable default setup,
44
+ # or add github/codeql-action via its own workflow. It is free for public repos.
@@ -0,0 +1,18 @@
1
+ # codex — index (read this first)
2
+
3
+ The project's **knowledge / resource root**. Read this signpost before touching any domain reference,
4
+ then open the matching subfolder's own `INDEX.md`. Project-owned: `grimoire sync` never touches
5
+ `codex/`; the base holds only a pointer to it. Every folder below keeps its own `INDEX.md`.
6
+
7
+ | Folder | What it holds |
8
+ |---|---|
9
+ | `domain/` | What the system **is** — glossary, context, business rules, capabilities. |
10
+ | `requirements/` | What it must **do** — IDed, versioned base + addons + change requests. |
11
+ | `decisions/` | **Why** it is built this way — ADRs (one file per decision). |
12
+ | `evidence/` | Investigation / reverse-engineering / extraction outputs, each fact sourced. |
13
+ | `resources/` | Raw materials — datasets, vendor specs, dumps, external artifacts/snapshots. |
14
+ | `reference/` | Confirmed-value tables, API/IPC catalogs, big contracts the code reads back. |
15
+ | `runbooks/` | The on-call answer to "production is broken — what now." |
16
+
17
+ Protocol: `.agents/standards/codex.md`. The structure is **extensible** — add a folder when a new
18
+ kind of knowledge appears; give it an `INDEX.md` and list it here.
@@ -0,0 +1,28 @@
1
+ # codex
2
+
3
+ The project's **knowledge and resource root**, at the repo root (not under `.agents/`). It is the
4
+ rebuild's source of truth: what the system is, what it must do, why it's built that way, and the raw
5
+ materials and evidence behind those claims. Project-owned — `grimoire sync` never touches it; the
6
+ base contract only points here. Full protocol: `.agents/standards/codex.md`.
7
+
8
+ ## Read-first rule
9
+
10
+ Any domain reference starts at `codex/INDEX.md`, then the relevant subfolder's `INDEX.md`. New work
11
+ reads the matching INDEX **before** acting — don't start a task blind to recorded knowledge.
12
+
13
+ ## Provenance discipline
14
+
15
+ Every recorded fact cites its **source** (file + offset/record) and a **CONFIRMED | INFERRED** tag.
16
+ Unsupported claims are removed or demoted to "not recovered" — no unsourced guesses. Pre-existing
17
+ docs are not trusted until audited to this standard (carry `audited: <date>`).
18
+
19
+ ## How to add a folder
20
+
21
+ codex is extensible. When a new kind of knowledge appears, add a folder, give it an `INDEX.md`
22
+ (signpost table) and a short `README.md`, and list it in the master `codex/INDEX.md`. Keep every
23
+ file lean (context economy).
24
+
25
+ ## Secrets
26
+
27
+ Real secrets / PHI never go in tracked knowledge docs — see `resources/README.md` and
28
+ `.agents/standards/codex.md`. The chat is the leak boundary: never echo a secret or PHI into output.
@@ -0,0 +1,36 @@
1
+ ---
2
+ id: 0000
3
+ title: <short decision title>
4
+ status: proposed # proposed | accepted | superseded | deprecated
5
+ date: <YYYY-MM-DD>
6
+ updates-confirmed-values: no # yes | no — see "Confirmed values" below
7
+ supersedes: # ADR id(s) this replaces, if any
8
+ ---
9
+
10
+ # ADR 0000 — <short decision title>
11
+
12
+ ## Context
13
+
14
+ What forces this decision? The problem, constraints, and the options actually on the table. Keep it
15
+ factual — no solution yet.
16
+
17
+ ## Decision
18
+
19
+ The choice, stated as one sentence in active voice ("We will …"). Then the *why* in a few lines.
20
+
21
+ ## Consequences
22
+
23
+ What becomes easier, what becomes harder, what we now owe (migrations, follow-ups, risks).
24
+
25
+ ## Confirmed values
26
+
27
+ > Set `updates-confirmed-values: yes` in the frontmatter **only if this decision changes a value the
28
+ > code treats as ground truth** — an IPC channel name, an error code, a permission key, a hospital/
29
+ > tenant config, an enum the UI and server both depend on.
30
+
31
+ If `yes`: list each value below **and** update the project's confirmed-values table
32
+ (`codex/reference/`) in the same PR (the PR checklist enforces this). If `no`, delete this section.
33
+
34
+ | Value | Old | New | Where it lives |
35
+ |---|---|---|---|
36
+ | | | | |
@@ -0,0 +1,11 @@
1
+ # decisions — index
2
+
3
+ **Why** the system is built the way it is: Architecture Decision Records, one file per decision.
4
+ Requirements say *what*; decisions say *how* and *why*.
5
+
6
+ | Entry | What it holds |
7
+ |---|---|
8
+ | `README.md` | When to write an ADR, the `updates-confirmed-values` field, the status lifecycle. |
9
+ | `0000-template.md` | Copy this for each new decision: `NNNN-kebab-title.md`. |
10
+
11
+ <!-- ADRs accumulate here as NNNN-kebab-title.md; number sequentially, never renumber. -->
@@ -0,0 +1,25 @@
1
+ # Architecture Decision Records
2
+
3
+ One file per decision: `codex/decisions/NNNN-kebab-title.md`, copied from `0000-template.md`. ADRs are
4
+ **project-owned** — `grimoire sync` never touches this folder. Number sequentially; never renumber.
5
+
6
+ ## When to write one
7
+
8
+ - A choice with lasting consequences (framework, data model, auth model, module boundaries).
9
+ - A trade-off a future reader would otherwise relitigate.
10
+ - **No test suite for a unit of work.** Absence of tests is a *recorded decision*, not a silent
11
+ omission: open an ADR stating why (spike/throwaway, external constraint) and the conditions under
12
+ which tests get backfilled. A missing test suite with no ADR is a defect.
13
+
14
+ ## The `updates-confirmed-values` field
15
+
16
+ Some values are **ground truth** the code reads back — IPC channel names, error codes, permission
17
+ keys, tenant/hospital configs, shared enums. When an ADR changes one of these, set
18
+ `updates-confirmed-values: yes` and, **in the same PR**, update the project's confirmed-values table
19
+ (`codex/reference/`). The PR checklist must verify the table was updated; a `yes` ADR without a
20
+ matching table change does not merge.
21
+
22
+ ## Status lifecycle
23
+
24
+ `proposed` → `accepted` (merged) → later `superseded` (point the new ADR's `supersedes:` at it) or
25
+ `deprecated`. Never delete an accepted ADR; supersede it so the history stays legible.
@@ -0,0 +1,14 @@
1
+ # domain — index
2
+
3
+ What the system **is**: the shared language and rules that everything else cites. Read before
4
+ writing requirements or code in an unfamiliar area.
5
+
6
+ | Entry | What it holds |
7
+ |---|---|
8
+ | `README.md` | What belongs in `domain/` and how to keep it sourced. |
9
+ | `glossary.md` | Domain terms → precise definitions (add as the language stabilizes). |
10
+ | `context.md` | The business/system context: actors, boundaries, why the system exists. |
11
+ | `business-rules.md` | The rules the system must enforce, each cited to its source. |
12
+ | `capabilities.md` | What the system can do, at the capability (not requirement) level. |
13
+
14
+ <!-- Seed these files as the domain takes shape; delete rows you don't use yet. -->
@@ -0,0 +1,10 @@
1
+ # domain
2
+
3
+ What the system **is** — the shared vocabulary and the business rules that requirements, decisions,
4
+ and code all refer back to. This is where you fix the language so two people (or agents) mean the
5
+ same thing by the same word. Glossary, business/system context, enforced business rules, and the
6
+ high-level capability map live here.
7
+
8
+ Hold to the codex provenance discipline: each rule or definition that comes from a source artifact
9
+ cites it (file + offset, `CONFIRMED | INFERRED`). A definition you invented for convenience is
10
+ `INFERRED` until confirmed. See `.agents/standards/codex.md`.
@@ -0,0 +1,36 @@
1
+ ---
2
+ id: 0000
3
+ title: <what was extracted / investigated>
4
+ status: draft # draft | reviewed
5
+ date: <YYYY-MM-DD>
6
+ audited: <YYYY-MM-DD> # date this doc was checked to the provenance standard
7
+ ---
8
+
9
+ # Extraction 0000 — <what was extracted / investigated>
10
+
11
+ ## Source artifact
12
+
13
+ What you investigated: file path / binary / dump / vendor doc, version or hash if known. One artifact
14
+ per doc where possible.
15
+
16
+ ## Method / tool
17
+
18
+ How you extracted it — the tool, command, decompiler, query, or manual read. Enough that someone
19
+ could repeat it and get the same result.
20
+
21
+ ## Findings
22
+
23
+ | item | source (file + offset/record) | CONFIRMED \| INFERRED | purpose |
24
+ |---|---|---|---|
25
+ | <value / rule / field> | `<file>:<offset>` or `<table>:<row>` | CONFIRMED | <what it's for> |
26
+
27
+ ## Not recovered
28
+
29
+ What you looked for and could **not** establish, and why (encrypted, stripped, absent). This bounds
30
+ the claim — don't let a gap pass as settled.
31
+
32
+ ## Security / redaction note
33
+
34
+ Confirm no real secret / PHI is recorded above. If the artifact contained any, record only its
35
+ **location + purpose** here for rotate/revoke; the value goes in the gitignored inventory
36
+ (`resources/`), never in this tracked doc.
@@ -0,0 +1,11 @@
1
+ # evidence — index
2
+
3
+ Outputs of investigation, reverse-engineering, and extraction — the raw findings that feed `domain/`,
4
+ `reference/`, and `requirements/`. Every fact here is sourced.
5
+
6
+ | Entry | What it holds |
7
+ |---|---|
8
+ | `README.md` | The provenance discipline, in brief; points to `.agents/standards/codex.md`. |
9
+ | `0000-extraction-template.md` | Copy for each extraction run: source, method, sourced findings table. |
10
+
11
+ <!-- Extraction docs accumulate here as NNNN-<slug>.md. -->
@@ -0,0 +1,15 @@
1
+ # evidence
2
+
3
+ Where investigation lands: reverse-engineering a legacy binary, extracting values from a vendor spec,
4
+ reading a database dump, recovering a protocol. These docs are the **paper trail** behind every
5
+ confirmed fact in `domain/`, `reference/`, and `requirements/`.
6
+
7
+ ## Provenance discipline (in brief)
8
+
9
+ - Every finding cites its **source** — file + offset/record — and a **CONFIRMED | INFERRED** tag.
10
+ - What you couldn't recover is listed explicitly under "Not recovered" — silence is not a finding.
11
+ - No unsourced guesses. An `INFERRED` row stays inferred until a source confirms it.
12
+ - Never paste a real secret / PHI into an evidence doc; record its **location and purpose**, not its
13
+ value (see `resources/README.md` + `.agents/standards/codex.md`).
14
+
15
+ Copy `0000-extraction-template.md` per run. Full standard: `.agents/standards/codex.md`.
@@ -0,0 +1,11 @@
1
+ # reference — index
2
+
3
+ The confirmed-value layer: ground-truth tables, API/IPC catalogs, and big contract docs the **code
4
+ reads back**. ADRs that set `updates-confirmed-values: yes` update tables here in the same PR.
5
+
6
+ | Entry | What it holds |
7
+ |---|---|
8
+ | `README.md` | What belongs here vs `domain/`; the confirmed-values discipline. |
9
+ | `confirmed-values.md` | Ground-truth values (error codes, permission keys, enums, channel names). |
10
+
11
+ <!-- Add catalogs / contract docs alongside; list each here. -->
@@ -0,0 +1,15 @@
1
+ # reference
2
+
3
+ Confirmed-value tables and large runtime contracts the code depends on literally: error-code
4
+ catalogs, permission keys, shared enums, IPC/channel names, API/IPC catalogs, tenant/hospital config
5
+ tables. `domain/` explains *what things mean*; `reference/` pins *the exact values* both sides read
6
+ back.
7
+
8
+ ## Confirmed-values discipline
9
+
10
+ - A value here is **ground truth** — code, tests, UI, and server agree on it. Treat a change as
11
+ breaking until proven otherwise.
12
+ - An ADR (`codex/decisions/`) that alters one sets `updates-confirmed-values: yes` and updates the
13
+ table **in the same PR** (the PR checklist enforces this).
14
+ - Each value carries its provenance (`CONFIRMED | INFERRED`, source) per `.agents/standards/codex.md`.
15
+ An `INFERRED` value is a lead, not a contract — confirm it before code relies on it.
@@ -0,0 +1,18 @@
1
+ ---
2
+ updated: <YYYY-MM-DD>
3
+ status: canonical
4
+ description: Ground-truth values the code reads back. Changed only via an ADR with updates-confirmed-values: yes, in the same PR.
5
+ ---
6
+
7
+ # Confirmed values
8
+
9
+ Values the system treats as **ground truth** — error codes, permission keys, shared enums, channel /
10
+ IPC names, tenant configs. Changing one is breaking: it goes through an ADR
11
+ (`codex/decisions/`) with `updates-confirmed-values: yes`, updated here in the **same PR**.
12
+
13
+ | key | value | kind | source (file + offset) | CONFIRMED \| INFERRED |
14
+ |---|---|---|---|---|
15
+ | <e.g. ERR_AUTH_EXPIRED> | <value> | error code | `<file>:<offset>` | CONFIRMED |
16
+
17
+ <!-- One table per kind is fine (error codes, permissions, enums…). Never silently edit a value:
18
+ every change traces to an ADR. -->
@@ -0,0 +1,11 @@
1
+ # requirements — index
2
+
3
+ What the system must **do**, as a tracked, IDed, versioned artifact. Protocol:
4
+ `.agents/standards/requirements.md`.
5
+
6
+ | Entry | What it holds |
7
+ |---|---|
8
+ | `README.md` | Rules of the road: stable ids, base-reflects-now, testable statements. |
9
+ | `base.md` | The baseline — what the system must do **now**. Changed only via an applied addon/CR. |
10
+ | `addons/0000-template.md` | Template for a new capability layered on the base. |
11
+ | `changes/0000-template.md` | Template for a change request modifying existing requirements. |
@@ -0,0 +1,22 @@
1
+ # Requirements
2
+
3
+ The project's requirements as a tracked, referenceable artifact. Project-owned: `grimoire sync` never
4
+ touches this folder (seeded once by `grimoire init`). Full protocol:
5
+ `.agents/standards/requirements.md`.
6
+
7
+ ## Files
8
+
9
+ | Path | Holds |
10
+ |---|---|
11
+ | `base.md` | The baseline — what the system must do **now**. Changed only via an applied addon/CR. |
12
+ | `addons/<id>-<slug>.md` | A new capability layered on the base (copy `addons/0000-template.md`). |
13
+ | `changes/<id>-<slug>.md` | A change request modifying existing requirements (copy `changes/0000-template.md`). |
14
+
15
+ ## Rules of the road
16
+
17
+ - Every requirement has a stable id `REQ-<AREA>-<NNN>` — sequential per area, **never reused or
18
+ renumbered**. A removed requirement becomes `status: withdrawn`; its row stays.
19
+ - Cite the id in commits (`implements REQ-…`), test names, and the ADR that decided *how*.
20
+ - The **base always reflects now**; addons and CRs are the **audit trail** of how it got there.
21
+ Never change a requirement in `base.md` without a matching addon/CR file recording the diff.
22
+ - A requirement must be a **testable** statement. If it can't be verified, it isn't finished.
@@ -0,0 +1,35 @@
1
+ ---
2
+ id: ADDON-0000
3
+ title: <short addon title>
4
+ status: proposed # proposed | accepted | implemented | withdrawn
5
+ date: <YYYY-MM-DD>
6
+ extends: # REQ-… ids in base this builds on, if any
7
+ ---
8
+
9
+ # Addon ADDON-0000 — <short addon title>
10
+
11
+ A self-contained new capability layered on the base. Reviewable on its own. When it ships, fold its
12
+ rows into `base.md` and bump the base `version`; this file stays as history.
13
+ See `.agents/standards/requirements.md`.
14
+
15
+ ## Why
16
+
17
+ What user need / opportunity this addresses. Link the PRD or discussion if any.
18
+
19
+ ## New requirements
20
+
21
+ | id | statement | priority | status | acceptance | source |
22
+ |---|---|---|---|---|---|
23
+ | REQ-<AREA>-<NNN> | The system must <testable statement>. | must | proposed | <test or check> | this addon |
24
+
25
+ ## Dependencies & impact
26
+
27
+ - **Builds on:** <REQ-… in base, or "none">
28
+ - **Touches:** <code areas, modules>
29
+ - **Decisions needed:** <ADR id(s) this spawns, if a design choice is required>
30
+ - **Confirmed values:** <does it add/change an error code, permission key, enum, channel? if so, the
31
+ ADR sets `updates-confirmed-values: yes` and the table updates in the same PR>
32
+
33
+ ## Acceptance (addon-level)
34
+
35
+ How we know the whole addon is done — the set of checks across its requirements.
@@ -0,0 +1,36 @@
1
+ ---
2
+ version: 0.1.0
3
+ updated: <YYYY-MM-DD>
4
+ status: canonical
5
+ description: Baseline requirements — what the system must do now. Changed only via an applied addon or change request.
6
+ ---
7
+
8
+ # Requirements — baseline
9
+
10
+ The agreed requirements at the current accepted state. This file always reflects **now**. It changes
11
+ only when an addon (`addons/`) or change request (`changes/`) is applied — see
12
+ `.agents/standards/requirements.md` for the flow. Never edit a requirement here without a matching
13
+ addon/CR file recording the diff.
14
+
15
+ ## How to read a row
16
+
17
+ `id` (stable `REQ-<AREA>-<NNN>`, never reused) · `statement` (one testable "the system must …") ·
18
+ `priority` (`must | should | could`) · `status` (`proposed | accepted | implemented | withdrawn`) ·
19
+ `acceptance` (the test or check that proves it) · `source` (who/what introduced it).
20
+
21
+ ## Requirements
22
+
23
+ ### AREA: <e.g. AUTH>
24
+
25
+ | id | statement | priority | status | acceptance | source |
26
+ |---|---|---|---|---|---|
27
+ | REQ-AUTH-001 | The system must <testable statement>. | must | accepted | `test/auth/...` or manual check | initial spec |
28
+
29
+ <!-- Add one section per area. Keep numbers sequential per area; never renumber or reuse an id.
30
+ A withdrawn requirement stays in the table with status: withdrawn — do not delete the row. -->
31
+
32
+ ## Changelog (applied addons / CRs)
33
+
34
+ | date | id | kind | summary | base version after |
35
+ |---|---|---|---|---|
36
+ | <YYYY-MM-DD> | <ADDON-001 / CR-001> | addon \| change | <one line> | 0.1.0 |
@@ -0,0 +1,39 @@
1
+ ---
2
+ id: CR-0000
3
+ title: <short change title>
4
+ status: proposed # proposed | accepted | applied | rejected
5
+ date: <YYYY-MM-DD>
6
+ affects: # the REQ-… id(s) this change modifies
7
+ ---
8
+
9
+ # Change Request CR-0000 — <short change title>
10
+
11
+ A modification to one or more **existing** requirements. Records the diff old → new so the change is
12
+ auditable. When applied, update the affected rows in `base.md`, bump the base `version`, and log it in
13
+ the base changelog; this file stays as history. See `.agents/standards/requirements.md`.
14
+
15
+ ## Reason for change
16
+
17
+ What changed in the world (new constraint, user feedback, regulation, a wrong assumption) that forces
18
+ this. Be factual.
19
+
20
+ ## The change
21
+
22
+ | id | old statement | new statement |
23
+ |---|---|---|
24
+ | REQ-<AREA>-<NNN> | <the current statement> | <the revised statement> |
25
+
26
+ <!-- For a withdrawal: new statement = "(withdrawn — <reason>)" and set the row's status to withdrawn
27
+ in base.md (keep the id). -->
28
+
29
+ ## Impact
30
+
31
+ - **Code/tests:** what must change to honor the new statement.
32
+ - **Decisions:** ADR id(s) this needs or supersedes.
33
+ - **Confirmed values:** if a ground-truth value changes (error code, permission key, enum, channel),
34
+ the linked ADR sets `updates-confirmed-values: yes` and the table updates in the **same PR**.
35
+ - **Downstream requirements:** other `REQ-…` affected by this change.
36
+
37
+ ## Acceptance
38
+
39
+ The check that proves the new statement holds (and the old behavior is gone).
@@ -0,0 +1,11 @@
1
+ # resources — index
2
+
3
+ Raw materials the project draws on: datasets, vendor specs, dumps, external artifacts and snapshots.
4
+ The inputs to investigation (`evidence/`), not the conclusions.
5
+
6
+ | Entry | What it holds |
7
+ |---|---|
8
+ | `README.md` | What belongs here; large / secret / binary handling; the manifest rule. |
9
+ | `manifest.md` | Tracked index of every resource — including gitignored ones — with source + purpose. |
10
+
11
+ <!-- Add resources alongside this INDEX; list each in manifest.md. -->
@@ -0,0 +1,17 @@
1
+ # resources
2
+
3
+ Raw materials and external artifacts: datasets, vendor/API specs, database dumps, binary snapshots,
4
+ captured payloads — the inputs you reverse-engineer or extract from. Conclusions go in `evidence/`
5
+ and `reference/`; the raw stuff lives here.
6
+
7
+ ## Large / secret / binary handling
8
+
9
+ - **Secret-bearing or PHI-bearing raw material** (dumps, captures, credential files) is **gitignored**
10
+ — it must never enter git history. Add the path to the project `.gitignore`.
11
+ - **Huge or binary** artifacts: keep out of the repo (or use the project's large-file mechanism);
12
+ don't bloat history.
13
+ - **Always keep a tracked `manifest.md`**: one row per resource — name, source/provenance, purpose,
14
+ and whether it's tracked or gitignored. The manifest is the durable record even when the bytes are
15
+ not in git, so a reader knows what exists and where to get it.
16
+
17
+ Never echo a secret / PHI from a resource into chat or agent output. See `.agents/standards/codex.md`.
@@ -0,0 +1,11 @@
1
+ # Resource manifest
2
+
3
+ One row per resource — tracked **and** gitignored. The durable record of what exists and where to get
4
+ it, even when the bytes aren't in git. Keep it current.
5
+
6
+ | resource | source / provenance | purpose | git status |
7
+ |---|---|---|---|
8
+ | `<path or name>` | <where it came from> | <what it's used for> | tracked \| gitignored |
9
+
10
+ <!-- For gitignored secret/PHI-bearing material: record location + purpose only here; the value lives
11
+ in the gitignored inventory, never in a tracked doc. -->
@@ -0,0 +1,9 @@
1
+ # runbooks — index
2
+
3
+ The on-call answer to "production is broken — what now." One file per service, kept short and
4
+ runnable under stress. Required by the launch-security checklist
5
+ (`.agents/standards/launch-security-checklist.md`).
6
+
7
+ | Entry | What it holds |
8
+ |---|---|
9
+ | `incident-runbook-template.md` | Copy per service to `codex/runbooks/<service>.md`. |
@@ -0,0 +1,8 @@
1
+ # runbooks
2
+
3
+ The on-call answer to "production is broken — what now." One runbook per service, copied from
4
+ `incident-runbook-template.md` to `codex/runbooks/<service>.md`. Keep each short, current, and
5
+ runnable under stress — a runbook nobody can follow at 3am is worse than none.
6
+
7
+ Required by the launch-security checklist (`.agents/standards/launch-security-checklist.md`). The
8
+ highest-value section is "Common failure modes" — fill it in per service as incidents teach you.
@@ -0,0 +1,58 @@
1
+ # Incident runbook — <service / app name>
2
+
3
+ The on-call answer to "production is broken — what now." Required by the launch-security checklist
4
+ (`.agents/standards/launch-security-checklist.md`). Keep it short, current, and runnable under stress.
5
+ Copy to `codex/runbooks/<service>.md`.
6
+
7
+ ## At a glance
8
+
9
+ - **Service:** <name + one line on what it does>
10
+ - **Owners / on-call:** <names / rotation / how to reach>
11
+ - **Dashboards:** <links — metrics, logs, error tracker, uptime>
12
+ - **Status page / comms channel:** <where incidents are announced>
13
+
14
+ ## Severity levels
15
+
16
+ | Sev | Meaning | Response |
17
+ |---|---|---|
18
+ | SEV1 | Full outage / data loss / security breach | Page now; all hands; comms immediately |
19
+ | SEV2 | Major feature down / degraded for many | Page on-call; fix within hours |
20
+ | SEV3 | Minor / workaround exists | Next business day |
21
+
22
+ ## First 15 minutes
23
+
24
+ 1. **Acknowledge** — claim the incident so others know it's owned.
25
+ 2. **Assess severity** (table above) and **declare** in the comms channel.
26
+ 3. **Stabilize, don't fix yet** — stop the bleeding: roll back the last release (see
27
+ `.agents/standards/release-versioning.md` → rollback), flip the feature flag off
28
+ (`.agents/rules/20-modes.md` HOTFIX), or scale/restart. Recovery beats root-cause under SEV1/2.
29
+ 4. **Communicate** — short status update; repeat on a cadence until resolved.
30
+
31
+ ## Diagnose
32
+
33
+ - Check the dashboards above; read logs by **error code**, not message text
34
+ (`.agents/standards/observability.md` + `standards/error-codes.md`).
35
+ - What changed? Last deploy/tag, last migration, last flag flip, upstream provider status.
36
+ - Reproduce on the smallest input that triggers it.
37
+
38
+ ## Common failure modes
39
+
40
+ <!-- Fill in per service: symptom → likely cause → action. This is the highest-value section. -->
41
+ | Symptom | Likely cause | Action |
42
+ |---|---|---|
43
+ | <e.g. 5xx spike after deploy> | <bad release> | <roll back to previous tag> |
44
+ | <DB connection errors> | <pool exhausted / provider down> | <check provider; restart; raise pool> |
45
+
46
+ ## Recovery & rollback
47
+
48
+ - **Roll back a release:** `<exact command / steps; previous-good-tag location>`.
49
+ - **Disable a feature:** `<flag name + how to flip>`.
50
+ - **Restore data:** `<backup location, restore procedure, last-known-good>`.
51
+
52
+ ## After: post-incident
53
+
54
+ - Write a blameless post-mortem: timeline, impact, root cause, what made it worse/better, action
55
+ items with owners.
56
+ - File the action items in `journal/backlog/` (`.agents/rules/40-handoff.md`).
57
+ - If the root cause was an unrecorded assumption or a ground-truth value, update the owning doc /
58
+ ADR / requirement the same turn (`.agents/rules/00-always.md`).
@@ -0,0 +1,12 @@
1
+ # --- Grimoire: session state is per-run, never tracked ---
2
+ journal/session/
3
+
4
+ # --- Grimoire: adopt-safety backups from `grimoire init`/`sync` (never tracked) ---
5
+ .agents.bak-*/
6
+
7
+ # --- Grimoire: graphify code-graph — commit the graph artifacts (team shares one map), ignore internal/local ---
8
+ graphify-out/*
9
+ !graphify-out/graph.json
10
+ !graphify-out/graph.html
11
+ !graphify-out/GRAPH_REPORT.md
12
+ !graphify-out/manifest.json