Module 2

Working with the Agent

Match ceremony to complexity, iterate with concrete targets, and manage context as the limited resource it is.

Match ceremony to complexity

Per study guide
Plain language

For a tiny, obvious change — add one if-check — just make the change directly; planning first would waste more time than it saves. For a large, tangled, breaking change spread across dozens of files, use plan mode so the agent maps out the work and you can review the approach before anything gets touched. For a genuine fork in the road with real trade-offs (three different architectures, each with pros and cons), use plan mode to lay out the options and let a person pick — that kind of decision should be made by people, not silently by the model.

Technical

Trivial, local, unambiguous change → direct execution. Large, interdependent, or breaking change → plan mode to map affected paths and produce a reviewable strategy before implementation. Architectural fork with real trade-offs and organizational impact → plan mode to present options for explicit human approval, rather than letting the agent silently choose a direction.

Why it matters

Ceremony has a cost (time, tokens, review overhead) and skipping it has a cost (risk, rework, hidden decisions) — the skill is recognizing which cost dominates for a given task.

Iterate with concrete, verifiable targets

Per study guide
Plain language

Saying 'think harder about edge cases' gives Claude nothing solid to aim at. Giving a specific example — 'here's an input, here's the output I expect' — defines success in a way that can't be argued with, and doubles as a check you can rerun later. When requirements are precise and testable (an algorithm with defined edge cases), write the tests first and let failing tests drive each round of changes. When several problems are tangled together, fix them one at a time and check after each fix, so you always know what caused what.

Technical

Vague feedback produces vague results; a concrete input/expected-output example defines success unambiguously and becomes a regression check. For precise, verifiable requirements, write the test suite first and let failing tests drive iteration. When issues interact, fix them sequentially with verification after each step, rather than changing everything at once and losing the ability to attribute cause and effect.

Why it matters

Ambiguous feedback and simultaneous multi-issue changes both destroy your ability to tell whether a given change helped, hurt, or did nothing — concrete targets and sequential fixes preserve that signal.

When you don't know the requirements, get interviewed

Per study guide
Plain language

If you're new to a topic, the scariest gaps are the ones you don't even know to ask about. Instead of guessing, ask Claude to interview you about the thing you're building — it will surface considerations (like 'what happens when the cache and the database disagree?') that you'd otherwise only discover after something breaks in production.

Technical

For unfamiliar problem domains, request that the agent interview the user before implementation, surfacing considerations such as invalidation strategy, failure modes, and consistency guarantees — converting unknown-unknowns into an explicit, reviewable list of decisions before any code is written.

Why it matters

You can only write down requirements for gaps you already recognize; interviewing exists specifically to expose the gaps a newcomer can't yet name.

Context is a limited, degrading resource

Per study guide
Plain language

The model's working memory fills up over a long session. A warning sign: it starts talking about 'typical patterns' in general instead of the specific files and classes it actually found earlier — a sign the useful details are getting crowded out. The fix is to write a summary of what's been learned, then continue in a fresh session (or a subagent) seeded with that summary, rather than trying to power through in an already-crowded context.

Technical

As context fills, response quality degrades — a tell is the agent falling back to generic patterns instead of citing the specific classes/files it previously discovered. Mitigations: summarize hard-won findings and continue in a fresh (sub)agent seeded with the summary; delegate narrow deep-dives to subagents so the main agent stays high-level; and explore large subsystems structure-first (imports, base classes) rather than reading exhaustively.

Why it matters

A degraded context doesn't just get slower, it gets less accurate — recognizing the 'generic pattern' tell early prevents acting on confidently-wrong output.

Sessions: continue, resume, fork

Needs verification
Plain language

--continue picks up wherever you last left off, on whatever was the most recent conversation. --resume <name> lets you jump back into one specific named conversation, even if you've had others since. Forking a session branches it into two independent copies that both remember everything up to that point but then develop separately — perfect for trying two different approaches side-by-side without them interfering with each other.

Technical

--continue resumes the most recent session. --resume <name/id> targets a specific session by name/identifier. A session-fork operation branches an existing session's accumulated context into two independent continuations, letting each develop separately for comparison. When resuming into an environment where files changed underneath you, keep the existing context and explicitly name the specific files that changed for a targeted re-read, rather than discarding everything or re-reading blind.

