Show HN: MicroCodex 编程智能体 – 使用 C++ 重写的 OpenAI/Codex,二进制文件小于 1MB
Show HN: MicroCodex Coding Agent – OpenAI/codex reimplemented in C++ <1MB binary

原始链接: https://github.com/paoloanzn/microcodex

MicroCodex 是一款基于 C++23 构建的超轻量级编码代理,专为在终端本地运行而设计。它功能丰富,包括交互式终端界面、一次性提示(one-shot prompting)、持久化对话历史记录以及自动上下文压缩。 用户可通过简单的 curl 脚本在 macOS 和 Linux 上安装该工具,或从 GitHub 下载预编译的二进制文件。身份验证通过 OAuth 处理,允许用户直接通过 CLI 使用现有的 ChatGPT 方案。 MicroCodex 支持自定义文件系统“技能”以扩展其功能,并通过词法黑名单针对破坏性命令提供了基本的防护措施。但它并非沙箱环境;由于该工具的操作权限与底层进程相同,用户在使用时仍需谨慎。尽管目前暂不支持 MCP 和文本复制功能,但该项目已在 Apache-2.0 许可证下开源。它旨在为那些偏好高性能、终端原生环境来管理编码任务的开发者提供支持。

Paolo Anziano 近期推出了“MicroCodex”,这是一个使用 C++ 实现的 OpenAI/Codex 风格编程代理,其二进制文件大小不到 1MB。该项目旨在为资源受限的环境(例如嵌入式设备或大型主流工具无法运行的多代理工作流)提供一种轻量级的替代方案。 此次发布在 Hacker News 上引发了关于二进制体积小型化必要性的讨论。尽管一些持怀疑态度的人认为,与功能成熟的主流工具相比,极简体积在实际应用中并无太大优势,但开发者强调,该代理在工具使用和上下文管理等关键领域几乎达到了与主流工具相当的水平。 讨论还涉及了代码库规模与可维护性之间的权衡。批评者指出,较小的代码库并不一定更容易管理,并质疑将一个快速迭代的 JavaScript 工具移植为 C++ 版本后的长期维护难度;而支持者则看好在极简硬件上运行自主编程代理的潜力。开发者计划通过自动化更新提示来保持功能同步,并邀请社区贡献诸如 MCP 支持等缺失的功能。
相关文章

原文

MicroCodex is an ultra-lightweight coding agent that runs locally in your terminal.

MicroCodex splash


MicroCodex is written in C++23 and provides one-shot prompts, an interactive terminal UI, local coding tools, durable conversations, and automatic context compaction.

Installing and running MicroCodex

Run the following on Mac or Linux to install MicroCodex:

curl -fsSL https://github.com/paoloanzn/microcodex/releases/latest/download/install.sh | sh

Then simply run microcodex login to sign in, followed by microcodex to get started.

You can also go to the latest GitHub Release and download the appropriate binary for your platform.

Each GitHub Release contains these executables:

  • macOS
    • Apple Silicon/arm64: microcodex-aarch64-apple-darwin.tar.gz
    • x86_64: microcodex-x86_64-apple-darwin.tar.gz
  • Linux
    • x86_64: microcodex-x86_64-unknown-linux-gnu.tar.gz
    • arm64: microcodex-aarch64-unknown-linux-gnu.tar.gz

Each archive contains a single entry with the platform baked into the name (for example, microcodex-aarch64-apple-darwin), so you likely want to rename it to microcodex after extracting it.

The installer selects the native build for the current architecture. Linux requires the libcurl and OpenSSL runtime libraries.

To install a specific release, set MICROCODEX_RELEASE:

curl -fsSL https://github.com/paoloanzn/microcodex/releases/latest/download/install.sh | MICROCODEX_RELEASE=v0.1.0 sh

Using MicroCodex with your ChatGPT plan

Run microcodex login and open the displayed URL in your browser. On a remote or headless machine, run microcodex login --device-auth and enter the displayed one-time code at the verification URL. MicroCodex stores the resulting OAuth credentials under $CODEX_HOME, or ~/.codex when CODEX_HOME is unset.

You can then start an interactive session or pass a one-shot prompt:

microcodex
microcodex "Find the failing test, fix it, and run the relevant test suite"

Warning

MicroCodex is not a sandbox. Before starting the user's shell, it applies a simple lexical denylist that blocks forced file removal (rm -f/rm -rf), git reset --hard, forced git clean, git checkout --, disk-formatting tools, and shutdown commands. This guard is not a shell parser and is not a complete security boundary: commands that do not match the denylist and all file operations run with the same permissions as the MicroCodex process.

MicroCodex discovers the same filesystem skills installed for Codex under $CODEX_HOME/skills, or ~/.codex/skills when CODEX_HOME is unset. Each skill must have a SKILL.md with YAML frontmatter containing a name and description. Skill metadata is added to the agent instructions at session startup; the complete skill is read only when its name or description matches the task.

Building requires a C++23 compiler, make, libcurl development files, and OpenSSL development files on Linux.

git clone --recurse-submodules https://github.com/paoloanzn/microcodex.git
cd microcodex
make

The executable is written to build/microcodex. Run the test suite with make test.

  • MCP support is not implemented yet.
  • Text cannot currently be copied from the terminal while using MicroCodex.
  • The bash safety gate is a lexical denylist, not a complete safe-command policy or sandbox; indirect or unrecognized destructive commands may not be blocked.

This repository is licensed under the Apache-2.0 License.

联系我们 contact @ memedata.com