Coding
Context and usage limit
- One session per task: Use
/clearor start a new session to reset the context window and remove irrelevant context - Use subagents: Subagents have isolated throwaway context and won't accumulate in the main conversation. For example, use subagents to do a security review of an implementation or do large refactors. Every tool call re-sends the whole conversations, and a task can have 100s of tool calls. Unnecessary context will add up quickly.
- Model switching: Avoid model switching mid-session because the full transcript will be sent again as context. (Unfortunately, if I hit the 5-hour usage limit, continuing the conversation after the limit resets will also send the full transcript because the GitHub MCP was disconnected and reconnected, which busts the cache.)
- Split big files into smaller ones: There might be information unnecessary to the current task, and reading all that in the big file will waste context space.
- Claude.md: I had Claude Code update Claude.md, a decision log, and a change log. It was helpful initially but the files got bigger and bigger, took up a lot of tokens, and ran down the 5-hour session usage limit quickly. I’m experimenting with summarizing the Claude.md file and removing unnecessary details in the Claude.md file that are already in the other two files. My project is a monorepo with folders like app, backend, and docs so that Claude can work across them in each session. I have also split it into a main Claude.md file and individual ones for each folder. I’ll have to see or sense if this affects the performance.