// 'Consult with powerful AI models via Python/LiteLLM for complex analysis, architectural reviews, security audits, or comprehensive code understanding. Supports any LiteLLM-compatible model (100+ providers) with custom base URLs. Use when you need deeper insights: (1) Complex architectural decisions, (2) Security vulnerability analysis, (3) Comprehensive code reviews across large codebases, (4) Understanding intricate patterns in unfamiliar code, (5) Expert-level domain analysis. Runs asynchronously with session management.'
| name | consultant |
| description | Consult with powerful AI models via Python/LiteLLM for complex analysis, architectural reviews, security audits, or comprehensive code understanding. Supports any LiteLLM-compatible model (100+ providers) with custom base URLs. Use when you need deeper insights: (1) Complex architectural decisions, (2) Security vulnerability analysis, (3) Comprehensive code reviews across large codebases, (4) Understanding intricate patterns in unfamiliar code, (5) Expert-level domain analysis. Runs asynchronously with session management. |
Consultant is a Python-based tool using LiteLLM to provide access to powerful AI models for complex analysis tasks. It accepts file globs and prompts, runs asynchronously, and returns detailed insights after extended reasoning time.
Key advantages:
The CLI uses uv for automatic dependency management. Dependencies (litellm, requests) are installed automatically on first run via PEP 723 inline script metadata.
If uv is not installed:
curl -LsSf https://astral.sh/uv/install.sh | sh
IMPORTANT: Always run uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py --help first to understand current capabilities.
Where {CONSULTANT_SCRIPTS_PATH} is the path to claude-plugins/consultant/skills/consultant/scripts/
Note: Always use uv run --upgrade to ensure litellm is at the latest version. This is important because LiteLLM frequently adds support for new models.
The consultant script runs synchronously (blocking until completion). For long-running analyses, you should run it in the background using the Bash tool with run_in_background: true, then use BashOutput to check progress every 30 seconds until completion.
Example: Running in background via Bash tool
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py \
--prompt "Analyze this code for security vulnerabilities" \
--file src/**/*.py \
--slug "security-audit"
When calling via the Bash tool:
run_in_background: true parameterWhat you'll see:
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py session security-audit
This returns JSON with:
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py list
Shows all sessions with status, timestamps, and models used.
# Use custom LiteLLM endpoint
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py \
--prompt "Review this PR" \
--file src/**/*.ts \
--slug "pr-review" \
--base-url "http://localhost:8000" \
--model "gpt-5.1"
Query models from a custom LiteLLM endpoint:
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py models \
--base-url "http://localhost:8000"
What happens:
http://localhost:8000/v1/models[
{"id": "gpt-5.1", "created": 1234567890, "owned_by": "openai"},
{"id": "claude-sonnet-4-5", "created": 1234567890, "owned_by": "anthropic"}
]
Query known models from major providers:
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py models
What happens:
[
{"id": "gpt-5.1", "provider": "openai"},
{"id": "claude-sonnet-4-5", "provider": "anthropic"},
{"id": "gemini/gemini-2.5-flash", "provider": "google"}
]
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py \
--prompt "Architectural review" \
--file "**/*.py" \
--slug "arch-review" \
--base-url "http://localhost:8000"
# No --model flag
Consultant will:
http://localhost:8000/v1/models to get available modelsFor model selection guidance: Check https://artificialanalysis.ai for up-to-date model benchmarks and rankings to choose the best model for your use case.
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py \
--prompt "Code review" \
--file src/*.py \
--slug "review"
# No --model flag, no --base-url flag
Consultant will:
For model selection guidance: Check https://artificialanalysis.ai for up-to-date model benchmarks and rankings. Recommended defaults: gpt-5-pro, claude-opus-4-5-20251101, gemini/gemini-3-pro-preview.
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py \
--prompt "Bug analysis" \
--file src/*.py \
--slug "bug" \
--model "gpt-5.1"
Consultant will:
gpt-5.1 directlyuv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py \
--prompt "..." \
--file ... \
--slug "..." \
--api-key "your-api-key"
Or use environment variables (see below).
Consultant checks these environment variables:
API Keys (checked in order):
LITELLM_API_KEY: Generic LiteLLM API keyOPENAI_API_KEY: For OpenAI modelsANTHROPIC_API_KEY: For Claude modelsBase URL:
OPENAI_BASE_URL: Default base URL (used if --base-url not provided)Example:
# Set API key
export LITELLM_API_KEY="your-key-here"
# Optional: Set default base URL
export OPENAI_BASE_URL="http://localhost:8000"
# Now consultant will use the base URL automatically
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py --prompt "..." --file ... --slug "..."
Perfect for:
Don't use consultant for:
Sessions are stored in ~/.consultant/sessions/{session-id}/ with:
metadata.json: Status, timestamps, token counts, model infoprompt.txt: Original user promptoutput.txt: Streaming response (grows during execution)error.txt: Error details (if failed)file_*: Copies of all attached filesQuery status anytime:
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py session <slug>
The most recent session with that slug will be returned.
Sessions persist until manually deleted:
rm -rf ~/.consultant/sessions/{session-id}
Consultant automatically:
Example output:
๐ Token Usage:
- Prompt: 1,234 tokens
- Files: 45,678 tokens (15 files)
- Total: 46,912 tokens
- Limit: 128,000 tokens
- Available: 102,400 tokens (80%)
If context exceeded:
ERROR: Input exceeds context limit!
Input: 150,000 tokens
Limit: 128,000 tokens
Overage: 22,000 tokens
Suggestions:
1. Reduce number of files (currently 25)
2. Use a model with larger context
3. Shorten the prompt
When no model is specified, consultant:
/v1/models or known list)Through LiteLLM, consultant supports:
Consultant provides clear error messages for common issues:
ERROR: No API key provided.
Set LITELLM_API_KEY environment variable or use --api-key flag.
ERROR: Input exceeds context limit!
[Details and suggestions]
ERROR: Model 'gpt-7' not found at base URL
Available models: [list]
WARNING: Network error connecting to http://localhost:8000
Retrying in 5 seconds... (attempt 2/3)
Issue: uv: command not found
Solution:
curl -LsSf https://astral.sh/uv/install.sh | sh
Issue: ImportError: No module named 'litellm'
Solution: This shouldn't happen with uv run, but if it does, clear uv cache:
uv cache clean
Issue: Session stuck in "running" status
Solution:
ls ~/.consultant/sessions/{session-id}/error.txt: cat ~/.consultant/sessions/{session-id}/error.txtps aux | grep consultant_cli.pyIssue: Context limit exceeded
Solution:
Issue: Model discovery fails
Solution:
--modelcurl http://localhost:8000/v1/modelsuv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py \
--prompt "Identify SQL injection vulnerabilities in the authentication module. For each finding, provide: vulnerable code location, attack vector, and recommended fix." \
--file "apps/*/src/**/*.{service,controller}.ts" \
--slug "security-audit" \
--model "claude-sonnet-4-5"
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py \
--prompt "Identify the top 5 highest-impact architectural issues causing tight coupling. For each: explain the problem, show affected components, and recommend a solution." \
--file "apps/*/src/**/*.ts" \
--slug "arch-review"
# Generate diff first
git diff origin/main...HEAD > /tmp/pr-diff.txt
uv run --upgrade {CONSULTANT_SCRIPTS_PATH}/consultant_cli.py \
--prompt "Review this PR for production deployment. Flag blockers, high-risk changes, and suggest regression tests." \
--file /tmp/pr-diff.txt \
--slug "pr-review"
The consultant agent uses this Python CLI automatically. When you invoke:
/consultant-review/consultant-investigate-bug/consultant-execplanThe agent constructs the appropriate consultant_cli.py command with all necessary files and prompt.