103 Exercises: The Session
Setup
- Claude Code installed and working, with the guidance file you wrote in 102.
- A project with some git history, and a multi-step task you can give the agent.
- A shell. The examples use zsh.
Exercise 1: Write the Handoff Before the Compaction (20 minutes)
Objective: Keep what a session learns across a compaction.
Instructions:
- Start a session on your project and give the agent a multi-step task, eg "add a module with these four functions, then write a test for each".
- Early in the session, correct the agent on something specific and explicit: a naming convention, an approach, a library choice.
- Before the context compacts, or before you trigger a compaction yourself with
/compact, write a handoff file: the next action as an instruction, what must not be done next (your correction goes here), any choice you made between options, and for each uncommitted file whether it is intentional, session-only, ignored or untracked. Commit it on its own. - Record the session id in the handoff:
echo $CLAUDE_CODE_SESSION_ID. - After the compaction, have the agent read the handoff before it continues, then check whether the correction is still reflected in its output. Compare the session id with the one you recorded, and say what that comparison can and cannot tell you.