RunBook helps AI coding agents work with structured project memory, context routing, session recovery, and verification discipline.
It gives a repository:
AGENTS.mdas the agent operating entry pointCONTEXT.mdas a routing map so agents read the right files for the taskPROJECT.mdas durable project memory for commands, architecture, paths, environment, tests, and gotchasSESSION.mdplus.runbook/sessions/for resumable work- frontend and backend guardrails
- native adapters for opencode, Claude, Cursor, Copilot, Gemini, Windsurf, Cline, and Aider
The focus is the core workflow: project memory, context routing, recovery, adapters, and honest verification.
Install the CLI globally first:
npm i -g @matsumiko/runbook
runbook --versionThen initialize RunBook in a project:
cd my-project
runbook initPick a profile:
runbook init --profile minimal
runbook init --profile frontend
runbook init --profile backend
runbook init --profile fullAdd adapter files:
runbook init --agent claude
runbook init --agent opencode
runbook init --agent cursor,copilot
runbook init --agent allPreview before writing:
runbook init --dry-run
runbook upgrade --dry-runUpgrade an existing RunBook install safely:
runbook upgrade
runbook doctor
runbook doctor --strict
runbook doctor --strict-live
runbook doctor --json
runbook finishOne-shot usage is still supported when you do not want a global install:
npx @matsumiko/runbook init| Use case | Command | Run command |
|---|---|---|
| Recommended CLI | npm i -g @matsumiko/runbook |
runbook ... |
| One-shot usage | no install needed | npx @matsumiko/runbook ... |
| Project-local dependency | npm i -D @matsumiko/runbook |
npx runbook ... or an npm script |
Default runbook init uses --profile full.
| Profile | Installs | Best for |
|---|---|---|
minimal |
AGENTS.md, CONTEXT.md, PROJECT.md |
Small repos that only need operating rules and project memory. |
frontend |
Minimal + FRONTEND.md |
UI, visual consistency, interaction, and design-system work. |
backend |
Minimal + SECURITY.md |
API, auth, data, billing, uploads, webhooks, or migrations. |
full |
All RunBook files | Teams that want decisions, bug history, module maps, planning, sessions, backlog, changelog, guardrails, and adapters. |
- Run
runbook initin the project root. - Fill
PROJECT.mdwith real commands, architecture, important paths, environment notes, tests, and gotchas. - Have the agent read
AGENTS.md. - Have the agent read
CONTEXT.mdand choose task-specific files. - Before repository-changing work, create a runtime session with
runbook session new. - During work, update the session with
step,touch, andverify. - Before closing, review durable memory and update the files that gained reusable facts.
- Close the session, then run the final RunBook proof gates.
- Record meaningful finished work in
CHANGELOG.md.
RunBook separates active task progress from long-term project memory.
| File | Purpose |
|---|---|
PROJECT.md |
Commands, architecture, important paths, environment notes, tests, gotchas, and do-not-touch areas. |
MODULE-MAP.md |
Module responsibilities, first files to inspect, related rules, common tasks, and module-specific pitfalls. |
DECISIONS.md |
Accepted product, business, architecture, security, data, or UX decisions future agents must not undo accidentally. |
BUG-HISTORY.md |
Fixed bugs, causes, fixes, changed files, and regression checks. |
FRONTEND.md |
Actual frontend design and interaction decisions. |
SECURITY.md |
Security-sensitive rules, auth/authorization constraints, secrets, abuse protection, and sensitive data behavior. |
Before closing repository-changing work, agents must review durable memory:
- update the relevant memory file when the task created or verified reusable facts
- preserve the file's structure and add concrete entries under the right section
- checkpoint every memory update with
runbook session touch <file> - state in the final report when a relevant memory file was reviewed but did not need changes
Active progress still belongs in .runbook/sessions/*.json, not in durable memory files.
RunBook uses CONTEXT.md so agents do not need to load every file by default.
runbook context list
runbook context frontend
runbook context backend
runbook context architecture
runbook context bugfix
runbook context module-work
runbook context security-audit
runbook context resume
runbook context planning
runbook context inspectRead more: docs/context-routing.md
For non-trivial work, RunBook can create project-local runtime sessions:
runbook session pending
runbook session new
runbook session resume
runbook session note "Found failing auth test"
runbook session step "Fix token refresh handling"
runbook session touch src/auth.ts
runbook session verify "npm test passed"
runbook session latest
runbook session show
runbook session close --status completed
runbook session validateAgents should check session pending before repository-changing task work. If a recoverable session exists, they should wait for the user to type exactly I will fight before resuming.
When the CLI is available, agents must use session CLI commands instead of hand-writing session JSON. Hand-written sessions are only a fallback if both runbook and npx @matsumiko/runbook fail after a real attempt.
Completed/cancelled runtime sessions are kept to the newest 5 by default; recoverable sessions are not auto-deleted.
Before an agent claims repository-changing work is complete, these commands should pass after the runtime session is closed:
runbook session pending
runbook session validate
runbook doctor --strict-live
runbook finishdoctor --strict-live checks RunBook health plus runtime session validity and confirms no recoverable session remains. finish is the final completion gate over doctor, session validation, pending sessions, and placeholder memory files.
Read more: docs/session-recovery.md
runbook init --agent codex- Fill
PROJECT.mdwith project commands and gotchas. - Agent reads
AGENTS.md, thenCONTEXT.md. - For a frontend bug, agent uses
runbook context frontendand readsFRONTEND.md. - For a backend or auth bug, agent uses
runbook context backendand readsSECURITY.md. - For a regression, agent uses
runbook context bugfixand readsBUG-HISTORY.md. - For module-specific work, agent uses
runbook context module-workand readsMODULE-MAP.md. - Agent updates
BUG-HISTORY.mdafter the bug is fixed and verified. - Agent updates
MODULE-MAP.mdif module ownership, entrypoints, or first files changed. - Agent verifies the fix, closes the session, and runs the finish gates.
- CLI reference
- Context routing
- Session recovery
- Agent adapters
- Examples
- Upgrading existing installs
- CI usage
- Release checklist
- Migrating from skill-based RunBook
.
|-- bin/
| `-- runbook.js
|-- docs/
|-- templates/
|-- variants/
|-- AGENTS.md
|-- CONTEXT.md
|-- PROJECT.md
|-- MODULE-MAP.md
|-- DECISIONS.md
|-- BUG-HISTORY.md
|-- SESSION.md
|-- FRONTEND.md
|-- SECURITY.md
|-- POLICIES.md
`-- package.json
Issues and pull requests are welcome.
Changes to the instruction system should be concrete, defensible, and helpful for safer, more consistent, or easier-to-audit agent work.
MIT. See LICENSE.
