fx README

项目的 README,来自 github.com/vercel-labs/fx。合并为一个 markdown 文件:README.md。

 ⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀
 ⠀⠀⠀⠀⠀⢰⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
 ⠀⠀⠀⣠⣶⣿⣿⣷⣶⡶⣶⣶⣆⠀⠀⠀⣴⣶⣶⠆
 ⠀⠀⠀⠉⢹⣿⣿⠉⠉⠀⠘⢿⣿⣧⣀⣾⣿⡿⠃⠀             Tiny, open, embeddable, native coding agent.
 ⠀⠀⠀⠀⣼⣿⡏⠀⠀⠀⠀⠀⠻⣿⣿⣿⠟⠀⠀⠀
 ⠀⠀⠀⢀⣿⣿⠃⠀⠀⠀⠀⢠⣦⠘⢿⣿⣷⡀⠀⠀             curl -fsSL https://fx.sh/setup.sh | bash
 ⠀⠀⠀⣸⣿⡟⠀⠀⠀⠀⣰⣿⣿⠗⠀⠻⣿⣿⣄⠀
 ⠀⠀⠀⣿⣿⠇⠀⠀⠀⠾⠿⠿⠋⠀⠀⠀⠘⠿⠿⠦             ⚠ Status: Experimental. Use at your own risk.
  ⠀⣸⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
 ⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

fx

fx is a minimal coding agent CLI that still comes with batteries included. It's one native binary written in Zig, so there is no runtime to install, and it runs the same on your laptop, in CI, or inside an agent sandbox. Its output is closer to a Unix shell than an IDE, because the conversation prints into your terminal's scrollback instead of filling the screen.

fx is meant to be embedded and extended. Scripts call it with fx ask, editors connect over the Agent Client Protocol (ACP), and JavaScript apps run the same agent core through libfx with their own tools. Skills, MCP servers, and your project's AGENTS.md add to what the agent knows and can do.

Vercel Labs Product fx CLI release License: Apache-2.0

Features

Install

curl -fsSL https://fx.sh/setup.sh | bash

fx runs on macOS and Linux, on x86_64 and arm64. The installer puts it in ~/.local/bin. fx checks for updates in the background, and fx upgrade installs the latest release right away. CHANGELOG.md lists what changed in each release. You can also try fx in your browser without installing anything.

Quick start

Sign in with one of these:

fx login                    # Vercel AI Gateway
fx login codex              # ChatGPT subscription
fx login grok               # Grok subscription
fx login vercel --api-key   # AI Gateway API key

Then open a project and start fx:

cd your-project
fx

Type what you want done and press Enter. /help lists the slash commands. If something doesn't work, run fx doctor to check your setup.

To send one request without the interactive shell, use fx ask. Add --json when a script needs to read the result:

fx ask "explain the changes in this repository"
fx ask --json "summarize the failing tests" | jq -r .final_output

Embed and extend

Surface Use it for
fx ask One request from a script or CI job. --json returns structured output, and --resume continues a saved session.
fx acp Editors and other Agent Client Protocol clients, over stdio.
libfx The agent core as a JavaScript library, built as a native Node.js addon and as WebAssembly. createFxAgent() runs an agent with your own tools, MCP clients, and skills, and createFxTerminal() embeds the fx terminal.

The libfx README and the libfx docs cover the API. The WebAssembly build is experimental.

The CLI also picks up these extensions:

Examples

examples/ has small libfx apps you can run with an AI Gateway API key:

Documentation

The manual at fx.sh/docs covers models, permissions, configuration, skills, MCP, sessions, and every CLI and slash command.

For coding agents

To learn fx, read the manual as Markdown. fx.sh/llms.txt indexes every page, fx.sh/llms-full.txt puts the whole manual in one file, and adding .md to any docs URL returns that page as Markdown. For the flags of the installed version, run fx <command> --help.

To run fx from your own tools, use fx ask. It takes the prompt as arguments or on stdin, writes its result to stdout and progress and diagnostics to stderr, and exits with a nonzero status when the request fails. With --json, the final answer is in final_output.

To inspect a user's setup, run fx status --json for configuration and runtime information, or fx doctor --json for health checks. Neither changes the setup.

