Context Engineering — Front-Matter: Front matter
- Source: /library/Context Engineering/source-file.pdf
- PDF pages: 1–11
- Pages without text: 1
Context Engineering: Engineering
Information for AI Systems
J.C. Ködel
Context Engineering: Engineering
Information for AI Systems
- About the author
- Map of the trilogy
- How LLMs use context
- The model only sees the input
- Attention: how the model weighs what you sent
- Nothing survives between calls
- Where the context hides
- What changes in your practice
- Tokens and context windows
- The model reads tokens, not words
- What tokenization explains as a bonus
- The context window is the container
- A big window is no license to fill it
- Measure it yourself: what travels with a one-line question
- The yardstick you take from this chapter
- Memory and limits
- The chat’s memory is a replay
- Where the illusion breaks
- What about the tools that claim to have memory?
- Work with the memory that exists, not the one you
imagine
6. The context cycle
- The shape of the cycle
- Where the cycle swells
- The arithmetic of accumulation
- Reading a session as a cycle
- Context rot: why large contexts degrade quality
- The U-shaped curve: “lost in the middle”
- Needles, haystacks and the test that became a standard
- Context rot: degradation in tasks that ought to be trivial
- Diagnosing rot in your session
- Token economics: the real cost of bad context
- How the meter runs
- Agent scale: the multiplier nobody budgets for
- Do the math yourself
- Parametric calculation: cost of irrelevant context
- What to measure tomorrow morning
- Quality and cost are the same bug
- Prompt engineering vs context engineering: why the prompt
became a second-order variable
- What prompt engineering really solves
- The same prompt, opposite results
- The discipline that takes its place
- The objections that deserve an answer
- Where the right context comes from
- Specifications
- What a spec carries
- Examples are the part the model understands best
- The waterfall objection
- Living documentation
- The document that describes the present
- “All docs rot, so why write them?”
- What each artifact answers
- ADRs
- A record for the why
- “ADRs are bureaucracy”
- Three artifacts, three questions
- Conventions
- Fewer decisions per task
- The conventions document
- Conventions that run in CI
- Where each kind of information lives
- Persistent context files
- The shortcut and what it costs
- Anatomy of a file that works
- Anti-patterns, and where each line goes instead
- “It turns into a dump and nobody maintains it”
- Project organization
- The context source you do not write
- What the technical tree screams
- What the feature tree screams
- Modularization
- Parnas’s criterion
- Deep modules, small surface
- A public surface is not the interface keyword
- Boundary lines across VilaSchedule’s tree
- “Too much ceremony for a system this size”
- Context for brownfield projects
- Step 1: structure and names
- Step 2: git archaeology
- Step 3: AI-guided reading
- Step 4: generating the artifacts incrementally
- Context layers
- A layer is a lifetime, not a folder
- The layers of a session
- The same session, annotated by layer
- What the layers let you decide
- “This is bureaucracy for a twenty-minute session”
- Context packing
- Packing is choosing the minimum, and choosing means
saying no
- The inventory of the bloated packet
- The window is not uniform
- Four questions that assemble the packet
- The same request, packed
- “If I forget the right file, it will make something up”
- What the packet cannot carry
- Context recovery
- Recovery is reassembling what had no address
- Recovery is not prevention
- The routine I use to restart a task
- The state note
- The two restarts, side by side
- “In 2026 the agent handles it on its own”
- Not everything that came back is still true
- Context validation
- Checking a belief is not validating input
- Two ways to state what is not so
- The statement, the check and the repair
- The checklist I run
- When the check fails
- “If I have to check everything, what is the AI for?”
- What is left of the check when the history shrinks
- Context compression
- Compressing is choosing what is left
- What a summary optimizes for
- The anchors you write beforehand
- “Then turn automatic summarization off”
- What this chapter assumes is in place
- One window, one task
- Context isolation
- One context per task
- When splitting is worth the coordination cost
- Thursday, split again
- The subtask contract
- Two subtasks at once, each on its own ground
- “The subagent loses sight of the whole”
- “Re-explaining the context to each one is expensive”
- The packet that fits in no window at all
- RAG vs direct context
- Fetching the passage when the question comes up
- Size, mutability and how each task uses it
- Embedding is the default until it hurts
- “RAG retrieves the wrong passage”
- “Chunking fragments meaning”
- The column the search does not answer
- MCP and tools as dynamic context
- Information you do not read but ask for
- The name this has in 2026
- The definition is what the model reads
- Every tool is context paid for before the question
- When the data calls for a tool
- “That is a whole integration to read four times”
- “And when the tool is down?”
- What the three decisions still do not say
- Context security and trust
- The window has one voice
- The attack has a name and a test
- Privilege is granted per tool, not per trust
- Provenance is origin plus authority
- The packet is an exposure surface
- “A good model already resists this”
- Where to start
- Development loops with AI
- Technique is not cadence
- Pack, run, validate, distill
- Where recovery comes in
- One turn on Thursday
- Calibrate without breaking it
- “That is ceremony for a ten-minute task”
- Two weeks later, the same feeling
- Measuring context: how to evaluate whether your context
improves results
- “Evaluating that is work for a machine learning team”
- What counts as right the first time
- Thirty seconds per turn
- The number on its own decides nothing
- Two counts that fit in the same file
- “Fifteen turns prove nothing”
- Your rate and the team’s
- Principles applied: chat, IDE, terminal and CI
- Four questions before any configuration
- The map of July 2026
- Chat assistant: the context lives outside the repository
- IDE agent: the context lives next to the code
- Terminal agent: the context lives in directory layers
- Agent in CI: nobody there to correct course
- One source, four projections
- “This will age the same way”
- The context that never leaves your laptop
- Teams: context as a repository asset
- What belongs to the repository
- One owner per artifact
- An agent’s first day
- “Nobody is going to maintain this”
- What happens when all of this meets a project
- Preparing a project (from scratch and from a legacy system)
- A caveat about the tool
- The path from scratch: three files and a tree
- The legacy path: a packet that shows its evidence
- How to know the packet is ready
- A complete AI-guided implementation
- Session 1: the skeleton, and three sentences that paid for
the session
- Session 2: five statements, three checks and a defect that
was not a statement
- Session 3: the window fills up, and what is left is not what
you think
- Session 4: the same task resumed twice
- Session 5: the slice that left the main window
- What the five sessions add up to
- Post-mortem: where the context failed and how it was
recovered
- The delivery that came back incomplete and said nothing
- The decision nobody made out loud
- The reason that died with the session
- The packet that was wrong
- The boundary drawn halfway
- The rule nobody enforced
- What each failure cost
- The legacy system as counterpoint
- Post-mortem script
- References
- Papers and articles
- Vendor documentation and publications
- Other sources