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.2.tar.gz (111.7 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.2-py3-none-any.whl (118.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: miracle_claw-0.1.2.tar.gz
  • Upload date:
  • Size: 111.7 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.2.tar.gz
Algorithm Hash digest
SHA256 0c03f52cbf85c372ce5b7d9c834d7cfe8f7c2b0ca8769e09e4bd447561e6a9f9
MD5 b6e6af44f51eba7f8cc8e28b61d217dc
BLAKE2b-256 688c013bd97c0911a032738824ff082ed7f602e686ad63fb5a318ef333581e85

See more details on using hashes here.

File details

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

File metadata

  • Download URL: miracle_claw-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 118.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 89c302d498d9ff934bb837de3b56f09dbf7932a48f5f458c685b3c9685761bb1
MD5 4f890446c5e16b1be8cf7f1c10d9d39d
BLAKE2b-256 57144bda56088381e1afd54fd755336593acc75cd68f1ae532573d4af2d932dd

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