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.4.tar.gz (158.8 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.4-py3-none-any.whl (129.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: miracle_claw-0.1.4.tar.gz
  • Upload date:
  • Size: 158.8 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.4.tar.gz
Algorithm Hash digest
SHA256 8e3b32783359a74e0597dcd90fb88c0da48fe822378ebb5b47c1859bfeb7583c
MD5 7a4a0c4c38fa37bfbf40719defc3008a
BLAKE2b-256 6dcf61d8fe142d65dbd782e0b4262fbb748c9b874e00f73e1a3453c983f16ebb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: miracle_claw-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 129.8 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 40fde755bbe3c92ceabf933bccd6e9948a8d6d795573de8ae666bb7880755fea
MD5 0f2e3ecc32f6e3e619bf4487dd7f8098
BLAKE2b-256 5ede45a8de162e216dd571db8d05495810149825d1512d20d7c18f77a229e057

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