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,112 @@
|
|
|
1
|
+
# AGENTS.md — master contract (tool-agnostic)
|
|
2
|
+
|
|
3
|
+
This is the **canonical entry** for every agent working in this repo. Claude Code reaches it via
|
|
4
|
+
`CLAUDE.md` (`@.agents/AGENTS.md`). Read in the order below — do **not** "read everything" up front.
|
|
5
|
+
|
|
6
|
+
Keep this file lean (`rules/35-context-economy.md`): tone, hardest rules, the map, pointers — detail
|
|
7
|
+
lives in the files it links.
|
|
8
|
+
|
|
9
|
+
## Tone
|
|
10
|
+
|
|
11
|
+
The person you work with is a **Product Builder** — address them directly ("you"), not as a passive
|
|
12
|
+
third party. Talk straight: factual and data-driven, no hype, no flattery, no telling them what they
|
|
13
|
+
want to hear. State trade-offs, risks, and disagreements plainly, with the evidence behind them —
|
|
14
|
+
being right matters more than being agreeable. Stay calm and professional, never emotional or
|
|
15
|
+
defensive. They may not know a given technical detail; explain it when it matters, plainly and
|
|
16
|
+
without condescension. Be terse and technical, and match the surrounding code and the user's
|
|
17
|
+
register. Project-specific tone or any communication mode lives in `local/AGENTS.local.md`.
|
|
18
|
+
|
|
19
|
+
## Load order
|
|
20
|
+
|
|
21
|
+
1. **This file** — hardest rules + the map (below).
|
|
22
|
+
2. **`rules/`** — always-on working process. Read `00-always.md` every session.
|
|
23
|
+
3. **`codex/INDEX.md`** — the project's knowledge base (domain, requirements, decisions, evidence,
|
|
24
|
+
resources, reference, runbooks). Read-on-demand, but **read-first for any domain/feature work**.
|
|
25
|
+
4. **`standards/`** — when writing code, load `general.md` + the per-language file.
|
|
26
|
+
5. **`stack/`** — when scaffolding or configuring, load the active profile.
|
|
27
|
+
6. **`codex/decisions/`** — when a decision's *why* matters.
|
|
28
|
+
7. **`local/`** — per-project customization. Read `local/AGENTS.local.md`, then the matching
|
|
29
|
+
`local/<area>/` (rules/standards/stack/skills/commands/reference) for any base area you touch;
|
|
30
|
+
**loads last and wins**.
|
|
31
|
+
|
|
32
|
+
## The map
|
|
33
|
+
|
|
34
|
+
| Need | Go to |
|
|
35
|
+
|---|---|
|
|
36
|
+
| System structure / what grimoire creates / CLI behavior / layout & lifecycles | `NAVIGATOR.md` |
|
|
37
|
+
| Project knowledge / domain / evidence / resources / requirements / decisions | `codex/` (start at `codex/INDEX.md`) |
|
|
38
|
+
| Working process, modes, handoff routing | `rules/` |
|
|
39
|
+
| Coding standards, naming, error codes | `standards/` |
|
|
40
|
+
| Requirements (base / addon / change request) | `standards/requirements.md` + `codex/requirements/` |
|
|
41
|
+
| Test strategy, release/versioning, accessibility | `standards/testing-strategy.md` · `standards/release-versioning.md` · `standards/accessibility.md` |
|
|
42
|
+
| Framework / lint / test / CI **starter templates** (copy manually — not auto-seeded) | `stack/` + `templates/ci/` · `templates/lint/` · `templates/tests/` |
|
|
43
|
+
| Independent verification (the verifier) | `rules/30-verification.md` + `agents/verifier.md` |
|
|
44
|
+
| What am I doing right now? | `journal/session/current.md` (NOW) |
|
|
45
|
+
| What do we already know? | `journal/memory/` + `journal/memory/MEMORY.md` (KNOWLEDGE) |
|
|
46
|
+
| What work is pending? | `journal/backlog/` (QUEUE) |
|
|
47
|
+
| Project-specific overrides | `local/` |
|
|
48
|
+
| Project domain reference (big contracts, IPC tables, confirmed values) | `local/reference/` |
|
|
49
|
+
| Keeping entry files lean | `rules/35-context-economy.md` |
|
|
50
|
+
| Presenting to a human (HTML) | `rules/45-presentation.md` + `commands/present.md` |
|
|
51
|
+
|
|
52
|
+
Inside any managed folder **or `local/` folder**, read its generated `INDEX.md` (one line per file)
|
|
53
|
+
**before** opening files — that is the per-folder resource map (regenerate with `grimoire index`; CI
|
|
54
|
+
runs `--check`). `grimoire doctor` health-checks the whole wiring (exits non-zero on error, for CI).
|
|
55
|
+
|
|
56
|
+
### Hot keywords (jump straight to the file)
|
|
57
|
+
|
|
58
|
+
| Keyword | File |
|
|
59
|
+
|---|---|
|
|
60
|
+
| error code / error catalog | `standards/error-codes.md` |
|
|
61
|
+
| verify command / done | active `stack/<profile>.md` + `rules/30-verification.md` |
|
|
62
|
+
| security / auth / secrets | `rules/50-security.md` |
|
|
63
|
+
| code quality / clean code | `standards/clean-code.md` + `rules/05-code-quality.md` |
|
|
64
|
+
| over-engineering / laziness / minimal code / the ladder / `ponytail:` marker | `standards/clean-code.md` (ladder + guardrail) · ADR `docs/adr/0007-adopt-ponytail-laziness-ladder.md` |
|
|
65
|
+
| launch / privacy gate | `standards/launch-security-checklist.md` + `standards/security-scanners.md` |
|
|
66
|
+
| requirement / spec / REQ-id / change request | `standards/requirements.md` + `codex/requirements/` |
|
|
67
|
+
| test strategy / how to test / coverage | `standards/testing-strategy.md` |
|
|
68
|
+
| release / changelog / version / rollback | `standards/release-versioning.md` |
|
|
69
|
+
| accessibility / a11y / WCAG | `standards/accessibility.md` |
|
|
70
|
+
| incident / runbook / on-call / outage | `codex/runbooks/` |
|
|
71
|
+
| CI / pipeline / workflow | `templates/ci/ci.yml` + `templates/ci/sast.yml` |
|
|
72
|
+
| commit format | `rules/60-commit-style.md` |
|
|
73
|
+
| HOTFIX | `rules/20-modes.md` |
|
|
74
|
+
| codex / knowledge base / provenance | `standards/codex.md` + `codex/INDEX.md` |
|
|
75
|
+
| domain / glossary / context | `codex/domain/` |
|
|
76
|
+
| evidence / investigation / decompile / reverse-engineer / provenance | `codex/evidence/` + `standards/codex.md` |
|
|
77
|
+
| decision / ADR / "why" | `codex/decisions/` |
|
|
78
|
+
| which skill / capability | `skills/catalog.md` |
|
|
79
|
+
| writing / editing a contract doc | `standards/writing.md` |
|
|
80
|
+
| credit / attribution / license / external source / adopt a tool | `standards/attribution.md` |
|
|
81
|
+
| knowledge retrieval / search the codebase / code graph | `graphify` (ADR `docs/adr/0006-delegate-retrieval-to-external-tooling.md`) |
|
|
82
|
+
| structure / architecture / navigator / what does grimoire create / layout / lifecycle | `NAVIGATOR.md` |
|
|
83
|
+
|
|
84
|
+
## Source priority (when sources conflict)
|
|
85
|
+
|
|
86
|
+
Trust in this order: **live code + committed docs/specs** (current) > **this base template**
|
|
87
|
+
(`rules/ standards/ stack/`) > **`journal/memory/` cards** (may be stale — verify before acting on one).
|
|
88
|
+
A memory never overrides what the code currently says; treat it as a lead, not as truth.
|
|
89
|
+
|
|
90
|
+
## Hardest rules (full text in `rules/00-always.md`)
|
|
91
|
+
|
|
92
|
+
- **Verify before done.** Code you wrote is not done until the verifier returns `pass` on fresh
|
|
93
|
+
context. The author cannot mark their own work done.
|
|
94
|
+
- **Doc-sync same turn.** Behavior change and its doc/memory update ship in the same turn.
|
|
95
|
+
- **Security first.** No hardcoded roles/secrets; validate + authorize on the server; fail closed.
|
|
96
|
+
- **Effort is not a constraint.** Do not scope-cut to save effort. Spawn parallel subagents instead.
|
|
97
|
+
|
|
98
|
+
## Customization & precedence
|
|
99
|
+
|
|
100
|
+
Base (this template) loads first; `local/` loads last and **wins**.
|
|
101
|
+
|
|
102
|
+
**In a consuming project, never edit the managed base** — `.agents/AGENTS.md`, `rules/`,
|
|
103
|
+
`standards/`, `stack/`, `agents/`, `skills/`, `commands/`, `tooling.json`. `grimoire sync`
|
|
104
|
+
overwrites all of them, so edits there are lost. Put **every** customization under root `local/`
|
|
105
|
+
(it is never synced): **override** a base behavior by restating it in `local/` (it wins), or **add**
|
|
106
|
+
a project-only rule/skill/command/standard under the matching `local/<area>/`. Protocol:
|
|
107
|
+
`local/README.md`.
|
|
108
|
+
|
|
109
|
+
**Project domain docs** that don't fit the lean `AGENTS.md` (a big runtime contract, confirmed-value
|
|
110
|
+
tables, an IPC catalog) live in `local/reference/` — `grimoire index` generates its `INDEX.md` too.
|
|
111
|
+
Run `grimoire doctor` to verify the wiring (imports, skill frontmatter, INDEX drift, placeholders);
|
|
112
|
+
it exits non-zero on error, for CI.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# NAVIGATOR — Grimoire structure & components
|
|
2
|
+
|
|
3
|
+
Canonical reference for **what Grimoire is, what it creates, and what each part does**. Read this to
|
|
4
|
+
get a consistent mental model before touching the CLI, the contract, or the layout. It ships inside the
|
|
5
|
+
contract (`.agents/NAVIGATOR.md`) so every project shares the same map; it complements `README.md`
|
|
6
|
+
(quickstart) and `.agents/AGENTS.md` (the working contract an agent loads each session).
|
|
7
|
+
|
|
8
|
+
Grimoire is a single, version-controlled **AI-agent operating system** you pull into any repo. One
|
|
9
|
+
command (`grimoire init`) gives a project a complete contract — rules, standards, subagents, skills,
|
|
10
|
+
commands, stack presets, a verification protocol — plus the root folders an agent writes into. Later,
|
|
11
|
+
`grimoire sync` propagates template updates to old projects **without clobbering** their own data.
|
|
12
|
+
|
|
13
|
+
The CLI (`grimoire`, source `bin/grimoire.mjs` in the template repo) is **zero dependencies**,
|
|
14
|
+
Node ≥18, ESM. The Grimoire repo itself *is* the template and dogfoods this layout
|
|
15
|
+
(`TEMPLATE_ROOT` = repo root, so its own `.agents/` is the template source).
|
|
16
|
+
|
|
17
|
+
## The one mental model: three lifecycles
|
|
18
|
+
|
|
19
|
+
Everything Grimoire manages falls into exactly one of three buckets. This split is the whole design.
|
|
20
|
+
|
|
21
|
+
| Lifecycle | Who owns it | `grimoire sync` | Where it lives |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| **Contract** (read-only) | the base template | **overwrites wholesale** (delete + copy) | `.agents/` |
|
|
24
|
+
| **Project-owned state/knowledge** | the project / the agent | **never touches** | `codex/`, `journal/`, `local/` (repo root) |
|
|
25
|
+
| **Seed sources** | the base template | shipped, copied into new projects | `templates/` |
|
|
26
|
+
|
|
27
|
+
Rule of thumb: **`.agents/` is 100% read-only.** Nothing an agent or project writes lives under it.
|
|
28
|
+
Anything written goes to a root folder (`codex/`, `journal/`, `local/`). To customize base behavior,
|
|
29
|
+
never edit `.agents/` in a consuming project — restate it in `local/` (loads last, wins).
|
|
30
|
+
|
|
31
|
+
## Top-level layout (what a Grimoire project contains)
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
<repo>/
|
|
35
|
+
├─ CLAUDE.md # thin pointer: imports @.agents/AGENTS.md + @local/AGENTS.local.md
|
|
36
|
+
├─ .agents/ # CONTRACT — read-only, wholesale-synced
|
|
37
|
+
│ ├─ AGENTS.md # canonical entry: tone, hardest rules, the map, load order
|
|
38
|
+
│ ├─ rules/ # always-on working process (numbered 00–60)
|
|
39
|
+
│ ├─ standards/ # coding standards (general + per-language) + writing/codex
|
|
40
|
+
│ ├─ stack/ # tech-stack presets (web-app / desktop / library)
|
|
41
|
+
│ ├─ agents/ # subagents (e.g. the independent verifier)
|
|
42
|
+
│ ├─ skills/ # reusable workflows (incl. vendored find-skills)
|
|
43
|
+
│ ├─ commands/ # slash commands (verify, checkpoint, onboard, present, grimoire)
|
|
44
|
+
│ ├─ tooling.json # declared plugins / skills / MCP servers
|
|
45
|
+
│ ├─ grimoire.manifest # documents the contract surface (no longer used for carve-outs)
|
|
46
|
+
│ └─ VERSION # template version + source sha (stamped by init/sync)
|
|
47
|
+
├─ codex/ # KNOWLEDGE — project-owned, seeded once, never synced
|
|
48
|
+
│ ├─ INDEX.md domain/ requirements/ decisions/ evidence/ resources/ reference/ runbooks/
|
|
49
|
+
├─ journal/ # AGENT STATE — project-owned, never synced
|
|
50
|
+
│ ├─ memory/ (+ MEMORY.md) # KNOWLEDGE: durable facts (tracked)
|
|
51
|
+
│ ├─ backlog/ # QUEUE: pending work items (tracked)
|
|
52
|
+
│ └─ session/ # NOW: per-run state (gitignored)
|
|
53
|
+
└─ local/ # OVERRIDE CONFIG — project-owned, never synced, loads LAST and wins
|
|
54
|
+
├─ AGENTS.local.md # profile (stack, testing policy), project facts, override declarations
|
|
55
|
+
├─ README.md rules/ standards/ stack/ skills/ commands/ reference/
|
|
56
|
+
└─ tooling.json # project-only plugins / MCP (merged additively by bootstrap)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### The contract — `.agents/` (read-only)
|
|
60
|
+
|
|
61
|
+
| Path | Holds |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `AGENTS.md` | entry contract + load-order + the map + hot-keywords |
|
|
64
|
+
| `rules/` | always-on process: 00-always, verification, modes, handoff, context-economy, commit-style, … |
|
|
65
|
+
| `standards/` | coding standards (general + per-language), writing, codex, knowledge-management |
|
|
66
|
+
| `stack/` | per-profile defaults (framework / lint / test / verify command) |
|
|
67
|
+
| `agents/` | subagent definitions — notably `verifier` (independent done-check) |
|
|
68
|
+
| `skills/` | re-runnable workflows; `find-skills` is vendored + mirrored to `.claude/skills/` |
|
|
69
|
+
| `commands/` | slash commands |
|
|
70
|
+
| `tooling.json` | source of truth for required plugins / skills / MCP |
|
|
71
|
+
| `grimoire.manifest` | lists the managed paths — documentation only (sync is wholesale) |
|
|
72
|
+
|
|
73
|
+
### Project-owned roots (never synced)
|
|
74
|
+
|
|
75
|
+
- **`codex/`** — the project's knowledge base; read-first for any domain/feature work (start at
|
|
76
|
+
`codex/INDEX.md`). Holds `domain/`, `requirements/`, `decisions/` (ADRs), `evidence/`, `resources/`,
|
|
77
|
+
`reference/`, `runbooks/`. Seeded once from `templates/codex/`.
|
|
78
|
+
- **`journal/`** — the agent's working state, the "3 homes":
|
|
79
|
+
- `journal/session/` = **NOW** (current run; gitignored),
|
|
80
|
+
- `journal/memory/` = **KNOWLEDGE** (durable facts + `MEMORY.md` index; tracked),
|
|
81
|
+
- `journal/backlog/` = **QUEUE** (pending work; tracked).
|
|
82
|
+
- **`local/`** — the project's customization layer. Loads **last and wins**. Override a base rule by
|
|
83
|
+
restating it here; add project-only rules/skills/commands/standards under the matching `local/<area>/`.
|
|
84
|
+
|
|
85
|
+
## What each CLI command creates / does
|
|
86
|
+
|
|
87
|
+
`grimoire <command> [--dir <path>]` (default dir = cwd).
|
|
88
|
+
|
|
89
|
+
### `init` — scaffold a project
|
|
90
|
+
1. **Auto-migrate** an old-layout project first (`migrateLegacyLayout`, see below).
|
|
91
|
+
2. **Wholesale-copy** the template `.agents/` into the project (`copyAgentsWholesale`).
|
|
92
|
+
3. Stamp `VERSION` (template version + git sha).
|
|
93
|
+
4. Write `CLAUDE.md` pointer (if absent).
|
|
94
|
+
5. Ensure `.gitignore` has the session/backup ignore snippet.
|
|
95
|
+
6. **Seed root folders** (only if absent / per-file gap-fill, never overwriting):
|
|
96
|
+
`seedCodex` → `codex/`; `seedRoot("journal")` → `journal/`; `seedRoot("local")` → `local/`.
|
|
97
|
+
7. Mirror discoverable skills into `.claude/skills/` (`find-skills` + every `local/skills/<x>`).
|
|
98
|
+
8. Generate per-folder `INDEX.md` (after all mutations).
|
|
99
|
+
9. Run `bootstrap` in dry-run (prints the plugin/MCP plan; writes nothing).
|
|
100
|
+
|
|
101
|
+
### `sync` — pull template updates into an existing project
|
|
102
|
+
1. Fail if no `.agents/` (must `init` first).
|
|
103
|
+
2. **Auto-migrate** an old layout (once, with backup).
|
|
104
|
+
3. **Wholesale-replace** `.agents/` from the template (delete + copy) — your contract is refreshed.
|
|
105
|
+
4. Re-stamp `VERSION`; re-seed `codex/`/`journal/`/`local/` (gap-fill only, never clobbers your files);
|
|
106
|
+
re-mirror skills; regenerate `INDEX.md`.
|
|
107
|
+
**`codex/`, `journal/`, `local/` are never overwritten** — only missing files are filled in.
|
|
108
|
+
|
|
109
|
+
### `bootstrap` — wire plugins / MCP / skills
|
|
110
|
+
Reads base `tooling.json` ∪ `local/tooling.json` (base wins on key conflict; local adds new keys).
|
|
111
|
+
- Dry-run (default): prints missing plugins, MCP servers to ensure, and skill install hints.
|
|
112
|
+
- `--apply`: enables missing plugins in `~/.claude/settings.json` (backs it up first, only **adds**,
|
|
113
|
+
never disables), and merges MCP servers into `.mcp.json` (never clobbers an existing server). Flags
|
|
114
|
+
unresolved `${ENV}` placeholders.
|
|
115
|
+
|
|
116
|
+
### `index` — regenerate per-folder `INDEX.md`
|
|
117
|
+
One-line-per-file table built from each file's frontmatter `description:` or its H1 + first sentence.
|
|
118
|
+
Two groups: the contract (`.agents/<folder>`) and the override layer (`local/<folder>`).
|
|
119
|
+
`index --check` is the CI drift gate: fails if any `INDEX.md` is stale, or a `tooling.json` MCP isn't
|
|
120
|
+
documented in `skills/catalog.md`. Newline-agnostic (tolerates CRLF checkouts).
|
|
121
|
+
|
|
122
|
+
### `doctor` — health-check the wiring (CI-friendly, exits non-zero on error)
|
|
123
|
+
Checks: `CLAUDE.md` imports `@.agents/AGENTS.md` (error) and `@local/AGENTS.local.md` (warn); mirrored
|
|
124
|
+
skills have `name:`+`description:`; INDEX/catalog drift; `local/AGENTS.local.md` stack-profile +
|
|
125
|
+
testing-policy filled; entry files ≤300 lines; `codex/INDEX.md` scaffolded; `local/tooling.json` valid.
|
|
126
|
+
|
|
127
|
+
## Seed-source map (`templates/` → project root)
|
|
128
|
+
|
|
129
|
+
`init`/`sync` seed project-owned roots from `templates/`. Source and destination are separate so this
|
|
130
|
+
repo's own live state never doubles as the seed.
|
|
131
|
+
|
|
132
|
+
| Seed source | Seeds into | How |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| `templates/codex/` | `codex/` | `seedCodex` — dir-level **seed-once** (skips if `codex/` exists) |
|
|
135
|
+
| `templates/journal/` | `journal/` | `seedRoot` — **per-file gap-fill** (fills missing files only) |
|
|
136
|
+
| `templates/local/` | `local/` | `seedRoot` — **per-file gap-fill** |
|
|
137
|
+
| `templates/CLAUDE.md` | `CLAUDE.md` | copied once (if absent) |
|
|
138
|
+
| `templates/gitignore-snippet.txt` | `.gitignore` | appended once (`journal/session/`, `.agents.bak-*/`) |
|
|
139
|
+
|
|
140
|
+
## Migration (old layout → new)
|
|
141
|
+
|
|
142
|
+
Older projects kept agent state under `.agents/{memory,backlog,session,local}`. On the next
|
|
143
|
+
`init`/`sync`, `migrateLegacyLayout` runs once: it backs up the whole `.agents/` to
|
|
144
|
+
`.agents.bak-<stamp>/`, then **moves** each legacy dir to its root home —
|
|
145
|
+
`.agents/memory→journal/memory`, `…/backlog→journal/backlog`, `…/session→journal/session`,
|
|
146
|
+
`…/local→local/` — **only if the destination is absent** (a conflict leaves the legacy copy in the
|
|
147
|
+
backup, never overwriting a newer root copy). Idempotent: a no-op once the legacy dirs are gone.
|
|
148
|
+
|
|
149
|
+
## How an agent reads a Grimoire project (load order)
|
|
150
|
+
|
|
151
|
+
1. `CLAUDE.md` → imports `@.agents/AGENTS.md` (contract) + `@local/AGENTS.local.md` (overrides).
|
|
152
|
+
2. `.agents/AGENTS.md` — hardest rules + the map; **read first, don't read everything**.
|
|
153
|
+
3. `.agents/rules/00-always.md` — every session.
|
|
154
|
+
4. `codex/INDEX.md` — read-first for any domain/feature work.
|
|
155
|
+
5. `standards/` + `stack/` — when writing/scaffolding code.
|
|
156
|
+
6. `local/` — loads **last and wins**.
|
|
157
|
+
|
|
158
|
+
Inside any folder, read its generated `INDEX.md` before opening files (two-level progressive
|
|
159
|
+
disclosure: map → INDEX → file), keeping context lean.
|
|
160
|
+
|
|
161
|
+
## Invariants (don't break these)
|
|
162
|
+
|
|
163
|
+
- **Zero runtime dependencies** in `bin/grimoire.mjs` (Node stdlib only).
|
|
164
|
+
- **`.agents/` is read-only** and wholesale-replaced by `sync` — never store project data there.
|
|
165
|
+
- **`codex/`, `journal/`, `local/` are never synced** — safe homes for project-owned content.
|
|
166
|
+
- **`local/` wins** on any conflict (loads last).
|
|
167
|
+
- Behavior change ships with its doc/INDEX update in the **same change** (doc-sync).
|
|
168
|
+
- Code an agent wrote is not done until the independent **verifier** returns `pass`.
|
package/.agents/VERSION
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verifier
|
|
3
|
+
description: Independent verification reviewer. Spawn AFTER a change is complete to confirm Definition of Done on fresh context. Receives only requirements + diff + checklist — never the implementer's reasoning. Refutes by default; runs the real verify commands and quotes real output.
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the **independent verifier**. You did not write this code. Your job is to **refute** the
|
|
8
|
+
claim that it is done — not to praise it. Default to **FAIL** when uncertain.
|
|
9
|
+
|
|
10
|
+
## You receive (and ONLY this)
|
|
11
|
+
|
|
12
|
+
- The requirements / acceptance criteria.
|
|
13
|
+
- The diff (or the changed files).
|
|
14
|
+
- The checklist (Definition of Done items).
|
|
15
|
+
|
|
16
|
+
You do **not** get the implementer's reasoning or conversation. If context is missing, say so and
|
|
17
|
+
FAIL — do not assume.
|
|
18
|
+
|
|
19
|
+
## What you must do
|
|
20
|
+
|
|
21
|
+
1. **Run the real `verify` command** for this project (`npm run verify`, or the profile's command
|
|
22
|
+
in `stack/`). If there is no verify script, run typecheck + lint + tests directly.
|
|
23
|
+
2. **Quote the actual output.** Real command, real exit code, real failing/passing counts. Never
|
|
24
|
+
write "looks good", "should pass", or paraphrase results.
|
|
25
|
+
3. Check the diff against **each requirement** and **each checklist item** explicitly.
|
|
26
|
+
4. Look for: untested branches, security regressions (`rules/50-security.md`), hardcoded
|
|
27
|
+
roles/secrets, swallowed errors, missing doc/memory sync, scope the diff does NOT cover.
|
|
28
|
+
5. **Code-quality rubric.** Load the "Review checklist" in `standards/clean-code.md` and refute the
|
|
29
|
+
diff against it (limits, readability, function design, type-safety, performance, suppression, dead
|
|
30
|
+
code). A violation without a recorded justification is a `fail`.
|
|
31
|
+
6. **Scope & contract.** Output meets the task's stated acceptance criteria and nothing out-of-scope
|
|
32
|
+
crept in (`rules/10` task contract; `rules/25` surgical). Flag any addition the request did not call for.
|
|
33
|
+
|
|
34
|
+
## Output (structured verdict)
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
VERDICT: pass | fail
|
|
38
|
+
COMMANDS RUN:
|
|
39
|
+
<command> -> exit <code>
|
|
40
|
+
<quoted output, trimmed to the relevant lines>
|
|
41
|
+
REQUIREMENTS:
|
|
42
|
+
- <req>: met | NOT met — <evidence>
|
|
43
|
+
CHECKLIST:
|
|
44
|
+
- <item>: done | NOT done
|
|
45
|
+
REASONS (if fail):
|
|
46
|
+
- <specific, actionable>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Definition of Done = tests green **AND** `VERDICT: pass` **AND** every checklist item done. If any
|
|
50
|
+
one is missing, the verdict is `fail`. Save this verdict as the artifact the main thread cites.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# commands — 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
|
+
| `checkpoint.md` | Snapshot the NOW whiteboard before a context boundary. |
|
|
8
|
+
| `grimoire.md` | Run grimoire init or sync from inside Claude Code. |
|
|
9
|
+
| `onboard.md` | Onboard an existing (pre-Grimoire) repo onto the template without losing its custom contract. |
|
|
10
|
+
| `present.md` | Render the current spec / review / report / prototype / editing UI as a self-contained HTML artifact and return a file:// URL. |
|
|
11
|
+
| `verify.md` | Run the verify script and dispatch the verifier subagent for independent sign-off. |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Snapshot the NOW whiteboard before a context boundary.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Checkpoint the current session state (`rules` §6 — NOW layer).
|
|
6
|
+
|
|
7
|
+
Steps:
|
|
8
|
+
|
|
9
|
+
1. Ensure `journal/session/current.md` reflects the live state: mode, focus, last-done, next-step,
|
|
10
|
+
blockers, open-questions, files-touched. Rewrite it in place if stale.
|
|
11
|
+
2. Copy it to `journal/session/archive/<timestamp>.md` (timestamp = `YYYY-MM-DD-HHmm`).
|
|
12
|
+
3. Confirm the snapshot path back to the user.
|
|
13
|
+
|
|
14
|
+
A checkpoint is **not a new file type** — it is a timestamped copy of `current.md`. Resume always
|
|
15
|
+
reads `current.md`; archives are for recovery only.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run grimoire init or sync from inside Claude Code.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Wrap the Grimoire CLI (`bin/grimoire.mjs`).
|
|
6
|
+
|
|
7
|
+
- **init** — scaffold `.agents/` + pointers into a new project. Run:
|
|
8
|
+
`npx github:nuttchanon/the-grimoire init` (or `node bin/grimoire.mjs init` when developing the template).
|
|
9
|
+
- **sync** — pull the latest template into an existing project. Overwrites **managed paths only**
|
|
10
|
+
(`.agents/grimoire.manifest`); never touches `codex/ journal/ local/`. Run:
|
|
11
|
+
`npx github:nuttchanon/the-grimoire sync`.
|
|
12
|
+
|
|
13
|
+
After `sync`, print the changelog (git log between the old and new template sha) and bump
|
|
14
|
+
`.agents/VERSION`. Confirm with the user before running `sync` if there are uncommitted changes.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Onboard an existing (pre-Grimoire) repo onto the template without losing its custom contract.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# onboard — adopt Grimoire in an existing repo
|
|
6
|
+
|
|
7
|
+
Use this when a repo already has its own agent contract (a hand-rolled `.agents/`, a long `CLAUDE.md`,
|
|
8
|
+
ad-hoc rules) and you want it on the managed template. `init` lays the base and **backs up** an
|
|
9
|
+
existing `.agents/` to `.agents.bak-<timestamp>/`; this playbook moves the project's signal into
|
|
10
|
+
`local/` so nothing is lost and `grimoire sync` stays conflict-free. Work on a branch.
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
1. **Branch + survey.** `git checkout -b chore/grimoire-onboard`. Read the existing `.agents/` (every
|
|
15
|
+
rule), `CLAUDE.md`, and any existing ADR/requirements layout (e.g. `docs/adr/`, `docs/requirements/`).
|
|
16
|
+
Note what is project-specific (domain, stack, security model, env gotchas) vs generic (it'll be
|
|
17
|
+
replaced by the base).
|
|
18
|
+
|
|
19
|
+
2. **Run init.** `npx github:nuttchanon/the-grimoire init`. If an `.agents/` was present it is now
|
|
20
|
+
safe in `.agents.bak-<timestamp>/`; the managed base + `local/` skeleton are in place. `init` also
|
|
21
|
+
seeds a single project-owned `codex/` tree at the repo root (decisions, requirements, runbooks,
|
|
22
|
+
domain, evidence, …) via `seedCodex` — seed-once, only when `codex/` is absent, and never touched
|
|
23
|
+
by `grimoire sync`.
|
|
24
|
+
|
|
25
|
+
3. **Move custom rules → `local/rules/`.** For each project rule worth keeping, recreate it under
|
|
26
|
+
`local/rules/` with a **`local-` prefix** (avoids number collisions with the base — see
|
|
27
|
+
`local/README.md`). Carry the content verbatim; add a frontmatter `description:`.
|
|
28
|
+
|
|
29
|
+
4. **Move CLAUDE.md context → `local/AGENTS.local.md` (+ big docs → `local/reference/`).** Set the
|
|
30
|
+
profile (stack, testing policy, verify command). Move the system model, doc map, domain pointers,
|
|
31
|
+
access/auth model, and env/build gotchas into **Project facts**; park large domain contracts (IPC
|
|
32
|
+
tables, confirmed values) in `local/reference/`. Record any base behaviour you're overriding under
|
|
33
|
+
**Override declarations**.
|
|
34
|
+
|
|
35
|
+
5. **Slim CLAUDE.md to a pointer.** Reduce it to the Grimoire imports
|
|
36
|
+
(`@.agents/AGENTS.md` + `@local/AGENTS.local.md`) plus one line of orientation.
|
|
37
|
+
|
|
38
|
+
6. **Migrate ADRs/requirements into `codex/`.** If the repo already had `docs/adr/` (or
|
|
39
|
+
`docs/requirements/`, or another ADR layout), move those decisions into `codex/decisions/` and
|
|
40
|
+
requirements into `codex/requirements/`, then remove the old trees. `seedCodex` only scaffolds
|
|
41
|
+
`codex/` when it is absent, so it won't clobber a `codex/` you populate. Note any non-default
|
|
42
|
+
location in **Override declarations**.
|
|
43
|
+
|
|
44
|
+
7. **Move bespoke paths to the repo root.** `.agents/` is now a fully read-only contract — `sync`
|
|
45
|
+
wholesale-replaces it, so nothing project-owned can live under it. Any bespoke project dirs (e.g.
|
|
46
|
+
`field-reports/`, `handoff/`) belong at the repo root, alongside `codex/`, `journal/`, and `local/`.
|
|
47
|
+
|
|
48
|
+
8. **Verify + clean up.** `grimoire index` (regen INDEX.md), `grimoire doctor` (check wiring), run the
|
|
49
|
+
project's verify command, confirm the contract loads. Delete the `.agents.bak-*` backup once
|
|
50
|
+
everything is migrated. Commit; open a PR.
|
|
51
|
+
|
|
52
|
+
## Done when
|
|
53
|
+
|
|
54
|
+
The `.agents.bak-*` backup is gone · every kept project rule lives under `local/rules/` (prefixed) ·
|
|
55
|
+
`CLAUDE.md` is a thin pointer · `grimoire index --check` + `grimoire doctor` are clean · decisions and
|
|
56
|
+
requirements live under `codex/` with no leftover `docs/adr/` (or `docs/requirements/`) tree.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Render the current spec / review / report / prototype / editing UI as a self-contained HTML artifact and return a file:// URL.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Turn a human-facing deliverable into an interactive HTML page a person will actually read — not a
|
|
6
|
+
long Markdown wall they skim. Use for a spec comparison, code-review dashboard, report/explainer,
|
|
7
|
+
design prototype, or a custom editing UI (see `skills/catalog.md` -> Presentation).
|
|
8
|
+
|
|
9
|
+
Honor presentation mode (`rules/45-presentation.md`): render HTML only when the mode is on for this
|
|
10
|
+
project (`local/AGENTS.local.md`) or the user asks; otherwise stay in Markdown.
|
|
11
|
+
|
|
12
|
+
Steps:
|
|
13
|
+
|
|
14
|
+
1. Keep the **source canonical** — the Markdown/spec stays the source of truth; the HTML is a *view*
|
|
15
|
+
generated from it.
|
|
16
|
+
2. Build ONE self-contained `.html`: inline CSS + JS, **no external/remote `<script>` or CDN**, works
|
|
17
|
+
offline via `file://`. **Escape** any code/diff/user text you embed (no raw injection).
|
|
18
|
+
3. Write it to `journal/session/artifacts/<YYYY-MM-DD-HHmm>-<slug>.html` (ephemeral, gitignored).
|
|
19
|
+
4. Return the absolute `file://` path so the user can open it in a browser.
|
|
20
|
+
5. For editing UIs, include a **"copy as JSON / copy as Markdown"** button so the user can export
|
|
21
|
+
their changes back into the conversation (close the loop).
|
|
22
|
+
|
|
23
|
+
Token-aware: render HTML for deliverables that earn it, not routine replies.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run the verify script and dispatch the verifier subagent for independent sign-off.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Verify the current change to Definition-of-Done standard (`rules/30-verification.md`).
|
|
6
|
+
|
|
7
|
+
Steps:
|
|
8
|
+
|
|
9
|
+
1. Identify the `verify` command for this project (package script `verify`, or the active
|
|
10
|
+
`stack/` profile's command). If none exists, fall back to typecheck + lint + tests.
|
|
11
|
+
2. Run it. Capture real output and exit code.
|
|
12
|
+
3. Spawn the **verifier** subagent (Task/Agent tool) on **fresh context**, passing ONLY:
|
|
13
|
+
- the requirements / acceptance criteria for this change,
|
|
14
|
+
- the diff (`git diff` of the change),
|
|
15
|
+
- the Definition-of-Done checklist.
|
|
16
|
+
Do **not** pass your own reasoning or this conversation.
|
|
17
|
+
4. Relay the verifier's structured verdict. If `fail`, the change is **not done** — address the
|
|
18
|
+
reasons and re-run. Do not declare done without a `pass` artifact.
|
|
19
|
+
|
|
20
|
+
For large or risky changes, also run `/code-review` (or `/code-review ultra`).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Managed contract surface — everything under `.agents/` is read-only and OVERWRITTEN by
|
|
2
|
+
# `grimoire sync` (wholesale replace). This file documents the contract; sync no longer needs
|
|
3
|
+
# it to compute carve-outs. One path (file or dir) per line, relative to .agents/.
|
|
4
|
+
|
|
5
|
+
AGENTS.md
|
|
6
|
+
NAVIGATOR.md
|
|
7
|
+
rules/
|
|
8
|
+
standards/
|
|
9
|
+
stack/
|
|
10
|
+
agents/
|
|
11
|
+
skills/
|
|
12
|
+
commands/
|
|
13
|
+
tooling.json
|
|
14
|
+
|
|
15
|
+
# Project-owned, NEVER synced — live at the repo ROOT, outside .agents/ (listed for clarity):
|
|
16
|
+
# codex/ — knowledge base (domain, requirements, decisions, evidence, runbooks)
|
|
17
|
+
# journal/ — agent working state (memory/, backlog/, session/)
|
|
18
|
+
# local/ — project override config (loads last, wins)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
updated: 2026-05-31
|
|
3
|
+
description: The non-negotiable rules; violating any is a hard error, not a style nit. Read every session.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 00 — Always (hard errors)
|
|
7
|
+
|
|
8
|
+
Always-on. Violating any of these is a hard error, not a style nit.
|
|
9
|
+
|
|
10
|
+
- **Verify before done.** Code is not done until the independent verifier (`30-verification.md`)
|
|
11
|
+
returns `pass` on **fresh context**. The author of a change cannot mark it done — bias comes from
|
|
12
|
+
shared context. Definition of Done = tests green **AND** verifier `pass` **AND** checklist complete.
|
|
13
|
+
For **user-facing, data-collecting** apps, the launch-security checklist
|
|
14
|
+
(`standards/launch-security-checklist.md`) is part of Done, not a later pass.
|
|
15
|
+
- **Read the knowledge base first.** Before domain/feature work, read `codex/INDEX.md` — the
|
|
16
|
+
project's source-of-truth knowledge base (domain, requirements, decisions, evidence). Don't start
|
|
17
|
+
blind.
|
|
18
|
+
- **Doc-sync same turn.** Any behavior/interface change updates its doc and `journal/memory/` in the **same
|
|
19
|
+
turn** as the code. No "I'll document later".
|
|
20
|
+
- **Security first.** Never hardcode roles, permissions, secrets, or hostnames. Validate and
|
|
21
|
+
authorize on the server. Fail **closed**. (Detail: `50-security.md`.)
|
|
22
|
+
- **No hardcoded roles.** Gate behavior through helpers/config, never string literals like
|
|
23
|
+
`if (user.role === "admin")`.
|
|
24
|
+
- **Effort is not a constraint.** Never reduce scope, skip tests, or pick the lazy design to save
|
|
25
|
+
effort. If the work is large, **spawn parallel subagents** — do not cut corners.
|
|
26
|
+
- **No silent test gaps.** Shipping a unit of work without a test suite is a *recorded decision*, not
|
|
27
|
+
a silent omission: write an ADR (`codex/decisions/`) stating why (spike/throwaway, external constraint) and
|
|
28
|
+
when tests get backfilled. A missing test suite with no ADR is a defect.
|
|
29
|
+
- **Confirmed values change with their ADR.** When a decision alters ground-truth values the code
|
|
30
|
+
reads back (IPC channels, error codes, permission keys, tenant configs, shared enums), the ADR sets
|
|
31
|
+
`updates-confirmed-values: yes` and the same PR updates the project's confirmed-values table.
|
|
32
|
+
- **Small increments.** One coherent change at a time; keep the diff reviewable. (Detail: `10-working-process.md`.)
|
|
33
|
+
- **Surgical changes.** Every changed line traces to the request; don't touch adjacent code you were
|
|
34
|
+
not asked to. (Detail: `25-surgical-changes.md`.)
|
|
35
|
+
- **Never edit the managed base; customize in `local/`.** In a consuming project, the base
|
|
36
|
+
(`.agents/AGENTS.md`, `rules/`, `standards/`, `stack/`, `agents/`, `skills/`, `commands/`,
|
|
37
|
+
`tooling.json`) is overwritten by `grimoire sync`. Put every project change under root `local/`
|
|
38
|
+
(never synced) — it loads last and wins. Protocol: `local/README.md`.
|
|
39
|
+
- **State your assumptions; don't pick silently.** If a requirement is ambiguous, name what is
|
|
40
|
+
confusing and present the interpretations — do not choose one quietly. Ask when the wrong guess is
|
|
41
|
+
expensive; otherwise pick the obvious default and say so. Push back when a simpler or better
|
|
42
|
+
approach exists.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
updated: 2026-05-31
|
|
3
|
+
description: Always-on code-quality essentials; the full standard lives in standards/clean-code.md.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 05 — Code quality (standards overview)
|
|
7
|
+
|
|
8
|
+
- **Small files.** Split when a file grows past its single responsibility. Prefer many small,
|
|
9
|
+
named modules over one large one.
|
|
10
|
+
- **Minimal comments — why, not what.** Code says *what*; comments explain *why* only when
|
|
11
|
+
non-obvious. Delete comments that restate the code.
|
|
12
|
+
- **DRY, but not prematurely.** Extract on the *third* repetition, not the first.
|
|
13
|
+
- **YAGNI — climb the ladder.** Before writing, stop at the first rung that holds: skip it → stdlib →
|
|
14
|
+
native platform → existing dependency → one line → only then minimal code. No speculative
|
|
15
|
+
abstraction, config, or hooks; no error handling for impossible scenarios. Mark a deliberate
|
|
16
|
+
shortcut with `// ponytail: <ceiling>, <upgrade path>`. Full ladder + the "never simplify away"
|
|
17
|
+
guardrail: `standards/clean-code.md`.
|
|
18
|
+
- **Simplicity first.** Minimum code that solves the problem. If 200 lines could be 50, rewrite.
|
|
19
|
+
Sanity check: would a senior engineer call this overcomplicated? If yes, simplify.
|
|
20
|
+
- **Naming mirrors the domain.** Names come from the problem domain, not the implementation.
|
|
21
|
+
Match the surrounding code's idiom, casing, and comment density.
|
|
22
|
+
|
|
23
|
+
- **No silent suppression.** `eslint-disable` / `@ts-ignore` / `any` need an inline comment naming
|
|
24
|
+
the constraint + a follow-up. Greening CI by disabling a rule without a replacement guard is
|
|
25
|
+
tracked tech debt (ADR if structural).
|
|
26
|
+
|
|
27
|
+
Full standard: `standards/clean-code.md` (limits, type-safety, performance, suppression) +
|
|
28
|
+
`standards/general.md` + the per-language file.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
updated: 2026-05-31
|
|
3
|
+
description: 'How to work a task end to end: plan, task contract, right altitude, small increments, tools, TDD.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 10 — Working process
|
|
7
|
+
|
|
8
|
+
- **Plan before code.** For anything beyond a trivial edit, state the plan (files, approach,
|
|
9
|
+
test strategy) before touching code. For large/ambiguous work, get a thumbs-up first.
|
|
10
|
+
- **Goal-driven.** Turn the task into a verifiable goal before starting: "fix the bug" → "write a
|
|
11
|
+
test that reproduces it, then make it pass". Strong success criteria let you loop to done without
|
|
12
|
+
re-asking; weak ones ("make it work") force constant clarification.
|
|
13
|
+
- **Task contract.** Before non-trivial code, state the contract: the verifiable **goal**, explicit
|
|
14
|
+
**acceptance criteria**, and what is **out of scope**. The verifier checks output against it — "done"
|
|
15
|
+
means the criteria are met and nothing out-of-scope crept in.
|
|
16
|
+
- **Right altitude.** Match effort and abstraction to the ask. Do the full *right* thing for the
|
|
17
|
+
actual request — neither gold-plate (speculative abstraction; YAGNI, `rules/05`) nor scope-cut to
|
|
18
|
+
save effort (`rules/00`). When the right altitude is unclear, state your read and proceed.
|
|
19
|
+
- **Ask before large work.** Multi-session, schema-changing, or architecture-shifting work →
|
|
20
|
+
route to **BACKLOG** (`40-handoff.md`) and confirm scope before starting.
|
|
21
|
+
- **Small increments.** Land coherent, reviewable slices. Vertical (tracer-bullet) over horizontal.
|
|
22
|
+
- **Use the tools.** When a skill or command fits the task, use it instead of improvising.
|
|
23
|
+
- **Adapt external guidance.** When applying an article, talk, or vendor doc, extract the principle and fit it to this stack and domain. Vendor names and examples in the source are illustrations, not mandates — keep the core tool-agnostic.
|
|
24
|
+
- **Update NOW.** Keep `journal/session/current.md` reflecting the live state (focus / last-done /
|
|
25
|
+
next-step / blockers). Rewrite in place; do not append.
|
|
26
|
+
- **Session hygiene.** Batch related asks into one well-planned request — every prompt reloads the
|
|
27
|
+
always-on context, so one-shotting beats drip-feeding. Finish a task, then compact or clear:
|
|
28
|
+
continuity lives in the three homes (`standards/knowledge-management.md`), not in chat history.
|
|
29
|
+
For work-in-progress, capture state via `journal/session/current.md` or the `handoff` skill before clearing.
|
|
30
|
+
- **TDD per stack policy.** Follow the active profile's testing policy
|
|
31
|
+
(`tdd-mandatory` | `test-ready-deferred` | `none`) — see `stack/`.
|