Claude Code Persistent Memory + Graphify Token-Savings Guide
Give Claude Code cross-session memory and a codebase structure map using an Obsidian Zettelkasten and Graphify knowledge graphs, cutting tokens wasted on re-reading code and re-explaining projects.
- Source repo
- lucasrosati/claude-code-memory-setup
- Stars
- ★ 1.1k
- Last updated
- 1mo ago
- License
- MIT
- Primary language
- Python
- FA score
- 69/100 · Some gaps
At a glance
- Works with
- Platform-specificClaude Code
- You'll need
- Typical use
- A multi-project developer who wants Claude Code to remember each project's stack, past decisions, and pending work without re-explaining every session.
- Main limitation
- The headline token savings (71.5x per session, 499x per query) are author-reported; the source payloads and tokenizer were never published and are not reproducible.
- Maintenance
- Commits in the last 6 monthslast commit 2026-10-21
- Source review
- 69/100 · Some gaps
What does this agent do, and when should you use it?
claude-code-memory-setup by lucasrosati is an MIT-licensed, complete configuration guide (also in PT-BR) that turns Claude Code into an agent with long-term memory and codebase awareness. It combines four complementary parts: a single Obsidian vault as persistent memory (Zettelkasten note conventions), a chat import pipeline (claude_to_obsidian.py plus sync_claude_obsidian.sh, cron-driven, converting Claude Code/Web conversations into tagged vault notes), Graphify codebase knowledge graphs (local tree-sitter AST processing, zero tokens by default), and /save, /resume, /memorize, /commit session commands plus a SessionEnd auto-save hook. It is not an installable product but a set of configuration docs, command files, and scripts deployed into ~/.claude/commands/, ~/.claude/skills/, and ~/scripts/. The README itself discloses that the 71.5x-per-session and 499x-per-query token-savings claims are author-reported and not reproducible from published data, and ships a benchmark protocol with an evidence audit. It fits developers already deeply using Claude Code who are willing to build and maintain an Obsidian vault.
The repository ships copyable configuration and scripts rather than an installable product: 1) It sets up a single Obsidian vault (~/vault/) with a Zettelkasten structure — permanent/, inbox/, logs/, chats/, graphify/ — governed by a vault-root CLAUDE.md enforcing atomic notes, wikilinks, YAML frontmatter and kebab-case filenames. 2) It installs /save, /resume, /memorize, /commit command files from commands/ into ~/.claude/commands/: /resume loads vault context, /save writes a session log then runs a deduplicated consolidation phase (decisions to architecture/decisions.md, reusable insights to permanent/), /commit pushes then triggers /save and a graph rebuild. 3) The chat pipeline uses pip-installed claude-conversation-extractor to export conversations, claude_to_obsidian.py to add keyword-based tags and frontmatter, and sync_claude_obsidian.sh scheduled via cron (e.g. daily at 22:00) to sync into chats/code/ and chats/web/. 4) pip install graphifyy && graphify install --platform claude registers a skill at ~/.claude/skills/graphify/; inside Claude Code you run /graphify . --obsidian --obsidian-dir ~/vault/graphify/project-name to generate graph.json, GRAPH_REPORT.md and Obsidian notes, or in a terminal use graphify extract . --out ./graphify-out (the headless CLI does not accept --obsidian/--wiki/--mode deep). 5) scripts/session_autosave.py is registered as a SessionEnd hook in ~/.claude/settings.json, parsing transcripts with pure JSONL, zero LLM calls, writing a minimal auto-log even when /save was forgotten.
- A multi-project developer who wants Claude Code to remember each project's stack, past decisions, and pending work without re-explaining every session.
- An engineer on a large TypeScript/Python codebase who wants the agent to query graph.json first and read source only when editing, reducing retrieval-context tokens.
- A user switching between Claude Web and Claude Code who wants chat decisions automatically imported as searchable Obsidian notes.
- A developer who forgets to run /save and wants the SessionEnd hook to leave a minimal session log as a safety net.
- A team or solo maintainer building architecture decision records (decisions.md) and a permanent-notes insight library for a React + Supabase project.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
pip install claude-conversation-extractorpip install graphifyy
- Environment variables
VAULT_DIRANTHROPIC_API_KEYMOONSHOT_API_KEY- Config files
~/.claude/commands/README.md~/.claude/settings.jsongraphify-out/graph.json
How do you install or deploy this agent?
Prerequisites: Claude Code installed and authenticated, Obsidian, Python 3.
Create the vault structure:
cd ~/vault
mkdir -p permanent inbox fleeting templates logs references
mkdir -p my-project/{architecture,pipeline,data,features,logs}Create CLAUDE.md at the vault root (project stacks, Zettelkasten rules, prohibitions) and a note template:
cat > templates/default-note.md << 'EOF'
---
title: {{title}}
tags: []
created: {{date}}
updated: {{date}}
status: draft
type: permanent
---
# {{title}}
## Context
## Details
## Related links
EOFInstall the session commands:
cp commands/*.md ~/.claude/commands/
rm ~/.claude/commands/README.md
export VAULT_DIR=~/vaultInstall chat-import and graph dependencies:
pip install claude-conversation-extractor
pip install graphifyy
graphify install --platform claudeFor Graphify's LLM semantic extraction, export a key (not needed in default AST mode):
export ANTHROPIC_API_KEY="your-key-here"
# or
export MOONSHOT_API_KEY="your-key-here"Auto-save hook script:
mkdir -p ~/scripts
cp scripts/session_autosave.py ~/scripts/
chmod +x ~/scripts/session_autosave.pyRegister it in ~/.claude/settings.json:
{
"hooks": {
"SessionEnd": [
{
"hooks": [
{
"type": "command",
"command": "VAULT_DIR=$HOME/vault python3 $HOME/scripts/session_autosave.py"
}
]
}
]
}
}How do you use this agent?
Typical session flow:
1) Open a Claude Code session and run /resume to load vault context (recent logs, decisions, progress).
2) Claude follows the project CLAUDE.md's 3-layer query rule: graphify-out/graph.json first, then the vault, raw code last.
3) Work normally; optionally run /memorize mid-session to pin a decision or insight now.
4) End with /save to write the session log and run the consolidation phase (writes to decisions.md or permanent/ and prints a Memory report); /commit pushes and triggers /save plus a graph rebuild.
Graph generation (inside Claude Code):
/graphify . --obsidian --obsidian-dir ~/vault/graphify/project-nameor headless in a terminal:
graphify extract . --out ./graphify-out
# incremental update
graphify update .
# query and explain
graphify query "question"
graphify explain "NodeName"Auto-import Claude chats: drop exported .md files into ~/claude-exports/code/ or web/, with cron running daily at 22:00:
0 22 * * * $HOME/scripts/sync_claude_obsidian.shIn Obsidian's graph view, filter sources with path:graphify, tag:chat-import, tag:auto-log, etc.
What are this agent's strengths and limitations?
- Four complementary layers (declarative memory / structural graph / chat archive / auto-log safety net) close the loop on both token-waste problems: inter-session amnesia and codebase re-reading.
- Graphify's default AST mode processes code 100% locally via tree-sitter — zero tokens, no API key, 20 languages, SHA256-cached incremental updates.
- /save has explicit consolidation and deduplication criteria (grep before write; separates decisions, insights, facts, conventions), and the auto-log hook is zero-LLM, millisecond-fast, and silently fails without breaking sessions.
- The README honestly disclaims the 71.5x/499x token claims and ships a benchmark protocol (benchmarks/) plus an evidence-audit issue.
- The headline token savings (71.5x per session, 499x per query) are author-reported; the source payloads and tokenizer were never published and are not reproducible.
- Deeply tied to Claude Code-specific mechanisms (CLAUDE.md, ~/.claude/skills, SessionEnd events) — porting to another agent means redoing all configuration.
- Heavy initial setup: build the Obsidian vault structure, write CLAUDE.md, configure cron, copy command files, register a JSON hook.
- Graphify's semantic mode requires an Anthropic or Moonshot (Kimi) API key; the headless CLI and skill invocation accept different flag sets (--obsidian/--wiki are skill-form only), which is easy to confuse.
- Not an install-and-run product but a docs-plus-scripts collection; users must write and maintain parts themselves (e.g. claude_to_obsidian.py's keyword-to-tag mapping).
How does this agent compare with similar options?
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| Claude Code Persistent Memory + Graphify Token-Savings Guide This agent | 69 · Some gaps | — | ★ 1.1k | 1mo ago | Python | Claude Code |
| EGC — One Brain for Every AI Coding Agent | 76 · Good | CLIFree | ★ 70 | today | JavaScript | Codex · Claude Code |
| Mnemon — Persistent Memory Engine for AI Agents | 71 · Some gaps | CLIFree | ★ 733 | 3d ago | Go | Codex · Claude Code |
| MCP Memory Service | 68 · Some gaps | MCP serverFree | ★ 2.1k | today | Python | ChatGPT · Codex · Claude Code · Claude.ai |
How does FollowAgents rate this agent?
Why each dimension lost points
Permissions are mostly restrained: writes go to the vault and ~/.claude/commands; the hook does mechanical JSONL parsing with zero LLM calls; /save deduplicates and writes conventions only after y/n confirmation; CLAUDE.md forbids deleting notes without asking. Deductions: third-party pip deps (claude-conversation-extractor, graphifyy) and a browser extension are unpinned and unaudited; chat exports (potentially sensitive conversations) flow into third-party tooling and plaintext staging dirs; API keys exported as plaintext env vars; no uninstall/rollback guidance, and the installed crontab job has no documented removal path.
Self-consistency is excellent: the README carefully distinguishes skill-form vs headless CLI argument support (--obsidian works only via the skill) and corrects the 71.5x framing. Deductions: dependency availability rests on external tools (graphify, extractor, browser extension) with no version compatibility info; failure handling is limited to silent autosave.log entries and brief test steps, and the Troubleshooting section's content is not visible in the sample.
Target audience (Claude Code + Obsidian users) is clear and capability boundaries are honest: token savings are task-dependent, historical figures are declared non-reproducible, and source reads remain necessary. Deductions: trigger precision is middling (auto-save has a noise filter but /save depends on user memory); environment fit is Unix/macOS-leaning (crontab, ln -s, bash) with no Windows guidance.
Information architecture is clear (layered folder scheme, TOC, tables); install notes are thorough with prerequisites and verification steps; MIT license is complete; attribution to Graphify and ai-memory is explicit. Deductions: CHANGELOG is referenced by CI but its content is not in the sample and there is no version number; examples are plentiful but the Troubleshooting/FAQ text is unverifiable from the packet; maintenance responsibility is implied only by CI design rules, with no stated maintenance commitment or update path.
Output usability is concrete: /save report format, memory destinations, and filter tags are all specified. Marginal value is real (persistent memory plus a structural graph genuinely address codebase re-reading), and cost framing is honest (0-token AST mode; deep mode needs an API key). Deductions: the headline 71.5x/499x figures are self-declared non-reproducible, leaving the residual benefit unquantified; no measured data supports the cost-benefit claim.
Traceability is good: the README explicitly labels 71.5x as author-reported and non-reproducible and explains that 71.4x compares retrieval context, not session usage — clear fact/inference discipline. Deductions: every quantitative benefit lacks third-party corroboration; Graphify's 'code never leaves your machine' claim is a restated third-party assertion unverifiable within the repo.
- Third-party dependencies (graphifyy, claude-conversation-extractor, the browser export extension) are unpinned and from unverified publishers — audit before installing.
- Chat exports may contain sensitive content and are stored in plaintext under ~/claude-exports and processed by a third-party extension; mind the exposure surface.
- The crontab job and SessionEnd hook lack documented uninstall/rollback steps; record how to remove them yourself.
- The 71.5x/499x token-savings figures are author-reported and non-reproducible; do not use them as a procurement basis.
FAQ
Is Claude Code Persistent Memory + Graphify Token-Savings Guide open source?
Is Claude Code Persistent Memory + Graphify Token-Savings Guide safe to use?
Is Claude Code Persistent Memory + Graphify Token-Savings Guide still maintained?
Who makes Claude Code Persistent Memory + Graphify Token-Savings Guide?
Thanks — we use this to improve the page.