lucasrosati/claude-code-memory-setup
Up to 71.5x fewer tokens per session on Claude Code with Obsidian + Graphify. Persistent memory, codebase knowledge graphs, and chat import pipeline. 🇧🇷 PT-BR included.
What it solves
This project provides a comprehensive setup to give Claude Code persistent long-term memory and codebase awareness. It solves two primary issues: "amnesia" between sessions (where the user must re-explain the project) and high token consumption caused by Claude re-reading entire codebases to understand structure in every new session.
How it works
The system uses a multi-layered approach to manage context:
- Persistent Memory: An Obsidian Zettelkasten vault acts as a "second brain," storing decisions, architecture, and session logs. Claude Code interacts with this vault via a
CLAUDE.mdfile and custom commands like/resumeand/save. - Codebase Mapping: It integrates Graphify to convert code into a queryable knowledge graph. Instead of reading raw files, Claude queries a structural map (AST-based), significantly reducing token usage.
- Chat Pipeline: A Python-based import pipeline exports Claude conversations (from both the CLI and Web app) into the Obsidian vault as indexed notes.
- Auto-Save Safety Net: A Python script registered as a
SessionEndhook in Claude Code automatically extracts session facts and writes a minimal log to the vault if the user forgets to manually save.
Who it’s for
Developers using Claude Code who want to reduce API costs (tokens) and maintain a continuous, searchable knowledge base of their project decisions and codebase structure across multiple sessions.
Highlights
- Token Efficiency: Claims up to 71.5x fewer tokens per session by replacing full file reads with graph queries.
- Zettelkasten Integration: Uses atomic, interlinked notes in Obsidian for declarative memory.
- Local Processing: Codebase graphs are processed locally via tree-sitter AST, ensuring code content doesn't leave the machine in default mode.
- Automated Sync: Includes cron-scheduled scripts to sync chat histories into the knowledge vault.
Related
- Project
- Project
- Project
- Project