the-grimoire-cli 0.3.2 → 0.5.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.
Files changed (95) hide show
  1. package/.agents/AGENTS.md +112 -112
  2. package/.agents/NAVIGATOR.md +193 -168
  3. package/.agents/VERSION +4 -4
  4. package/.agents/agents/INDEX.md +7 -7
  5. package/.agents/agents/verifier.md +50 -50
  6. package/.agents/commands/INDEX.md +11 -11
  7. package/.agents/commands/checkpoint.md +15 -15
  8. package/.agents/commands/grimoire.md +14 -14
  9. package/.agents/commands/onboard.md +56 -56
  10. package/.agents/commands/present.md +23 -23
  11. package/.agents/commands/verify.md +20 -20
  12. package/.agents/grimoire.manifest +18 -18
  13. package/.agents/rules/00-always.md +42 -42
  14. package/.agents/rules/05-code-quality.md +28 -28
  15. package/.agents/rules/10-working-process.md +31 -31
  16. package/.agents/rules/15-skills.md +27 -27
  17. package/.agents/rules/20-modes.md +41 -41
  18. package/.agents/rules/25-surgical-changes.md +29 -29
  19. package/.agents/rules/30-verification.md +36 -36
  20. package/.agents/rules/35-context-economy.md +41 -41
  21. package/.agents/rules/40-handoff.md +25 -25
  22. package/.agents/rules/45-presentation.md +35 -35
  23. package/.agents/rules/50-security.md +30 -30
  24. package/.agents/rules/60-commit-style.md +14 -14
  25. package/.agents/rules/INDEX.md +18 -18
  26. package/.agents/skills/INDEX.md +8 -8
  27. package/.agents/skills/README.md +1 -1
  28. package/.agents/skills/catalog.md +106 -106
  29. package/.agents/skills/find-skills/SKILL.md +142 -142
  30. package/.agents/stack/README.md +71 -66
  31. package/.agents/stack/desktop.md +36 -36
  32. package/.agents/stack/library.md +1 -1
  33. package/.agents/stack/web-app.md +32 -32
  34. package/.agents/standards/INDEX.md +23 -23
  35. package/.agents/standards/accessibility.md +50 -50
  36. package/.agents/standards/architecture.md +39 -39
  37. package/.agents/standards/attribution.md +39 -39
  38. package/.agents/standards/clean-code.md +121 -121
  39. package/.agents/standards/codex.md +69 -69
  40. package/.agents/standards/error-codes.md +41 -41
  41. package/.agents/standards/general.md +46 -46
  42. package/.agents/standards/guardrail-tests.md +40 -40
  43. package/.agents/standards/knowledge-management.md +35 -35
  44. package/.agents/standards/launch-security-checklist.md +45 -45
  45. package/.agents/standards/observability.md +35 -35
  46. package/.agents/standards/release-versioning.md +53 -53
  47. package/.agents/standards/requirements.md +75 -75
  48. package/.agents/standards/security-scanners.md +42 -42
  49. package/.agents/standards/testing-strategy.md +61 -61
  50. package/.agents/standards/typescript.md +19 -19
  51. package/.agents/standards/writing.md +58 -58
  52. package/.agents/tooling.json +20 -19
  53. package/LICENSE +1 -1
  54. package/README.md +139 -139
  55. package/bin/grimoire.mjs +667 -598
  56. package/package.json +32 -32
  57. package/templates/CLAUDE.md +7 -7
  58. package/templates/ci/ci.yml +49 -49
  59. package/templates/ci/sast.yml +44 -44
  60. package/templates/codex/INDEX.md +18 -18
  61. package/templates/codex/README.md +28 -28
  62. package/templates/codex/decisions/0000-template.md +36 -36
  63. package/templates/codex/decisions/INDEX.md +11 -11
  64. package/templates/codex/decisions/README.md +25 -25
  65. package/templates/codex/domain/INDEX.md +14 -14
  66. package/templates/codex/domain/README.md +10 -10
  67. package/templates/codex/evidence/0000-extraction-template.md +36 -36
  68. package/templates/codex/evidence/INDEX.md +11 -11
  69. package/templates/codex/evidence/README.md +15 -15
  70. package/templates/codex/reference/INDEX.md +11 -11
  71. package/templates/codex/reference/README.md +15 -15
  72. package/templates/codex/reference/confirmed-values.md +18 -18
  73. package/templates/codex/requirements/INDEX.md +11 -11
  74. package/templates/codex/requirements/README.md +22 -22
  75. package/templates/codex/requirements/addons/0000-template.md +35 -35
  76. package/templates/codex/requirements/base.md +36 -36
  77. package/templates/codex/requirements/changes/0000-template.md +39 -39
  78. package/templates/codex/resources/INDEX.md +11 -11
  79. package/templates/codex/resources/README.md +17 -17
  80. package/templates/codex/resources/manifest.md +11 -11
  81. package/templates/codex/runbooks/INDEX.md +9 -9
  82. package/templates/codex/runbooks/README.md +8 -8
  83. package/templates/codex/runbooks/incident-runbook-template.md +58 -58
  84. package/templates/gitignore-snippet.txt +10 -12
  85. package/templates/journal/backlog/README.md +18 -18
  86. package/templates/journal/memory/MEMORY.md +15 -15
  87. package/templates/journal/session/archive/.gitkeep +1 -1
  88. package/templates/journal/session/artifacts/.gitkeep +1 -1
  89. package/templates/journal/session/current.md +12 -12
  90. package/templates/lint/README.md +25 -25
  91. package/templates/lint/eslint.config.mjs +33 -33
  92. package/templates/lint/tsconfig.base.json +11 -11
  93. package/templates/local/AGENTS.local.md +33 -33
  94. package/templates/local/README.md +55 -55
  95. package/templates/tests/guardrail.invariants.test.ts +59 -59
