
A0
io.github.Joe-Simov0.8.16更新於 Oct 1, 2026
Write, check, run and compile A0 programs through revision-checked structured edits.
概覽
讓助理透過帶修訂校驗的結構化編輯來撰寫、檢查、執行與編譯 A0 程式,而不是直接改文字檔。
- 功能
- 透過 stdio 提供 A0 語言服務,讓代理以工具而非原始檔案工作:a0_open 回傳帶控制代碼的函式檢視,a0_program 回傳可限定目標平台的程式控制代碼,a0_apply 在控制代碼下編輯並回傳新檢視或含 code、id、message、expected/actual、fix 與 applicability 的診斷,a0_check 負責校驗,a0_run 在具燃料上限的參考解譯器中執行,a0_emit 產生任意目標,a0_save 僅在成功套用後寫入。路徑被限制在啟動根目錄內,不執行 shell,輸出有上限。
- 適用情境
- 當助理需要撰寫或維護 A0 原始碼,且你希望編輯在落地前先經檢查器驗證、診斷中帶有精確修正時使用。適合已採用 A0 工具鏈(含語言伺服器、鉤子與 CI 檢查)的專案。
- 執行需求
- 需要在 PATH 上有本機 A0 執行檔,可透過 Homebrew、安裝指令稿或下載發行版執行檔取得;伺服器以本機 stdio 程序執行,不需帳號、不需託管,也未宣告環境變數。僅在連結本機原生輸出時需要 C 編譯器。清單列出僅限桌面的 .mcpb 套件,涵蓋 macOS、Linux 與 Windows。
安裝
README
A0
The programming language built for AI, not for people. a0lang.com · Docs
A0 is a compact, exactly specified language that models write and edit through revision-checked structured edits. A model reads only what an edit touches, writes only the changed lines, and nothing invalid lands. One program compiles to native machine code (A0's own AArch64 code generator, or C), the browser (wasm32), JavaScript, the JVM, .NET, Metal GPU kernels, and clocked SystemVerilog, and every target is verified against one oracle.
Measured on the repository's benchmarks (Apple M3, 8 cores, results/*.json). The machine was not quiet: results/exec-benchmark.json records a 1/5/15-minute load average of 6.4-8.0 for the main and arm64 runs and 32-40 for the JavaScript remeasurement; a quiet-machine rerun is pending:
The site a0lang.com is itself two A0 programs (site/page.a0, site/docs.a0).
See DESIGN.md for intent and
semantics, MODEL_GUIDE.txt for the AI-facing language
instructions, STATUS.md for the current results, loss ledger, known limits, and next actions
(session history in docs/history/), and results/ for machine-readable evidence.
Install
A0 is a single self-contained binary: no Node, no Bun.
Both scripts accept A0_VERSION=v0.8.16 to pin a release and A0_INSTALL_DIR to change the destination. Or download a binary from the latest release by hand and check it against checksums.txt. a0 --version prints the release and compiler version. Then:
Binaries: a0-darwin-arm64, a0-darwin-x64, a0-linux-x64, a0-linux-arm64, a0-windows-x64.exe. A C compiler (clang or gcc) is needed only to link native output on your machine.
MCP server
a0 mcp <file-or-dir> serves A0 to AI agents over stdio (Model Context Protocol), so they edit through tools instead of text files: a0_open (function view with a handle), a0_program (program handle, optionally scoped to a target), a0_apply (edit under a handle; returns the new view or a diagnostic with code (class), id (A0nnnn), message, expected/actual, fix and applicability; the reply fix all applies every exact fix of the last rejected edit, atomically), a0_check, a0_run (reference interpreter, fuel-bounded), a0_emit (any target), a0_save (only after a successful apply). Paths are confined to the launch root (symlink escapes and use escapes rejected); no shell is run; output is bounded.
Language server
a0 lsp [root] is a Language Server Protocol server over stdio (built on vscode-languageserver; --stdio is accepted and ignored). Point any LSP client at it for .a0 files: diagnostics on open and change from the linker and checker (the diagnostic code is the class, data carries the table code id, the fix and its applicability, and an exact fix is a quick fix), hover (function signatures, op docs), go-to-definition across use files, document symbols, completion of ops and in-scope functions, and formatting through the canonical printer. Files are confined to root (default: the working directory) exactly as in the MCP server; a document outside it gets one limit diagnostic and nothing else.
Use with AI agents
Put a0 on your PATH first (see Install). Every entry below runs the same local stdio server, a0 mcp <dir>, with no hosting and no account. Ready-to-copy configs are in integrations/. The Agent Skill in skills/a0/ (install with npx skills add Joe-Simo/a0) teaches the language and loads the primer and the edit protocol only when they are needed.
Replace . with the folder the server may read and write when your agent does not start servers in the project folder.
Project rules, hooks and CI
a0 init [dir]writesAGENTS.md(read by Codex, Cursor, Copilot, Jules and others) with the MCP tool workflow, the edit protocol and the primer path (.a0/MODEL_GUIDE.txt, copied in when available, otherwise the GitHub URL), plus@AGENTS.mdpointers inCLAUDE.mdandGEMINI.md, glob rules for Cursor (.cursor/rules/a0.mdc), Windsurf (.windsurf/rules/a0.md) and Copilot (.github/instructions/a0.instructions.md), and a Gemini CLIAfterToolhook (.gemini/settings.json). Existing instruction files get the A0 section appended once; other existing files are kept.a0 hookis the after-edit check: it reads a hook's tool-call JSON on stdin and, when an edited*.a0file failsa0 check, prints a blocking response whose reason is the exact diagnostic with itsfix:.- Claude Code plugin (
plugin/): aPostToolUsehook onEdit|Write|MultiEdit(plugin/hooks/hooks.json, runsa0 hook; setA0_BINifa0is not onPATH) and the slash commands/a0-check,/a0-emit,/a0-run(plugin/commands/). - CI:
uses: Joe-Simo/a0@main(rootaction.yml, inputversion, defaultlatest) downloads the release binary for the runner and checks every tracked.a0file. pre-commit:repo: https://github.com/Joe-Simo/a0, hook ida0-check(needsa0onPATH). a0 checkaccepts several files and exits 1 if any fails, printing<file>: error: <code>: ... fix: ...per failure.
Privacy
The a0 MCP server and the .mcpb bundles run entirely on your machine. They collect no data, make no network requests, and read or write only inside the folder you give them.
Contributing to the compiler
See CONTRIBUTING.md for the layout, the edit protocol, how to add a backend or a language to the experiments, and the measurement rules.
The compiler is being rewritten in A0 (see compiler/ and DESIGN.md section 7a). Until that lands, the compiler itself is TypeScript, and working on it needs Bun or Node 22+. Users of A0 never need this: the released a0 binary is self-contained.
CLI (after bun run build):
Layout: src/core.ts grammar/validation/interpreter, src/edit.ts revisions and
edit sessions, src/optimize.ts, src/backends.ts JS/C/Java/SystemVerilog emission
and emission cache, src/toolchain.ts installed-tool integration, src/cli.ts,
test/, tools/ (corpus + oracle, verify, hw-verify, bench, token-bench).
Errors built for agents
Every diagnostic is one row of src/diagnostics.ts: a stable code (A0nnnn), a coarse class (parse, type, structure, limit, edit, patch, revision, handle, runtime, cli, unchanged), a message template, the fix, and a0 explain text with one failing and one fixed example. A diagnostic reaches an agent as {code, id, message, line, expected, actual, fix, applicability, edits} from a0 check --json, the edit protocol, the MCP server and the LSP. An unknown name (op, function, node, fold body, loop predicate, type) gets a did-you-mean by TypeScript's spelling rule. A fix is exact (safe to apply blindly, with edits that do it) or maybe. In the edit protocol the reply fix all applies every exact fix of the last rejected reply and validates the result before it commits. test/diagnostics.test.ts runs every explain example, and corpus/reject/ holds rejected programs and replies with the diagnostic each must raise and the program its fix produces (node dist/tools/reject-corpus.js [--bless] [--coverage]).
來源:README.md,提交 9e2076a
工具
0版本歷史
1- v0.8.16最新Oct 1, 2026

