跳到正文
原文
Hacker News 热门(buzzing.cc 中文翻译)· Hacker News 热门(buzzing.cc 中文翻译)·· 2026-06-23精选AI 评分72

Show HN:Oak——专为代理设计的 Git 替代方案

AI 导读

Oak 是开源版本控制系统,专为 AI 智能体(Claude Code、Codex、Cursor)设计。采用 BLAKE3 内容哈希、内容定义分块、diff/merge 及 Blob/Manifest/Commit/Tree 数据模型,可选 SQLite 和 git 后端。以分支-会话为基本工作单元,用分支描述替代逐次提交,通过内容寻址懒加载使智能体数秒内编辑任意仓库。速度远超 git。已发布公开测试版 v0.99.0,支持 macOS(Apple Silicon)、Linux(x86_64)及 Windows,可通过 curl 或 cargo 安装,Apache-2.0 开源。

推荐理由

专为 AI 代理打造的全新版本控制工具,分支作为会话单元、内容寻址懒加载,设计直接摆脱了 git 的包袱,用 agent 的开发者值得一试。

正文

README.md 217 lines · 9.4 KB

This repository is the open-source heart of Oak: version control at the speed of agents. It's developed as a Cargo workspace: a reusable VCS library plus the oak command-line client that agents drive.

Bring your own agent (Claude Code, Codex, Cursor, …); Oak is the foundation it reads, writes, branches, and collaborates through. The substrate is shaped around how agents actually work — branch-per-session as the unit of work, branch descriptions in place of per-commit messages, and content-addressed lazy mounts that get an agent editing any repo in seconds. Because it's content-addressed and hydrates on demand, it's also far faster than git for agent workloads — but the speed is a consequence of the design, not the pitch.

CratePathcrates.ioWhat it is
oakvcs-corecore/oakvcs-coreThe VCS foundation: BLAKE3 content hashing, content-defined chunking, diff/merge, the Blob/Manifest/Commit/Tree data model, and an optional client-side local repository (SQLite + git backends).
oakvcs-clicli/oakvcs-cliThe oak binary that builds on oakvcs-core.

Using the library in your own project

oakvcs-core is usable on its own — e.g. to build an Oak integration into another tool or engine. Pull in just the content-addressed data model and hashing (no SQLite/git) with default features off:

[dependencies]
oakvcs-core = { version = "0.105.0", default-features = false }

The crate is published as oakvcs-core but imported as oak_core.

Add the default local-repo feature when you also want the on-disk Repository (SQLite + read-only git) backends.

Installing the CLI

Oak is in public beta (v0.105.0). The quickest way in is the prebuilt oak binary:

curl -fsSL oak.space/install | sh

The sh installer supports macOS (Apple Silicon and Intel) and Linux (x86_64) — it picks the native binary for the machine it runs on. After install, oak upgrade updates the binary in place.

Linux ARM64 binaries are published too, but the installer doesn't select them yet; grab oak-linux-arm64 from the latest GitHub release for now.

Windows (x86_64)

The curl … | sh installer is Unix-only; Windows has a PowerShell counterpart:

irm https://oak.space/install.ps1 | iex

It installs oak.exe to %USERPROFILE%\.local\bin and adds that directory to your user PATH. You can also grab the prebuilt oak-windows-x86_64.exe from the latest GitHub release (rename it to oak.exe and put it on your PATH), or build from crates.io with cargo install oakvcs-cli. oak upgrade then updates it in place.

oak mount on Windows uses the Projected File System (ProjFS), an optional Windows feature. Enable it once per machine from an elevated PowerShell:

Enable-WindowsOptionalFeature -Online -FeatureName Client-ProjFS -NoRestart

(or Settings → Apps → Optional features → "Windows Projected File System"). Everything else — clone, push, pull, commit — works without it.

Prefer to build from crates.io? Install with Cargo instead (works on macOS, Linux, and Windows — the TLS stack uses rustls + ring, so no C/NASM build toolchain is required):

