Est.
Bug TriageLong read

Giving Coding Agents Codebase Institutional Knowledge for Triage

Agents need explicit conventions and business rules embedded in repositories to triage correctly.

· 8 min read
Cover illustration for “Giving Coding Agents Codebase Institutional Knowledge for Triage”
Bug Triage · October 27, 2026 · 8 min read · 1,900 words

Giving coding agents codebase institutional knowledge for triage is a repository-design problem. Agents need explicit conventions, boundaries, business rules, and playbooks to orient and act correctly from the first session. A tiered knowledge layer that is kept up to date gives agents that context when they need it, without making every task use an oversized prompt.

Why coding agents fail at triage without structured institutional knowledge

An agent can produce the right behavior in the wrong place. It may resolve an issue while choosing the wrong class naming pattern or error-handling idiom, leaving a human to correct code that is functionally sound. The repository may contain examples of several patterns without explaining which is authoritative. Human developers resolve that ambiguity through code review, pair programming, and conversations. An agent that is new to a repository has none of those ways to learn what the team knows.

The resulting correction cycle exposes a structural gap. Peli de Halleux, Don Syme, and Ben Zorn (2026) describe it directly. “If a convention isn't written down in a place the agent can find and parse, the agent won't have enough context.” Supplying the missing rule in a task prompt may resolve that session, but it leaves the repository unchanged for the next one. The durable fix is to make documentation load-bearing infrastructure, with the rules needed for correct work stored where agents can reliably find them.

What "institutional knowledge" actually means for a triage agent

Conventions answer the question of where work belongs and what form it should take. Naming patterns, file placement, code style, and error handling cannot always be inferred reliably because older code may apply them inconsistently. Dependencies and boundaries answer a different question, which is whether the agent may touch a given part of the system. They identify authoritative APIs, generated files that must not be hand-edited, and modules that remain outside scope. They also define which architectural layers may interact.

Business rules state which behavior must be kept. A pricing calculation, security check, or workflow transition can have rules that still bind it when a cleaner implementation appears. Its status as a domain invariant must be explicit, together with the tests that validate it. Playbooks then answer what happens next. They define how recurring issue classes are routed, what makes an issue agent-delegable, and when a human must intervene.

These categories separate recoverable context from authored knowledge. Code can show how a function behaves, but not necessarily why that behavior is binding or who may authorize a change. Xueping Gao (2026) shows this with a pricing rule where the discount is clear but its standing as a business rule is not. The knowledge layer must add those missing judgments, going beyond what the code does.

Why context volume is not the same as context quality

Boilerplate can obscure the few facts a change must satisfy to be acceptable, while irrelevant material competes with task-specific guidance. Gloaguen et al. found that lengthy context files can make agent performance worse than no context. The implication is selective authoring. Build commands, naming conventions, and domain invariants deserve space because they answer questions the agent cannot reliably answer on its own.

Lulla et al. (2026) found that AGENTS.md files were associated with lower median runtime and output token consumption. That association supports treating context as navigation. A prototype may fit into one manifest, but a large system needs a way to retrieve detail selectively. The useful model is a codebase map that answers task-shaped questions.

Structuring the knowledge layer: from flat manifest to tiered architecture

A tiered architecture keeps rules needed throughout a session separate from details about a given domain. Tier 1 is hot memory, a constitution such as CLAUDE.md, AGENTS.md, or.cursorrules that is always loaded. It contains the commands, paths, conventions, boundaries, and retrieval guidance needed to orient in any session. AGENTS.md provides a portable repository-level format across harnesses, making it a reasonable default for teams using more than one agent. The constitution remains small because it directs the agent to deeper knowledge.

Tier 2 supplies domain expertise when the task requires it. Specialized sub-agents embed project-specific knowledge about areas such as payment flows, auth, or data pipelines, while an orchestrator routes relevant work to them. Aristidis Vasilopoulos (2026) documents 19 specialized agents in a 108,000-line C# project. They provide the narrower knowledge needed once the task enters a particular domain.

Tier 3 holds detailed specifications in cold memory. API specifications, data schemas, workflow transitions, and compatibility contracts are retrieved on demand. The same study describes 34 specification documents that are retrieved through an MCP server. General constraints stay in view, while detailed context comes in when it can help the agent make a specific decision.

What to put in the hot-memory constitution and how to keep it honest

For teams authoring the constitution, the admission test is whether a line resolves something the agent cannot reliably infer. Write down the exact build, test, and lint commands so the agent can use them without searching a README. Give explicit file paths for new components of each type. State casing rules and prefix or suffix patterns. Explain what distinguishes a service from a handler wherever that distinction determines naming or placement.

Error handling deserves an equally direct statement. State whether the codebase uses exceptions, result types, or error codes so the agent has a rule to follow when the examples differ. Name prohibited imports and files that must not be hand-edited. Include behavioral rules for blocked work, draft versus complete pull requests, and uncertainty. Those instructions define what acceptable agent conduct looks like before the implementation is reviewed.

The format should make obligations easy to parse. De Halleux and colleagues favor tables, JSON examples, key-value pairs, and formal MUST/SHOULD/MAY requirements over discursive onboarding prose. Conformance tests tied to specifications can then check whether output follows the documented rules. When an agent violates an unwritten convention, adding that convention before closing the session prevents the correction from remaining inaccessible knowledge.

