CASE 05 // 2025

Guardian MCP

An AI agent's memory and safety net. Learned about moats the hard way.

ROLE
Creator & Maintainer
STACK
TypeScript · MCP Protocol · tree-sitter
UPDATED
2026-07-10
Guardian MCP documentation

Guardian MCP was my open-source MCP server that gave AI coding agents persistent memory and safety rails: AST-parsed code search over tree-sitter, decision tracking, and gated engineering workflows. Frontier models improved past the need, and I sunset it. The postmortem taught me more than the launch.

“I built a moat out of model weaknesses. The models got better, and the moat evaporated in one release cycle.”

— Gagan Raj

CONSTRAINTS

  • AI agents hallucinate config values and break patterns they cannot see
  • Code search had to be structural, not string matching
  • Solo project: built for my own use first, productised second

THE BUILD

In 2025, AI coding agents had a memory problem: they would hallucinate a port number, forget an architectural decision made two sessions ago, and cheerfully break patterns the codebase had established. Guardian MCP was my fix: an MCP server that parsed the repository with tree-sitter, answered structural queries about functions and call sites, recorded decisions, and gated risky edits behind explicit workflows.

It worked, and I used it daily. I attempted the SaaS version, and then the frontier models absorbed the use case: longer context, better recall, native code understanding. The features I had built as a product became model capabilities. I sunset it rather than sell a patch for a problem that was disappearing.

The lesson was worth the build: a moat made of model weaknesses is a lease, not an asset. Whatever I build in AI tooling now has to survive the models getting better, because they will.

DECISIONS — INCLUDING THE REJECTED ONES

Code understanding

CHOSE AST parsing with tree-sitter

REJECTED Regex and embedding search

Agents ask structural questions: who calls this, what shape is this config. Text similarity answers a different question than the one being asked.

Safety model

CHOSE Gated workflows: analyse, plan, approve, then edit

REJECTED Advisory warnings the agent could ignore

A guardrail an agent can skip is a suggestion. Gates made the failure mode inspection instead of cleanup.

End of life

CHOSE Sunset publicly and keep it open source

REJECTED Pivoting to chase the models

The honest read was that the problem was evaporating. Shutting down cleanly cost less than pretending otherwise.

OUTCOME

  • Open-source MCP server, used daily in my own workflow at its peak
  • AST-parsed search, decision memory, and gated edits for AI agents
  • Sunset deliberately when frontier models absorbed the use case

CRAFT LEDGER

  • tree-sitter AST search
  • Decision memory
  • Gated engineering workflow
  • MCP protocol server