memtwig

Git-native memory for AI agents across every org.

Curated Markdown vaults routed by Git remote. One Go binary for every harness.

Active workspace
cwd: ~/work/acme/payments-apiremote: github.com/acme/payments-api
acme
full · propose
personal
persona/** · direct
beta
isolated
$ memtwig search "deploy"
acmeinfra/deploy.md

Production runs on Fly.io (fra). Rollback via fly releases.

personalpersona/style.md

Keep commit messages short. Run tests before proposing edits.

105 ms

109 Markdown notes indexed into SQLite FTS5

12 MB

Single static Go binary, zero CGO

0

External vector databases required

Architecture

Git + Markdown

Every vault is a plain Git repository. Notes use YAML frontmatter or lightweight headers, an 8 KB soft cap, and append-only archives instead of silent deletion.

Hybrid FTS5 + RRF

Local SQLite FTS5 BM25 fused with optional Ollama, OpenAI, or Cloudflare embeddings via Reciprocal Rank Fusion. Degrades cleanly to BM25 offline.

Proposals + RBAC

Org vaults and owner-locked notes block direct agent writes. Agents queue deterministic proposals in .curator/proposals.json; rejected IDs never reopen.

How it compares

Capability memtwig Vector Memory APIs Static Rules Files
Storage format Plain Markdown in Git Proprietary cloud DB Unindexed flat files
Multi-org isolation cwd & git remote routing in SQL Manual tenant IDs in app code Per-repo only
Agent write safety owner-lock + proposal queue Autonomous overwrite Unrestricted edits
Secret scanning Built-in linter blocks sync None Manual hooks
Cross-harness CLI, stdio/HTTP MCP, native hooks SDK integration required Tool-specific filenames
go install github.com/vittoriocompagno/memtwig/cmd/memtwig@latest

memtwig init ~/notes --name personal --kind personal
memtwig index
memtwig search "deploy"

FAQ

What is memtwig?

memtwig is an open-source, single-binary Go memory layer for AI agents that stores curated facts in Git-backed Markdown vaults with multi-org isolation, hybrid SQLite FTS5 search, MCP, and proposal governance.

How does memtwig isolate memory across multiple client orgs?

Each org vault defines match_paths and match_git_remotes. memtwig resolves active vaults from the current working directory and enforces vault_id IN (...) directly inside SQLite queries, so agents in Client A's repo never see Client B's notes.

How does memtwig compare to Mem0 or vector memory APIs?

Vector memory APIs store extracted facts in opaque databases and allow autonomous overwrites. memtwig keeps plain Markdown in Git, works offline with zero external services, scans for leaked secrets, and requires human approval for proposals on org or owner-locked notes.

Which AI coding agents work with memtwig?

memtwig works with Claude Code, Cursor, Codex, Antigravity, Hermes, and any MCP-compatible client via stdio MCP (memtwig mcp), Streamable HTTP MCP (memtwig serve), and native per-turn hooks (memtwig install).

Does memtwig require a vector database or paid API key?

No. memtwig embeds pure-Go SQLite with FTS5 BM25 out of the box. Embeddings via Ollama, OpenAI, or Cloudflare and semantic curation (curate --llm) are optional and degrade cleanly to local BM25 when offline.