Agent Brain 标志

Agent Brain

组织
SpillwaveSolutions

Local-first RAG memory for AI agents: hybrid + GraphRAG search, MCP server with OAuth 2.1, plugin for Claude Code / OpenCode / Codex.

发布者SpillwaveSolutions
代码仓库agent-brain
语言Python
复刻数
23
星标数
119
可用工具
0
传输类型stdio
许可协议MIT
链接
  • 将工具接入 AI 工作流

    Agent Brain 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 119 个 Star 和 23 个 Fork。


last_validated: 2026-03-16

Agent Brain

A RAG-based (Retrieval-Augmented Generation) document indexing and semantic search system for AI agents and applications. Agent Brain enables intelligent querying of documentation and source code using natural language.

Overview

Agent Brain provides AI-first document and code search through a Claude Code plugin with skills, commands, and agents. Use slash commands to search, agents for complex research tasks, and skills for intelligent query optimization.

ComponentDescription
Plugin30 slash commands, 3 agents, 2 skills for Claude Code
SkillsIntelligent search mode selection and query optimization
AgentsResearch assistant, search assistant, setup assistant
ServerFastAPI backend for indexing and retrieval
CLICommand-line tool (also used by plugin internally)

Quick Start (Claude Code Plugin)

1. Install the Plugin

bash
# 1. Add the Agent Brain marketplace (the repo is a plugin marketplace)
claude plugins marketplace add SpillwaveSolutions/agent-brain

# 2. Install the plugin from that marketplace
claude plugins install agent-brain@agent-brain-marketplace

Installing a Claude Code plugin does not use pip. The plugin is installed through the marketplace above; the underlying Python packages (agent-brain-rag, agent-brain-cli) are installed for you by the /agent-brain-setup wizard (or manually via pip — see CLI Usage).

Other hosts

The same plugin installs into Codex, Cursor, Grok Build, and OpenCode through the CLI. Each command converts the shared payload into the host's native layout and, with --with-mcp, registers the MCP server in that host's config file.

bash
pip install agent-brain-rag agent-brain-cli agent-brain-ag-mcp
agent-brain install-agent --agent codex --with-mcp     # .codex/skills/agent-brain + AGENTS.md; MCP in ~/.codex/config.toml
agent-brain install-agent --agent cursor --with-mcp    # .cursor/plugins/agent-brain + .cursor/rules; MCP in .cursor/mcp.json
agent-brain install-agent --agent grok --with-mcp      # .grok/plugins/agent-brain; zero-config Claude load, MCP in .mcp.json
agent-brain install-agent --agent opencode --with-mcp  # .opencode/plugins/agent-brain; MCP in opencode.json

A conforming Agent Plugins 1.0 client reads agent-brain-plugin/plugin.json, skills/, and mcp.json directly. See docs/HOSTS.md for the manifest each host reads.

2. Set Up Your Project

In Claude Code, run:

/agent-brain-setup

This interactive wizard will:

  • Install the Python packages (agent-brain-rag, agent-brain-cli)
  • Configure your API keys
  • Initialize the project
  • Start the server
  • Index your documentation

3. Search with Commands

/agent-brain-search "how does authentication work"

That's it! The plugin handles everything automatically.

Plugin Commands

Search Commands

CommandDescriptionUse When
/agent-brain-searchSmart hybrid search (recommended)General questions
/agent-brain-semanticPure semantic/vector searchConceptual queries
/agent-brain-keywordBM25 keyword searchError messages, function names
/agent-brain-hybridHybrid with alpha tuningFine-tuned searches
/agent-brain-graphKnowledge graph search"What calls X?", dependencies
/agent-brain-multiAll modes combined (RRF)Maximum recall

Server Commands

CommandDescription
/agent-brain-startStart the server (auto-port)
/agent-brain-stopStop the server
/agent-brain-statusCheck health and document count
/agent-brain-indexIndex documents or code

Setup Commands

CommandDescription
/agent-brain-setupComplete guided setup wizard
/agent-brain-installInstall pip packages
/agent-brain-initInitialize project directory
/agent-brain-verifyVerify configuration
/agent-brain-providersConfigure embedding/summarization providers

Plugin Agents

Agent Brain includes three intelligent agents for complex tasks:

AgentDescriptionTriggered By
Search AssistantMulti-step search across modes, synthesizes answers"Find all references to...", "Research how..."
Research AssistantDeep exploration with follow-up queries"Investigate...", "Analyze the architecture of..."
Setup AssistantGuided installation and troubleshooting"Help me set up Agent Brain", configuration issues

Example Agent Interaction

You: "Research how authentication is implemented across the codebase"

Research Assistant:

  1. Searches documentation for auth concepts
  2. Queries code for auth-related functions
  3. Uses graph mode to find dependencies
  4. Synthesizes comprehensive answer with references

Plugin Skills

Skills provide intelligent context to Claude for optimal searching:

SkillPurpose
using-agent-brainSearch mode selection, query optimization, API knowledge
configuring-agent-brainInstallation, provider configuration, troubleshooting