Why it matters

Each option trades off differently between continuity and precision — picking the wrong one either loses valuable accumulated context or drags in the wrong (stale, or simply irrelevant) conversation.

Verification note — --continue and --resume <name> are confirmed CLI session flags. 'fork_session' as an exact name is unconfirmed for the Claude Code CLI — official docs describe branching a session into an independent continuation (surfaced as a session-branch feature), and the Claude Agent SDK exposes a session-forking option under its own API. Treat 'fork_session' here as descriptive of the capability, not a guaranteed exact flag/function name — check current docs before relying on the literal syntax.

Worked examples for this module

See all 58 →
#4

Interview-Style Planning for Unknowns

Situation

You want Redis caching with a 5-minute TTL on a product endpoint, but you're new to production caching and unsure what else a robust implementation needs.

Recommended approach

Ask Claude to interview you first, surfacing invalidation strategy, caching layers, consistency guarantees, and failure modes before anything is built.

Why it works

You don't know what you don't know. Interviewing surfaces considerations you'd otherwise miss — cache invalidation, layering, consistency, failure modes — converting unknown-unknowns into explicit decisions before code is written.

Weaker approaches people try — and why they fall short

  • Use plan mode to analyze the endpoint, then give requirements after Claude explains the code.Analyzing existing code doesn't teach you the caching considerations you're actually missing.
  • Write a spec with TBD markers and let Claude propose solutions per TBD.You can only write TBDs for gaps you already recognize — the dangerous gaps are the ones you can't name.
  • Make a minimal request now, add features via follow-ups as problems surface.Discovering requirements through production failures is the slowest, riskiest path for something you don't understand yet.
Takeaway — When you're new to a topic, have Claude interview you to expose hidden requirements before building.

Plain-language notes on the technical terms above

Plan mode
A mode where Claude maps out a strategy and shows it to you before making any actual changes.
#5

Direct Execution for Trivial Changes

Situation

Add a date-validation check (event dates must be in the future) — a single conditional in one function in one file.

Recommended approach

Just make the change directly.

Why it works

The change is tiny, local, and unambiguous. Direct execution is the right amount of ceremony; planning modes and extended reasoning are for complex, multi-file, or uncertain work, and using them here just adds overhead.

Weaker approaches people try — and why they fall short

  • Enter plan mode first for a detailed strategy.Overkill for a single-line conditional.
  • Enable extended thinking to reason thoroughly.Wastes effort on genuinely trivial logic.
  • Use plan mode to analyze impact on the wider reservation flow.There's no meaningful cross-flow impact to analyze for a self-contained check.
Takeaway — Match ceremony to complexity. Trivial, local, clear changes → just do them directly.

Plain-language notes on the technical terms above

Plan mode
A mode where Claude maps out a strategy and shows it to you before making any actual changes.
#6

Concrete Test Cases Beat Vague Feedback

Situation

A migration script mishandles null values in optional fields, and needs a fix.

Recommended approach

Provide a concrete test case — an example null input plus the expected output — and ask Claude to fix it against that target.

Why it works

A concrete input/expected-output example defines success unambiguously and lets Claude make a targeted fix. It also becomes a regression check you can rerun to confirm the fix holds.

Weaker approaches people try — and why they fall short

  • Add 'think harder about edge cases' and request a full rewrite.Vague feedback plus a rewrite discards working code and doesn't specify the correct null behavior.
  • Fix the null handling yourself, then continue.Doesn't teach the model the pattern and loses the benefit of iterating together.
  • Describe the null problem and ask for a full regeneration.Risky and wasteful when a small, well-specified fix would do.
Takeaway — Show, don't tell: a failing test case with expected output pinpoints the fix and guards against regressions.
#8

Plan Mode for Large, Interdependent Migrations

Situation

Upgrading an auth library across a major version with breaking changes (callbacks becoming promises, a restructured type, removed methods), used across 45 files in multiple modules.

Recommended approach

Use plan mode: explore usage, map affected paths, and create a migration strategy before touching any code.

Why it works

This is a large, high-risk, interdependent change. Plan mode lets Claude map where and how the library is used and produce a reviewable strategy before implementation, so mistakes get caught on paper rather than in production.

