Logo Agent Brain

Agent Brain

Tổ chức
SpillwaveSolutions

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

Nhà phát hànhSpillwaveSolutions
Kho mãagent-brain
Ngôn ngữPython
Bản fork
23
Sao
119
Công cụ có sẵn
0
Phương thức truyền tảistdio
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Agent Brain cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    119 sao và 23 bản fork từ kho mã được liên kết.


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

Dùng MCP Agent Brain với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Agent Brain, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm Agent Brain làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Agent Brain.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "agent-brain": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Agent Brain, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Agent Brain.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Agent Brain giúp tôi làm việc này không?
Agent Brain
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Agent Brain.

Câu hỏi thường gặp

Máy chủ MCP Agent Brain dùng để làm gì?

Agent Brain là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Agent Brain với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Agent Brain với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Agent Brain với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Agent Brain, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Agent Brain với TypingMind?

Agent Brain hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP Agent Brain cung cấp những công cụ nào trong TypingMind?

Agent Brain cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Agent Brain không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Agent Brain yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