TheWeave: Memory for AI agents you can cat, grep, and git.
TheWeave is a markdown-native memory architecture for Claude and any MCP-aware agent. Your agent's memory lives as plain .md files you own: a 5-verb MCP core over the vault, query-driven PageRank retrieval, bi-temporal facts (valid_from / valid_until), and a persona-as-vault model. No database and no embeddings server. The files are the memory, inspectable in your editor and versionable in git.
README
TheWeave
Claude memory you can cat, grep, and git.
<p align="center"> <img src="docs/theweave-demo.gif" alt="TheWeave demo — query-driven memory retrieval over a plain markdown vault" width="100%"> </p>
A markdown-native memory architecture for Claude and any MCP-aware agent. Your assistant's memory lives as plain .md files in a directory you own — inspectable in your text editor, versionable in git, portable across machines — not in an opaque vector database somewhere else.
Five composable patterns sit on top of the same vault:
- Weave Core MCP — 5-verb memory tool over any markdown directory
- PPR boot retriever — query-driven Personalized PageRank, not pre-baked dumps
- Bi-temporal resolver — facts have
valid_from/superseded_by; time-travel queries built in - Sleep-time consolidator — recent activity gets patched back into entity files; reflect synthesis runs over the learning log
- Write-time conflict resolver — k-NN + LLM verdict refuses to ADD a duplicate when an UPDATE is correct
The substrate is just markdown and YAML frontmatter. No services, no embeddings DB, no Ollama. The 5-verb tool ships zero-infra; the richer patterns layer on top of the same files.
Quickstart
git clone https://github.com/TheWeaveSC/theweave.git ~/theweave
cd ~/theweave
pip install -e .
# verify the install end-to-end
weave-cli doctor
# try the included demo vault
weave-cli demo boot "ACME cutover with Marcus"
weave-cli demo current entity-ACME --as-of 2026-01-01 # time-travel
weave-cli demo consolidate --today 2026-05-23 # dry-run
A healthy install looks like:
🪶 Weave 2.0 Doctor
[Engine]
✓ Python 3.11.15 (≥3.11 required)
✓ Dependencies importable
mcp 1.27.1, networkx 3.6.1, frontmatter 1.3.0, click 8.4.1, ...
✓ CLI + MCP entry points importable
ℹ theweave 0.3.0
[Vault]
✓ Vault root resolves: ~/theweave/seed-vault
✓ Layout: flat (seed-vault style)
✓ 18 notes total — entities 6, sessions 7, signals 1, other 4
✓ Frontmatter parses on all notes
✓ Pattern 4 will scan 7 session(s)
✓ Pattern 2 graph: 18 nodes, 71 edges, 0 isolates (0%)
✓ Bi-temporal coverage: 6/6 entities (100%)
[Environment]
✓ Obsidian.app detected in /Applications/
ℹ ANTHROPIC_API_KEY not set — Pattern 4/5 will run in mock mode
All checks passed.
Requires Python ≥ 3.11. For a zero-clone install path (no GitHub auth required), see Install.
Bring your own persona
TheWeave is vault-native. Your assistant's identity — voice, working style, the relationship you've built — is itself just markdown in the vault. Persona memories load on every session; factual memories get retrieved on demand. Same primitive, same files, different loading discipline.
That means a persona is just a starter vault you can fork:
# clone a starter vault and verify the engine sees it
cp -R personas/sonnet ~/my-vault
weave-cli doctor --vault ~/my-vault --check-mcp
$EDITOR ~/my-vault/entities/entity-user.md # personalize the user identity
Starter vaults shipped in this repo:
seed-vault/— neutral fictional starter (ACME / FOO entities). Best for kicking the tires on the five patterns.personas/sonnet/— a starter built around a terse, audit-discipline Claude collaborator. Voice, working-style, and relationship scaffolding pre-wired. Seepersonas/sonnet/README.mdfor the layout and fork instructions.
Or skip the starter and point TheWeave at any existing markdown directory — Obsidian, your notes repo, dotfiles. The engine adapts to whatever layout you have.
What this is (and isn't)
| TheWeave | Vector-DB memory layers | |
|---|---|---|
| Storage | Plain .md files in your filesystem |
Vendor DB / Pinecone / pgvector |
| Inspection | cat, grep, rg, your text editor |
API query or admin UI |
| Versioning | git diff, git log, git blame |
Snapshot/export tools |
| Schema | Open YAML frontmatter | Vendor DB schema |
| Failure mode | A bad markdown file you can edit by hand | A bad row you have to query out |
| Vendor lock-in | None — it's a folder | Migration tool required |
TheWeave is not a chat-memory bolt-on. It's the memory layer for Claude when you want the data on your machine, in your filesystem, in a format you can read.
Architecture
┌──────────────────────────────────────┐
│ TheWeave — two-tier design │
└──────────────────────────────────────┘
╔════════════════════════════════════════════════════════════════════╗
║ WEAVE CORE (zero-infra, drop-in MCP server) ║
║ ║
║ ┌─────────────────────────────────────────────────────────────┐ ║
║ │ MCP server — 5 verbs over any markdown vault │ ║
║ │ view • create • str_replace • insert • delete │ ║
║ └─────────────────────────────────────────────────────────────┘ ║
║ │ ║
║ ▼ ║
║ ┌─────────────────────────────────────────────────────────────┐ ║
║ │ Vault (markdown + YAML frontmatter) │ ║
║ │ entities/ sessions/ wiki/ LearningLayer/ │ ║
║ └─────────────────────────────────────────────────────────────┘ ║
╚════════════════════════════════════════════════════════════════════╝
│
▼ (same vault, richer engine)
╔════════════════════════════════════════════════════════════════════╗
║ WEAVE PRO (Python engine on your machine) ║
║ ║
║ Pattern 2 — Query → entity-extract → Personalized PageRank → ║
║ top-N notes (bi-temporal-aware) ║
║ ║
║ Pattern 3 — Bi-temporal frontmatter (valid_from / valid_until / ║
║ superseded_by) + chain resolver ║
║ ║
║ Pattern 4 — Sleep-time consolidator: ║
║ recent sessions → per-entity activity patch ║
║ LearningLayer signals → reflect synthesis ║
║ (dry-run by default; --apply with _archive/ backup) ║
║ ║
║ Pattern 5 — Write-time: ║
║ TF-IDF k-NN candidates → LLM (or mock) → ║
║ ADD / UPDATE / DELETE / NOOP verdict ║
║ ║
║ ┌──────────────┐ ┌─────────────────┐ ║
║ │ mock_llm │ ◄─────► │ anthropic_llm │ ║
║ │ (offline) │ env │ (live Claude) │ ║
║ └──────────────┘ var └─────────────────┘ ║
╚════════════════════════════════════════════════════════════════════╝
Both tiers share one vault. Core ships zero-infra (an MCP entry in claude_desktop_config.json and you're in). Pro adds the richer engine without changing the data format.
Pattern status
| # | Pattern | Implementation | LLM dependency |
|---|---|---|---|
| 1 | Weave Core MCP | Stable — 5 verbs, path-escape protected | None |
| 2 | PPR boot retrieval | Stable — NetworkX, frontmatter-aware wikilinks, bi-temporal seed resolution | None |
| 3 | Bi-temporal resolver | Stable — superseded_by walker, as_of time-travel |
None |
| 4 | Sleep-time consolidator | Stable scan + patch. Reflect synthesis uses mock heuristic by default; live Claude with ANTHROPIC_API_KEY |
Optional |
| 5 | Write-time conflict resolver | Stable TF-IDF + verdict pipeline. Mock classifier by default; live Claude with ANTHROPIC_API_KEY |
Optional |
All persistence is plain markdown. No ChromaDB, no Ollama, no services. The 5-verb substrate carries ~80% of the architecture; only the classifier steps in Patterns 4 and 5 need an LLM.
Install
Editable install (current path)
git clone https://github.com/TheWeaveSC/theweave.git ~/theweave
cd ~/theweave
pip install -e .
weave-cli doctor
Zero-clone install (recommended for learners)
curl -sSL https://github.com/TheWeaveSC/theweave/releases/latest/download/install-weave.sh | bash
Downloads the tagged release tarball, sets up a Python venv at ~/theweave/venv/, installs the package, and symlinks weave-cli into ~/.local/bin/ if it's on your PATH. Runs weave-cli doctor as the success signal. No GitHub authentication required — the tarball is fetched from the public releases endpoint.
Overridable via env vars: WEAVE_VERSION, WEAVE_HOME, PYTHON. See install-weave.sh.
MCP integration with Claude Desktop
Copy docs/claude-desktop-config.snippet.json into your ~/Library/Application Support/Claude/claude_desktop_config.json under mcpServers. Restart Claude Desktop. The 5 verbs become available as weave-core/view, weave-core/create, etc.
Live Claude mode (Patterns 4 & 5)
Patterns 4 and 5 default to deterministic mock implementations. To go live:
pip install anthropic
export ANTHROPIC_API_KEY=...
export WEAVE_CLAUDE_MODEL=claude-sonnet-4-6 # optional
weave-cli demo consolidate # reflect step now uses Claude
weave-cli demo write /tmp/foo.md # verdict now uses Claude
The weave/pro/llm.py selector picks anthropic_llm whenever ANTHROPIC_API_KEY is set, falling back to mock_llm otherwise. Code paths are identical; only the classifier swaps.
Dependencies
| Layer | What | Required? |
|---|---|---|
| Engine runtime | Python ≥ 3.11; pip install -e . installs the rest |
Yes |
| AI ↔ vault | Claude Desktop, Cowork, or any MCP client with weave-core registered |
Yes |
| Human ↔ vault | Any markdown editor. Obsidian is recommended for the native wikilink + backlink-graph UX, but not required. | Recommended |
| Patterns 4 & 5 live mode | ANTHROPIC_API_KEY exported |
Optional |
After install, weave-cli doctor verifies the full stack — engine, vault, environment, and optionally Claude Desktop MCP wiring with --check-mcp.
Limitations
Honest list of what's rough:
- TF-IDF in the conflict resolver is short-doc-fragile. Short candidate notes get low similarity scores even when conceptually identical. The name-match bypass covers most of this; real embeddings (e.g.,
nomic-embed-text) would be the production path. - PPR runs over the whole graph per query, not cached. Fine for vaults under ~1,000 notes; pre-compute and cache for larger ones.
- Consolidator's mock reflect step is keyword-bucketing. Honest stub, not a substitute for the live-Claude reflect pass.
- Live LLM mode is Claude only. No OpenAI / Gemini / Ollama backends — open for contribution.
Documentation
docs/architecture.md— deeper technical write-updocs/v2-switchover-guide.md— migrating from v1CHANGELOG.md— release history
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。