cargo install oakvcs-cli   # builds and installs the `oak` binary

Shell completion is generated on demand — bash, zsh, fish, elvish, and powershell are supported. For the current session:

source <(oak completions bash)

Or write the script wherever your shell loads completions from, e.g. oak completions bash > ~/.local/share/bash-completion/completions/oak.

Teaching your agent to drive Oak

Oak bundles an agent skill in the open Agent Skills format — a SKILL.md plus reference files that tell a coding agent how Oak differs from git (flat branches, messageless commits, branch descriptions, mounts, the CI gate) so it stops reaching for git status:

oak skill install            # into this repo's .claude/skills/ — commit it
oak skill install --global   # into ~/.claude/skills/ for every project

The files are baked into the binary, so the installed skill always documents the CLI version that wrote it; re-run after oak upgrade to refresh it. The source of truth is cli/src/commands/skill/oak-vcs/.

CI and the merge gate

An Oak server runs CI natively from workflow files at .oak/workflows/*.yml, and merges onto main are gated on it: the server refuses a squash-merge (HTTP 412) while the branch head's CI is red or still in flight. The CLI is the visibility and recovery surface for that gate:

oak ci status              # CI for the current branch head — exit 0 pass, 1 fail, 3 running
oak ci runs [--limit N]    # recent runs: id, workflow, branch, commit, status, duration
oak ci logs <run-id>       # step-by-step logs
oak ci rerun <run-id>      # re-dispatch at the same commit, for infra flakes
oak ci cancel RUN_ID --commit HASH --json # exact ordinary push/merge run only

oak merge --wait           # ride the gate out instead of polling
oak merge --force          # override it, after reading the failure

Cancellation requires an explicit run ID and full lowercase commit hash. It rejects manual, protected, release, terminal, moved, and unknown runs before mutation. A successful receipt confirms the control-plane cancellation record; stopping already-running execution remains best effort and is not confirmed.

Working with large monorepos

Two ways to avoid pulling a whole monorepo:

  • Lazy mounts — oak mount <org>/<repo> puts a working tree on top of the remote and hydrates files on demand (FSKit on macOS, FUSE on Linux, ProjFS on Windows). Best default for very large repos.

  • Sparse (partial) clones — Perforce-style, when you want a plain on-disk checkout scoped to a subtree:

    oak clone acme/monorepo --path services/api --path libs/shared
    oak sparse add libs/proto   # widen the cone
    oak sparse disable          # back to a full checkout
    

    Add --json to a named Oak clone for one machine-readable acquisition receipt. It records the requested history and cone, the resulting exact head/manifest, observed object and unique chunk counts, materialization counts, and explicitly unavailable transport/disk measurements. Legacy fallback phases remain visible rather than being folded into a false single-pass claim.

    Only files under the cone are downloaded and written; the rest of the tree is listed but its content is withheld, and commits carry the out-of-cone paths forward untouched (narrowing never deletes them). The same withhold-content mechanism powers server-side path permissions — directory-level read access, declared in the repo as a CODEOWNERS-shaped .oak/PERMISSIONS file rather than configured in the platform. OAK_ALLOW_PARTIAL_CLONE=1 is a separate recovery flag that skips, rather than errors on, blobs a broken server failed to ship.

Every clone first negotiates a bounded metadata integrity profile; merely being logged in does not trigger object-store probes. If the proof runs out of its history/tree/path or wall-time budget, the result is inconclusive (exit 8), not a content failure: Oak never narrows or waives on its own, and recommends the exact --shallow retry first. When the server issued a snapshot pin for that inconclusive proof, it also offers the explicit --allow-unverified-integrity retry, which proceeds without proving completeness while the pull still verifies transferred hashes. --allow-legacy-scope is the separate, explicit compatibility waiver for an accessible older server that cannot prove branch/depth/sparse scope. Use oak doctor --repo ORG/REPO --verify metadata --json for a cheap bounded diagnostic and the platform-admin oak blob info HASH --repo ORG/REPO --json for bounded target byte evidence (--depth N --branch NAME selects a wider explicit history scope).

Building from source

cargo build --workspace        # builds oak-core + the oak binary
cargo test  -p oakvcs-cli      # CLI tests (incl. wiremock HTTP tests)
make build                     # release build + the CLI release tooling
make release-proof             # non-mutating launch/release readiness proof

The CLI depends on oak-core via an in-workspace path, so a plain cargo build works against the local core/ checkout with no extra setup. See docs/release-readiness.md for the release proof and crates.io publish-order checks.

Feedback

oak feedback files a feature request or bug report against Oak from the terminal and prints back a tracking reference (fb-N). It takes -m, a file, or stdin, opens $EDITOR with a template when given nothing on a TTY, and exits rather than blocking when there's no terminal — so an agent can file one mid-task without stalling:

oak feedback -m "oak diff --print panics on a closed pipe" --json

License

Apache-2.0. See LICENSE.

AI

This repo was written almost entirely using AI with human oversight. If you see anything that needs fixed or would like to contribute, please email [email protected] or reach out on Discord.

1
# Oak
2
3
This repository is the open-source heart of [Oak](https://oak.space):
4
**version control at the speed of agents**. It's developed as a Cargo
5
workspace: a reusable VCS library plus the `oak` command-line client that
6
agents drive.
7
8
Bring your own agent (Claude Code, Codex, Cursor, …); Oak is the foundation
9
it reads, writes, branches, and collaborates through. The substrate is shaped
10
around how agents actually work — branch-per-session as the unit of work,
11
branch descriptions in place of per-commit messages, and content-addressed
12
lazy mounts that get an agent editing any repo in seconds. Because it's
13
content-addressed and hydrates on demand, it's also far faster than git for
14
agent workloads — but the speed is a consequence of the design, not the pitch.
15
16
| Crate | Path | crates.io | What it is |
17
|-------|------|-----------|------------|
18
| `oakvcs-core` | [`core/`](core/) | [`oakvcs-core`](https://crates.io/crates/oakvcs-core) | The VCS foundation: BLAKE3 content hashing, content-defined chunking, diff/merge, the Blob/Manifest/Commit/Tree data model, and an optional client-side local repository (SQLite + git backends). |
19
| `oakvcs-cli` | [`cli/`](cli/) | [`oakvcs-cli`](https://crates.io/crates/oakvcs-cli) | The `oak` binary that builds on `oakvcs-core`. |
20
21
## Using the library in your own project
22
23
`oakvcs-core` is usable on its own — e.g. to build an Oak integration into
24
another tool or engine. Pull in just the content-addressed data model and
25
hashing (no SQLite/git) with default features off:
26
27
```toml
28
[dependencies]
29
oakvcs-core = { version = "0.105.0", default-features = false }
30
```
31
32
The crate is published as `oakvcs-core` but imported as `oak_core`.
33
34
Add the default `local-repo` feature when you also want the on-disk
35
`Repository` (SQLite + read-only git) backends.
36
37
## Installing the CLI
38
39
Oak is in **public beta** (v0.105.0). The quickest way in is the prebuilt
40
`oak` binary:
41
42
```bash
43
curl -fsSL oak.space/install | sh
44
```
45
46
The `sh` installer supports **macOS (Apple Silicon and Intel)** and **Linux
47
(x86_64)** — it picks the native binary for the machine it runs on. After
48
install, `oak upgrade` updates the binary in place.
49
50
Linux ARM64 binaries are published too, but the installer doesn't select them
51
yet; grab `oak-linux-arm64` from the [latest GitHub
52
release](https://github.com/oakdotspace/oak/releases/latest) for now.
53
54
### Windows (x86_64)
55
56
The `curl … | sh` installer is Unix-only; Windows has a PowerShell
57
counterpart:
58
59
```powershell
60
irm https://oak.space/install.ps1 | iex
61
```
62
63
It installs `oak.exe` to `%USERPROFILE%\.local\bin` and adds that directory to
64
your user `PATH`. You can also grab the prebuilt `oak-windows-x86_64.exe` from
65
the [latest GitHub
66
release](https://github.com/oakdotspace/oak/releases/latest) (rename it to
67
`oak.exe` and put it on your `PATH`), or build from crates.io with
68
`cargo install oakvcs-cli`. `oak upgrade` then updates it in place.
69
70
`oak mount` on Windows uses the **Projected File System (ProjFS)**, an optional
71
Windows feature. Enable it once per machine from an elevated PowerShell:
72
73
```powershell
74
Enable-WindowsOptionalFeature -Online -FeatureName Client-ProjFS -NoRestart
75
```
76
77
(or Settings → Apps → Optional features → "Windows Projected File System").
78
Everything else — clone, push, pull, commit — works without it.
79
80
Prefer to build from crates.io? Install with Cargo instead (works on macOS,
81
Linux, and Windows — the TLS stack uses rustls + `ring`, so no C/NASM build
82
toolchain is required):
83
84
```bash
85
cargo install oakvcs-cli   # builds and installs the `oak` binary
86
```
87
88
Shell completion is generated on demand — `bash`, `zsh`, `fish`, `elvish`, and
89
`powershell` are supported. For the current session:
90
91
```bash
92
source <(oak completions bash)
93
```
94
95
Or write the script wherever your shell loads completions from, e.g.
96
`oak completions bash > ~/.local/share/bash-completion/completions/oak`.
97
98
## Teaching your agent to drive Oak
99
100
Oak bundles an agent skill in the open [Agent
101
Skills](https://code.claude.com/docs/en/skills) format — a `SKILL.md` plus
102
reference files that tell a coding agent how Oak differs from git (flat
103
branches, messageless commits, branch descriptions, mounts, the CI gate) so it
104
stops reaching for `git status`:
105
106
```bash
107
oak skill install            # into this repo's .claude/skills/ — commit it
108
oak skill install --global   # into ~/.claude/skills/ for every project
109
```
110
111
The files are baked into the binary, so the installed skill always documents
112
the CLI version that wrote it; re-run after `oak upgrade` to refresh it. The
113
source of truth is
114
[`cli/src/commands/skill/oak-vcs/`](cli/src/commands/skill/oak-vcs/).
115
116
## CI and the merge gate
117
118
An Oak server runs CI natively from workflow files at `.oak/workflows/*.yml`,
119
and merges onto `main` are gated on it: the server refuses a squash-merge
120
(HTTP 412) while the branch head's CI is red or still in flight. The CLI is the
121
visibility and recovery surface for that gate:
122
123
```bash
124
oak ci status              # CI for the current branch head — exit 0 pass, 1 fail, 3 running
125
oak ci runs [--limit N]    # recent runs: id, workflow, branch, commit, status, duration
126
oak ci logs <run-id>       # step-by-step logs
127
oak ci rerun <run-id>      # re-dispatch at the same commit, for infra flakes
128
oak ci cancel RUN_ID --commit HASH --json # exact ordinary push/merge run only
129
130
oak merge --wait           # ride the gate out instead of polling
131
oak merge --force          # override it, after reading the failure
132
```
133
134
Cancellation requires an explicit run ID and full lowercase commit hash. It
135
rejects manual, protected, release, terminal, moved, and unknown runs before
136
mutation. A successful receipt confirms the control-plane cancellation record;
137
stopping already-running execution remains best effort and is not confirmed.
138
139
## Working with large monorepos
140
141
Two ways to avoid pulling a whole monorepo:
142
143
- **Lazy mounts** — `oak mount <org>/<repo>` puts a working tree on top of the
144
  remote and hydrates files on demand (FSKit on macOS, FUSE on Linux, ProjFS on
145
  Windows). Best default for very large repos.
146
- **Sparse (partial) clones** — Perforce-style, when you want a plain on-disk
147
  checkout scoped to a subtree:
148
149
  ```bash
150
  oak clone acme/monorepo --path services/api --path libs/shared
151
  oak sparse add libs/proto   # widen the cone
152
  oak sparse disable          # back to a full checkout
153
  ```
154
155
  Add `--json` to a named Oak clone for one machine-readable acquisition
156
  receipt. It records the requested history and cone, the resulting exact
157
  head/manifest, observed object and unique chunk counts, materialization
158
  counts, and explicitly unavailable transport/disk measurements. Legacy
159
  fallback phases remain visible rather than being folded into a false
160
  single-pass claim.
161
162
  Only files under the cone are downloaded and written; the rest of the tree
163
  is listed but its content is withheld, and commits carry the out-of-cone
164
  paths forward untouched (narrowing never deletes them). The same
165
  withhold-content mechanism powers server-side **path permissions** —
166
  directory-level read access, declared in the repo as a CODEOWNERS-shaped
167
  `.oak/PERMISSIONS` file rather than configured in the platform.
168
  `OAK_ALLOW_PARTIAL_CLONE=1` is a separate recovery flag that skips, rather
169
  than errors on, blobs a broken server failed to ship.
170
171
Every clone first negotiates a bounded metadata integrity profile; merely
172
being logged in does not trigger object-store probes. If the proof runs out
173
of its history/tree/path or wall-time budget, the result is *inconclusive*
174
(exit 8), not a content failure: Oak never narrows or waives on its own, and
175
recommends the exact `--shallow` retry first. When the server issued a
176
snapshot pin for that inconclusive proof, it also offers the explicit
177
`--allow-unverified-integrity` retry, which proceeds without proving
178
completeness while the pull still verifies transferred hashes. `--allow-legacy-scope` is the separate, explicit compatibility waiver
179
for an accessible older server that cannot prove branch/depth/sparse scope.
180
Use `oak doctor --repo ORG/REPO --verify metadata --json` for a cheap bounded
181
diagnostic and the platform-admin `oak blob info HASH --repo ORG/REPO --json`
182
for bounded target byte evidence (`--depth N --branch NAME` selects a wider
183
explicit history scope).
184
185
## Building from source
186
187
```bash
188
cargo build --workspace        # builds oak-core + the oak binary
189
cargo test  -p oakvcs-cli      # CLI tests (incl. wiremock HTTP tests)
190
make build                     # release build + the CLI release tooling
191
make release-proof             # non-mutating launch/release readiness proof
192
```
193
194
The CLI depends on `oak-core` via an in-workspace path, so a plain
195
`cargo build` works against the local `core/` checkout with no extra setup.
196
See [`docs/release-readiness.md`](docs/release-readiness.md) for the release
197
proof and crates.io publish-order checks.
198
199
## Feedback
200
201
`oak feedback` files a feature request or bug report against Oak from the
202
terminal and prints back a tracking reference (`fb-N`). It takes `-m`, a file,
203
or stdin, opens `$EDITOR` with a template when given nothing on a TTY, and
204
exits rather than blocking when there's no terminal — so an agent can file one
205
mid-task without stalling:
206
207
```bash
208
oak feedback -m "oak diff --print panics on a closed pipe" --json
209
```
210
211
## License
212
213
Apache-2.0. See [LICENSE](LICENSE).
214
215
## AI
216
217
This repo was written almost entirely using AI with human oversight. If you see anything that needs fixed or would like to contribute, please email [email protected] or reach out on [Discord](https://discord.gg/UUPfUaeDnS).

来源:Hacker News 热门(buzzing.cc 中文翻译) · oak.space