← knowledge.oriz.in

Session hygiene — break sessions between distinct features

rule agentsessionhygienecontexttokens

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