-
Notifications
You must be signed in to change notification settings - Fork 16
Agent Skill Definition
name: using-agent-brain description: | Expert Agent Brain skill for document search with BM25 keyword, semantic vector, hybrid, graph, and multi retrieval modes. Use when asked to "search documentation", "query domain", "find in docs", "bm25 search", "hybrid search", "semantic search", "graph search", "multi search", "find dependencies", "code relationships", "searching knowledge base", "querying indexed documents", "finding code references", "exploring codebase", "what calls this function", "find imports", "trace dependencies", "brain search", "brain query", or "knowledge base search". Supports multi-instance architecture with automatic server discovery. GraphRAG mode enables relationship-aware queries for code dependencies and entity connections. Pluggable providers for embeddings (OpenAI, Cohere, Ollama) and summarization (Anthropic, OpenAI, Gemini, Grok, Ollama). license: MIT allowed-tools:
- Bash
- Read metadata: version: 2.0.0 category: ai-tools author: Spillwave
Expert-level skill for Agent Brain document search with five modes: BM25 (keyword), Vector (semantic), Hybrid (fusion), Graph (knowledge graph), and Multi (comprehensive fusion).
- Search Modes
- Mode Selection Guide
- GraphRAG (Knowledge Graph)
- Server Management
- When Not to Use
- Best Practices
- Reference Documentation
| Mode | Speed | Best For | Example Query |
|---|---|---|---|
bm25 |
Fast (10-50ms) | Technical terms, function names, error codes | "AuthenticationError" |
vector |
Slower (800-1500ms) | Concepts, explanations, natural language | "how authentication works" |
hybrid |
Slower (1000-1800ms) | Comprehensive results combining both | "OAuth implementation guide" |
graph |
Medium (500-1200ms) | Relationships, dependencies, call chains | "what calls AuthService" |
multi |
Slowest (1500-2500ms) | Most comprehensive with entity context | "complete auth flow with dependencies" |
| Parameter | Default | Description |
|---|---|---|
--mode |
hybrid | Search mode: bm25, vector, hybrid, graph, multi |
--threshold |
0.7 | Minimum similarity (0.0-1.0) |
--top-k |
5 | Number of results |
--alpha |
0.5 | Hybrid balance (0=BM25, 1=Vector) |
--traversal-depth |
2 | Graph traversal depth for graph/multi modes |
Searching for exact technical terms:
agent-brain query "recursiveCharacterTextSplitter" --mode bm25
agent-brain query "ValueError: invalid token" --mode bm25
agent-brain query "def process_payment" --mode bm25Counter-example - Wrong mode choice:
# BM25 is wrong for conceptual queries
agent-brain query "how does error handling work" --mode bm25 # Wrong
agent-brain query "how does error handling work" --mode vector # CorrectSearching for concepts or natural language:
agent-brain query "best practices for error handling" --mode vector
agent-brain query "how to implement caching" --mode vectorCounter-example - Wrong mode choice:
# Vector is wrong for exact function names
agent-brain query "getUserById" --mode vector # Wrong - may miss exact match
agent-brain query "getUserById" --mode bm25 # Correct - finds exact matchNeed comprehensive results (default mode):
agent-brain query "OAuth implementation" --mode hybrid --alpha 0.6
agent-brain query "database connection pooling" --mode hybridAlpha tuning:
-
--alpha 0.3- More keyword weight (technical docs) -
--alpha 0.7- More semantic weight (conceptual docs)
Exploring relationships and dependencies:
agent-brain query "what functions call process_payment" --mode graph
agent-brain query "classes that inherit from BaseService" --mode graph --traversal-depth 3
agent-brain query "modules that import authentication" --mode graphPrerequisite: Requires ENABLE_GRAPH_INDEX=true during server startup.
Need the most comprehensive results:
agent-brain query "complete payment flow implementation" --mode multi --include-relationshipsGraphRAG enables relationship-aware retrieval by building a knowledge graph from indexed documents.
export ENABLE_GRAPH_INDEX=true
agent-brain start --daemon| Query Pattern | Example |
|---|---|
| Function callers | "what calls process_payment" |
| Class inheritance | "classes extending BaseController" |
| Import dependencies | "modules importing auth" |
| Data flow | "where does user_id come from" |
See Graph Search Guide for detailed usage.
agent-brain init # Initialize project (first time)
agent-brain start --daemon # Start server
agent-brain index ./docs # Index documents
agent-brain query "search" # Search
agent-brain stop # Stop when doneProgress Checklist:
-
agent-brain initsucceeded -
agent-brain statusshows healthy - Document count > 0
- Query returns results (or "no matches" - not error)
| Command | Description |
|---|---|
agent-brain init |
Initialize project config |
agent-brain start --daemon |
Start with auto-port |
agent-brain status |
Show port, mode, document count |
agent-brain list |
List all running instances |
agent-brain stop |
Graceful shutdown |
Before querying, verify setup:
agent-brain statusExpected:
- Status: healthy
- Documents: > 0
- Provider: configured
Counter-example - Querying without validation:
# Wrong - querying without checking status
agent-brain query "search term" # May fail if server not running
# Correct - validate first
agent-brain status && agent-brain query "search term"See Server Discovery Guide for multi-instance details.
This skill focuses on searching and querying. Do NOT use for:
-
Installation - Use
configuring-agent-brainskill -
API key configuration - Use
configuring-agent-brainskill -
Server setup issues - Use
configuring-agent-brainskill -
Provider configuration - Use
configuring-agent-brainskill
Scope boundary: This skill assumes Agent Brain is already installed, configured, and the server is running with indexed documents.
- Mode Selection: BM25 for exact terms, Vector for concepts, Hybrid for comprehensive, Graph for relationships
- Threshold Tuning: Start at 0.7, lower to 0.3-0.5 for more results
-
Server Discovery: Use
runtime.jsonrather than assuming port 8000 -
Resource Cleanup: Run
agent-brain stopwhen done - Source Citation: Always reference source filenames in responses
- Graph Queries: Use graph mode for "what calls X", "what imports Y" patterns
- Traversal Depth: Start with depth 2, increase to 3-4 for deeper chains
| Guide | Description |
|---|---|
| BM25 Search | Keyword matching for technical queries |
| Vector Search | Semantic similarity for concepts |
| Hybrid Search | Combined keyword and semantic search |
| Graph Search | Knowledge graph and relationship queries |
| Server Discovery | Auto-discovery, multi-agent sharing |
| Provider Configuration | Environment variables and API keys |
| Integration Guide | Scripts, Python API, CI/CD patterns |
| API Reference | REST endpoint documentation |
| Troubleshooting | Common issues and solutions |
- Vector/hybrid/graph/multi modes require embedding provider configured
- Graph mode requires additional memory (~500MB extra)
- Supported formats: Markdown, PDF, plain text, code files (Python, JS, TS, Java, Go, Rust, C, C++)
- Not supported: Word docs (.docx), images
- Server requires ~500MB RAM for typical collections (~1GB with graph)
- Ollama requires local installation and model download
- Design-Architecture-Overview
- Design-Query-Architecture
- Design-Storage-Architecture
- Design-Class-Diagrams
- GraphRAG-Guide
- Agent-Skill-Hybrid-Search-Guide
- Agent-Skill-Graph-Search-Guide
- Agent-Skill-Vector-Search-Guide
- Agent-Skill-BM25-Search-Guide
Search
Server
Setup
- Pluggable-Providers-Spec
- GraphRAG-Integration-Spec
- Agent-Brain-Plugin-Spec
- Multi-Instance-Architecture-Spec