octobrain

octobrain

Persistent memory for AI assistants — store insights, decisions, and knowledge that survives across conversations.

Category
访问服务器

README

Octobrain

Persistent memory for AI assistants — store insights, decisions, and knowledge that survives across conversations.

Crates.io License Rust

MCP Registry: mcp-name: io.github.Muvon/octobrain

Octobrain gives your AI assistant a long-term memory. Store code insights, architecture decisions, bug fixes, and knowledge — then retrieve them with semantic search in future sessions. Works as a CLI tool or as an MCP server for integration with Claude Desktop and other AI tools.

Why Octobrain?

AI assistants start every conversation with zero context. You explain your project, your preferences, your decisions — every single time. Octobrain breaks that cycle:

  • Persistent memory — Insights survive across sessions, not just within them
  • Semantic search — Find memories by meaning, not exact keywords
  • Auto-linking — Related memories connect automatically (Zettelkasten-style)
  • Knowledge indexing — Ingest docs, articles, and files for retrieval
  • MCP integration — Works with Claude Desktop and other MCP-compatible tools

Quick Start

# Install from crates.io
cargo install octobrain

# Store your first memory
octobrain memory memorize --title "API Design Pattern" \
  --content "Use REST for CRUD, GraphQL for complex queries" \
  --memory-type architecture --tags "api,design"

# Search memories
octobrain memory remember "how should I design APIs"

# Start MCP server for Claude Desktop integration
octobrain mcp

Installation

From crates.io (Recommended)

cargo install octobrain

From Source

# Clone and build
git clone https://github.com/muvon/octobrain.git
cd octobrain
cargo build --release

# Binary location
./target/release/octobrain --help

Feature Flags

Octobrain supports multiple embedding providers:

Flag Description API Key Required
fastembed Local embeddings via FastEmbed No
huggingface Local embeddings via HuggingFace No
(default) Both fastembed + huggingface No
(no features) API-based: Voyage, OpenAI, Google, Jina Yes
# Build with local embeddings (default, no API keys needed)
cargo build --release

# Build with API-based embeddings only
cargo build --no-default-features --release

For API-based embeddings, set the appropriate environment variable:

  • VOYAGE_API_KEY for Voyage AI
  • OPENAI_API_KEY for OpenAI
  • GOOGLE_API_KEY for Google
  • JINA_API_KEY for Jina

Usage

Memory Management

Store and retrieve insights, decisions, and context:

# Store a memory
octobrain memory memorize --title "API Design" \
  --content "Use REST for CRUD, GraphQL for complex queries" \
  --memory-type architecture --tags "api,design"

# Search memories (semantic search)
octobrain memory remember "api design patterns"

# Multi-query search for broader coverage
octobrain memory remember "authentication" "security" "jwt"

# Get a memory by ID
octobrain memory get <id>

# Get recent memories
octobrain memory recent --limit 20

# Filter by type
octobrain memory by-type architecture --limit 10

# Filter by tags
octobrain memory by-tags "api,security"

# Find memories related to files
octobrain memory for-files "src/main.rs,src/lib.rs"

# Update a memory
octobrain memory update <id> --title "New Title" --add-tags "new-tag"

# Delete a memory
octobrain memory forget --memory-id <id>

Memory Consolidation

Close a goal and fold all its contributing memories into a consolidated summary:

# Consolidate a goal (all Achieves-link sources get archived)
octobrain memory consolidate <goal-id> --summary "Final summary"

# Sleep consolidation: auto-cluster recent similar memories
octobrain memory sleep-consolidate --threshold 0.85 --min-size 3

Memory Relationships

Connect related memories for context-rich retrieval:

# Create a relationship between memories
octobrain memory relate <source-id> <target-id> \
  --relationship-type "depends_on" \
  --description "Source requires target to function"

# View relationships for a memory
octobrain memory relationships <memory-id>

# Find related memories through relationships
octobrain memory related <memory-id>

