Claude Code & Cowork Token Discipline Guide

Internal Engineering Briefing • Based on insights by Nate Herk (AI Automation) & Thariq (Anthropic)

TL;DR Summary

Prompt Caching automatically saves context between turns inside Claude Code, cutting costs and expanding session longevity. However, the cache vanishes completely if you stay inactive for more than 1 hour, shift system prefixes unnecessarily, or change models mid-stream. Combining native slash commands with professional execution discipline stops token-thrashed death spirals before they happen.

Why Our Team Needs to Care

10%
Cost of Cached Tokens
10x
In-Terminal Processing Speed

Essentials Power-User Shortcuts & Commands

Stop guessing your context load. Use these native interactive bindings to manage active terminal sessions:

Command / Binding Action Token / Optimization Impact
/context Visualizes what is currently loaded into your active window. Instantly audits which files are eating your structural memory limits.
/compact Manually compress and summarize conversation history. Compresses previous turns down to a tight baseline summary, shedding raw tool output bytes.
/btw [question] Asks a quick side question outside the conversation timeline. Executes a read-only query without adding payload overhead to the persistent chat cache stack.
/clear or /reset Wipes current conversation context completely. Resets session memory while fully keeping local CLAUDE.md project architecture configurations alive.
/rewind Rolls back conversation and file states to a target checkpoint. Trims out failed, hallucinated, or circular engineering paths to clean up the token history.
Shift + Tab Cycles permissions mode: defaultacceptEditsplan. Plan Mode blocks expensive mutating tools while you map logic out without token waste.
Esc Interrupts Claude mid-response. Immediately halts runaway looping generations or faulty print statements, saving thousands of output tokens.
Esc, Esc Opens the visual rewind/checkpoint selection menu. Allows safe backward time-travel across your file diff changes.

Cultivating Team Token Discipline (Avoiding Token Maxing)

Token maxing or context thrashing happens due to poor conversational discipline. Follow these strict engineering heuristics:

1. Execute the "Plan and Clear" Routine (The Anthropic Standard)
Don't build features linearly inside a single, infinite terminal thread. Instead: drop into Plan Mode via Shift+Tab, iron out a precise checklist, run /clear to drop previous debugging baggage, and run the execution cleanly in a fresh session.

2. Evade the "Agentic Death Spiral" Loop
If Claude attempts a terminal task (e.g., executing a failing regular expression or bad test suite compile) and fails twice in a row, do not let it try a third time blindly. Hit Esc to kill generation, step in, and manually correct its direction. Left unattended, agentic loops will burn a weekly allocation in minutes.

3. Keep State Static with CLAUDE.md and Skills
Never repeat setup rules, lint criteria, or custom project architecture constraints inside your terminal chat strings. Drop them as markdown files inside your project structure (or globally in ~/.claude/skills/). Claude rehydrates these natively without bloating conversational streams.

4. Scope Your Working Directory Tightly
Opening Claude Code at the absolute root of a complex, massive monorepo forces unnecessary filesystem context indexing. Launch the tool natively inside the targeted microservice subdirectory, and dynamically introduce sibling code paths using /add-dir only when explicitly required.

The Technical Mechanics: Prefix Matching

Claude's backend caching relies on strict prefix matching. If you change even one byte at the absolute beginning of your prompt stream, the entire downstream cache fails.

  1. Turn 1 (Cache Create): Your system prompts, core tool metadata, and project memories are compiled and saved. This is a full-price execution layer.
  2. Turn 2+ (Cache Read): If the previous prefix remains untouched, Claude securely references the hot segment. Only your new user modifications are computed.

The Lifetime Reality (TTL): On standard corporate seat subscriptions, your cache persists for 1 hour. However, if you trigger pay-per-token API tiers or utilize dynamic background sub-agents, that safety buffer contracts to a sharp 5-minute window.

Caution Common Habits That Secretly Break Caching