@@ -1,66 +1,71 @@
1
- # Stack — tech-stack presets
2
-
3
- A **profile** pins the framework, lint/format, test setup, and CI scaffold for a project type.
4
- Pick one at `init`; record the active profile in `local/AGENTS.local.md`.
5
-
6
- ## Profiles (v0.1 starter set)
7
-
8
- - `web-app.md` — full-stack / front-end web.
9
- - `desktop.md` — Electron / desktop app.
10
- - `library.md` — published or internal reusable package.
11
-
12
- ## Testing-policy knob (per profile, project chooses — not hardcoded)
13
-
14
- | Policy | Meaning |
15
- |---|---|
16
- | `tdd-mandatory` | Red-green-refactor required before merge (ever-sync style). |
17
- | `test-ready-deferred` | Test harness wired; tests written as features stabilize (pharma style). |
18
- | `none` | No automated tests (spikes/throwaway only). **Requires a recorded ADR** (`codex/decisions/`) — see `rules/00-always.md` "No silent test gaps". |
19
-
20
- ## The `verify` script
21
-
22
- Every profile defines a `verify` command — the single gate the **verifier** runs
23
- (`rules/30-verification.md`):
24
-
25
- ```
26
- verify = typecheck + lint + test + coverage + format:check
27
- ```
28
-
29
- Wire it as a package script (`npm run verify`) so it is one command everywhere. The verifier runs it
30
- and quotes the real output; "looks good" is never acceptable.
31
-
32
- ## Knowledge retrieval — graphify (ADR 0006)
33
-
34
- Grimoire does **not** ship a homegrown retrieval engine. Searching the codebase (and `codex/`) is
35
- delegated to **graphify**, a code+docs knowledge graph. The base prescribes the convention; install is
36
- per-machine.
37
-
38
- - **Install** (one-time, per machine): `uv tool install graphifyy` then `graphify install`.
39
- - **Build / refresh** the graph for a repo: `graphify .` (PowerShell: no leading slash). Code is
40
- extracted locally via AST (free, no API); docs/PDFs use the IDE session model (no separate key).
41
- `graphify hook install` rebuilds the code graph on every commit (AST only, free).
42
- - **Query-first**: prefer `graphify query "<question>"` / `graphify path A B` / `graphify explain X`
43
- over grepping raw files or reading the whole report — it is the cheaper, structured path.
44
- - **Commit policy**: `graphify-out/` is committed so the team shares one map; local-only artifacts
45
- (`cost.json`, `cache/`, `.graphify_python`) are gitignored (`templates/gitignore-snippet.txt`).
46
- - **`codex/` is the source of truth** graphify indexes content vs retrieval stay separate.
47
-
48
- Optional personal layer (not a base dependency): **obsidian-wiki** maintains a cross-project Obsidian
49
- vault via the coding agent (Karpathy LLM-Wiki). Install it in your global agent skills, never in the
50
- managed contract.
51
-
52
- ## Laziness enforcement ponytail (ADR 0007)
53
-
54
- The **principle** lives in the contract: `standards/clean-code.md` owns the ladder, the "never
55
- simplify away" guardrail, and the `ponytail:` shortcut marker — tool-agnostic, every agent gets it.
56
- **Enforcement automation** is delegated to the **ponytail** plugin (skill-capable hosts: Claude Code,
57
- Codex, OpenCode, Gemini, pi); install is per-machine, optional.
58
-
59
- - **Install** (Claude Code): `/plugin marketplace add DietrichGebert/ponytail` then
60
- `/plugin install ponytail@ponytail`. Other hosts: see the ponytail README.
61
- - **`/ponytail-review`** — review the current diff for over-engineering; hands back a delete-list.
62
- - **`/ponytail-audit`** same, whole repo instead of the diff.
63
- - **`/ponytail-debt`** harvest the `ponytail:` shortcut markers into a ledger so "later" isn't
64
- "never". This is why the marker token in `clean-code.md` is literally `ponytail:`.
65
- - Without the plugin the principle still holds (the marker is self-documenting); you just lose the
66
- automated harvest/review.
1
+ # Stack — tech-stack presets
2
+
3
+ A **profile** pins the framework, lint/format, test setup, and CI scaffold for a project type.
4
+ Pick one at `init`; record the active profile in `local/AGENTS.local.md`.
5
+
6
+ ## Profiles (v0.1 starter set)
7
+
8
+ - `web-app.md` — full-stack / front-end web.
9
+ - `desktop.md` — Electron / desktop app.
10
+ - `library.md` — published or internal reusable package.
11
+
12
+ ## Testing-policy knob (per profile, project chooses — not hardcoded)
13
+
14
+ | Policy | Meaning |
15
+ |---|---|
16
+ | `tdd-mandatory` | Red-green-refactor required before merge (ever-sync style). |
17
+ | `test-ready-deferred` | Test harness wired; tests written as features stabilize (pharma style). |
18
+ | `none` | No automated tests (spikes/throwaway only). **Requires a recorded ADR** (`codex/decisions/`) — see `rules/00-always.md` "No silent test gaps". |
19
+
20
+ ## The `verify` script
21
+
22
+ Every profile defines a `verify` command — the single gate the **verifier** runs
23
+ (`rules/30-verification.md`):
24
+
25
+ ```
26
+ verify = typecheck + lint + test + coverage + format:check
27
+ ```
28
+
29
+ Wire it as a package script (`npm run verify`) so it is one command everywhere. The verifier runs it
30
+ and quotes the real output; "looks good" is never acceptable.
31
+
32
+ ## Knowledge retrieval — graphify (ADR 0006)
33
+
34
+ Grimoire does **not** ship a homegrown retrieval engine. Searching the codebase (and `codex/`) is
35
+ delegated to **graphify**, a code+docs knowledge graph. The base prescribes the convention; install is
36
+ per-machine.
37
+
38
+ - **Install** (one-time, per machine): `uv tool install graphifyy` then `graphify install`.
39
+ - **Build / refresh** the graph for a repo: `graphify .` (PowerShell: no leading slash). Code is
40
+ extracted locally via AST (free, no API); docs/PDFs use the IDE session model (no separate key).
41
+ `graphify hook install` rebuilds the code graph on every commit (AST only, free).
42
+ - **Query-first**: prefer `graphify query "<question>"` / `graphify path A B` / `graphify explain X`
43
+ over grepping raw files or reading the whole report — it is the cheaper, structured path.
44
+ - **Commit policy**: `graphify-out/` is **gitignored by default** (`templates/gitignore-snippet.txt`)
45
+ when `graphify hook install` rebuilds the graph on every commit, a committed graph would churn on
46
+ each commit and always sit one commit stale, so each clone rebuilds it locally instead. Commit the
47
+ graph only if you do **not** use the post-commit hook (rebuild it deliberately) and want it browsable
48
+ in-repo; whitelist `graph.json`/`graph.html`/`GRAPH_REPORT.md`/`manifest.json` then.
49
+ - **`codex/` is the source of truth** graphify indexes content vs retrieval stay separate.
50
+
51
+ Optional personal layer (not a base dependency): **obsidian-wiki** maintains a cross-project Obsidian
52
+ vault via the coding agent (Karpathy LLM-Wiki). Install it in your global agent skills, never in the
53
+ managed contract.
54
+
55
+ ## Laziness enforcement ponytail (ADR 0007)
56
+
57
+ The **principle** lives in the contract: `standards/clean-code.md` owns the ladder, the "never
58
+ simplify away" guardrail, and the `ponytail:` shortcut marker — tool-agnostic, every agent gets it.
59
+ **Enforcement automation** is delegated to the **ponytail** plugin (skill-capable hosts: Claude Code,
60
+ Codex, OpenCode, Gemini, pi); install is per-machine, optional.
61
+
62
+ - **Install** (Claude Code): `/plugin marketplace add DietrichGebert/ponytail` then
63
+ `/plugin install ponytail@ponytail`. Other hosts: see the ponytail README. ponytail is declared in
64
+ `tooling.json` (with a `source` field = the marketplace repo), so `grimoire bootstrap` lists it and
65
+ prints exactly this paste command.
66
+ - **`/ponytail-review`** — review the current diff for over-engineering; hands back a delete-list.
67
+ - **`/ponytail-audit`** — same, whole repo instead of the diff.
68
+ - **`/ponytail-debt`** — harvest the `ponytail:` shortcut markers into a ledger so "later" isn't
69
+ "never". This is why the marker token in `clean-code.md` is literally `ponytail:`.
70
+ - Without the plugin the principle still holds (the marker is self-documenting); you just lose the
71
+ automated harvest/review.
@@ -1,36 +1,36 @@
1
- # Profile: desktop
2
-
3
- Default for Electron / desktop apps (harvested from ever-sync-adapter).
4
-
5
- | Concern | Default |
6
- |---|---|
7
- | Shell | Electron |
8
- | Language | TypeScript (`strict`) |
9
- | Lint / format | ESLint + Prettier |
10
- | Test | Vitest (unit) + Playwright/Spectron-style (integration) |
11
- | IPC | typed channels; document the channel table in `journal/memory/` |
12
- | Release | new code paths behind env flags (single-unset rollback) |
13
- | CI | typecheck + lint + test + package on tag |
14
- | Testing policy | `tdd-mandatory` (override per project) |
15
-
16
- `verify`: `tsc --noEmit && eslint . && vitest run --coverage && prettier --check .`
17
-
18
- Note: for on-site/production tools, pair with HOTFIX mode (`rules/20-modes.md`).
19
-
20
- ## Reference defaults (adapt per project; vendor names are examples)
21
-
22
- - **Process boundaries:** separate tsconfig per process (main / renderer / preload / shared) with
23
- path aliases; explicit IPC channel registry (one `channels.ts`), preload bridge, and typed API.
24
- - **IPC discipline:** adding a channel touches several files (registry, preload, types, handler, the
25
- AGENTS.md/`local/` channel table) — keep that checklist explicit and, ideally, a guardrail test
26
- that diffs the registry against the allow-list in CI.
27
- - **Secrets at rest:** OS keystore (`safeStorage` / keychain), never plaintext in the local DB
28
- (`rules/50`).
29
- - **Native modules:** rebuild for Electron (`electron-rebuild`) before dev/dist; pin native driver
30
- versions per backend (e.g. Oracle Instant Client per server version).
31
- - **Local DB:** embedded SQLite via a typed query builder; a single factory is the only legal
32
- instantiation point; temp-DB fixtures (`mkdtemp` + cleanup) for tests.
33
- - **Tests:** Vitest (unit + integration) + Playwright (E2E); CSP + boundary regression as gates in
34
- the `verify` chain. Desktop profile defaults to `tdd-mandatory`.
35
- - **Lint preset:** start from `templates/lint/` (clean-code limits + type-safety); enforce via
36
- `eslint .` in `verify`.
1
+ # Profile: desktop
2
+
3
+ Default for Electron / desktop apps (harvested from ever-sync-adapter).
4
+
5
+ | Concern | Default |
6
+ |---|---|
7
+ | Shell | Electron |
8
+ | Language | TypeScript (`strict`) |
9
+ | Lint / format | ESLint + Prettier |
10
+ | Test | Vitest (unit) + Playwright/Spectron-style (integration) |
11
+ | IPC | typed channels; document the channel table in `journal/memory/` |
12
+ | Release | new code paths behind env flags (single-unset rollback) |
13
+ | CI | typecheck + lint + test + package on tag |
14
+ | Testing policy | `tdd-mandatory` (override per project) |
15
+
16
+ `verify`: `tsc --noEmit && eslint . && vitest run --coverage && prettier --check .`
17
+
18
+ Note: for on-site/production tools, pair with HOTFIX mode (`rules/20-modes.md`).
19
+
20
+ ## Reference defaults (adapt per project; vendor names are examples)
21
+
22
+ - **Process boundaries:** separate tsconfig per process (main / renderer / preload / shared) with
23
+ path aliases; explicit IPC channel registry (one `channels.ts`), preload bridge, and typed API.
24
+ - **IPC discipline:** adding a channel touches several files (registry, preload, types, handler, the
25
+ AGENTS.md/`local/` channel table) — keep that checklist explicit and, ideally, a guardrail test
26
+ that diffs the registry against the allow-list in CI.
27
+ - **Secrets at rest:** OS keystore (`safeStorage` / keychain), never plaintext in the local DB
28
+ (`rules/50`).
29
+ - **Native modules:** rebuild for Electron (`electron-rebuild`) before dev/dist; pin native driver
30
+ versions per backend (e.g. Oracle Instant Client per server version).
31
+ - **Local DB:** embedded SQLite via a typed query builder; a single factory is the only legal
32
+ instantiation point; temp-DB fixtures (`mkdtemp` + cleanup) for tests.
33
+ - **Tests:** Vitest (unit + integration) + Playwright (E2E); CSP + boundary regression as gates in
34
+ the `verify` chain. Desktop profile defaults to `tdd-mandatory`.
35
+ - **Lint preset:** start from `templates/lint/` (clean-code limits + type-safety); enforce via
36
+ `eslint .` in `verify`.
@@ -13,4 +13,4 @@ Default for published or internal reusable packages.
13
13
  | CI | typecheck + lint + test + build + pack-check on PR |
