Chat with local Ollama models that can explore your codebase
Project description
[!WARNING] This is early experimental work — use it at your own risk! The API and features may change without notice.
Local Brain — Claude Code Plugin Marketplace
A Claude Code plugin marketplace that extends Claude with local capabilities. The first skill lets Claude delegate codebase exploration to local Ollama models.
Install Marketplace
Add this marketplace to Claude Code:
/plugin marketplace add IsmaelMartinez/local-brain
Then install the plugin:
/plugin install local-brain@local-brain-marketplace
Available Plugins
local-brain
Delegate codebase exploration to local Ollama models. Claude offloads read-only tasks to your machine—no cloud round-trips, full privacy.
┌─────────────┐ delegates ┌─────────────┐ calls ┌─────────┐
│ Claude Code │ ──────────────────►│ Local Brain │ ──────────────►│ Ollama │
│ (Cloud) │ │ (Smolagents)│ │ (Local) │
│ │◄────────────────── │ │◄────────────── │ │
└─────────────┘ returns └─────────────┘ responds └─────────┘
results with code execution
What Claude can delegate:
- "Review the code changes"
- "Explain how the auth module works"
- "Generate a commit message"
- "Find all TODO comments"
Marketplace Structure
This repo follows the Claude Code plugin structure:
local-brain/ # MARKETPLACE ROOT
├── .claude-plugin/
│ └── marketplace.json # Marketplace manifest
└── local-brain/ # PLUGIN
├── plugin.json # Plugin manifest
└── skills/
└── local-brain/
└── SKILL.md # Skill documentation
local-brain Plugin Details
Prerequisites
- Install the CLI:
uv pip install local-brain
Or with pipx:
pipx install local-brain
- Install Ollama from ollama.ai and pull a model:
ollama pull qwen3
CLI Usage
local-brain "What files changed recently?"
local-brain "Review the code in src/"
local-brain "Generate a commit message"
local-brain "Explain how auth works"
local-brain "prompt" # Ask anything (auto-selects best model)
local-brain -v "prompt" # Verbose (show tool calls)
local-brain -m qwen2.5-coder:7b "prompt" # Specific model
local-brain --list-models # Show available models
local-brain --root /path/to/project "prompt" # Set project root
Model Discovery
Local Brain automatically detects installed Ollama models and picks the best one:
local-brain --list-models
Recommended models:
qwen3:latest— General purpose (default)qwen2.5-coder:7b— Code-focusedllama3.2:3b— Fast, lightweightmistral:7b— Balanced
Tools
Custom read-only tools registered with Smolagents' @tool decorator:
| Tool | What it does |
|---|---|
read_file |
Read file contents (path-jailed) |
list_directory |
List files with glob patterns (path-jailed) |
file_info |
Get file metadata (path-jailed) |
git_diff |
Show git changes (staged or unstaged) |
git_status |
Show current branch and changes |
git_log |
View recent commit history |
git_changed_files |
List modified/staged files |
Architecture
Local Brain uses Smolagents as the agent framework:
local_brain/
├── __init__.py # Version
├── cli.py # Click CLI entry point
├── models.py # Ollama model discovery & selection
├── security.py # Path jailing utilities
└── smolagent.py # CodeAgent + custom tools
What comes from Smolagents:
CodeAgent— Agent that executes tasks via code generationLiteLLMModel— Connects to Ollama via LiteLLM@tooldecorator — Registers our custom tools with the agent
What we implement:
- All 7 tools (read_file, git_diff, etc.) — our code, registered via
@tool - Path jailing security — restricts file access to project root
- Model discovery — detects installed Ollama models
Security
Two-layer security model:
-
Tool layer — Our pre-defined tools are trusted code:
- ✅ Read files within project directory (path-jailed)
- ✅ Execute git commands (read-only via subprocess)
- ❌ File I/O outside project root blocked
- ❌ Sensitive files blocked (
.env, keys)
-
LLM sandbox — Code generated by the LLM runs in LocalPythonExecutor:
- ❌ Cannot import subprocess, socket, os.system, etc.
- ❌ Cannot access network directly
- ✅ Can only call our pre-defined tools
The LLM writes Python code that calls our tools—it cannot bypass them to run arbitrary shell commands.
Why no web access? Claude Code already has web access—delegate web research to Claude, local codebase work to Local Brain. This separation prevents data exfiltration and prompt injection from fetched content.
Future Ideas
- MCP Bridge — Ollama ↔ Model Context Protocol bridge when MCP adoption increases
- Docker Sandbox — Stronger isolation via container when Docker is available
- CLI Wrappers — Wrap existing tools (ripgrep, gh, tokei) instead of custom implementations
- Observability — Add tracing and logging for debugging agent behavior
Architecture Decisions
See docs/adrs/ for Architecture Decision Records:
- ADR-001 — Why custom implementation over frameworks
- ADR-002 — Why Smolagents for code execution
- ADR-003 — Why no web tools
Adding New Plugins
Want to add a plugin to this marketplace?
- Create a new directory at the root:
your-plugin/
├── plugin.json
└── skills/
└── your-skill/
└── SKILL.md
- Register it in
.claude-plugin/marketplace.json:
{
"plugins": [
{ "name": "local-brain", "source": "./local-brain", "description": "..." },
{ "name": "your-plugin", "source": "./your-plugin", "description": "..." }
]
}
See the Claude Code plugin docs for full specifications.
Development
git clone https://github.com/IsmaelMartinez/local-brain.git
cd local-brain
uv sync
uv run local-brain "Hello!"
Note: Requires Python 3.10-3.13 (grpcio build issue with 3.14).
macOS grpcio installation error? If you see compilation errors for grpcio, force installation of pre-built wheels:
uv pip install --only-binary :all: grpcio
Run Tests
uv run pytest tests/ -v
Test Plugin Locally
# In Claude Code
/plugin marketplace add ./path/to/local-brain
/plugin install local-brain@local-brain-marketplace
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file local_brain-0.7.0.tar.gz.
File metadata
- Download URL: local_brain-0.7.0.tar.gz
- Upload date:
- Size: 213.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d657c24df9825c6d9903f51f5716bf58811550fb4eb6e6e3dece454a8c4643f4
|
|
| MD5 |
22c7d7d19be110bc353c60c366b32806
|
|
| BLAKE2b-256 |
974978f7236b7138bf6769549b8ebfe0e0704def45e2074c266d97d0cac160eb
|
Provenance
The following attestation bundles were made for local_brain-0.7.0.tar.gz:
Publisher:
release.yml on IsmaelMartinez/local-brain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
local_brain-0.7.0.tar.gz -
Subject digest:
d657c24df9825c6d9903f51f5716bf58811550fb4eb6e6e3dece454a8c4643f4 - Sigstore transparency entry: 760820399
- Sigstore integration time:
-
Permalink:
IsmaelMartinez/local-brain@157908ecfa6074baf0e57679a21adac82df28a1f -
Branch / Tag:
refs/tags/0.7.0 - Owner: https://github.com/IsmaelMartinez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@157908ecfa6074baf0e57679a21adac82df28a1f -
Trigger Event:
release
-
Statement type:
File details
Details for the file local_brain-0.7.0-py3-none-any.whl.
File metadata
- Download URL: local_brain-0.7.0-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2feb31136bc6448afec062ab83fa2dfec33c2a2e49eb524cf9485706f7737c63
|
|
| MD5 |
c902c15cea0503e66574a1d689983cd9
|
|
| BLAKE2b-256 |
159ebb6f1c3e0c20dec6092ff6047c9f24200694f4bc67f048d242e95a68175d
|
Provenance
The following attestation bundles were made for local_brain-0.7.0-py3-none-any.whl:
Publisher:
release.yml on IsmaelMartinez/local-brain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
local_brain-0.7.0-py3-none-any.whl -
Subject digest:
2feb31136bc6448afec062ab83fa2dfec33c2a2e49eb524cf9485706f7737c63 - Sigstore transparency entry: 760820401
- Sigstore integration time:
-
Permalink:
IsmaelMartinez/local-brain@157908ecfa6074baf0e57679a21adac82df28a1f -
Branch / Tag:
refs/tags/0.7.0 - Owner: https://github.com/IsmaelMartinez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@157908ecfa6074baf0e57679a21adac82df28a1f -
Trigger Event:
release
-
Statement type: