𝗥𝘂𝗻𝗻𝗶𝗻𝗴 𝗔 𝗟𝗼𝗰𝗮𝗹 𝗖𝗼𝗱𝗶𝗻𝗴 𝗔𝗴𝗲𝗻𝘁 𝗼𝗻 𝗮 𝗠𝗮𝗰 𝗠𝗶𝗻𝗶

I use a local coding agent for low-stakes tasks. It handles file edits, test fixes, and build verification. It also writes Playwright tests, reviews code, and runs deploys.

The setup runs on a Mac Mini M4 with 24 GB of RAM. I do not use cloud APIs for the coding work. I use a cheap cloud model only for planning and routing. A coding agent named Pi handles the actual file editing. It connects to oMLX, which is a local LLM server.

This setup works with any agent that uses an OpenAI-compatible API. You can use Claude Code or Codex with this same oMLX server.

I use two models and swap them based on the task. The 24 GB RAM limit prevents me from running both at once.

  • Primary coding model: 9B class at 20 tokens per second.
  • Fast model: 4B class at 27 tokens per second for quick fixes.

A swap script moves one model out and brings the other in. This process takes 5 seconds.

The agent performs these tasks:

  • File edits and refactoring
  • Writing and fixing tests
  • Build verification
  • Code reviews
  • Documentation updates
  • Running deploys

I use RPC mode for anything more complex than a single line of code. The orchestration layer writes a prompt and Pi executes it.

I use these tools to improve performance:

  • pix-optimizer: Compresses tokens and removes boilerplate.
  • context-mode: Routes workspace tasks and manages tool calls.
  • pi-subagents: Runs tasks in parallel.
  • pi-workflow-engine: Handles multi-step task sequences.
  • pi-mcp-adapter: Connects to external tools via MCP.

Important rules for this setup:

  • Load only one model at a time to avoid memory errors.
  • Disable thinking mode to maintain speed.
  • Do not send full chat history in prompts or the model will crash.
  • Use RPC mode for non-trivial tasks to skip safety controls.
  • Retry the first request after a model swap if it times out.

Setup script: curl -fsSL https://workswithagents.dev/static/setup-local-llm-pi.sh | sh

Source: https://dev.to/vystartasv/running-a-local-coding-agent-on-a-mac-mini-the-actual-setup-47bo

Optional learning community: https://t.me/GyaanSetuAi