Weaker approaches people try — and why they fall short

  • Build a custom slash command and run it on each file without exploring first.A blind command can't handle usage patterns it never inspected.
  • Paste the breaking changes and direct-execute across all 45 files.Direct-executing 45 interdependent files at once is error-prone with no plan to review.
  • Bump the version, run tests, and fix each failure as it appears.Test-driven fixing only catches what tests cover; silent breakages in untested paths slip through.
Takeaway — Large, interdependent, breaking-change work → plan and map first, implement second.

Plain-language notes on the technical terms above

Plan mode
A mode where Claude maps out a strategy and shows it to you before making any actual changes.
#13

Sequential Iteration for Interacting Issues

Situation

A PDF report has three interacting problems: narrow columns truncate content, dates aren't formatted, and page breaks land wrong — and changing one affects the others.

Recommended approach

Fix column width first (with specific measurements), verify, then fix dates within the corrected columns, then adjust page breaks — testing after each step.

Why it works

Because the issues interact, changing everything at once makes it impossible to tell what fixed or broke what. Fixing one at a time and verifying after each isolates cause and effect, so each change lands on a known-good base. Column width first makes sense because both dates and page breaks depend on it.

Weaker approaches people try — and why they fall short

  • Show a correct example and ask Claude to match it, without listing the issues.Matching an example doesn't supply the precise measurements the layout needs and hides which sub-issue is being solved.
  • Start fresh with all requirements listed upfront.Discards working query logic and still bundles the interacting fixes together.
  • Give all three issues at once with exact specs and fix them together.Fixing all three simultaneously tangles the interactions so results can't be attributed to any one change.
Takeaway — When fixes interact, iterate sequentially and verify after each step so you can isolate cause and effect.
#15

Plan Mode for Architectural Choices Needing Approval

Situation

Adding real-time updates to a product — the choice is between WebSockets, server-sent events, or polling, each with different complexity, browser support, and infrastructure needs.

Recommended approach

Use plan mode to explore the architecture, weigh the trade-offs, and present the options for the team to approve.

Why it works

This is an architectural decision with real trade-offs and organizational impact. Plan mode lets Claude lay out the options so the team can approve a direction before code is committed — big directional choices should be decided by people, informed by analysis.

Weaker approaches people try — and why they fall short

  • Direct-execute polling first, planning to upgrade later.Committing to polling prematurely may require a costly rewrite down the line.
  • Direct-execute WebSockets and refactor if infrastructure issues arise.Committing to WebSockets before assessing infrastructure risks the same kind of rework.
  • Direct-execute and let Claude silently pick the 'best' approach.Letting the model choose silently hides a decision that stakeholders should actually own.
Takeaway — Architectural forks with trade-offs and team impact → plan mode, present options, get human approval.

Plain-language notes on the technical terms above

Plan mode
A mode where Claude maps out a strategy and shows it to you before making any actual changes.
#16

Test-Driven Iteration for Precise Behavior

Situation

Implementing a graph-traversal algorithm with performance requirements and edge cases: disconnected nodes, cycles, and weighted edges.

Recommended approach

Write a test suite first — covering behavior, edge cases, and performance — have Claude work to pass it, and iterate on whatever fails.

Why it works

The requirements here are precise and verifiable, which is exactly where writing tests first shines. It turns 'correct behavior' into an objective target; each edge case becomes a concrete pass/fail, and feedback is automatic and unambiguous.

Weaker approaches people try — and why they fall short

  • Give a reference implementation, ask Claude to restyle it and add edge cases, then compare outputs.A reference implementation may not match your actual constraints, and comparing outputs is looser than a real test suite.
  • Do extended-thinking research and produce one complete implementation from the plan.A one-shot implementation gives no iterative verification loop for the edge cases.
  • Give a natural-language spec, review outputs manually, and describe changes each time.Manual review with prose feedback is slower and more subjective than tests, and doesn't verify performance.
Takeaway — Precise, verifiable requirements → write tests first and let failing tests drive each iteration.
#17

Context Degradation → Summarize + Subagent

Situation

