Hax – 一款用 C 语言编写的极简主义终端原生编码助手
Hax – a minimalist, terminal-native coding agent written in C

原始链接: https://usehax.dev/

**hax** 是一款轻量级、极简的 AI 命令行工具,专为偏好终端工作流的开发者设计。它以单一原生 C 二进制文件编写,资源占用极低,非常适合在不占用过多系统内存的情况下运行本地大语言模型(LLM)。 主要功能包括: * **无缝集成:** 自动发现本地模型,并支持 OpenAI、Anthropic 和 llama.cpp 等主流提供商。 * **终端友好:** 遵循标准终端行为,输出整洁,支持滚动回看,并采用流式 Markdown 显示。 * **透明度:** 提供可查阅的会话记录视图(Ctrl+T)和详细的网络协议追踪,以便审计模型交互。 * **Unix 哲学:** 遵循传统工具标准,使用 XDG 路径、纯文本配置和子进程组合,而非复杂的插件系统。 **hax** 有意避开了 IDE 面板或应用市场生态等臃肿功能,专注于打造一个稳健、透明且高性能的代理工具。它适用于 macOS 和 Linux(可通过 Homebrew 或静态二进制文件安装),并为交互式会话、一次性提示词和会话恢复提供了简洁的接口。无论你是为了审计 AI 行为还是管理有限的系统资源,hax 都为现代 AI 集成提供了一种可靠的“老派”方案。

Hacker News 的用户正在讨论 **Hax**,这是一款全新的极简主义终端原生编码代理,完全使用 C 语言编写。该工具由 OleksandrC 开发,凭借其相较于基于 JavaScript 或 Python 的大型替代方案所具备的速度优势和极低的资源占用,获得了广泛关注。 讨论中的要点包括: * **性能:** 用户称赞 Hax 运行速度快、易于构建,且保持了“令人耳目一新”的极简特性。多位用户反馈已成功将其与本地大模型(通过 llama.cpp)以及 DeepSeek 等自定义 API 提供商配合使用,且成本极低。 * **设计选择:** 虽然有人质疑为何在一个现代项目中使用 C 语言,但开发者解释称,C 语言是实现最小资源占用的最有效语言,也是他最熟悉的语言。支持者则强调了 C 语言在不同硬件架构间无与伦比的可移植性。 * **实用性:** Hax 可以处理读取、编辑和执行 Bash 命令等核心任务。用户指出,尽管一些高级模型是针对特定代理工具集进行微调的,但它们通常能很好地适应 Hax 的简化指令结构。 * **市场反响:** 该项目作为一种高效、务实的替代方案,受到了广泛欢迎。用户正积极在 GitHub 仓库贡献反馈和错误报告。
相关文章

原文

> 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.

联系我们 contact @ memedata.com