Context Engineering: How to Turn AI Coding Agents into Production-Ready Tools
AI coding giving you nothing but slop? The problem isn't the model, it's the context. Notes from Dex Horthy's talk on the 40% "dumb zone", sub-agents, and the Research-Plan-Implement workflow I use every day with ClaudeKit 😁
Also in: Tiếng Việt · 中文 · 한국어 · 日本語
Hey folks, remember me? 😁
Two weeks without a post, huh? Blame "Black Friday" haha... I've been buried in customer support and technical support for ClaudeKit after a wild BF season, so even though I had tons I wanted to write about, I just couldn't find a free minute 🥲 Got a little breathing room this morning, so here we go.
So last Saturday I did a livestream with the NextLevelBuilder folks, and someone asked me: "How do I get more out of Claude Code / ClaudeKit?"
Besides walking through the workflow I usually use, my very first answer was: "LEARN".
Seriously. If you want to squeeze the most out of any tool or AI, you need to understand how it works under the hood, and only then can you use it the right way. No toolkit is magical enough to cover all of that for you.
And one of the most important things I think you need to learn is context engineering.
When AI is still just a "slop machine"
I watched a video of Dex Horthy - CEO of HumanLayer - at AI Engineer Summit 2025, where he gave a pretty shocking talk about the state of AI coding agents. Not about potential or a bright future, but facing a bitter truth head-on:
Most of the time when you use AI to code, you're creating a lot of rework and code churn, and it doesn't work well for complex tasks or brownfield codebases.
Research from Eigor covering 100,000 developers shows a brutal reality: you're shipping more code, but most of it is just reworking the slop you shipped last week. If you're building a simple greenfield project like a NextJS dashboard, AI works great. But if you jump into a 10-year-old Java codebase? Good luck.
Context Engineering: the soul of AI development
Why does context matter so much?
LLMs are basically stateless functions. The quality of the output depends entirely on the quality of the input.
Every time Claude Code or any coding agent picks its next step, there are hundreds of right steps and hundreds of wrong ones. The only thing that influences the output is what's in the conversation up to that point.
Context engineering is about optimizing the context window for correctness, completeness, size, and trajectory.
The trajectory part is especially interesting - if you keep yelling at the AI for getting things wrong, the LLM picks up the pattern: "OK, I mess up → human yells → I mess up again → human yells". The most likely next token in this conversation is... to keep messing up so it gets yelled at! 😂
The "Dumb Zone": the 40% no-go zone
This is the key concept Dex introduced: Once you use more than 40% of the context window, performance starts dropping hard. With Claude Code's ~168,000 tokens, around 40% is the line where you'll clearly see diminishing returns.
The more of the context window you use, the worse the results.
Why 40%?
Research shows transformer models have a trait: the larger the context window gets, the more the model's "recall" and "reasoning" degrade. It's not a bug, it's a fundamental property of the architecture.
A bigger context window doesn't remove the need for disciplined context management. Instead, it makes it easier to degrade output quality if you don't curate properly.
I wrote about this a few months ago, you can read it here:
VB-07: Claude Code common mistakesgoonnguyen.substack.comResearch-Plan-Implement: the anti-"slop" workflow
HumanLayer developed a workflow they call RPI (Research-Plan-Implement).
It's also the workflow I use every day with Claude Code/ClaudeKit, and it's the backbone behind ClaudeKit's clear edge in effectiveness over other AI coding tools.
It's not just a set of prompts or a rigid process, but a philosophy of designing the entire development process around context management.
mermaidflowchart LR
R["Research: compress truth"] --> H1["Human review"]
H1 --> P["Plan: compress intent"]
P --> H2["Human review"]
H2 --> I["Implement with fresh context"]
I --> T["Test and compact"]
T --> N["Next phase"]Phase 1: Research - compressing "truth" from the codebase
The research phase focuses on objectively understanding how the system works, finding the right files, and staying objective. The goal isn't writing code, it's producing a markdown file with exactly the information you need: file names, line numbers, data flows.
Locked section: Phase 2: Plan - compressing "intent"
Locked section: Phase 3: Implement - execute with fresh context
Locked section: Sub-agents: not about "roles" but about context control
Locked section: The right way to use sub-agents
Locked section: Intentional Compaction: the core workflow
Locked section: How "Spec-Driven Dev" got distorted
Locked section: What does "Spec-Driven Dev" even mean now?
Locked section: Key lessons
Locked section: 1. Don't make AI do your thinking for you...
Locked section: 2. "Bad line of code" vs "bad line of plan"
Locked section: 3. Context is a scarce resource
Locked section: 4. Brownfield projects need a different approach
Locked section: 5. Anyone can access the tools, but not the workflow
Locked section: That's a wrap. My take: context engineering is the ultimate rule
Locked section: Right information
Locked section: Right tools
Locked section: Right format
Locked section: Right time
Locked section: References
The rest is for Knowledges members
Plus 19 more sections (about 6 min) for members
You are reading roughly the first third. Knowledges, Combo and Community plans unlock paid articles in full; the Zuey AI plan reads previews only.