Localcode:开源智能体编程,Mac 上一条命令搞定
Localcode, open source agentic coding on your Mac with one command

原始链接: https://github.com/mjwsolo/localcode

LocalCode 是一款在 Mac 上本地运行 AI 模型的智能体编码工具。使用 `uv pip install -U localcode` 安装,然后在项目中运行 `localcode`。它可读取和编辑文件、运行测试、构建、执行 Git 和 shell 命令、搜索代码、搭建应用,并在触碰项目外内容前征求许可。它还提供兼容 OpenAI 的本地 API。 要求:配备 Apple Silicon 的 Mac、macOS 13+、16 GB 统一内存、Python 3.10+。可从 12 个模型和 169 个量化选项中选择,支持从 Hugging Face 并行下载并断点续传。 性能通过推测性草拟、重写时的复制草拟、提示词缓存复用、预热、预编译 GPU 内核、flash attention 和 8 位 KV 缓存提升——带来约 2 倍更快的回复和更长的上下文。质量特性包括默认关闭隐藏思考、计划面板、卡住检测以及每次发布的实时测试。 推理完全本地;仅模型下载、网页搜索/抓取和 MCP 服务器使用网络。Apache 2.0 许可证。

Hacker News 上一篇帖子介绍了 Localcode,一个结合了推理服务器和编程代理的开源 Mac 命令行工具。评论者质疑它相比 llama.cpp 加 pi 或 opencode 配合 omlx 等现有方案有何优势,并指出其缺乏沙箱或 seatbelt 保护,允许 shell 命令访问用户账户的安全问题。他们更偏好使用容器或虚拟机的模块化方案。另一位评论者指出它与一个在 64GB Mac 上运行 DeepSeek 4.1 Flash 的应用重名。作者澄清 Localcode 是基于 llama.cpp 和 opencode 构建的开源 CLI,承认命名重叠,并表示 DeepSeek 支持性能较差,但可以重新考虑。
相关文章

原文

localcode

PyPI License Python Platform

Agentic coding. Local models. On your Mac.

A localcode turn: it reads the stub and test, edits the file, then pytest reports 1 passed

Upgrade with uv pip install -U localcode.

cd your-project
localcode

To use the running model from another local app, open /server or run localcode api for its OpenAI compatible endpoint. See the Local API guide.

  • Reads and edits files in your project
  • Runs your tests, builds, Git and shell commands inside the project on its own, and asks before touching anything outside it
  • Searches code by name, content or structure
  • Scaffolds and launches apps, then checks that they respond
  • Remembers the task across messages
  • Mac with Apple Silicon, macOS 13 or newer
  • 16 GB unified memory or more
  • Python 3.10 or newer
  • Disk space for LocalCode and your chosen model (download sizes below)

Choose from 12 models and 169 quant options for coding, image input and typed decisions. Models download from Hugging Face. Downloads run in parallel and can resume if interrupted. Switch with /models. LocalCode recommends the most capable one that fits your Mac's memory and marks it with a star.

Speed: Gemma 4, Qwen 3.6, Muse Glimmer and Qwen 3.8 draft tokens with the vendor's own speculative drafter, which downloads with the model. The model server's GPU kernels ship precompiled, so the first start after an install is quicker.

What LocalCode adds on top of the stock model server to make local models faster and better at coding.

Speed

  • Drafting: the vendor's own drafter guesses tokens ahead (about 2x faster replies on Gemma 4, Qwen 3.6, Qwen 3.8 and Muse Glimmer)
  • Copy drafting: when the model rewrites a file it already read, it copies instead of generating (3.5 to 4x faster on rewrites)
  • Prompt cache reuse: the system prompt stays the same every turn, so the model only reads what is new
  • Warm-up: the first request's prompt is read while the model loads, so your first message starts sooner
  • Precompiled GPU kernels: no half-minute shader compile on first start
  • Threads matched to your Mac's performance cores
  • Flash attention on by default
  • Inkling 2: its experts run on the GPU (were silently on the CPU, about 5x slower), banded attention and a fused activation op halve its GPU memory and read prompts 20 to 30% faster
  • Downloads run in parallel, resume if interrupted, and keep going while you use another model

Memory

  • 8-bit KV cache by default: half the memory of full precision, so longer context fits
  • Inkling 2 uses a 16-bit cache instead: its attention reads it directly, so long prompts read 1.4 to 1.8x faster and it needs 3.3 GB less memory at 128K context
  • Context sized from what the server reports, so long chats compact before they run out of room
  • The picker recommends the most capable model that fits your Mac

Quality

  • Hidden thinking off by default, so answers come straight away; a model that gets stuck thinking is recovered instead of failing
  • Plan panel: the model keeps a task list and is reminded to update it
  • Stuck detection: a model that makes no progress, or keeps failing the same check, is nudged to change approach and then stopped so it reports what it has
  • Every release is tested live on every model (load, reply, tool calls, images) before it ships

Inference is local. Three features use the network: model downloads, the web_search and web_fetch tools, and any MCP servers you add. See Network Boundary for the full list.

Powerful, personal AI should work for everyone, on any device, anywhere. That means running it locally. localcode is a first step.

To sponsor localcode, reach out.

See CONTRIBUTING.md.

Apache 2.0. See LICENSE.

联系我们 contact @ memedata.com