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,35 +1,35 @@
1
- ---
2
- updated: 2026-05-31
3
- status: canonical
4
- description: 'The second-brain model: three homes for work-state, and how to view memory as an optional Obsidian vault.'
5
- ---
6
-
7
- # Standards — knowledge management
8
-
9
- Where work-state lives so context survives across sessions and compaction. Three homes, each
10
- answering one question; nothing duplicated between them. Continuity lives here, not in chat history.
11
-
12
- ## Three homes
13
-
14
- | Layer | Answers | Home | Git |
15
- |---|---|---|---|
16
- | NOW | what am I doing right now? | `journal/session/current.md` | gitignored |
17
- | KNOWLEDGE | what do we already know? | `journal/memory/` + `journal/memory/MEMORY.md` | tracked |
18
- | QUEUE | what work is pending? | `journal/backlog/` | tracked |
19
-
20
- Write the live state to NOW as you go; promote durable facts to KNOWLEDGE; route pending work to
21
- QUEUE (`rules/40-handoff.md`). Finish a task, then compact or clear the session — the three homes
22
- carry continuity, so a fresh session loses nothing that mattered.
23
-
24
- ## Memory cards
25
-
26
- One fact per file under `journal/memory/`, linked with `[[wikilinks]]`; `MEMORY.md` is the one-line index.
27
- Convert relative dates to absolute. Link liberally — a `[[name]]` with no file yet marks a card
28
- worth writing later.
29
-
30
- ## Optional: view memory as an Obsidian vault
31
-
32
- `journal/memory/` is plain Markdown using `[[wikilinks]]` — already Obsidian-native. Point an Obsidian vault
33
- at it for graph view and backlinks over the agent's knowledge base. This is a **human view layer
34
- only**: Grimoire never depends on Obsidian (the core stays tool-agnostic), and nothing in `journal/memory/`
35
- requires it.
1
+ ---
2
+ updated: 2026-05-31
3
+ status: canonical
4
+ description: 'The second-brain model: three homes for work-state, and how to view memory as an optional Obsidian vault.'
5
+ ---
6
+
7
+ # Standards — knowledge management
8
+
9
+ Where work-state lives so context survives across sessions and compaction. Three homes, each
10
+ answering one question; nothing duplicated between them. Continuity lives here, not in chat history.
11
+
12
+ ## Three homes
13
+
14
+ | Layer | Answers | Home | Git |
15
+ |---|---|---|---|
16
+ | NOW | what am I doing right now? | `journal/session/current.md` | gitignored |
17
+ | KNOWLEDGE | what do we already know? | `journal/memory/` + `journal/memory/MEMORY.md` | tracked |
18
+ | QUEUE | what work is pending? | `journal/backlog/` | tracked |
19
+
20
+ Write the live state to NOW as you go; promote durable facts to KNOWLEDGE; route pending work to
21
+ QUEUE (`rules/40-handoff.md`). Finish a task, then compact or clear the session — the three homes
22
+ carry continuity, so a fresh session loses nothing that mattered.
23
+
24
+ ## Memory cards
25
+
26
+ One fact per file under `journal/memory/`, linked with `[[wikilinks]]`; `MEMORY.md` is the one-line index.
27
+ Convert relative dates to absolute. Link liberally — a `[[name]]` with no file yet marks a card
28
+ worth writing later.
29
+
30
+ ## Optional: view memory as an Obsidian vault
31
+
32
+ `journal/memory/` is plain Markdown using `[[wikilinks]]` — already Obsidian-native. Point an Obsidian vault
33
+ at it for graph view and backlinks over the agent's knowledge base. This is a **human view layer
34
+ only**: Grimoire never depends on Obsidian (the core stays tool-agnostic), and nothing in `journal/memory/`
35
+ requires it.
@@ -1,45 +1,45 @@
1
- ---
2
- updated: 2026-05-31
3
- status: canonical
4
- description: Pre-launch privacy + security gate for any app that collects user data.
5
- ---
6
-
7
- # Launch security checklist
8
-
9
- A pre-launch gate for any app that collects user data. Do not ship to real users until every item
10
- passes — legal and breach exposure scale with user count, so clear these before marketing.
11
-
12
- ## 1. Privacy & data map
13
- - Publish a privacy policy (GDPR / CCPA / PDPA as applicable). PHI → HIPAA (see `skills/catalog.md`
14
- Healthcare).
15
- - Keep a data map: what personal data you collect, where it lives, who can read it, retention.
16
- - Collect the minimum; delete what you do not need.
17
-
18
- ## 2. Row-level authorization on every user table
19
- - Each row is restricted to its authenticated owner (Postgres/Supabase RLS, or app-layer checks).
20
- - **Default-deny** — zero policies = a wide-open database. Verify one user cannot read another
21
- user's rows (open DevTools / hit the API as user B).
22
-
23
- ## 3. Failure / abuse-path tests (not just the happy path)
24
- - Wrong password ×N (lockout/backoff), reset for a non-existent email (no user enumeration),
25
- expired / missing session, malformed / oversized / injection input. Attackers probe these first.
26
-
27
- ## 4. Server-side validation on every write route
28
- - Validate **and** authorize on the server. Client (zod) validation is UX only — attackers call the
29
- API directly with JS disabled.
30
-
31
- ## 5. Security headers + OWASP review
32
- - Set headers: CSP, HSTS, X-Content-Type-Options, X-Frame-Options, Referrer-Policy.
33
- - Run an OWASP Top 10 review (injection, broken auth, broken access control, XSS, SSRF…) via
34
- `ecc:security-review` / `ecc:security-scan`.
35
-
36
- ## 6. SAST scan
37
- - Run a static analysis scanner in CI and fix **High/Critical** before launch.
38
- See `standards/security-scanners.md`.
39
-
40
- ## 7. Incident runbook reviewed
41
- - A dated incident/rollback runbook exists and has had a tabletop or review — not just a green CI.
42
- Shipping to production with an untested playbook is a launch risk in itself.
43
-
44
- **Gate:** for any user-facing, data-collecting app this checklist is part of the Definition of Done
45
- (`rules/30-verification.md`).
1
+ ---
2
+ updated: 2026-05-31
3
+ status: canonical
4
+ description: Pre-launch privacy + security gate for any app that collects user data.
5
+ ---
6
+
7
+ # Launch security checklist
8
+
9
+ A pre-launch gate for any app that collects user data. Do not ship to real users until every item
10
+ passes — legal and breach exposure scale with user count, so clear these before marketing.
11
+
12
+ ## 1. Privacy & data map
13
+ - Publish a privacy policy (GDPR / CCPA / PDPA as applicable). PHI → HIPAA (see `skills/catalog.md`
14
+ Healthcare).
15
+ - Keep a data map: what personal data you collect, where it lives, who can read it, retention.
16
+ - Collect the minimum; delete what you do not need.
17
+
18
+ ## 2. Row-level authorization on every user table
19
+ - Each row is restricted to its authenticated owner (Postgres/Supabase RLS, or app-layer checks).
20
+ - **Default-deny** — zero policies = a wide-open database. Verify one user cannot read another
21
+ user's rows (open DevTools / hit the API as user B).
22
+
23
+ ## 3. Failure / abuse-path tests (not just the happy path)
24
+ - Wrong password ×N (lockout/backoff), reset for a non-existent email (no user enumeration),
25
+ expired / missing session, malformed / oversized / injection input. Attackers probe these first.
26
+
27
+ ## 4. Server-side validation on every write route
28
+ - Validate **and** authorize on the server. Client (zod) validation is UX only — attackers call the
29
+ API directly with JS disabled.
30
+
31
+ ## 5. Security headers + OWASP review
32
+ - Set headers: CSP, HSTS, X-Content-Type-Options, X-Frame-Options, Referrer-Policy.
33
+ - Run an OWASP Top 10 review (injection, broken auth, broken access control, XSS, SSRF…) via
34
+ `ecc:security-review` / `ecc:security-scan`.
35
+
36
+ ## 6. SAST scan
37
+ - Run a static analysis scanner in CI and fix **High/Critical** before launch.
38
+ See `standards/security-scanners.md`.
39
+
40
+ ## 7. Incident runbook reviewed
41
+ - A dated incident/rollback runbook exists and has had a tabletop or review — not just a green CI.
42
+ Shipping to production with an untested playbook is a launch risk in itself.
43
+
44
+ **Gate:** for any user-facing, data-collecting app this checklist is part of the Definition of Done
45
+ (`rules/30-verification.md`).
@@ -1,35 +1,35 @@
1
- ---
2
- updated: 2026-05-31
3
- status: canonical
4
- description: Production logging, metrics, and tracing lessons from real data/sync tools.
5
- ---
6
-
7
- # Standards — observability
8
-
9
- Lessons from production data/sync tools. The goal: an operator can self-diagnose a live issue from
10
- logs alone, without attaching a debugger.
11
-
12
- ## Make the diagnosable facts visible at INFO
13
-
14
- - When a query/request returns **zero rows or an empty result on a path that usually has data**, log
15
- enough to tell "correct empty" from "wrong input" — at **INFO**, not DEBUG. Operators rarely have
16
- debug mode on in production.
17
- - For generated queries, log the **rendered parameters** (the actual values sent), not just the
18
- template. A silent 0-row from a bad default (locale, era, timezone, unit) is otherwise invisible.
19
-
20
- ## No silent empty results
21
-
22
- - A path that returns nothing where data was expected must surface *why* (filtered, unauthorized,
23
- no-match) — never an unexplained empty array.
24
-
25
- ## Per-source / per-locale overrides are first-class
26
-
27
- - Defaults that vary by deployment (date era, timezone, encoding, ID format, DB dialect) must be
28
- **documented in onboarding** and overridable per source. Bake the override point in; don't assume
29
- one global default fits every site.
30
-
31
- ## Logging hygiene
32
-
33
- - Never log secrets, tokens, or full PII; scrub before logging (`rules/50-security.md`).
34
- - Structured logs (level + code + context) over free-text — pairs with the error-code catalog
35
- (`standards/error-codes.md`).
1
+ ---
2
+ updated: 2026-05-31
3
+ status: canonical
4
+ description: Production logging, metrics, and tracing lessons from real data/sync tools.
5
+ ---
6
+
7
+ # Standards — observability
8
+
9
+ Lessons from production data/sync tools. The goal: an operator can self-diagnose a live issue from
10
+ logs alone, without attaching a debugger.
11
+
12
+ ## Make the diagnosable facts visible at INFO
13
+
14
+ - When a query/request returns **zero rows or an empty result on a path that usually has data**, log
15
+ enough to tell "correct empty" from "wrong input" — at **INFO**, not DEBUG. Operators rarely have
16
+ debug mode on in production.
17
+ - For generated queries, log the **rendered parameters** (the actual values sent), not just the
18
+ template. A silent 0-row from a bad default (locale, era, timezone, unit) is otherwise invisible.
19
+
20
+ ## No silent empty results
21
+
22
+ - A path that returns nothing where data was expected must surface *why* (filtered, unauthorized,
23
+ no-match) — never an unexplained empty array.
24
+
25
+ ## Per-source / per-locale overrides are first-class
26
+
27
+ - Defaults that vary by deployment (date era, timezone, encoding, ID format, DB dialect) must be
28
+ **documented in onboarding** and overridable per source. Bake the override point in; don't assume
29
+ one global default fits every site.
30
+
31
+ ## Logging hygiene
32
+
33
+ - Never log secrets, tokens, or full PII; scrub before logging (`rules/50-security.md`).
34
+ - Structured logs (level + code + context) over free-text — pairs with the error-code catalog
35
+ (`standards/error-codes.md`).
@@ -1,53 +1,53 @@
1
- ---
2
- updated: 2026-05-31
3
- status: canonical
4
- description: "Versioning, changelog, and release discipline across app and library profiles — what ships, how it's tagged, how it's recorded."
5
- ---
6
-
7
- # Standards — release & versioning
8
-
9
- Every project needs an answer to "what version is live, and what changed since the last one." This
10
- standard gives the default; the active `stack/` profile refines the tooling.
11
-
12
- ## Versioning scheme
13
-
14
- - **Libraries** (`stack/library.md`): strict **SemVer** — major = breaking API, minor = added API,
15
- patch = fix. Public API changes drive the bump. Use **changesets** so each PR declares its bump.
16
- - **Apps** (web-app / desktop): SemVer-ish or CalVer — pick one and stay consistent. The number is
17
- for humans tracing "which build has this fix," so what matters is that a tag exists per release and
18
- maps to a commit. Tag the release commit (`vX.Y.Z`); the tag is the source of truth for "what
19
- shipped."
20
-
21
- ## Changelog — required, generated from commits
22
-
23
- - Keep a `CHANGELOG.md` (Keep-a-Changelog style: grouped Added / Changed / Fixed / Removed /
24
- Security under each version + date).
25
- - It is **derived from Conventional Commits** (`rules/60-commit-style.md`): `feat:` → Added,
26
- `fix:` → Fixed, `feat!:`/`BREAKING CHANGE:` → a major bump + a Changed/Removed entry. A tool
27
- (changesets, release-please, or `git-cliff`) generates it; do not hand-curate from memory.
28
- - Cite requirement and ADR ids where relevant (`implements REQ-…`, `see ADR 00NN`) so a release
29
- links back to *why* (`standards/requirements.md`).
30
-
31
- ## Release checklist (gate before tagging)
32
-
33
- 1. Verifier `pass` on fresh context; full suite green (`rules/30-verification.md`).
34
- 2. For a user-facing app: the launch-security checklist passes
35
- (`standards/launch-security-checklist.md`).
36
- 3. `CHANGELOG.md` updated for this version; version bumped in the manifest (`package.json` etc.).
37
- 4. Any `updates-confirmed-values: yes` ADR in this range has its confirmed-values table updated.
38
- 5. Docs synced (`rules/00-always.md`) — no behavior shipped with stale docs.
39
- 6. Tag the release commit; push the tag; publish (library: registry; app: deploy).
40
-
41
- ## Deploy & rollback
42
-
43
- - The deploy target and any region/config pinning that the code depends on belong in the project's
44
- `local/` notes or an ADR (not hardcoded, not tribal knowledge).
45
- - Every release must be **rollback-able**: know the previous good tag and the procedure to redeploy
46
- it. A migration that can't roll back is itself a decision — record it in an ADR with the
47
- forward-fix plan.
48
-
49
- ## Pre-release / staged rollout
50
-
51
- Feature flags or env gates (same mechanism as HOTFIX, `rules/20-modes.md`) let a change ship dark and
52
- ramp. A flag is debt: record its name, the ramp/cleanup condition, and remove it once fully rolled
53
- out — a stale flag is a silent fork in behavior.
1
+ ---
2
+ updated: 2026-05-31
3
+ status: canonical
4
+ description: "Versioning, changelog, and release discipline across app and library profiles — what ships, how it's tagged, how it's recorded."
5
+ ---
6
+
7
+ # Standards — release & versioning
8
+
9
+ Every project needs an answer to "what version is live, and what changed since the last one." This
10
+ standard gives the default; the active `stack/` profile refines the tooling.
11
+
12
+ ## Versioning scheme
13
+
14
+ - **Libraries** (`stack/library.md`): strict **SemVer** — major = breaking API, minor = added API,
15
+ patch = fix. Public API changes drive the bump. Use **changesets** so each PR declares its bump.
16
+ - **Apps** (web-app / desktop): SemVer-ish or CalVer — pick one and stay consistent. The number is
17
+ for humans tracing "which build has this fix," so what matters is that a tag exists per release and
18
+ maps to a commit. Tag the release commit (`vX.Y.Z`); the tag is the source of truth for "what
19
+ shipped."
20
+
21
+ ## Changelog — required, generated from commits
22
+
23
+ - Keep a `CHANGELOG.md` (Keep-a-Changelog style: grouped Added / Changed / Fixed / Removed /
24
+ Security under each version + date).
25
+ - It is **derived from Conventional Commits** (`rules/60-commit-style.md`): `feat:` → Added,
26
+ `fix:` → Fixed, `feat!:`/`BREAKING CHANGE:` → a major bump + a Changed/Removed entry. A tool
27
+ (changesets, release-please, or `git-cliff`) generates it; do not hand-curate from memory.
28
+ - Cite requirement and ADR ids where relevant (`implements REQ-…`, `see ADR 00NN`) so a release
29
+ links back to *why* (`standards/requirements.md`).
30
+
31
+ ## Release checklist (gate before tagging)
32
+
33
+ 1. Verifier `pass` on fresh context; full suite green (`rules/30-verification.md`).
34
+ 2. For a user-facing app: the launch-security checklist passes
35
+ (`standards/launch-security-checklist.md`).
36
+ 3. `CHANGELOG.md` updated for this version; version bumped in the manifest (`package.json` etc.).
37
+ 4. Any `updates-confirmed-values: yes` ADR in this range has its confirmed-values table updated.
38
+ 5. Docs synced (`rules/00-always.md`) — no behavior shipped with stale docs.
39
+ 6. Tag the release commit; push the tag; publish (library: registry; app: deploy).
40
+
41
+ ## Deploy & rollback
42
+
43
+ - The deploy target and any region/config pinning that the code depends on belong in the project's
44
+ `local/` notes or an ADR (not hardcoded, not tribal knowledge).
45
+ - Every release must be **rollback-able**: know the previous good tag and the procedure to redeploy
46
+ it. A migration that can't roll back is itself a decision — record it in an ADR with the
47
+ forward-fix plan.
48
+
49
+ ## Pre-release / staged rollout
50
+
51
+ Feature flags or env gates (same mechanism as HOTFIX, `rules/20-modes.md`) let a change ship dark and
52
+ ramp. A flag is debt: record its name, the ramp/cleanup condition, and remove it once fully rolled
53
+ out — a stale flag is a silent fork in behavior.
@@ -1,75 +1,75 @@
1
- ---
2
- updated: 2026-05-31
3
- status: canonical
4
- description: "How requirements are captured, identified, versioned, and traced — base requirements plus addons and change requests."
5
- ---
6
-
7
- # Standards — requirements
8
-
9
- A project's requirements are a **tracked, referenceable artifact**, not scattered chat history. They
10
- live under `codex/requirements/` (project-owned; `grimoire sync` never touches them — seeded by
11
- `grimoire init` from `templates/codex/`). Every requirement has a stable ID so code, tests,
12
- commits, ADRs, and change requests can cite it.
13
-
14
- ## The three documents
15
-
16
- | File | Holds | When it changes |
17
- |---|---|---|
18
- | `codex/requirements/base.md` | The **baseline** — the agreed requirements at the current accepted state | Only via an applied change request (CR) |
19
- | `codex/requirements/addons/<id>-<slug>.md` | A self-contained **addon** — a new feature/capability layered on the base | New file per feature; merged into base when it ships |
20
- | `codex/requirements/changes/<id>-<slug>.md` | A **change request (CR)** — a modification to an existing requirement | New file per change; records old → new |
21
-
22
- Base = the source of truth for "what the system must do *now*." Addons and CRs are the **audit
23
- trail** of how it got there. Nothing edits a requirement silently — the diff always exists as a CR
24
- or an addon.
25
-
26
- ## Requirement IDs — stable and traceable
27
-
28
- - Format: `REQ-<area>-<NNN>` — e.g. `REQ-AUTH-001`, `REQ-ROSTER-014`. Area is a short uppercase
29
- domain tag; number is zero-padded, sequential per area, **never reused or renumbered**.
30
- - A requirement keeps its ID for life. If it is removed, mark it `status: withdrawn` — do not delete
31
- the row (the ID must never point at something else later).
32
- - Cite the ID everywhere the requirement is realized: commit body (`implements REQ-AUTH-001`), test
33
- name/describe block, the ADR that decided *how*, and the CR that last changed it. An auditor reads
34
- one ID and finds the whole chain.
35
-
36
- ## Each requirement row carries
37
-
38
- `id` · `statement` (one testable "the system must …" sentence) · `rationale` (why) ·
39
- `acceptance` (how we verify it — links to the test or the manual check) · `status`
40
- (`proposed | accepted | implemented | withdrawn`) · `priority` (`must | should | could`) ·
41
- `source` (who asked / which CR or addon introduced it).
42
-
43
- A requirement that cannot be phrased as a **testable** statement is not done being written — sharpen
44
- it until its acceptance criterion is observable.
45
-
46
- ## Change flow (base ← addon / CR)
47
-
48
- 1. **New feature** → write an **addon** (`addons/<id>-<slug>.md`) with its own `REQ-…` rows. It is
49
- reviewable on its own and references the base requirements it depends on or extends.
50
- 2. **Modify an existing requirement** → write a **CR** (`changes/<id>-<slug>.md`): name the affected
51
- `REQ-…` id(s), give **old statement → new statement**, the reason, and the impact (code, tests,
52
- ADRs, confirmed-values).
53
- 3. **On merge**, fold the addon's / CR's outcome into `base.md` (update the rows, bump the base
54
- `version`), and leave the addon/CR file in place as history. The base always reflects *now*; the
55
- addon/CR explains *the change*.
56
- 4. If the change alters a **ground-truth value** (error code, permission key, enum, channel name),
57
- the linked ADR sets `updates-confirmed-values: yes` and the confirmed-values table updates in the
58
- **same PR** (`codex/decisions/` + `standards/error-codes.md`).
59
-
60
- ## Versioning the base
61
-
62
- `base.md` carries a `version` (semantic-ish: bump minor for an added requirement, patch for a
63
- clarification, major for a breaking removal/redefinition) and a `changelog` table listing each
64
- applied addon/CR by id and date. Diffing two base versions = the requirements delta between releases.
65
-
66
- ## Relationship to the rest of the contract
67
-
68
- - **Planning** (`rules/10-working-process.md`): the task contract's *goal* and *acceptance criteria*
69
- should cite the `REQ-…` ids it satisfies.
70
- - **Verification** (`rules/30-verification.md`): the verifier checks output against the cited
71
- requirement's acceptance criterion — "done" means that criterion is met.
72
- - **Decisions** (`codex/decisions/`): requirements say *what*; ADRs say *how* and *why*. A CR that needs a
73
- design choice spawns an ADR; the ADR's `supersedes` and the CR cross-link.
74
- - **PRD/spec skills** (`skills/catalog.md`: `to-prd`, `brainstorming`) produce the prose; this
75
- standard is where that prose lands as IDed, versioned rows.
1
+ ---
2
+ updated: 2026-05-31
3
+ status: canonical
4
+ description: "How requirements are captured, identified, versioned, and traced — base requirements plus addons and change requests."
5
+ ---
6
+
7
+ # Standards — requirements
8
+
9
+ A project's requirements are a **tracked, referenceable artifact**, not scattered chat history. They
10
+ live under `codex/requirements/` (project-owned; `grimoire sync` never touches them — seeded by
11
+ `grimoire init` from `templates/codex/`). Every requirement has a stable ID so code, tests,
12
+ commits, ADRs, and change requests can cite it.
13
+
14
+ ## The three documents
15
+
16
+ | File | Holds | When it changes |
17
+ |---|---|---|
18
+ | `codex/requirements/base.md` | The **baseline** — the agreed requirements at the current accepted state | Only via an applied change request (CR) |
19
+ | `codex/requirements/addons/<id>-<slug>.md` | A self-contained **addon** — a new feature/capability layered on the base | New file per feature; merged into base when it ships |
20
+ | `codex/requirements/changes/<id>-<slug>.md` | A **change request (CR)** — a modification to an existing requirement | New file per change; records old → new |
21
+
22
+ Base = the source of truth for "what the system must do *now*." Addons and CRs are the **audit
23
+ trail** of how it got there. Nothing edits a requirement silently — the diff always exists as a CR
24
+ or an addon.
25
+
26
+ ## Requirement IDs — stable and traceable
27
+
28
+ - Format: `REQ-<area>-<NNN>` — e.g. `REQ-AUTH-001`, `REQ-ROSTER-014`. Area is a short uppercase
29
+ domain tag; number is zero-padded, sequential per area, **never reused or renumbered**.
30
+ - A requirement keeps its ID for life. If it is removed, mark it `status: withdrawn` — do not delete
31
+ the row (the ID must never point at something else later).
32
+ - Cite the ID everywhere the requirement is realized: commit body (`implements REQ-AUTH-001`), test
33
+ name/describe block, the ADR that decided *how*, and the CR that last changed it. An auditor reads
34
+ one ID and finds the whole chain.
35
+
36
+ ## Each requirement row carries
37
+
38
+ `id` · `statement` (one testable "the system must …" sentence) · `rationale` (why) ·
39
+ `acceptance` (how we verify it — links to the test or the manual check) · `status`
40
+ (`proposed | accepted | implemented | withdrawn`) · `priority` (`must | should | could`) ·
41
+ `source` (who asked / which CR or addon introduced it).
42
+
43
+ A requirement that cannot be phrased as a **testable** statement is not done being written — sharpen
44
+ it until its acceptance criterion is observable.
45
+
46
+ ## Change flow (base ← addon / CR)
47
+
48
+ 1. **New feature** → write an **addon** (`addons/<id>-<slug>.md`) with its own `REQ-…` rows. It is
49
+ reviewable on its own and references the base requirements it depends on or extends.
50
+ 2. **Modify an existing requirement** → write a **CR** (`changes/<id>-<slug>.md`): name the affected
51
+ `REQ-…` id(s), give **old statement → new statement**, the reason, and the impact (code, tests,
52
+ ADRs, confirmed-values).
53
+ 3. **On merge**, fold the addon's / CR's outcome into `base.md` (update the rows, bump the base
54
+ `version`), and leave the addon/CR file in place as history. The base always reflects *now*; the
55
+ addon/CR explains *the change*.
56
+ 4. If the change alters a **ground-truth value** (error code, permission key, enum, channel name),
57
+ the linked ADR sets `updates-confirmed-values: yes` and the confirmed-values table updates in the
58
+ **same PR** (`codex/decisions/` + `standards/error-codes.md`).
59
+
60
+ ## Versioning the base
61
+
62
+ `base.md` carries a `version` (semantic-ish: bump minor for an added requirement, patch for a
63
+ clarification, major for a breaking removal/redefinition) and a `changelog` table listing each
64
+ applied addon/CR by id and date. Diffing two base versions = the requirements delta between releases.
65
+
66
+ ## Relationship to the rest of the contract
67
+
68
+ - **Planning** (`rules/10-working-process.md`): the task contract's *goal* and *acceptance criteria*
69
+ should cite the `REQ-…` ids it satisfies.
70
+ - **Verification** (`rules/30-verification.md`): the verifier checks output against the cited
71
+ requirement's acceptance criterion — "done" means that criterion is met.
72
+ - **Decisions** (`codex/decisions/`): requirements say *what*; ADRs say *how* and *why*. A CR that needs a
73
+ design choice spawns an ADR; the ADR's `supersedes` and the CR cross-link.
74
+ - **PRD/spec skills** (`skills/catalog.md`: `to-prd`, `brainstorming`) produce the prose; this
75
+ standard is where that prose lands as IDed, versioned rows.
@@ -1,42 +1,42 @@
1
- ---
2
- updated: 2026-05-31
3
- status: canonical
4
- description: SAST scanners by language and how to wire them into CI to catch exploitable bugs.
5
- ---
6
-
7
- # Security scanners (SAST)
8
-
9
- Linters find what is ugly; **SAST** finds what is exploitable — SQLi, XSS, RCE, path traversal,
10
- hardcoded secrets, weak crypto. Pick by language, run in CI, fail on High/Critical. OSS unless noted.
11
-
12
- | Scanner | Scope | Use when |
13
- |---|---|---|
14
- | **Semgrep** | pattern-based, 30+ languages | default for any project (incl. TS/JS) |
15
- | **njsscan** | JS / Node / React Native | Next.js, Electron, React Native |
16
- | **CodeQL** | semantic taint-tracking, GitHub-native | any repo on GitHub (free for public) — enable Code Scanning |
17
- | **Bandit** | Python | any Python service |
18
- | **Brakeman** | Ruby on Rails | Rails apps |
19
- | **gosec** | Go | Go services |
20
- | **Snyk Code** | AI-assisted, inline fixes (freemium) | optional, on top of the above |
21
-
22
- ## For this org's stacks (TypeScript · Next.js · Electron)
23
-
24
- Run **Semgrep + njsscan** in CI and enable **CodeQL** Code Scanning on GitHub. Add **Bandit** if a
25
- Python service appears.
26
-
27
- ## CI wiring
28
-
29
- Drop-in workflow: copy `templates/ci/sast.yml` → `.github/workflows/sast.yml` (Semgrep + njsscan;
30
- CodeQL enabled separately). It fails the build on findings. Per profile:
31
-
32
- | Profile | Run |
33
- |---|---|
34
- | web-app (Next.js) | Semgrep + njsscan + CodeQL (js/ts) |
35
- | desktop (Electron) | Semgrep + njsscan + CodeQL |
36
- | library | Semgrep + the language's native scanner (bandit/gosec/…) if not JS/TS |
37
- | + any Python service | add Bandit (`bandit -r src -ll`) |
38
-
39
- CodeQL: GitHub → Security → Code scanning → enable, or the `github/codeql-action` workflow.
40
-
41
- Pre-launch: clear High/Critical and wire the scan into `standards/launch-security-checklist.md`. For
42
- user-facing, data-collecting apps this is part of Definition of Done (`rules/00-always.md`).
1
+ ---
2
+ updated: 2026-05-31
3
+ status: canonical
4
+ description: SAST scanners by language and how to wire them into CI to catch exploitable bugs.
5
+ ---
6
+
7
+ # Security scanners (SAST)
8
+
9
+ Linters find what is ugly; **SAST** finds what is exploitable — SQLi, XSS, RCE, path traversal,
10
+ hardcoded secrets, weak crypto. Pick by language, run in CI, fail on High/Critical. OSS unless noted.
11
+
12
+ | Scanner | Scope | Use when |
13
+ |---|---|---|
14
+ | **Semgrep** | pattern-based, 30+ languages | default for any project (incl. TS/JS) |
15
+ | **njsscan** | JS / Node / React Native | Next.js, Electron, React Native |
16
+ | **CodeQL** | semantic taint-tracking, GitHub-native | any repo on GitHub (free for public) — enable Code Scanning |
17
+ | **Bandit** | Python | any Python service |
18
+ | **Brakeman** | Ruby on Rails | Rails apps |
19
+ | **gosec** | Go | Go services |
20
+ | **Snyk Code** | AI-assisted, inline fixes (freemium) | optional, on top of the above |
21
+
22
+ ## For this org's stacks (TypeScript · Next.js · Electron)
23
+
24
+ Run **Semgrep + njsscan** in CI and enable **CodeQL** Code Scanning on GitHub. Add **Bandit** if a
25
+ Python service appears.
26
+
27
+ ## CI wiring
28
+
29
+ Drop-in workflow: copy `templates/ci/sast.yml` → `.github/workflows/sast.yml` (Semgrep + njsscan;
30
+ CodeQL enabled separately). It fails the build on findings. Per profile:
31
+
32
+ | Profile | Run |
33
+ |---|---|
34
+ | web-app (Next.js) | Semgrep + njsscan + CodeQL (js/ts) |
35
+ | desktop (Electron) | Semgrep + njsscan + CodeQL |
36
+ | library | Semgrep + the language's native scanner (bandit/gosec/…) if not JS/TS |
37
+ | + any Python service | add Bandit (`bandit -r src -ll`) |
38
+
39
+ CodeQL: GitHub → Security → Code scanning → enable, or the `github/codeql-action` workflow.
40
+
41
+ Pre-launch: clear High/Critical and wire the scan into `standards/launch-security-checklist.md`. For
42
+ user-facing, data-collecting apps this is part of Definition of Done (`rules/00-always.md`).