fx ask uses the user's saved permission mode, which is auto unless they changed it. Pass --full-access only when the user asks for it, because it turns off fx's permission checks.

To change fx itself, read AGENTS.md first, then build and verify the change as described in Contributing.

Feedback

Run /feedback inside fx to open the feedback form, or open an issue. If something looks wrong in your terminal, /trace creates a private diagnostic trace that you can share as a link from fx.sh/share (share feedback).

Contributing

You need Zig 0.17.1 to build fx:

git clone https://github.com/vercel-labs/fx.git
cd fx
zig build
./zig-out/bin/fx

Test your changes with the freshly built ./zig-out/bin/fx, because a bare fx may be an older copy on your PATH.

zig build test runs the unit tests, which sit next to the code they cover. The end-to-end tests in tests/e2e/ drive the built binary through tmux and need Bun.

The source is laid out like this:

fx/
├── src/
│   ├── main.zig     entry point that wires everything together
│   ├── core/        agent loop, sessions, config, permissions, MCP, skills
│   ├── builtins/    built-in tool specs, providers, and the system prompt
│   ├── tools/       built-in tools: files, shell, web, skills, subagents
│   ├── ui/          terminal rendering and input
│   ├── gateway/     model provider transport
│   ├── mcp/         MCP engine
│   └── acp/         Agent Client Protocol server
├── sdk/             libfx, the JavaScript library
├── tests/           end-to-end tests and model evals
└── benchmarks/      startup, memory, and latency benchmarks

Read CONTRIBUTING.md before you open a pull request. It covers verification, CI, and PR labels. If a coding agent is helping you, point it at For coding agents.

Security

Report vulnerabilities through the contact page instead of a public issue.

License

Apache-2.0. Third-party licenses and attributions are in THIRD_PARTY_NOTICES.md.

Credits

Interface sounds by cuelume.

fx (vercel-labs/fx)

正在搜索数据库…

3.9K ·GitHub
这是什么?fx 是一个用 Zig 编写的类 Unix 编程智能体框架和命令行工具,为研究和嵌入更大系统而设计,极度强调极简与性能。
fx 更像 Unix shell 工具,还是完整的 IDE 风格终端应用?fx 追求的是 Unix shell 命令的手感,而不是笨重的终端 IDE,它的命令行输出风格和形态都保持极简。
怎么开始在项目里用 fx?在你的项目文件夹里运行 fx 二进制文件;当前目录即成为主工作区,然后输入提示词,或运行 /help 浏览命令。
我需要 API 密钥吗,还是能用我的 ChatGPT 或 Grok 订阅?你可以用 Vercel AI Gateway 的 API 密钥登录,也可以通过 OpenAI Codex OAuth 用符合条件的 ChatGPT 订阅认证,或通过 xAI OAuth 用符合条件的 Grok 订阅认证。
保存的 fx 会话损坏了怎么办?你可以运行 fx session recover,把受损会话中经验证的完好前段复制到新会话,但损坏点之后的记录会被丢弃,命令也不会重新执行。
fx 能嵌入带自有认证体系的其他产品吗?可以。在网络边界注入提供商认证的宿主可以设置 FXAUTHMODE=host-managed,这样 fx 就不会自己读取、刷新或写入本地的大模型提供商凭据。
fx 二进制文件有多大?大约 7.8 MiB,体现了该项目在系统提示词、工具和功能集上对极简与性能的执着。
当对话长到超出模型上下文窗口时会怎样?当活跃请求达到可用输入容量的 80% 时,fx 会自动把会话摘要压缩进一个全新的上下文窗口;你也可以用 /compact 手动触发同样的交接。
用 ChatGPT 或 Grok 登录时,我的令牌会经过 Vercel 吗?不会。OpenAI Codex 和 xAI Grok 的 OAuth 令牌都存储在本地(~/.fx/chatgpt-auth.json 或 ~/.fx/grok-auth.json),绝不会发送给 Vercel AI Gateway,也不会互相发送。
fx 行为异常时,/trace 能做什么?它会生成一份私密的 Markdown 诊断文件,包含日志、会话上下文、运行时状态、权限和最近的渲染事件,帮助排查问题。
大小
116.9 MB
星标
3.9K
时长
3个月
提交 · 90 天