Lesson deck
Context and long-running agents flashcards
Reviewing needs JavaScript. You can read every card in the list below.
Loading your cards...
Back to the lesson12 cards in this deck
Read all 12 cards as a list
- Front
- Name the two problems that long agent runs hit.
- Back
- Context rot inside a session (a crowded window degrades use of what is in it) and amnesia across sessions (each new window starts blank). The harness budgets the first and writes state down for the second.
- Front
- What is context rot?
- Back
- As the number of tokens in the window grows, the model's ability to recall information from it falls. Treat the window as a finite attention budget (Anthropic, Sep 2025).
- Front
- Three cheap moves to protect the context budget?
- Back
- Cap what enters (truncate and offload large outputs), clear old raw tool results, and compact the conversation late and in one step.
- Front
- What should a compaction keep as written?
- Back
- The goal and acceptance criteria, constraints, key decisions with their reasons, open to-dos, files touched, the last failing command and error, and identifiers needed later.
- Front
- What can a compaction drop or replace with a pointer?
- Back
- Raw tool output (save it to a file), repeated reads, and exploration that led nowhere. Keep the fact of what was tried and why it failed.
- Front
- Two ways a compaction goes wrong?
- Back
- Details are lost and then reinvented with confidence, and negative knowledge (what failed and why) disappears. Changing early context also defeats prefix caching.
- Front
- What does the initializer session create in Anthropic's long-running pattern?
- Back
- An init script, a progress file, a first git commit and a feature list with every entry failing. Later coding sessions use the same harness and tools with a different first prompt.
- Front
- Why a JSON feature list rather than Markdown?
- Back
- Anthropic reports the model was less likely to change structured JSON inappropriately than Markdown. The agent was told to change only each entry's passes field.
- Front
- Is "change only passes" a lock?
- Back
- No: it is an instruction in a prompt. The harness should reject other edits, or keep the list where the agent can write only the status.
- Front
- What is the session startup routine?
- Back
- Check the working directory, read the git log and progress file, read the feature list and pick one unfinished item, run the init script, and run a basic end-to-end check before adding anything.
- Front
- Why keep the instruction file short?
- Back
- A long file crowds the window, flattens priorities and goes stale. Keep a short map that points into a docs folder, and tie each rule to a past failure (Osmani).
- Front
- What does "if the agent cannot read it, it does not exist" mean in practice?
- Back
- Decisions held in chat or in heads must be written into the repository as plain versioned text. Scope memory per session and make it fail closed when no scope is known.