type: rule
status: active
timestamp: 2026-07-02
tags: [agent, session, hygiene, context, tokens]

Session hygiene — break sessions between distinct features

Reset chat/session when moving between distinct features. Stale context leaks confuse the agent and waste tokens. Stay in same chat only when tied to what you just built.

Session hygiene — break sessions between features

The rule

Start a fresh chat/session when moving to a distinct feature. Stay in the same chat only when the next task is directly tied to what you just built.

When to break

When to stay

Why

Two costs when you don’t break:

  1. Stale context leaks confuse the agent. Auth-implementation chatter from feature 3 bleeds into feature 7 design decisions. The agent references decisions no longer relevant.

  2. Token cost compounds. Each turn re-reads the full history. Long chats = every prompt costs 2-5× a fresh session. Also breaks Anthropic’s 5-min prompt cache TTL faster.

Mechanic

Complement: session-handoff prompt

When breaking mid-project (not mid-feature), use the handoff prompt from session-handoff-prompt:

“Summarize architecture + decisions + current state + what’s left to do so I can paste into a new session.”

Then paste into the fresh session as opening context. CLAUDE.md/AGENTS.md handles permanent facts; handoff prompt handles session state.

Anti-patterns

Cross-refs


Edit on GitHub · Back to index