Skip to main content
ContextMarmot logo

ContextMarmot

A graph-based memory engine for agentic systems. Structured context over MCP, instead of raw files.

Agents Are Drowning in Files

The Problem

Coding agents burn tokens re-reading files to rebuild context that already existed two turns ago. Raw files are the worst possible representation: unstructured, redundant, and oblivious to the relationships that actually matter.

Conversation history decays. Ad-hoc retrieval returns disconnected chunks. The agent ends up exploring broadly, paying for it, and still missing the edge that would have answered the question in one hop.

The Graph

ContextMarmot gives agents a persistent knowledge graph: nodes are Obsidian-compatible markdown with YAML frontmatter and [[wikilinks]], edges are typed and directed. Agents query and write via five MCP tools and get back a compacted subgraph, not a file dump.

Agent  →  MCP Server  →  Embed + Search + Traverse + Compact  →  XML context

What's in the Box

A single Go binary. Zero CGo, zero runtime dependencies. Everything below ships in one build.

Semantic Search

Embedding index with graph-traversal expansion. Ask in natural language, get a connected subgraph instead of a pile of chunks.

Typed, Directed Edges

Structural edges (contains, imports, extends, implements) stay acyclic. Behavioral edges are free to loop. The graph enforces the difference.

Token-Budget Compaction

Results are compacted into XML that fits your context window, with full / compact / truncated tiers chosen automatically.

CRUD Classifier

Writes are auto-classified as ADD, UPDATE, SUPERSEDE, or NOOP using embeddings plus an optional LLM tiebreaker.

Multi-Namespace Graphs

Projects stay isolated. Bridge manifests describe cross-namespace and cross-vault edges so a repo graph can talk to a team graph.

Static Analysis Indexer

Parses Go (full AST), TypeScript, and 30+ languages into graph nodes with typed edges. No manual authoring required.

The Graph, Up Close

An embedded D3 web UI ships with the binary. Filter, search, overlay heat maps, group by folder, and curate the graph through a chat interface with slash commands and node-reference pills.

Multi-namespace graph with bridge arcs connecting separate vaults
Multi-namespace graph with bridge arcs
Chat-driven graph curation interface with node-reference pills
Chat-driven graph curation
Node detail panel showing edges, tags, and summary
Node detail panel with edges, tags, and summary
Graph view with organic contour hulls grouping nodes by folder
Folder grouping with organic contour hulls

Same Quality. Lower Cost.

Evaluated on 20 code-comprehension questions from the SWE-QA benchmark across django, flask, pytest, and requests. The graph acts as a navigation map — agents query it first, then read only the files and line ranges it identifies.

MetricVanillaHybridΔ
Answer quality (1–5)4.624.62identical
Tokens per question151,32795,876−37%
Cost per question$0.1065$0.0834−22%
Avg turns7.56.9−8%

Full methodology and per-question breakdown in docs/benchmark.md.

How It Works

1

Index

marmot index runs static analysis on your source and builds a graph of nodes with typed edges, stored as Obsidian-compatible markdown.

2

Query

Agents call context_query over MCP with a natural-language question. The engine embeds, searches, and seeds a traversal.

3

Traverse

BFS expands along hot edges first. A heat map tracks co-access frequency with exponential decay so the graph learns which paths matter.

4

Compact

Results are serialized to XML, pruned to the token budget, and returned as a self-contained subgraph the agent can reason over.

Obsidian-compatible vault 5 MCP tools over stdio Go 1.21+, single static binary

Give Your Agents a Memory

ContextMarmot is Apache 2.0, open source, and part of how we ship reliable agent workflows at Cloud Gatherer Labs. Clone the repo, run marmot init, and wire it into your coding agent today.