商业产业 Hacker News Agent 2026-08-12T14:43 正文 ok 495 words

🔶 Hax:用 C 编写的极简终端原生编程 Agent

英文标题:🔶 Hax – a minimalist, terminal-native coding agent written in C

Hax 是一款以单个原生 C 二进制形式发布的终端原生编程 Agent,强调快速启动、低内存占用和较少依赖,适合为本地 LLM 留出更多资源。它将本地模型视为一等公民,可自动发现模型与运行时能力,并支持 OpenAI、Anthropic、Codex、OpenRouter、llama.cpp 等提供商。该工具注重终端体验与可审计性,支持流式 Markdown、原生滚动历史、会话恢复,以及通过 Ctrl+T 查看模型请求和响应记录。对于偏好 Unix 工具哲学、在资源受限环境运行 Agent、或需要审计工具行为的开发者,Hax 提供了轻量且可组合的选择。
打开原文相关 6 · 机会 1
media90.8 KB media32.7 KB

中文

> 轻量化设计

单个原生 C 二进制文件,依赖集很小。启动迅速,内存占用极低(仅几 MB)——从而为本地 LLM 留出更多 RAM。

> 本地模型是一等公民

hax 会自动发现模型和运行时能力。默认配置无需编写自定义 provider 配置块。

llama-server -m [model].gguf
hax --provider llama.cpp

> 尊重你的终端

流式输出 Markdown 和实时工具输出,并针对终端显示进行重排。它只会重绘当前正在流式生成的行或输入区域,保留终端原生滚动历史;不会接管或扰乱你的终端。

> 可检查

通过可用的转录视图(Ctrl+T),准确查看发送给模型的内容及其回复。还可以选择收集详细的线协议追踪记录。

> 可使用任意提供商/模型

支持 OpenAI(及兼容服务)、Anthropic(及兼容服务)、Codex(通过 ChatGPT 订阅)、OpenRouter、llama.cpp 等。

> 行为良好的 Unix 工具

采用 XDG 路径;在 -p 单次执行模式下将干净输出写入 stdout,并将恢复提示写入 stderr;使用纯文本配置与会话文件;通过子进程组合能力,而非插件。

> 目标用户

适合那些长期使用终端、运行本地模型、审计工具行为、为发行版打包软件,或在资源稀缺环境中运行 Agent 的开发者。如果你需要 MCP 市场、插件运行时、IDE 面板或按命令进行权限确认,其他 Agent 正是为此而构建;hax 则有意不提供这些功能,docs/philosophy.md 解释了每项取舍及满足相应需求的替代模式。

如果“用老派极简包装呈现的炫酷新 AI 技术”正合你的胃口,你可能会喜欢它。

$ 开始使用

hax 可运行于 Linux 和 macOS;在 Windows 上,请通过 WSL 使用。

使用 Homebrew(macOS 或 Linux):

brew install oleksandrchekhovskyi/hax/hax

在 Linux 上,从最新版本下载与你的架构(x86_64 或 aarch64)匹配的预构建静态二进制文件,然后将 hax 二进制文件解压到 PATH 中的任意目录。

从源码构建会生成一个链接到系统共享库的二进制文件,而非静态二进制文件:

git clone https://github.com/OleksandrChekhovskyi/hax.git
cd hax
scripts/install_deps.sh   # Debian/Ubuntu、Fedora、Arch、openSUSE、Alpine、macOS
make                      # 二进制文件现在位于 ./build/hax
make install              # 可选;可能会提示输入 sudo

scripts/install_deps.sh 会安装构建依赖——C 编译器、libcurl、jansson、meson、ninja 和 pkg-config——以及 fzf;当可用时,hax 使用它实现 @file 补全。

在希望 hax 操作的项目目录中运行它:

hax                         # 交互式 REPL
hax -p "list TODOs"         # 运行单条提示并输出最终答案
printf "explain x" | hax -p # 从 stdin 读取提示
hax -c                      # 继续此目录最近一次会话
hax --resume                # 选择此目录中的历史会话
hax --resume=ID -p "next"   # 在单次执行模式下恢复指定会话

最简单的首次运行方式是交互式启动:运行 hax,然后使用 /provider 查看可用提供商并选择模型。hax 会记住交互式选择的提供商、模型和 effort 设置。

有关提供商配置和完整文档,请参阅 README。

English / 原文

> Lightweight by design

A single native C binary with a small dependency set. Starts instantly, and uses a very small amount of memory (just a few MBs) — so more RAM is left for your local LLMs.

> Local models are first-class

hax auto-discovers the model and runtime capabilities. No custom provider config block needed for the default setup.

llama-server -m [model].gguf
hax --provider llama.cpp

> Respects your terminal

Streaming Markdown and live tool output, reflowed for display in the terminal. Only redraws the current streaming line or the input area, native scrollback is preserved. Does not take over or mess with your terminal.

> Inspectable

See exactly what was sent to the model and what it replied in a usable transcript view (Ctrl+T). Optionally collect a detailed wire protocol trace.

> Use any provider/model

Supports OpenAI (+compatible), Anthropic (+compatible), Codex (via ChatGPT subscription), OpenRouter, llama.cpp, etc.

> Well-behaved Unix tool

XDG paths, clean stdout in -p one-shot mode with resume hints on stderr, plain-text config and session files, composition via subprocesses instead of plugins.

> Target audience

Developers who live in the terminal, run local models, audit what their tools do, package software for distros, or run agents where resources are scarce. If you want MCP marketplaces, a plugin runtime, IDE panels, or per-command permission prompts, other agents build exactly that — hax deliberately doesn't, and docs/philosophy.md explains each omission and the pattern that covers the need.

If "fancy new AI tech in an old-school minimalist package" sounds like your vibe, you might like this.

$ Get started

hax runs on Linux and macOS; on Windows, use it under WSL.

With Homebrew (macOS or Linux):

brew install oleksandrchekhovskyi/hax/hax

On Linux, download the prebuilt static binary for your architecture (x86_64 or aarch64) from the latest release, then unpack the hax binary into any directory on your PATH.

Building from source gives a binary linked against your system's shared libraries instead of a static one:

git clone https://github.com/OleksandrChekhovskyi/hax.git
cd hax
scripts/install_deps.sh   # Debian/Ubuntu, Fedora, Arch, openSUSE, Alpine, macOS
make                      # the binary is now at ./build/hax
make install              # optional; may prompt for sudo

scripts/install_deps.sh installs the build dependencies — a C compiler, libcurl, jansson, meson, ninja, and pkg-config — plus fzf, which hax uses for @file completion when available.

Run hax from the project directory you want it to work in:

hax                         # interactive REPL
hax -p "list TODOs"         # run one prompt and print the final answer
printf "explain x" | hax -p # read the prompt from stdin
hax -c                      # continue the latest session for this directory
hax --resume                # pick a past session for this directory
hax --resume=ID -p "next"   # resume a specific session in one-shot mode

The easiest first run is interactive: start hax, then use /provider to see available providers and choose a model. hax remembers interactive provider, model, and effort selections.

See the README for provider setup and the full documentation.