Context Engineering for Coding Agents

A deep dive into advanced engineering techniques for coding agents, focusing on effective context management in LLMs like Claude. The talk introduces a practical framework using a brain-inspired analogy, proposing a Markdown-based 'wiki' as a long-term memory system to augment the agent's limited context window. This approach is demonstrated through a real-world challenge of extracting structured data from technical drawings.

4 min read
Context Engineering for Coding Agents
source: https://www.youtube.com/watch?v=jXtnhyro-QE

This talk presents a framework for “Complex Engineering for Coding Agents,” focusing on managing the context window of Large Language Models (LLMs) like Claude to solve complex, real-world problems. The speaker, Fauso, argues that while the context window is growing, effective engineering requires treating it as a scarce resource. He suggests a rule of thumb: keep context usage below 25% of the model’s capacity to maintain speed, reduce cost, and minimize errors.

A Taxonomy of Context Injection

The core of the presentation is a detailed breakdown of how to influence an agent’s behavior through various forms of context injection, categorized as deterministic, probabilistic, and human-driven.

  • Deterministic Context: These are predictable injections that load at the start of a session.

    • claude.md files: Hierarchical markdown files for user-level, project-level, or folder-level instructions.
    • Rules: Path-scoped or file-extension-scoped instructions for coding conventions and standards.
    • Hooks: Scripts tied to lifecycle events, useful for tasks like summarizing a session upon completion or using an observer model to refine user input in real-time.
  • Probabilistic Context: These are more dynamic and are invoked based on the flow of the conversation.

    • Sub-agents: Specialized agents for non-coding tasks (e.g., research, business operations) that do not inherit the parent agent’s full context, allowing for more focused and efficient execution.
    • Skills: Reusable slash commands that can range from simple markdown instructions to complex scripts that call other models or APIs (e.g., using Gemini for video analysis). The speaker emphasizes creating skills dynamically from successful chat interactions.
    • Observers: Separate processes that monitor a session and can interact with it. An example given is using tmux to allow different agent sessions to communicate with each other.

The Brain as a Mental Model for Agent Architecture

To manage the complexity of these systems, the speaker proposes using the human brain as a mental model, focusing on attention and memory.

  • Attention & Working Memory: The LLM’s context window is analogous to human working memory—a limited space where active processing occurs.
  • Long-Term Memory: To overcome the limitations of the context window, a long-term memory system is proposed. Inspired by Andrej Karpathy, this system uses a “wiki” of Markdown files as a knowledge base. Key components include:
    • Storage: An agent, or a team of agents, processes information (e.g., research papers, documentation) and stores it in the wiki.
    • Retrieval: An observer agent monitors the main chat and fetches relevant information from the wiki to inject into the context window at the right moment.
    • Maintenance: A policy-based system maintains the wiki’s relevance. This includes a scoring mechanism for concepts and a decay rule (like Ebbinghaus’s forgetting curve) to downgrade the importance of unused information over time.

This system allows the agent to build a persistent, transferable knowledge base, enabling it to solve problems more effectively, especially under time constraints, as demonstrated with a cellular automata visualization task.

The Build-off Challenge

The talk culminates in a hands-on challenge where teams must extract structured information from a technical drawing within a tight, five-minute timeframe. The challenge is designed to test the application of the discussed concepts, forcing participants to build a robust system with a memory wiki and specialized skills to solve a problem that is intractable with simple prompting or research alone.

Share post

Stay In The Loop! Subscribe to Our Newsletter.

Get updates straight to your inbox. No spam, just useful content.

Recommended for You

Skills at Scale — Nick Nisi and Zack Proser, WorkOS

Skills at Scale — Nick Nisi and Zack Proser, WorkOS

Nick Nisi and Zach Proser from WorkOS explain how to build, manage, and scale AI 'skills'—reusable, portable instructions that make AI agents like Claude more powerful and consistent. They cover the core anatomy of a skill, best practices for writing them, advanced techniques like progressive disclosure, and their application beyond coding, from video generation to automating business workflows.

AI at college graduations and why Claude blackmails

AI at college graduations and why Claude blackmails

The Mixture of Experts team discusses the growing skepticism towards AI among younger generations, a Microsoft study revealing how LLMs can corrupt data in complex workflows, Anthropic's data-centric fix for Claude's "blackmailing" issue, and the cultural debate over an AI-generated story potentially winning a literary prize, all circling the central themes of human ownership, trust, and the need for better processes in the age of AI.