Back to Blog

The HANDOFF.md Pattern - How to Keep Claude Code Productive Across Sessions

Fazm Team··3 min read
claude-codedeveloper-toolsproductivityarchitecture

The HANDOFF.md Pattern

There is a point in every AI-assisted project where the codebase outgrows the context window. When that happens, prompt quality stops being the bottleneck. Context management becomes everything.

We hit this building Fazm, a macOS desktop agent with separate Swift UI, accessibility API, and LLM pipeline modules. Each Claude Code session would waste 10-15 minutes re-discovering what was already done before it could make progress. We describe the overall experience of building a macOS agent with Claude in a separate post.

The Pattern

After each agent session, it writes a summary of what changed and what is pending into a HANDOFF.md file. The next session reads this file first and picks up where the previous one left off.

A typical handoff looks like:

## Last Session (2026-03-14)
- Added accessibility tree caching for repeated queries
- Fixed race condition in ScreenCaptureKit frame handler
- PENDING: Cache invalidation when focused window changes
- PENDING: Unit tests for the cache layer

This is not documentation in the traditional sense. It is a conversation between your past agent and your future agent. Short, specific, focused on what matters for the next session.

Post-Edit Hooks

The other pattern that made a huge difference: hooks that run swift build after any .swift file change. This catches 80% of issues before they compound.

Without the hook, an agent might make three changes that each introduce a small type error. By the time it runs a build, there are six errors to untangle. With the hook, each error surfaces immediately after the change that caused it. This kind of fast feedback loop was essential when we were building the Swift ScreenCaptureKit pipeline, where type errors in async code could cascade quickly.

Context Window Management

The biggest lesson was that context window management matters more than prompt quality once you are past a certain project size.

A beautifully crafted prompt means nothing if the agent does not have the right files loaded. And loading too many files means the agent loses focus on the task at hand.

The practical approach:

  1. CLAUDE.md describes the project structure and conventions (loaded every session)
  2. HANDOFF.md describes the current state of work (loaded every session)
  3. Relevant source files get loaded on-demand as the agent needs them

This three-layer context strategy keeps each session productive without overwhelming the context window. When you combine this with running multiple agents in parallel, the handoff file becomes even more critical - each agent needs to know what the others have already completed.


Based on our experience building Fazm and discussions in r/ClaudeCode.

Related Posts