The End of the Stale README: Inside theDakshJaitly/mex

How a zero-token drift detector turns AI context files into a deterministic database, giving coding agents a flawless long-term memory.

7 min read • View on GitHub • More from theDakshJaitly

A massive, intricate clockwork automaton trying to build a modern suspension bridge, but it is reading from a crumbling, moth-eaten paper scroll that is actively disintegrating.
Context window amnesia: when your AI agent is operating on outdated documentation.

I finally built a better version of NGL, in 9 days with no code experience No bots. No cringe. Just real anonymous questions. It’s called Ask To Know —and MVP is live now. 🔗asktoknow.vercel.app Here’s what it does 🧵

Daksh Jaitly, Creator · Daksh on Medial
Key Takeaways

The Context Rot Epidemic

In the era of AI-assisted development, your coding agent is only as good as its context window. We feed Claude and Cursor detailed .cursorrules and architecture documents, expecting them to act as a flawless co-pilot. But codebase reality moves faster than documentation. Files are renamed, dependencies are swapped, and architectural decisions pivot.

The result is context rot. The AI confidently writes deprecated patterns because its instructions are three months out of date. The very tools meant to accelerate development end up causing friction when their foundational knowledge is stale.

Portrait of Daksh Jaitly in a WSJ hedcut style

The Zero-Token Philosophy

The naive solution to context rot is to throw more AI at the problem: ask an LLM to read the codebase and update the docs. This is slow, expensive, and prone to hallucinations. mex takes a radically different approach. It skips the AI entirely for the detection phase.

Instead, mex uses deterministic Abstract Syntax Tree (AST) parsing. It treats markdown not as a loose text file, but as a structured database of "claims" about the codebase. This makes drift detection fast enough to run as a pre-commit hook, bringing milliseconds-fast verification to AI memory.

A precise, vintage mechanical sorting machine separating structural gears from a long ribbon of text.
Deterministic AST parsing separates hard facts (code paths) from unstructured text, without spending a single token.
FeatureNaïve AI Doc Syncmex Deterministic Sync
Detection PhaseLLM Context Window (Slow, expensive)AST Claim Extraction (Milliseconds, zero-token)
VerificationSemantic search and "vibes"<code>fs.existsSync</code> and <code>simple-git</code> history
Fix PhaseRewrite entire fileTargeted surgical brief prompting

Extracting Claims from the AST

The core engine lives in src/drift/claims.ts. mex uses remark to parse Markdown into an AST, systematically hunting for structured information. When it finds an inline code block like `src/api/auth.ts`, it registers a "Path Claim." When it finds bold text in a tech stack section, it registers a "Dependency Claim."

The Claim Extraction Pipeline: turning unstructured markdown into testable assertions.

To avoid false positives, mex employs sophisticated filtering. URL routes or random code snippets that resemble file paths are ignored. It even detects if a claim exists within a "negated section" (e.g., "What we don't use"), demonstrating an understanding of how developers actually structure documentation.

Gamifying the Hippocampus

Documentation is only maintained if there are consequences for neglecting it. mex introduces a gamified scoring system in src/drift/scoring.ts. The documentation health starts at a perfect 100/100.

Eight distinct checkers enforce this score. A broken file path or missing dependency results in a severe 10-point deduction. Stale files—detected via simple-git commit analysis—trigger a 3-point penalty. This transforms doc maintenance from a chore into a passing or failing CI build.

A close-up of an ornate analog pressure gauge with the needle in a critical zone, and a drop of ink about to fall on a ledger.
The scoring system enforces strict penalties for documentation drift.

The Surgical Sync

When the score drops and drift is detected, mex finally engages the LLM—but not with a blind "fix this" prompt. Instead, it builds a highly specific Targeted Brief.

By passing only the exact broken claims to the AI, mex instructs it to perform surgical edits. This preserves crucial YAML frontmatter, saves tokens, and prevents the LLM from hallucinating unnecessary changes. It's a precise, efficient mechanism that ensures your AI agent always operates with a flawless, up-to-date memory.