Encoding business rules and domain invariants so agents treat them as facts, not guesses

Business rules require more than a clear instruction file. An agent reading a discount function can infer the calculation without knowing whether it represents policy, a temporary workaround, or an incidental implementation choice. That distinction governs whether changing it is permissible. The agent also needs authoritative tests and a way to tell whether the associated knowledge is current. A manifest can point to the rule, but a pointer alone does not establish its contract or validation state.

Gao proposes Executable Code Knowledge, or ECK, as a source-bound representation for this purpose. An Executable Code Knowledge Unit combines identity, semantics, an executable body, a contract, evidence, relations, provenance, validation state, and a query interface. The approach is research-stage, from a 2026 paper, with a packaged tool teams can install today still unavailable. Its value is the representation it proposes. Chosen code units become knowledge objects that keep what the code means, the tests that support it, and the relationships it affects tied to the source.

Freshness is part of that representation. AST-bounded fingerprints detect changes to annotated units so that stale knowledge can be identified before an agent relies on it. ECK complements retrieval rather than replacing it, with retrieval providing broad coverage and source-bound knowledge governing selected high-value units. Teams should first identify and annotate the ten to twenty units where a mistake would be most costly, including pricing, auth, payments, and data contracts. The goal is not to describe every function, but to distinguish binding rules from ordinary implementation detail.

Building triage playbooks agents can execute, not just read

An agent may understand a module and still route an issue incorrectly, gather the wrong context, or produce an artifact it was not authorized to create. Playbooks connect static repository knowledge to live triage. For each issue class, they should define classification, required context, permitted autonomous action, escalation conditions, and the expected output. That output may be a draft PR, a comment, a label change, or a reassignment.

The instructions need explicit triggers and obligations. MUST/SHOULD/MAY language gives the agent a clearer decision path than a prose runbook that assumes an experienced on-call engineer will fill in the gaps. The Linear triage automation pattern illustrates the connection to existing tools. Issues with specified labels are batch-assigned to agents, which work within defined scopes and return draft PRs for human review. The playbook supplies the limits and expected result around that automation.

Delegation does not transfer ownership of the work. The playbook should state that the human teammate remains the assignee and is responsible for the output. De Halleux and colleagues describe the human role as setting direction, reviewing the diff, intervening when work goes wrong, and maintaining 360-degree oversight. This division gives the agent an executable process without treating successful execution as final approval.

How to maintain the knowledge layer as the codebase changes

Maintenance begins with three distinct forms of decay. Convention drift happens when the code changes but the manifest stays the same, so agents get instructions that clash with how the code now works. Stale business-rule annotations keep old contracts or test references after the code they govern changes. Obsolete playbooks preserve workflows that have moved on in conversation or in a separate document. Each requires an update path.

Convention drift belongs in code review. Every PR that changes a convention, boundary, or business rule should include the corresponding knowledge-layer update as a review requirement. The same discipline applies when a human corrects an agent, because the correction may reveal an undocumented rule. Workflow changes likewise need a matching agent-facing playbook revision.

Business-rule annotations also benefit from automated freshness signals. Gao demonstrates that static rules snapshots detect none of the stale cases that fingerprints bounded by code structure correctly classify. Within the research pattern, fingerprints make source changes visible without relying solely on manual audits. They do not supply the revised business meaning themselves. Review must still bring the contract, evidence, and instructions into agreement with the changed code, keeping the knowledge layer under the same update obligations as the system it describes.

What changes for engineering teams when agents can actually orient themselves

Codified knowledge changes how much work a team can delegate without repeatedly supplying missing context. Engineers can spend less time correcting local conventions and more time directing tasks and evaluating results. Anthropic’s 2026 Agentic Coding Trends Report identifies “expedited onboarding to dynamic project staffing” as a consequential shift. When repository knowledge supplies what people would otherwise learn through pair programming and review, onboarding can shrink from weeks to hours. That changes how teams approach project resourcing.

The same foundation can broaden an engineer’s working range. The report describes capability expansion across frontend, backend, databases, and infrastructure, with tighter feedback loops and faster learning. The system supplies domain knowledge, so it no longer has to come entirely from what the engineer directing the work remembers. Oversight remains necessary, but it starts from explicit rules. Review can focus on whether the proposed change satisfies those rules.

Run attribution can make the infrastructure itself assessable. When each agent run is logged against its playbook, model, and instructions, teams can identify recurring convention violations, playbooks producing good-quality PRs, and frequently retrieved cold-memory documents. The organizational payoff is the ability to expand delegation without expanding a backlog of corrections that only senior engineers know how to make.

Sources

  1. Codified Context: Infrastructure for AI Agents in a Complex Codebase
  2. Executable Code Knowledge: Code as a Native, Validation-Carrying Knowledge Representation for AI Coding Agents
  3. Repositories Are Human/Agent Knowledge Factories
  4. Knowledge Activation: AI Skills as the Institutional Knowledge Primitive for Agentic Software Development
Filed underBug Triage

More in Bug Triage