Lat.md: Agent Lattice: a knowledge graph for your codebase, written in Markdown
TL;DR Highlight
Replace a flat AGENTS.md with a linked markdown graph that lat check keeps in sync with code.
Who Should Read
A developer whose AGENTS.md keeps growing and whose coding agent misses context as the codebase scales.
Core Mechanics
- One AGENTS.md file doesn't scale
- A single flat file becomes impractical as a codebase grows.
- Key design decisions get buried and business logic goes undocumented.
- Agents hallucinate context they should be able to look up.
- A markdown graph lives in lat.md/
- Sections link to each other with [[wiki links]].
- Markdown links to code symbols like [[src/auth.ts#validateToken]].
- Source files link back with // @lat: [[section-id]] comments.
- lat check catches drift between docs and code
- It enforces referential consistency of links and refs.
- Agents call it automatically before finishing work.
- Agents search the graph instead of grepping
- lat search and lat section surface design decisions and constraints.
- By default it uses a local embedding model (all-MiniLM-L6-v2, WebAssembly), so no API key is needed.
- An OpenAI or Vercel AI Gateway key switches to hosted embeddings.
- Test specs can be enforced too
- Write test cases as lat.md/ sections marked require-code-mention: true.
- lat check flags any spec with no // @lat: backlink in test code.
- Review lat.md/ changes first
- Agents maintain the lat files, so humans read the semantic changes first.
- Code review becomes the secondary task.
- Context captured in the graph persists across sessions.
Community Reactions
- A tool now does the job one person did by hand
- One commenter already had md files and custom skills but was the one linking docs to code and checking consistency.
- lat check now does that, and they are rolling it out across all their repos.
- They said they haven't run rigorous tests.
- Pushback: where is the evidence
- Several commenters asked for a benchmark against a big AGENTS.md, nested AGENTS.md, or skills.
- One said a 10% improvement in their repo would make them push for adoption.
- Alternatives from commenters
- One reported AST/RAG sweeps plus LSP drill-down cut their search phase by 50%.
- Another said small markdown files per folder keep Claude and Codex grounded in a 10M+ LOC C/C++ codebase.
- Others use mkdocs or vitepress and say rendering docs for humans keeps them reviewed.
- Concerns about multi-agent setups
- One asked how merge conflicts are handled with multiple agents.
- The creator joined the thread for an AMA and shared two videos.
How to Apply
- Try lat on a repo now
- In a small repo, run npm install -g lat.md and then lat init.
- Write one or two core design docs in lat.md/ and run lat check.
- Slim AGENTS.md down to a pointer
- Move design decisions and domain rules into lat.md/ sections.
- Leave only instructions in AGENTS.md to find and update them via lat search and lat section.
- Add lat check to CI
- Use vercel-labs/lat.md@action-v1 in GitHub Actions.
- Let validation errors fail the job.
- Enforce backlinks on test specs
- Set require-code-mention: true in tests.md.
- Add // @lat: [[section]] comments in tests and use lat check to find gaps.
Try It
# Run in a shell (requires Node.js)
npm install -g lat.md
cd {{path to your project}}
lat init
lat locate "{{section name}}"
lat search "{{question}}"
lat checkTerminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques