Manthan
Manthan is a deterministic, Git-native MCP memory server for AI agents.
Search working and constitutional memory with BM25, namespace/glob, tags, limits, stale/constitution filters, and Git SHA provenance.
Atomically commit validated Markdown memories with agent/trace metadata, tags, supersession, and optional staleness/expiry.
Propose constitutional rules/ADRs as draft guardrails for human review, optionally on an isolated Git branch.
Audit memory lineage/time-travel via Git commit history and diffs.
Rebuild/synchronize the SQLite FTS5 sidecar index and stamp current Git HEAD.
Fetch/rank memories by multi-tag AND/OR, keywords, document type, trust tier, namespace, with snippets.
Expose MCP resources for constitution, active context, and status/health.
Uses Git as the single source of truth for agent memory, storing every memory state update, architectural decision, and session handoff as an atomic Git commit with author-agent and trace metadata. Provides commit SHA provenance for recall operations and supports lineage auditing and time-travel via Git commit history.
Maintains an embedded SQLite FTS5 sidecar index (via node:sqlite with BM25 ranking) to provide sub-5ms deterministic lexical retrieval across stored memory artifacts, with support for full index rebuilds and synchronization with the current Git HEAD.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Manthan Recall the payment API idempotency rule and show its Git commit provenance."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🏛️ Manthan Blueprint (@kidakaka/manthan-mcp)
Commercial-Grade, Git-Native, Deterministic Memory Engine for AI Agents via Model Context Protocol (MCP)
Unlike probabilistic vector-only memory layers that suffer from black-box semantic drift and silent hallucinations, Manthan treats agent memory as version-controlled state ("Memory-as-Code").
Git is the Single Source of Truth: Every state update, architectural decision, and session handoff is an atomic Git commit with full author-agent and observability trace metadata.
Embedded SQLite FTS5 Sidecar Index: Uses Node's built-in
node:sqlite(DatabaseSyncwith BM25 ranking) for sub-5ms deterministic lexical retrieval with zero native C++ compilation dependencies on Windows, Linux, and macOS.Git Commit SHA Provenance: Every memory recall operation returns cryptographic commit SHA provenance, providing reproducible time-travel and compliance auditing.
📢 Calling Early Adopters & Agent Builders!
We need real-world user feedback more than code contributions right now.
If you are building with Claude Code, Cursor, Windsurf, or Google Antigravity, we want your feedback: Does deterministic Git-backed memory eliminate the state drift and hallucinations you experience with probabilistic vector stores?
👉 Read our Early Adopter & Contributor Guide | 💬 Join GitHub Discussions
System Overview
Manthan is an open-source, deterministic, Git-native memory engine for AI coding agents exposed through the Model Context Protocol (MCP). It stores agent memories as structured Markdown artifacts with strict YAML frontmatter, archives historical state transitions via atomic Git commits, and provides sub-5ms BM25 lexical recall via an embedded SQLite FTS5 sidecar index (node:sqlite).
workspace/
├── .manthan.yaml # Declarative engine configuration
└── .manthan/
├── index.db # Ephemeral SQLite FTS5 BM25 search sidecar (gitignored)
└── memory/
├── working/ # Active mutable memory (Read/Write)
│ └── backend/
│ └── mem_01j9x8.md
└── constitution/ # Architectural guardrails & ADRs (Read-only)
└── core/
└── ADR-001.mdArchitectural Tiers:
Active Memory Store (
workingLayer): Stores live project state, episodic session decisions, and task handoffs. Validated against a strict Zod schema with atomic Git commits.Constitutional Memory (
constitutionLayer): Stores non-negotiable architectural rules, ADRs, and project conventions inside.manthan/memory/constitution/. Proposed additions default tostatus: draftfor human review.
Related MCP server: openmemkit
Subdirectories & System Boundaries
Core Application & Server Runtime (
src) - Wires configuration, storage sub-engines, MCP resources, and tools into a unifiedManthanContext. Exposes Commander CLI and Stdio MCP runtime.Configuration & Client Linker (
src/config) - Zod schema validation for.manthan.yaml, frontmatter normalization, and automated client configuration injection for Claude Desktop, Cursor, and VS Code.Resources Provider (
src/resources) - Direct MCP resource endpoints (manthan://constitution,manthan://active-context,manthan://status) for zero-turn context injection.Storage Engine (
src/storage) - Dual-tier persistence throughGitEngine(commits, lineage, branches),MarkdownStore(filesystem YAML/MD), andSqliteIndexer(embedded FTS5 BM25).MCP Tools Implementation (
src/tools) - Handlers forrecall_memory,commit_memory,propose_constitution_rule,audit_memory_lineage,sync_memory_index, andfetch_by_tags_and_keywords.
Global Invariants
Memory-as-Code Integrity: All persistent memory artifacts must reside as
.mdfiles with valid YAML frontmatter matchingMemoryFrontmatterSchema.Constitutional Immutability: Memories under
layer: "constitution"are read-only during standard agent task execution; new rules are submitted viapropose_constitution_rulewithlayer: 'constitution'andstatus: 'draft'.Deterministic Lexical Retrieval: Search queries execute against SQLite FTS5 BM25 index with fixed column weights (
title: 5.0, tags: 3.0, namespace: 2.0, content: 1.0), preventing non-deterministic vector drift.StdIO Protocol Separation: Standard output (
stdout) is strictly reserved for JSON-RPC transport frames. All logging, diagnostic outputs, and notices must be written to standard error (stderr).Startup Index Resynchronization: If the cached
git_head_shain the SQLite database does not match the active Git HEAD SHA during server startup, a full index rebuild from disk is automatically performed.
Global Side Effects
Local Filesystem: Creates and modifies files in
.manthan/memory/working/and.manthan/memory/constitution/. May generate or modify.manthan.yamland.gitignore.Embedded Database: Creates and manages
.manthan/index.dbSQLite database using WAL mode (PRAGMA journal_mode = WAL).Git Version Control: Executes Git commands via
simple-git: repository initialization, file staging, atomic commits with author metadata"${author_agent} <agent@manthan.internal>", and branch creation (manthan/rule-${id}).Host Client Configuration: Modifies client configuration files during
linkorinit(Claude Desktop config in OS AppData/Config,.cursor/mcp.json, and.vscode/mcp.json).
System Verification
Run:
npm test
🌊 The Origin & Etymology of "Manthan" (मंथन)
"Out of the turbulent ocean of chaotic noise, deep contemplation churns the immortal nectar of truth."
Manthan (मन्थन) is an ancient Sanskrit word originating from the root manth (मन्थ्), which translates to "to churn, vigorously agitate, deeply contemplate, and extract the concentrated essence from vast substance."
In Indian philosophy and classical Vedic epics (such as the Mahabharata and Bhagavata Purana), the term finds its definitive mythic expression in Samudra Manthan (समुद्र मन्थन — The Churning of the Cosmic Ocean). When the forces of light (Devas) and darkness (Asuras) churned the primordial ocean of chaos, they churned through the deadly, volatile poisons (Halahala) to extract the supreme divine treasures (Ratnas) and the ultimate prize: Amrita (अमृत) — the immortal nectar of eternal life, truth, and absolute clarity.
Why Was This Name Chosen for This Engine?
In modern software engineering with autonomous AI agents, models operate inside a vast, turbulent, and noisy ocean of ephemeral tokens, fleeting scratchpads, and probabilistic hallucinations:
Churning the Ocean of Ephemeral Context:
During real-world development, AI agents generate tens of thousands of tokens of intermediate trial-and-error, debug outputs, and transient hypotheses. If left uncurated, this context degrades into token exhaustion, context drift, and silent hallucinations. Manthan acts as the cognitive churning rod — actively stirring through this raw stream, discarding the volatile noise, and distilling the essential truths of your codebase.From Fleeting Noise to Immortal State (Amrita):
In Indian thought, Amrita is that which cannot die (a-mrita = deathless). When an agent commits an architectural decision or constitutional rule in Manthan, it is not lost when a context window closes or an LLM session restarts. It is forged into an immutable, cryptographically signed Git commit backed by sub-5ms BM25 retrieval — conferring permanence, reproducibility, and time-travel lineage upon the agent's memory.Contemplative Cognition (Manan):
Manthan is intimately linked to the Sanskrit concept of Manan (मनन) — rigorous intellectual contemplation, inner reflection, and conscious discernment. Rather than treating memory as an opaque, black-box vector database that drifts unpredictably, Manthan treats memory as version-controlled state ("Memory-as-Code") that humans and agents can consciously audit, debate, and evolve.
📋 Standardized Memory Artifact Schema
Every memory artifact is stored as a standard .md file with strict YAML frontmatter:
---
id: "mem_01j9x8k2m"
title: "API Idempotency Key Header Standard"
layer: "working" # "working" | "constitution"
namespace: "backend/payments" # Logical topic or directory slug
status: "active" # "active" | "superseded" | "draft" | "archived"
author_agent: "claude-code"
trace_id: "tr_98234792"
supersedes: null # Optional ID of previous memory artifact
tags: ["idempotency", "api", "payments"]
updated_at: "2026-11-09T10:00:00.000Z"
---
## Context & Decision
All payment mutation endpoints must accept and validate a unique `Idempotency-Key` header.🛠️ MCP Tools Specification
Manthan exposes 6 deterministic tools to any MCP-compliant client:
Tool | Purpose | Key Inputs | Key Outputs |
| Lexical BM25 search across state & guardrails |
| JSON bundle of |
| Atomic state write with Git commit & FTS indexing |
| Commit SHA, artifact path, and confirmation |
| Propose architectural law or ADR for review |
| Draft artifact path and human review guidance |
| Provenance audit and time-travel history |
| Chronological commit history, agent author, and diff summary |
| Sidecar index maintenance & cache refresh |
| Indexed counts, duration, and synchronized Git HEAD SHA |
| Tag-filtered BM25 retrieval with snippet extraction |
| Compact excerpt list and OKF v0.2 matching documents |
📦 Native MCP Resources (manthan://...)
Manthan exposes live MCP Resources that clients (Claude, Cursor, Antigravity) can read directly into their context window without burning a tool turn:
URI | Type | Purpose | Content |
|
| Zero-turn guardrail injection | Active architectural rules & ADRs |
|
| Active working context snapshot | Active episodic memories & handoffs |
|
| Telemetry & engine health | Memory counts, Git HEAD SHA & BM25 config |
⚙️ Declarative Configuration (.manthan.yaml)
version: "1.0"
project: "my-project"
storage:
root_dir: ".manthan/memory"
working_dir: ".manthan/memory/working"
constitution_dir: ".manthan/memory/constitution"
index_db_path: ".manthan/index.db"
git:
auto_commit: true
branch_strategy: "direct" # "direct" | "session-branch"
commit_prefix: "chore(manthan):"
governance:
prioritize_constitution_on_recall: true
allow_direct_constitution_writes: false
retrieval:
bm25_weights:
title: 5.0 # Boost title matches 5x
tags: 3.0 # Boost tag matches 3x
namespace: 2.0 # Boost namespace matches 2x
content: 1.0 # Base content body weight🚀 Quickstart & Frictionless Setup
💡 Zero Background Daemons Needed!
Unlike traditional servers, you never need to keep a terminal open runningmanthan serve. Your LLM client (Cursor, Claude Desktop, VS Code) launches Manthan automatically in the background as an isolated sidecar process over stdio.
1. Initialize Manthan in your repository
npx @kidakaka/manthan-mcp initThis automatically:
Creates
.manthan.yamlwith declarative settings.Creates directory structures for
workingandconstitutionmemories.Adds
.manthan/index.db*to.gitignore.Initializes Git (if not already initialized).
Seeds initial constitutional rules (
ADR-001) and working memories.Builds the local SQLite FTS5 search index.
Auto-configures Cursor & VS Code: Generates
.cursor/mcp.jsonand.vscode/mcp.jsonin your repository so you can start immediately with zero manual configuration!
2. Auto-Link to Claude Desktop (1-Click)
To automatically connect Claude Desktop without touching JSON files or hunting down OS appdata paths:
npx @kidakaka/manthan-mcp link claude(You can also run npx @kidakaka/manthan-mcp link all to configure all detected LLM clients at once).
3. Inspect Status
npx @kidakaka/manthan-mcp status🔌 Manual Client Integration (Optional)
If you prefer to configure your client manually, add the following to your client's settings:
1. Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"manthan": {
"command": "npx",
"args": ["-y", "@kidakaka/manthan-mcp", "serve"]
}
}
}2. Cursor
In .cursor/mcp.json (already generated automatically by manthan init):
{
"mcpServers": {
"manthan": {
"command": "npx",
"args": ["-y", "@kidakaka/manthan-mcp", "serve"]
}
}
}3. VS Code / Copilot / Cline
In .vscode/mcp.json (already generated automatically by manthan init):
{
"mcpServers": {
"manthan": {
"command": "npx",
"args": ["-y", "@kidakaka/manthan-mcp", "serve"]
}
}
}4. Google Antigravity
Add to your Antigravity MCP configuration (~/.gemini/antigravity/mcp/manthan.json or config.json):
{
"name": "manthan",
"command": "npx",
"args": ["-y", "@kidakaka/manthan-mcp", "serve"]
}💻 CLI Commands Reference
manthan init [--dir <path>] [-c <client>]: Initialize memory storage, seed artifacts, and generate client configs.manthan link [claude|cursor|vscode|all]: Automatically link the MCP server into your LLM client configuration.manthan serve [--dir <path>]: Start the MCP server over stdio (called automatically by LLM clients).manthan status [--dir <path>]: View memory counts, Git HEAD, and index health.manthan reindex [--dir <path>]: Force a complete rebuild of the SQLite FTS5 index.
🧪 Testing
Run the automated end-to-end integration test suite:
npm testThe test verifies:
Workspace initialization and Git repository detection.
Atomic
commit_memoryexecution and Git SHA stamping.Sub-5ms BM25 lexical recall with
recall_memory.State supersession (marking v1 as
superseded, creating v2 asactive, excluding superseded items from recall).Constitutional rule proposal and staging with
status: draft.Audit lineage retrieval via Git commit logs.
Full FTS5 sidecar index rebuilding and HEAD SHA synchronization.
🤝 Contributing & Early Feedback
We value real-world feedback from early adopters above everything else.
If you are an agent developer or user: Test Manthan in your repository and tell us what works, what breaks, and how your agent behaves with deterministic state handoffs.
If you are a systems/TypeScript engineer: Help us expand MCP client presets, optimize BM25 tokenizers, and build multi-repo memory federation.
Please check out our Contributing Guide and Project Roadmap & TODO for our complete publishing checklist, discussion links, and local development instructions.
💖 Sponsorship & Support
If Manthan helps eliminate hallucination and state drift in your AI agents, consider supporting ongoing open-source maintenance via GitHub Sponsors.
📄 License
Licensed under the Apache License, Version 2.0 (the "License").
You may not use this software except in compliance with the License.
Copyright © 2026 Prasad Ajinkya and Manthan Contributors.
Available Tools
6 toolsaudit_memory_lineageB
Provenance & Time-Travel: retrieves chronological Git commit history, agent author metadata, and diff audit trail for a memory artifact.
Inputs: file_path, memory_id, max_commits.
commit_memoryB
Deterministic state write: validates Markdown frontmatter, atomically commits to Git with agent provenance, and updates local FTS5 index.
Inputs: title (required), content (required), namespace (required), author_agent (required), +6 more.
fetch_by_tags_and_keywordsB
Specialized harness to fetch, filter, and rank memories via multi-tag combinations (AND/OR) and BM25 lexical keywords with snippet context extraction.
Inputs: tags, limit, doc_type, keywords, +5 more.
propose_constitution_ruleB
Guardrail Promotion: proposes a new architectural law or ADR inside constitution memory with status: "draft" for human developer review.
Inputs: title (required), content (required), namespace (required), rationale (required), +4 more.
recall_memoryB
Lexical BM25 search across agent working memory and constitutional guardrails with Git commit SHA provenance and glob namespace filtering.
Inputs: tags, limit, query, namespace, +2 more.
sync_memory_indexB
Sidecar Maintenance: scans .manthan/memory/, parses Markdown frontmatter, synchronizes the SQLite FTS5 index, and stamps the current Git commit SHA.
Inputs: force_rebuild.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
recall_memory and fetch_by_tags_and_keywords both perform BM25 lexical retrieval over memories, differing mainly in glob namespace filtering versus multi-tag combinations and snippet extraction, so an agent may hesitate between them. The other four tools—commit, sync, audit, and propose—are clearly distinct.
All names use snake_case with a verb-first pattern, giving a predictable style throughout. Minor deviations are the long compound names like audit_memory_lineage and fetch_by_tags_and_keywords, but no conventions are mixed.
Six tools is well-scoped for a memory/provenance server, with each tool covering a distinct phase: retrieval, audit, index maintenance, write, and constitution proposal. There are no obvious filler tools.
The set covers search, commit, index sync, lineage audit, and rule proposal, but there is no explicit delete/forget or update-existing-memory operation. Constitution rules can be proposed as drafts but cannot be approved, rejected, or promoted, creating a lifecycle dead end.
Maintenance
Related MCP Connectors
Project memory, documentation and controlled secret access for AI coding agents.
Portable AI memory shared across models and harnesses - plain markdown you own.
One memory for every AI you work with: your rules, notes and decisions in your own Git repo.
Shared Markdown memory for your agents: docs, typed collections, files, skills and Dispatch.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides long-lived, cross-project technical memory for AI agents via markdown cards stored in git and indexed by SQLite, enabling search, retrieval, and human-reviewed knowledge management.ISC
- AlicenseAqualityDmaintenanceEnables AI agents to maintain a persistent, queryable memory stored as user-owned Markdown files, with dual-channel retrieval (FTS5 and optional semantic search) and an audited write pipeline.11MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents like Codex, Grok Build, and Antigravity to share persistent local memory, preferences, project context, tasks, and handoffs using Markdown and SQLite.1MIT
- AlicenseAqualityBmaintenanceEnables AI coding agents to persist atomic, token-budgeted facts across sessions via SQLite-backed full-text search, automatically superseding outdated entries and flagging memories as stale when Git webhooks detect changes to anchored repo files.11AGPL 3.0