An AI brain that combines zenrag and zenpreference for knowledge retrieval and preference recall. Includes an MCP server and CLI.
- Unified context — Combines knowledge (RAG) and preferences in one
getContextcall - MCP server — Model Context Protocol server for Cursor and other AI tools
- CLI —
zenbrainfor capture, query, and MCP - Shell history capture — Summarize and index shell history for context
bun add zenbrainSet OPENROUTER_API_KEY in your environment for embeddings.
import { ZenBrain, createEmbeddingModel } from "zenbrain";
const embeddingModel = createEmbeddingModel(); // uses OPENROUTER_API_KEY
const brain = new ZenBrain({ embeddingModel });
// Add knowledge
await brain.addKnowledge(["Your document content here..."]);
// Store preferences
await brain.storePreference({
key: "packageManager",
value: "bun",
content: "Uses bun for package management",
});
// Get combined context for a query
const context = await brain.getContext("How should I run tests?");zenbrain capture # Capture shell history
zenbrain query # Query knowledge and preferences
zenbrain mcp # Start MCP serverAdd zenbrain to your MCP config (e.g. Cursor) to expose brain_retrieve, brain_get_context, brain_store_preference, and related tools.
MIT