Table of Contents
Fetching ...

Codified Context: Infrastructure for AI Agents in a Complex Codebase

Aristidis Vasilopoulos

TL;DR

A three-component codified context infrastructure developed during construction of a 108,000-line C# distributed system is presented, including a hot-memory constitution encoding conventions, retrieval hooks, and orchestration protocols and a cold-memory knowledge base of 34 on-demand specification documents.

Abstract

LLM-based agentic coding assistants lack persistent memory: they lose coherence across sessions, forget project conventions, and repeat known mistakes. Recent studies characterize how developers configure agents through manifest files, but an open challenge remains how to scale such configurations for large, multi-agent projects. This paper presents a three-component codified context infrastructure developed during construction of a 108,000-line C# distributed system: (1) a hot-memory constitution encoding conventions, retrieval hooks, and orchestration protocols; (2) 19 specialized domain-expert agents; and (3) a cold-memory knowledge base of 34 on-demand specification documents. Quantitative metrics on infrastructure growth and interaction patterns across 283 development sessions are reported alongside four observational case studies illustrating how codified context propagates across sessions to prevent failures and maintain consistency. The framework is published as an open-source companion repository.

Codified Context: Infrastructure for AI Agents in a Complex Codebase

TL;DR

A three-component codified context infrastructure developed during construction of a 108,000-line C# distributed system is presented, including a hot-memory constitution encoding conventions, retrieval hooks, and orchestration protocols and a cold-memory knowledge base of 34 on-demand specification documents.

Abstract

LLM-based agentic coding assistants lack persistent memory: they lose coherence across sessions, forget project conventions, and repeat known mistakes. Recent studies characterize how developers configure agents through manifest files, but an open challenge remains how to scale such configurations for large, multi-agent projects. This paper presents a three-component codified context infrastructure developed during construction of a 108,000-line C# distributed system: (1) a hot-memory constitution encoding conventions, retrieval hooks, and orchestration protocols; (2) 19 specialized domain-expert agents; and (3) a cold-memory knowledge base of 34 on-demand specification documents. Quantitative metrics on infrastructure growth and interaction patterns across 283 development sessions are reported alongside four observational case studies illustrating how codified context propagates across sessions to prevent failures and maintain consistency. The framework is published as an open-source companion repository.
Paper Structure (27 sections, 4 figures, 4 tables)

This paper contains 27 sections, 4 figures, 4 tables.

Figures (4)

  • Figure 1: Three-tier codified context infrastructure. A human prompt enters the session, which always loads the constitution (Tier 1, hot memory). Specialist agents (Tier 2) are invoked per task via the trigger table; the knowledge base (Tier 3, cold memory) is queried on demand through the MCP retrieval service. Decreasing fill intensity reflects decreasing load frequency.
  • Figure 2: Infrastructure growth across eight milestones reconstructed from Git history. (a) C# code (solid) and knowledge infrastructure (dashed) lines over time, with three development phases as alternating background bands. (b) Context file counts by tier: constitution (T1, darkest), specialist agents (T2, medium), and knowledge base documents (T3, lightest).
  • Figure 3: Typical session workflows for development tasks. A prompt enters the session with the always-loaded constitution (Tier 1). Ad-hoc sessions (${\sim}$87%) produce a result directly or optionally invoke a specialist agent; structured sessions (${\sim}$13%) follow a modified plan-execute-review cycle with specialist agents (Tier 2) and knowledge base retrieval (Tier 3). Knowledge base retrieval is available in both modes but shown only on the structured path. Dashed arrows indicate optional steps.
  • Figure 4: Practitioner guidelines for using a codified context infrastructure.