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.
- package/.agents/AGENTS.md +112 -0
- package/.agents/NAVIGATOR.md +168 -0
- package/.agents/VERSION +4 -0
- package/.agents/agents/INDEX.md +7 -0
- package/.agents/agents/verifier.md +50 -0
- package/.agents/commands/INDEX.md +11 -0
- package/.agents/commands/checkpoint.md +15 -0
- package/.agents/commands/grimoire.md +14 -0
- package/.agents/commands/onboard.md +56 -0
- package/.agents/commands/present.md +23 -0
- package/.agents/commands/verify.md +20 -0
- package/.agents/grimoire.manifest +18 -0
- package/.agents/rules/00-always.md +42 -0
- package/.agents/rules/05-code-quality.md +28 -0
- package/.agents/rules/10-working-process.md +31 -0
- package/.agents/rules/15-skills.md +27 -0
- package/.agents/rules/20-modes.md +41 -0
- package/.agents/rules/25-surgical-changes.md +29 -0
- package/.agents/rules/30-verification.md +36 -0
- package/.agents/rules/35-context-economy.md +41 -0
- package/.agents/rules/40-handoff.md +25 -0
- package/.agents/rules/45-presentation.md +35 -0
- package/.agents/rules/50-security.md +30 -0
- package/.agents/rules/60-commit-style.md +14 -0
- package/.agents/rules/INDEX.md +18 -0
- package/.agents/skills/INDEX.md +8 -0
- package/.agents/skills/README.md +6 -0
- package/.agents/skills/catalog.md +106 -0
- package/.agents/skills/find-skills/SKILL.md +142 -0
- package/.agents/stack/INDEX.md +9 -0
- package/.agents/stack/README.md +66 -0
- package/.agents/stack/desktop.md +36 -0
- package/.agents/stack/library.md +16 -0
- package/.agents/stack/web-app.md +32 -0
- package/.agents/standards/INDEX.md +23 -0
- package/.agents/standards/accessibility.md +50 -0
- package/.agents/standards/architecture.md +39 -0
- package/.agents/standards/attribution.md +39 -0
- package/.agents/standards/clean-code.md +121 -0
- package/.agents/standards/codex.md +69 -0
- package/.agents/standards/error-codes.md +41 -0
- package/.agents/standards/general.md +46 -0
- package/.agents/standards/guardrail-tests.md +40 -0
- package/.agents/standards/knowledge-management.md +35 -0
- package/.agents/standards/launch-security-checklist.md +45 -0
- package/.agents/standards/observability.md +35 -0
- package/.agents/standards/release-versioning.md +53 -0
- package/.agents/standards/requirements.md +75 -0
- package/.agents/standards/security-scanners.md +42 -0
- package/.agents/standards/testing-strategy.md +61 -0
- package/.agents/standards/typescript.md +19 -0
- package/.agents/standards/writing.md +58 -0
- package/.agents/tooling.json +19 -0
- package/LICENSE +21 -0
- package/README.md +139 -0
- package/bin/grimoire.mjs +598 -0
- package/package.json +32 -0
- package/templates/CLAUDE.md +7 -0
- package/templates/ci/ci.yml +49 -0
- package/templates/ci/sast.yml +44 -0
- package/templates/codex/INDEX.md +18 -0
- package/templates/codex/README.md +28 -0
- package/templates/codex/decisions/0000-template.md +36 -0
- package/templates/codex/decisions/INDEX.md +11 -0
- package/templates/codex/decisions/README.md +25 -0
- package/templates/codex/domain/INDEX.md +14 -0
- package/templates/codex/domain/README.md +10 -0
- package/templates/codex/evidence/0000-extraction-template.md +36 -0
- package/templates/codex/evidence/INDEX.md +11 -0
- package/templates/codex/evidence/README.md +15 -0
- package/templates/codex/reference/INDEX.md +11 -0
- package/templates/codex/reference/README.md +15 -0
- package/templates/codex/reference/confirmed-values.md +18 -0
- package/templates/codex/requirements/INDEX.md +11 -0
- package/templates/codex/requirements/README.md +22 -0
- package/templates/codex/requirements/addons/0000-template.md +35 -0
- package/templates/codex/requirements/base.md +36 -0
- package/templates/codex/requirements/changes/0000-template.md +39 -0
- package/templates/codex/resources/INDEX.md +11 -0
- package/templates/codex/resources/README.md +17 -0
- package/templates/codex/resources/manifest.md +11 -0
- package/templates/codex/runbooks/INDEX.md +9 -0
- package/templates/codex/runbooks/README.md +8 -0
- package/templates/codex/runbooks/incident-runbook-template.md +58 -0
- package/templates/gitignore-snippet.txt +12 -0
- package/templates/journal/backlog/README.md +18 -0
- package/templates/journal/backlog/done/.gitkeep +0 -0
- package/templates/journal/memory/MEMORY.md +15 -0
- package/templates/journal/session/.gitkeep +0 -0
- package/templates/journal/session/archive/.gitkeep +1 -0
- package/templates/journal/session/artifacts/.gitkeep +1 -0
- package/templates/journal/session/current.md +12 -0
- package/templates/lint/README.md +25 -0
- package/templates/lint/eslint.config.mjs +33 -0
- package/templates/lint/tsconfig.base.json +11 -0
- package/templates/local/AGENTS.local.md +33 -0
- package/templates/local/README.md +55 -0
- package/templates/local/commands/.gitkeep +0 -0
- package/templates/local/rules/.gitkeep +0 -0
- package/templates/local/skills/.gitkeep +0 -0
- package/templates/local/stack/.gitkeep +0 -0
- package/templates/local/standards/.gitkeep +0 -0
- package/templates/tests/guardrail.invariants.test.ts +59 -0
|
@@ -0,0 +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`).
|
|
@@ -0,0 +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.
|
|
@@ -0,0 +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.
|
|
@@ -0,0 +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`).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
updated: 2026-05-31
|
|
3
|
+
status: canonical
|
|
4
|
+
description: "The project-wide testing approach: the pyramid, what to test at each level, the active policy, and what 'tested' means."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Standards — testing strategy
|
|
8
|
+
|
|
9
|
+
The per-stack **policy** (`tdd-mandatory | test-ready-deferred | none`) says *whether* you write
|
|
10
|
+
tests now (`stack/`). This standard says *how* you test when you do — so "add tests" is never an
|
|
11
|
+
open question.
|
|
12
|
+
|
|
13
|
+
## The pyramid (most tests cheap, few tests broad)
|
|
14
|
+
|
|
15
|
+
| Level | Tests | Speed | Use for |
|
|
16
|
+
|---|---|---|---|
|
|
17
|
+
| **Unit** | pure functions, domain/engine logic, reducers, validators | ms, no I/O | the bulk; every branch of business logic |
|
|
18
|
+
| **Integration** | a module against its real boundaries (DB, queue, an adapter) | seconds | data access, server actions, wiring |
|
|
19
|
+
| **E2E / contract** | a user-visible flow or a published API contract | slow | a few critical happy paths + key failure paths |
|
|
20
|
+
|
|
21
|
+
Push logic **down** the pyramid: keep the domain layer pure (`standards/architecture.md`) so most
|
|
22
|
+
behavior is unit-testable without spinning up I/O.
|
|
23
|
+
|
|
24
|
+
## What a good test asserts
|
|
25
|
+
|
|
26
|
+
- **Behavior, not implementation.** Assert observable output/effect for an input, not internal calls.
|
|
27
|
+
A refactor that preserves behavior must not break the test.
|
|
28
|
+
- **One reason to fail.** Each test pins one behavior; the name states it (`returns 409 when the
|
|
29
|
+
slot is already taken`).
|
|
30
|
+
- **Failure paths first-class.** Test the error/empty/forbidden branches, not just the happy path —
|
|
31
|
+
the launch-security checklist requires abuse-path tests for user-facing apps.
|
|
32
|
+
- **Deterministic.** No real clock, network, or randomness — inject them. A seeded RNG or a fixed
|
|
33
|
+
clock makes a flaky test impossible. Flaky = broken; fix or quarantine, never ignore.
|
|
34
|
+
- **Error codes, not strings.** Switch assertions on stable codes (`standards/error-codes.md`), not
|
|
35
|
+
on message text.
|
|
36
|
+
|
|
37
|
+
## Coverage — a floor, not a goal
|
|
38
|
+
|
|
39
|
+
Aim for meaningful coverage of branches and failure modes, not a vanity percent. 100% line coverage
|
|
40
|
+
with no failure-path assertions is weaker than 70% that exercises every error branch. Untested code
|
|
41
|
+
on a critical path (auth, money, data integrity) is a defect regardless of the overall number.
|
|
42
|
+
|
|
43
|
+
## Structural / guardrail tests
|
|
44
|
+
|
|
45
|
+
Some invariants are not example-based — "every module's public API is re-exported", "every error
|
|
46
|
+
code is unique", "the registry and the routes agree". Encode these as **guardrail tests** that fail
|
|
47
|
+
CI when two sources of truth drift (`standards/guardrail-tests.md`).
|
|
48
|
+
|
|
49
|
+
## When tests are deferred
|
|
50
|
+
|
|
51
|
+
Under `test-ready-deferred` (or any unit of work shipped without tests), the absence is a **recorded
|
|
52
|
+
decision**, not a silent gap: open an ADR stating why and the conditions for backfill
|
|
53
|
+
(`codex/decisions/`). Keep the code test-ready meanwhile — pure logic, injected dependencies, small units —
|
|
54
|
+
so tests drop in later without a rewrite.
|
|
55
|
+
|
|
56
|
+
## Definition of "tested" (feeds Definition of Done)
|
|
57
|
+
|
|
58
|
+
A change is tested when: the new/changed behavior has assertions at the right pyramid level · failure
|
|
59
|
+
paths are covered · the suite is green on fresh context · and (user-facing) the launch checklist's
|
|
60
|
+
abuse-path tests exist. The independent verifier (`rules/30-verification.md`) runs the real suite and
|
|
61
|
+
quotes real output — it does not take "tests pass" on trust.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
updated: 2026-05-31
|
|
3
|
+
status: canonical
|
|
4
|
+
description: 'TypeScript specifics: strict mode, no any, type-safety expectations.'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Standards — TypeScript
|
|
8
|
+
|
|
9
|
+
- **`strict: true`.** No implicit `any`. Prefer `unknown` over `any` at boundaries, then narrow.
|
|
10
|
+
- **No non-null `!`** except where provably safe with a comment. Prefer guards.
|
|
11
|
+
- **Types over interfaces** for unions/utility; `interface` for extendable object shapes — pick one
|
|
12
|
+
per project and stay consistent.
|
|
13
|
+
- **Discriminated unions** for state; avoid boolean-flag soup.
|
|
14
|
+
- **`const` by default**; `let` only when reassigned; never `var`.
|
|
15
|
+
- **No default exports** for modules with logic (named exports aid refactor + grep). Components MAY
|
|
16
|
+
use default export if the framework expects it.
|
|
17
|
+
- **Async:** always `await` or explicitly `void` a promise; no floating promises.
|
|
18
|
+
- **Validation at boundaries** with a schema lib (zod/valibot). Internal code trusts validated types.
|
|
19
|
+
- **Errors** carry a code (`error-codes.md`); never throw strings.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
updated: 2026-05-31
|
|
3
|
+
status: canonical
|
|
4
|
+
description: How to write agent-facing docs so they are high-signal and versioned.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Standards — writing docs
|
|
8
|
+
|
|
9
|
+
How to write the Markdown agents read (rules, standards, agents, skills, commands, ADRs). Goal: an
|
|
10
|
+
agent finds the right file and the right line fast. High-signal docs are part of code quality
|
|
11
|
+
(`rules/35-context-economy.md`).
|
|
12
|
+
|
|
13
|
+
## Lead with purpose
|
|
14
|
+
|
|
15
|
+
The first line after the H1 is one crisp sentence: **what this file is + when to read it.** The
|
|
16
|
+
per-folder `INDEX.md` generator lifts this as the blurb — a vague lead ("Always-on.") makes a useless
|
|
17
|
+
index entry. Files that carry frontmatter may set a `description:` field, which the generator prefers.
|
|
18
|
+
|
|
19
|
+
## Voice
|
|
20
|
+
|
|
21
|
+
- Terse, technical, active voice. Cut filler, hedging, throat-clearing.
|
|
22
|
+
- Address the agent directly ("do X", not "one should do X").
|
|
23
|
+
- Match the register of the surrounding docs.
|
|
24
|
+
|
|
25
|
+
## Structure
|
|
26
|
+
|
|
27
|
+
- **One topic per file.** If it grows a second concern, split it (`rules/35`).
|
|
28
|
+
- **Tables and lists for enumerations**; prose only for reasoning a reader must follow.
|
|
29
|
+
- **H1 = `Area — topic`** (e.g. `Standards — clean code`); sections scannable by heading.
|
|
30
|
+
- **Link, don't inline.** Point to the canonical file; never paste a catalog or long procedure into
|
|
31
|
+
an entry file. When you move detail out, leave a one-line pointer behind.
|
|
32
|
+
|
|
33
|
+
## Versioning
|
|
34
|
+
|
|
35
|
+
Git holds full history; a visible stamp answers "is this current?" at a glance.
|
|
36
|
+
|
|
37
|
+
- Canonical docs (standards, ADRs, long-lived references) carry frontmatter `updated: YYYY-MM-DD`,
|
|
38
|
+
and `status:` (`draft` | `canonical` | `deprecated`) where a lifecycle matters.
|
|
39
|
+
- **Bump `updated` in the same commit as any change to the doc's meaning** — this extends the
|
|
40
|
+
doc-sync rule (`rules/00-always.md`): behaviour and its doc move together, and the stamp records when.
|
|
41
|
+
- A `status: deprecated` doc names its replacement (`superseded-by:` or an inline pointer); never
|
|
42
|
+
delete silently. ADRs already follow this (`codex/decisions/`).
|
|
43
|
+
- `updated` with no `description:` does not change a file's INDEX blurb (the generator falls back to
|
|
44
|
+
the H1 + first line), so stamping is safe to add incrementally.
|
|
45
|
+
|
|
46
|
+
## Do / don't
|
|
47
|
+
|
|
48
|
+
- ✅ `# 30 — Verification` → "The agent that writes code cannot mark it done. ..." (lead states what + why).
|
|
49
|
+
- ❌ Restating the heading, or opening with backstory before the point.
|
|
50
|
+
- ✅ A five-row table of limits. ❌ The same limits as five paragraphs.
|
|
51
|
+
- ✅ "See `standards/clean-code.md`." ❌ Copying its content into three files.
|
|
52
|
+
|
|
53
|
+
## Before you commit a doc
|
|
54
|
+
|
|
55
|
+
- The lead sentence works as a standalone INDEX blurb.
|
|
56
|
+
- No duplicated content that will drift — one canonical home, others point to it.
|
|
57
|
+
- `updated` bumped if the meaning changed.
|
|
58
|
+
- Regenerate indexes: `grimoire index` (CI runs `--check`).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins": [
|
|
3
|
+
{ "name": "superpowers", "marketplace": "claude-plugins-official", "scope": "user" },
|
|
4
|
+
{ "name": "skill-creator", "marketplace": "claude-plugins-official", "scope": "user" },
|
|
5
|
+
{ "name": "ecc", "marketplace": "ecc", "scope": "user" },
|
|
6
|
+
{ "name": "ui-ux-pro-max", "marketplace": "ui-ux-pro-max-skill", "scope": "user" },
|
|
7
|
+
{ "name": "andrej-karpathy-skills", "marketplace": "karpathy-skills", "scope": "user" },
|
|
8
|
+
{ "name": "pordee", "marketplace": "pordee", "scope": "user" },
|
|
9
|
+
{ "name": "caveman", "marketplace": "caveman", "scope": "user" }
|
|
10
|
+
],
|
|
11
|
+
"skills": [
|
|
12
|
+
{ "name": "mattpocock", "install": "npx skills@latest add mattpocock/skills", "setup": "/setup-matt-pocock-skills", "source": "https://github.com/mattpocock/skills", "scope": "user" },
|
|
13
|
+
{ "name": "find-skills", "vendored": ".agents/skills/find-skills", "scope": "project" }
|
|
14
|
+
],
|
|
15
|
+
"mcp": [
|
|
16
|
+
{ "name": "playwright", "server": { "command": "npx", "args": ["-y", "@playwright/mcp@latest"] } },
|
|
17
|
+
{ "name": "stitch", "server": { "type": "http", "url": "https://stitch.googleapis.com/mcp", "headers": { "X-Goog-Api-Key": "${STITCH_API_KEY}" } }, "note": "Google Stitch — HTTP MCP; generate the key in Stitch Settings, set STITCH_API_KEY" }
|
|
18
|
+
]
|
|
19
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nuttchanon Jantawong
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Grimoire
|
|
2
|
+
|
|
3
|
+
A single, version-controlled **AI-agent operating system** you pull into every project.
|
|
4
|
+
One command gives a new repo a complete, orderly set of working rules, coding standards,
|
|
5
|
+
subagents, skills, commands, tech-stack defaults, and a self-bias-free verification protocol.
|
|
6
|
+
|
|
7
|
+
The core is **tool-agnostic** (`.agents/AGENTS.md`) so any agent can read it; Claude Code
|
|
8
|
+
binding sits on top. Template updates propagate to old projects without clobbering their
|
|
9
|
+
per-project customization.
|
|
10
|
+
|
|
11
|
+
> **Full structure & component reference:** [`.agents/NAVIGATOR.md`](.agents/NAVIGATOR.md) — what Grimoire
|
|
12
|
+
> creates, what each CLI command does, the three lifecycles, and the seed/migration model.
|
|
13
|
+
|
|
14
|
+
## What is in `.agents/`
|
|
15
|
+
|
|
16
|
+
| Path | Holds |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `AGENTS.md` | entry contract + load-order index |
|
|
19
|
+
| `rules/` | always-on working process + protocols (numbered) |
|
|
20
|
+
| `standards/` | coding standards (general + per-language) |
|
|
21
|
+
| `stack/` | tech-stack presets (web-app / desktop / library) |
|
|
22
|
+
| `agents/` | subagents — e.g. the independent `verifier` |
|
|
23
|
+
| `commands/` | slash commands (`verify`, `checkpoint`, `grimoire`) |
|
|
24
|
+
| `skills/` | reusable, re-runnable workflows |
|
|
25
|
+
| `local/` | per-project overrides; `sync` never touches |
|
|
26
|
+
|
|
27
|
+
`init` also seeds **`codex/`** at the **repo root** (not under `.agents/`) — the project's knowledge
|
|
28
|
+
base: `domain/`, `requirements/`, `decisions/`, `evidence/`, `resources/`, `reference/`, `runbooks/`.
|
|
29
|
+
It is read-first for any domain/feature work (start at `codex/INDEX.md`), project-owned, and lives
|
|
30
|
+
outside every managed path, so `grimoire sync` is sync-safe and never touches it.
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
Published on npm as [`the-grimoire-cli`](https://www.npmjs.com/package/the-grimoire-cli); the command
|
|
35
|
+
it installs is `grimoire`.
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
# New project — scaffold .agents/ + pointers
|
|
39
|
+
npx the-grimoire-cli init
|
|
40
|
+
|
|
41
|
+
# Existing project — pull latest template (managed paths only; codex/ journal/ local/ untouched)
|
|
42
|
+
npx the-grimoire-cli sync
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Install it globally for the `grimoire` command everywhere, and update in place:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
npm i -g the-grimoire-cli # install
|
|
49
|
+
grimoire init # or: grimoire sync
|
|
50
|
+
npm update -g the-grimoire-cli # pull the latest template release
|
|
51
|
+
grimoire --version # release version + build sha
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Prefer pinning straight to the repo? `npx github:nuttchanon/the-grimoire init` works too, no npm needed.
|
|
55
|
+
|
|
56
|
+
## Two-layer model
|
|
57
|
+
|
|
58
|
+
- **Managed base** — the template owns it; `grimoire sync` overwrites it. Listed in
|
|
59
|
+
`.agents/grimoire.manifest`.
|
|
60
|
+
- **Local overrides** (`local/`, at the repo root) — the project owns it; sync never touches it. To change a
|
|
61
|
+
base rule, **do not edit the base** — add an override in `local/`. That is what keeps sync
|
|
62
|
+
conflict-free.
|
|
63
|
+
|
|
64
|
+
Precedence: base loads first, `local/` loads last and **wins**.
|
|
65
|
+
|
|
66
|
+
## Session-state — 3 homes
|
|
67
|
+
|
|
68
|
+
| Layer | Answers | Home | Git |
|
|
69
|
+
|---|---|---|---|
|
|
70
|
+
| **NOW** | "what am I doing right now?" | `journal/session/` | gitignored |
|
|
71
|
+
| **KNOWLEDGE** | "what do we already know?" | `journal/memory/` | tracked |
|
|
72
|
+
| **QUEUE** | "what work is pending?" | `journal/backlog/` | tracked |
|
|
73
|
+
|
|
74
|
+
## Verification
|
|
75
|
+
|
|
76
|
+
The agent that writes code cannot mark it done. After a change, the main thread spawns the
|
|
77
|
+
**verifier** subagent on fresh context (requirements + diff + checklist only — not the
|
|
78
|
+
implementer's reasoning). It refutes by default, runs the real `verify` script, and quotes real
|
|
79
|
+
output. Definition of Done = tests green **AND** verifier `pass` **AND** checklist complete.
|
|
80
|
+
|
|
81
|
+
## Tooling — skills, plugins & MCP
|
|
82
|
+
|
|
83
|
+
`.agents/tooling.json` declares the plugins, skills, and MCP servers a project relies on, and
|
|
84
|
+
`.agents/skills/catalog.md` maps `task → capability` (primary + alternates). The always-on rule
|
|
85
|
+
`rules/15-skills.md` makes consulting the catalog reflexive; anything uncovered is found via the
|
|
86
|
+
vendored `find-skills` skill.
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
# enable required plugins / MCP / skills (prints a plan; nothing is written)
|
|
90
|
+
npx github:nuttchanon/the-grimoire bootstrap
|
|
91
|
+
|
|
92
|
+
# actually apply (additive, backs up ~/.claude/settings.json, never disables anything)
|
|
93
|
+
npx github:nuttchanon/the-grimoire bootstrap --apply
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`init` runs `bootstrap` in dry-run automatically and mirrors `find-skills` into `.claude/skills/`.
|
|
97
|
+
The mattpocock engineering skills install separately via `npx skills@latest add mattpocock/skills`
|
|
98
|
+
followed by `/setup-matt-pocock-skills`. Editing `~/.claude/settings.json` is a machine-wide change —
|
|
99
|
+
bootstrap defaults to dry-run, backs up first, and only adds.
|
|
100
|
+
|
|
101
|
+
A project declares its **own** plugins / MCP servers (Linear, Sentry, Supabase, Figma, …) in
|
|
102
|
+
`local/tooling.json` — same shape as the base. `bootstrap` merges it **additively** (base
|
|
103
|
+
wins on conflict, local adds new entries), so project integrations live in `local/` instead of
|
|
104
|
+
bloating the managed base.
|
|
105
|
+
|
|
106
|
+
## Navigation — generated per-folder indexes
|
|
107
|
+
|
|
108
|
+
Each managed folder carries an `INDEX.md`: a one-line-per-file table generated from each file's
|
|
109
|
+
frontmatter or H1. Agents read it before opening files — two-level progressive disclosure
|
|
110
|
+
(`AGENTS.md` map → folder `INDEX.md` → file) that keeps context lean (`rules/35-context-economy.md`).
|
|
111
|
+
It is generated, never hand-edited:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
# regenerate every INDEX.md (runs automatically inside init + sync)
|
|
115
|
+
npx github:nuttchanon/the-grimoire index
|
|
116
|
+
|
|
117
|
+
# CI guard: fail if any INDEX.md is stale, or a tooling.json MCP is undocumented in the catalog
|
|
118
|
+
npx github:nuttchanon/the-grimoire index --check
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`init`/`sync` generate an `INDEX.md` for both the managed folders and your `local/` folders.
|
|
122
|
+
|
|
123
|
+
## Health check — doctor
|
|
124
|
+
|
|
125
|
+
`grimoire doctor` verifies a project is correctly wired: `CLAUDE.md` imports, skill frontmatter
|
|
126
|
+
(`name:`/`description:` so mirrored skills are discoverable), INDEX/catalog drift, unfilled
|
|
127
|
+
`AGENTS.local.md` placeholders, and oversized entry files. One line per
|
|
128
|
+
finding; exits non-zero on any error, so it drops straight into CI:
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
npx github:nuttchanon/the-grimoire doctor
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Decisions — ADRs
|
|
135
|
+
|
|
136
|
+
`init` seeds `codex/decisions/` (a template + README) into the project; it is project-owned and
|
|
137
|
+
survives `sync`. ADRs record lasting choices, carry an `updates-confirmed-values` flag (ground-truth
|
|
138
|
+
values change with their ADR in the same PR), and a missing test suite must be a recorded ADR rather
|
|
139
|
+
than a silent gap (`rules/00-always.md`).
|