mlx-code Local-First

A Coding Agent That Speaks Git Natively

No API keys. No cloud. No data leaving your Mac. Just Apple Silicon, Git primitives, and raw local intelligence powered by Apple MLX.

$ uvx --from mlx-code mlc

Why Git-native?

Most coding agents treat version control as an afterthought, something you run manually after the work is done. mlx-code fundamentally maps an agent's reasoning loop directly onto Git structures. Your agent state history isn't tucked away in an opaque proprietary database; it's right in your git log.

Agent Concept Git Primitive Superpower Unlocked
Execution step changes files Commit Inspect precise additions using standard git diff
Alternative approach/reasoning Branch Explore paths non-destructively; fork logic seamlessly
Isolated agent playground Worktree Your current active checkout remains clean and completely safe
Resuming historical session Checkout Hash Instant rewind to any snapshot with memory intact

Built for Complex Pipeline Pipelines

Everything scales seamlessly from a simple single file edit up to concurrent multi-agent architectures.

Branching Logic Paths

A branch isn't just a placeholder. It opens up a fresh interactive TUI tab context. Fork your code logic mid-session to test different design parameters cleanly.

/branch --rev 2 make it use httpx instead

Resume Sessions Anywhere

Every single step is snapshot-committed with the active history text directly packed inside the commit message payload. Rewind safely anytime.

mlc --resume abc1234

Mid-Session Hot Swaps

Coding requires changing mindsets. Switch specialized configurations dynamically between your abstract Planner phases and your focused Coder tools.

/clear --config reviewer.yaml

Continuous Batching Architecture

Run multi-agent generation logic concurrently inside one coherent hardware step context. Fully share your Mac's active GPU resources dynamically.

mlc --engine batch

System Composability

Tabs, branched states, and specialized delegated background processes evaluate straight from the exact same structural Python engine abstraction layers.

Conversation tree (nodes = git commits with embedded chat history)

  main ──●──●──●──●──●──●──●──●──●──●──●──●──●──●
            │        │
            │        └── branch-1 ──●──●──●
            │                          │ ┌────────────┐
            │                          └─┤ branch-1-0 ├──●──●
            │                            └─────┬──────┘
            └── branch-0 ──●──●──●             │
                                               │
                                               │
Branch tabs (each tab = a git branch + agent)  │
                                               │
                                               │
┌──────────────────────────────────────────────┼─────────┐
│  TUI tabs                                    │         │
│  ┌──────┐  ┌──────────┐  ┌──────────┐  ┌─────┴──────┐  │
│  │ main │  │ branch-0 │  │ branch-1 │  │ branch-1-0 │  │
│  └──────┘  └────┬─────┘  └──────────┘  └────────────┘  │
└─────────────────┼──────────────────────────────────────┘
                  │
Agents            ├─────────────────────────────────────────► Each tab is an independent Agent
                  │
             ┌────┴─────────────────────────────────────┐
             │  Agent                                   │
             │  ┌────────────────┐  ┌────────────────┐  │
             │  │ API:           │  │ Tools:         │  │
             │  │ Local (mlx-lm) │  │ Read    Write  │  │
             │  │ Claude         │  │ Edit    Bash   │  │
             │  │ Gemini         │  │ Grep    Find   │  │
             │  │ OpenAI         │  │ Ls      Skill  │  │
             │  └────────────────┘  │ Agent ─────────┼──┼───► AgentTool to spawn a child Agent
             │                      └────────────────┘  │     (each with own tools + worktree + etc)
             │  Git worktree                            │  
             │  (isolation + session state)             │ 
             └──────────────────────────────────────────┘

Use as a Python Library

Build programmatic review tasks, run deep automated testing, or forge complex parallel workflow topologies seamlessly natively on your localized machine files.

from mlx_code.repl import Agent
from mlx_code.tools import ReadTool, WriteTool, EditTool

agent = Agent(api='claude', tool_names=['Read', 'Write', 'Edit'])
result = await agent.run('refactor utils.py to use dataclasses')

Interactive TUI Quick Reference

Slash Commands

/branch [--rev N]Fork tab from checkpoint
/diff [--all]Side-by-side worktree differences
/clear [--config F]Reload system properties
/history [--raw]View exact raw execution dumps
/toolsVerify active workspace tool sets
!commandEvaluate quick host shell script
$commandInteractive vim/less execution shell

Keyboard Shortcuts

Ctrl-1 ... Ctrl-9Jump straight into target tab target
Ctrl-, / Ctrl-.Cycle through adjacent workflow tabs
Ctrl-CAbort active generating processing context
Ctrl-DClose target branch context securely
Ctrl-RRecall last raw user string prompt back into editor
Ctrl-JForce enter inline custom layout newline