EXPERIMENT_036 // MODULAR-CONTEXT-FILE.COMPILER
Pick a session context and watch a five-layer stack of Diana's own agent context files compile into one resolved view, with every line tagged by the layer it came from and every override traced back to the earlier layer it replaced.
LOADING EXPERIMENT...
Diana's coding agents read a five-layer stack of context files before they act — a fleet-wide baseline, harness rules, a project's own conventions, its Claude-specific notes, and per-repo memory. This experiment compiles a curated, sanitised snapshot of that real stack for two of her actual repos, resolving it into one view where every fact is tagged with the layer it came from and every override is shown next to the earlier layer it replaced.
HOW IT WORKS
The pipeline runs fleet baseline → harness rules → repo AGENTS.md → repo CLAUDE.md → scoped memory, in that order, because that is the order Diana's real agents resolve them in. Each layer contributes a handful of sanitised excerpts tagged with a topic id; the two session contexts — this Labs site, and Geoverity, a commercial product — share the first two layers verbatim and diverge from the repo layer onward.
A pure function walks the five layers in order and groups every contribution by topic. A topic only one layer touches resolves as single-source; a topic two or more layers touch resolves to whichever layer is last in the pipeline, with every earlier contribution kept for the provenance history rather than discarded.
Geoverity's language-policy topic is the clearest case: the fleet baseline assigns it US English by name, and the override comes straight from a scoped-memory entry, skipping the repo's own AGENTS.md and CLAUDE.md files entirely — proof that "later wins" in this architecture means later in the fixed pipeline order, not necessarily the adjacent layer.
Switching a layer off re-runs the same compileContext() call with a smaller layer set live in the browser — disabling Geoverity's scoped-memory layer, for instance, visibly moves its repo-scope topic's winner back to the repo's CLAUDE.md file, so the override chain is something you can take apart, not just read about.
WHAT THIS PROVES
The fleet's own "Manual Nobody Maintains" argument — that a context stack this layered needs tooling to see clearly, not just discipline to maintain — is demonstrable rather than asserted: the same resolution engine that decides what a real coding agent reads first is small enough to unit-test for additive merge, override, and missing-layer cases in isolation from any UI.
Self-referential build: the experiment visualising the architecture is itself built inside that architecture, using the real Labs AGENTS.md/CLAUDE.md pairing this page describes as one of its own two session contexts.