Context Management Is the Real Bottleneck in Agent-Assisted Development
Your AI coding agent is only as good as the context you give it. Here's how I structure information so agents actually ship useful code.
Your AI coding agent is only as good as the context you give it. Here's how I structure information so agents actually ship useful code.

The biggest bottleneck in agent-assisted development isn't model capability. It's context.
Give an agent a vague task and a huge codebase, and it'll produce plausible-looking code that breaks everything. Give it the right context — the architecture, the conventions, the decisions — and it'll ship production-quality work.
I've spent more time structuring context for agents than writing code. That investment pays for itself every day.
AI coding agents have a fundamental constraint: limited context windows. Even with 200K tokens, you can't dump an entire codebase into a prompt.
So agents need to be selective. They read files, search for patterns, build a mental model. But their mental model is only as good as what they can find.
What goes wrong:
The solution isn't smarter models. It's better-organized information.
Every project has a CLAUDE.md at the root. This is the first thing an agent reads. It contains:
Think of it as onboarding docs for a new developer. Because that's exactly what it is. Every agent session is a new developer joining the team.
My docs/ directory has numbered folders:
docs/
├── 00_project/decisions.md
├── 02_architecture/
│ ├── api_spec.md
│ └── data_model.md
├── 03_engine/
│ ├── workflow.md
│ ├── intelligence.md
│ └── memory.md
└── 07_frontend/architecture.md
The critical file: decisions.md. Every major decision gets recorded with:
When an agent reads this, it understands the constraints. It won't propose solutions we've already rejected. It won't violate boundaries we set intentionally.
The most reliable documentation is the code itself. In my system:
Rust types define the domain model:
pub struct WorkflowExecution {
pub id: ExecutionId,
pub workflow_id: WorkflowId,
pub status: ExecutionStatus,
pub current_node: Option<NodeId>,
pub budget_remaining: TokenBudget,
}
OpenAPI spec bridges the gap:
ExecutionStatus:
type: string
enum: [pending, running, paused, completed, failed]
TypeScript types are generated from the spec:
type ExecutionStatus = 'pending' | 'running' | 'paused' | 'completed' | 'failed'
An agent working on the frontend can read the generated types and know exactly what the backend expects. No guessing.
Each package has its own context cues:
README.md in each package explaining its purposeAn agent working in packages/ui/ doesn't need to understand the Rust backend. It needs to understand the component patterns in that package.
The hardest context to convey: why things are the way they are.
An agent sees a seemingly redundant abstraction and "simplifies" it. But that abstraction exists because of a production issue three months ago.
An agent sees an unused parameter and removes it. But it's there for backward compatibility with a client integration.
How I solve this:
Not all context is created equal. I think about it in layers:
Layer 1: Always Available (CLAUDE.md)
Layer 2: On-Demand (Architecture docs)
Layer 3: Just-in-Time (Source code)
Layer 4: Historical (Git history, PR discussions)
The goal: agents load Layer 1 automatically, request Layer 2 when starting a feature, and pull Layer 3 as they work.
Dumping 50 files into context doesn't help. The agent drowns in information. Important signals get lost in noise.
Better: Give the agent a map (Layer 1), let it navigate to what it needs.
Docs that describe last month's architecture are worse than no docs. The agent follows outdated patterns.
Better: Keep docs in the same repo, same PR as code changes. Review docs like you review code.
"Everyone knows we use camelCase for TypeScript." Agents don't know unless you tell them.
Better: Write it down. In CLAUDE.md, in linter configs, in template files.
Some teams give agents zero guidance. "Here's the repo, figure it out."
The agent figures it out. Differently every time. Inconsistent with existing code. Missing conventions.
Better: Invest 30 minutes writing good project context. It saves hours of rework.
How do I know if my context is good enough?
Agent rework rate. If I'm rejecting more than 20% of agent output, context is probably the issue.
Convention violations. If agents keep using the wrong patterns, those patterns aren't documented.
Architecture drift. If agents put things in the wrong places, the directory structure isn't clear enough.
Repeated questions. If I keep telling agents the same thing, it should be in CLAUDE.md.
Here's the thing: writing good context for agents also helps human developers.
My onboarding time for new developers dropped after I invested in agent context. The same docs that help AI agents help humans understand the system.
The architecture decision records I wrote for agents have become the go-to reference for the team.
Context management isn't just an AI problem. It's a knowledge management problem. Agents just make the problem visible because they don't tolerate implicit knowledge.
Your AI coding agent doesn't need a bigger context window. It needs better-organized context. Write the docs. Record the decisions. Make conventions explicit. Treat every agent session like a new team member's first day.
The teams that manage context well will get 10x productivity from AI agents. The teams that don't will get 10x frustration.