---
title: "STACK | The Agentic Codebase"
description: "STACK is a five-layer architecture for repositories where humans and agents share work: Structure, Toolchain, Agent configuration, Connection, Knowledge and…"
image: "https://lenvanderhof.com/photos/len-portrait-1.jpg"
---

Framework

# STACK The Agentic Codebase

STACK is a five-layer architecture for repositories where humans and agents share work: Structure, Toolchain, Agent configuration, Connection, Knowledge and quality. The agent OS is versioned like the app.

The moves

5

## When to use it

Use STACK when agents demo well and then rot the repo: rules in five tools, MCP without contracts, skills nobody owns. The disease is agentic repo debt, not a weak model.

## The moves

1. 01

### Structure

Layout, entry points, workspaces, and boundaries an agent can navigate on its first minute in the repo.
2. 02

### Toolchain

The shells, commands, and CLI contracts an agent is allowed to run, written down instead of remembered.
3. 03

### Agent configuration

AGENTS.md, CLAUDE.md, rules, skills, and subagent charters as versioned standing context.
4. 04

### Connection

MCP servers, tool contracts, hooks, and guardrails with least privilege and a real failure story.
5. 05

### Knowledge and quality

Memory tiers, context budgets, evals, and CI, so a model upgrade does not silently lower the bar.

## The book

Available now

### The Agentic Codebase

The Five-Layer Architecture That Makes Agent Work Survive Production

Open the bookThe articleThe series

## Related frameworks

CHORUS

### The Multi-Agent Organization

CHORUS is a six-skill coordination protocol for teams of 2 to 15 people who share work with specialised AI workers: Charter, Handoff, Orchestrate, Review, Update, Sync. Org charts name reporting lines. CHORUS names coordination lines.

SENSE

### AI Agents for Startup Strategy

SENSE is a five-move strategic intelligence layer: Scan, Evaluate, Navigate, Simulate, Execute. It turns agent work from a productivity shortcut into a sourced claim that changes a watchlist, an assumption register, or a Monday decision.

BooksOS

### The Agentic Author

BooksOS is a gated production system for serious nonfiction: Brief, Bible, Map, Draft, Edit, Package, Launch. Agents do specialist work inside the gates. Judgment, voice, and accountability stay human.

GRAIN

### The RAG Engineer

GRAIN is a retrieval loop: Gather, Rank, Assemble, Inspect, Navigate. Gather governs the corpus: sources, permissions, and versioning. Rank retrieves candidate passages and reranks them for the question actually asked. Assemble builds the context the model may see. Inspect traces a wrong answer back to the chunk and retrieval decision behind it. Navigate keeps the index fresh: TTL policy, re-ingest, and change detection. If you cannot point at the passage, you do not have retrieval. You have a fluent guess.

## Essays on this site

- [What is an AI agent?](https://lenvanderhof.com/en/blog/what-is-an-ai-agent/)
- [MCP explained for founders](https://lenvanderhof.com/en/blog/mcp-explained-for-founders/)
- [The Agentic Codebase: introduction](https://lenvanderhof.com/en/blog/the-agentic-codebase-introduction/)
- [Version the agent OS](https://lenvanderhof.com/en/blog/stack-version-the-agent-os/)
- [An agentic workflow is not an automation](https://lenvanderhof.com/en/blog/agentic-workflow-vs-automation/)
- [LLM integration is an operating-design problem](https://lenvanderhof.com/en/blog/llm-integration-is-operating-design/)
- [MCP meaning: Model Context Protocol, not a product](https://lenvanderhof.com/en/blog/mcp-meaning/)
- [What is STACK? Five layers, not a vendor diagram](https://lenvanderhof.com/en/blog/what-is-stack/)

## Terminology

- [STACK](https://lenvanderhof.com/glossary/stack/)
- [CHORUS](https://lenvanderhof.com/glossary/chorus/)
- [SENSE](https://lenvanderhof.com/glossary/sense/)
- [BooksOS](https://lenvanderhof.com/glossary/booksos/)
- [GRAIN](https://lenvanderhof.com/glossary/grain/)
- [AI agent](https://lenvanderhof.com/glossary/ai-agent/)
- [Human in the loop](https://lenvanderhof.com/glossary/human-in-the-loop/)
- [Override doctrine](https://lenvanderhof.com/glossary/override-doctrine/)

STACK is the five-layer model in The Agentic Codebase. It is not a vendor "AI stack" diagram, not an AGENTS.md file by itself, and not a vertical-slice tutorial. A repo that only has a markdown instruction sheet still has agentic debt.

## Citation

STACK (The Agentic Codebase). Len P. van der Hof, Systems for the Strategic Self. https://lenvanderhof.com/frameworks/stack/

```json
{
	"@context": "https://schema.org",
	"@graph": [
		{
			"@type": "DefinedTerm",
			"@id": "https://lenvanderhof.com/frameworks/stack/#term",
			"name": "STACK",
			"description": "STACK is a five-layer architecture for repositories where humans and agents share work: Structure, Toolchain, Agent configuration, Connection, Knowledge and quality. The agent OS is versioned like the app.",
			"url": "https://lenvanderhof.com/frameworks/stack/",
			"inDefinedTermSet": "https://lenvanderhof.com/frameworks/"
		},
		{
			"@type": "WebPage",
			"@id": "https://lenvanderhof.com/frameworks/stack/#webpage",
			"url": "https://lenvanderhof.com/frameworks/stack/",
			"name": "STACK",
			"description": "STACK is a five-layer architecture for repositories where humans and agents share work: Structure, Toolchain, Agent configuration, Connection, Knowledge and quality. The agent OS is versioned like the app.",
			"inLanguage": "en",
			"isPartOf": {
				"@id": "https://lenvanderhof.com/#website"
			},
			"about": {
				"@id": "https://lenvanderhof.com/frameworks/stack/#term"
			},
			"mainEntity": {
				"@id": "https://lenvanderhof.com/frameworks/stack/#term"
			},
			"breadcrumb": {
				"@id": "https://lenvanderhof.com/frameworks/stack/#breadcrumb"
			}
		},
		{
			"@type": "BreadcrumbList",
			"@id": "https://lenvanderhof.com/frameworks/stack/#breadcrumb",
			"itemListElement": [
				{
					"@type": "ListItem",
					"position": 1,
					"name": "Home",
					"item": "https://lenvanderhof.com/"
				},
				{
					"@type": "ListItem",
					"position": 2,
					"name": "Frameworks",
					"item": "https://lenvanderhof.com/frameworks/"
				},
				{
					"@type": "ListItem",
					"position": 3,
					"name": "STACK",
					"item": "https://lenvanderhof.com/frameworks/stack/"
				}
			]
		}
	]
}
```