After 25 minutes exploring a rendering subsystem, the agent starts citing 'typical rendering patterns' instead of the specific classes it actually found earlier. It's now asked to study how physics and rendering integrate.

Recommended approach

Summarize the key rendering findings, then spawn a subagent for the physics work, seeded with that summary as its starting context.

Why it works

Generalizing to 'typical patterns' instead of specific classes is the tell that context is degrading — useful detail is being crowded out. Summarizing preserves the valuable findings, and a fresh subagent regains a clean working context while still starting from what was already learned.

Weaker approaches people try — and why they fall short

  • Clear the context entirely and start the physics work fresh from file paths in CLAUDE.md.Throws away the hard-won rendering findings still needed to relate physics to rendering.
  • Continue in the same context with more targeted prompts naming the classes.Staying in the degraded context won't restore the lost detail; it will keep drifting.
  • Spawn a subagent for physics independently, then manually synthesize with the rendering knowledge afterward.Exploring independently and hand-merging afterward risks losing the specific rendering linkages.
Takeaway — When responses drift to generic patterns, context is degrading: capture a summary, then continue in a fresh (sub)agent context.

Plain-language notes on the technical terms above

Context degradation
What happens when the working memory gets so full that answers start getting vaguer and more generic instead of specific.
Subagent
A separate assistant with its own clean memory, used when a task is big or messy enough to deserve its own isolated workspace.
Context window
The model's working memory for the current conversation — everything it can 'see' right now. It's limited, and it can get crowded.
#19

Structure-First Exploration Under Context Limits

Situation

Caching logic spans 15 files and roughly 8,000 lines across decorators, middleware, and service classes. The goal is to understand it well enough to add an invalidation trigger, while keeping context usage under control.

Recommended approach

Analyze imports and class hierarchies to find the base cache class, read that to learn the shared interface, then trace the specific invalidation implementations from there.

Why it works

8,000 lines won't all fit usefully in context, so a structural map has to come first. Following imports and class hierarchies to the base class reveals the interface everything depends on, giving a targeted anchor to trace from — rather than brute-force reading.

Weaker approaches people try — and why they fall short

  • Search for 'invalidate'/'expire' everywhere and read only those line ranges.Keyword-only slices miss the architecture and give a fragmented, potentially misleading picture.
  • Sequentially read all 15 files for complete understanding.Blows the context budget and buries the signal in noise.
  • Find files with 'cache' in the name and read the largest ones first.'Largest first' is an arbitrary heuristic unrelated to architectural importance.
Takeaway — For big subsystems, map structure first (imports, base classes, interfaces), then read selectively along that map.

Plain-language notes on the technical terms above

Context window
The model's working memory for the current conversation — everything it can 'see' right now. It's limited, and it can get crowded.

Situation

Yesterday's two-hour deep-dive session into a legacy monolith's auth code needs to continue, but three other codebases have been worked on since, and the specific session needs to be found by name.

Recommended approach

Use --resume <name> with the session's name to load that specific session directly.

Why it works

The session's name is already known, and that specific session is what's wanted — resuming by name targets it directly, which is the natural fit.

Weaker approaches people try — and why they fall short

  • Use a session-id flag with the UUID pulled from a transcript file.Works, but only if you go hunting for the exact ID — unnecessary when you already know the name.
  • Use --continue to pick up the most recent conversation.--continue resumes the most recent session, which by now is one of the three other codebases — the wrong one.
  • Start fresh and re-read the files.Discards two hours of accumulated context for no reason.
Takeaway — Know the session name and want that one specifically → --resume <name>. --continue only grabs the latest.

Plain-language notes on the technical terms above

--resume <name>
Jumps back into one specific, named conversation, even if you've had others since.
--continue
Picks up your most recent conversation, whatever it was.
#21

Adaptive Decomposition for Unknown Bugs

Situation

Intermittent 500 errors on one endpoint in a 200+ file codebase, with no idea yet which components are involved — could be routing, middleware, business logic, or the database.

Recommended approach

Dynamically generate investigation subtasks based on what's discovered at each step, adapting as the error path emerges.

Why it works

The bug's location isn't known yet, so the investigation has to be adaptive — each discovery narrows the next step. Generating subtasks as evidence emerges follows the real trail instead of committing to a plan built on ignorance.

