Advisory
CLAUDE.mdRead at session start. Can be ignored if context fills. Soft guidance — Claude will usually follow it, but there is no enforcement mechanism.
Features · Project Brain
The context layer Claude reads at the start of every session. Stops re-derivation. Keeps decisions stable across hundreds of tool calls.
What it is
Claude Code reads CLAUDE.md at the start of every session — and on every significant tool call. That file is the brain: a structured document telling Claude what stack it's in, what conventions to follow, which agents exist, and what decisions have already been made.
The kit installs an opinionated, pre-filled version of this file tuned for Next.js + Supabase, plus a set of rules files and a source-of-truth directory that extend and reinforce it.
What's inside
One paragraph orienting Claude in thirty seconds. Stack, deploy target, auth provider, database setup. Enough for Claude to start with the right assumptions rather than ask.
Structured entries in the source-of-truth directory: "we use App Router not Pages Router," "RLS is required on every user-data table," "migrations are reversible — no DROP without a corresponding CREATE." These are written once and stay stable.
A map of which agents exist and what each one's scope is. Code-reviewer owns diffs. Planner owns plan state. Security-reviewer owns authentication surfaces. Claude knows who to delegate to.
File paths, naming patterns, where logs go, how secrets are handled, when to ask before writing. The conventions Claude would otherwise forget between sessions.
CLAUDE.md template
The kit holds CLAUDE.md to under 100 lines because real benchmarks show degradation past that point — the file begins to compete with the task context rather than supplement it.
Three-tier instruction hierarchy
Claude is a probabilistic actor. The kit places each guardrail at the strictness level that fits — advisory context for soft guidance, scoped rules for automatic enforcement, shell hooks for hard blocks Claude cannot override.
CLAUDE.mdRead at session start. Can be ignored if context fills. Soft guidance — Claude will usually follow it, but there is no enforcement mechanism.
.claude/rules/Auto-fire on file-pattern match. When Claude touches a file that matches the glob, the rule is injected automatically. Claude cannot skip rules the way it can ignore a long CLAUDE.md.
.claude/settings.jsonShell commands executed by Claude Code directly. Exit 2 blocks the action and surfaces stderr to Claude. No model in the loop — this is a hard block.
Context-window toolbox
A long-running session accumulates context. These commands — plus two hook events the kit wires — let you manage it deliberately rather than hitting the wall.
/clearWipe the conversation, open a fresh window. Use when the session has drifted or accumulated noise.
/compactSummarise earlier turns and drop them. Keeps the active context; reduces token pressure.
/contextShow current context usage. How many tokens are loaded, how much headroom remains.
/rewindBack up N messages. Undo a chain of tool calls without starting over entirely.
PreCompact hookFires before context compresses. The kit uses this to save state — open issues, current task status — so the post-compact session knows where it was.
PostCompact hookFires after compression. Reloads the saved state. The session continues as if the compress did not happen.
Component architecture rules
Infra-as-code or it does not ship. docker/caddy/, docker/systemd/, and docker/firewall/ all live in repo and are applied by deploy.sh. No manual server state.
No shared test fixtures bleeding across components. A test that relies on fixture state set up by a different test is not a test — it is a coupling.
Do not expose the same data through three routes. If a piece of data has three callers, two of them are future confusion.
Each component type is defined before any code is written: what it is, why it exists, what it may do, what it must not do, its influence chain. The kit sequences ontology in Layer 11, before epic planning in Layer 08, so types stay coherent when scope expands.
Why it matters
Claude has no persistent memory between sessions. Each new conversation starts blank. Without a project brain, it re-derives your stack from the file tree — which works, but costs tokens and drifts. Every session is a fresh guess.
With a project brain, Claude opens with the right assumptions already loaded. It knows App Router is the target, not Pages Router. It knows RLS is required. It knows which agent handles review. No re-derivation. No drift.
Files installed
CLAUDE.md __documentation/recovery-playbook.md .claude/rules/context-discipline.md
Everything is reconciled against your existing .claude/ — never clobbered. The manifest preview shows every conflict before anything is written.
Before / after
Without project brain
Claude proposes Pages Router routing on a new page. You correct it. Same correction next session.
With project brain
Claude opens with App Router patterns automatically. Decision made once, held indefinitely.