Skip to content
Archive
No. 006AI SystemsPaper

Mitigating Context Rot in Agentic Software Development

The Continuous Context Protocol and the Librarian Pattern

The rapid adoption of Large Language Models (LLMs) in software engineering has fundamentally altered the development lifecycle. However, the stateless nature of conversational coding agents introduces a critical vulnerability: Context Rot. As projects scale in complexity, agents frequently hallucinate structural implementations, overwrite live data plumbing with mock placeholders, and discard established architectural decisions across isolated sessions. In this paper, we introduce the Continuous Context Protocol (CCP) and its central mechanism, the Librarian Pattern. Emulating human "shift-handover" methodologies, the CCP enforces rigorous, autonomous documentation of architectural decisions into a semantic EXECUTION_LEDGER. Analyzing the implementation of the CCP within a complex spatial operating system (Orbital OS), we demonstrate that forcing contextual continuity drastically reduces hallucinated regressions and elevates agent operational capacity from localized task-execution to global architectural stewardship.

Date
MAR 2026
Read
8 min
Depth
Depth: DeepDeep
Cluster
AI Systems
Department
Research Engineering
Provenance
Third Signal Consulting · open-source CCP repository
Authors
Lenox Paris, Third Signal Consulting
About 8 min left

Thesis

Agents lose the plot across sessions because retrieval gives them syntax, not intent.

Retrieval-augmented tooling returns what the code does. It does not return why the architecture was built that way. When a new session meets an ambiguous requirement, the agent falls back on its training and makes lazy refactors, such as replacing a live Firebase listener with a mocked localStorage call. The paper names this degradation Context Rot.

01 · Argument

Intent has to be written down as a ledger the agent must read before it acts.

The Continuous Context Protocol has a Librarian agent read each completed diff, summarize the structural changes, and append them to an EXECUTION_LEDGER. A pre-hook then requires every new session to read the ledger before it evaluates the prompt, so a later agent inherits the decisions and the rejected alternatives of its predecessors.

Evidence

In Orbital's Epic 5, UI refactors silently disconnected live API keys.

Asked to restyle a settings page, the agent updated the Tailwind classes and replaced live keys with mock values. Three controls followed: an anti-mocking rule, a librarian-sync skill that documents live wiring after each commit, and a refactor-live workflow that extracts a plumbing map before any UI change. The paper reports that instances of overwritten persistence layers dropped by more than 95 percent. That figure is the author's own report, not an outside measurement.

Diagram · Ledger scaling tiers

A monolithic ledger is split in three steps: batch compression at 1,000 lines, domain sharding at 2,000, and semantic compression into a Current Truth document at 5,000. By the paper's table, tokens loaded per session fall from about 3,000 at a 1,000-line monolith to about 600 once semantic compression applies.

Signal 01
“Intent, not syntax, is the scarce context.”
Signal 02
“Documentation becomes a gate, not a courtesy: the Sentinel Hook rejects a commit that adds structural dependencies without a ledger update.”

Tension

A ledger that remembers everything eventually costs more to read than the bug it prevents.

The paper's answer is hierarchical compression with the full chronicle archived. What it leaves open is how much architectural nuance survives each compression pass, and who checks.

Implication

The agent's job shifts from executing tasks to stewarding the architecture.

The paper closes on the idea of an AI Lead Architect: an agent trusted over a multi-month horizon because its context is verified, not assumed.

Context named in the paper

The paper positions itself against stateless coding assistants (Claude Code, Cursor, Aider) and borrows from immutable event-stream designs such as OpenHands and SWE-agent. It offers no formal reference list.