How to Generate Mergeable Code with a Context Engine — Peter Werry, Unblocked

Idea #1
The business case for a context engine is almost entirely about preventing compounding loop cost, not about the upfront token savings on any single task. A naive comparison of context-assisted vs. unassisted agent runs looks modest: in the demo, optimizing the source-mark calculator cost roughly half as many tokens and half as much wall-clock time with Unblocked's context injected (sub-dollar, ~1 minute) versus without (~2 minutes, higher cost). That difference is real but unimpressive on its own. The real argument is multiplicative: an agent that starts from incomplete or wrong context builds a subtly wrong plan, executes against that plan, discovers a problem partway through, and must loop back — which triggers a new round of discovery, re-planning, and re-execution, each step again at partial-context quality. These loops compound. A 2x cost difference on a one-shot task becomes a 5x or 10x difference on a multi-step agentic pipeline where each stage depends on the prior stage's conclusions being correct. This means the ROI calculation for context infrastructure should be framed as error-loop elimination, not token savings — and it becomes especially critical as teams move toward longer-horizon, more autonomous agents where there is no human correction point mid-run.

Idea #2
Agents suffer from a structural amnesia problem that grows worse as your codebase and organization scale, and the only durable fix is pre-building and delivering organizational context rather than having the agent discover it at task time. Every agent invocation is effectively a new employee onboarding: it has to rediscover how the codebase is structured, how the team builds and tests software, and what architectural decisions have been made — every single time. Humans accumulate this as tribal knowledge over months; agents reset it on every task. Two failure modes compound this. First, 'satisfaction of search': just as a radiologist who finds one suspicious region on an X-ray may stop looking and miss others, an agent that finds one plausible piece of context stops there and operates on an incomplete picture. Second, even when agents do search broadly, they don't distill understanding — they can locate documents but can't synthesize how dependencies interact or how past architectural decisions constrain future choices. Dumping the whole codebase plus architecture docs into a million-token context window also doesn't fix it: it doesn't fit, it distracts the agent from the task at hand, and it wastes tokens on irrelevant material. The demonstrated alternative — Unblocked's context engine — pre-processes organizational knowledge (PRs, Slack, Notion, code) into task-specific, ranked context delivered to the agent before it starts, rather than letting the agent go hunt for it mid-run.

Idea #3
An engineering social graph — built from PR and commit history — is a practical, automatable signal for routing expertise, boosting high-signal code review comments, and identifying coverage gaps across a codebase. By analyzing who reviews whose code, clusters of collaborators naturally emerge that correspond to team and domain boundaries, without requiring any manual org-chart input. This graph serves two concrete functions in a context engine: (1) expertise routing — when an agent or human needs authoritative context about a part of the codebase, the graph identifies who the subject-matter experts are and weights their past comments, decisions, and Slack messages accordingly; (2) coverage analysis — the graph can show which parts of the codebase lack expert reviewers, surfacing organizational risk before it becomes an incident. In Unblocked's live demo, a code review agent surfaced a comment that a senior engineer (Richie) recognized as something he himself had said — because the system had retrieved and boosted his past PR comments as high-expertise signals. The same graph helped correlate a drop in detected code review issues to a Claude version upgrade (4.8), tracing the chain from Slack conversation to PR to behavioral change automatically.

Source: How to Generate Mergeable Code with a Context Engine — Peter Werry, Unblocked (AI Engineer)

Text summarized and optimized using Anthropic’s models and reviewed by a human.