Weaker approaches people try — and why they fall short

  • First create a comprehensive plan mapping all code paths before any exploration.You can't comprehensively map paths you don't yet have the knowledge to plan around.
  • Run parallel agents on all four layers simultaneously, then synthesize.Blind parallel investigation of every layer wastes effort and struggles to pinpoint an intermittent root cause.
  • Follow a fixed step sequence regardless of findings.Ignoring intermediate findings is the opposite of what debugging an unknown actually needs.
Takeaway — Unknown root cause → adaptive decomposition: let each finding shape the next step. Fixed plans need knowledge you don't have yet.
#22

Multi-Phase Workflow Helps Open-Ended Tasks

Situation

Two requests: a mechanical rename of one function across the whole codebase, versus an open-ended request to improve error handling across a module (try/catch coverage, meaningful messages, no silent data corruption). Which one benefits from an analyze-then-propose-then-implement-with-review workflow?

Recommended approach

The error-handling request benefits from the multi-phase workflow; the rename does not.

Why it works

Improving error handling is open-ended and judgment-heavy — many valid designs exist, and the risk (silent data corruption) is real, so a review step before changes land is valuable. The rename is mechanical and unambiguous, so multi-phase ceremony adds little.

Weaker approaches people try — and why they fall short

  • Assume both tasks benefit equally from the multi-phase workflow.They don't — one is deterministic, the other is design-laden.
  • Apply the multi-phase workflow to the rename instead.A rename is exactly the kind of well-defined task that doesn't need phased review.
  • Assume neither task benefits from it.The error-handling task clearly does benefit, so 'neither' undersells the judgment-heavy case.
Takeaway — Multi-phase workflows pay off for open-ended, judgment-heavy tasks; mechanical, well-defined tasks don't need them.

Plain-language notes on the technical terms above

Plan mode
A mode where Claude maps out a strategy and shows it to you before making any actual changes.
#23

Trace Renamed Re-Exports Before Grepping

Situation

Before removing a function, all its callers need to be found — but it's defined in a core library and re-exposed under a different, renamed wrapper name in another module.

Recommended approach

Read the library and its wrapper modules first to find every exposed alias, then search for each of those names.

Why it works

Because the function is re-exported under a different name, searching only for the original name misses every caller that goes through the alias. Reading the wrappers first to enumerate every name is the only way to catch calls made through renamed wrappers.

Weaker approaches people try — and why they fall short

  • Search documentation for intended usage and navigate the documented integration points.Docs may be incomplete or stale — not a reliable way to find all callers.
  • Search only for the original function name across the codebase.Misses every caller that goes through the renamed wrapper.
  • Search for files importing the library or its wrappers, then read each one to check usage.Import-based scanning is noisy and still won't reliably tie usage back to the specific renamed function.
Takeaway — With renamed re-exports, first enumerate all alias names, then search for each one. A single name isn't enough.
#24

Resume + Targeted Re-Read of Changed Files

Situation

Resuming yesterday's auth analysis: the session is still valid, but 3 of the 12 previously-read files were changed overnight by a teammate's merge.

Recommended approach

Resume the session, and explicitly tell the agent which 3 files changed so it can re-analyze just those.

Why it works

Resuming keeps the valuable accumulated context — only what actually changed needs correcting. Naming the exact 3 changed files prompts a targeted re-read: accurate about the new reality, efficient because the other 9 files aren't redone.

Weaker approaches people try — and why they fall short

  • Resume and immediately re-read all 12 files.Wastes effort re-reading 9 files that never changed.
  • Start a fresh session to avoid stale assumptions.Throws away an hour of correct context over a 3-file delta.
  • Resume without mentioning that anything changed.Leaves the agent reasoning from stale versions of those 3 files.
Takeaway — Resume to keep context; explicitly flag only the changed files for targeted re-reading. Efficient and accurate.

Plain-language notes on the technical terms above

--resume <name>
Jumps back into one specific, named conversation, even if you've had others since.
#25

Map-Prioritize-Adapt for Open-Ended Coverage

Situation

Adding comprehensive tests to a 200-file legacy codebase with minimal existing coverage, with no priorities specified up front.

Recommended approach

