Give your AI agent a memory that lives with the code.
AgentInfra is a zero-dependency, convention-based knowledge layer for AI-assisted development. Drop a .ai/ directory into any project, and your agent instantly understands the architecture, design decisions, tech stack, and history β without re-reading every file from scratch.
No servers. No databases. No embeddings. Just markdown.
The superpowers skill system proved something important: structured markdown is all an LLM needs to dramatically change its behavior. A well-written .md file can turn a generic agent into a domain expert β better at debugging, better at TDD, better at code review. No servers, no embeddings, just a file the agent reads.
This was a breakthrough. But it also revealed a gap.
Skills teach an agent how to work β workflows, processes, techniques. They're generic by design: the same TDD skill works on a Python CLI and a React SPA. The same debugging skill applies to every codebase.
But they can't teach an agent what your project is:
- What's the architecture? What modules exist and how do they interact?
- Why was PostgreSQL chosen over MongoDB? Why REST instead of GraphQL?
- What conventions does your team follow? What patterns are forbidden?
- What's the tech debt? Where are the landmines?
This knowledge is project-specific. It doesn't belong in a global skill. It changes as the project evolves. And without it, every session looks like this:
Session 1: "Let me grep for the auth module... read 15 files... ah, it uses JWT..."
Session 2: "Let me grep for the auth module... read 15 files... ah, it uses JWT..."
Session 3: "Let me grep for the auth module... read 15 files... ah, it uses JWT..."
The agent re-reads source files, re-infers architecture, re-discovers conventions, re-deduces decisions β burning thousands of tokens and minutes on knowledge it already had yesterday. Skills made the agent a better engineer, but a better engineer without project context is still lost on day one.
When a new engineer joins your team, you don't just teach them "how to debug." You give them:
- An architecture overview
- Design principles the team follows
- Why certain technology choices were made
- A history of key decisions
- Where the bodies are buried (tech debt)
Skills are the training program. But agents also need the onboarding β and they need it every single session.
If a 200-line skill file can teach an agent how to debug, a 200-line architecture doc can teach it what your system does β and it'll remember across every session.
AgentInfra applies the same "structured markdown" approach that skills validated, but to a different problem: persistent, project-specific knowledge. Skills teach process. AgentInfra teaches context. Together, they give the agent both capability and understanding.
The AI tooling ecosystem has produced many approaches to the "agent context" problem. Here's how they differ:
| RAG / Vector DB | AgentInfra | |
|---|---|---|
| Infrastructure | Embedding pipeline + vector DB + retrieval server | Zero. Just .md files in your repo |
| Retrieval quality | Semantic similarity (often noisy, misses context) | LLM reasoning via decision tree (precise, explainable) |
| Transparency | Black box β you can't read what the agent "knows" | Every piece of knowledge is a readable, diffable .md file |
| Maintenance | Re-index on every code change, manage drift | Agent updates docs as it works, human reviews via git diff |
| Cost | Embedding API calls + DB hosting + retrieval latency | Zero runtime cost. Zero API calls. Zero latency |
| Setup time | Hours to days (configure, embed, tune) | Minutes (create .ai/, write CLAUDE.md) |
RAG solves the problem of searching large corpora. But project knowledge isn't a search problem β it's a structure problem. You don't need to "find" your architecture; you need it presented clearly every time.
| MCP | AgentInfra | |
|---|---|---|
| Purpose | Connect agents to external tools and data sources | Give agents persistent project understanding |
| Architecture | Client-server protocol, requires running servers | Zero architecture. Files in a directory |
| Scope | Tool connectivity (APIs, databases, services) | Project knowledge (architecture, decisions, conventions) |
| Setup | Configure servers, manage connections, handle auth | Copy templates, write markdown |
| Portability | Platform-specific server implementations | Works anywhere markdown is readable |
MCP and AgentInfra solve different problems. MCP gives agents hands (tools); AgentInfra gives agents a brain (knowledge). They're complementary β an agent with both MCP tools and .ai/ knowledge is more capable than either alone.
| Skills (superpowers, etc.) | AgentInfra | |
|---|---|---|
| What they teach | How to work (workflows, processes, techniques) | What the project is (architecture, decisions, context) |
| Scope | Generic β same skill across all projects | Project-specific β different .ai/ for every repo |
| Evolution | Static β updated by skill author | Living β agent updates docs as the project evolves |
| Location | Installed globally or per-user | Lives in the repo, versioned with the code |
Skills teach an agent to be a better engineer. AgentInfra teaches it to understand your project. A skilled agent without project knowledge is like a senior dev on their first day β capable but lost.
| Single instruction file | AgentInfra | |
|---|---|---|
| Scalability | One file grows unbounded (500+ lines = token waste) | Structured multi-file, load only what's relevant |
| Loading | Everything, every time | Three-layer: always β task-driven β on-demand |
| Maintenance | Manual, often stale | Agent auto-maintains, drift detection built in |
| Structure | Freeform, inconsistent | Templates, frontmatter, conventions |
| Separation of concerns | Rules, context, commands all mixed together | Architecture, features, history each in their own file |
CLAUDE.md is a great starting point. AgentInfra is what you graduate to when your project outgrows a single file. And they work together β CLAUDE.md becomes the router that points to .ai/.
| Built-in Memory | AgentInfra | |
|---|---|---|
| Storage | Platform-specific, hidden in ~/.claude/ or cloud |
In your repo, visible, git-tracked |
| Loading | Passive β agent must explicitly read | Active β CLAUDE.md drives loading protocol |
| Shareability | Per-user, not shared with team | In the repo β every collaborator (human or agent) sees it |
| Structure | Flat key-value notes | Layered knowledge: core β features β evolution |
| Review | Hard to audit what the agent "remembers" | git diff on every knowledge update |
| Portability | Locked to one platform | Works with any agent that reads files |
Built-in memory is personal notes. AgentInfra is team documentation β except the agent writes and reads it.
High Structure
β
AgentInfra βββββ€
β
Skills βββββββββββββββΌββββββββββββ RAG
β
CLAUDE.md βββββββ€
β
Low Structure
β
βββββββββββββββββββββββΌββββββββββββββββββββββ
Zero Infrastructure Heavy Infrastructure
AgentInfra sits in the high structure, zero infrastructure quadrant β the sweet spot for project knowledge.
No servers. No databases. No build steps.
No embeddings. No vector stores. No API calls.
No configuration files. No package installation.
Just .md files in a directory.
Any project can adopt AgentInfra in under 5 minutes. If you can create a directory and write markdown, you can use it.
Most context solutions dump everything into the prompt. AgentInfra uses three-layer loading to minimize token waste:
| Layer | What | When | Cost |
|---|---|---|---|
| L1 | CLAUDE.md β index table + instructions |
Every session (auto) | ~400 tokens |
| L2 | Relevant .ai/ docs β matched by task type |
Session start (decision tree) | ~2000-4000 tokens |
| L3 | Source code β referenced in .ai/ docs |
When needed (on-demand) | Varies |
Typical session: ~4000-5000 tokens total (~2.5% of a 200K context window).
Compare this to RAG systems that retrieve 10-20 chunks at ~500 tokens each, often with low relevance. Or to a bloated CLAUDE.md that loads 3000+ tokens of instructions for every task, whether relevant or not.
Knowledge that isn't maintained becomes a lie. AgentInfra solves this by making the agent responsible:
- Trigger-based updates β agent knows when to update which docs (new feature β update feature doc, new dependency β update tech-stack)
- Drift detection β at session end, agent checks if code changes are reflected in
.ai/docs - Separate commits β
docs(.ai): ...commits let humans review knowledge updates independently - Quality checklist β agent self-checks for hallucinated paths, stale versions, and index drift
The agent maintains. The human reviews. Git tracks everything.
The core/ β features/ β evolution/ structure is a convention, not enforcement:
- Add custom directories:
.ai/api/,.ai/integrations/,.ai/runbooks/ - Modify templates to match your team's documentation style
- Adjust loading rules for your workflow
- Use any subset β a 3-file
.ai/is just as valid as a 30-file one
git clone https://github.com/JayCheng113/AgentInfra.git /tmp/agentinfra
cp -r /tmp/agentinfra/.ai/ your-project/.ai/This gives you the loading rules, maintenance protocol, and templates. No CLAUDE.md yet β the agent will generate it.
Open a session in your project and tell the agent:
"Read
.ai/templates/init-core.mdand.ai/templates/claude-md.md, then analyze this codebase and generate the full.ai/knowledge base includingCLAUDE.md."
The agent will:
- Scan your code structure and infer architecture
- Detect tech stack from config files (package.json, pyproject.toml, etc.)
- Generate
CLAUDE.mdwith your project's identity, index table, and rules - Populate
core/,features/, andevolution/docs - Commit everything for your review
Check the generated .ai/ files. The agent's first pass won't be perfect β correct inaccuracies, adjust principles, fill in context only you know. Commit.
From now on, every session automatically benefits from .ai/ knowledge. The agent reads what it needs, works on your task, and updates the docs when it's done.
your-project/
βββ CLAUDE.md # L1 entry point (always loaded)
β # Contains: project identity, index table,
β # loading/maintenance instructions
βββ .ai/
β βββ _loading-rules.md # Decision tree: which docs for which task
β βββ _maintenance-rules.md # When and how to update knowledge
β β
β βββ core/ # Stable foundation (changes rarely)
β β βββ architecture.md # System design, module boundaries
β β βββ principles.md # Design principles, conventions
β β βββ tech-stack.md # Languages, frameworks, rationale
β β
β βββ features/ # Per-module knowledge (grows with project)
β β βββ _template.md # Template for new feature docs
β β βββ auth.md # Example: auth module design
β β βββ payments.md # Example: payment module design
β β
β βββ evolution/ # Project timeline (append-only)
β β βββ history.md # ADRs and milestone log
β β βββ roadmap.md # Planned work
β β βββ tech-debt.md # Known issues, prioritized
β β
β βββ templates/ # Document templates
β βββ adr.md # Architecture Decision Record
β βββ claude-md.md # CLAUDE.md template
β βββ init-core.md # Bootstrap guide
β
βββ src/ # Your actual code
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Session Start β
β β
β 1. Agent reads CLAUDE.md (auto-loaded) β
β β Gets project identity + knowledge index β
β β
β 2. Agent reads _loading-rules.md β
β β Classifies task β follows decision tree β
β β Loads only relevant .ai/ docs β
β β
β 3. Agent works on the task β
β β Full project context without re-reading everything β
β β
β 4. Agent runs maintenance protocol β
β β Updates affected .ai/ docs β
β β Runs drift detection β
β β Commits separately: docs(.ai): <summary> β
β β
β Result: Next session starts with updated knowledge β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The agent classifies each task and loads accordingly:
| Task Type | What Gets Loaded | Budget |
|---|---|---|
| Modify a feature | Target module's feature doc + architecture | β€ 3 docs |
| Fix a bug | Affected feature doc + tech-debt | β€ 3 docs |
| Refactor | Tech-debt + roadmap + affected feature docs | β€ 5 docs |
| New feature | Adjacent module docs + principles + roadmap | β€ 3 docs |
| Tooling/CI | Usually none | β€ 1 doc |
This is LLM-native retrieval β the agent uses its own reasoning to decide what's relevant, not keyword matching or semantic similarity.
This repo includes two example projects:
examples/minimal/ β Python CLI Tool
A word-counter CLI with just 3 .ai/ files. Shows that small projects need only a lightweight subset.
examples/web-app/ β FastAPI Web Application
A task management API with auth, status workflows, and background workers. Shows the full three-layer system with feature docs, ADRs, and tech debt tracking.
Does this only work with Claude Code?
No. AgentInfra uses CLAUDE.md as the entry point because Claude Code auto-loads it, but the .ai/ convention works with any agent that can read files. Cursor, Codex, Windsurf, Copilot β if it reads markdown, it reads .ai/.
What if my project already has a CLAUDE.md?
Add the knowledge base section to your existing file. AgentInfra's CLAUDE.md template is designed to coexist with your existing rules and instructions.
How is this different from just writing good docs?
Three ways: (1) It's structured for agents, not humans β frontmatter, decision trees, templates. (2) Agents maintain it β you don't have to remember to update docs. (3) It has a loading protocol β agents don't read everything, just what's relevant.
Won't the .ai/ files get stale?
The maintenance protocol includes drift detection β at session end, the agent checks if code changes are reflected in .ai/ docs. This isn't perfect, but it's dramatically better than documentation that's only updated when humans remember to.
What about monorepos?
Each package/service can have its own .ai/ directory. The root CLAUDE.md can point to multiple .ai/ locations.
- Fork the repo
- Create a feature branch
- Make your changes β follow
.ai/core/principles.md - Commit knowledge updates separately:
docs(.ai): <summary> - Open a pull request
MIT β Copyright (c) 2026 AgentInfra Contributors