Context Manager
Sets up and maintains a minimal, tool-agnostic context system so any AI tool can
resume any project without re-reading everything.
Core principle: Global rules + domain scoping + two files per domain.
Two files per domain (non-negotiable):
{domain}.md — operational. Resume state, current status, next task, open bugs. Changes every session.
{domain}-ref.md — reference. What exists, where it lives, how it works, why it's built this way. Changes only when architecture or decisions change.
Three-layer architecture:
Layer 3 — Knowledge cross-project, distilled, long-lived (~/.claude/knowledge/)
Layer 2 — Project cross-session, time-aware (docs/sessions/, docs/backlog/)
Layer 1 — Session per-session context (docs/context/)
Layer 1 + 2 → {project-root}/docs/
Layer 3 → ~/.claude/knowledge/ (change to any persistent path — use it consistently)
Step 1 — Detect mode
| Mode |
When |
| SETUP |
No docs/context/ exists. First time on this project. |
| RESUME |
Session starting. User wants to pick up where they left off. |
| UPDATE |
Session ending, context running low, or saving progress. |
When ambiguous, ask: "Set up fresh, resume work, or save and wrap up?"
Step 2 — Load mode file
After detecting mode, use Glob to find the mode file, then Read it and follow its instructions:
| Mode |
File to load |
| SETUP |
**/context-manager/SETUP.md |
| RESUME |
**/context-manager/RESUME.md |
| UPDATE |
**/context-manager/UPDATE.md |
Do not load all three. Load only the one that matches the detected mode.
Context slicing rules (non-negotiable)
- Never load full history
- Load both domain files every session:
{domain}.md + {domain}-ref.md (knowledge store = +1 on Cold resume only)
- Prefer structured data over prose
- Drop redundancy — if it's in the code, don't duplicate in context
- Compress before adding — update existing files, don't append forever
- pointers.md is the only file that routes — never bypass it
- Session timing is mandatory — every entry must have start, end, duration
- Distill before the log grows unreadable — trigger at 20 entries or 30 days
- Knowledge store is read-only during RESUME — only written during UPDATE distillation
- Always load the domain file — gap determines whether to also load sessions/knowledge store, not whether to load the domain file
- {domain}-ref.md is a snapshot, not an accumulation — when a decision is superseded or a file path changes, replace it. Never append without pruning stale entries.
1---2name: context-manager3description: Full project context setup and session management skill. Use this when starting a new project, onboarding onto an existing codebase, resuming work after a session gap, ending a session and wanting to save progress, or when context is running low mid-session. Sets up a docs/context/ system that any AI tool can read (Claude, Codex, Cursor, Windsurf). Three modes: SETUP (first time), RESUME (session start), UPDATE (session end). Trigger on: "set up context", "resume project", "update context", "end session", "context manager", "save progress", "continue from where we left off", or when starting work on any large multi-domain project.4---56# Context Manager78Sets up and maintains a minimal, tool-agnostic context system so any AI tool can9resume any project without re-reading everything.1011**Core principle:** Global rules + domain scoping + two files per domain.1213**Two files per domain (non-negotiable):**14- `{domain}.md` — operational. Resume state, current status, next task, open bugs. Changes every session.15- `{domain}-ref.md` — reference. What exists, where it lives, how it works, why it's built this way. Changes only when architecture or decisions change.1617**Three-layer architecture:**18```19Layer 3 — Knowledge cross-project, distilled, long-lived (~/.claude/knowledge/)20Layer 2 — Project cross-session, time-aware (docs/sessions/, docs/backlog/)21Layer 1 — Session per-session context (docs/context/)22```2324```25Layer 1 + 2 → {project-root}/docs/26Layer 3 → ~/.claude/knowledge/ (change to any persistent path — use it consistently)27```2829---3031## Step 1 — Detect mode3233| Mode | When |34|---|---|35| **SETUP** | No `docs/context/` exists. First time on this project. |36| **RESUME** | Session starting. User wants to pick up where they left off. |37| **UPDATE** | Session ending, context running low, or saving progress. |3839When ambiguous, ask: "Set up fresh, resume work, or save and wrap up?"4041## Step 2 — Load mode file4243After detecting mode, use Glob to find the mode file, then Read it and follow its instructions:4445| Mode | File to load |46|---|---|47| SETUP | `**/context-manager/SETUP.md` |48| RESUME | `**/context-manager/RESUME.md` |49| UPDATE | `**/context-manager/UPDATE.md` |5051Do not load all three. Load only the one that matches the detected mode.5253---5455## Context slicing rules (non-negotiable)56571. Never load full history582. Load both domain files every session: `{domain}.md` + `{domain}-ref.md` (knowledge store = +1 on Cold resume only)593. Prefer structured data over prose604. Drop redundancy — if it's in the code, don't duplicate in context615. Compress before adding — update existing files, don't append forever626. pointers.md is the only file that routes — never bypass it637. Session timing is mandatory — every entry must have start, end, duration648. Distill before the log grows unreadable — trigger at 20 entries or 30 days659. Knowledge store is read-only during RESUME — only written during UPDATE distillation6610. Always load the domain file — gap determines whether to also load sessions/knowledge store, not whether to load the domain file6711. {domain}-ref.md is a snapshot, not an accumulation — when a decision is superseded or a file path changes, replace it. Never append without pruning stale entries.