# Auto-link similar memories (Zettelkasten-style)
octobrain memory auto-link <memory-id>

# Explore memory graph
octobrain memory graph <memory-id> --depth 2

Knowledge Base

Index and search web content, docs, and files:

# Index a URL
octobrain knowledge index https://docs.rs/tokio/latest/tokio/

# Search knowledge base
octobrain knowledge search "how to handle async tasks"

# Search within a specific source (auto-indexes if outdated)
octobrain knowledge search "spawn blocking" --source https://docs.rs/tokio/

# Read full content of a URL or local file
octobrain knowledge read https://docs.rs/tokio/latest/tokio/

# Search indexed content by regex pattern
octobrain knowledge match "spawn_blocking|block_in_place"

# Store raw text content
octobrain knowledge store "meeting-notes" --content "Discussion points..."

# List indexed sources
octobrain knowledge list --limit 20

# Show statistics
octobrain knowledge stats

# Delete a source
octobrain knowledge delete https://example.com/docs

# Delete stored content by key
octobrain knowledge delete-stored "meeting-notes"

MCP Server

Run as an MCP server for integration with Claude Desktop and other AI tools:

# Start with stdio transport (for Claude Desktop)
octobrain mcp

# Start with HTTP transport (for web-based tools)
octobrain mcp --bind 0.0.0.0:12345

Available MCP Tools:

| memorize | Store memories with metadata; optional related_to for inline relationships | | remember | Semantic search with filters; returns 1-hop graph neighbors | | forget | Delete memories (requires confirmation) | | knowledge | Unified tool: search, store, delete, read, match via command field | See MCP Integration for Claude Desktop setup.

Features

  • Semantic Search — Find memories by meaning using vector embeddings, not exact keyword matches
  • Hybrid Search — Combines BM25 full-text search with vector similarity for better results
  • Reranking Support — Optional cross-encoder reranking for 20-35% accuracy improvement
  • Auto-Linking — Automatically connects semantically similar memories (Zettelkasten-style)
  • Temporal Decay — Ebbinghaus forgetting curve for importance management
  • Knowledge Indexing — Ingest URLs, PDFs, docs for retrieval
  • Project Scoping — Isolate memories per Git project or share across projects
  • Role Filtering — Tag memories by role (developer, reviewer, etc.)
  • Query Expansion (HyDE-lite) — Pseudo-relevance feedback for +10-30% recall on long-tail queries
  • MCP Protocol — Full MCP 2025-03-26 compliance for AI tool integration

Benchmarks

Retrieval quality of octobrain's knowledge system on standard BEIR datasets — nDCG@10, fully local, no LLM judge, using the default local embedder bge-small-en-v1.5 (384-dim, 33M params). Each corpus passage is indexed through octobrain's real retrieval path and scored against the official qrels (metrics reproduce pytrec_eval).

Dataset octobrain vector octobrain hybrid BM25¹ bge-small-en-v1.5²
SciFact (5.2K docs, 300 q) 0.722 0.742 0.665 0.713
NFCorpus (3.6K docs, 323 q) 0.341 0.363 0.325 0.343
  • vector = dense-only retrieval; reproduces the embedder's published BEIR numbers (validates the harness).
  • hybrid = BM25 + vector fused with Reciprocal Rank Fusion (k=60) — octobrain's default. Adds +2 nDCG@10 over the bare embedding and beats classic BM25 on both datasets.

¹ Canonical BM25 from the BEIR paper (Anserini/Lucene, k1=0.9 b=0.4). ² From the bge-small-en-v1.5 model card (MTEB).

Scope: this measures the ranking layer (embedding + BM25 fusion + reranking). BEIR passages are pre-chunked, so octobrain's chunking strategy is not exercised here.

Reproduce (downloads the datasets, builds a release binary, runs fully offline):

cd benches && bash scripts/run_retrieval.sh

Configuration

