Skip to main content

Agentic CLI coding assistant with voice input, background commands, and local LLM fast-path.

Project description

Miracle Claw (mlg)

An agentic CLI coding assistant that runs anywhere Python runs. Free, source-available, BYO model.

mlg is a terminal-first AI coding tool. It has slash commands, voice input, background job control, inline @file mentions, tab completion, and routes to any OpenAI-compatible endpoint — local Ollama, your own gateway, or managed cloud.

It is the open-source alternative to Claude Code and Aider, with two things neither of them have:

  1. Push-to-talk voice input — speak a task, get a shell command.
  2. Local-first fast path — point it at Ollama and skip the cloud entirely.

Quick start

Path 1 — Docker (works on Windows, macOS, Linux)

git clone https://github.com/milagro-distribution/miracle-claw.git
cd miracle-claw
echo "MILAGRO_API_KEY=sk-..." > .env
docker compose run --rm mlg

For the browser frontend: docker compose --profile serve up → http://localhost:7777

Path 2 — pip install (Linux/macOS/WSL)

pip install miracle-claw[voice]
export MILAGRO_API_KEY=sk-...
mlg

For one-shot mode:

mlg "list all files modified today"

For the interactive REPL:

mlg
⚡ miracle_claw
  model : milagro-dev
  url   : http://localhost:8080/v1
  cwd   : /home/you
  help  : type '?' or 'help'  ·  quit: 'exit'  ·  raw: '!cmd' how do I find large files?

Features

Slash commands (19)

/help /read PATH /edit PATH
/diff A B /tree [N] /pwd
/model [NAME] /url [URL] /history [N]
/clear /run CMD... /git SUBCMD
/cd [PATH] /alias [NAME CMD] /voice [SECS]
/jobs /tail ID [N] /kill ID · /wait ID

Inline mentions

Type @somefile.py anywhere in a prompt and mlg will read the file (4 KB cap per file, 16 KB total) and include it as context:

⚡ @jobs.py explain the reaper thread

Voice input

⚡ /voice
  ▸ listening... (press Enter to stop)
▸ make me a directory tree of mlg's repo
  send to LLM? [Y/n/e(dit)]: y
  ✓ 4.2s · maic:milagro-dev

Requires arecord (ALSA) and a one-time pip install of faster-whisper into a side venv. mlg finds it automatically.

Background commands

⚡ ! make test &
  ▸ background job j3a7 (pid 48291): make test
    log: ~/.miracle_claw/jobs/j3a7.log
    /jobs · /tail j3a7 · /kill j3a7 · /wait j3a7

⚡ /jobs
  ID     PID     STATUS        ELAPSED   CMD
  j3a7   48291   ● running     12s       make test

⚡ /tail j3a7
  ── j3a7 (✓ exit 0, 47s) ───────────────
  Building...
  test_jobs.py ........... PASSED
  ✓ all 14 tests passed

Local LLM fast path

⚡ /model
  current: milagro-dev → milagro-dev via maic
  Local fast-path aliases (Ollama, no MAIC):
    local          → llama3.2
    local-big      → mistral
    local-huge      → gemma4
    coder-local    → llama3.2
  Switch with:  /model <name|alias>

⚡ /model local
  ✓ model → local  →  llama3.2  via ollama  (no MAIC hop)

No MAIC hop means no API key needed for local models. Cold start ~20s (disk load); hot path 2-5s on CPU.

Session persistence

mlg saves your cwd, model, URL, and aliases to ~/.miracle_claw/session.json on exit and restores them on next start. Run mlg --reset-session to clear.


Architecture

miracle_claw/
├── mlg              # main entry: arg parsing, REPL loop, atexit
├── mlg-serve        # WebSocket + xterm.js browser frontend
├── llm.py           # MAIC + Ollama clients, model resolution
├── turn.py          # one full turn: prompt → call → parse → run → log
├── commands.py      # slash command dispatch (19 commands)
├── completion.py    # tab completion (slash + paths, no readline)
├── repl.py          # custom line editor (raw mode, ANSI-aware)
├── safety.py        # risk classification (SAFE / NORMAL / DANGEROUS)
├── runtime.py       # bash/python/perl subprocess wrappers
├── history.py       # session log reader (JSONL)
├── mentions.py      # @file inline mention resolver
├── session.py       # cwd/model/url persistence
├── aliases.py       # user-defined command aliases
├── jobs.py          # background job registry
├── voice.py         # arecord + faster-whisper
├── ui.py            # ANSI color helpers
├── context.py       # project context builder
├── CLAW.md          # system prompt (user-editable)
└── CLAW.md.example  # fallback system prompt

Design choices:

  • One file per concern, ~100-400 lines each. Easy to read, easy to swap out.
  • The custom line editor in repl.py replaces Python readline because readline + PTY canonical mode + ANSI prompts fight each other (tabs get eaten, input() blocks on \n).
  • LLM client (llm.py) is the only module that does HTTP. Mocking for tests, swapping gateways, and adding retry/backoff all happen in one place.
  • urllib.request everywhere (no extra HTTP deps).

vs. the competition

mlg Claude Code Aider Cursor
Free, source-available
Voice input
Background commands
Local model routing
Inline @file mentions
Tab completion n/a
Browser frontend n/a
Vendor lock-in none Anthropic none OpenAI

The pitch: "Claude Code's UX, Aider's openness, and two features nobody else has. Free if you bring your own model."


Requirements

  • Python 3.10+
  • urllib (stdlib only)
  • Optional: arecord + ffmpeg for voice input
  • Optional: ollama running locally for the fast-path
  • Optional: a TTY for the REPL (works fine in the browser via mlg-serve)

License

Apache 2.0. See LICENSE.

Free for commercial use, modification, and redistribution. Just keep the copyright notice and don't blame us when it works.

Support


Built in Albuquerque, NM by Milagro Distribution Corp.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

miracle_claw-0.1.1.tar.gz (111.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

miracle_claw-0.1.1-py3-none-any.whl (117.4 kB view details)

Uploaded Python 3

File details

Details for the file miracle_claw-0.1.1.tar.gz.

File metadata

  • Download URL: miracle_claw-0.1.1.tar.gz
  • Upload date:
  • Size: 111.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for miracle_claw-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0515e6667c4665bf33bb92894ee6e7ef9ee585573e6e705e62266dd33fee80c1
MD5 fe6a64f3fdad8d4a052b836d55646f25
BLAKE2b-256 c72650caa444c36381ee9b458fcbe1feaf21f34f3cf3d65e1d7d2b61a64492fa

See more details on using hashes here.

File details

Details for the file miracle_claw-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: miracle_claw-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 117.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for miracle_claw-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17b6f7b370a28c26395c9514a85b2e4978e509727a30374a5522f719b9acf345
MD5 7f7603a983ecb6b99a8a919cfba0c515
BLAKE2b-256 40d30f3e6f588ac1f5ce17b7c666c8e513e28f55e809ddf8d4b786b9d305f710

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page