MEX: The Git-Native Memory Layer for Humans and Coding Agents
A local-first system that stores team context in the repo, routes AI attention through structured files, and verifies that documentation still matches the code.
- MEX treats memory as part of the repository, so context, code, and history stay versioned together.
- Its real trick is not storage but trust, because schemas, parsing, and drift checks keep memory tied to evidence.
- The router loads only the context a task needs, which makes agent attention selective instead of noisy.
- Relays turn handoffs into durable objects, so the next person or agent can continue without a meeting.
MEX starts with a simple inversion: the repo is not just where code lives, it is where team memory lives too. That matters because coding agents do not merely need more context. They need context that survives commits, handoffs, and code changes without drifting away from reality.
Why MEX Exists
The problem MEX is trying to solve is not subtle. AI coding assistants forget what happened in the last session, and human teams still spend time re-explaining decisions that should have been durable. MEX says the right place for that memory is alongside the code, in `.mex/`, where it can travel with Git instead of living in a separate SaaS layer.
The original idea was to stop coding agents from relearning the same project every session. mex gives them a structured Markdown wiki inside .mex/ for architecture, conventions, decisions, patterns and project state. That solves forgetting.
The Repo Becomes the Memory
The local-first idea is the heart of the project. Instead of pushing knowledge into a hosted database, MEX stores context, patterns, events, and handoff data in the repository itself. That means a checkout from six months ago does not just restore source code. It restores the team’s understanding of that code at that moment.
The Contract Layer That Keeps Everyone Honest
MEX’s contract layer is where the system stops being a nice idea and becomes infrastructure. In `packages/hub-contracts`, Zod schemas and shared TypeScript types define what counts as a relay, a job, a spec, or a problem detail. The point is bigger than validation. It means the repo’s memory speaks a protocol, not vibes.
import { z } from 'zod';
export const RelaySchema = z.object({
id: z.string(),
observedState: z.string(),
blockers: z.array(z.string()).default([]),
nextActions: z.array(z.string()).default([]),
});
export const HubProblemDetailsSchema = z.object({
type: z.string().url().optional(),
title: z.string(),
status: z.number().int(),
detail: z.string().optional(),
instance: z.string().optional(),
});
That matters because memory systems usually fail at the edges. They store text, but not enough structure to know whether the text still matches the world. MEX tries to make every claim auditable, from project state to filesystem paths, with the same rigor you would expect from an API contract.
Relays Turn Handoffs Into Data
The relay concept is the most human part of the system. A relay captures what was observed, what is blocked, and what should happen next, so the next person or agent does not need a meeting just to reconstruct momentum. It turns “where I left off” into something versioned and reviewable.
| Old handoff | MEX relay |
|---|---|
| A teammate explains the state again in a meeting. | A relay records the observed state, blockers, and next actions. |
| Important details live in chat threads. | Important details live beside the repo history. |
| The next person starts by asking questions. | The next person starts with a structured baton pass. |
| Context disappears when the session ends. | Context survives as a durable object in Git. |
Deterministic Parsing Over Vibes
MEX is unusually serious about proof. Tree-sitter builds a local code graph, and the evaluation suite checks whether that graph and the linked documentation still line up. That is a different bet from a fuzzy semantic memory store. It says the best grounding comes from parsing the code, not guessing what the code probably means.
| Deterministic grounding | Semantic retrieval |
|---|---|
| Anchors claims to concrete symbols and files. | Returns nearby text that may be relevant. |
| Can flag drift when code and docs diverge. | Can recall similarity without proving correctness. |
| Fits engineering workflows where exactness matters. | Fits conversational recall and broad recall tasks. |
| Feels like infrastructure. | Feels like memory assistance. |
What MEX Is, and What It Is Not
MEX is not a general wiki, and it is not just another vector database with a UI. It is closer to a repo-native memory protocol for engineering teams that want AI context to be local, versioned, and trustworthy. That puts it in a different category from tools like Mem0, Zep, Cognee, or commercial coding assistants.
| Tool type | Typical model | How MEX differs |
|---|---|---|
| Traditional wiki | Documents live outside the repo. | MEX keeps memory in Git and ties it to code history. |
| Semantic memory store | Conversation-first retrieval. | MEX focuses on architectural and symbol-grounded knowledge. |
| Generic coding assistant | Large context dump and prompt steering. | MEX routes only the files the task actually needs. |
| Broad AI memory framework | Flexible infrastructure. | MEX is opinionated about engineering truth and drift detection. |
The bigger bet is simple: team memory should behave like source code. It should be reviewable, diffable, and tied to a commit. MEX is interesting because it treats memory as an engineering problem, not a prompt trick.