Configuration is stored in ~/.local/share/octobrain/config.toml. All options have sensible defaults.

Key Settings

Section Option Default Description
[embedding] model fastembed:nomic-ai/nomic-embed-text-v1.5 Embedding model (provider:model format). Default is a local fastembed model — no API key, runs on CPU.
[search] similarity_threshold 0.3 Minimum relevance (0.0-1.0)
[search.hybrid] enabled true Enable BM25 + vector fusion
[search.reranker] enabled true Enable cross-encoder reranking
[search.hyde] enabled true Pseudo-relevance feedback query expansion
[memory] max_memories 10000 Maximum stored memories
[memory] auto_linking_enabled true Auto-connect similar memories
[knowledge] chunk_size 1200 Characters per chunk

Embedding Providers

[embedding]
# Local models (no API key, runs on CPU, model auto-downloaded on first use)
model = "fastembed:nomic-ai/nomic-embed-text-v1.5"                      # Default: 768-dim, 8192-token context
model = "fastembed:BAAI/bge-small-en-v1.5"                              # 384-dim, ~62 MTEB, fast + good quality
model = "fastembed:sentence-transformers/all-MiniLM-L6-v2-quantized"  # Smallest (~22MB), fastest
model = "fastembed:BAAI/bge-base-en-v1.5"                              # Larger (~440MB), higher quality
model = "fastembed:intfloat/multilingual-e5-small"                     # Multilingual

# Cloud providers (require API keys, generally higher quality)
model = "voyage:voyage-3.5-lite"          # VOYAGE_API_KEY
model = "openai:text-embedding-3-small"   # OPENAI_API_KEY
model = "google:text-embedding-004"       # GOOGLE_API_KEY
model = "jina:jina-embeddings-v3"         # JINA_API_KEY

Full Configuration

See config-templates/default.toml for all available options with documentation.

Memory Types

Organize memories by category for better filtering:

Type Use For
code Code patterns, solutions, implementations
architecture System design, decisions, patterns
bug_fix Bug fixes, troubleshooting, solutions
feature Feature specs, implementations
documentation Docs, explanations, knowledge
user_preference Settings, preferences, workflows
decision Project decisions, trade-offs
learning Tutorials, notes, education
configuration Setup, config, deployment
testing Test strategies, QA insights
performance Optimizations, benchmarks
security Vulnerabilities, fixes, considerations
validation Idea/product validation, hypothesis testing
research Technical/market research, analysis
workflow SOPs, playbooks, process descriptions
requirement Business requirements, specs, constraints
design UI/UX decisions, wireframes, system design
integration API integrations, third-party services
communication Stakeholder updates, team decisions
process Deployment procedures, runbooks, operations
insight General insights, tips
goal Task/intent anchors for consolidation workflow

MCP Integration

Claude Desktop Setup

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "octobrain": {
      "command": "/path/to/octobrain",
      "args": ["mcp"]
    }
  }
}

Restart Claude Desktop. Octobrain tools will be available in your conversations.

HTTP Transport

For web-based integrations:

octobrain mcp --bind 0.0.0.0:12345

The server exposes endpoints at /mcp for MCP protocol communication.

Storage Locations

Data is stored in platform-specific directories:

Platform Location
macOS ~/.local/share/octobrain/
Linux ~/.local/share/octobrain/ or $XDG_DATA_HOME/octobrain/
Windows %APPDATA%\octobrain\

Project-specific memories are isolated by Git remote URL hash.

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Run cargo clippy and fix all warnings
  4. Run cargo test --no-default-features
  5. Submit a pull request

Development Setup

# Clone and build
git clone https://github.com/muvon/octobrain.git
cd octobrain
cargo build --no-default-features

# Run tests
cargo test --no-default-features

# Run clippy
cargo clippy --no-default-features

License

Apache-2.0 — see LICENSE for details.

Credits

Developed by Muvon Un Limited.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选