商业产业 Hacker News Agent 2026-08-02T20:11 正文 ok 468 words

Show HN:MicroCodex 编程 Agent——用 C++ 重实现 OpenAI/codex,二进制文件小于 1MB

英文标题:🔶 Show HN: MicroCodex Coding Agent – OpenAI/codex reimplemented in C++ <1MB binary

MicroCodex 是一款可在本地终端运行的超轻量级编程 Agent,使用 C++23 编写,提供单次提示、交互式终端 UI、本地编码工具、持久化对话和自动上下文压缩功能。项目支持通过 ChatGPT 计划登录,并可使用与 Codex 兼容的本地 skills 目录;macOS 和 Linux 均提供预编译二进制包。其安全机制仅依赖对部分危险 Bash 命令的词法拒绝列表,并非沙箱或完整安全边界,开发者需要自行评估执行本地命令的风险。项目目前尚未支持 MCP,Linux 构建及运行依赖 libcurl 和 OpenSSL。
打开原文相关 8 · 机会 1
media1.2 MB media117.7 KB

中文

MicroCodex 是一款可在本地终端运行的超轻量级编程 Agent。

MicroCodex 启动画面

MicroCodex 使用 C++23 编写,提供单次提示、交互式终端 UI、本地编码工具、持久化对话以及自动上下文压缩功能。


安装和运行 MicroCodex

在 Mac 或 Linux 上运行以下命令安装 MicroCodex:

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

随后只需运行 microcodex login 登录,再运行 microcodex 即可开始使用。

你也可以前往最新 GitHub Release,下载适用于自己平台的二进制文件。

每个 GitHub Release 均包含以下可执行文件:

  • 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

每个压缩包只包含一个文件,其名称中已内置平台信息(例如 microcodex-aarch64-apple-darwin),因此解压后可能需要将其重命名为 microcodex。

安装程序会为当前架构选择原生构建版本。Linux 需要 libcurl 和 OpenSSL 运行时库。

如需安装指定版本,请设置 MICROCODEX_RELEASE:

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

通过 ChatGPT 计划使用 MicroCodex

运行 microcodex login,并在浏览器中打开显示的 URL。在远程或无头机器上,运行 microcodex login --device-auth,然后在验证 URL 中输入显示的一次性代码。MicroCodex 会将生成的 OAuth 凭据存储在 $CODEX_HOME 目录下;如果未设置 CODEX_HOME,则存储在 ~/.codex 下。

随后你可以启动交互式会话,或传入单次提示:

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

警告

MicroCodex 不是沙箱。在启动用户 Shell 前,它会应用一个简单的词法拒绝列表,阻止强制删除文件(rm -f/rm -rf)、git reset --hard、强制 git clean、git checkout --、磁盘格式化工具以及关机命令。该防护机制并非 Shell 解析器,也不是完整的安全边界:不匹配拒绝列表的命令,以及所有文件操作,都将以与 MicroCodex 进程相同的权限执行。

MicroCodex 会发现 Codex 在 $CODEX_HOME/skills 下安装的同一套文件系统 skills;如果未设置 CODEX_HOME,则使用 ~/.codex/skills。每个 skill 都必须包含一个 SKILL.md 文件,并带有包含 name 和 description 的 YAML frontmatter。会话启动时,skill 元数据会被加入 Agent 指令;只有当 skill 的名称或描述与任务匹配时,才会读取完整 skill 内容。

构建需要 C++23 编译器、make,以及 Linux 上的 libcurl 开发文件和 OpenSSL 开发文件。

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

可执行文件会写入 build/microcodex。使用 make test 运行测试套件。

  • 尚未实现 MCP 支持。
  • 使用 MicroCodex 时,目前无法从终端复制文本。
  • Bash 安全门机制是词法拒绝列表,而不是完整的安全命令策略或沙箱;间接执行或无法识别的破坏性命令可能不会被拦截。

该仓库采用 Apache-2.0 License 授权。

English / 原文

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.