The principle that the agent’s effective world consists only of what enters its context window. Anything that lives outside the repository, in Slack threads, Google Docs, meeting notes, or someone’s head, is invisible to the agent and therefore does not exist for any purpose the agent can act on.
Coined and made operational in Harness Engineering at OpenAI: the team’s design goal is not navigability for human engineers but legibility for Codex. They optimised the repo for the agent first.
Key
From the agent’s point of view, anything it can’t access in-context while running effectively doesn’t exist.
Knowledge in Slack, Google Docs, Notion pages, or tribal memory is illegible. To make it real, encode it into the codebase as markdown, schemas, executable plans, or code.
This is the inverse of the human assumption that “the documentation is the docs site, the alignment lives in chat, and the code is the code.” For agents, all three must be unified into one thing: versioned, repo-local artifacts.
Why this is a distinct principle
Agent-Friendly Codebase (Lucas Meijer’s Marble Madness metaphor) covers the navigation angle: the marble rolls down the level you build for it; smooth out friction so the agent does not waste tokens exploring.
Agent Legibility is broader. It is about the scope of what the agent can know at all:
| Concern | Question | Page |
|---|---|---|
| Navigation friction | Can the agent find what it needs without burning context? | Agent-Friendly Codebase |
| Scope of knowledge | Does the agent know X exists in the first place? | This page |
Smoothing navigation only matters for things inside the legibility envelope. The legibility envelope determines what is even reachable.
What becomes illegible by default
Without explicit work, every team accumulates illegible knowledge:
- Slack discussions that aligned the team on an architectural pattern
- Google Docs / Notion pages with PRD context
- Meeting decisions captured in someone’s head or a personal notes file
- Verbal team norms (“we don’t do X here” that nobody has written down)
- External documentation that the agent cannot fetch (auth-walled wikis, behind-VPN sites)
- Linear / Jira tickets containing the actual product intent
- Customer feedback that lives in the support inbox or sales calls
Each of these would be discoverable by a new human hire over weeks. The agent has no equivalent runway. Either the knowledge is in the repo or it does not exist.
How OpenAI made things legible
The transformation OpenAI applied to its repo:
- Slack and meeting alignments -> committed markdown in
docs/design-docs/ - PRDs from Google Docs ->
docs/product-specs/checked in - Architectural decisions ->
ARCHITECTURE.md+ per-domain design docs with verification status - Tech debt and known issues ->
docs/exec-plans/tech-debt-tracker.md - Quality grades per domain ->
docs/QUALITY_SCORE.md - External library docs the team cared about -> bundled as
docs/references/*-llms.txt - Plans for in-flight work ->
docs/exec-plans/active/versioned alongside code
The repository becomes the system of record. Not “a copy of what is also elsewhere”, but the canonical source.
The three legibility tiers
There is a useful three-tier hierarchy for how knowledge enters an agent’s context (reuses the structure from Agent Harness “What Belongs in the Always-Attached Set”):
| Tier | Mechanism | When it applies |
|---|---|---|
| Always-attached | System prompt + AGENTS.md (~100 lines, table of contents only) | Identity, invariants, where to look for more. See AGENTS.md Six Core Areas |
| On-demand | docs/ tree, structured and indexed | Specific design decisions, plans, references; agent reads when task matches |
| Tools-and-runtime | Custom lint messages, observability outputs, tool descriptions | Constraints surfaced as the agent acts; remediation injected into context. See Agent-Computer Interface (ACI) |
All three tiers are legible in the sense used here. Knowledge that is none of the three is illegible.
Why this is more than just “good documentation”
Three things distinguish agent legibility from the classic “keep your docs up to date” advice:
- The audience is the agent, not the human. Diagrams that work for humans (whiteboard photos, video walkthroughs) do not. Markdown, code, schemas, and structured tables do. Choose formats agents can actually parse.
- Verification is mechanical. A “doc-gardening” agent can lint for staleness, broken cross-links, or docs that contradict the code. Human-only docs depend on humans noticing rot.
- The cost of illegibility is silent. The agent does not raise an error when something it should have known is missing. It just produces a worse result. Failure is quiet, which makes it dangerous.
Concrete consequences for tech choices
When agent legibility is the design goal, several decisions shift:
- Prefer “boring” technologies. Composable APIs, stable behaviour, well-represented in the model’s training data. The OpenAI team explicitly notes this.
- Sometimes reimplement small libraries rather than absorb opaque upstream behaviour. OpenAI rewrote a
p-limit-style helper because they wanted it tightly integrated with their telemetry and 100% test-covered. The cost of “agent does not understand this dependency” can outweigh the cost of maintaining a small clone. - Generated artifacts go in the repo too. OpenAI ships a
docs/generated/db-schema.mdso the agent can read the schema without round-tripping to the database. - External docs get bundled in.
docs/references/uv-llms.txt,docs/references/nixpacks-llms.txt. If the agent might need it, ship it in-repo.
Failure modes
What happens when teams ignore legibility:
- The agent quietly diverges from team norms because the norms live in Slack.
- Architectural decisions get re-litigated every PR because the decision lives in a Google Doc the agent cannot read.
- Bug fixes pattern-match on broken code because the “we know that’s broken, don’t copy it” lives in a person’s head.
- The agent re-derives the same conclusion repeatedly across sessions, burning tokens and time.
These failures are silent and compound. By the time you notice, the codebase has accumulated weeks of off-norm code that the agent cannot help you fix because it does not know it is off-norm.
Application to regulated industries
For a payments / banking / healthcare context, agent legibility maps cleanly onto audit traceability. Both demand:
- Decisions captured in versioned, named artifacts
- Cross-linked rationale (“we did X because of decision Y on date Z”)
- Mechanical verification of doc-vs-code coherence
- Single source of truth for compliance-critical claims
The work to make a repo agent-legible is largely the same work an audit demands. Doing it for the agent gives you the audit story for free.
Related Concepts
- Harness Engineering at OpenAI — the case study where this principle was named
- Agent-Friendly Codebase — the navigation/friction sister concept; legibility is scope, friendliness is smoothness
- AGENTS.md Six Core Areas — the always-attached tier of legibility
- Context Engineering — the broader discipline; legibility is a sub-principle
- Agent-Computer Interface (ACI) — making constraints legible at the moment the agent needs them
- Self-Extending Agents — extensions are legible because they are files; same idea applied to capability
- Writing Specs for AI Coding Agents — specs as a primary legibility artifact
- Spec-Driven Development — gated phases as legibility checkpoints
- Agent Harness — “What Belongs in the Always-Attached Set” is the always-attached tier of this principle
Open Questions
- What is the minimum legibility investment that matters? Is
AGENTS.md+ a structureddocs/enough, or is the per-worktree observability stack also load-bearing? - How do you measure legibility? “Agent failed because it didn’t know X” is hard to detect post-hoc.
- For multi-team monorepos, who owns legibility? Can it be a platform team responsibility, or must each domain own its own?
- Does an agent-legible repo become less navigable for humans, or are the two compatible in practice?