End-of-Session Review: Decision Log & Rules File Updates
Run before /clear or closing a session: the agent logs decisions to docs/decisions.md, notes where it stalled, and proposes small rules-file fixes so the next session doesn't repeat mistakes.
Added
We're ending this session. Before I clear context, do the following. Do not change code. ## 1. Decision log Append to docs/decisions.md (create it if missing) one entry per real decision made this session: ### [YYYY-MM-DD] [Short title] - Decision: [what we chose] - Why: [the reason, in 1-2 lines] - Rejected: [options we considered and dropped, and why] - Revisit if: [what would change this decision] Skip trivial choices. If nothing was decided, write nothing. ## 2. Where the session stalled List up to 5 moments where you wasted turns: wrong assumptions, commands that failed, files you couldn't find, instructions you misread, or times I had to correct you. For each, give the cause in one line. ## 3. Proposed rules-file changes For each stall that a rule would have prevented, propose ONE short line for AGENTS.md (or CLAUDE.md). Also flag any existing rule that was wrong or got in the way. Show these as a diff. Do not apply them; I'll approve each one. Keep the rules file lean: prefer fixing or deleting a line over adding one, and never propose more than 3 additions. ## 4. Pick-up note Write 5 lines max: what's done, what's in progress, the exact next step, and the command to verify current state. If work is unfinished, put this in HANDOFF.md. Make sure AGENTS.md has this line so future sessions find the log: "Read docs/decisions.md before changing architecture or reversing an earlier choice."
How to use it
- Click Copy template.
- Paste into ChatGPT, Claude, Grok, Cursor, or your agent framework.
- Replace the [BRACKETED] parts with your details.
Pairs well with: Lean CLAUDE.md: Trim a Bloated Rules File to 40 Lines · Remove-and-Add-Back Test for CLAUDE.md & AGENTS.md Rules
FAQ
How do I keep context when I /clear in Claude Code?
Before clearing, have the agent write decisions to a file in the repo, such as docs/decisions.md, and a short pick-up note. Point AGENTS.md or CLAUDE.md at the log so every new session reads the why behind past choices instead of re-debating them.
Should an AI agent update its own CLAUDE.md or AGENTS.md?
Let it propose changes, not apply them. Agent-written rules tend to pile up and go stale. Reviewing each suggested line as a diff, and capping additions per session, keeps the file short and accurate.
What's the difference between decisions.md and HANDOFF.md?
decisions.md is a permanent log of why the project is built the way it is. HANDOFF.md is temporary and covers one task in progress. Use both: the log for lasting choices, the handoff for unfinished work.
Does this work with Codex, Cursor, and Gemini CLI?
Yes. It's plain Markdown in the repo, so any agent that reads AGENTS.md or your rules files can follow the pointer to docs/decisions.md.
Get 3 new templates every week
Free. Unsubscribe anytime.Related templates
HANDOFF.md: Move Tasks Between Claude Code, Codex & Cursor
AI Agent Run Postmortem Prompt (Find the Real Fix)
AI Agent Guardrails Checklist: Prompt Rules vs. Tool Permissions
Browse all AI Agents templates