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

## Executive summary

The presentation introduces the concept of a Context Engine designed to overcome limitations in current AI agents. Agents often suffer from 'satisfaction of search' and lack deep organizational context (intent, conventions, past decisions), behaving like new employees who reset their knowledge for every task. A Context Engine solves this by ingesting data from diverse sources—including GitHub PRs, Slack discussions, and architecture documents—to provide a comprehensive understanding that allows agents to generate accurate plans, show their work, and prevent compounding errors during complex development tasks.

## Key takeaways

- The Context Problem in AI Agents: Agents struggle because they lack access to 'unknown unknowns'—the critical organizational context like team conventions or architectural rationale. Simply attaching a wiki is insufficient; the agent needs guided, synthesized information.
- The Compounding Effect of Context: The true value of a context engine is not in solving the first task, but in preventing compounding errors. Without proper context, agents may operate on wrong assumptions, forcing costly loops and significantly increasing time/token usage.
- The Role of Seniority Signals: Advanced review agents can use signals like reviewer seniority or expertise to boost the visibility of important past comments, ensuring critical institutional knowledge is surfaced during code reviews.

## Technical details

- Context Engine Functionality: The engine synthesizes organizational context by ingesting data from multiple sources (e.g., Slack, Notion architecture documents, GitHub history/PRs). It can generate artifacts, such as architecture diagrams, that did not previously exist and provides 'show your work' traceability.
- Code Review Automation: The system analyzes PR data alongside historical conversations to identify best practices. It can automatically surface past discussions related to a specific code change, correlating the fix with its original context.
- Open Source Tools: Two open-source projects are available: a Document Query Engine (runs over GitHub history to synthesize schemas for querying) and an Engineering Social Graph (visualizes team review relationships and identifies coverage gaps in the codebase).

## Practical implications

- Implement context-aware tooling to move beyond simple code search and incorporate architectural rationale and historical decision logs.
- Use social graph analysis on PR data to identify areas of the codebase lacking expert review coverage, guiding targeted engineering efforts.
- Integrate CI/CD pipelines with external knowledge bases (e.g., Slack archives) to ensure that automated fixes are traceable back to their original requirements or discussions.

## Topics

AI Agents, Context Engines, Codebase Management, Software Architecture, CI/CD Automation, Unblocked Context Engine, Document Query Engine, Engineering Social Graph

Source: https://www.youtube.com/watch?v=qdAkxLoYNI8
