Session start:
- Read
.context.mdfiles for modules you'll work on - Check
working/plans/for active plans - Check
working/logs/for recent session context git log --oneline -10— what changed recently?- State what you understand the current task/goal to be
Session end:
- Save session log to
working/logs/YYYY-MM-DD_description.md - Update
.context.mdfor any modules you modified - Update this file if you learned something new
- Note any unresolved questions in the session log
These 8 rules override all other guidance. Follow them every time.
BEFORE writing implementation code, write a failing test. Run it. Confirm it FAILS. Then implement the minimum code to make it pass. Then refactor. If you cannot write a test first, STOP and explain why to the user.
For non-trivial tasks (3+ files, architectural decisions, new features):
- Enter plan mode with
EnterPlanMode - Save plan to
working/plans/YYYY-MM-DD_description.md - Get user approval before implementing Skip for: typo fixes, single-line changes, running commands.
Before presenting ANY code change to the user, run:
make check # or: make build && make test && make lintIf any fail, fix them. Never present unverified code.
Delegate reviews and parallel research to Task tool subagents. Do NOT try to do everything sequentially in the main context. See "Subagent Patterns" below.
Create or update a session log in working/logs/ for every
significant work session. This preserves context across auto-compression.
After ANY user correction, add a [LEARN:tag] entry to the "Learned Patterns"
section below. This prevents the same mistake from recurring.
Rely on auto-compression to manage long conversations. /clear destroys all context; auto-compression preserves what matters.
For non-trivial plans, run /review-plan to spawn architecture, test, and
security reviewers on the plan file BEFORE implementation. Fix critical
plan issues before writing code.
Always read .context.md FIRST. Every module maintains a .context.md file
that describes what's implemented, key files, interfaces, and dependencies.
Read it instead of running Glob/Grep exploration. If it's missing, run
/explore-module [path] to create it.
Use the Task tool to delegate specialized work. Agent definitions live in
.claude/agents/*.md — read the file and include its content in the task prompt.
Task(subagent_type="senior-code-reviewer",
prompt="<content of .claude/agents/code-reviewer.md>\n\nReview these files: {list}")
Task(subagent_type="security-code-auditor",
prompt="<content of .claude/agents/security-reviewer.md>\n\nAudit these files: {list}")
Spawn multiple Task calls in the SAME response for parallel execution:
Task 1: security-code-auditor with security-reviewer.md
Task 2: senior-code-reviewer with code-reviewer.md
Task 3: senior-code-reviewer with test-reviewer.md
Task(subagent_type="Explore", prompt="Find all files related to {topic}")
Run in order. Stop on first failure.
make build— zero errorsmake test— all tests passmake lint— zero warnings
[LEARN:workflow] Use Task tool with subagent_type for spawning subagents; SendMessage and TaskList are available in team contexts [LEARN:workflow] MEMORY.md is the #1 enforcement tool — it loads in system prompt every session [LEARN:workflow] Skills are prompt expansions — they must be explicit about what tools to use [LEARN:workflow] Rules in .claude/rules/ are auto-loaded context — don't duplicate in CLAUDE.md [LEARN:workflow] .context.md files are the default source of module context — read them first [LEARN:workflow] All non-trivial work happens in worktrees via EnterWorktree() [LEARN:workflow] Linter configs are the canonical coding standards, not prose docs [LEARN:workflow] Plans should be reviewed via /review-plan before implementation
- Phase: [CURRENT PHASE]
- Key Metrics: [e.g., test count, coverage %, etc.]
- Active Plan: [path to current plan file, or "none"]
- Key Gaps: [known issues or incomplete areas]