Context Inheritance: A Git-Native Architecture and Pre-registered Study of Repository Context for AI Coding Agents
Abstract
AI coding agents repeatedly rediscover project constraints, because repositories version code but not operating knowledge: the decisions taken, the alternatives rejected, the constraints found during execution. We introduce the Repository Context Layer (RCL) — the repository carries its own agent-facing context, versioned with the code, deterministically discoverable, consulted by contract, and writable by agents only under human review, in a minimal default format, context.md — and study, in a pre-registered experiment on SWE-bench Verified, when it helps. The organizing observation is a capability-dependent author–reader pattern we call context inheritance: repository context behaves like senior knowledge, and across the levels we observe its value flows toward weaker readers. A small local executor gains a large navigational benefit from context authored by a more capable model (+26 pp localization on topic-matched tasks, p < 0.0001) but nothing from context it wrote itself (+0.0 pp); with two author levels drawn from different model families, we report this as a pattern consistent with a capability gradient rather than an isolated causal variable. At the frontier the axes shift: an agent appears to gain from its own failure-derived lessons, but not from answer-derived ones (+14.6 pp resolve on constraint-sharing tasks; p = 0.041 uncorrected, 0.081 after Holm correction within its registered family, so we report the direction rather than a confirmed effect; −32% tokens per resolved task); how context is delivered matters (exploratorily, a sharded store the agent reads selectively outperformed a monolith at a third of the tokens at the local tier); and on a broad random sample a frontier agent sits at a resolve ceiling that no context improves. The design consequence is concrete: version repository context as a first-class artifact, author it with the strongest writer available, and expect the benefit in cheaper agents that read it.