When you ask about documentation or code, Claude automatically uses the skill to:

  • Choose the best search mode for your query
  • Set appropriate parameters (top_k, threshold, alpha)
  • Interpret and synthesize results

Search Modes

ModeBest ForExample Query
HYBRIDGeneral questions (default)"How does caching work?"
VECTORConceptual understanding"Explain the architecture"
BM25Exact terms, error codes"NullPointerException", "getUserById"
GRAPHRelationships, dependencies"What classes use AuthService?"
MULTIComprehensive search"Everything about data validation"

Pluggable Providers

Agent Brain supports multiple providers for embeddings and summarization:

Embedding Providers

ProviderModelsLocal
OpenAItext-embedding-3-large, text-embedding-3-smallNo
Ollamanomic-embed-text, mxbai-embed-largeYes
Cohereembed-english-v3.0, embed-multilingual-v3.0No

Summarization Providers

ProviderModelsLocal
Anthropicclaude-haiku-4-5-20251001, claude-sonnet-4-5-20250514No
OpenAIgpt-5, gpt-5-miniNo
Geminigemini-3-flash, gemini-3-proNo
Grokgrok-4, grok-4-fastNo
Ollamallama4:scout, mistral-small3.2, qwen3-coderYes

Fully Local Mode

Run completely offline with Ollama:

/agent-brain-providers
# Select Ollama for both embeddings and summarization

Features

Code Search

  • 10 Programming Languages: Python, TypeScript, JavaScript, Java, Kotlin, C, C++, C#, Go, Rust, Swift
  • AST-Aware Chunking: Tree-sitter parsing preserves code structure
  • LLM Summaries: AI-generated descriptions improve semantic search
  • Language Filtering: Filter results by programming language

GraphRAG (Knowledge Graph)

  • Entity and relationship extraction
  • Dependency-aware queries ("What calls X?")
  • Code structure visualization

Multi-Instance Architecture

  • Per-project isolated servers
  • Automatic port allocation
  • Work on multiple projects simultaneously

Project Structure

agent-brain/
├── agent-brain-plugin/        # Claude Code plugin (primary interface)
│   ├── commands/              # 30 slash commands
│   ├── agents/                # 3 intelligent agents
│   └── skills/                # 2 context skills
├── agent-brain-server/        # FastAPI backend
├── agent-brain-cli/           # CLI tool (used by plugin)
└── docs/                      # Documentation

Documentation

Getting Started

Reference

Architecture

CLI Usage (Alternative)

While the plugin is the recommended interface, you can also use the CLI directly:

bash
# Install
pip install agent-brain-rag agent-brain-cli

# Initialize and start
agent-brain init                     # auto-generates a per-project API key
agent-brain start --daemon

# Index and query
agent-brain index /path/to/docs --include-code
agent-brain query "authentication" --mode hybrid

Note on authentication. As of the next release, every data endpoint requires X-API-Key. agent-brain init writes a 32-byte urlsafe key into .agent-brain/config.json (mode 0o600); the CLI and agent-brain-mcp pick it up automatically. Pass --no-api-key to agent-brain init for the legacy no-auth experience on 127.0.0.1. The server refuses to start on any non-loopback bind without a key set. See docs/CHANGELOG.md under the unreleased entry for the full design (Issue #179).

Development

Prerequisites

  • Python 3.10+
  • Poetry (dependency management)
  • Task (task runner)

Setup

bash
git clone https://github.com/SpillwaveSolutions/agent-brain.git
cd agent-brain
task install

Running Tests

bash
task test           # All tests
task before-push    # Full quality check

Technology Stack

  • Plugin: Claude Code slash commands, agents, skills
  • Server: FastAPI + Uvicorn
  • Vector Store: ChromaDB (HNSW, cosine similarity)
  • BM25 Index: LlamaIndex BM25Retriever
  • Graph Store: SimplePropertyGraphStore / Kuzu
  • Embeddings: OpenAI or Ollama
  • Summarization: Claude, GPT-5, Gemini, Grok, or Ollama
  • AST Parsing: tree-sitter (10 languages)
  • CLI: Click + Rich
  • Build System: Poetry

Contributing

See the Developer Guide for setup instructions.

Before pushing changes, always run:

bash
task before-push

License

MIT License - see LICENSE file for details.

Links

将 Agent Brain MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Agent Brain 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 Agent Brain 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Agent Brain MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "agent-brain": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Agent Brain MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Agent Brain MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Agent Brain 帮我完成这项任务吗?
Agent Brain
当然。我已阅读。
以下是我使用 Agent Brain 得到的结果。

常见问题

Agent Brain MCP 服务器有什么用途?

Agent Brain 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Agent Brain MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 Agent Brain,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 Agent Brain MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 Agent Brain 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Agent Brain MCP 连接到 TypingMind?

Agent Brain 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Agent Brain MCP 在 TypingMind 中提供哪些工具?

Agent Brain 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Agent Brain MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 Agent Brain 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