Ultrabrain
CLAUDE.md1 starsChanged 9 months agoMITView on GitHub
UltraBrain is a Claude Code plugin providing persistent semantic memory across sessions. It captures tool usage, compresses observations using the Claude Agent SDK, embeds them into LanceDB for vector search, and injects relevant context into future sessions. 5 Lifecycle Hooks: SessionStart -> UserPromptSubmit -> PostToolUse -> Stop -> SessionEnd Hooks (src/hooks/*.ts) - TypeScript -> ESM, built to plugin/scripts/*-hook.js Worker Service (src/services/worker-service.ts) - Express API on port 37777, Bun-managed, handles AI processing asynchronously Database (src/services/sqlite/) - SQLite3 at ~/.ultrabrain/ultrabrain.db Search Skill…
In this repository6 other files it gives its agents.
- .claude-plugin/CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- plugin/CLAUDE.mdCLAUDE.md
- ragtime/CLAUDE.mdCLAUDE.md
- src/CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 60
No need to edit the changelog ever, it's generated automatically.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
UltraBrain: AI Development Instructions
UltraBrain is a Claude Code plugin providing persistent semantic memory across sessions. It captures tool usage, compresses observations using the Claude Agent SDK, embeds them into LanceDB for vector search, and injects relevant context into future sessions.
Architecture
5 Lifecycle Hooks: SessionStart -> UserPromptSubmit -> PostToolUse -> Stop -> SessionEnd
Hooks (src/hooks/*.ts) - TypeScript -> ESM, built to plugin/scripts/*-hook.js
Worker Service (src/services/worker-service.ts) - Express API on port 37777, Bun-managed, handles AI processing asynchronously
Database (src/services/sqlite/) - SQLite3 at ~/.ultrabrain/ultrabrain.db
Search Skill (plugin/skills/mem-search/SKILL.md) - HTTP API for searching past work, auto-invoked when users ask about history
Vector Search (src/services/sync/LanceSync.ts) - LanceDB vector embeddings for semantic search (native Rust, in-process)
Embeddings (src/services/sync/EmbeddingService.ts) - @xenova/transformers with all-MiniLM-L6-v2 (384-dim, in-process ONNX)
Viewer UI (src/ui/viewer/) - React interface at http://localhost:37777, built to plugin/ui/viewer.html
Privacy Tags
<private>content</private>- User-level privacy control (manual, prevents storage)
Implementation: Tag stripping happens at hook layer (edge processing) before data reaches worker/database. See src/utils/tag-stripping.ts for shared utilities.
Build Commands
npm run build-and-sync # Build, sync to marketplace, restart workerConfiguration
Settings are managed in ~/.ultrabrain/settings.json. The file is auto-created with defaults on first run.
File Locations
- Source:
<project-root>/src/ - Built Plugin:
<project-root>/plugin/ - Database:
~/.ultrabrain/ultrabrain.db - Vector DB:
~/.ultrabrain/vector-db/(LanceDB)
Exit Code Strategy
Hooks use specific exit codes per Claude Code's hook contract:
- Exit 0: Success or graceful shutdown
- Exit 1: Non-blocking error (stderr shown to user, continues)
- Exit 2: Blocking error (stderr fed to Claude for processing)
Requirements
- Bun (all platforms - auto-installed if missing)
- Node.js >= 18
Important
No need to edit the changelog ever, it's generated automatically.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