Map the codebase's structure, find the heavily-coupled (high-risk, high-value) modules, plan to test those first, and revise the plan as the dependency structure becomes clearer.

Why it works

With no priorities given, effort should follow impact. Mapping the structure and starting with high-coupling modules puts testing effort where risk and value are highest, and staying adaptive means the plan improves as more is learned.

Weaker approaches people try — and why they fall short

  • Follow a fixed schedule by directory, with equal effort per directory regardless of complexity or importance.Ignores that some code is far riskier and more central than others.
  • Start alphabetically at the first file and discover related files organically.Alphabetical order is arbitrary and unrelated to impact.
  • Read all 200 files to inventory every function before writing any tests.A huge upfront cost that delays any actual value.
Takeaway — Open-ended coverage work → map, prioritize by impact/coupling, start high-value, and adapt as you learn.
#26

Forking a Session to Explore Two Approaches in Parallel

Situation

Yesterday's analysis surfaced two refactor approaches — extracting a microservice, versus refactoring in place. Today, concrete code changes are wanted for both, before deciding which to pursue.

Recommended approach

Fork the session from yesterday's analysis, exploring one approach in each branch.

Why it works

Both explorations should start from the same accumulated analysis but proceed independently. Forking branches the existing context into two, so each fork inherits yesterday's findings yet develops its own approach without the two ideas bleeding into each other.

Weaker approaches people try — and why they fall short

  • Resume for approach one, and manually recreate the context in a brand-new session for approach two.Manually recreating context is error-prone and loses fidelity.
  • Resume and explore both approaches sequentially in the same thread.Lets the two approaches bleed into each other and bloats the context unnecessarily.
  • Start two fresh sessions and manually summarize yesterday's findings into each.Hand-written summaries lose detail and duplicate effort.
Takeaway — Compare independent options from a shared starting point → fork the session; each branch inherits context cleanly.

Plain-language notes on the technical terms above

Session forking
Splitting one conversation into two independent copies that both remember everything up to that point, then develop separately.
#27

Forking a Session for Independent Strategy Development

Situation

An agent has already analyzed a 23-file service, understanding its request flows and error patterns. Now two different testing strategies — end-to-end with mocks, versus snapshot tests — need to be developed independently for comparison.

Recommended approach

Resume with a session fork, giving each testing strategy its own branch.

Why it works

Both strategies should build on the same 23-file analysis but stay independent. Forking gives each strategy its own branch seeded with the full prior context, with no re-reading and no interference between them.

Weaker approaches people try — and why they fall short

  • Export the key findings to a file, then create two new sessions that reference it.Exporting and re-seeding loses the rich in-context understanding and adds friction.
  • Continue in the original session, doing one strategy fully before starting the other.Sequential work in one thread entangles the two strategies and grows context unnecessarily.
  • Start two fresh sessions that each re-read all 23 source files.Re-reading 23 files twice is wasteful and starts from zero understanding both times.
Takeaway — Independent parallel development from one shared analysis → fork the session; avoid re-reading or manually re-seeding context.

Plain-language notes on the technical terms above

Session forking
Splitting one conversation into two independent copies that both remember everything up to that point, then develop separately.
#28

Subagents to Preserve Main-Context Understanding

Situation

Investigating untested paths across a 45-file payment module. After about 8 files, accuracy starts dropping — the agent forgets earlier patterns and hasn't yet found all the test files or traced the critical flows.

Recommended approach

Spawn subagents for specific narrow questions (find all the test files, trace the refund dependencies) while the main agent coordinates and keeps the high-level picture.

Why it works

Context is overflowing. Each subagent gets a fresh window to answer one narrow question and returns a concise result, so detailed exploration happens in disposable contexts while the coordinating agent preserves the overall understanding.

Weaker approaches people try — and why they fall short

  • Summarize findings, clear the context, and use the summary report as the sole reference going forward.A single summary as the sole reference loses detail that's still needed and forces re-discovery.
  • Clear the context, then selectively re-read critical files while writing findings to a scratchpad file.Helps, but is more manual and still reloads a lot of detail back into the main context.
  • Switch to keyword search only, to reduce how much content gets loaded.Reduces tokens but sacrifices the deep understanding that tracing flows actually requires.