14
14
  | Testing policy | `tdd-mandatory` (public contract — override per project) |
15
15
 
16
- `verify`: `tsc --noEmit && eslint . && vitest run --coverage && prettier --check . && npm pack --dry-run`
16
+ `verify`: `tsc --noEmit && eslint . && vitest run --coverage && prettier --check . && npm pack --dry-run`
@@ -1,32 +1,32 @@
1
- # Profile: web-app
2
-
3
- Default for full-stack / front-end web projects.
4
-
5
- | Concern | Default |
6
- |---|---|
7
- | Framework | Next.js (App Router) or Vite + React |
8
- | Language | TypeScript (`strict`) — see `standards/typescript.md` |
9
- | Lint / format | ESLint + Prettier |
10
- | Test | Vitest + React Testing Library; Playwright for e2e |
11
- | Coverage | reported in `verify`; threshold set per project |
12
- | Validation | zod at every boundary |
13
- | CI | typecheck + lint + test + build on PR |
14
- | Testing policy | `test-ready-deferred` (override per project) |
15
-
16
- `verify`: `tsc --noEmit && eslint . && vitest run --coverage && prettier --check .`
17
-
18
- ## Reference defaults (adapt per project; vendor names are examples)
19
-
20
- - **Auth guards — one model, three call-site shapes:** a single `can(permission)` policy with
21
- `requirePermission()` (throws, for actions), `requirePermissionResponse()` (returns 401, for route
22
- handlers), `requirePermissionOrRedirect()` (for pages). Zero inline `role === "x"` checks.
23
- - **Edge-safe auth split:** keep an edge/middleware config with **no DB** separate from the full
24
- server auth that hits the DB at sign-in (Auth.js v5 pattern).
25
- - **Validation:** zod at every server-action boundary; client validation is UX only (`rules/50`).
26
- - **Module layering:** pure engine + read/write/projection split + schema-ownership by module
27
- (`standards/architecture.md`).
28
- - **Security headers in one place** (e.g. `next.config` headers): CSP, HSTS, X-Frame-Options DENY,
29
- X-Content-Type-Options, Referrer-Policy, Permissions-Policy; disable `poweredByHeader`.
30
- - **DB:** typed query builder / ORM with tracked migrations (generate → migrate); `db:push` dev-only.
31
- - **Lint preset:** start from `templates/lint/` (clean-code limits + type-safety); `eslint .` in the
32
- `verify` script enforces it.
1
+ # Profile: web-app
2
+
3
+ Default for full-stack / front-end web projects.
4
+
5
+ | Concern | Default |
6
+ |---|---|
7
+ | Framework | Next.js (App Router) or Vite + React |
8
+ | Language | TypeScript (`strict`) — see `standards/typescript.md` |
9
+ | Lint / format | ESLint + Prettier |
10
+ | Test | Vitest + React Testing Library; Playwright for e2e |
11
+ | Coverage | reported in `verify`; threshold set per project |
12
+ | Validation | zod at every boundary |
13
+ | CI | typecheck + lint + test + build on PR |
14
+ | Testing policy | `test-ready-deferred` (override per project) |
15
+
16
+ `verify`: `tsc --noEmit && eslint . && vitest run --coverage && prettier --check .`
17
+
18
+ ## Reference defaults (adapt per project; vendor names are examples)
19
+
20
+ - **Auth guards — one model, three call-site shapes:** a single `can(permission)` policy with
21
+ `requirePermission()` (throws, for actions), `requirePermissionResponse()` (returns 401, for route
22
+ handlers), `requirePermissionOrRedirect()` (for pages). Zero inline `role === "x"` checks.
23
+ - **Edge-safe auth split:** keep an edge/middleware config with **no DB** separate from the full
24
+ server auth that hits the DB at sign-in (Auth.js v5 pattern).
25
+ - **Validation:** zod at every server-action boundary; client validation is UX only (`rules/50`).
26
+ - **Module layering:** pure engine + read/write/projection split + schema-ownership by module
27
+ (`standards/architecture.md`).
28
+ - **Security headers in one place** (e.g. `next.config` headers): CSP, HSTS, X-Frame-Options DENY,
29
+ X-Content-Type-Options, Referrer-Policy, Permissions-Policy; disable `poweredByHeader`.
30
+ - **DB:** typed query builder / ORM with tracked migrations (generate → migrate); `db:push` dev-only.
31
+ - **Lint preset:** start from `templates/lint/` (clean-code limits + type-safety); `eslint .` in the
32
+ `verify` script enforces it.
@@ -1,23 +1,23 @@
1
- # standards — index
2
-
3
- <!-- GENERATED by `grimoire index`; do not edit by hand. Re-run after adding/renaming files here. -->
4
-
5
- | File | What it covers |
6
- |---|---|
7
- | `accessibility.md` | Baseline accessibility (WCAG 2.x AA) for any user-facing surface — the non-negotiable floor plus how to verify it. |
8
- | `architecture.md` | Module layering and boundaries distilled from real modular codebases. |
9
- | `attribution.md` | Credit the external work the project builds on: what to record when adopting a tool/pattern/idea, where it goes, and the adapt-not-copy rul… |
10
- | `clean-code.md` | The canonical code-quality standard: minimize complexity, with limits, type-safety, and performance rules. |
11
- | `codex.md` | The codex — the project's knowledge/resource root at the repo root: read-first rule, provenance discipline, secrets boundary, and how it re… |
12
- | `error-codes.md` | Every error carries a stable code so logs, tests, and UIs switch on it, not on message strings. |
13
- | `general.md` | Baseline conventions: naming, file size, import order, error handling, formatting. |
14
- | `guardrail-tests.md` | Structural-invariant tests that fail CI when two sources of truth drift apart. |
15
- | `knowledge-management.md` | The second-brain model: three homes for work-state, and how to view memory as an optional Obsidian vault. |
16
- | `launch-security-checklist.md` | Pre-launch privacy + security gate for any app that collects user data. |
17
- | `observability.md` | Production logging, metrics, and tracing lessons from real data/sync tools. |
18
- | `release-versioning.md` | Versioning, changelog, and release discipline across app and library profiles — what ships, how it's tagged, how it's recorded. |
19
- | `requirements.md` | How requirements are captured, identified, versioned, and traced — base requirements plus addons and change requests. |
20
- | `security-scanners.md` | SAST scanners by language and how to wire them into CI to catch exploitable bugs. |
21
- | `testing-strategy.md` | The project-wide testing approach: the pyramid, what to test at each level, the active policy, and what 'tested' means. |
22
- | `typescript.md` | TypeScript specifics: strict mode, no any, type-safety expectations. |
23
- | `writing.md` | How to write agent-facing docs so they are high-signal and versioned. |
1
+ # standards — index
2
+
3
+ <!-- GENERATED by `grimoire index`; do not edit by hand. Re-run after adding/renaming files here. -->
4
+
5
+ | File | What it covers |
6
+ |---|---|
7
+ | `accessibility.md` | Baseline accessibility (WCAG 2.x AA) for any user-facing surface — the non-negotiable floor plus how to verify it. |
8
+ | `architecture.md` | Module layering and boundaries distilled from real modular codebases. |
9
+ | `attribution.md` | Credit the external work the project builds on: what to record when adopting a tool/pattern/idea, where it goes, and the adapt-not-copy rul… |
10
+ | `clean-code.md` | The canonical code-quality standard: minimize complexity, with limits, type-safety, and performance rules. |
11
+ | `codex.md` | The codex — the project's knowledge/resource root at the repo root: read-first rule, provenance discipline, secrets boundary, and how it re… |
12
+ | `error-codes.md` | Every error carries a stable code so logs, tests, and UIs switch on it, not on message strings. |
13
+ | `general.md` | Baseline conventions: naming, file size, import order, error handling, formatting. |
14
+ | `guardrail-tests.md` | Structural-invariant tests that fail CI when two sources of truth drift apart. |
15
+ | `knowledge-management.md` | The second-brain model: three homes for work-state, and how to view memory as an optional Obsidian vault. |
16
+ | `launch-security-checklist.md` | Pre-launch privacy + security gate for any app that collects user data. |
17
+ | `observability.md` | Production logging, metrics, and tracing lessons from real data/sync tools. |
18
+ | `release-versioning.md` | Versioning, changelog, and release discipline across app and library profiles — what ships, how it's tagged, how it's recorded. |
19
+ | `requirements.md` | How requirements are captured, identified, versioned, and traced — base requirements plus addons and change requests. |
20
+ | `security-scanners.md` | SAST scanners by language and how to wire them into CI to catch exploitable bugs. |
21
+ | `testing-strategy.md` | The project-wide testing approach: the pyramid, what to test at each level, the active policy, and what 'tested' means. |
22
+ | `typescript.md` | TypeScript specifics: strict mode, no any, type-safety expectations. |
23
+ | `writing.md` | How to write agent-facing docs so they are high-signal and versioned. |
@@ -1,50 +1,50 @@
1
- ---
2
- updated: 2026-05-31
3
- status: canonical
4
- description: "Baseline accessibility (WCAG 2.x AA) for any user-facing surface — the non-negotiable floor plus how to verify it."
5
- ---
6
-
7
- # Standards — accessibility
8
-
9
- Applies to every user-facing surface (web, desktop UI). Target: **WCAG 2.2 level AA**. Accessibility
10
- is part of Definition of Done for UI work, not a later pass — it is cheapest built in and most
11
- expensive retrofitted.
12
-
13
- ## The non-negotiable floor
14
-
15
- - **Semantic HTML first.** Use the right element (`button`, `a`, `nav`, `main`, `label`, `table`).
16
- A `div` with a click handler is not a button — it loses keyboard, focus, and screen-reader
17
- semantics. Reach for ARIA only when no native element fits, and prefer a native one.
18
- - **Keyboard operable.** Every interactive control is reachable and operable by keyboard alone, in a
19
- logical tab order, with a **visible focus indicator**. No keyboard trap. Test by unplugging the
20
- mouse.
21
- - **Labels & names.** Every input has an associated `<label>`; every icon-only control has an
22
- accessible name (`aria-label`); every meaningful image has `alt` (decorative → `alt=""`).
23
- - **Contrast.** Text ≥ 4.5:1 (≥ 3:1 for large text); UI/graphics ≥ 3:1. Don't encode meaning by
24
- **color alone** — pair it with text, icon, or pattern.
25
- - **Forms & errors.** Errors are announced (not color-only), tied to their field
26
- (`aria-describedby`), and the message says how to fix it. Don't disable submit silently.
27
- - **Structure.** One `h1`; headings nest without skipping. Landmarks (`main`, `nav`) so AT users can
28
- jump. Page has a sensible `<title>` and `lang`.
29
- - **Motion & media.** Respect `prefers-reduced-motion`; no content flashes > 3×/sec; captions/text
30
- alternatives for audio/video.
31
- - **Targets & zoom.** Touch targets ≥ 24×24 CSS px; layout survives 200% zoom and 320px width
32
- (reflow, no horizontal scroll).
33
- - **Live regions.** Dynamic updates (toasts, async results) use `aria-live` so they are announced.
34
-
35
- ## Internationalization note
36
-
37
- If the app is localized (e.g. Thai-first), set `lang` correctly, don't hardcode LTR assumptions, and
38
- don't build strings by concatenation — these intersect with screen-reader correctness.
39
-
40
- ## Verify it (not by eye alone)
41
-
42
- 1. **Automated:** run an axe-based check (axe-core / Playwright `@axe-core/playwright` / Lighthouse)
43
- in CI for key pages. Catches ~40% of issues — necessary, not sufficient.
44
- 2. **Keyboard pass:** tab through the whole flow; confirm order, focus visibility, no trap.
45
- 3. **Screen reader smoke:** one pass with VoiceOver/NVDA on the primary flow.
46
- 4. **Zoom/reflow:** 200% zoom + 320px width with no loss of content or function.
47
-
48
- The `ecc:frontend-a11y` skill (`skills/catalog.md`) automates much of the audit; this standard is the
49
- floor it audits against. For UI work, an a11y check is part of the verifier's review
50
- (`rules/30-verification.md`).
1
+ ---
2
+ updated: 2026-05-31
3
+ status: canonical
4
+ description: "Baseline accessibility (WCAG 2.x AA) for any user-facing surface — the non-negotiable floor plus how to verify it."
5
+ ---
6
+
7
+ # Standards — accessibility
8
+
9
+ Applies to every user-facing surface (web, desktop UI). Target: **WCAG 2.2 level AA**. Accessibility
10
+ is part of Definition of Done for UI work, not a later pass — it is cheapest built in and most
11
+ expensive retrofitted.
12
+
13
+ ## The non-negotiable floor
14
+
15
+ - **Semantic HTML first.** Use the right element (`button`, `a`, `nav`, `main`, `label`, `table`).
16
+ A `div` with a click handler is not a button — it loses keyboard, focus, and screen-reader
17
+ semantics. Reach for ARIA only when no native element fits, and prefer a native one.
18
+ - **Keyboard operable.** Every interactive control is reachable and operable by keyboard alone, in a
19
+ logical tab order, with a **visible focus indicator**. No keyboard trap. Test by unplugging the
20
+ mouse.
21
+ - **Labels & names.** Every input has an associated `<label>`; every icon-only control has an
22
+ accessible name (`aria-label`); every meaningful image has `alt` (decorative → `alt=""`).
23
+ - **Contrast.** Text ≥ 4.5:1 (≥ 3:1 for large text); UI/graphics ≥ 3:1. Don't encode meaning by
24
+ **color alone** — pair it with text, icon, or pattern.
25
+ - **Forms & errors.** Errors are announced (not color-only), tied to their field
26
+ (`aria-describedby`), and the message says how to fix it. Don't disable submit silently.
27
+ - **Structure.** One `h1`; headings nest without skipping. Landmarks (`main`, `nav`) so AT users can
28
+ jump. Page has a sensible `<title>` and `lang`.
29
+ - **Motion & media.** Respect `prefers-reduced-motion`; no content flashes > 3×/sec; captions/text
30
+ alternatives for audio/video.
31
+ - **Targets & zoom.** Touch targets ≥ 24×24 CSS px; layout survives 200% zoom and 320px width
32
+ (reflow, no horizontal scroll).
33
+ - **Live regions.** Dynamic updates (toasts, async results) use `aria-live` so they are announced.
34
+
35
+ ## Internationalization note
36
+
37
+ If the app is localized (e.g. Thai-first), set `lang` correctly, don't hardcode LTR assumptions, and
38
+ don't build strings by concatenation — these intersect with screen-reader correctness.
39
+
40
+ ## Verify it (not by eye alone)
41
+
42
+ 1. **Automated:** run an axe-based check (axe-core / Playwright `@axe-core/playwright` / Lighthouse)
43
+ in CI for key pages. Catches ~40% of issues — necessary, not sufficient.
44
+ 2. **Keyboard pass:** tab through the whole flow; confirm order, focus visibility, no trap.
45
+ 3. **Screen reader smoke:** one pass with VoiceOver/NVDA on the primary flow.
46
+ 4. **Zoom/reflow:** 200% zoom + 320px width with no loss of content or function.
47
+
48
+ The `ecc:frontend-a11y` skill (`skills/catalog.md`) automates much of the audit; this standard is the
49
+ floor it audits against. For UI work, an a11y check is part of the verifier's review
50
+ (`rules/30-verification.md`).
@@ -1,39 +1,39 @@
1
- ---
2
- updated: 2026-05-31
3
- status: canonical
4
- description: Module layering and boundaries distilled from real modular codebases.
5
- ---
6
-
7
- # Standards — architecture
8
-
9
- Patterns distilled from real modular codebases. Apply where the module is non-trivial; don't
10
- over-structure a thin CRUD screen (YAGNI).
11
-
12
- ## Pure domain layer
13
-
14
- - Keep business logic in a layer with **zero framework/DB/IO imports** (call it `engine/`, `domain/`,
15
- or `core/`). Plain functions in, plain data out.
16
- - DB/IO lives only in dedicated read/write modules that call into the pure layer — never the reverse.
17
- - Make non-determinism injectable: pass a **seeded RNG** / clock, so generation is reproducible and
18
- unit-testable without mocks.
19
-
20
- ## Read / write / projection split
21
-
22
- - **reads** — query module (`data/queries.ts`), `server-only`, returns raw rows.
23
- - **writes** — action module (`actions/`), the only place that mutates.
24
- - **projections** — pure shape transforms for each render surface, no DB. Independently testable.
25
- - A view layer composes reads + projections and owns the cache tag.
26
-
27
- ## Schema / ownership by module
28
-
29
- - Core owns identity-level schema only; each module owns its own tables. The shared DB client is
30
- **schema-less** (doesn't import module tables at init), so modules don't become a circular hub.
31
- - Modules may re-export core tables for FK convenience — never invert the dependency.
32
-
33
- ## Invariants
34
-
35
- - Where correctness depends on a structural fact (an inner-join that excludes ghosts, an ordering, a
36
- default), state it with a `// INVARIANT:` comment **and** a test. A silent structural invariant
37
- breaks the first time someone writes a left-join.
38
- - Validate required env at the **startup boundary** with a clear error — never `process.env.X!`
39
- scattered at use sites (a missing var should fail loud at init, not as a random runtime error).
1
+ ---
2
+ updated: 2026-05-31
3
+ status: canonical
4
+ description: Module layering and boundaries distilled from real modular codebases.
5
+ ---
6
+
7
+ # Standards — architecture
8
+
9
+ Patterns distilled from real modular codebases. Apply where the module is non-trivial; don't
10
+ over-structure a thin CRUD screen (YAGNI).
11
+
12
+ ## Pure domain layer
13
+
14
+ - Keep business logic in a layer with **zero framework/DB/IO imports** (call it `engine/`, `domain/`,
15
+ or `core/`). Plain functions in, plain data out.
16
+ - DB/IO lives only in dedicated read/write modules that call into the pure layer — never the reverse.
17
+ - Make non-determinism injectable: pass a **seeded RNG** / clock, so generation is reproducible and
18
+ unit-testable without mocks.
19
+
20
+ ## Read / write / projection split
21
+
22
+ - **reads** — query module (`data/queries.ts`), `server-only`, returns raw rows.
23
+ - **writes** — action module (`actions/`), the only place that mutates.
24
+ - **projections** — pure shape transforms for each render surface, no DB. Independently testable.
25
+ - A view layer composes reads + projections and owns the cache tag.
26
+
27
+ ## Schema / ownership by module
28
+
29
+ - Core owns identity-level schema only; each module owns its own tables. The shared DB client is
30
+ **schema-less** (doesn't import module tables at init), so modules don't become a circular hub.
31
+ - Modules may re-export core tables for FK convenience — never invert the dependency.
32
+
33
+ ## Invariants
34
+
35
+ - Where correctness depends on a structural fact (an inner-join that excludes ghosts, an ordering, a
36
+ default), state it with a `// INVARIANT:` comment **and** a test. A silent structural invariant
37
+ breaks the first time someone writes a left-join.
38
+ - Validate required env at the **startup boundary** with a clear error — never `process.env.X!`
39
+ scattered at use sites (a missing var should fail loud at init, not as a random runtime error).
@@ -1,39 +1,39 @@
1
- ---
2
- updated: 2026-06-14
3
- status: canonical
4
- description: "Credit the external work the project builds on: what to record when adopting a tool/pattern/idea, where it goes, and the adapt-not-copy rule."
5
- ---
6
-
7
- # Standards — attribution
8
-
9
- Credit the external work the project builds on. When you adopt something from outside — a tool,
10
- library, framework, pattern, or idea (including an article or gist you adapt) — record it and credit
11
- its author. This is ethics **and** provenance: a future reader must know what is ours, what is
12
- borrowed, and where it came from. It is the same discipline as `standards/codex.md` (every fact cites
13
- its source), applied to dependencies.
14
-
15
- ## What to record
16
-
17
- For every external adoption:
18
-
19
- - **Name** + **author** (handle / org if known)
20
- - **Source** — repo URL, package name, or article/gist link
21
- - **License** — and any redistribution constraint. **Verify it; never guess a license.**
22
- - **What you adopted** — the tool/pattern, and whether used **as-is** or **adapted**
23
- - **Where it's wired** — the adopting ADR, and the files/standards that reference it
24
- - **Date**
25
-
26
- ## Where it goes
27
-
28
- - **The adopting ADR cites the source.** Any decision to bring in an external tool/pattern names and
29
- links it in `codex/decisions/` (this template repo: `docs/adr/`). The *why* carries the credit —
30
- non-negotiable.
31
- - **A running ledger** collects them in one place: `docs/attributions.md` at the repo root (the
32
- Grimoire template uses this), or `codex/resources/manifest.md` for a consuming project's resources.
33
-
34
- ## Adapt, don't copy
35
-
36
- When you adapt an external idea to this stack, say so and say what you changed — a vendor example is an
37
- illustration, not a mandate. Credit the source for the idea even when little of its form survives.
38
-
39
- Keep this lean (`rules/35-context-economy.md`).
1
+ ---
2
+ updated: 2026-06-14
3
+ status: canonical
4
+ description: "Credit the external work the project builds on: what to record when adopting a tool/pattern/idea, where it goes, and the adapt-not-copy rule."
5
+ ---
6
+
7
+ # Standards — attribution
8
+
9
+ Credit the external work the project builds on. When you adopt something from outside — a tool,
10
+ library, framework, pattern, or idea (including an article or gist you adapt) — record it and credit
11
+ its author. This is ethics **and** provenance: a future reader must know what is ours, what is
12
+ borrowed, and where it came from. It is the same discipline as `standards/codex.md` (every fact cites
13
+ its source), applied to dependencies.
14
+
15
+ ## What to record
16
+
17
+ For every external adoption:
18
+
19
+ - **Name** + **author** (handle / org if known)
20
+ - **Source** — repo URL, package name, or article/gist link
21
+ - **License** — and any redistribution constraint. **Verify it; never guess a license.**
22
+ - **What you adopted** — the tool/pattern, and whether used **as-is** or **adapted**
23
+ - **Where it's wired** — the adopting ADR, and the files/standards that reference it
24
+ - **Date**
25
+
26
+ ## Where it goes
27
+
28
+ - **The adopting ADR cites the source.** Any decision to bring in an external tool/pattern names and
29
+ links it in `codex/decisions/` (this template repo: `docs/adr/`). The *why* carries the credit —
30
+ non-negotiable.
31
+ - **A running ledger** collects them in one place: `docs/attributions.md` at the repo root (the
32
+ Grimoire template uses this), or `codex/resources/manifest.md` for a consuming project's resources.
33
+
34
+ ## Adapt, don't copy
35
+
36
+ When you adapt an external idea to this stack, say so and say what you changed — a vendor example is an
37
+ illustration, not a mandate. Credit the source for the idea even when little of its form survives.
38
+
39
+ Keep this lean (`rules/35-context-economy.md`).