``

lat.md transforms static folders into a validated knowledge graph by automatically linking code to documentation using referential integrity.
As AI becomes a bigger part of how we write code, developers are hitting a critical infrastructure problem: AI models can only "see" a small part of a project at once. When projects get large, simply dumping thousands of files into an LLM context window doesn't work well. It consumes resources, causes context hallucination, and leads to the AI missing the big architectural picture.
For context-aware coding, precision is king. This is where lat.md comes in. lat.md is a powerful open-source agent tool that builds a queryable knowledge graph from your code and documents, ensuring that your documentation remains synchronized with your implementation. In fact, this approach goes beyond simple search; it actively prevents information drifts that defeat AI efficiency.
lat.md, also known as Agent Lattice, is a system designed to solve the "Context Drift" problem.
While traditional documentation (like README files) attempts to explain what code does, developers often struggle with "why." A standard file becomes a nightmare to maintain as a project scalesโit becomes too long for context windows, and links often go stale.
lat.md solves this by treating documentation not as a static file, but as a living part of your codebase. It scans your local environment to map relationships between functions, classes, and notes.
Key to its design is Referential Integrity:
"The map is how the AI understands your project. Everything else is just guessing." Don't just expect your AI tool to "understand" your folder structure based on raw text parsing. Basic file tracking is messy. By using lat.md, you are essentially building a database schema for your documentation. If you want your AI to be a credible engineering partner, you must stop feeding it a "Pile of Code" and start feeding it a "Validated Graph."
lat.md operates on a relatively simple but effective architecture for local LLM orchestration:
loginUser() function) are marked in the graph.This is the hardest part of the workflow to set up but the most impactful. By using the check command (or setting it up to run on save), lat.md acts as a linter.
lat.md in project root. Tool detects setup markers (e.g., .lat.md/config.json).Class A โ Method B โ Documentation Node C).Method B matches Documentation Node C.Follow these steps to implement a validated knowledge graph for a new or existing project.
Step 1: Installation & Initialization You don't need Docker. You just need the CLI.
# Install the package (pip/nuget/npm equivalent logic, substituting generic command)
npm install -g lat-md
# or
pip install lat-md
# Navigate to your project
cd /path/to/your/repo
# Run setup
lat-md init
Step 2: Define Rules & Select AI
The interactive setup asks which AI tools you use (e.g., Cursor, Claude, Copilot). It creates a map directory that holds your graph data. It writes a "shim" or prompt instructions for your AI tools to consult this map instead of reading raw files when possible.
Step 3: The First Scan (Offline)
Run the graph builder. It scans your entire node_modules, assets, and source code.
Important: No data leaves your terminal. This is a secure, private operation suitable for regulated data environments.
Step 4: Enforce Summaries Create a note for a new feature. Ensure you include a short summary (3 sentences max) at the top.
## Connection Logic
This function connects to the legacy database...
...
Why? This summary acts as the "digest" the AI uses to decide relevance.
Step 5: Enable Auto-Checks
Set up a git pre-commit hook or a VS Code task that runs lat-md check before saving.
Now, every time you change code and commit, lat.md verifies that your document matches the code. If you delete a function but forget the doc, the next git commit fails until you fix it.
While tools like Graphify or Vector databases are powerful, lat.md has a specific niche.
| Feature | lat.md | Vector Databases (e.g., Weaviate) | Traditional Docs |
|---|---|---|---|
| Primary Goal | Referential Integrity | Semantic Search | Human Readability |
| Data Type | Structured Graph | Unstructured Vectors | Text Files |
| Validation | Runtime Checks | No (Retrieval only) | Manual |
| Responsibility | Automation | Search Engine | Maintenance |
| Use Case | Context-aware coding | RAG applications | Manuals |
lat.md is still in its growth phase. In the coming updates, we expect to see stronger support for complex C++ or Rust codebases and deeper integration with LLM workflows where the AI actively writes the documentation to keep the graph valid.
map folder just like your code.lat.md represents a shift from "hosting" code to "orchestrating" knowledge. By moving your AI tools from a reactive search model to a validated graph model, you reduce token waste and improve architectural intent understanding.
Don't let your documentation sit on a server collecting dust. Use lat.md to make your data a living, breathing part of your development lifecycle.
Deploying long-running agents in a regulated environment? Let's talk.