local-brain
Delegate complex, multi-step codebase exploration to local Ollama models. Best for analysis, review, and understanding tasks that require reasoning across multiple files.
What this skill does
# Local Brain
Delegate complex codebase exploration to local Ollama models. Local Brain excels at multi-step tasks requiring reasoning, not simple commands.
## When to Use Local Brain
Local Brain adds 10-70 seconds of LLM inference overhead per query. Use it for tasks where AI reasoning provides value, not for simple commands.
**Use Local Brain for:**
- Multi-step exploration ("Find all error handlers and explain how they work")
- Code review and analysis ("Review recent changes for potential issues")
- Understanding unfamiliar code ("Explain how authentication flows through the system")
- Tasks requiring judgment ("What patterns does this codebase use?")
- When you don't know which files or commands to look at
**Do NOT use Local Brain for:**
- Simple file listing (use `ls` or `find` directly โ 1000x faster)
- Git status/log (use `git log` directly โ 1000x faster)
- Reading a specific known file (use `cat` or your editor)
- Any single-command operation where you know what to run
**Performance reality:** A simple "list files" query takes 12-70 seconds via Local Brain vs 5ms via `ls`. The value is in the reasoning, not the tool execution.
## Installation
Install local-brain:
```bash
uv pip install local-brain
```
Or with pipx:
```bash
pipx install local-brain
```
**Requirements:**
- Ollama running locally (https://ollama.ai)
- A model pulled (e.g., `ollama pull qwen3`)
## Usage
```bash
local-brain "prompt" # Ask anything (auto-selects best model)
local-brain -v "prompt" # Show tool calls
local-brain -d "prompt" # Show step-by-step debug output
local-brain -m qwen3-coder:30b "prompt" # Specific model
local-brain --trace "prompt" # Enable OTEL tracing
local-brain --list-models # Show available models
local-brain --root /path/to/project "prompt" # Set project root
local-brain doctor # Check system health
```
## Health Check
Verify your setup is working correctly:
```bash
local-brain doctor
```
This checks:
- Ollama is installed and running
- Recommended models are available
- Tools execute correctly
- Optional tracing dependencies
Example output:
```
๐ Local Brain Health Check
Checking Ollama...
โ
Ollama is installed (ollama version is 0.13.1)
Checking Ollama server...
โ
Ollama server is running (9 models)
Checking recommended models...
โ
Recommended models installed: qwen3:latest
Checking tools...
โ
Tools working (9 tools available)
Checking optional features...
โ
OTEL tracing available (--trace flag)
========================================
โ
All checks passed! Local Brain is ready.
```
## Examples
Focus on tasks where AI reasoning adds value:
```bash
# Code review and analysis (good use case)
local-brain "Review the recent git changes and identify potential issues"
local-brain "Analyze the error handling patterns in this codebase"
# Understanding unfamiliar code (good use case)
local-brain "Explain how the authentication system works end-to-end"
local-brain "What design patterns does this codebase use?"
# Multi-step exploration (good use case)
local-brain "Find all TODO comments and categorize them by urgency"
local-brain "Trace how user input flows through the validation layer"
# Generate content requiring context (good use case)
local-brain "Generate a commit message based on the staged changes"
local-brain "Summarize what changed in the last 5 commits"
```
## Model Selection Guide
Choose the right model for your task:
### For Code Exploration (Recommended)
Use `qwen3-coder:30b` for faster exploration tasks:
```bash
local-brain -m qwen3-coder:30b "Find all error handlers and explain how they work"
local-brain -m qwen3-coder:30b "What validation patterns are used in this codebase?"
local-brain -m qwen3-coder:30b "Trace the data flow from API endpoint to database"
```
Why: 2.5x faster than qwen3:30b (12-20s vs 35-70s per query), direct tool usage.
### For Complex Reasoning
Use `qwen3:30b` for tasks requiring deeper analysis:
```bash
local-brain -m qwen3:30b "Analyze the architecture and suggest improvements"
local-brain -m qwen3:30b "Review recent changes for security vulnerabilities"
local-brain -m qwen3:30b "Explain how authentication works end-to-end"
```
Why: More thorough reasoning, better at synthesis and review tasks.
### Tips for Better Results
Use --debug to see what the model is doing step-by-step:
```bash
local-brain -d -m qwen3-coder:30b "Analyze the test coverage gaps"
```
**Avoid these models** (broken or unreliable tool calling):
- `qwen2.5-coder:*` - Outputs JSON instead of executing tools
- `llama3.2:1b` - Too small, hallucinates paths
- `deepseek-r1:*` - No tool support at architecture level
If no model is specified, Local Brain auto-selects the best installed model.
## Observability
### Debug Mode (--debug or -d)
See step-by-step progress with the `--debug` flag:
```bash
local-brain --debug "Analyze error handling in the auth module"
```
This shows:
- Step number and duration
- Tool calls with arguments
- Result preview (truncated)
- Token usage per step
Example output:
```
[debug] Model: qwen3-coder:30b
[debug] Project root: /path/to/project
[Step 1] (4.2s)
Tool: list_directory(path='.', pattern='**/*')
Result:
src/main.py
src/utils.py
... (15 lines total)
Tokens: 2634 in / 42 out
```
### OTEL Tracing (--trace)
Enable OpenTelemetry tracing to visualize agent execution with detailed timing and metrics:
```bash
local-brain --trace "Review recent changes and identify potential issues"
```
This captures:
- Agent execution timeline (total duration)
- Individual steps (planning, execution, final answer)
- LLM calls with token counts
- Tool invocations with inputs/outputs
- Timing for each operation
#### Visualizing Traces with Jaeger (Recommended)
For real-time visualization of agent execution, use Jaeger:
**1. Start Jaeger (one-time setup):**
```bash
docker run -d \
--name jaeger \
-p 16686:16686 \
-p 4318:4318 \
jaegertracing/all-in-one
```
**2. Run local-brain with tracing:**
```bash
local-brain --trace -m qwen3-coder:30b "Analyze the test patterns in this codebase"
```
**3. View in Jaeger UI:**
Open http://localhost:16686 and select:
- Service: `local-brain`
- Operation: `CodeAgent.run`
You'll see a waterfall timeline showing:
```
CodeAgent.run (5.1s total)
โโโ Step 1 (2.04s)
โ โโโ LiteLLMModel.generate (2.03s) โ LLM latency
โ โโโ list_directory (1.5ms) โ Tool execution
โโโ Step 2 (3.09s)
โโโ LiteLLMModel.generate (3.09s)
โโโ FinalAnswerTool (0.1ms)
```
Click any span to see details: tokens used, arguments, outputs, errors.
#### Install Tracing Dependencies
For JSON console output only (no Jaeger):
```bash
pip install local-brain[tracing]
```
For Jaeger visualization, also install:
```bash
pip install opentelemetry-exporter-otlp
```
#### Combining Flags for Maximum Insight
Use all three flags together for complete visibility:
```bash
local-brain --trace --debug -m qwen3-coder:30b "Review recent changes for security issues"
```
This gives:
- `--trace` โ OTEL spans in Jaeger (timing, tokens, architecture)
- `--debug` โ Real-time step progress to stderr (what's happening now)
- `--verbose` โ Tool calls in main output (what was called)
Note: `--debug` and `--trace` can be combined.
## Security
All file operations are **restricted to the project root** (path jailing):
- Files outside the project directory cannot be read
- Shell commands execute within the project root
- Sensitive files (`.env`, `.pem`, SSH keys) are blocked
- Only read-only shell commands are allowed
- All tool outputs are truncated (200 lines / 20K chars max)
- Tool calls have timeouts (30 seconds default)
## Available Tools
The model assumes these tools are available and uses them directly:
### File Tools
- `read_file(path)` - Read file contents at a given `path`. Large files are truncated (200 lines / 20K chars). Has 30s timeout. **Restricted to projRelated in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.