Your coder — an opencode-style CLI coding assistant. Highly customizable, local-first, with tool calling and agent orchestration.
# Clone and install
git clone https://github.com/DankChamp/luna
cd luna
./setup.sh # one-time: venv, deps, config
# Run
./luna # interactive TUI
./luna "your coding task here" # direct prompt- Python 3.10+
- Void Linux (or any Linux with Ollama/local LLM endpoint)
- Ollama running locally (or any OpenAI-compatible API)
Luna is built as a modular, extensible coding agent with these core components:
luna/
├── cli.py # Entry point, argument parsing
├── luna.py # Main agent loop & orchestration
├── config.py # Configuration (Pydantic Settings)
├── core/
│ ├── agent/ # Agent logic, tool calling, planning
│ ├── llm/ # LLM providers (Ollama, OpenAI, Anthropic)
│ ├── memory/ # Conversation history, context management
│ ├── session/ # Session persistence, restore
│ └── tools/ # Built-in tools (file ops, shell, search, etc.)
├── tools/ # Additional tool implementations
├── ui/ # Rich-based TUI components
├── bridge/ # External integrations (opencode, etc.)
└── tests/ # Pytest suite
| Feature | Description |
|---|---|
| Multi-provider LLM | Ollama, OpenAI, Anthropic — unified interface |
| Tool calling | File read/write, shell exec, search, grep, LSP integration |
| Session persistence | SQLite-backed, resume where you left off |
| Rich TUI | Interactive terminal interface with syntax highlighting |
| Extensible tools | Plugin-style tool system, add custom tools easily |
| Local-first | Runs entirely on your machine, no cloud required |
| OpenTelemetry | Built-in tracing for debugging agent behavior |
Luna uses Pydantic Settings — all config via .env or environment variables:
# LLM Provider
LUNA_LLM_PROVIDER=ollama # ollama | openai | anthropic
LUNA_OLLAMA_BASE_URL=http://localhost:11434
LUNA_OLLAMA_MODEL=llama3.1:8b
# OpenAI-compatible (LM Studio, llama.cpp, vLLM, etc.)
LUNA_OPENAI_BASE_URL=http://localhost:1234/v1
LUNA_OPENAI_API_KEY= # optional
LUNA_OPENAI_MODEL=your-model
# Anthropic
LUNA_ANTHROPIC_API_KEY=sk-ant-...
# Agent behavior
LUNA_MAX_ITERATIONS=10
LUNA_TEMPERATURE=0.2
LUNA_SYSTEM_PROMPT_PATH=.luna/system_prompt.mdSee .env.example for all options.
./lunaTab— toggle sidebar (tools, history, config)Ctrl+C— cancel current taskCtrl+D— exit
./luna "refactor the auth module to use async SQLAlchemy"
./luna "add tests for the session manager" --max-iterations 5./luna --context core/agent.py --context core/tools/ "explain this code"# Install dev dependencies
pip install -e ".[dev]"
# Lint
ruff check .
# Type check
mypy .
# Test
pytest -q --tb=short
# Run from source
python -m luna| Directory | Purpose |
|---|---|
core/agent/ |
Agent loop, planning, tool orchestration |
core/llm/ |
Provider implementations, streaming, tool calling |
core/tools/ |
Built-in tools (file, shell, search, LSP) |
core/memory/ |
Conversation history, summarization, context window |
tools/ |
Additional tool implementations |
ui/ |
Rich TUI components, layouts, themes |
bridge/ |
External tool integrations |
- Create
core/tools/my_tool.pyinheriting fromBaseTool - Implement
name,description,parameters,execute() - Register in
core/tools/__init__.py - Add tests in
tests/test_my_tool.py
- LSP integration (go-to-def, hover, diagnostics)
- Multi-agent orchestration (planner + executor)
- Voice input/output (Vosk + Piper)
- Web UI (optional, for remote access)
- Plugin marketplace / tool registry
PRs welcome! Please:
- Fork the repo & create a feature branch
- Run
ruff check . && mypy . && pytest -qlocally - Follow the existing code style (ruff config in
pyproject.toml) - Add tests for new functionality
- Open a PR with a clear description
# Quick validation
ruff check . && mypy . && pytest -qMIT License — see LICENSE for details.