Takeaway — When the main context is saturating, delegate narrow deep-dives to subagents and keep the coordinator high-level.

Plain-language notes on the technical terms above

Subagent
A separate assistant with its own clean memory, used when a task is big or messy enough to deserve its own isolated workspace.
Context degradation
What happens when the working memory gets so full that answers start getting vaguer and more generic instead of specific.

Situation

An exploration subagent spent 30 minutes across 47 files documenting data flows, then got interrupted. Meanwhile, a merged pull request renamed two utility functions. The exploration needs to continue.

Recommended approach

Resume the subagent from its transcript, and explicitly inform it about the two renamed functions.

Why it works

Resuming preserves the full 47 files of accumulated context. The only actual change is two renamed functions, so resuming and naming those two renames keeps everything else intact while correcting the one factual drift precisely.

Weaker approaches people try — and why they fall short

  • Start a fresh subagent with only a summary of the prior findings.A summary loses most of the detailed data-flow context that was already built up.
  • Start a fresh subagent with the prior transcript pasted into the initial prompt.Re-feeding the whole transcript into a fresh agent is redundant when resuming does the same thing more directly.
  • Resume without mentioning the renames, since the overall architecture understanding still holds.Leaves the agent reasoning with outdated function names.
Takeaway — Resume to keep deep context; then name the specific changes so the agent updates only what actually moved.

Plain-language notes on the technical terms above

Subagent
A separate assistant with its own clean memory, used when a task is big or messy enough to deserve its own isolated workspace.

Situation

A customer returns 4 hours later to the same dispute. The old 32-turn session still has a stale 'pending' status recorded from a tool call; on resume, the agent keeps citing that outdated status even after fresh tool calls return updated information.

Recommended approach

Resume with the full history, plus a system instruction to always prefer the most recent tool result whenever the same tool has been called more than once.

Why it works

The goal is to keep conversation continuity while making sure current data wins. Resuming with full history plus an explicit instruction to trust the newest duplicate tool result resolves the staleness directly while preserving everything else — targeting the exact failure (old data vs. new) without discarding useful context.

Weaker approaches people try — and why they fall short

  • Resume, but filter out all previous tool-result messages so the agent is forced to re-fetch everything.Loses useful context and forces re-fetching everything, not just the specific stale bits.
  • Start a brand-new session and inject a structured summary of the issue, actions, and status before making fresh tool calls.Discards a rich 32-turn history unnecessarily when the fix could be much smaller.
  • Resume and automatically re-call every previously-used tool at the start of the session.Wasteful, and may re-run tools that aren't even relevant to the current question.
Takeaway — On resume with stale duplicates in the history, keep the history but instruct the agent to trust the most recent tool result.

Plain-language notes on the technical terms above

--resume <name>
Jumps back into one specific, named conversation, even if you've had others since.
#60

Structured Persistence of Key Facts Under Context Limits

Situation

Three separate issues have unfolded over 45 turns of a conversation — a refund, then a subscription question, then a payment update. At turn 48, with context nearly full, the customer asks 'what happened with my refund?'

Recommended approach

Extract and persist the key structured facts for each issue — order IDs, amounts, statuses — into a separate, durable context layer as the conversation goes.

Why it works

To keep all three issues answerable even as context fills up, the key structured facts per issue need to survive independently of the raw transcript. Those compact records let the agent answer 'what happened with my refund?' precisely, even after the original turns describing it have aged out of the window.

Weaker approaches people try — and why they fall short

  • Rely on tools to re-fetch information on demand whenever an earlier issue gets referenced again.Only works if a tool can actually retrieve it and the right identifiers are still known — exactly what risks being lost.
  • Use a sliding window that keeps only the most recent 30 turns.A 30-turn window would drop the refund issue (turns 1 through 15) entirely — the very thing being asked about.
  • Summarize earlier turns into a narrative, keeping full history only for the currently active issue.A narrative summary is lossy and less reliable than structured fields for exact IDs, amounts, and statuses.
Takeaway — Under context pressure, extract and persist key facts as structured records so every issue stays answerable regardless of what ages out.

Plain-language notes on the technical terms above

Context window
The model's working memory for the current conversation — everything it can 'see' right now. It's limited, and it can get crowded.