A coding agent built on ollama and opencode
README.md

Madara #

A lightweight, privacy-first coding agent powered by Ollama with full tool execution.

Features #

  • 🤖 AI-powered - Uses Ollama's local LLMs
  • 🔧 Tool execution - Bash, Read, Write, Edit, Glob, Grep
  • 📦 Plugin system - Extensible slash commands
  • 💾 Local-first - All data stays on your machine
  • 🎯 Model picker - Easy switch between models

Quick Start #

1. Install Ollama #

# macOS/Linux
curl -fsSL https://ollama.ai/install.sh | sh

# Windows - download from ollama.ai

2. Pull a Model #

ollama pull qwen3.5:4b    # Default model (4B parameters, fast & capable)
ollama pull llama3       # General purpose

3. Run Madara #

pip install -r requirements.txt
python src/madara.py chat

Available Tools #

Tool Description Example
Bash Execute shell commands Bash("ls -la")
Read Read file contents Read("main.py")
Write Create/write files Write("test.py", "print('hi')")
Edit Edit file text Edit("main.py", "old", "new")
Glob Find files by pattern Glob("**/*.py")
Grep Search file contents Grep("function", "*.js")

Usage Examples #

You: Create a hello world Python file
Madara: I'll create that for you...
  → Calling Write(...)
  → ✅ Written to hello.py

You: Read the file I just created
Madara:
  → Calling Read("hello.py")
  → print("Hello, World!")

You: Run the file
Madara:
  → Calling Bash("python hello.py")
  → Hello, World!

You: Find all Python files in this project
Madara:
  → Calling Glob("**/*.py")
  → src/main.py
  src/utils.py
  tests/test_main.py

Chat Commands #

Command Description
/help Show help & available tools
/models Switch Ollama model
/clear Clear conversation
/exit Exit Madara

Configuration #

Config location: ~/.config/madara/config.json

{
  "model": "qwen3.5:4b",
  "ollama_url": "http://localhost:11434",
  "workdir": "/path/to/project",
  "system_prompt": "You are Madara, a coding assistant."
}

Model Recommendations #

Model Size Best For
qwen3.5:4b ~4B params Default model (fast, multilingual)
llama3 ~4.7GB General purpose
mistral ~4GB Fast, efficient
phi ~2.7GB Lightweight

CLI Commands #

madara chat              # Start chat
madara models            # List models
madara models --select 2 # Switch model
madara init              # Initialize config
madara install qwen3.5:4b # Install model

License #

MIT