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
  1. 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.
  2. 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).
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. 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).
  12. 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.