Mlx-Code: A Coding Agent That Speaks Git Natively

JosefAlbers1 pts0 comments

mlx-code | A Coding Agent That Speaks Git Natively

-->

[ 00_mlx_code ]

> A Coding Agent That Speaks Git Natively

✔ Git isn't just a backup. It's a state machine.

✔ Git commits store file changes together with the conversation that produced them.

✔ Parallel worktrees host multiple isolated agents concurrently.

✔ Agents can spawn sub-agents recursively.

# Branch, diff, and resume from any branching paths dynamically.

[ GITHUB_REPO ]

[ EXPLORE_PRIMITIVES ]

[ 01_cli_demo ]

terminal - zsh

[ IDLE ]

~ $<br>uvx --from mlx-code mlc

[ COPY ]<br>[ ▶ DEMO ]

[ 02_why_git ]

Agent<br>Git<br>What It Enables

Execution step changes files<br>commit<br>Inspect changes cleanly with git diff

Alternative approach<br>branch<br>Explore paths non-destructively

Isolated agent sandbox<br>worktree<br>Keep your active checkout clean and safe

Resuming from a past session<br>checkout<br>Rewind agent to any snapshot state

Most agents treat version control as an afterthought.<br>mlx-code maps the reasoning loop directly onto Git mechanisms. Your complete agent state history lives inside git commit history rather than an opaque database.

[ 03_primitives ]

01 // branching logic paths

Fork from any checkpoint

A branch opens a fresh interactive tab in an isolated worktree.<br>Test divergent code designs securely without abandoning your active checkout.

/branch --rev 2 make it use httpx instead

02 // session recovery

Resume from anywhere

Every file-changing step is snapshot-committed with the chat/execution history.<br>Rewind cleanly to any checkpoints.

mlc --resume abc1234

03 // mid-session hot swaps

Switch configs on the fly

Swap agent configurations mid-session between planner, coder, and reviewer roles without losing your active context.

/clear --config reviewer.yaml

04 // parallel batching

Concurrent multi-agent

Run multiple agents concurrently inside one batch step.<br>Share your unified memory architecture compute pools dynamically.

mlc --engine batch

[ 04_architecture ]

Worktrees:

main ──●──●──●──●──●──●──●──●──●──●──●──●──●──●──────► Node = git commit + chat history<br>│ │<br>│ └── branch-1 ──●──●──●<br>│ │ ┌────────────┐<br>│ └─┤ branch-1-0 ├──●──●<br>│ └─────┬──────┘<br>└── branch-0 ──●──●──● │<br>Tabs: ├────────────► Tab = git branch + Agent<br>┌──────────────────────────────────────────────┼─────────┐<br>│ TUI tabs │ │<br>│ ┌──────┐ ┌──────────┐ ┌──────────┐ ┌─────┴──────┐ │<br>│ │ main │ │ branch-0 │ │ branch-1 │ │ branch-1-0 │ │<br>│ └──────┘ └────┬─────┘ └──────────┘ └────────────┘ │<br>└─────────────────┼──────────────────────────────────────┘<br>Agents: ├──────────────────────────────────────► Each tab runs its own Agent<br>┌────┴─────────────────────────────────────┐<br>│ Agent │<br>│ ┌────────────────┐ ┌────────────────┐ │<br>│ │ API: │ │ Tools: │ │<br>│ │ Local (mlx-lm) │ │ Read Write │ │<br>│ │ Gemini │ │ Edit Bash │ │<br>│ │ Claude │ │ Grep Find │ │<br>│ │ Codex │ │ Ls Skill │ │<br>│ │ DeepSeek │ │ Agent ─────────┼──┼─► Recursively spawns sub-Agents<br>│ └────────────────┘ └────────────────┘ │<br>│ Git worktree │<br>│ (isolation + session state) │<br>└──────────────────────────────────────────┘

[ 05_library_api ]

Use as a Library

Construct custom workflow pipelines, run programmatic background review checks, or coordinate distributed multi-agent workflows natively on your Mac.

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')

[ 06_user_manual ]

slash commands

/branch [--rev N]Fork tab from checkpoint

/diff [--all]Review worktree changes

/clear [--config F]Clear / reset session

/history [--raw]Show chat log

/toolsList active tools

!commandRun a shell command

$commandRun an interactive command

keyboard shortcuts

Ctrl-1 … Ctrl-9Jump directly to N-th tab

Ctrl-, / Ctrl-.Cycle adjacent tabs

EnterSubmit

Ctrl-JInsert newline

Ctrl-RRecall last prompt

Ctrl-CClear input or abort agent

Ctrl-DClose branch tab, or exit app

-->

agent branch from ctrl agents session

Related Articles