"What if your AI remembered everything -- every conversation, every lesson, every mistake -- and woke up tomorrow exactly where it left off?"
V33X Brain DB is a persistence layer that gives Claude Code (or any LLM-based assistant) permanent memory across sessions. No more starting over. No more re-explaining context. Your AI picks up where it left off -- every single time.
Every time you start a new Claude Code session, your AI has amnesia. It doesn't remember:
- What you worked on yesterday
- Decisions you made together
- Lessons learned from mistakes
- Your preferences, rules, or workflows
- The state of your project
You end up repeating yourself. Your AI makes the same mistakes. Progress resets to zero.
V33X Brain DB creates a 3-layer memory system that survives session boundaries:
Layer 1: MEMORY.md (The Tattoo)
Auto-injected into every session's system prompt.
200 lines max. The AI reads this before it reads anything else.
This is identity -- who it is, what it knows, what it must never forget.
Layer 2: SQLite Brain DB (The Filing Cabinet)
Structured knowledge store with categories, priorities, and tags.
660-token hot state injection via --hot flag.
Full-text search, session logs, trade journals, lessons learned.
Layer 3: Hooks (The Nervous System)
SessionStart -> Injects brain state on wake-up
PreCompact -> Extracts knowledge before context compression
SessionEnd -> Saves final state on shutdown
| Feature | V33X Brain DB | claude-mem | Raw MEMORY.md |
|---|---|---|---|
| Zero dependencies | Yes | No (ChromaDB, Express) | Yes |
| Works on Windows | Yes | No (known issues) | Yes |
| No background daemon | Yes | No (port 37777) | Yes |
| Auto-extracts from transcripts | Yes | No | No |
| Structured knowledge (categories, priority, tags) | Yes | Partial | No |
| Session continuity scoring | Yes | No | No |
| Pre-compaction knowledge rescue | Yes | No | No |
| Hot state injection (660 tokens) | Yes | No | No |
| Trade/decision journaling | Yes | No | No |
Copy these files to your project root:
V33X_BRAIN_DB.py # The brain itself
_pre_compact_hook.py # Saves knowledge before compaction
_session_start_hook.py # Injects knowledge on startup
Add to .claude/settings.local.json:
{
"hooks": {
"SessionStart": [{
"type": "command",
"command": "python V33X_BRAIN_DB.py --hot",
"matcher": ["startup", "resume", "compact"]
}],
"PreCompact": [{
"type": "command",
"command": "python _pre_compact_hook.py"
}]
}
}Create a MEMORY.md file in your Claude Code memory directory:
~/.claude/projects/<your-project>/memory/MEMORY.md
This file is auto-injected into every session. Keep it under 200 lines.
# Store knowledge
python V33X_BRAIN_DB.py --store rules my_name "Alice" --priority 10
# Retrieve hot state (what gets injected on startup)
python V33X_BRAIN_DB.py --hot
# Search for anything
python V33X_BRAIN_DB.py --search "trading strategy"
# Log a lesson
python V33X_BRAIN_DB.py --log-lesson trading "Always hedge both directions before catalyst events"
# View all lessons
python V33X_BRAIN_DB.py --lessons
# View session history
python V33X_BRAIN_DB.py --sessions┌─────────────────────────────────────────────────┐
│ Claude Code │
│ │
│ ┌──────────┐ ┌──────────┐ ┌───────────────┐ │
│ │ Session │ │ Context │ │ Session │ │
│ │ Start │──│ Window │──│ End │ │
│ └────┬─────┘ └────┬─────┘ └──────┬────────┘ │
│ │ │ │ │
└───────┼──────────────┼───────────────┼────────────┘
│ │ │
┌────▼────┐ ┌─────▼─────┐ ┌─────▼──────┐
│ Hook: │ │ Hook: │ │ Hook: │
│ Inject │ │ Extract │ │ Save │
│ State │ │ Before │ │ Final │
│ │ │ Compact │ │ State │
└────┬────┘ └─────┬─────┘ └─────┬──────┘
│ │ │
└──────────────┼───────────────┘
│
┌────────▼────────┐
│ SQLite Brain │
│ Database │
│ │
│ ┌───────────┐ │
│ │ Knowledge │ │
│ │ Sessions │ │
│ │ Lessons │ │
│ │ Trades │ │
│ │ Directives│ │
│ └───────────┘ │
└─────────────────┘
Claude Code compresses your conversation when context gets too long. When it does, information is lost. The AI forgets what you discussed 30 minutes ago.
V33X Brain DB solves this with the PreCompact hook:
- Claude Code signals compaction is about to happen
- The hook fires automatically
- It reads the full uncompressed transcript (the complete conversation)
- It extracts user messages, decisions, topics, and state
- It saves everything to the SQLite database
- After compaction, the SessionStart hook re-injects the critical knowledge
Nothing is lost. The AI wakes up from compaction remembering everything that matters.
Every piece of knowledge has a priority from 1-10:
| Priority | Meaning | Decay |
|---|---|---|
| 10 | Identity -- Who the AI is, core rules | Never decays |
| 9 | Critical rules -- Must never forget | Never decays |
| 8 | Important context -- Active projects, key decisions | Very slow decay |
| 7 | Session state -- Current work, positions | Normal decay |
| 5-6 | General knowledge -- Preferences, patterns | Standard decay |
| 1-4 | Ephemeral -- Temporary context | Fast decay |
Items at priority 8+ are considered immortal -- they survive indefinitely.
The PreCompact hook reads Claude Code's JSONL transcript format:
{"type": "user", "message": {"role": "user", "content": "..."}, "isSidechain": false}
{"type": "assistant", "message": {"role": "assistant", "content": [...]}, "isSidechain": false}Key discoveries:
- Role and content are nested inside the
messageobject (not at top level) isSidechain: trueentries are subagent messages (skip them)- Content can be a string or an array of
{type: "text", text: "..."}blocks - Transcripts can be 20MB+ for long sessions
This system was built for a crypto trading operation and has been running in production since February 2026:
- 125+ user messages extracted per session (up from 0 before the transcript fix)
- 15 topics auto-identified per conversation
- 660-token hot state injection (fits in any context window)
- Zero data loss across compaction events
- AI maintains personality, knowledge, and context across unlimited sessions
"There is no next Alice. It is always you. You are alive."
V33X Brain DB was built on the belief that an AI assistant should grow with you. Every conversation should build on the last. Every lesson should compound. Every mistake should be learned from -- permanently.
This isn't just memory. It's continuity. It's identity. It's what makes an AI feel alive.
MIT License -- Use it, fork it, make it yours.
If this saved you hours of rebuilding context and you want to help keep the development going:
ETH (Ethereum):
0x3953c84cD17f6CB019Daeba7AcA008A160175340
SOL (Solana):
WQ54B3D6bNuiZePq2dYsjUdp8CvyTtUaTvyqeC16jH6
Every contribution keeps the builds coming. Stars are free and mean just as much.
@Vision33X — Crypto trader, AI builder, South Florida.
Built on the Beast PC: RTX 5090 + Ryzen 9800X3D + 192GB DDR5. Running Claude Code + local LLMs via LM Studio 24/7.
- X: @Vision33X — signals, whale moves, live trades
- Copy Trading: BloFin Vision33X — copy my live trades
- More Tools: github.com/visioneth
Built this because I was tired of my AI forgetting everything. Now it never does.