Mari blog

5-layer agent runtime - three document layers

Daniel Henneberger · 2026-05-08

There is a useful piece of vocabulary going around right now: Claude Code as a five-layer agent runtimeCLAUDE.md (memory), Skills (knowledge), Hooks (guardrails), Subagents (delegation), and Plugins (distribution).

It is a clean way to look at the system. It also makes the failure pattern obvious.

Hooks and plugins are mechanical. A hook is a script; it either fires or it doesn't. A plugin is a manifest; it either installs or it doesn't. Engineering orgs already know how to manage scripts and packages.

The other three are not mechanical. Memory, knowledge, and delegation are documents. A CLAUDE.md, a SKILL.md, a subagent's system prompt — they are prose written by humans, read by a probabilistic model, expected to remain true as the codebase moves underneath them.

That is a documentation problem. And documentation problems do not get better when you give them to engineers as a side quest.

This post is about the middle three.

CLAUDE.md goes stale past the 200-line ceiling

Layer 1: the memory layer is already breaking

CLAUDE.md is the most-used and least-managed file in modern engineering repos. The official guidance is that it should be "under roughly 200 lines"; past that, "Claude ignores half of it because important rules get lost in the noise."

That is not a hypothetical. The community is living it:

Then there is the precedence problem. Claude walks the directory tree concatenating every CLAUDE.md it finds. The order is documented inconsistently enough that Anthropic has its own open issue about it, and a separate issue (#54955) noting the behavior "differs from intuitive behavior where closer/more specific files should take precedence." In a monorepo, you also load every parent file whether you want to or not — issue #20880 describes a 40k-character Go-microservices root rule sheet being loaded inside a UI subdir, with no way to opt out.

And then it goes stale. Rules in CLAUDE.md outlive the code they describe. Auto-memory writes new entries you never reviewed. Conventions drift. The on-call engineer onboarding next month gets a different ~/.claude/CLAUDE.md than yours, so their Claude does different things in the same repo. Anthropic shipped /team-onboarding in v2.1.101 specifically because, in the words of the Panaversity guide, "the frontend developer's Claude inserts Python docstrings into React components, the backend engineer's Claude adds TypeScript-style imports to FastAPI routes." That guide is here.

There is no linter. There is no claude memory diff. There is no expiry. There is no test that the rule "use functional components" still matches the code. There is no review step on auto-memory writes. Memory is treated as a config file, but the failure mode is documentation rot.

Skill activation is a coin flip

Layer 2: the knowledge layer is sprawling before most teams notice

Skills were supposed to be the answer to a 400-line CLAUDE.md. "A skill's body loads only when it's used," per the official docs, so long reference material costs nothing until you need it. Modular knowledge. On demand.

In practice, the failure modes show up almost immediately:

And the bigger gap: the institutional knowledge an org actually has does not live in .claude/skills/. It lives in Slack threads, Confluence pages, design docs, and the heads of three senior engineers. That is the gap between "we have skills installed" and "Claude knows how this team actually does things." It is not a skill problem. It is a documentation pipeline problem.

Layer 4: the delegation layer is fragile in exactly the place teams trust it

Subagents are how you stop the main context from collapsing at two-thirds. They run "in their own context and return only the summary" (code.claude.com). When they work, they are the single biggest quality lever in the whole runtime.

The catch is what teams put in agents/code-reviewer.md. That file is a system prompt — a document — describing how your team reviews code. And it has the same management problems as any other document, with extra failure modes on top:

And again, the deeper gap: the subagent prompt that says how your team reviews code is a doc. It will drift from how your team actually reviews code. There is no review step that catches that drift.

The pattern

Three layers. One pattern.

Each one is a folder of documents that the agent reads as ground truth. Each one rots. Each one sprawls. Each one fails silently — Claude does not throw a compile error when CLAUDE.md contradicts the code, when the skill description loses the routing lottery, when the subagent prompt describes a workflow nobody uses anymore.

The thing engineering orgs are missing is not a sixth layer. It is the same thing they have always been missing: a documentation pipeline that survives change. Source-grounded. Versioned. Reviewed in PRs. Drift-detected against the code.

Where Mari fits

Mari is AI content management for coding agents: the record of everything your AI writes. The thesis we keep coming back to: documentation is a background-agent-shaped problem. Bounded. Repetitive. Anchored in code, PRs, and Slack, sources of ground truth an agent can pull from and cite back.

That same thesis is what makes Mari the right place to put the middle three layers. The loop that keeps a runbook honest, detect the change, write or update, verify every fact, owner signs off, watch for drift, is the same loop that should govern the documents governing your agents.

Concretely:

We are not trying to replace .claude/. We are trying to give .claude/ the same record your docs get: a source, an owner, a sign-off on every fact, and a watcher for when the code moves on.

The 5-layer framework is the right map. The middle three layers are where teams quietly lose, because they are documentation, and documentation does not maintain itself.

Mari is what maintains it.

If you'd rather see it live, book a demo, or open an issue on GitHub and pull on the thread.

— Daniel