-
Notifications
You must be signed in to change notification settings - Fork 2
Command Search
name: agent-brain-search description: Search indexed documentation using hybrid BM25+semantic retrieval parameters:
- name: query description: The search query text required: true
- name: top-k description: Number of results to return (1-20) required: false default: 5
- name: threshold description: Minimum relevance score (0.0-1.0) required: false default: 0.3
- name: alpha description: Hybrid blend (0=BM25 only, 1=semantic only) required: false default: 0.5 skills:
- using-agent-brain
Performs hybrid search combining BM25 keyword matching with semantic vector similarity. This is the default and recommended search mode as it balances exact term matching with conceptual understanding.
Hybrid search is ideal for:
- General documentation queries
- When you need both precise term matching and conceptual relevance
- Comprehensive search results across different document types
/agent-brain-search <query> [--top-k <n>] [--threshold <t>] [--alpha <a>]
| Parameter | Required | Default | Description |
|---|---|---|---|
| query | Yes | - | The search query text |
| top-k | No | 5 | Number of results (1-20) |
| threshold | No | 0.3 | Minimum relevance score (0.0-1.0) |
| alpha | No | 0.5 | Hybrid blend factor |
The --alpha parameter controls the balance between vector and BM25:
-
alpha = 1.0: 100% semantic (pure vector search) -
alpha = 0.7: 70% semantic, 30% keyword (favor meaning) -
alpha = 0.5: 50% each (balanced - default) -
alpha = 0.3: 30% semantic, 70% keyword (favor exact terms) -
alpha = 0.0: 100% keyword (pure BM25)
Before executing the search, verify the server is running:
agent-brain statusIf the server is not running, start it first:
agent-brain start --daemonagent-brain query "<query>" --mode hybrid --top-k <top-k> --threshold <threshold> --alpha <alpha># Basic hybrid search
agent-brain query "OAuth implementation" --mode hybrid
# More results with lower threshold
agent-brain query "error handling patterns" --mode hybrid --top-k 10 --threshold 0.2
# Favor keyword matching for technical terms
agent-brain query "AuthenticationError" --mode hybrid --alpha 0.3
# Favor semantic matching for concepts
agent-brain query "how does caching work" --mode hybrid --alpha 0.7Format search results with source citations:
For each result, present:
- Source: File path or document name
- Score: Relevance score (normalized 0-1)
- Content: Relevant excerpt from the document
## Search Results for "OAuth implementation"
### 1. docs/auth/oauth-guide.md (Score: 0.89)
OAuth 2.0 implementation requires configuring the authorization endpoint,
token endpoint, and callback URL. The recommended flow for server-side
applications is the Authorization Code flow...
### 2. src/auth/oauth_client.py (Score: 0.76)
class OAuthClient:
"""Handles OAuth 2.0 authentication flow."""
def __init__(self, client_id: str, client_secret: str):
self.client_id = client_id
...
### 3. docs/api/authentication.md (Score: 0.71)
The API supports OAuth 2.0 Bearer tokens. Include the token in the
Authorization header: `Authorization: Bearer <token>`...
---
Found 3 results above threshold 0.3
When referencing results in responses, always cite the source:
- "According to
docs/auth/oauth-guide.md..." - "The implementation in
src/auth/oauth_client.pyshows..."
Error: Could not connect to Agent Brain server
Resolution: Start the server with agent-brain start --daemon
No results found above threshold 0.3
Resolution:
- Try lowering the threshold:
--threshold 0.1 - Try different search terms
- Verify documents are indexed:
agent-brain status
Error: Alpha must be between 0.0 and 1.0
Resolution: Use a value between 0.0 and 1.0 for the alpha parameter
Error: OPENAI_API_KEY not set
Resolution: Set the environment variable:
export OPENAI_API_KEY="sk-proj-..."Warning: No documents indexed
Resolution: Index documents first:
agent-brain index /path/to/docs- 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