“Using Claude Code: Session Management & 1M Context” — Thariq (Apr 15 2026)
Why this is in the vault
First-party Anthropic guidance from a Claude Code engineer on how to operate Claude Code well in the 1M-context era. Directly applicable to RDCO since we’re running Ray on Claude Code with multiple persistent loops + scheduled crons + sub-agents. Several techniques here that should change our playbook — particularly /rewind (which we underuse) and the /clear vs /compact distinction (which validates our manual working-context.md handoff pattern).
The core argument
Context window has a soft cost called “context rot” — model performance degrades as context grows because attention spreads across more tokens, and older irrelevant content distracts from the current task. So even with 1M tokens of room, more context isn’t free.
Every Claude turn ends at a branching point. Five options:
- Continue — send another message in the same session
- /rewind (or
esc esc) — jump back to a previous message; everything after is dropped - /clear — start a new session, ideally with a brief you’ve distilled
- /compact — let Claude summarize the session and continue on top of the summary
- Subagents — delegate the next chunk to an agent with its own clean context; only the result returns
Most people just continue. The other four exist for context management.
Rewind > correction. Thariq calls this “the one habit that signals good context management.” When Claude tries an approach and it doesn’t work, the instinct is to reply “that didn’t work, try X.” But the better move is esc esc to jump back to before the failed approach and re-prompt with the lesson — “Don’t use approach A, the foo module doesn’t expose that — go straight to B.” Cleaner context, sharper next attempt. Bonus tip: “summarize from here” creates a handoff message — like a note to past-Claude from future-Claude saying “here’s what I tried and learned.”
/compact vs /clear — they feel similar but behave very differently:
- /compact is lossy summarization done by the model. You don’t write anything; Claude decides what mattered. You can steer it:
/compact focus on the auth refactor, drop the test debugging. - /clear is manual: you write the brief (“we’re refactoring X, the constraint is Y, files A and B matter, ruled out approach Z”) and start fresh. More work, but the resulting context is exactly what you said was relevant.
Bad compacts happen when the model can’t predict where the work is going. Example: long debugging session auto-compacts → you say “now fix that other warning we saw in bar.ts” → but bar.ts got dropped from the summary because the session focused on debugging. Made worse by context rot: the model is at its least intelligent moment when compacting. With 1M context, you have more time to /compact proactively with explicit direction.
Subagents are context management, not just parallelism. Test: will I need the tool output again, or just the conclusion? If just the conclusion → spawn a subagent so the intermediate output never enters parent context. Patterns Thariq recommends:
- “Spin up a subagent to verify the result of this work based on the following spec”
- “Spin off a subagent to read through this other codebase and summarize how it implemented X, then implement it yourself the same way”
- “Spin off a subagent to write the docs on this feature based on my git changes”
Mapping against Ray Data Co
Five concrete shifts:
1. We underuse /rewind. When a skill misfires (e.g., a draft-review surfaces nothing, or process-newsletter mis-classifies a sender), my instinct is to reply “no, do X instead.” Per Thariq, the better move is esc esc back to before the misclassification and re-prompt with the lesson. Worth establishing as a default reflex. Could even be added to skill files as a “if first attempt fails, /rewind and re-prompt with [hint]” pattern.
2. Our working-context.md IS the /clear pattern. Validates our existing approach. The bridge-notes hooks (PreCompact write → SessionStart:compact read) are our manual /clear discipline. Worth strengthening: when starting a substantial new task, /clear and re-bootstrap from working-context.md rather than carrying conversational drift forward.
3. Bad compacts are real and we’ve experienced them. Several of our compaction events have lost material work — the moment of compaction is exactly when the model is most lossy. Mitigation: invoke /compact proactively with explicit direction before hitting auto-compact, especially after long sub-agent fan-outs (process-newsletter batch, commoncog backfill, MAC drafts).
4. Subagent guidance matches what process-newsletter and check-board already do. The “max 3 concurrent sub-agents” pattern in process-newsletter (one per article message ID) is exactly the “spin off subagent so intermediate output never enters parent context” pattern Thariq describes. Validation. Worth porting to other skills that read large source material — particularly /process-youtube, /cross-check, /audit-model.
5. The “1M context = longer tasks” framing changes what we attempt. Thariq specifically calls out “build a full-stack app from scratch” as a now-tractable single-session task. RDCO equivalents: end-to-end newsletter issue (research → draft → review → polish → distribution remix in one session); end-to-end audit-model run from interview → matrix → tests → docs; full landing-page build in one shot via the build-landing-page skill. Worth stress-testing.
Tracked-author candidate
Thariq (@trq212) — Claude Code team at Anthropic, ex YC W20 / MIT Media Lab. Bio: “towards machines of loving grace.” First-party voice on the harness we run on. Add to Twitter/CRM workflow tracking.
Related
- 2026-04-11-garry-tan-thin-harness-fat-skills — harness-thesis foundation; this post is the harness-vendor’s own playbook
- 2026-04-15-alphasignal-anthropic-routines-claude-code — Routines/Managed Agents (the same Anthropic platform context)
- 2026-04-15-every-claude-managed-agents-mini-vibe-check — operator’s POV on the same launch
- ../04-tooling/rdco-state-ownership-architecture — working-context.md as state-as-moat; this article validates that pattern