Multi-Agent Deep Research CLI - Terminal-based research tool with intelligent breadth/depth exploration.
Use it two ways:
- Terminal CLI - Interactive TUI for deep research
- Claude Code & OpenCode Skills - Load as a skill/command in AI assistants
# Install dependencies
bun install
# Set up environment
cp .env.example .env
# Edit .env with your API keysRequired environment variables:
# Anthropic Claude API
ANTHROPIC_AUTH_TOKEN=your_token
ANTHROPIC_BASE_URL=https://api.anthropic.com
# Web search (Exa API)
EXA_API_KEY=your_exa_keyGetting API Keys:
- Anthropic Claude: Visit https://console.anthropic.com/ to get your API key
- Exa Search API: Visit https://exa.ai/api and sign up for an account
- Free tier: 1000 requests/month
"EXA_API_KEY not set" error
- Ensure your
.envfile is in the project root - Restart your terminal after creating
.env - Verify the key has no extra spaces when copying
Rate limiting errors
- Reduce breadth/depth parameters:
bun run research "topic" --breadth 10 --depth 2 - Check your Exa API plan limits at https://exa.ai/dashboard
- Wait a few seconds before retrying
Research appears stuck
- The AI is thinking - this can take 10-30 seconds for scope planning
- Check debug.log for errors:
cat debug.log - Verify network connectivity
- Try reducing complexity with
--mode quick
TypeScript build errors
- Run
bun run typecheckto see specific errors - Ensure all dependencies are installed:
bun install - Try cleaning build artifacts:
rm -rf dist/ && bun run build:only
TUI not displaying correctly
- Ensure your terminal supports Unicode characters
- Try a different terminal app (iTerm2, Terminal.app)
- Check your terminal font settings
Interactive terminal UI with real-time progress tracking.
# Start the CLI
bun run cli.ts
# or
bun run start
# Development with auto-reload
bun run devFeatures:
- Beautiful TUI with progress bars, task tracking, and metrics
- Auto mode - AI determines optimal breadth (10-30) and depth (1-10)
- Multiple modes: quick, standard, deep, ultradeep
- Real-time phase updates and progress tracking
Interactive Commands:
| Command | Description |
|---|---|
:help |
Show all commands |
:export <file> |
Save report to markdown file |
:status |
Show current research status |
:restart |
Start new research session |
:quit |
Exit the application |
Load as a skill in Claude Code or use as a command in OpenCode.
The skill file is at .claude/skills/deep-research.md.
Claude Code will automatically discover it. Just ask:
/deep-research "your research question"
/deep-research "complex topic" --mode deep
/deep-research "topic" --breadth 20 --depth 5
The command file is at .opencode/commands/deep-research.md.
Registered in opencode.json - available as:
/deep-research <query> [options]
Options:
| Flag | Description |
|---|---|
--mode, -m |
auto |
--breadth, -b |
Number of sources (1-50) |
--depth, -d |
Number of depth rounds (0-10) |
--out <path> |
Save report to file |
Examples:
/deep-research "How does Redis clustering work?"
/deep-research "PostgreSQL vs MySQL" --mode deep
/deep-research "Microservices patterns" --breadth 25 --depth 5
/deep-research "GraphQL best practices" --out ./research/graphql.md┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ SCOPE PLANNING │ → │ BREADTH SEARCH │ → │ DEPTH DECISION │
│ LLM analyzes │ │ 10-30 sources │ │ LLM evaluates │
│ query complexity│ │ Extract 3x each │ │ if depth needed │
└─────────────────┘ └─────────────────┘ └─────────────────┘
↓
┌─────────────────────────┐
│ DEPTH SEARCH │
│ Iterative deep dives │
│ 1-10 rounds │
│ Domain-specific search │
└─────────────────────────┘
↓
┌─────────────────────────┐
│ REPORT GENERATION │
│ Comprehensive markdown │
│ with citations │
└─────────────────────────┘
| Mode | Breadth | Depth | Best For |
|---|---|---|---|
auto |
AI (10-30) | AI (1-10) | Most queries (default) |
quick |
10 | 0 | Fast overview, breadth only |
standard |
15 | 3 | General research |
deep |
20 | 5 | Complex topics |
ultradeep |
25 | 10 | Academic/thesis level |
- No Context Bloat - Each result truncated to 25KB, only 3 key learnings stored per source
- Dynamic Scope - AI determines optimal breadth/depth based on query complexity
- Aggressive Depth Bias - Defaults toward continuing research vs. stopping early
- Evidence-Based Reports - All findings include source citations
# Terminal CLI
bun run start # Start interactive CLI
bun run dev # Development mode with auto-reload
bun run build # Full build
bun run build:only # TypeScript compilation only
# Skill/Research commands
bun run research "query" # Run research via skill handler
bun run research:quick "query" # Quick mode
bun run research:deep "query" # Deep modeterm-research/
├── cli.ts # Terminal CLI entry point
├── src/
│ ├── skill-handler.ts # Unified skill handler for Claude Code/OpenCode
│ ├── workflow/
│ │ └── research-orchestrator.ts # Core research engine
│ ├── search/
│ │ └── search-manager.ts # Exa API integration
│ ├── state/
│ │ └── research-state.ts # State management
│ ├── ui/
│ │ └── streaming-event-bus.ts # Event system for UI updates
│ ├── model.ts # LLM integration
│ ├── prompts.ts # Prompt templates
│ └── terminal-ui.ts # Blessed-based TUI
├── .claude/
│ └── skills/
│ └── deep-research.md # Claude Code skill definition
├── .opencode/
│ └── commands/
│ └── deep-research.md # OpenCode command definition
├── opencode.json # OpenCode configuration
└── package.json # NPM configuration
- bun - Runtime and package manager
- @ai-sdk/anthropic - Anthropic API client
- blessed - Terminal UI framework
- zod - Schema validation
- p-limit - Rate limiting
MIT