# Oak documentation > Every page of https://oak.space/docs in one file, in reading order, for pasting into an agent's context. ## Introduction Oak is version control, and the hosting around it, for people who work alongside coding agents. Your agent (Claude Code, Codex, Cursor, or anything else that can run a shell command) reads, writes, branches and publishes through the `oak` CLI, and you review and merge what comes back. Oak doesn't run agents. You bring your own. Oak makes no AI calls on your behalf and doesn't train on your code. ### The five ideas Most of what's in these docs follows from five decisions. 1. **A branch is a task.** It's one unit of work, usually one agent session, rather than a long-lived line of development. `oak init` and `oak clone` put you on a fresh personal branch, and you make a new one for each task. 2. **Commits are checkpoints; the branch description is the message.** `oak commit` takes no `-m`. What the change *is* gets written once, on the branch, with `oak desc`. 3. **`main` lives on the server, and only merges reach it.** You never commit to `main` locally and direct pushes to it are refused. Publishing a branch and merging it are separate steps, and merging is a human's call. 4. **Merging squashes.** A merged branch becomes exactly one commit on `main`, whose message is the branch description. `main` reads as one line per task. 5. **You don't need the whole repo.** A [shallow clone](/docs/sparse-clones#other-ways-to-clone-less) leaves out the history, a [sparse clone](/docs/sparse-clones) checks out only the directories you name, and [`oak ls`, `oak cat` and `oak grep --remote`](/docs/remote-inspection) read a repo on the server without cloning it. Around that, oak.space has what a group needs to land changes: [marks](/docs/marks) for what passed and what's deployed, [access rules](/docs/path-permissions) per directory, organizations, webhooks, and a JSON API. ### Where to start | If you want to… | Read | |---|---| | Install the CLI and sign in | [Install and sign in](/docs/install) | | Get a repo onto Oak and merge your first change | [Quickstart](/docs/quickstart) | | Translate what you know from Git | [Coming from Git](/docs/coming-from-git) | | Point a coding agent at Oak | [Working with agents](/docs/agents) | | Run several agents on one big repo | [Example: a fleet of agents](/docs/example-session) | | Record what passed, or deploy from a commit | [Marks](/docs/marks) | | Look up a command or flag | [CLI reference](/docs/cli) | | Script against oak.space | [HTTP API reference](/docs/api) | ### Platforms The `oak` CLI ships for **macOS** (Apple Silicon and Intel), **Linux x86_64**, and **Windows x86_64**. A Linux ARM64 binary is published too, but the installer doesn't select it yet; see [Install](/docs/install#install-the-cli). ### For agents Every page has a **Copy page** button and a **.md** link that return its Markdown source, and [`/docs/llms-full.txt`](/docs/llms-full.txt) is every page in one file. `oak skill install` puts an `oak-vcs` skill into your repo so agents pick up the workflow without being told. See [Working with agents](/docs/agents#install-the-agent-skill). ### Getting your data out `oak export` replays an Oak repo's full history into an ordinary Git repository, keeping each commit's author, email, and timestamp. See [Git import and export](/docs/git). ## Install and sign in ### Install the CLI On **macOS** (Apple Silicon or Intel) and **Linux x86_64**: ```bash curl -fsSL https://oak.space/install | sh ``` On **Windows x86_64**, from PowerShell: ```powershell irm https://oak.space/install.ps1 | iex ``` The installer picks the native binary for your machine, verifies its minisign signature, and puts it at `~/.local/bin/oak` (`%USERPROFILE%\.local\bin\oak.exe` on Windows). If that directory isn't on your `PATH`, the installer prints the line to add. | Installer variable | Effect | |---|---| | `INSTALL_DIR` | Install somewhere else — e.g. `/usr/local/bin` on a CI image, so the binary is already on `PATH`. | | `OAK_NO_LOGIN=1` | Skip the "Log in now?" prompt at the end. (It's skipped automatically when there's no terminal.) | | `OAK_CHANNEL=nightly` | Install the nightly build instead of the latest release. See [Nightly builds](#nightly-builds). | #### Nightly builds We build the tip of `main` once a day, on days when something landed. To install that build instead of the latest release: ```bash curl -fsSL https://oak.space/install | OAK_CHANNEL=nightly sh ``` ```powershell $env:OAK_CHANNEL = 'nightly'; irm https://oak.space/install.ps1 | iex ``` Nightlies are signed with the same key as releases and checked the same way. The installer also saves the choice in `~/.config/oak/update.json`, so `oak upgrade` and the daily update notice follow nightlies from then on. `oak upgrade --channel stable` switches back; running the ordinary installer again doesn't change the saved channel. If no nightly has been published for your platform, the installer stops and tells you to install the stable release instead. > **Linux ARM64:** a binary is published, but the installer doesn't select it yet. Download it from , rename it to `oak`, make it executable, and put it on your `PATH`. ### Sign in ```bash oak login oak whoami # prints the username you're signed in as ``` `oak login` opens your browser at oak.space, where you sign in however you normally do (password or GitHub), and hands a token back to the CLI over a one-shot local callback. On a machine with no browser — an SSH session, a container — it prints a URL instead: open it on any other device, approve, and paste the one-time code it shows back into the terminal. The token is saved in `~/.config/oak/credentials` and lasts 90 days. Run `oak login` again to refresh it, or `oak logout` to remove it. To check which credential the CLI is actually using — handy when a push 404s on a repo you know exists — run: ```bash oak auth status ``` It reports where the credential came from (never the secret itself), which server, and the identity the server resolves it to. #### Non-interactive machines and CI `oak login` needs a human once. For scripts, CI jobs, and long-running agents, use an API key instead and export it: ```bash export OAK_API_KEY=oak_... ``` `OAK_API_KEY` beats every stored credential. Create keys — including narrowly scoped, read-only, or single-repo keys — as described in [API keys and tokens](/docs/api-keys). #### Other servers Every command that talks to a server takes `-r, --remote ` (default `https://oak.space`). You can also set `OAK_REMOTE` for a whole shell. Once a checkout is linked to a server, it remembers which one. ### Keep it up to date ```bash oak upgrade # latest build on your channel (stable unless you chose nightly) oak upgrade --channel nightly # switch to nightly builds; remembered for later upgrades oak upgrade --channel stable # switch back to releases oak upgrade --canary # install the current nightly once, without switching ``` Upgrades are signature-checked like the installer. The CLI checks for a new version at most once a day and prints a one-line notice; set `OAK_NO_UPDATE_CHECK=1` to turn that off. ### Shell completion ```bash oak completions --install ``` This writes the completion script for your shell (from `$SHELL`, or name it: `oak completions --install zsh`) to where that shell loads completions from: `~/.zfunc/_oak` for zsh, `~/.local/share/bash-completion/completions/oak` for bash, `~/.config/fish/completions/oak.fish` for fish. If your startup file is missing a line the shell needs to load it, such as zsh's `fpath` and `compinit`, Oak prints the line for you to add. It doesn't edit startup files. To print the script instead, give the shell name: `oak completions zsh`. `elvish` and `powershell` can be printed this way too. ### Teach your agent If you use a coding agent, install the bundled skill in each repo you work in: ```bash oak skill install # into ./.claude/skills/ — commit it oak skill install --global # or into ~/.claude/skills/ for every project ``` More in [Working with agents](/docs/agents). ### Uninstall Delete the binary (`~/.local/bin/oak`) and, if you want to drop your login and other local state too, `~/.config/oak/`. Repositories you've cloned are ordinary directories; each one's Oak metadata lives in its own `.oak/` folder. Next: [Quickstart](/docs/quickstart). ## Quickstart This page takes you from nothing to a change merged on `main`. It assumes you've [installed the CLI and signed in](/docs/install). ### 1. Get a repository Pick whichever matches where your code is now. **Start a new repo:** ```bash oak init my-app cd my-app ``` **Clone one that's already on Oak:** ```bash oak clone acme/web # or just `oak clone` to pick from a list cd web ``` **Bring a Git repo over:** ```bash oak clone https://github.com/acme/web.git # fetches with git, replays history into Oak cd web ``` …or run `oak init --import-git` inside an existing Git checkout. [Git import and export](/docs/git) covers the details. **Working against a huge repo?** `oak clone acme/web --shallow` leaves out the history, and `--path` checks out only the directories you need. See [Sparse clones](/docs/sparse-clones). Whichever way you came in, you're now on a **personal branch** — something like `zdgeier-3f2a8b` — parented onto `main`. You never work on `main` directly; see [Branches and descriptions](/docs/branches). ### 2. Start a task ```bash oak start "Add a dark-mode toggle to the settings page" ``` This creates a branch from the latest `main` named after the summary, sets the summary as its [description](/docs/branches#descriptions), and pushes it. In a repo you created with `oak init`, `oak start` skips the push until step 5 links it to the server. ### 3. Make a change and checkpoint it Edit some files, then: ```bash oak status # what changed oak diff # the changes themselves (full-screen viewer on a terminal) oak commit # save a checkpoint ``` `oak commit` takes no message, on purpose. Commit as often as you like — every checkpoint gets folded into one commit when the branch merges. ### 4. Describe the change `oak start` set the description to your summary. Refine it once you know what the branch really does: ```bash oak desc "Add a dark-mode toggle to the settings page, stored per account" ``` The **branch description** is the commit message for the whole branch. It becomes the message of the single commit that lands on `main` when you merge, so write it for someone reading `main`'s history later. ### 5. Publish the branch If you **cloned** the repo, publish your commits: ```bash oak push ``` If you **created** it with `oak init` (or imported from Git), the first push also creates the repo on oak.space, so Oak needs to know which organization owns it. On an interactive terminal, plain `oak push` asks you to pick one. In a script or an agent run, there's no terminal to ask, so name it: ```bash oak push --repo acme/my-app ``` `acme` must be an existing organization you can publish to — every account has a personal one named after its username. The repo itself is created if it doesn't exist. After this first link, plain `oak push` works. > **Agents:** never guess the owner. If you don't know which organization to publish into, ask. `OAK_REPO=acme/my-app` works in place of the flag. Your branch now shows up on the repo's **Branches** page at `https://oak.space/acme/my-app/branches`. Open it in a browser with `oak open`. ### 6. Merge it When the change is ready, merge it: ```bash oak merge # squash the branch onto main ``` If `main` has moved since you started, run `oak pull` first. Or click **Merge** on the branch's page in the web UI. Either way, `main` gains exactly one commit whose message is your branch description, and the branch is closed. If merging `main` in hits a conflict, [Merging and conflicts](/docs/merging) walks through it. ### 7. Start the next task ```bash oak start "Fix the login redirect" ``` That's the whole loop: **start → edit → commit → describe → merge**. ### Where next - [Coming from Git](/docs/coming-from-git) — command-by-command translation. - [Making changes](/docs/making-changes) — ignore files, hooks, undoing things. - [Working with agents](/docs/agents) — set up Claude Code, Codex, or Cursor to follow this loop on its own. - [Marks](/docs/marks) — record which commit on `main` your tests passed on, and deploy by following a mark. ## Coming from Git Oak will feel familiar — repos, branches, push, pull, diff — but a few of Git's defaults are deliberately turned around. This page is the translation table. ### What's different, in short - **No staging area.** `oak commit` snapshots the whole working tree (or just the paths you name). There's no `add`. - **No commit messages.** Commits are checkpoints. The *branch* carries the message, set with `oak desc`, and it becomes the message of the squash commit on `main`. - **No local `main`.** `main` lives on the server. Locally you're always on a feature branch; `oak switch main` is an error, not a checkout. - **One kind of merge.** Merging a branch onto `main` always squashes it to a single commit. There's no merge-commit or rebase option to choose between, and no pull-request object — the branch *is* the review unit. - **Pull merges, never rebases.** `oak pull` merges the latest `main` into your branch. History on your branch is never rewritten under you. - **Large files are normal files.** Content is chunked and deduplicated (FastCDC + BLAKE3), so there's no LFS to set up. ### Command mapping | Git | Oak | Notes | |---|---|---| | `git init` | `oak init` | `--import-git` brings over an existing `.git` history. | | `git clone ` | `oak clone /` | A Git URL works too — it's imported. | | `git clone --depth 1` | `oak clone --shallow` | | | `git sparse-checkout` | `oak clone --path `, `oak sparse` | See [Sparse clones](/docs/sparse-clones). | | `git worktree add` | `oak clone / --from ` | A second clone that reuses content the first one already downloaded. | | `git status` | `oak status` | `--short`/`--porcelain` are Git-compatible. | | `git diff` | `oak diff` | Opens a full-screen viewer on a terminal; `--print` for plain output. | | `git diff main...feature` | `oak diff feature` | Shows what the branch contributes. | | `git add -A && git commit -m …` | `oak commit` | `-m` is refused. Describe the branch with `oak desc`. | | `git commit --amend -m …` | `oak desc "…"` | Change what the branch says it does. | | `git push` | `oak push` | Publishes the current branch. Pushes to `main` are refused. | | `git pull` / `git pull --rebase` | `oak pull` | Always merges `main` into your branch. | | `git fetch` | `oak fetch` | Refreshes your copy of `main`. | | `git switch ` / `git checkout ` | `oak switch ` | Fetches the branch if you don't have it. | | `git switch -c ` | `oak switch -c []` | Name is optional; one is generated. To begin a task, use `oak start ""`, which also describes and pushes the branch ([Starting a task](/docs/agents#starting-a-task)). | | `git checkout ` | `oak switch -d ` | Detached HEAD. A unique prefix of 4+ characters works. | | `git branch` | `oak branch` / `oak branch list` | `--remote` reads the server. | | `git branch --show-current` | `oak branch --show-current` | | | `git branch -d ` | `oak close ` | Closed branches can be reopened from the web. | | `git merge` / "Squash and merge" | `oak merge` | Server-side squash onto `main`. | | `git rebase -i` | `oak split` | Reorder, drop, or split a branch's commits into separate branches. | | `git restore ` | `oak restore ` | `-s ` to restore from elsewhere. | | `git reset --hard` | `oak reset` | Discards uncommitted changes. | | `git log` | `oak log` | `-S` / `-G` pickaxe search work as in Git. | | `git rev-parse HEAD` | `oak hash` | | | `git archive` | `oak export --tree-only` | Writes one commit's files to a directory. | | `.gitignore` | `.oakignore` | Same syntax. Oak falls back to `.gitignore` when there's no `.oakignore`. | | `.git/hooks/pre-commit` | `.oak/hooks/pre-commit` | Local only, like Git. | | GitHub Actions | Your own CI, plus marks (`oak mark`) | Oak runs no checks. Your tests record what passed by moving a [mark](/docs/marks), and deploy machines follow one. | | `CODEOWNERS` | Path rules | Set per folder or file in the repo's **Settings → Access**: who owns, reads, writes and approves it. See [Path rules](/docs/path-permissions). | ### Things Git has that Oak doesn't (yet) - **Tags.** There's no tag object; refer to commits by hash. - **Issues, pull-request review threads, line comments.** Review happens on the branch page and in the CLI (`oak branch review`), not in comment threads. - **Submodules.** Imports skip them. - **Push to arbitrary remotes.** You push to an Oak server. To leave, `oak export` writes a complete Git repo you can push anywhere. - **Branch rename.** `oak branch rename` is temporarily disabled. ### Using Git tools with an Oak repo Oak doesn't serve repos to Git. When a tool needs a Git repository, `oak export` writes one, with the history, into a separate directory. See [Git import and export](/docs/git). > **Inside an Oak checkout, don't run `git`.** An Oak repo has a `.oak/` directory and no `.git`. ## Making changes The everyday loop: see what changed, checkpoint it, publish it, and stay in sync with `main`. ### See what changed ```bash oak status # modified, added, deleted files oak status --short # Git-compatible short format (same as --porcelain) oak status --json --compact # bounded, machine-readable — what agents should use ``` ```bash oak diff # working tree vs. your last checkpoint oak diff src/ README.md # only these paths oak diff --branch # everything on this branch (commits + uncommitted) vs. where it forked from main oak diff --stat # per-file +/- counts oak diff --name-only # just the paths oak diff --print # plain unified diff to stdout instead of the viewer oak diff --check # whitespace errors and leftover conflict markers; exits 1 if any ``` On a terminal, `oak diff` opens a full-screen viewer — a file tree beside the diff — that takes arrow keys, `less`/vi keys, and emacs keys. Press `?` inside it for every binding. Piped, or with `--print` / `--json`, it prints instead. Set `OAK_DIFF_TOOL` to use an external diff tool. `oak diff` can also compare branches and commits without checking anything out — see [Reviewing branches](/docs/reviewing#read-a-diff-without-switching). ### Checkpoint with oak commit ```bash oak commit # snapshot every change in the working tree oak commit src/parser/ # only changes under these paths oak commit --push # checkpoint, then publish the branch ``` There's no staging area and **no commit message** — `-m` is refused with a pointer to `oak desc`. Commits are checkpoints you can return to; what the branch *does* is written once, as its [description](/docs/branches#descriptions). Commit as often as is useful: they're all squashed into one commit on `main` at merge time. `oak commit` only writes to your local repo. Nothing leaves your machine until you push. ### Publish with oak push ```bash oak push ``` Pushes the current branch's new commits — and its description — to the server. Only the content chunks the server doesn't already have are uploaded, so re-pushing a large binary with a small change sends only the changed chunks. | Situation | What to do | |---|---| | First push of a repo made with `oak init` | `oak push --repo /` (or answer the prompt on a terminal). See [Quickstart](/docs/quickstart#5-publish-the-branch). | | Push was rejected because the remote branch moved | `oak pull`, then push again. | | You really mean to overwrite the remote branch | `oak push --force`. | | You want to see what would be sent first | `oak push --plan --json` (read-only). | Pushing to `main` is always refused — `main` only changes by [merging](/docs/merging). ### Stay in sync with oak pull ```bash oak pull ``` `oak pull` does two things: it fetches any new commits on **your** branch from the server (pushed from another machine, or by an agent), then merges the latest **`main`** into your branch. Conflicts surface here, on your branch, where you can take your time — see [Merging and conflicts](/docs/merging#resolving-conflicts). | Command | What it does | |---|---| | `oak pull` | Fetch your branch, then merge `main` into it. | | `oak pull --branch-only` | Fetch your branch only; skip merging `main`. | | `oak fetch` | Refresh your local copy of `main` without touching your branch or working tree. | | `oak pull --force` | Throw away local commits the server doesn't have and match the remote branch. | ### Undo things ```bash oak restore path/to/file # put a file back to your last checkpoint oak restore -s 3f9fab02 file # …or to how it was at another commit oak reset # discard every uncommitted change (asks first; -f to skip) oak reset src/ # …or just under a path ``` To go back to an earlier checkpoint as a starting point, `oak switch -d ` detaches HEAD there; `oak switch -c` from that state starts a new branch. To reshape a branch's commits — drop one, reorder them, or split them into separate branches — use `oak split` (Oak's answer to `git rebase -i`). ### Ignore files Put gitignore-syntax patterns in **`.oakignore`** at the repo root. If there's no `.oakignore`, Oak reads `.gitignore` instead — so an imported Git repo keeps working unchanged. (When both exist, only `.oakignore` counts.) Always ignored, whatever the files say: `.oak/` (except the tracked config files below), `.git/`, and OS clutter such as `.DS_Store`, `._*` AppleDouble files, `Thumbs.db`, and `desktop.ini`. ### Tracked files under .oak/ The `.oak/` directory holds your local repository database, which is never committed. One file inside it is an ordinary, versioned file: | Path | Purpose | |---|---| | `.oak/attributes` | Reserved for per-path attributes | ### Hooks Executable files at `.oak/hooks/` run at fixed points, like Git hooks: | Hook | When | On failure | |---|---|---| | `pre-commit` | Before `oak commit` writes anything | Aborts the commit | | `post-commit` | After a successful commit | Prints a warning | Hooks run from the repo root with `OAK_HOOK` set to the event name. They're **local only** — never pushed — so each person chooses what runs on their machine; files ending in `.sample` are ignored. Skip them for one commit with `oak commit --no-verify`. A typical Rust `pre-commit`: ```bash #!/bin/sh set -e cargo fmt --all cargo clippy --workspace -- -D warnings ``` ### Large files There's nothing to configure. Every file is split into content-defined chunks and stored once per organization, so large binaries, game assets, and datasets are just files: pushes and pulls move only the chunks that changed, and the same asset in two repos of one org is stored once. A single push can carry up to 25 GiB; see [Plans and limits](/docs/limits). ### Exit codes Every command uses the same exit codes, so scripts can branch without parsing output — for example `5` means "conflicts" and `3` means "repository locked, retry". The full table is in the [CLI reference](/docs/cli#exit-codes). ## Branches and descriptions In Oak the **branch** is the unit of work, not the commit. A branch is one task — usually one agent session or one change a person wants reviewed — and it ends by being squash-merged onto `main` or closed. ### How branches work - **`main` exists only on the server.** There's no local `main` to commit to, and the server refuses pushes to it. It only changes when a branch is [merged](/docs/merging). - **Every other branch is parented onto `main`.** Branches are flat: none is built on another open branch. New branches start from the latest `main`, and `oak pull` keeps them current by merging `main` in. To break a large branch into pieces that land separately, use [`oak split`](#reshape-a-branch-with-oak-split). - **You always have a branch.** `oak init` and `oak clone` create a personal one named `-<6 hex chars>` (for example `zdgeier-3f2a8b`), so two clones of the same repo never collide on push. Your username comes from your login, or `OAK_AUTHOR`, `USER`, or `USERNAME`. - **Branches are cheap.** Make one per task with `oak start`. The open-branch view on oak.space and `oak branch triage` exist precisely because a repo worked on by agents has a lot of them. ### Start a task ```bash oak start "Fix the login redirect" # branch named fix-the-login-redirect oak start "Fix the login redirect" --name login-fix # choose the name ``` `oak start` is the usual way to begin work. It creates a branch from `main` named after the summary (with `-2`, `-3` if that's taken), sets the summary as its [description](#descriptions), and pushes it. Run `oak pull` to merge in a newer `main`; if that conflicts, see [Merging and conflicts](/docs/merging). Uncommitted files come with you, as with `oak switch -c`; `--clean` discards them. `--no-push` skips the push. ### Create and switch ```bash oak switch -c # new branch off the latest main, generated name oak switch -c fix-login-redirect # …with a name oak switch -c --clean # …and drop uncommitted changes instead of carrying them over oak switch fix-login-redirect # switch to an existing branch (fetched from the server if needed) oak switch # pick from a list oak switch -d 3f9fab02 # detach HEAD at a commit (full hash or unique prefix) ``` Uncommitted edits come with you when you create a branch, the way `git checkout -b` works; pass `--clean` to start fresh instead. `oak switch main` is an error — there's no local `main` to switch to. ### Descriptions Commits carry no message. The **branch description** says what the whole branch does, and it becomes the commit message of the squash commit on `main` when the branch merges. ```bash oak desc "Retry flaky uploads with jittered backoff" oak desc --file description.md # from a file git log -1 --format=%B | oak desc --file - # …or from stdin oak desc --append "Also fixes #212." # add a paragraph to the existing description ``` `oak desc` saves locally and, if the branch has been pushed, updates the server too; otherwise the next `oak push` carries it. It can be changed any number of times until the branch merges. Write it for someone reading `main`'s history months from now: what changed and why, not a list of touched files. A first line that works as a title, then a blank line and detail, renders best. If a branch merges without a description, the squash commit's message falls back to the branch name. `--append` refuses, rather than overwrite, when your local copy of the description is out of date with the server's — it tells you the exact command to refresh with. That makes it safe for several agents to add notes to one branch. ### List and inspect ```bash oak branch # local branches oak branch --show-current # just the current branch's name oak branch list --remote # every branch on the server oak branch list --remote --status open oak branch show fix-login-redirect --remote oak status --json # repo, branch, parent, remote, and linked-repo details ``` Add `--json` to any of them for machine-readable output. To compare or review branches without switching to them, see [Reviewing branches](/docs/reviewing). ### Close and reopen ```bash oak close # close the current branch oak close old-experiment --remote --json # close a pushed branch without switching to it oak close old-experiment --reason "superseded by fix-login-redirect" ``` To close several pushed branches only if they haven't moved since you looked, pin each to its head: `oak close --remote --json A@FULL_HEAD B@FULL_HEAD --reason superseded`. The pin is read, then the branch is closed; the server's close has no expected-head condition, so a push in between isn't prevented. The CLI re-checks afterward and reports `closed_after_head_moved` if the head moved. Details in the [CLI reference](/docs/cli#oak-close). Merging closes a branch automatically. Close the ones you're abandoning so they drop off the open-branch view. Closing is idempotent and keeps everything — a closed branch can be **reopened** from its page on oak.space (or via the [API](/docs/api#branches)). ### Reshape a branch with oak split `oak split` is Oak's `git rebase -i`. It opens a todo list of the branch's commits where you can reorder them, drop some, or send groups of them to new, independent branches — useful when an agent did two unrelated things on one branch. ```bash oak split # interactive, on the current branch oak split --from big-branch # on another branch oak split --plan plan.txt # apply a plan non-interactively (or --plan - for stdin) oak split --dry-run # print the resulting structure without writing ``` `oak histedit` is an alias. ### Branch names Names can't contain whitespace, control characters, `/` or `\`, and `main` is reserved. `oak branch rename` exists but is **temporarily disabled** (the server returns 503) while a storage-integrity issue is fixed. To rename, create a new branch from the old one's work and close the old one. ### Limits A repo can hold up to 10,000 branches, open and closed. There's no cap on open branches during the beta — see [Plans and limits](/docs/limits). ## Merging and conflicts Merging is how work reaches `main`, and it's the only way. A merge takes a whole branch — every checkpoint on it — and lands it on `main` as **one squash commit** whose message is the [branch description](/docs/branches#descriptions). Merging is a human decision. Agents should push their branch and stop; a person reviews and merges. (Nothing enforces that — it's the workflow Oak is built around, and what the agent skill teaches.) ### The merge, step by step ```bash oak desc "Cache tile lookups in the renderer" # this becomes the commit message on main oak push # publish the branch oak pull # bring main's newer commits into your branch oak diff --branch # last look at everything the branch changes oak merge --dry-run --json # would it merge cleanly? (a prediction; changes nothing) oak merge # squash onto main and close the branch ``` What each step is for: - **`oak pull` first.** It merges the current `main` *into your branch*, so conflicts surface on your branch, where you can resolve them calmly — not halfway through landing on `main`. - **`oak merge --dry-run`** predicts the merge without pushing or touching files. It checks `main`'s head on the server first, so the prediction is certified against the `main` the merge would land on; `--offline` skips that and reports it uncertified. - **`oak merge`** asks the server to squash the branch onto its parent (`main`) and close it. Only the approvals a [path rule](/docs/path-permissions#approvals) asks for can hold it up. You can merge a branch you aren't on: `oak merge fix-login-redirect`. And you can merge from the browser — every branch's page on oak.space has a **Merge** button, and the branches list has **Merge selected** for landing several non-overlapping branches at once. The web merge checks for conflicts before you click. ### What lands on main One commit: - **Message:** the branch description (or the branch name, if it has none). - **Contents:** the branch's final tree, merged with `main`. - **Ancestry:** the squash commit keeps a pointer (`merge_parent_hash`) to the branch's last checkpoint, so the full pre-squash history stays reachable for tooling, even though `main` shows one line per task. A merge to `main` fires the `merge` [webhook](/docs/webhooks) event. ### Resolving conflicts A conflict can come up during `oak pull` (merging `main` into your branch) or during `oak merge`. Both work the same way. ```bash oak pull # CONFLICT in src/render/tiles.rs oak conflict status # what's in progress and how much is left oak conflict show # per-file details for every conflicted path $EDITOR src/render/tiles.rs # resolve by hand: remove the <<<<<<< ======= >>>>>>> markers oak conflict take src/render/tiles.rs --theirs # …or take one side of every block in a file oak pull --continue # finish oak pull --abort # …or back out; the branch is left as it was ``` During a merge, the same commands finish or cancel it: `oak merge --continue`, `oak merge --abort`. - **Markers are line-level.** Oak wraps only the diverging lines, not whole files. - **`--ours`** keeps your branch's side; **`--theirs`** keeps `main`'s (or the remote's). - **Every `oak conflict` command takes `--json`**, so handing resolution to an agent is a supported path. `oak diff --check` catches markers you forgot to remove. - While a conflict is in progress, commands that would change the branch exit with code `5`. #### When a pushed branch conflicts If an agent's branch has gone stale against `main`, you don't need to redo the work. A conflicting branch's page shows the conflicted files in place of **Merge**, and the conflict is resolved locally, on the branch, in one of two ways. **With a coding agent.** **Copy resolve prompt** copies instructions for a coding agent: get the branch (an existing clone, or a new shallow one), pull, resolve, check, and push. The agent stops there, so you still review and merge. **By hand.** Switch to the branch in a clone (a [shallow](/docs/sparse-clones#other-ways-to-clone-less) one is enough), pull, resolve, and push: ```bash oak clone acme/web --shallow cd web oak switch fix-auth oak pull # conflicts appear here # resolve, or hand the clone to an agent to resolve oak pull --continue oak commit && oak push ``` ### Tests and deploys Oak runs none of your code on the server, before or after a merge. Agents run the tests before they push. To record which commit on `main` your tests passed on, have the machine that runs them move a [mark](/docs/marks), such as `oak mark move server-good `. A deploy machine follows a mark with `oak mark follow`. ### Undoing a merge Open the commit on oak.space and click **Revert**: Oak lands a new commit on `main` that applies the inverse of that commit's changes, like `git revert`. If any file the commit touched has changed since, the revert is refused rather than guessed at. The API equivalent is `POST /api/{owner}/{name}/commits/{hash}/revert`. ### When a merge is refused | What you see | Meaning | What to do | |---|---|---| | Conflicts (409 with `conflict_paths`) | The branch and `main` changed the same lines. | `oak pull`, resolve, push, merge again. | | `main_moved` / `branch_moved` (409, retryable) | Someone landed on `main`, or pushed to the branch, during the merge. Nothing was merged. | Retry. | | "already closed" (400) | The branch was already merged or closed. | Nothing — check `oak branch show --remote`. | | "Repository isn't linked to an organization yet" | The repo has never been pushed. | `oak push --repo /` first. | ## Reviewing branches When agents do the work, review becomes the bottleneck: ten branches come back, and switching your checkout ten times to read them isn't an option. Everything on this page is **checkout-free** — it reads the server (or your local repo) and prints, without touching your working tree. ### Triage first ```bash oak branch triage --remote # every open branch, scored oak branch triage --remote --only mergeable # just the ones ready to land oak branch triage --remote --json # for an agent doing the triage ``` Each row carries: | Field | Values | |---|---| | Mergeability | `clean`, `conflicts` | | Contribution | `contributes`; or `empty` / `superseded_exact` for a branch that adds nothing `main` doesn't already have | | Recommended action | `validate_then_merge`, `resolve`, `close`, `rebuild`, `review`, `do_not_merge` | `--only mergeable | closable | ambiguous` sorts a fleet before you read a single diff: land the first bucket, close the second (agent runs that produced nothing new), and spend your attention on the third. `--analysis-depth` trades speed for depth, `--limit N` caps how many branches get the deep pass, and `--against ` compares against something other than `main`. ### Review one branch ```bash oak branch review fix-auth--a1b2c3d4 --remote --merge-preview ``` `oak branch review` gathers the evidence for one branch: what it changed, what it's based on, and — with `--merge-preview` — whether it would merge cleanly, plus a merge-safety verdict that flags a prediction which would destroy work already on `main`. Add `--json` for agents. ### Read a diff without switching ```bash oak diff fix-auth--a1b2c3d4 # full-screen viewer: what the branch contributes oak branch diff fix-auth--a1b2c3d4 --remote # summary of changed files oak branch diff fix-auth--a1b2c3d4 --remote --print # the patch, to stdout oak branch diff fix-auth--a1b2c3d4 --remote --json --hunks # the patch, as JSON oak diff 3f9fab02 8fcf5aed # any two commits ``` Branch diffs come in three modes, chosen with `--diff-mode` (`oak branch diff`) or `--mode` (`oak diff`): | Mode | Answers | |---|---| | `contribution` | What did this branch add since it forked from `main`? The honest "what did the agent do". | | `tree` | How do the two heads differ right now? (Default for `oak branch diff`.) | | `net-merge` | What would `main` gain if this branch merged now? | For large branches, `--changed-files-limit` / `--changed-files-offset` page through the file list and `--max-bytes` caps the patch text in JSON output. ### The full-screen viewers `oak diff` and `oak log` open full-screen on a terminal. Both take the keys you already know: | Style | Keys | |---|---| | Arrows | ↑ ↓, PgUp / PgDn, Home / End | | less / vi | `j` `k`, Space (page down), `b` (page up), `d` / `u` (half page), `g` / `G`, `/` to search | | emacs | `^N` / `^P`, `^V` / `M-v`, `M-<` / `M->`, `^S` to search, `^G` to cancel | In `oak diff`, Tab or the arrow keys move between the file tree and the diff pane, and Space folds a directory in the tree. Press `?` in either viewer for the complete list. Pipe the output, or pass `--print` / `--json`, to skip the viewer. ### In the browser The repo's **Branches** page on oak.space lists every open branch: its title, who pushed last, and when. Each branch opens a detail page with: - the full diff, file by file; - a **Seen by** list — opening a branch page records that you've read it; - **Merge**, **Update** (merge the latest `main` into the branch), and **Close** / **Reopen** buttons. When a merge would conflict, the page lists the conflicted files and copies a prompt for resolving them locally ([Merging and conflicts](/docs/merging#when-a-pushed-branch-conflicts)). Check several branches on the list and **Merge selected** lands them one after another — usually how a fan-out ends when the branches don't overlap. ### Then land it ```bash oak switch fix-auth--a1b2c3d4 # fetches it if needed oak merge # squash onto main ``` See [Merging and conflicts](/docs/merging). ## History and inspection ### The log ```bash oak log # full-screen viewer on a terminal: commit list + detail pane oak log -n 20 --oneline # the last 20, one per line oak log --verbose # include each commit's changed files oak log src/parser/ # only commits touching these paths oak log --json # machine-readable ``` On your branch, the log shows your checkpoints. On `main` — `oak log` after `oak switch -d` to a main commit, or the repo's history on oak.space — it's one squash commit per merged branch, each carrying that branch's description as its message. The viewer takes arrows, `less`/vi, and emacs keys; press `?` for the list. See [the full-screen viewers](/docs/reviewing#the-full-screen-viewers). #### Search history ```bash oak log -S parse_header # commits that add or remove the literal string (like git log -S) oak log -G 'fn parse_\w+' # commits with an added/removed line matching a regex (like git log -G) ``` #### Read a remote branch's history without fetching it ```bash oak log --remote --json --branch fix-auth--a1b2c3d4 -n 50 ``` A bounded, read-only walk of the branch's history on the server. Each row is hash-verified; when the list is truncated, the output says so and gives a `--from ` to continue from. Requires `--json`. ### Where am I? ```bash oak hash # current HEAD commit oak branch --show-current # current branch name oak status --json # repo, branch, parent, remote, and linked-repo details oak open # open this repo on oak.space (--print to just print the URL) ``` ### Inspect files and trees at a commit These read committed content without changing your working tree — useful for agents that need one file from another commit without a checkout. ```bash oak doctor file src/main.rs --at # one file at a commit oak doctor file src/main.rs --at HEAD --output /tmp/main.rs oak doctor file src/main.rs --at --remote # from the server, no clone needed oak doctor tree --at HEAD --max-files 500 --json # a commit's whole tree, bounded oak doctor refs --json # every local branch and its head ``` `oak doctor file` caps output at 16 MiB by default (`--max-bytes` to change it). All three take `--json`. ### Browse files at any commit `oak switch -d ` puts your working tree at an old commit with a detached HEAD. On oak.space, every commit page has **Browse files at this commit**, and the API serves trees and raw files by commit — `GET /api/{owner}/{name}/tree/{commit}` and `/raw/{commit}/{path}`; see [the API reference](/docs/api#commits-and-content). ### Save uncommitted work without committing ```bash oak change capture --json # snapshot uncommitted changes as immutable objects oak change capture src/ --json # …or only part of them oak change export --output work.zip ``` `oak change capture` stores your current uncommitted changes durably — like a stash that doesn't touch the working tree or move any branch — and prints a capture id. `oak change export` writes one capture out as a self-contained zip (a manifest plus the changed files) you can hand to someone else. ## Working with agents Oak doesn't run agents — you bring your own: Claude Code, Codex, Cursor, Aider, a script of your own. What Oak gives them is a version-control model that fits how they work, and a CLI built to be driven by a program as well as a person. ### The model - **One branch per session.** Begin each agent run with `oak start ""`. A session you don't like gets closed, and `main` never notices. - **The agent writes the description.** Commits carry no message, so the agent's summary of what it did goes in `oak desc` — and becomes the commit message on `main`. - **The agent publishes; a person merges.** The agent ends with `oak finish`, which leaves its branch pushed. You [review](/docs/reviewing) and [merge](/docs/merging). - **A clone per agent.** For many agents at once, give each agent its own clone; `--shallow` keeps each one small. See [Example: a fleet of agents](/docs/example-session). ### Install the agent skill ```bash oak skill install # writes .claude/skills/oak-vcs/ — commit it oak skill install --global # or ~/.claude/ for every project on this machine ``` The `oak-vcs` skill is a `SKILL.md` plus reference files in the open Agent Skills format. It teaches an agent to recognize an Oak repo (a `.oak/` directory and no `.git`), to use `oak` instead of `git`, and the whole workflow on this site — including the traps, like interactive commands that hang without a terminal. Committed to the repo, every collaborator's agent picks it up. The files are baked into the CLI binary, so the skill always matches the CLI version that wrote it. After `oak upgrade`, the installed copy describes the old version: `oak skill status` says whether each copy is `current` or `stale`, and `oak upgrade` prints the install command to run. ```bash oak skill status --json # each copy (this repo, user-wide) and whether it matches this CLI oak skill show # print SKILL.md to stdout; `oak skill show commands.md` for a reference file ``` For agents that read `AGENTS.md` rather than skills (Codex, Cursor, and others), `oak init` offers to write an `AGENTS.md` explaining Oak, plus a one-line `CLAUDE.md` that points at it. An agent without skill support can also run `oak skill show` to read the guide that matches the installed CLI. ### Rules to give an agent If you'd rather put it in your own prompt or `AGENTS.md`, this is the core: ```text This repo uses Oak (the `oak` CLI), not git. Never run git commands here. - Begin every task with `oak start ""`: a branch from the latest main, described and pushed. - main lives on the server; never try to push to it. - `oak commit` takes no message. Describe the branch once with `oak desc "..."`; it becomes the commit message on main, so write it for a reviewer. - Finish every task with `oak finish --desc-file --json`. - If `oak pull` reports a conflict, resolving it is your next action: `oak conflict status`, edit the listed files, `oak pull --continue`. - Do not run `oak merge`. A human merges. - Prefer --json output. Commands that open a UI or prompt (bare `oak diff`, `oak switch` with no name, `oak clone` with no repo, `oak split` without --plan) hang without a terminal — use `oak diff --print`/`--stat`/`--json` and pass names. - `oak reset` / `oak restore` ask for confirmation; pass -f only after `oak status` shows what you'd discard. - First push of a brand-new repo: `oak push --repo /`. Never guess the org — ask if you don't know it. - Lost? Run `oak agent state --json --compact`. ``` ### Starting a task `oak start` is how a task begins: ```bash oak start "fix the auth redirect" # or --name BRANCH to choose the branch name ``` It creates a branch from `main`'s head, named after the summary, carries over any uncommitted files, sets the summary as the branch description, and pushes the branch. In a brand-new repo it skips the push until the [first push](/docs/quickstart#5-publish-the-branch) links it. To pick up changes on `main` while you work, run `oak pull`. Push commits with `oak push`, or `oak commit --push`. ### Machine-readable everything Every command an agent needs takes `--json`, and the results are designed to be acted on: | Command | Use | |---|---| | `oak start "" --json` | Begin a task. The receipt names the branch and whether the push went through (`pushed`, `push_error`). | | `oak agent state --json --compact` | One document: repo, branch, what's dirty, what's unpushed, and `recommended_next_commands`. The "where am I and what now?" call. | | `oak status --json --compact` | Bounded working-tree status. | | `oak diff --json --hunks --max-bytes N` | The diff, with a byte budget. | | `oak commit --json`, `oak push --json`, `oak pull --json` | Receipts with what happened and what to do next. | | `oak finish --desc-file --json` | Describe, checkpoint, and publish in one step — see below. | | `oak conflict status`, `oak conflict show --json` | Conflict state, file by file. | | `oak mark list --json` | Every [mark](/docs/marks), such as `server-good`, and how far behind `main` it is. | | `oak ls`, `oak cat`, `oak grep` with `--remote` | Read a path on the server without cloning it: [Reading a repository without a clone](/docs/remote-inspection). | | `oak branch triage --remote --json` | Score every open branch, for an agent doing review. | Many JSON payloads include `recommended_next_commands`: exact invocations for the natural next step. An agent should run one of those rather than improvise flags. Exit codes are stable and meaningful — `3` repository locked (retry), `4` dirty working tree, `5` conflicts, `6` network/server/auth — so a wrapper can branch without parsing text. The table is in the [CLI reference](/docs/cli#exit-codes). ### Finishing a task in one command ```bash oak finish --desc-file /tmp/desc.md --json ``` `oak finish` checks it can publish (is a remote linked? is anything blocking?) **before** changing anything else, then sets the branch description, checkpoints uncommitted changes, and pushes. If the preflight refuses, nothing has changed. If a later step is rejected, the JSON names the phase that completed and, where there is one, the command to run next. #### Unconfirmed publications Sometimes the push request was sent but the reply never arrived (a timeout, a dropped connection), so neither the client nor you can tell whether it landed. `oak finish` and `oak push` report this as an unconfirmed publication (exit 6, `publication_unconfirmed`), and they give no command to retry. That is deliberate: a second push on a guess can duplicate or overwrite work. Reconcile read-only first. ```bash oak agent state --refresh --json --compact # re-reads the server; shows interrupted publications oak branch show BRANCH --remote --json # the head the server holds ``` Compare the heads. If the server holds your commit, the publication landed. If it holds the old head, it did not land (at that moment), and you can decide to push again. Seeing a head is evidence, not proof of who pushed it, so check the commit is yours. Exit 6 with `publication_unconfirmed` is the signal. The local record of the interrupted operation stays, and blocks further push and finish advice, until you explicitly forget it: checking the server (read-only) never removes it. `oak agent publication forget OPERATION_ID --acknowledge-unknown --json` removes that one record, without contacting the server, once you have decided to accept that its outcome stays unknown. The CLI refuses it unless both `--acknowledge-unknown` and `--json` are given. ### Keeping a branch mergeable A pushed branch goes stale while other branches land on `main`. An agent that should keep its branch ready until someone merges it can wait on it instead of stopping: ```bash oak branch wait --json ``` It holds until the branch is merged or closed, or until `main` moves and the branch no longer merges cleanly. On a conflict (exit 5, `"event": "conflicts"`) its `recommended_next_commands` are the fix: `oak pull`, resolve the files it names, `oak pull --continue`, test, `oak push`, then `oak branch wait` again. A clean move of `main` needs nothing, since the server's squash merge doesn't need the branch up to date; pass `--on-main-move` to hear about those too and re-test. An agent whose commands have a time limit can pass `--timeout SECONDS` and call it again on `"event": "timeout"`, or run it in the background. ### Other ways to work - [MCP server](/docs/mcp) when your agent connects to a URL instead of running commands. - [Roots](/docs/roots) for release lines. ### Credentials for unattended agents `oak login` needs a browser once. An agent on a server, in CI, or in a container should use an API key instead: ```bash export OAK_API_KEY=oak_... ``` For an agent, prefer a key that can do no more than its job. A [key for an agent](/docs/api-keys#keys-for-agents) works in one organization, reads and writes as a member of the groups you choose, and can push but never merge. An [organization agent](/docs/api-keys#organization-agents) with only `read` and `write` scopes gives the agent its own name. See [API keys and tokens](/docs/api-keys). ### Running many agents at once Give each agent its own branch *and* its own working tree, so they can't step on each other. A shallow clone per agent keeps that cheap, and `--from` reuses content another clone already downloaded: ```bash oak clone acme/web ./fix-login --shallow oak clone acme/web ./add-search --shallow --from ./fix-login claude -p "Work in ./fix-login. Start with: oak start 'fix login' ..." & claude -p "Work in ./add-search. Start with: oak start 'add search' ..." & wait oak branch triage --remote ``` The [example session](/docs/example-session) walks through this end to end. ### Feedback from agents Agents hit rough edges first. `oak feedback` files a bug or feature request from the terminal and returns a tracking reference (`fb-N`): ```bash oak feedback -m "oak pull --json omits parent_head_after on fast-forward" --json ``` Without `-m` or `--file` it opens your editor on a terminal, and exits with an error (rather than hanging) when there's no terminal. ### Privacy Oak makes no AI calls on your behalf and doesn't train on your code. Whatever agent you use is its own integration, with its own data policy. ## MCP server Oak runs a [Model Context Protocol](https://modelcontextprotocol.io) server at `https://oak.space/mcp` for clients that connect to a URL, like Claude's connectors. Agents that can run shell commands usually do better with the CLI and the bundled skill (`oak skill install`; see [Working with agents](/docs/agents)). ### Endpoint The endpoint is `https://oak.space/mcp`. It uses the Streamable HTTP transport and answers each request with one JSON response; there are no sessions or server-sent streams. #### Connecting In Claude (claude.ai or the desktop app), open Settings → Connectors, choose "Add custom connector" and enter the URL. In Claude Code: ```bash claude mcp add --transport http oak-space https://oak.space/mcp ``` then run `/mcp` in Claude Code to sign in. Other clients that support remote servers with OAuth take the same URL. #### Signing in The first time a client connects, it opens an Oak page that asks whether to allow it. After you click Allow, it can read what your account can read. The page also has an "Allow changes" box, off by default. Off, the client can't change anything. On, it can also do what your account can do with the tools listed under [Changes](#changes): set branch descriptions, file reports, create and move marks, and, where you're an admin, edit path rules and groups. It can't push files, merge or delete repositories. Allowing a client adds an API key named after it to Settings → API keys: "Claude (connector)" for reading, "Claude (connector, can change)" with changes allowed. To disconnect the client, or to take changes away, remove that key and connect again. A client that can't do OAuth can send any Oak API key or `oak login` token instead, as an `Authorization: Bearer` header. A read-only key gets the reading tools only. Every tool calls the Oak API with that key, so groups, path rules, hidden branches and private repositories apply exactly as they do for the CLI. Folders you can't read are left out of every answer, names included, and so are commits that changed them. #### Tools Repositories are written `owner/name`. Where a tool takes `ref`, it is a branch name or a full commit hash, and defaults to `main`. Long answers are cut short with a note saying how to ask for the rest. Repositories and files: - `oak_whoami`: the account the connection acts as - `oak_repo_list`: repositories you can read - `oak_repo_show`: one repository's description, visibility and `main` head - `oak_ls`: the files and folders in a folder - `oak_cat`: a file's contents, in line ranges for long files - `oak_grep`: code search over `main`, text or regular expression Branches and history: - `oak_branch_list`: open branches with their descriptions - `oak_branch_show`: one branch with its full description - `oak_diff`: what a branch changes, with patches, a page of files at a time - `oak_merge_preview`: whether a branch would merge cleanly now, and what blocks it - `oak_approvals`: approvals a branch needs from path rule owners, and who has given them - `oak_log`: a branch's history, newest first - `oak_commit_show`: one commit, its changed files and the reports filed against it Marks and roots: - `oak_mark_list`, `oak_mark_show` and `oak_mark_log`: the repository's [marks](/docs/marks) and their moves - `oak_root_list` and `oak_root_show`: the repository's [roots](/docs/roots) Access: - `oak_repo_access`: groups and people with access to a repository - `oak_path_rules`: a repository's [path rules](/docs/path-permissions), or the one that governs a given path - `oak_org_list`: organizations you belong to - `oak_org_show`: one organization and its members - `oak_group_list`: an organization's groups and their members Pages: - `oak_site_list`: [Pages](/docs/pages) sites of a repository or an organization - `oak_site_show`: one site with its recent deployments and each custom domain's DNS status #### Changes Only on connections allowed to make changes. Each one is checked by the API as the same request from the CLI would be. - `oak_branch_describe`: replace an open branch's description - `oak_report_file`: file a report against a commit - `oak_mark_create` and `oak_mark_move`: create a mark, move it forward - `oak_path_rule_create`, `oak_path_rule_update` and `oak_path_rule_delete`: edit path rules (admins) - `oak_group_create`: create a group (admins) - `oak_group_member_add` and `oak_group_member_remove`: change a group's members - `oak_group_repo_grant` and `oak_group_repo_revoke`: give a group access to a repository, or take it away (admins) ## Example: a fleet of agents This is the end-to-end shape the rest of the docs assume: one large repo, several agents working on it at once — each in its own clone, on its own branch — and one person reviewing and merging what comes back. ### The shape of it Five lines, before any commands: 1. **A branch is a task** — one unit of work, usually one agent session. 2. **Each task gets its own clone.** A shallow clone downloads only the newest commit, and `--from` reuses content another checkout on the same machine already has, so N tasks don't mean N full downloads. 3. **Commits are checkpoints; the branch description is the message.** 4. **Publishing isn't merging.** Each agent pushes its branch and stops. Nothing reaches `main` until a person merges it. 5. **Merging squashes.** `main` gets one commit per task, however many checkpoints the agent made. If you're coming from Git: a clone per task does what worktrees do; the branch description does what a PR title and body do, minus the PR; and the squash merge is what "Squash and merge" does, except it's the only merge there is. ### 1. Set up ```bash curl -fsSL https://oak.space/install | sh oak login oak repo list --org acme # which repos can you clone? # acme/monorepo # acme/infra # acme/docs mkdir acme && cd acme # any directory works ``` ### 2. Fan out One task = one directory = one clone = one branch. Tasks are isolated by construction: separate directories, separate working trees, separate branches, and none of them can touch `main`. ```bash oak clone acme/monorepo ./fix-auth-redirect --shallow oak clone acme/monorepo ./add-search-index --shallow --from ./fix-auth-redirect oak clone acme/monorepo ./bump-tokio --shallow --from ./fix-auth-redirect ``` `--shallow` leaves out the history, and `--from` copies file content from the first clone instead of downloading it again. If a task only needs part of the monorepo, add `--path` to make a [sparse clone](/docs/sparse-clones) of just those directories. Now launch one agent per task. Each starts its own branch with `oak start`, so the branch name reads as the work. With Claude Code: ```bash claude -p "Work in ./fix-auth-redirect. Start with: oak start 'fix auth redirect'. The OAuth callback drops the ?next= param. Fix it, then finalize with oak finish." & claude -p "Work in ./add-search-index. Start with: oak start 'add search index'. Add a trigram index behind the search-index flag. Finalize with oak finish." & claude -p "Work in ./bump-tokio. Start with: oak start 'bump tokio'. Bump tokio to 1.42 across the workspace and fix the fallout. Finalize with oak finish." & wait ``` A cross-repo task gets one clone per repo — clone `acme/monorepo` and `acme/infra` side by side under `./unify-errors/` and start the same task name in each. ### 3. Each agent finishes its own branch Each agent ends with: ```bash cd ./fix-auth-redirect oak finish --desc-file /tmp/desc.md --json ``` One command that checks it can publish, sets the branch description from the file, checkpoints anything uncommitted, and pushes. If a step fails, nothing is lost and the JSON names the next command. Pushed branches appear live on the repo's **Branches** page, and `oak branch triage --remote` lists them from anywhere. ### 4. Review what came back Three branches, and you don't want to switch your working tree three times. Start with triage: ```bash oak branch triage --remote # every open branch, scored oak branch triage --remote --only mergeable oak branch triage --remote --only ambiguous ``` Then read the ones that need you: ```bash oak branch review fix-auth-redirect --remote --merge-preview oak diff fix-auth-redirect # full-screen, no checkout oak branch diff add-search-index --remote --diff-mode net-merge ``` Or do it in the browser: the **Branches** page lists every open branch, and each one opens to its diff with a **Merge** button. [Reviewing branches](/docs/reviewing) has the details. ### 5. Land them Merging is a decision, so it happens from somewhere you control — the web UI or your own checkout: ```bash # In a clone of the repo (a shallow or sparse one is fine) oak switch fix-auth-redirect oak merge # squash onto main ``` Or check off the clean branches on the **Branches** page and click **Merge selected**. **When a branch conflicts**, don't re-run the agent from scratch — go back to the task's clone, still on that branch, and fix it in place: ```bash cd ./fix-auth-redirect oak pull # merge the new main in; conflicts surface here # resolve, or hand this clone to an agent oak pull --continue oak commit && oak push ``` If the clone is gone, make a new one with `oak clone acme/monorepo --shallow` and `oak switch fix-auth-redirect`. That's also how a follow-up prompt keeps working on a branch an agent already pushed. ### 6. Clean up A task's clone is an ordinary directory. Once its branch is merged or closed, check nothing is left unpushed and delete it: ```bash cd ./bump-tokio && oak agent state --json --compact # dirty and unpushed work, if any cd .. && rm -rf ./bump-tokio ``` ### All of it at once ```bash # once per machine curl -fsSL https://oak.space/install | sh && oak login # fan out oak clone acme/monorepo ./fix-auth-redirect --shallow oak clone acme/monorepo ./add-search-index --shallow --from ./fix-auth-redirect claude -p "Work in ./fix-auth-redirect. Start with: oak start 'fix auth redirect' …" & claude -p "Work in ./add-search-index. Start with: oak start 'add search index' …" & wait # review, checkout-free oak branch triage --remote --json oak branch review --remote --merge-preview # land oak switch && oak merge # or Merge in the web UI # delete clones whose branches have landed rm -rf ./fix-auth-redirect ./add-search-index ``` Scaling up is more of the same: more task directories, more clones, more agents. The limit worth knowing is your own review throughput, which is what `oak branch triage` exists to protect. ## Sparse clones A **sparse clone** checks out only part of a repository — Perforce-style. Pass one or more directories, and only those come down: ```bash oak clone acme/monorepo --path services/api --path libs/shared # or: --path services/api,libs/shared ``` ### How it behaves - **Other directories aren't there at all.** The server sends each commit rebuilt over just those directories (a *view*), so the rest are left out of the tree, not only out of your disk. `AGENTS.md` and `CLAUDE.md` in the directories on the way down are kept. - **Your commits leave the rest alone.** When you push, the server puts your changes back into the full tree; everything outside your directories stays as it was. - **Everything else is normal.** Commit, push, pull, and merge work exactly as in a full clone. ### Change the directories ```bash oak sparse # show the directories you have (--json for machines) oak sparse add docs/ # add one oak sparse remove docs/ # drop one oak sparse set services/web # exactly these ``` A change fetches the checkout again for the new set of directories, so it needs a clean working tree and nothing unpushed: commit and push first. `oak sparse disable` is refused; clone again without `--path` for a full checkout. ### Sparse clones and path rules Sparse clones and [path rules](/docs/path-permissions) share a mechanism: a directory you can't read is left out of your tree the same way. The difference is who decides — a sparse clone is a choice you make; path rules are access control set by the repo's admins. ### Other ways to clone less | Flag | Effect | |---|---| | `oak clone --shallow` | Only the newest commit on `main` (or on `--branch NAME`), no history. | | `oak clone --from ../other-checkout` | Reuse content already in another local checkout of the same repo instead of downloading it again. | | `oak clone --detached` | Check out `main`'s head without creating a personal branch — for read-only tooling. | ### Recovery switch If a server is ever in a broken state and a normal clone or pull fails on a missing file, `OAK_ALLOW_PARTIAL_CLONE=1` skips each missing file (and reports it) instead of failing. It's for recovery only — use `--path` when you want part of a repo on purpose. ## Reading a repository without a clone `oak ls`, `oak cat` and `oak grep` read a repository on the server. They don't change your branch, your refs or your files, so they work from any directory that is linked to the repository, including a [sparse clone](/docs/sparse-clones) that doesn't hold the path you want. All three need `--remote`; there is no local `oak ls`. The server filters what it returns by what you can read. A path you can't read is absent, as if it didn't exist. ```bash oak ls --remote # the repository root on main oak ls --remote src/api --rev my-branch --json oak cat --remote src/api/mod.rs --rev my-branch oak grep --remote "verify_token" --json -- src/auth oak grep --remote -E "fn (read|write)_" --case-sensitive ``` ### ls `oak ls --remote [PATH] [--rev BRANCH_OR_HASH] [--max-entries N] [--json]` lists one directory. `--rev` takes a branch name or a full 64-character commit hash (an abbreviated hash is refused, since it can't be resolved unambiguously on the server). `--max-entries` defaults to 1000; the JSON says `truncated` when it stopped early. ### cat `oak cat --remote PATH [--rev BRANCH_OR_HASH] [--max-bytes N] [--json]` prints one file, checked against the commit's recorded content hash. A file larger than `--max-bytes` (default 16 MiB) is reported, not printed. ### grep `oak grep --remote PATTERN [-E] [--case-sensitive] [--max-files N] [--json] [-- PATH...]` searches the server's copy of `main`. It is case-insensitive unless you pass `--case-sensitive`, and `-E` reads the pattern as a regular expression. Paths after `--` limit the search to those prefixes. It stops after `--max-files` matching files (default 100) and exits 1 when nothing matches. ### What is verified `oak cat --remote` verifies the bytes it prints. `ls` and `grep` results are redacted by the server rather than proved, so their JSON says `"verified": false`. Treat a listing or a search hit as a pointer, and `cat` the file when the content matters. To compare two commits without checking them out, see [`oak diff --remote`](/docs/cli#oak-diff). See the [CLI reference](/docs/cli#oak-ls-cat-grep) for every flag. ## Retention A **retention rule** keeps only the newest versions of the files under a directory. Older versions keep their commits and history, but Oak stops serving their content and reclaims the storage. It's for directories whose history you don't need byte for byte: build artifacts, exported datasets, rendered assets, large binaries that change often. ```bash oak retention set build/artifacts --keep 3 # the newest 3 versions of each file oak retention # list rules and what they've expired oak retention remove build/artifacts ``` ### What counts as a version A version is a distinct content of a file on `main`. Walking `main` from the newest commit back, the first N distinct contents of each path keep their bytes and older ones expire. A file reverted to an old content counts that content as new again, so it's kept. The deepest matching rule wins: `assets/` can keep 5 versions while `assets/raw/` keeps 1. A rule for `/` covers the whole repository. Commits on branches don't count as versions, but their content under a rule expires too once it's old and no longer in use, so editing a file 30 times on a branch doesn't keep 30 copies. ### What is always kept - **Everything an open branch points at.** The current tree of `main` and of every open branch is complete. A closed branch's old content can expire like any other history. - **Content a file outside the rule uses.** Oak stores content once per organization, so if the same bytes are also in a directory without a rule, they stay. - **Recent content.** A version newer than 24 hours keeps its bytes even if it's past the limit. ### What happens to an expired version - **History is untouched.** Commits, trees and hashes stay exactly as they were, so `oak log`, blame, and every hash check work as before. Only the bytes of the old version go. - **Clone and pull skip it.** They report the versions they skipped (`N historical file version(s) are no longer stored on the server`), and checking out an old commit leaves those files out. `oak clone --shallow` never needs them. - **The web and raw API say so.** Opening an expired version shows that it expired; `GET /api/:owner/:name/raw/:commit/*path` answers `410 Gone`. - **Storage is reclaimed after 7 days.** Until then, removing or loosening the rule brings the versions back. After that, the bytes are gone for good. Older Oak CLIs can't skip expired versions, so a full clone or a pull that needs them fails with a message asking you to upgrade (or to clone `--shallow`). ### Managing rules Organization owners and admins change rules, from the repository's **Settings → Retention** or the CLI. Every change is in the organization's audit log, with the rule before and after. Anyone who can read the repository can list the rules. ```bash oak retention --json # rules, expired counts and bytes, can_edit oak retention set / --keep 100 --repo acme/data ``` Rules take effect on the next retention run, which a change queues right away; repositories are also rechecked daily. The same operations are on the [HTTP API](/docs/api): `GET`, `PUT` (`{"path", "keep_versions"}`) and `DELETE ?path=` on `/api/:owner/:name/retention`, and `POST /api/:owner/:name/retention/run` queues a run. ## Roots A root is a separate timeline inside one repository, with its own history and head. It has no branches. A root starts empty, or at a commit on `main`, which is how you keep a release line that takes patches apart from `main`. ### Who can do what - Everyone who can read the repository can read a root. - A root's owner group and the organization's owners and admins can push to it. A root with no owner group is writable only by owners and admins. - Owners and admins create roots; a group's maintainers can create roots that group owns. Maintainers of the owner group, and owners and admins, archive them. - A root that started from `main` holds that commit's whole tree, including folders that [path rules](/docs/path-permissions) hide. Reading or starting one therefore takes being able to read every path of the repository. Someone who can't sees the root's metadata only and gets a 403 on pull. ### Create and list ```bash oak root create notes # an empty root oak root create stable --from main --owner-group release # start at main's head oak root create hotfix --from FULL_64_CHAR_HASH # start at an older commit on main oak root create scratch --sync # a sync root instead of a direct one oak root list [--archived] --json oak root show stable --json ``` `--from` takes `main` or a full 64-character hash on `main`'s first-parent history; the server refuses anything else. `--owner-group GROUP` names the group that writes the root. Every `oak root` command takes `--repo OWNER/NAME` (default: the checkout's repository), `-r, --remote URL` and `--json`. ### Pull and push ```bash oak root pull stable # its files go to roots/stable/ # edit roots/stable/... oak root push stable # one commit on the root ``` The checkout ignores every directory a root was pulled into, so `roots/NAME/` is never committed to `main`. Inside a root directory, `pull` and `push` need no name; elsewhere they do. `--dir PATH` chooses a different directory. `pull` merges per file. Files you didn't touch take the root's version, files only you changed are kept, and a file changed on both sides refuses the whole pull with exit 5 until you move your copy aside or pass `--force` to take the root's. `push` sends only content the root doesn't already have. If the root moved since your last pull it exits 5: run `oak root pull`, then push again. A directory that was never pulled can't push to a root that already has commits. ### Archive ```bash oak root archive stable --yes ``` An archived root's history stays readable and it takes no more pushes. `oak root list --archived` includes it. See the [CLI reference](/docs/cli#oak-root) for every flag. ## Marks A mark is a named pointer to a commit on `main`. People and bots move marks to record what has passed what: `server-good` for the newest commit the server tests passed on, `cli-approved` for the release someone signed off, `server-prod` for what is deployed. We suggest naming them `-`. A deploy is a mark that a machine follows: when the mark moves, the machine checks out the commit and runs your deploy script. Oak runs none of your code for this. The tests, the approvals and the deploys run where you run them, and a mark is how they hand a commit to each other. ### Who can do what - Everyone who can read the repository can list marks, read their history and wait on their moves, read-only API keys included. - A mark's **followers** are organization agents listed on it (`--follower NAME`); only the repository's writers and admins see who they are. Only followers get a move's signed grant, and they can file the report named after the mark on its moves with a read-only key (never replacing a report someone else filed). Following never lets them move the mark. - A mark's owner group moves it forward (agents on the group count). A mark with no owner group can be moved by anyone who can write the repository. An API key needs the `write` scope to move one. - Moving a mark back is a rollback. That takes an organization owner or admin, or the owner group too when the mark was created with `--allow-group-rollback`. - A mark with required approvers, or one whose grants carry a fixed identity (see [Signed moves](#signed-moves)), is **protected**: moving it is a release step. A person signed in as themselves may (if the rules above let them), an API key must carry the explicit `release` scope, and an agent's key never may. - A mark with required approvers moves only when one of them moves it, acting as themselves under those same checks (not an organization agent or an agent's key). The move records them. - Owners and admins create, change and delete marks, in the repository's **Settings → Marks** or over the API. A change can name the `expected_policy_version` it was made against, and is refused when the mark changed since. ### Create, move, roll back ```bash oak mark create server-good oak mark create server-prod --owner-group deploy --requires server-good oak mark move server-good main # main's head oak mark move server-prod 3f2a8b1c --note "ship the new pull path" oak mark rollback server-prod 1d9e0c77 # an earlier commit oak mark list oak mark show server-prod oak mark log server-prod ``` A mark starts at `main`'s head unless you pass `--commit`, and not ahead of the marks it requires. Creating a mark deploys nothing: its first move carries no grant and followers skip it. Commits are `main`, a full hash, or a unique prefix of at least seven characters. Every `oak mark` command takes `--repo OWNER/NAME` (default: the checkout's repository), `-r, --remote URL` and `--json`. The rules a move has to pass: - **Forward only.** `move` goes to the mark's commit or a later one on `main`'s first-parent history. A commit that isn't on `main` (a branch commit) is refused. Moving to the commit the mark is already at is allowed, which is how you run a deploy again. - **Requirements.** A mark created with `--requires a,b` moves to a commit only when `a` and `b` are already at that commit or after it. The refusal names the marks that are behind. - **Rollback.** `rollback` goes to a commit before the mark's. `--root NAME` makes a mark point into a [root](/docs/roots) instead of `main`; the same rules apply along the root's history. ### Following a mark ```bash oak mark follow server-prod --repo acme/web --run scripts/deploy.sh ``` `oak mark follow` waits for the mark to move. Run it as one of the mark's followers so its script gets the move's signed grant. Anyone else gets moves without it, and `oak mark follow` stops with an error unless you pass `--no-grant`, for a script that only needs `OAK_COMMIT`, `OAK_MARK` and the like. For each move it checks the commit out into a work dir (`./oak-mark-` by default; a clone of the repository made the first time), runs the script there, and files a [report](/docs/reports) on the commit under the mark's name (`--report-name` picks another): "deploying (move #12 by zach)", then "live (move #12)" or "failed (move #12)" followed by the end of the script's output. Arguments for the script go after `--`. It handles one move at a time. If the mark moves several times while a deploy runs, only the newest move runs next. The last move it handled is kept in a state file (`--state-file`, default `.follow.json`), so a restart carries on from there; a move that was running when the follower stopped is reported `failed` and not run again (move the mark again to retry). `--once` handles at most one move and exits, which suits a cron job or a test. `--no-checkout` runs the script without checking anything out. The script runs with: | Variable | What | |---|---| | `OAK_COMMIT` | The commit the mark moved to | | `OAK_MARK`, `OAK_MOVE_ID`, `OAK_MOVE_KIND` | The mark, the move's id, and `create`, `forward` or `rollback` | | `OAK_REPO`, `OAK_REMOTE` | The repository and server | | `OAK_LINE` | `main`, or `~NAME` for a mark on a root | | `OAK_REPO_ID` | The repository's numeric id (followers only) | | `OAK_GRANT`, `OAK_GRANT_SIGNATURE` | The move's signed grant and its minisign signature, both base64, when the server signs grants (followers only) | The grant names everything about the move a target needs to check (see [Signed moves](#signed-moves)), so a script reads the rest from it. The older `OAK_CI_*` names are still set for scripts written before these, and are deprecated. Secrets stay on the machine that follows: put them in its environment, not in Oak. Following needs only a read-only key; filing the reports needs write access, so a deploy machine usually runs as an [organization agent](/docs/api-keys#organization-agents) on the mark's owner group. ### Signed moves When the server has a release grant key, every move (but a mark's first) gets a grant signed with it: a short document naming the repository, the commit, the move and a single-use authorization id, valid for four hours. The identity it names is fixed when the move is made, so changing a mark later never changes an old move's grant. A follower asking for an expired grant gets it signed again only while the move is the mark's current one and less than a day old; after that the mark has to be moved again (the same commit is fine). A target that holds the public key can check that a commit really was moved there before it acts on it, and refuse a grant it has seen before. The grant is plain `key=value` lines: ``` schema=oak-release-grant-v1 repo_id=42 source_commit= branch=main workflow_path=.oak/marks/server-prod workflow_hash= event=manual ci_run_id= authorization_id= environment_id= environment_name=server-prod policy_version= issued_at= expires_at= ``` The field names come from Oak's old CI and stay as they are, so a target that already checks these grants keeps working. A mark can instead carry a fixed identity that a target pins, which its grants then name exactly; that is set through the API, and the CLI doesn't offer it. ### Reports A move's follower files [reports](/docs/reports) on the commit, and anyone can file their own with `oak report`: what the tests said, a deploy's log, a review. Whether a commit passed something is a mark's move: the test runner that passes moves `server-good`, and the one that fails writes what went wrong in its report. ### On the web Marks show on the History tab. Each commit names the marks pointing at it: the first two (your own groups' marks first, then the most recently moved), then **+N** for the rest, which opens the commit's page with every mark there. A mark's name opens its moves with who moved it, when, and the reports on each move. **Find a mark** above the commits searches marks by name; typing a mark's exact name opens its moves. Each report's name shows beside its commit, its headline on hover. A commit's page lists the marks you may move with **Move here** or **Roll back here**, and says which requirements aren't met yet. ### API | Request | What | |---|---| | `GET /api/:owner/:name/marks` | Every mark, with how far behind `main` it is | | `POST /api/:owner/:name/marks` | Create one (`name`, `commit`, `owner_group`, `requires`, `required_approvers`, `followers`, `allow_group_rollback`) | | `GET`, `PATCH`, `DELETE /api/:owner/:name/marks/:mark` | Show, change, delete | | `POST /api/:owner/:name/marks/:mark/move`, `…/rollback` | `{"commit", "note"}` | | `GET /api/:owner/:name/marks/:mark/moves` | The moves, newest first, with their reports | | `GET /api/:owner/:name/marks/:mark/follow?after=ID&timeout=S` | Waits up to 55 seconds for a move newer than `after`; returns the newest move, and for the mark's followers its grant and the variables above | | `POST`, `GET /api/:owner/:name/commits/:commit/reports` | File or read [reports](/docs/reports) | Every move also sends the `mark.moved` [webhook](/docs/webhooks) event, with `mark`, `move_id`, `move_kind` and `from_commit`. The [MCP server](/docs/mcp) can list marks and read their moves. ## Reports A report is what someone or something says about a commit, under a name (`tests`, `server-prod`, `review`): free text, usually markdown, and optionally a link. Its first line is the headline shown beside the commit on History; the rest (a summary, numbers, the end of a log) is on the commit's page. A body over 64 KiB keeps its start and its end. The next report under the same name on the same commit replaces it. ```bash oak report main --name tests --body "412 passed" oak report 3f2a8b1c --name tests --body-file report.md # `-` reads stdin oak report main --name tests --body "412 passed" --url https://ci.example/runs/7 oak report main # the commit's reports oak report main --name tests # one report, in full ``` Commits are `main`, a full hash, or a unique prefix. `oak report` takes `--repo OWNER/NAME` (default: the checkout's repository), `-r, --remote URL` and `--json`. `--move-id ID` ties a report to a [mark](/docs/marks) move; `oak mark follow` files its "deploying", "live" and "failed" reports that way. Reports are written for the people and agents reading them, so there are no fixed states. Whether a commit passed something is a mark's move: the test runner that passes moves `server-good`, and the one that fails writes what went wrong in its report. ### Who can file one Anyone who can write the repository files reports, with a key that has the `write` scope. A mark's followers can also file the report named after the mark on that mark's moves with a read-only key, but never replace a report someone else filed under that name. Everyone who can read the repository reads them. ### API | Request | What | |---|---| | `POST /api/:owner/:name/commits/:commit/reports` | File one: `{"name", "body", "url", "move_id"}` | | `GET /api/:owner/:name/commits/:commit/reports` | The commit's reports: `commit`, and `reports` with `name`, `headline`, `body`, `url`, `move_id`, `reporter`, `updated_at` | ## Organizations and access ### Organizations Every repository belongs to an **organization**, and its URL is `oak.space//`. Every account comes with a **personal organization** named after its username; create shared ones for groups and companies from your dashboard (or `POST /api/orgs`). The organization is also where storage is accounted and **deduplicated**: content is stored once per organization, so the same large asset committed to five of its repos costs one copy. Each repo's first push of it still uploads it, since a repo can only use content it has sent or published itself. Storage quotas are per organization; see [Plans and limits](/docs/limits). A personal organization always has exactly one member. To work with others, create a shared organization and invite them. ### Members and roles | Role | Can | |---|---| | **Owner** | Everything, including deleting the organization. | | **Admin** | Manage members, groups and what they can reach, the organization's agents, and settings. Full access to every repo. | | **Member** | Create repos in the organization, and read or write the repos they've been given access to. | The organization's people are its built-in **`members` group**: manage them on the `members` card under **Settings → Groups** (`oak.space//settings`), where owners and admins add people, change their role and remove them, and anyone can leave. From the terminal, `oak group add members alice` adds someone and `oak group remove members alice` takes them out. Removing someone (or someone leaving) also takes away everything they were granted inside the organization: their group memberships, and any repo they were added to on their own. Admins and owners can always read and write every repo in the organization, and can change any of a repo's [boundaries](/docs/path-permissions). ### Who can see a repository Access to a repo is given to **groups**. Give a group **Read** or **Write** on a repo, and everyone in the group gets that, along with any [agent keys](/docs/api-keys#keys-for-agents) made for it. Every organization has two built-in groups: | Group | Who's in it | |---|---| | `public` | Anyone, signed in or not. Giving it Read on a repo is what makes the repo **public**: readable on the web and with `oak clone`. It can't be given Write. | | `members` | Everyone in the organization: adding someone to it adds them to the organization. Give it Read or Write on a repo to share it with the whole organization. | Beyond those, a repo can be read by: - the organization's **owners and admins**, who can always read and write every repo, - the groups given access to it, and - someone added to that one repo on their own, for the odd outside collaborator. Being a plain **member** of the organization doesn't by itself give access to its private repos, until the `members` group (or another group they're in) is given access. Only people with Write can push branches or merge, unless the repo takes [external contributions](#external-contributions). Who's in each group is set under the organization's **Settings → Groups**. What a group can do in a repo is set in that repo's **Settings → Access**: a table of the groups and people who can reach it, each Read or Write, with the switch between public and private, and the repo's [path rules](/docs/path-permissions) below it. From the terminal, `oak group grant web mono --role write` gives a group access, and `oak group grant public mono` makes a repo public (`oak group revoke` undoes either). `PATCH /api/{owner}/{name}/visibility` still switches a repo between public and private. Inside a repo, [path rules](/docs/path-permissions) can narrow access to particular folders, or publish parts of a private repo to everyone. ### External contributions Owners and admins can let people without write access contribute, the way a pull request from a fork works on GitHub. Turn on **Allow external contributions** under the repo's **Settings → General**. It's off by default. With it on, anyone who can read the repo (for a public repo, any signed-in person or agent) can clone it and push a branch of their own: ```bash oak clone acme/widgets cd widgets oak switch -c fix-typo-in-readme # ...edit... oak desc "Fix a typo in the README" oak commit --push ``` Their branch shows up on the repo's branch board marked **External**, with who opened it, and the branch API reports it as `"external": {"author": ""}`. From there: - Only its author and the repo's writers can push to an external branch. A contributor can't push to `main`, to a writer's branch, or to another contributor's branch, and has to push under a new branch name instead. - A contributor can hold up to 20 open branches in a repo, and can close (withdraw) their own. Merging, renaming, reopening and everything else stays with writers. - Turning the setting off keeps existing external branches, but their authors can't push to them until it's turned back on. ### Groups Groups, nested groups, the organization's own agents and `oak group switch` have their own page: [Groups](/docs/groups). ### Moving and renaming - **Transfer a repo** to another organization from the repo's **Settings** (or `POST /api/{owner}/{name}/transfer`). Its history, branches, and settings come along. Access granted by the old organization doesn't: its groups' and people's grants are removed, so the new owners grant access afresh. A public repo stays public. - **Rename a repo** from its **Settings**. - **Rename an organization's slug** from the organization's **Settings → General**. URLs that use the old slug stop working, so update remotes and links. ### Archiving a repository Owners and admins can archive a repo from its **Settings → Danger** (or `POST /api/{owner}/{name}/archive`) when it's no longer maintained but should stay around. An archived repo is read-only: pushes, new branches, merges, branch changes and settings edits are refused, while its code, branches and commits stay browsable and it can still be cloned. Every page of the repo says it's archived. Unarchive it from the same place (or `POST /api/{owner}/{name}/unarchive`) to make it writable again. An archived repo can still be transferred or deleted. ### Audit log Owners and admins can see who did what — membership changes, merges, merges forced past approvals, settings changes — with `GET /api/orgs/{slug}/audit`. ### The organization page `oak.space/` is the organization's landing page: a list of its repos that the visitor can see. Under **Settings → General** you can choose whether people outside the organization can see it. To publish a static website from a repo, see [Pages](/docs/pages). ## Groups A **group** is a named list of an organization's people, such as `eng` or `billing`. Access to repos is given to groups, and [path rules](/docs/path-permissions) name groups as the owners, readers and writers of folders. The organization's own [agents](/docs/api-keys#organization-agents) can be on groups too. In the web UI, groups are under the organization's **Settings → Groups** (`oak.space//settings`): one card per group, with its members, maintainers, agents and what it reaches. What a group can do in one repo is set in that repo's **Settings → Access**. From the terminal it's `oak group`, and over the HTTP API it's `/api/orgs/{slug}/groups` (see the [API reference](/docs/api#account-and-keys)). ### Built-in groups Every organization has two groups it can't delete: | Group | Who's in it | |---|---| | `public` | Anyone, signed in or not. Giving it Read on a repo makes the repo public. It can't be given Write. | | `members` | Everyone in the organization. Adding someone to `members` adds them to the organization, and removing them takes them out of it and every group. | Who is in a built-in group follows from the organization, so neither can be nested or take agents. Every other group is one you create, and nobody is added to it automatically. ### Creating groups and adding people ```bash oak group create web --description "Web app" oak group add web alice oak group add web bob --maintainer oak group invite web carol # adds carol to the organization first if needed oak group list # every group, as a tree oak group show web # parent, maintainers, members, repos oak groups # the groups you're in ``` Organization owners and admins manage every group. A group's **maintainers** manage it and every group under it: they add and remove members, appoint maintainers and create sub-groups. Inviting someone who isn't in the organization yet takes an owner or admin. Anyone can remove themselves from a group. ### Nested groups A group can sit under another: `oak group create billing --parent eng`. Someone in `billing` counts as a member of `eng` too, so anything given to `eng` reaches everyone in `billing`. Maintainers go the other way: a maintainer of `eng` also maintains `billing`. A top-level group takes an owner or admin to create; a sub-group takes a maintainer of the group above it. ### Giving a group access to a repo Give a group **Read** or **Write** on a repo, and everyone in it (and in its sub-groups) gets that: ```bash oak group grant web acme/site --role write oak group revoke web acme/site oak group grant public site # make the repo public ``` The same table is in the repo's **Settings → Access**, with a row per group or person and a Read or Write picker on each. Granting repo access takes an organization owner or admin, who can always read and write every repo themselves. See [Who can see a repository](/docs/organizations#who-can-see-a-repository). ### Folders Inside a repo, [path rules](/docs/path-permissions) narrow access to folders and files by group: a rule's owner group approves changes there, and its readers and writers can be `@group/name`. Rules are edited in the repo's **Settings → Access**, under the grants. ### Agents on groups An organization's [agents](/docs/api-keys#organization-agents) are its own non-human accounts, created under **Settings → Agents**. An agent reaches what the groups it's on reach, never its creator's access. A new agent is on no group, so it reaches only public repos. ```bash oak group agent list # each agent and its groups (owners and admins) oak group agent add web deploy-bot oak group agent remove web deploy-bot ``` Adding an agent takes a maintainer of the group, or an owner or admin. In the web UI, add one from the group's card under **Settings → Groups**. A person can also give an agent a [key that works as a group](/docs/api-keys#keys-for-agents) without creating an organization agent. ### Working as a group `oak group switch web` makes your checkout work as `web`: you see and change exactly what the group can, until `oak group switch --clear`. It uses a 30-day key whose grant is the group, for that checkout only. `oak group switch` with no name says which group the checkout works as, and `oak groups` marks it with `*`. It's a way to check what a group's people and agents get. ## Path rules [Groups](/docs/organizations#who-can-see-a-repository) decide who can see a repo at all. Inside a repo, **path rules** (also called ownership boundaries) decide who reads and writes each folder or file, and whose approval a change there needs. A private repo can also publish one folder to the world. Path rules are set on the server, in the repo's **Settings → Access**: a table with a row per rule on a folder or file (owner group, who reads, who writes, approval, self-approve), each editable in place, and a last row to add one. Organization owners and admins change them there; a group's maintainers can also change the rules their group owns with `oak` or the [API](#api). They take effect on the next request, and every change is recorded in the organization's audit log with what it was before and after. Nothing about them lives in the repo's files, so a branch can't change the rules that apply to it. ### Groups A **group** is a named list of an organization's members, such as `eng` or `billing`. Groups can have sub-groups: `billing` can sit under `eng`. - A member of a sub-group counts as a member of every group above it. Anything granted to `@group/eng` reaches everyone in `eng` and its sub-groups. - A group's **maintainers** manage it and every group under it: they add and remove members, appoint maintainers and create sub-groups. - Organization owners and admins manage every group. - Every organization has the built-in `members` group (everyone in it), and `public` (anyone), which path rules spell `@public`. Nobody is added to any other group automatically. Groups are managed under the organization's **Settings → Groups**, with `oak group`, or with the [API](#api). ### Boundaries A boundary is a path of one repo — a directory, or a single file — with: | Setting | Means | |---|---| | **Owner group** | The group that owns the path. It can always read and write it, as far as the boundaries above let it. | | **Approval** | `required`: a change needs the owner group's approval before it merges. `advisory`: the branch shows the approval is wanted, but it doesn't block. `off`: neither. | | **Owners may approve their own branches** | Off by default. | | **Readers** | Who can read the path. Blank means everyone who can read the repo. | | **Writers** | Who can change it. Blank means everyone who can read it. | Readers and writers are lists of: | Principal | Means | |---|---| | `@alice` | The user `alice`. | | `@group/ops` | Everyone in the organization's `ops` group, or in a group under it. (`@team/ops` means the same.) | | `@group/members` | Everyone in the organization. | | `*` | Everyone who can already read the repo. | | `@public` | Everyone, including people with no access to the repo at all. | | *(an empty list)* | Organization owners and admins only. | Owners and admins always have full access, whatever the boundaries say. A repo with no boundaries has no path rules, and nothing waits for an approval. ### Nested boundaries A path belongs to its **deepest** boundary. - **Ownership and approval** come from that boundary alone. - **Access only narrows going down.** You can read a path only if every boundary above it lets you read. A nested boundary can lock its path down further, but it can't reopen what an enclosing boundary closed. - `@public` is the exception: a boundary that names it opens its path to everyone, whatever encloses it. Only organization owners and admins can set it. A boundary on a directory covers it and everything in it. A boundary on a file covers just that file: one on `config/prod.yaml` restricts that file, not `config/prod.yaml.bak` next to it. Boundaries are exact paths, not patterns: `*.pem` or `secrets/**` is refused. ### Who can change boundaries | To | You need to be | |---|---| | Change a boundary's settings, readers and writers, or delete it | A maintainer of its owner group, or of a group above it | | Add a boundary inside one you control | The same. It can go to that group or any group under it | | Give a boundary to a group outside that tree | Also a maintainer of the receiving group | | Add a boundary where none covers the path | An organization owner or admin | | Open a path to `@public` | An organization owner or admin | So the maintainers of `eng` can split `apps/` among eng's sub-groups, and each sub-group's maintainers can split their own directory further. Changing boundaries also takes write access to the repo, as any other change to it does. Changing a boundary's owner group or approval setting clears the approvals branches already had for it. ### Approvals A branch's touched boundaries are the deepest boundary of each file it changes. Each `required` one needs an approval from someone on its owner group who didn't work on the branch, before the branch can merge. An approval lasts as long as that boundary's part of the change stays the same: editing elsewhere, or merging `main` in, keeps it. Approve on the branch page, or with `oak approve` and an API key that has the **Review** scope (Settings → API keys). `oak approve --path apps/web` approves one boundary. `oak owners --branch` shows what a branch needs. Organization owners and admins can land a branch past missing approvals, as the repo's **Forcing past approvals** setting allows (Settings → Access). ### Restricted paths For someone who can read the repo, a path no boundary restricts is readable, and boundaries take access away. What a restricted path looks like to someone without access: - **You get a partial checkout.** `oak clone`, `oak pull` and `oak log --remote` serve you the repo without the directories you can't read: they aren't in the tree at all, not even by name (see [below](#if-you-can-t-read-some-directories)). - **The web UI, zip downloads and [Pages](/docs/pages) sites** leave restricted entries out entirely. - **Writes are refused.** A push, upload or revert that changes a path you may not write is rejected. Merging `main` into your branch with `oak pull` is fine — carrying the restricted files along unchanged isn't a write. - **Branches are hidden.** A branch that changes a directory you can't read is hidden from you, because its description could say what's there. - If identical content also lives at a path you *can* read, you can read those bytes there. #### If you can't read some directories Every commit on `main` carries its message, author and the names of the files it changed, and its hash covers all of that, so a commit can't be served with part of it removed. If any directory is restricted from you, Oak therefore serves you `main` only as a **partial checkout** (a view): the same commits rebuilt without the directories you can't read. A commit that also changed one of them keeps its author and date, but its message reads "(also changes paths outside your view)". The CLI does this for you: - `oak clone ORG/REPO` notices that some directories are hidden from you and clones the rest. `oak sparse show` lists what you have; `oak clone ORG/REPO --path DIR` still clones only the directories you name. - In a full checkout you made before a directory was restricted, `oak pull` turns it into a partial checkout and then pulls. That needs nothing local to lose, so commit and `oak push` your work first; until then `oak pull` stops and says so. - `oak log --remote` reads `main`'s history through the same partial view. In a full checkout it reads commit metadata instead, leaving out the commits that changed a directory you can't read, as the History page does. Organization owners and admins, and anyone who can read every directory, keep getting the full repo. **Older oak versions** get a refusal instead (HTTP 403 with `"code": "view_required"`) that tells you to run `oak upgrade`, or to clone the directories you need with `oak clone ORG/REPO --path DIR`. `GET /api/{owner}/{repo}/boundaries` reports `view_required` up front, for scripts that talk to the API directly; send the view with `?view_protocol=view_v1&view=%2B` (the whole repo) or the `oak-view-*` headers. ### Publishing paths with @public `@public` runs the other way, for people who have **no** access to the repo. For them, a path is hidden unless a boundary grants it to `@public`. That's how one private repo can contain a genuinely open-source directory — and it fails safe: forget a boundary, and too little is published, never too much. Outsiders can read a published directory: - in the web UI: the file tree, the file view and the zip download. Branches, commits and diffs stay private. A private repo with public paths **isn't listed** anywhere; people reach it by direct link. ### API | Request | Does | |---|---| | `GET /api/{owner}/{repo}/boundaries` | The boundaries whose paths you can read, plus `view_required` (some directory is hidden from you, so `main` is served to you only as a partial checkout) and `hidden_directories` | | `POST /api/{owner}/{repo}/boundaries` | Add one: `{"path", "owner_group", "approval"?, "self_approve"?, "readers"?, "writers"?}` | | `PATCH /api/{owner}/{repo}/boundaries/{id}` | Change one; `readers`/`writers` take `null` for the default | | `DELETE /api/{owner}/{repo}/boundaries/{id}` | Delete one | | `GET /api/{owner}/{repo}/owners?path=P` | The boundary that owns `P` | | `GET /api/orgs/{org}/groups` | Every group, with members and maintainers | | `POST /api/orgs/{org}/groups` | Create one: `{"slug", "parent"?, "description"?}` | | `PATCH /api/orgs/{org}/groups/{group}` | Change its description or parent | | `DELETE /api/orgs/{org}/groups/{group}` | Delete one with no sub-groups and no boundaries | | `PUT /api/orgs/{org}/groups/{group}/members/{user}` | Add someone, or change `{"maintainer": true}` | | `DELETE /api/orgs/{org}/groups/{group}/members/{user}` | Remove someone | From the CLI: `oak access`, `oak owners PATH`, `oak group list|show|create|add|remove|invite`, and `oak groups` for the groups you're in. Repo access for groups is on [Organizations and access](/docs/organizations#who-can-see-a-repository). ## API keys and tokens Everything that talks to oak.space — the CLI, the [HTTP API](/docs/api), CI jobs, agents — authenticates with a bearer token: ```text Authorization: Bearer oak_... ``` There are three kinds of token. | Token | Comes from | Lifetime | Use it for | |---|---|---|---| | **Login session** | `oak login` | 90 days | You, at your own terminal. | | **Personal API key** | You create it | Until revoked | Scripts and tools acting as you. | | **Agent key** | An org admin creates it for one of the organization's [agents](#organization-agents) | Until revoked | Bots, deploy machines, and agents with their own identity. | ### Personal API keys Create one under **Settings → API keys** on oak.space, or over the API: ```bash curl -X POST https://oak.space/api/api-keys \ -H "Authorization: Bearer $OAK_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "release script", "scope": "read", "repo": "acme/web"}' ``` | Field | Value | |---|---| | `name` | 1–100 characters, for your own reference. | | `scope` | `full` (default) or `read` — a read key can only make read requests. | | `repo` | Optional `owner/name`. The key then works only for that one repo. | | `expires_in` | Optional lifetime in seconds, from one minute to 366 days. Omitted, the key lasts until you revoke it. | | `org`, `groups` | Make it a [key for an agent](#keys-for-agents). | **The full key is shown once**, when it's created. After that only its first characters are displayed, so store it somewhere safe. List your keys with `GET /api/api-keys` and revoke one with `DELETE /api/api-keys/{id}`. A personal key acts as you, with your access — a repo-scoped or read-only key can only do less, never more. ### Keys for agents A personal key acts as you. If you're on groups that read a private directory, or you own the organization, so does anything holding your key. A key for an agent gives away less: ```bash curl -X POST https://oak.space/api/api-keys \ -H "Authorization: Bearer $OAK_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "web agent", "org": "acme", "groups": ["web"], "expires_in": 28800}' ``` Or open **For an agent** under **Settings → API keys**. | Field | Value | |---|---| | `org` | The organization the key works in. It can't reach any other, or your account. | | `groups` | Groups of that organization you are on. Leave it out for no group. An organization owner or admin can name any group. | Inside a repo, [boundaries](/docs/path-permissions) treat the key as a member of those groups and the groups above them, and as nobody else: - It isn't you. A boundary that lists `@you` doesn't reach it, and it never has an owner's or admin's full access, whoever made it. - It follows your membership. Leave a group and your keys lose it on their next request. - It does an agent's work: clone, pull, push branches, describe and close them, move the [marks](/docs/marks) its groups own and file reports on commits. Merging, approving, and anything under settings take your own credential. - If its groups can't read every directory, it's a [restricted reader](/docs/path-permissions#restricted-paths) like any other. It gets a checkout without those directories and doesn't see branches that touch them. `GET /api/whoami` with such a key answers with a `grant` block (`org`, `groups`), so an agent can tell what it is. Two things to know: - **Groups take access away only where a boundary lists readers or writers.** A key on `web` still reads every directory that's open to all of the repo's readers. - **A key protects you only where the agent can't reach your login.** `oak login` stores a session in `~/.config/oak/credentials`, and a session can make new keys. Give an agent this key in a container, on a remote machine, or in a sandbox without your home directory. ### Organization agents An **organization agent** is a non-human identity owned by an organization — a deploy bot, a build machine, a coding agent that runs unattended. Its actions show up under its own name in the audit log. It reaches what the [groups](/docs/groups) it's on reach, the same way a person does. A new agent is on no group, so it reaches only the organization's public repos. Put it on a group, and it reads or writes the repos that group was given, and [path rules](/docs/path-permissions) judge it as a member of that group. It doesn't borrow anything from whoever created it or issued its keys: an owner's agent doesn't get the owner's access. Organization owners and admins create them and issue their keys under the organization's **Settings → Agents**, or over the API. Whoever manages a group adds agents to it from the group's card under **Settings → Groups**, or over the API: ```bash # Create the agent curl -X POST https://oak.space/api/orgs/acme/agents \ -H "Authorization: Bearer $OAK_TOKEN" -H "Content-Type: application/json" \ -d '{"name": "nightly-agent", "display_name": "Nightly refactor agent"}' # Put it on the web group, so it reaches what web reaches curl -X PUT https://oak.space/api/orgs/acme/groups/web/agents/nightly-agent \ -H "Authorization: Bearer $OAK_TOKEN" # Give it a key that can push branches curl -X POST https://oak.space/api/orgs/acme/agents/nightly-agent/keys \ -H "Authorization: Bearer $OAK_TOKEN" -H "Content-Type: application/json" \ -d '{"name": "prod", "scopes": "read,write"}' ``` | Scope | Allows | |---|---| | `read` | Every read request an agent makes: clone, pull, list, view. | | `write` | Push branches, describe, close, reopen and rename them, move the marks its groups own and file reports on commits, in repos its groups can write. | | `release` | Accepted, but no request needs it now. | Scopes are required on an organization agent's keys. They do an agent's work, like a [key for an agent](#keys-for-agents): merging, approving, creating repos, and anything under settings take a person's credential, so an organization agent's key can't carry `merge`, `review` or `admin`. A key only works inside its own organization: the repos its groups reach (`/api/{org}/{repo}/...`), `/api/repos` (which lists those repos), `/api/whoami` and `/api/capabilities`. A repo its groups weren't given answers **404**, and anything else outside its reach answers **403** saying why. `GET /api/whoami` answers with a `grant` block listing its groups. Organization agents and their keys can only be managed from a signed-in session, never with an API key, so a key can't mint itself a stronger one. Disable an agent (`PATCH /api/orgs/{slug}/agents/{name}` with `{"disabled": true}`) to stop all its keys at once, or delete it. Revoke one key with `DELETE …/agents/{name}/keys/{key_id}`. The older `/api/orgs/{slug}/service-accounts` paths still work. > **For coding agents**, a `read,write` organization agent key can clone, push its branches, and move the marks its groups own, but can't merge to `main`: merging stays a human decision. If its groups can't read every directory, it's a [restricted reader](/docs/path-permissions#restricted-paths). ### Using a key with the CLI ```bash export OAK_API_KEY=oak_... oak clone acme/web oak auth status # confirms which credential is in use and who it resolves to ``` The CLI picks its credential in this order: 1. `OAK_API_KEY`, if set. 2. A key stored in the checkout itself (`oak clone` saves one, bound to the server it came from). 3. Your `oak login` session for that server, from `~/.config/oak/credentials`. If a push or pull unexpectedly says a repo you know exists isn't found, a stale key from step 2 is the usual suspect — `oak auth status` shows which source is winning. ### Using a key with the API ```bash curl https://oak.space/api/repos -H "Authorization: Bearer $OAK_API_KEY" ``` See the [HTTP API reference](/docs/api). ## Plans and limits Oak is free while it's in beta, and every organization gets the same allowances. Paid plans will come after the beta, and we'll say so well ahead of time. If you need more than what's here in the meantime, email [zach@oak.space](mailto:zach@oak.space). ### Beta allowances | | Per organization | |---|---| | Storage | 100 GiB | | Repositories | Unlimited (up to 1,000) | | Members | Unlimited | | Open branches | Unlimited | ### Storage Storage is counted per organization, after deduplication: content shared between repos — or between versions of a file — is stored and counted once. See an organization's usage on its **Settings** page, or `GET /api/orgs/{slug}/storage`; a single repo's with `GET /api/{owner}/{name}/size`. The storage quota is enforced: a push that would exceed it is refused. ### Hard limits These apply on every plan. | Limit | Value | |---|---| | Repositories per organization | 1,000 | | Branches per repository (open and closed) | 10,000 | | Data in a single push | 25 GiB | | File versions (blobs) in a single push | 50,000 | | Organizations you can own | 10 | If one of these is in your way, [say so](mailto:zach@oak.space). ## Git import and export Code moves between Git and Oak two ways: import a Git history into Oak, and export an Oak history back to Git. Both run in the `oak` CLI on your machine and need `git` on your `PATH`. | You want to… | Use | |---|---| | Bring a Git repo over from its URL | [`oak clone `](#import-with-oak-clone) | | Convert a Git checkout you already have | [`oak init --import-git`](#convert-a-checkout-in-place) | | Start a repo from a folder in the browser | [Upload a folder](#upload-a-folder) | | Get the history back out as Git | [`oak export`](#export-back-to-git) | ### Import with oak clone ```bash oak clone https://github.com/acme/web.git oak clone git@github.com:acme/web.git oak clone https://git.example.com/acme/web.git my-dir # choose the directory ``` Oak runs your system `git clone` (your Git credentials apply), creates an Oak repo, replays the history onto `main`, and leaves you on a personal branch at the tip. It then offers to delete the now-redundant `.git` directory, and keeps it if you decline or there's no terminal to ask. If the import fails, the destination is removed so you can run the command again. **What counts as a Git URL:** anything starting with `git@`, `ssh://`, or `git://`; anything ending in `.git`; and github.com, gitlab.com, and bitbucket.org URLs. For a self-hosted server over HTTPS, make sure the URL ends in `.git` so Oak doesn't read it as an Oak `org/repo`. Oak-only flags (`--branch`, `--path`, `--detached`, `--from`, `--json`) are rejected with a Git URL. The importer always brings the checked-out history. ### Convert a checkout in place ```bash cd my-existing-git-repo oak init --import-git ``` Oak replays the Git history onto `main` and puts you on a personal branch at the tip. Your files are left exactly as they are: anything that differs from the last Git commit, like uncommitted changes, untracked files, or line endings Git converted on checkout, shows up in `oak status`. Your `.git` directory is untouched, so you can keep using Git alongside for a while; on a terminal Oak offers to remove it. On a terminal, plain `oak init` asks whether to import. Without one (scripts, agents, `--json`) it refuses until you choose: `--import-git` to import, or `--no-import-git` to start an empty repository beside the Git history. With `--json`, the receipt's `git_import` field lists what was imported and anything left out. ### Publish what you imported A CLI import lives on your machine until you push. The first push names the owner, which creates the repo on oak.space with the imported history on `main`: ```bash oak push --repo acme/web ``` Then start working; see the [Quickstart](/docs/quickstart). ### What's preserved **Kept:** - The commit graph in order, including both parents of merge commits. - Every commit's author, email, message, and committer timestamp. - File modes: regular, executable, and symlinks. **Left out, and listed when it happens:** - **Submodules.** Oak has no submodule concept. - **Paths Oak can't track**: names that aren't valid UTF-8 or that hold control characters, any `.git` or `.oakroot` path component, and anything under `.oak/` other than `.oak/attributes`. They're dropped from every commit. - **Octopus merges** (three or more parents) keep their first two parents. - **History before a shallow clone's cut-off.** A shallow Git clone imports from its oldest fetched commits. **Not imported:** - **Only one line of history** comes across: the checked-out `HEAD`. Other branches aren't recreated. - **Tags.** Oak has no tags; refer to commits by hash. - **Git LFS content.** Files tracked by LFS come across as their pointer files. `oak clone ` refuses a repository whose checkout puts files under `.oak/hooks` (or anything else under `.oak/` besides what Oak tracks), because Oak runs `.oak/hooks` on commit. Your `.gitignore` keeps working: Oak reads it when there's no `.oakignore`. ### Upload a folder When creating a repo on oak.space, you can upload a folder from your computer instead of starting empty. The import form has presets for Godot, Unity, and Unreal projects that skip their generated directories. Files can also be uploaded into an existing repo from its page. ### Export back to Git ```bash oak export ../web-as-git oak export ../web-as-git --branch main --git-branch main ``` `oak export` writes an Oak branch's history (by default the current one) into a new Git repository and checks it out. Push it anywhere. This is Oak's escape hatch: your code and its history are never trapped. - Every commit on the branch comes across with its author, message, and timestamp, so exporting the same history twice gives the same Git commit ids. A history imported from Git exports back to the commits it came from. - Merges within the branch keep both parents. A squash-merge on `main` exports as one commit, the way it reads on Oak. - Every tracked file is written as Oak stores it. Your `.gitignore`, `.gitattributes`, hooks, and signing settings don't change what's exported. - A checkpoint with no message gets `oak: ` as its Git message. - From a shallow clone, the Git history starts at the oldest commit the clone has. Export from a full clone for all of it. A sparse clone needs the left-out directories first (`oak sparse add`). | Flag | Effect | |---|---| | `-b, --branch` | The Oak branch to export (default: current). | | `--git-branch` | Name of the branch in the Git repo (default: same as the Oak branch). | | `-f, --force` | Write into a destination that isn't empty. In an existing Git repo this overwrites the branch and leaves the working tree alone. | | `--tree-only --at ` | Write just one commit's files, without history or Git. | ## Webhooks A webhook makes oak.space send an HTTP `POST` to a URL of yours when something happens in a repo — to notify a chat channel, kick off an external build, or update a dashboard. ### Events | Event | Fires when | |---|---| | `branch.created` | A branch is pushed for the first time. | | `push` | An existing branch gets new commits (including a revert). | | `merge` | A branch is squash-merged onto `main`. | | `branch.closed` | A branch is closed without merging. | | `branch.reopened` | A closed branch is reopened. | | `branch.approved` | Someone [approves a directory's changes](/docs/path-permissions#approvals) on a branch. Approving several boundaries at once sends one event each. | | `mark.moved` | A [mark](/docs/marks) is created, moved forward or rolled back. `commit` is where it points now. | ### Add a webhook Under the repo's **Settings → Webhooks** (you need write access), enter: - the **URL** to deliver to — it must resolve to a public address; - a **secret**, to sign deliveries (recommended); - which **events** to send. Choosing none means all of them, including events added later, so switch on `event` and ignore what you don't handle. Or over the API: ```bash curl -X POST https://oak.space/api/acme/web/webhooks \ -H "Authorization: Bearer $OAK_API_KEY" -H "Content-Type: application/json" \ -d '{"url": "https://ci.example.com/oak", "secret": "s3cret", "events": ["push", "branch.created"]}' ``` Leave `events` out (or empty) to get every event. Names Oak doesn't send are dropped, and a list naming none it sends is refused with a 400 that lists them, so a typo never subscribes you to everything. List them with `GET /api/{owner}/{name}/webhooks` and remove one with `DELETE /api/{owner}/{name}/webhooks/{id}`. ### Who reads it A webhook only sends what the people reading it can see. Oak can't know who reads the channel or endpoint, so by default that's anyone who can read the repo. When a [path rule](/docs/path-permissions) hides a folder from some readers, a branch that touches that folder, and its merge to `main`, are left out. If a webhook posts somewhere only one group reads, such as your team's own channel, set **Who reads it** to that group. It then sends everything that group can see. Only a member of the group, or an owner or admin of the organization, can choose it. Over the API, pass `"audience": ""` when you create a webhook, or change it later: ```bash curl -X PATCH https://oak.space/api/acme/web/webhooks/12 \ -H "Authorization: Bearer $OAK_API_KEY" -H "Content-Type: application/json" \ -d '{"audience": "internal"}' ``` Send `"audience": null` to go back to every reader. Deleting the group does the same. ### Payload Each delivery is a JSON `POST`: ```http POST /oak HTTP/1.1 Content-Type: application/json User-Agent: oak-webhooks/1 X-Oak-Event: push X-Oak-Delivery-Id: 7f3c… X-Oak-Signature-256: sha256=5d61… { "event": "push", "owner": "acme", "repo": "web", "branch": "fix-login-redirect", "commit": "8fcf5aed1b2c…", "pusher": "zdgeier", "timestamp": "2026-10-06T17:04:11.512Z" } ``` | Field | Value | |---|---| | `event` | The event name, from the table above. | | `owner`, `repo` | The repository. | | `branch` | The branch the event is about. | | `commit` | The commit it's about — for `merge`, the new squash commit on `main`. | | `pusher` | Who did it. | | `timestamp` | When the delivery was sent (RFC 3339, UTC). | | `mark`, `move_id`, `move_kind`, `from_commit` | On `mark.moved`: the mark, the move, `create`, `forward` or `rollback`, and where it was before. | | `boundary` | The approved boundary's path (a directory or file), on `branch.approved` (`""` is the whole repo). | | `description` | The start of the branch's description, up to 500 characters, when the branch has one. | | `url` | The page for the branch, when the event has one. | Fields that don't apply are left out rather than sent as `null`. `X-Oak-Delivery-Id`, when present, is unique per delivery — use it to ignore duplicates. ### Verify the signature When a webhook has a secret, `X-Oak-Signature-256` is `sha256=` followed by the hex HMAC-SHA256 of the raw request body, keyed with the secret. Compute it over the bytes exactly as received, before parsing the JSON, and compare in constant time: ```python import hmac, hashlib def verify(secret: str, body: bytes, header: str) -> bool: expected = "sha256=" + hmac.new(secret.encode(), body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, header or "") ``` ```js import { createHmac, timingSafeEqual } from "node:crypto"; function verify(secret, rawBody, header = "") { const expected = "sha256=" + createHmac("sha256", secret).update(rawBody).digest("hex"); return expected.length === header.length && timingSafeEqual(Buffer.from(expected), Buffer.from(header)); } ``` ### Discord Paste a Discord channel webhook URL (`https://discord.com/api/webhooks/…`) and Oak recognizes it: instead of the JSON payload, it posts a readable message to the channel. No secret is needed, and no signature is sent. ### Slack Paste a Slack incoming webhook URL (`https://hooks.slack.com/services/…`) and Oak recognizes it the same way: the channel gets a readable message with a link to the branch, and the start of the branch's description. Create the URL by adding an [incoming webhook](https://api.slack.com/messaging/webhooks) to a Slack app in your workspace. No secret is needed, and no signature is sent. ### Delivery - Deliveries are sent shortly after the event and retried with backoff if your endpoint fails, so the same `X-Oak-Delivery-Id` can arrive more than once. - Events can arrive out of order. - Oak checks that the URL resolves to a public address both when you add it and again before every delivery, and skips it otherwise — so a webhook can't be pointed at internal networks. - Respond quickly with any `2xx`; do slow work after responding. ### Using webhooks for external CI A webhook is how you'd drive an external CI system: listen for `push` and `branch.created`, then fetch that commit with an [API key](/docs/api-keys) — `oak clone acme/web --branch `. To record what passed, have it file a [report](/docs/reports) on the commit (`oak report`) or move a [mark](/docs/marks). ## Pages Oak Pages publishes a folder of a repo as a static website: ```text https://.oak.page/ ``` You pick the name, and it's yours across all of oak.page. A repo can have as many sites as you like, each from its own folder: `docs/` at one name, `examples/demo/` at another. Every merge to `main` redeploys them. There's no build step on Oak's side: the site serves the files that are on `main`. ### Create a site From a checkout of the repo: ```bash oak page create acme-docs --dir docs # https://acme-docs.oak.page/ ← docs/ on main oak page create acme-demo --dir examples/demo --spa oak page list ``` Or open the repo's **Settings → Pages** and use **Add site**. Leave the folder empty to publish the whole repo. Creating, renaming and deleting sites, changing their folder and setting a password take an owner or admin of the repo's organization, because a site claims a name for the organization. Anyone with write access can redeploy or roll back. ### Names A name is one DNS label: lowercase letters, digits and hyphens, up to 63 characters, starting and ending with a letter or digit. Some names aren't available: - Names Oak uses or might use, and names that could be used to impersonate a service: `www`, `api`, `mail`, `docs`, `login`, `support` and many more. Names starting with `oak-` are reserved too. - A name that matches an organization's slug belongs to that organization. Only `acme` can claim `acme.oak.page`. - When a site is deleted or renamed, its old name stays with its organization for 30 days, so nobody else can pick it up and receive its traffic. During that time a renamed site's old address redirects to the new one. `oak page check NAME` tells you whether a name is free. ### Custom domains A site can also answer on a domain you own, like `example.com` or `docs.example.com`: ```bash oak page domain add acme-docs docs.example.com ``` Oak then shows two DNS records to create at your DNS provider: | Type | Name | Value | |---|---|---| | `TXT` | `_oak-pages.docs.example.com` | `oak-pages-verification=…` | | `CNAME` | `docs.example.com` | `domains.oak.page` | The TXT record proves the domain is yours. The CNAME sends visitors to Oak. A root domain like `example.com` can't have an ordinary CNAME, so use your provider's ALIAS, ANAME or flattened CNAME record pointing at `domains.oak.page`. If your domain's DNS is on Cloudflare, either proxied or DNS-only records work. Once the records are in place, verify the domain: ```bash oak page domain verify acme-docs docs.example.com oak page domain list acme-docs ``` DNS changes can take a few minutes to show up. After the domain is verified, Oak gets it an HTTPS certificate, which usually takes a few more minutes. `oak page domain list` shows where each domain is, and so does **Settings → Pages**. Keep the TXT record after verifying. Oak checks it once a day, and a domain whose record has been missing for a week stops serving the site. If a domain changes hands, its new owner can add it to their own site and verify it, and it moves to their site. To make a domain the site's main address, make it primary. The site's `oak.page` address and its other domains then redirect there: ```bash oak page domain primary acme-docs docs.example.com ``` Adding, verifying, removing and choosing a primary domain take an owner or admin of the repo's organization. A site can have up to 5 custom domains. Wildcard domains aren't supported. ### How files are served For a request to `/path`, Oak serves, in order: 1. `path/index.html` when the path ends in `/` (the root is `index.html`). 2. The exact file, then `path.html`, so `/about` finds `about.html`. 3. A redirect to `/path/` when `path` is a folder, so relative links work. 4. With the **SPA fallback** on, `index.html` for any path without a file extension. Use this for single-page apps with client-side routing. 5. Your `404.html`, with status 404, if the site has one. Each site is its own origin, so root-relative links like `/assets/app.js` work without setting a base path in your build. Sites can't read each other's cookies or storage, or oak.space's. ### Caching Responses are cached for up to a minute (`Cache-Control: public, max-age=60`), so a new deploy can take that long to show everywhere. Every file has an `ETag`, so a browser that already has the current version gets a `304` instead of the file again. A file whose name includes the start of its own content hash is cached for a year and marked `immutable`, since that address can never serve anything else. The hash is the file's BLAKE3 hash in lowercase hex, at least 8 characters of it, as its own dot-separated part between the name and the extension: ```text assets/app.3f9a1c0b7e2d4a61.js # b3sum app.js starts with 3f9a1c0b7e2d4a61 ``` Oak checks the name against the file's content on every request. A name that only looks like a hash, or a file that was edited without being renamed, is cached for a minute like everything else, so this can't leave visitors with a stale file. A password-protected site is served with `Cache-Control: private, no-cache`, so nothing between Oak and the visitor's browser keeps a copy. ### Deploys A deployment points a site at one commit of `main` and the folder in it. Every merge to `main` redeploys each of the repo's sites at the new `main`. A merge that doesn't change a site's files doesn't create a deployment for it. A deploy that fails (for example, the folder is empty) is recorded with its reason, and the site keeps serving the last good deployment. ```bash oak page deploys acme-docs # history, newest first oak page redeploy acme-docs # deploy main again now oak page rollback acme-docs # back to the previous good deployment oak page rollback acme-docs --to 42 # or a specific one ``` A rollback points the site back at an older deployment's commit and folder, and lasts until the next merge to `main` that changes the site. If your site needs a build step, commit the build output to a folder and point the site at it. Uploading a build from CI is on our list. ### Private repos and path permissions You can publish a site from a private repo. The site itself is public, so only publish folders you mean to share. Files that [path permissions](/docs/path-permissions) hide from a repo's readers are never published, whatever folder the site points at. Path permissions apply as they are now, not as they were when the site was deployed: restricting a folder takes it off the site straight away, and a rollback can't bring it back. To keep a site private, set a password in **Settings → Pages** or with `oak page set NAME --password-user USER --password-file FILE`. Visitors then get a browser sign-in prompt (HTTP Basic Auth). ### Limits | | Limit | |---|---| | Sites per organization | 10 | | Custom domains per site | 5 | | Bandwidth per site, per month | 50 GiB | | Bandwidth per organization, per month | 200 GiB | There's no limit on the number or size of files. Files are streamed, and a request for part of a file (an HTTP `Range` request, which browsers make to seek in a video or resume a download) gets just that part. Bandwidth counts the bytes of your files that Oak sends. Copies a visitor's browser or the CDN in front of Oak already has don't count. Months run on UTC. The bandwidth limits are soft. When a site, or all of an organization's sites together, use their bandwidth for the month, we email the organization's owners and admins, and the site keeps serving. At twice the limit, we email again, and the site answers file requests with `429 Too Many Requests` until the month ends. A download that started before then finishes. The site's card in **Settings → Pages** and `oak page show NAME` show how much it has used. If a site needs more, please let us know. Sites serve static files with `GET` and `HEAD` only. Paths under `/_oak/` are reserved for Oak (`/_oak/health` reports the live deployment). ### Acceptable use Pages is for project pages, documentation, personal sites and similar sites. Please don't use it to run an online business, an e-commerce site or a software-as-a-service product, or to handle sensitive transactions such as passwords or payment details. It also isn't meant for serving mainly video, large media, or downloads that have nothing to do with the site. Everything in our [Acceptable Use Policy](/aup) applies to sites too. ### Moving and deleting Transferring a repo to another organization deletes its sites, and their names stay with the old organization for 30 days. Deleting a repo deletes its sites the same way. ### Reporting abuse To report a site for phishing, malware or other abuse, email [abuse@oak.space](mailto:abuse@oak.space) with its address. We can disable a site immediately. ## CLI reference Every public `oak` command, grouped by what it's for. Run `oak --help` for the same information in your terminal; `oak` with no arguments prints a grouped overview. This page follows CLI version 0.113.0. Check `oak --version`, and `oak --help` for the build you have. Commands for Oak staff and for recovery (`oak doctor blob`, `oak feedback list|show|transition`, `oak agent publication`) are listed under [Staff and recovery commands](#staff-and-recovery-commands). ### Global options | Option | Effect | |---|---| | `--verbose` | Print per-phase timings. Goes **before** the command: `oak --verbose push`. Same as `OAK_VERBOSE=1`. | | `-h`, `--help` | Help for any command or subcommand. | | `--version` | Print the CLI version. | Commands that talk to a server take `-r, --remote ` (default `https://oak.space`). The server used is: the flag, then `OAK_REMOTE`, then the one the checkout is linked to, then the default. Most commands take `--json` for machine-readable output. Environment variables are listed in [Files and environment variables](/docs/configuration). ### Exit codes | Code | Meaning | |---|---| | `0` | Success. | | `1` | General error. | | `2` | Usage error (bad flags or arguments, or an interactive prompt with no terminal). | | `3` | Repository locked by another `oak` process — retry. | | `4` | The working tree has uncommitted changes that block the operation. | | `5` | Merge or sync conflicts, or a conflict is already in progress. | | `6` | Network, server, or authentication failure. | | `7` | Merge prediction couldn't be certified. | | `8` | An integrity check ran out of budget — inconclusive. | ### Setup and sign-in #### oak init ```text oak init [PATH] [--json] [--import-git | --no-import-git] ``` Create a repository in `PATH` (default: the current directory) and put you on a personal branch parented onto `main`. `--json` prints one receipt and never prompts. On a terminal it offers to import an existing `.git` history and to write an `AGENTS.md` for coding agents. Without a terminal, a directory with a `.git` needs `--import-git` (bring the history over, see [Git import](/docs/git#convert-a-checkout-in-place)) or `--no-import-git` (start empty beside it). Refuses to run in your home directory. #### oak clone ```text oak clone [ORG/REPO | GIT-URL] [DEST] ``` Clone a repository and put you on a personal branch. With no argument, pick from a list. A bare `REPO` means your personal organization. A Git URL is imported instead — see [Git import](/docs/git#import-with-oak-clone). | Flag | Effect | |---|---| | `--branch ` | Switch to this remote branch after cloning. | | `--expected-head ` | With `--branch`: fail unless the branch is open at exactly this commit. | | `--shallow` | Only the newest commit on the selected branch (`main` by default). | | `--path ` | Only these directories. Repeatable or comma-separated. The other directories aren't in the tree at all. See [Sparse clones](/docs/sparse-clones). | | `--detached` | Check out `main`'s head with no personal branch. | | `--from ` | Reuse content from another local checkout of the same repo. | | `--json` | Print a machine-readable receipt. | | `--allow-unverified-integrity` | Continue when the server's integrity proof is inconclusive (otherwise exit 8). | | `--allow-legacy-scope` | Permit a scoped clone on an older server that lacks the bounded integrity proof. Pull may honor the requested scope and still verifies hashes; this waives only the proof before download. | | `-r, --remote ` | Server to clone from. | #### oak login / logout / whoami ```text oak login [-r URL] oak logout [-r URL] oak whoami [-r URL] ``` `oak login` signs in through your browser (or prints a URL and asks for a one-time code when there's no browser) and saves a token in `~/.config/oak/credentials`. `whoami` prints the signed-in username. See [Install and sign in](/docs/install#sign-in). #### oak auth status ```text oak auth status [--json] [-r URL] ``` Show which credential the CLI would use — `OAK_API_KEY`, the checkout's key, or your login — and who the server says it belongs to. Never prints the secret. #### oak repo list ```text oak repo list [--org ORG] [--limit N] [--json] [-r URL] ``` List repositories you can see (public ones only when signed out). `--limit` defaults to 200. #### oak skill ```text oak skill install [--global] [--json] oak skill status [--json] oak skill show [FILE] ``` `oak skill install` writes the bundled `oak-vcs` agent skill into `./.claude/skills/` (or `~/.claude/skills/` with `--global`). `oak skill status` reports each installed copy as `current`, `stale` or `missing` against this CLI and names the install command that refreshes a stale one. `oak skill show` prints `SKILL.md`, or a reference file such as `commands.md`, to stdout. See [Working with agents](/docs/agents#install-the-agent-skill). #### oak upgrade ```text oak upgrade [-f] [--channel stable|nightly] [--canary] ``` Upgrade to the latest signed build on your update channel: stable releases unless you chose nightly. `--channel` switches channels and is remembered in `~/.config/oak/update.json`; `--canary` installs the current nightly once without switching. `-f` skips the confirmation. See [Nightly builds](/docs/install#nightly-builds). #### oak completions ```text oak completions oak completions --install [bash | zsh | fish] ``` Print a shell-completion script. `--install` writes it to the shell's completions directory instead (the shell comes from `$SHELL` if not named) and prints any startup-file line the shell still needs. See [Shell completion](/docs/install#shell-completion). ### Working tree #### oak status ```text oak status [--json [--compact] [--fingerprint]] [--short | --porcelain] [--reconcile] ``` Show modified, added, and deleted files. `--short` / `--porcelain` print Git-compatible short rows; `--json --compact` is bounded output for agents; `--reconcile` applies any pending reconciliation after a remote merge first. `--json --fingerprint` adds the same read-only working-tree `fingerprint` that [`oak diff --fingerprint`](#oak-diff) reports. #### oak diff ```text oak diff [REV [REV]] [PATHS...] [options] ``` Show changes. With no revision: the working tree against your last checkpoint. One branch name: what that branch contributes, no checkout needed. One commit: that commit against the working tree. Two revisions: between them. On a terminal, opens the full-screen viewer. | Flag | Effect | |---|---| | `--branch` | The whole current branch (checkpoints + uncommitted) against where it forked. | | `--against ` | Base for a branch endpoint (default: its parent). | | `--mode ` | Perspective for branch endpoints. See [Reviewing](/docs/reviewing#read-a-diff-without-switching). | | `--print` | Print a unified diff instead of opening the viewer. | | `--stat` | Per-file added/removed counts. | | `--name-only` | Only the changed paths. | | `--word-diff` | With `--print`: mark changes within lines. | | `-U, --unified ` | Lines of context. | | `--check` | Report whitespace errors and conflict markers; exit 1 if any. | | `--exit-code` | Exit 1 if there are differences, 0 if not. | | `-a, --text` | Treat large text files as text. | | `--json` | Machine-readable summary. Add `--hunks` for patch text, `--max-bytes ` to cap it, `--changed-files-limit` / `--changed-files-offset` to page. | | `--line-numbers` | With `--json --hunks`, each file's `hunks` carry `old_line` / `new_line` per line. With `--print`, hunk lines are prefixed with their line numbers; that output is for reading, not for `apply`. Also on `oak branch diff`. | | `--fingerprint` | With the working-tree `--json` document, add a `fingerprint` object (`change_id`, `base_commit`, `base_tree`, `result_tree`, `changed_file_count`). The `change_id` is the id [`oak change capture`](#oak-change) would record for the same tree and paths. Computing it writes nothing and needs no linked remote. | | `--verify-fingerprint ` | Recompute the fingerprint (optionally for just the paths given) and exit 1 unless its `change_id` equals `ID`. Writes nothing. Use it to confirm the tree you are about to commit is the tree you reviewed. | | `--remote ` | Diff two exact commits on the server, with `--json` or `--print`. | #### oak commit ```text oak commit [PATHS...] [--push] [--no-verify] [--json] [--quiet] ``` Save a local checkpoint of every change (or only those under `PATHS`). Takes no message: `-m` is refused — describe the branch with `oak desc`. `--push` publishes afterwards; `--no-verify` skips [hooks](/docs/making-changes#hooks). #### oak restore ```text oak restore [PATHS...] [-s COMMIT] [-f] ``` Restore files (or everything) to the last checkpoint, or to `COMMIT`. Asks first unless `-f`. #### oak reset ```text oak reset [PATH] [-f] ``` Discard uncommitted changes — everything, or under `PATH`. Asks first unless `-f`. #### oak change ```text oak change capture [PATHS...] [--json] oak change export --output [--json] ``` Store uncommitted changes as an immutable capture without committing or touching the working tree; export one as a zip. See [History](/docs/history#save-uncommitted-work-without-committing). ### Branches #### oak start ```text oak start SUMMARY [--name NAME] [--no-push] [--clean] [--json] ``` Begin a task: create a branch from `main`'s head, named after `SUMMARY` (with `oak switch -c` semantics, so uncommitted files are carried over), set its description to `SUMMARY`, and push it. A push failure keeps the branch, and the receipt says what to retry. See [Working with agents](/docs/agents#starting-a-task). | Flag | Effect | |---|---| | `--name ` | Branch name to use instead of the slugified summary. | | `--no-push` | Don't push the new branch. Also skipped when the checkout isn't linked to a remote yet. | | `--clean` | Start from the latest `main` and discard working-tree changes. | | `--json` | Print a machine-readable receipt. | #### oak switch ```text oak switch [NAME] [-c] [--clean] [-d] [--json] ``` Switch to a branch (fetching it if needed). With no name, pick from a list; that picker can't run unattended, so pass a name (or `-c`) in scripts and with `--json`. | Flag | Effect | |---|---| | `-c, --create` | Create a branch off the latest `main` and switch to it. The name is optional. | | `--clean` | Start from the latest `main` and discard working-tree changes. | | `-d, --detach` | Treat `NAME` as a commit (full hash or a unique prefix of 4+ characters) and detach HEAD there. | | `--json` | One receipt: the branch and head now checked out, and the ones before. | #### oak desc ```text oak desc [DESCRIPTION | --file FILE] [--append] [--json] ``` Set the current branch's description — the commit message it will merge with. `--file -` reads stdin; `--append` adds a paragraph and refuses if your copy is stale. See [Descriptions](/docs/branches#descriptions). #### oak branch ```text oak branch [--show-current] [--json] oak branch list [--remote] [--status open|closed] [--json] oak branch show [--remote] [--json] oak branch rename ``` List branches, print the current one, or show one branch's details. `--remote` reads the server. `rename` is temporarily disabled. To close a branch, use [`oak close`](#oak-close). Other `oak branch` subcommands: [`triage`](#oak-branch-triage), [`review`](#oak-branch-review) and [`diff`](#oak-branch-diff). #### oak close ```text oak close [NAME...] [--remote] [--reason TEXT] [--json] ``` Close a branch (default: the current one). `--remote --json` closes pushed branches without switching to them, several at once. `--reason` records why in the audit log. To close a fleet of remote branches only if they haven't moved, pin each one to the head you reviewed: ```bash oak close --remote --json --reason superseded \ feature-a@FULL_64_CHAR_HEAD feature-b@FULL_64_CHAR_HEAD ``` The pin is a check, not a lock. The CLI reads each branch's remote head and refuses to close one that differs from its pin, but the server's close has no expected-head condition. A push that lands between that read and the close is not prevented; the CLI re-checks afterwards and reports `closed_after_head_moved` (exit 5), or `fence_verified: "unchecked"` (exit 6) if it couldn't re-check. Exit 0 means every branch was confirmed closed at its pin. Branches are closed independently, so some may succeed while others fail. Each branch's row says `closed`, `already_closed`, `refused_head_moved` (nothing was sent), `closed_after_head_moved`, `unknown_outcome` and so on. After any non-zero exit, read the final open-branch list (`oak branch list --remote --json`) before doing anything else, and don't retry an `unknown_outcome` blindly. #### oak split ```text oak split [--from BRANCH] [--plan FILE] [--dry-run] ``` Reorder or drop a branch's commits, or split them into separate branches (`oak histedit` is an alias). `--plan` applies a todo list non-interactively (`-` for stdin). #### oak finish ```text oak finish (--desc TEXT | --desc-file FILE) [--json] ``` Check that the branch can publish, then set the description, checkpoint, and push. If the check (the preflight) refuses, finish changes nothing. The JSON names the phase that completed. A step that was clearly rejected may name a next command. A publication whose outcome is unconfirmed (the request may have landed but the reply was lost) names no retry command: it points at read-only checks instead. Run those, don't push again until you know. See [Working with agents](/docs/agents#finishing-a-task-in-one-command) and [Unconfirmed publications](/docs/agents#unconfirmed-publications). ### Merging and conflicts #### oak merge ```text oak merge [BRANCH] [--force] [--dry-run [--offline]] [--json] oak merge --continue | --abort ``` Squash-merge a branch (default: the current one) onto `main` and close it. The branch description becomes the commit message. See [Merging and conflicts](/docs/merging). | Flag | Effect | |---|---| | `--dry-run` | With `--json`: predict the merge and change nothing. The prediction is certified against the server's current `main`; exit 7 means it couldn't be certified. | | `--offline` | With `--dry-run`: make no network request. The prediction uses your local `main` and is reported uncertified (exit 7). | | `--force` | Sends the merge API's `?force=1` override: merge past a required [approval](/docs/path-permissions#approvals), where the repository's approval policy allows it (org admins only). | | `--continue` / `--abort` | Finish or cancel a merge after resolving conflicts. | #### oak conflict ```text oak conflict status [--json] oak conflict show [--json] oak conflict take (--ours | --theirs) [--json] ``` Inspect an in-progress merge or pull conflict, and resolve a file by taking one side of every conflict block. See [Resolving conflicts](/docs/merging#resolving-conflicts). #### oak agent ```text oak agent state --json [--compact] [--refresh] [--publication-after OPERATION_ID] ``` One JSON document with the repository's state and `recommended_next_commands`. `--refresh` checks the server first, and also re-observes any interrupted publications it lists. `--publication-after OPERATION_ID` continues the bounded page of interrupted-publication records after that operation. ### Syncing #### oak push ```text oak push [--repo ORG/REPO] [-f] [--json] [--plan --json] [-r URL] ``` Publish the current branch. `--repo` (or `OAK_REPO`) links a new repo on its first push without a prompt — the organization must exist; the repo is created. `-f` overwrites a diverged remote branch. `--plan --json` reports what would be sent without sending it. #### oak pull ```text oak pull [--branch-only] [-f] [--json] [-r URL] oak pull --continue | --abort ``` Fetch new commits on your branch, then merge the latest `main` into it. `--branch-only` skips the merge; `-f` discards local commits the server doesn't have. #### oak fetch ```text oak fetch [-r URL] ``` Refresh your copy of `main` without touching your branch or files. #### oak sparse ```text oak sparse list [--json] oak sparse [--json] oak sparse set oak sparse add oak sparse disable oak sparse remove ``` Show or change a [sparse checkout's](/docs/sparse-clones) cone, or the directories a `--path` view holds. ### History and inspection #### oak log ```text oak log [PATHS...] [-n N] [--oneline] [--verbose] [-S TERM | -G REGEX] [--json] oak log --remote --json [--branch NAME] [--from HASH] [-n N] ``` Show history — full-screen on a terminal. `-S` finds commits that add or remove a string, `-G` commits with a changed line matching a regex. `--remote` reads a branch's history from the server without fetching it. #### oak hash ```text oak hash ``` Print the full hash of the current commit, bare, for scripts. Repository, branch, parent and remote details are in `oak status --json`. #### oak open ```text oak open [--page NAME] [--print | --json] ``` Open the repo on oak.space, or just print its URL. `--page NAME` opens that [Oak Pages](/docs/pages) site (`https://NAME.oak.page/`) instead. ### Reviewing #### oak owners / oak access / oak approve ```text oak owners PATH [--json] oak owners --branch [--json] oak access [--json] oak approve [BRANCH] [--path DIR] [--head HASH] [--json] ``` `oak owners PATH` shows the [boundary](/docs/path-permissions) that owns a path: its owner group, approval setting, readers and writers. `oak owners --branch` shows what the current branch touches and which approvals it still needs. `oak access` lists the repo's boundaries you can see. `oak approve` approves every touched boundary you may approve, or one with `--path`; `--head HASH` is the head you reviewed, and a branch that has moved since is refused. It needs an API key with the **Review** scope. #### oak retention ```text oak retention list [--repo OWNER/NAME] [-r URL] [--json] oak retention [--repo OWNER/NAME] [--json] oak retention set DIR --keep N [--json] oak retention remove DIR [--json] ``` Lists or changes the repo's [retention rules](/docs/retention): keep only the newest N versions of each file under a directory. Changing a rule needs an organization owner or admin. #### oak groups / oak group ```text oak groups [--org ORG] [--json] oak group list [--org ORG] [--json] oak group show GROUP oak group create GROUP [--parent GROUP] [--description TEXT] oak group add GROUP USER [--maintainer] oak group remove GROUP USER oak group invite GROUP USER [--maintainer] oak group grant GROUP REPO [--role read|write] oak group revoke GROUP REPO oak group agent list oak group agent add GROUP AGENT oak group agent remove GROUP AGENT oak group switch [GROUP] [--clear] ``` `oak groups` lists the groups you're in, across your organizations, and marks the one this checkout works as. `oak group` manages your organization's [groups](/docs/groups): sub-groups, members and maintainers. `invite` also adds the person to the organization when they aren't in it yet. `grant` and `revoke` give a group access to a repo or take it away; `oak group grant public REPO` makes a repo public. `switch` makes this checkout work as a group, seeing and changing exactly what it can, until `switch --clear`. `oak team` is the old name and still works. `oak group agent` puts an organization's agents on groups. An agent reaches what its groups reach, never its creator's access. `list` (organization owners and admins) shows each agent and its groups; `add` takes a maintainer of the group or an owner or admin, and the built-in groups (`public`, `members`) don't take agents; `remove` takes an agent off a group. Every `oak group` subcommand takes `--org ORG` (default: this checkout's), `--remote URL` and `--json`. `oak group add members USER` adds someone to the organization itself, and `oak group remove members USER` removes them from it and every group. #### oak repo visibility ```text oak repo visibility [public | private] [--repo OWNER/NAME] [--json] [-r URL] ``` With no argument, print whether the repository is public or private (this checkout's, unless `--repo`). With `public` or `private`, change it; only owners and admins of the repository's organization can. `oak group grant public REPO` and `oak group revoke public REPO` do the same through the group commands. #### oak repo move / adopt ```text oak repo move ORG/SOURCE --into ORG/TARGET:PATH --owner-group GROUP [--dry-run] [--no-wait] oak repo adopt ``` Move a repo into a directory of another repo, with its history. With the default force policy the move has to be started from the web; `--dry-run` shows the plan, and `--no-wait` starts the move and returns without following it. `oak repo adopt`, run in a checkout of a moved repo, carries its work to a new checkout of the target. #### oak branch triage ```text oak branch triage [--remote] [--only mergeable|closable|ambiguous] [--against BRANCH] [--status STATUS] [--analysis-depth DEPTH] [--limit N] [--json] ``` Score many branches at once — mergeability, contribution, recommended action — without switching. #### oak branch review ```text oak branch review [--remote] [--merge-preview] [--changed-files-limit N] [--changed-files-offset N] [--json] ``` Evidence for one branch: what changed, and with `--merge-preview`, whether and how safely it would merge. #### oak branch wait ```text oak branch wait [NAME] [--timeout SECONDS] [--on-main-move] [--json] ``` Wait on a pushed branch (default: the current one) until it is merged or closed, or until `main` moves and the branch no longer merges cleanly. Then it prints one result: `merged`, `closed`, `conflicts` (exit 5, with the conflicting files and the commands that fix it), or `unpublished` when the checkout has commits the server doesn't. A clean move of `main` needs nothing, so it keeps waiting; `--on-main-move` returns then too (`main_moved`), and `--timeout` gives up after a while (`timeout`). See [Keeping a branch mergeable](/docs/agents#keeping-a-branch-mergeable). #### oak branch diff ```text oak branch diff [PATHS...] [--remote] [--against BRANCH] [--diff-mode tree|contribution|net-merge] [--print] [--json [--hunks]] [--line-numbers] [--max-bytes N] [-U N] [-a] [--changed-files-limit N] [--changed-files-offset N] ``` A branch's diff without checking it out. Default mode is `tree`. `--max-bytes` is a byte budget across all `--hunks` patches, `-U/--unified N` sets context lines, `-a/--text` treats oversized text files as text, and `--changed-files-limit` / `--changed-files-offset` page the changed-file summaries. `--line-numbers` works as in [`oak diff`](#oak-diff). ### Roots #### oak root ```text oak root list [--archived] [--json] oak root show ROOT [--json] oak root create NAME [--from main|HASH] [--owner-group GROUP] [--sync] [--json] oak root archive ROOT --yes [--json] oak root pull [ROOT] [--dir PATH] [--force] [--json] oak root push [ROOT] [--dir PATH] [--json] ``` Separate timelines inside one repository, such as a release line that takes patches apart from `main`. Every subcommand takes `--repo OWNER/NAME` and `-r/--remote URL`. See [Roots](/docs/roots) for the workflow, permissions and exit codes (`pull` and `push` exit 5 when the root and your copy disagree). ### Marks #### oak mark ```text oak mark list [--json] oak mark show MARK [--json] oak mark create NAME [--commit main|HASH] [--owner-group GROUP] [--root ROOT] [--requires MARK,...] [--approver USER] [--allow-group-rollback] [--follower AGENT] [--description TEXT] [--json] oak mark move MARK COMMIT [--note TEXT] [--json] oak mark rollback MARK COMMIT [--note TEXT] [--json] oak mark log MARK [-n N] [--json] oak mark delete MARK --yes [--json] oak mark follow MARK --run SCRIPT [--dir DIR] [--state-file FILE] [--once] [--no-checkout] [--no-grant] [--report-name NAME] [--json] [-- ARGS...] ``` Named pointers to commits on `main` that people and bots move to record what has passed what, and that deploy machines follow. Every subcommand takes `--repo OWNER/NAME` and `-r/--remote URL`. See [Marks](/docs/marks) for the rules (forward only, requirements, rollbacks) and the variables `follow` gives its script. #### oak report ```text oak report COMMIT --name NAME (--body TEXT | --body-file FILE) [--url URL] [--move-id ID] [--json] oak report COMMIT [--name NAME] [--json] ``` File a report on a commit, or, without a body, list the commit's reports (with `--name`, show that one in full). A report is free text under a name; its first line is the headline History shows, and the next one under the same name replaces it. `--body-file -` reads stdin. Takes `--repo OWNER/NAME` and `-r/--remote URL`. `oak mark report` is an older name for filing one. See [Reports](/docs/reports). ### Reading a remote repository #### oak ls / cat / grep ```text oak ls --remote [PATH] [--rev BRANCH_OR_HASH] [--max-entries N] [--json] oak cat --remote PATH [--rev BRANCH_OR_HASH] [--max-bytes N] [--json] oak grep --remote PATTERN [-E] [--case-sensitive] [--max-files N] [--json] [-- PATH...] ``` List a directory, print a file, or search `main` on the server without cloning or changing your checkout. `--remote` is required. Results are limited to what you can read. `cat` is hash-verified; `ls` and `grep` are not. `grep` exits 1 when nothing matches. See [Reading a repository without a clone](/docs/remote-inspection). ### Pages #### oak page ```text oak page list [--org ORG] oak page create NAME [--dir PATH] [--spa] oak page show NAME oak page rename NAME NEW oak page set NAME [--dir PATH] [--spa|--no-spa] [--password-user USER --password-file FILE | --no-password] oak page rm NAME [--yes] oak page deploys NAME oak page redeploy NAME oak page rollback NAME [--to ID] oak page check NAME oak page domain list SITE oak page domain add SITE DOMAIN oak page domain verify SITE DOMAIN oak page domain primary SITE DOMAIN [--off] oak page domain rm SITE DOMAIN [--yes] oak open --page NAME ``` Publish folders of the current repo as static websites at `https://NAME.oak.page/`. `oak page domain` serves a site on your own domain: `add` prints the DNS records to create, `verify` checks the TXT record and starts serving there (exit 1 if the record isn't found yet), `primary` makes a verified domain the main address so the others redirect to it (`--off` stops that), and `rm` removes it. See [Pages](/docs/pages). Every subcommand takes `--repo OWNER/NAME`, `-r/--remote URL` and `--json`. ### Tools #### oak export ```text oak export [-b BRANCH] [--git-branch NAME] [-f] oak export --tree-only --at [--max-files N] [--max-bytes N] ``` Replay a branch's history into a new Git repo, or write one commit's files. See [Export back to Git](/docs/git#export-back-to-git). #### oak feedback ```text oak feedback [-m TEXT | --file FILE] [--title TITLE] [--name NAME] [--email EMAIL] [--json] ``` Send a bug report or feature request; prints a tracking reference (`fb-N`). Opens your editor on a terminal when no text is given. Alias: `oak feature-request`. #### oak environment ```text oak environment [--json] ``` List every environment variable Oak reads and its effective value (secrets shown as set/unset only). Alias: `oak env`. #### oak doctor ```text oak doctor --repo ORG/REPO [--verify metadata|existence|bytes] [--depth N] [--max-chunks N] [--max-bytes N] [--json] oak doctor file --at [--remote] [--output FILE] [--max-bytes N] [--json] oak doctor tree --at [--max-files N] [--max-bytes N] [--json] oak doctor refs [--max-branches N] [--json] oak doctor compact ``` With `--repo`, check a remote repository's content end to end, from commits down to stored bytes. `--max-chunks` and `--max-bytes` bound how many chunk objects and object bytes one request verifies. Exit `0` verified, `6` a problem was found, `8` inconclusive. The subcommands check one thing each, without changing anything except `compact`: - `oak doctor file` verifies one file's bytes at a commit. `--remote` reads it from the server without a clone; `--output` also writes the verified bytes to a new file. - `oak doctor tree` lists a commit's paths, sizes and hashes, bounded by `--max-files` and `--max-bytes`. - `oak doctor refs` reads every local branch head from one snapshot and flags disagreements; `--max-branches` bounds the list. - `oak doctor compact` rewrites a local database made by an older CLI in the current storage format and reclaims disk space. See [History and inspection](/docs/history#inspect-files-and-trees-at-a-commit). `oak doctor blob` is under [Staff and recovery commands](#oak-doctor-blob). ### Staff and recovery commands These are listed so that the reference is complete; most people never need them. #### oak doctor blob ```text oak doctor blob HASH --repo ORG/REPO [--depth N [--branch NAME]] [--json] ``` Privileged: prove one blob's metadata, chunk mapping, stored objects and affected paths. It needs administrator access to the server; `--depth` bounds how many of a branch's newest commits it inspects. #### oak feedback list / show / transition / link / unlink ```text oak feedback list [--status STATUS] [--limit N] [--cursor CURSOR] [--json] oak feedback show ITEM [--json] oak feedback transition ITEM --expected-revision TOKEN [--status STATUS] [--notes TEXT | --clear-notes] [--json] oak feedback link ITEM [--branch NAME | --commit HASH] [--repo ORG/REPO] [--json] oak feedback unlink ITEM [--link-id ID | --branch NAME | --commit HASH] [--repo ORG/REPO] [--json] ``` `list`, `show` and `transition` are platform-admin views of the feedback queue (`list` is bounded and omits reporter details). `transition` edits one ticket only if it is still at the revision you observed (`--expected-revision`, taken from a fresh `show` or `list`), needs server support (`feedback_transition_v1`), and never retries: a conflict or an unconfirmed outcome means re-read and reconcile. `link` and `unlink` (also admin-only) connect a feedback item to the branch (default: the current one) or commit that addresses it; `unlink` never guesses between several matches and prints the `--link-id` that resolves it. #### oak agent publication forget ```text oak agent publication forget OPERATION_ID --acknowledge-unknown --json ``` Delete one local record of an interrupted publication, without contacting the server, after you accept that its outcome stays unknown. Both `--acknowledge-unknown` and `--json` are required. The record stays until you do this; a read-only check of the server never removes it. It refuses a record owned by a running process. Reconcile first: see [Unconfirmed publications](/docs/agents#unconfirmed-publications). ## Files and environment variables ### In a repository | Path | Versioned? | Purpose | |---|---|---| | `.oak/` | — | The local repository: its database (`.oak/oak.db`), in-progress merge state, and hooks. Never committed, except the file below. | | `.oak/attributes` | Yes | Reserved for per-path attributes. | | `.oak/hooks/pre-commit`, `post-commit` | No | Local [hooks](/docs/making-changes#hooks). | | `.oakignore` | Yes | Files Oak should ignore, in `.gitignore` syntax. | | `.gitignore` | Yes | Used **only** when there's no `.oakignore`. | | `AGENTS.md`, `CLAUDE.md` | Yes | Instructions for coding agents; `oak init` offers to write them. | | `.claude/skills/oak-vcs/` | Yes | The agent skill, from `oak skill install`. | ### In your home directory | Path | Purpose | |---|---| | `~/.local/bin/oak` | The CLI, where the installer puts it. | | `~/.config/oak/credentials` | Saved logins, one per server (from `oak login`). | | `~/.config/oak/version_check` | When the CLI last checked for an update. | | `~/.config/oak/update.json` | Your update channel (`stable` or `nightly`). | | `~/.config/oak/feedback.json` | The contact email `oak feedback` remembers. | | `~/.config/oak/auto-update.log` | Output of the last background nightly update. | | `~/.claude/skills/oak-vcs/` | The agent skill, from `oak skill install --global`. | If `XDG_CONFIG_HOME` is set to an absolute path, Oak uses `$XDG_CONFIG_HOME/oak` instead of `~/.config/oak`. Versions before 0.118 kept these files in `~/.oak/`; the CLI moves each one the first time it needs it, and removes `~/.oak/` once nothing else is left in it. ### Environment variables `oak environment` (or `oak env`) prints every variable below with its effective value — secrets as set/unset only. #### Server and credentials | Variable | Effect | |---|---| | `OAK_REMOTE` | Server URL for this invocation, overriding the checkout's linked server. | | `OAK_API_KEY` | Token to authenticate with. Beats every stored credential. See [API keys](/docs/api-keys). | | `OAK_REPO` | `org/repo` to link on a first push — the same as `oak push --repo`. | | `OAK_BROWSER` | Command `oak login` runs to open its URL instead of the system browser. A command that fails (such as `false`) switches to pasting a code. | #### Identity | Variable | Effect | |---|---| | `OAK_AUTHOR` | Author name on commits, and the prefix of generated branch names. Defaults to your login, then `USER` / `USERNAME`. | | `OAK_EMAIL` | Contact email for `oak feedback`. | #### Network | Variable | Effect | |---|---| | `OAK_NO_UPDATE_CHECK` | Turn off the daily check for a new CLI version. | | `OAK_NO_AUTO_UPDATE` | On the nightly channel, don't install new builds in the background; the notice still prints. | | `OAK_URL` | Where `oak upgrade` and the update check download releases (default `https://oak.space`). | | `OAK_UPLOAD_CONCURRENCY` | Parallel uploads during push. | | `OAK_PRELOAD_CONCURRENCY` | Content uploads in flight before a large push publishes (default 3). | | `OAK_DOWNLOAD_CONCURRENCY` | Parallel downloads during clone and pull (default 32). | | `OAK_PROBE_TIMEOUT_SECS` | Timeout in seconds for read-only server probes, 1–300 (default 20; 5 for the `main` head check in `oak start`, `oak switch -c` and `oak merge --dry-run`). | | `OAK_ALLOW_PARTIAL_CLONE` | Recovery only: skip files a broken server can't send instead of failing. | | `HTTPS_PROXY`, `HTTP_PROXY`, `ALL_PROXY`, `NO_PROXY` | Standard proxy settings (lowercase forms too). | #### Output | Variable | Effect | |---|---| | `OAK_VERBOSE` | Print per-phase timings, like `--verbose`. | | `OAK_LOG` | Log filter for debugging (for example `OAK_LOG=debug`). | | `OAK_PROGRESS` | `always`, `never`, or `auto` progress display. | | `OAK_SPINNER` | Spinner style: `line`, `pulse`, `arc`, `minimal`, `oak`. | | `NO_COLOR`, `CLICOLOR_FORCE` | Disable or force color. | | `CI` | When set, progress display is off by default. | #### Tools | Variable | Effect | |---|---| | `OAK_DIFF_TOOL` | External program to use instead of `oak diff`'s viewer. | | `PAGER` | Pager for long output. | | `VISUAL`, `EDITOR` | Editor for `oak feedback` (falls back to `vi`). | #### Set by Oak | Variable | Where | |---|---| | `OAK_HOOK` | In [hooks](/docs/making-changes#hooks): the event name. | | `OAK_COMMIT`, `OAK_MARK` and the rest | In the script `oak mark follow` runs: see [Following a mark](/docs/marks#following-a-mark). | #### Installer | Variable | Effect | |---|---| | `INSTALL_DIR` | Where `install.sh` / `install.ps1` put the binary. | | `OAK_NO_LOGIN` | Skip the installer's login prompt. | | `OAK_CHANNEL` | `nightly` installs the nightly build and keeps `oak upgrade` on nightlies. See [Nightly builds](/docs/install#nightly-builds). | ## HTTP API reference oak.space has a JSON API — the same one the `oak` CLI is built on. Use it to script repositories, branches, merges, marks, and organizations, or to wire Oak into your own tools and agents. ### Basics **Base URL:** `https://oak.space/api`. Paths below are relative to it. **Authentication:** send a token as a bearer header. Personal API keys, organization agent keys, and `oak login` sessions all work — see [API keys and tokens](/docs/api-keys). ```bash curl https://oak.space/api/repos -H "Authorization: Bearer $OAK_API_KEY" ``` Requests without a token can read public resources only. **Format:** request and response bodies are JSON (`Content-Type: application/json`). `{owner}` is an organization slug (including personal organizations, which are named after their user). **Errors** use the usual status codes — `400` bad request, `401` not signed in, `403` signed in but not allowed (including a key missing a scope), `404` not found (also returned for things you can't see), `409` conflict, `412` precondition failed, `503` temporarily unavailable — with a body like: ```json { "error": "human-readable message" } ``` Some errors add a machine-readable `code` and `retryable: true`. ### Account and keys | Method | Path | Description | |---|---|---| | `GET` | `/whoami` | The user (or organization agent) behind the token. | | `GET` | `/version` | Server version. | | `GET` | `/api-keys` | Your personal API keys (prefixes only). | | `POST` | `/api-keys` | Create a key: `{"name", "scope": "full"\|"read", "repo"?: "owner/name", "expires_in"?, "org"?, "groups"?}` (see [API keys](/docs/api-keys#personal-api-keys)). Returns the full key **once**. | | `DELETE` | `/api-keys/{id}` | Revoke a key. | ### Repositories | Method | Path | Description | |---|---|---| | `GET` | `/repos?sort=name\|updated\|created` | Repositories you can access. | | `POST` | `/repos` | Create one: `{"name", "description"?, "is_public"?, "organization_slug"?}`. | | `GET` | `/{owner}/{name}` | A repository: name, visibility, head, and more. | | `DELETE` | `/{owner}/{name}` | Delete a repository. | | `PATCH` | `/{owner}/{name}/visibility` | `{"is_public": true\|false}`. | | `POST` | `/{owner}/{name}/transfer` | Move it to another organization: `{"to_organization": "slug"}`. | | `POST` | `/{owner}/{name}/archive` | Archive it: every write except unarchive, transfer, and delete then gets `403` (org owners and admins). | | `POST` | `/{owner}/{name}/unarchive` | Make an archived repo writable again (org owners and admins). | | `GET` | `/{owner}/{name}/size` | Storage the repository uses. | ### Branches | Method | Path | Description | |---|---|---| | `GET` | `/{owner}/{name}/branches` | List branches, with descriptions, heads, and status. | | `POST` | `/{owner}/{name}/branches` | Create one: `{"name", "description"?, "parent_branch"?}`. | | `GET` | `/{owner}/{name}/branches/{branch}` | One branch. Add `?record_read=1` to record that you've read it; the response includes who else has. | | `POST` | `/{owner}/{name}/branches/{branch}/merge` | Squash-merge onto the parent. See below. | | `POST` | `/{owner}/{name}/branches/{branch}/sync` | Merge the parent into the branch. `409` with `code: "branch_moved"` (retryable) if it received new commits meanwhile. | | `POST` | `/{owner}/{name}/branches/{branch}/close` | Close a branch. Idempotent. | | `POST` | `/{owner}/{name}/branches/{branch}/reopen` | Reopen a closed branch. | | `POST` | `/{owner}/{name}/branches/{branch}/rename` | Temporarily disabled — returns `503`. | Branch descriptions are set by pushing (`oak desc` then `oak push`); there's no separate endpoint. #### Merge responses `POST …/merge` lands one squash commit on `main` whose message is the branch description. | Status | Meaning | |---|---| | `200` | Merged. The body has `commit_hash` (the new commit on `main`) and `merge_parent_hash` (the branch tip). | | `409` with `conflict_paths` | The branch conflicts with `main`. Sync, resolve, and push. | | `409` with `code: "main_moved"` or `"branch_moved"` | `main` or the branch changed during the merge. Nothing was merged; retry. | | `409` with `code: "approvals_required"` | A [path rule](/docs/path-permissions#approvals) needs approvals the branch doesn't have yet (`missing_approvals`). | | `400` "already closed" | The branch was already merged or closed. | ### Commits and content | Method | Path | Description | |---|---|---| | `POST` | `/{owner}/{name}/commits/info` | Commits for a list of hashes, with their trees unless `"metadata_only": true`. `"first_parent": N` with one hash walks back from it instead (up to 200; `first_parent.next` continues). If some directory is hidden from you, only metadata requests are answered, and commits that changed a hidden directory are left out. | | `POST` | `/{owner}/{name}/commits/{hash}/revert` | Land a commit that undoes `{hash}` on its branch. `409` if the affected files have changed since. | | `GET` | `/{owner}/{name}/tree/{commit}` | The root directory listing at a commit. | | `GET` | `/{owner}/{name}/tree/{commit}/{path}` | A subdirectory listing. | | `GET` | `/{owner}/{name}/raw/{commit}/{path}` | A file's bytes at a commit. | Outside the JSON API, `GET https://oak.space/{owner}/{name}/download` returns a zip of `main`. ### Marks [Marks](/docs/marks) live under `/{owner}/{name}/marks`, and reports on a commit under `/{owner}/{name}/commits/{commit}/reports`. The routes are listed in [Marks](/docs/marks#api). ### Organizations | Method | Path | Description | |---|---|---| | `GET` | `/orgs` | Your organizations. | | `POST` | `/orgs` | Create one: `{"slug", "name", "description"?}`. | | `GET` | `/orgs/{slug}` | One organization. | | `PATCH` | `/orgs/{slug}` | Update its name or description. | | `DELETE` | `/orgs/{slug}` | Delete it. | | `GET` | `/orgs/{slug}/members` | Members and roles. | | `POST` | `/orgs/{slug}/members` | Add someone: `{"username", "role"?: "member"\|"admin"\|"owner"}`. | | `PATCH` | `/orgs/{slug}/members/{username}` | Change a role: `{"role"}`. | | `DELETE` | `/orgs/{slug}/members/{username}` | Remove a member. | | `GET` | `/orgs/{slug}/groups` | Groups, with their `kind` (`public`, `members` or `custom`), members, maintainers, `agents` (organization agents) and `repos`. (`/orgs/{slug}/teams` is the old name.) | | `POST` | `/orgs/{slug}/groups` | Create a group: `{"slug", "parent"?, "description"?}`. | | `PATCH` | `/orgs/{slug}/groups/{group}` | Change a group's `description` or `parent`. | | `DELETE` | `/orgs/{slug}/groups/{group}` | Delete a group with no sub-groups and no boundaries. | | `PUT` | `/orgs/{slug}/groups/{group}/members/{username}` | Add someone, or set `{"maintainer": true}`. | | `DELETE` | `/orgs/{slug}/groups/{group}/members/{username}` | Remove someone. | | `PUT` | `/orgs/{slug}/groups/{group}/agents/{name}` | Put one of the organization's agents on a custom group. | | `DELETE` | `/orgs/{slug}/groups/{group}/agents/{name}` | Take it off. | | `POST` | `/orgs/{slug}/groups/{group}/invite` | `{"username", "maintainer"?}`: add someone, to the organization first if they aren't in it (that part takes an owner or admin). | | `PUT` | `/orgs/{slug}/groups/{group}/repos/{repo}` | Give the group `{"role": "reader"\|"writer"}` on a repo (owners and admins). For `public`, makes the repo public. | | `DELETE` | `/orgs/{slug}/groups/{group}/repos/{repo}` | Take it away. For `public`, makes the repo private. | | `GET` | `/{owner}/{name}/access` | Who can reach a repo: `{"repo", "is_public", "grants": [{"group"?, "kind"?, "user"?, "role"}]}`. | | `PUT` | `/{owner}/{name}/access/users/{username}` | Give one person `{"role"}` on the repo (owners and admins). | | `DELETE` | `/{owner}/{name}/access/users/{username}` | Take one person's access away. | | `GET` | `/user/groups` | The groups you're in, across your organizations. | | `GET` | `/orgs/{slug}/storage` | Storage used against the quota. | | `GET` | `/orgs/{slug}/audit` | The audit log. | Managing members and organization agents needs owner or admin. Groups are managed by owners and admins and by each group's maintainers; giving groups access to repos takes owner or admin. See [Path rules](/docs/path-permissions#who-can-change-boundaries) for who changes rules on folders. #### Organization agents | Method | Path | Description | |---|---|---| | `GET` | `/orgs/{slug}/agents` | List them, each with the `groups` it's on. | | `POST` | `/orgs/{slug}/agents` | Create one: `{"name", "display_name"?}`. | | `PATCH` | `/orgs/{slug}/agents/{name}` | `{"disabled": true\|false}`. | | `DELETE` | `/orgs/{slug}/agents/{name}` | Delete it. | | `GET` | `/orgs/{slug}/agents/{name}/keys` | Its keys. | | `POST` | `/orgs/{slug}/agents/{name}/keys` | Create a key: `{"name", "scopes": "read,write"}` (some of `read`, `write`, `release`). Returns the key **once**. | | `DELETE` | `/orgs/{slug}/agents/{name}/keys/{key_id}` | Revoke a key. | An agent reaches what its groups reach. Scopes are explained in [API keys and tokens](/docs/api-keys#organization-agents). `/orgs/{slug}/service-accounts` is the old name for these paths and still works. ### Webhooks | Method | Path | Description | |---|---|---| | `GET` | `/{owner}/{name}/webhooks` | A repo's webhooks. | | `POST` | `/{owner}/{name}/webhooks` | Create one: `{"url", "secret"?, "events"?: ["push", "merge", …]}`, using the names in [Webhooks](/docs/webhooks#events). | | `DELETE` | `/{owner}/{name}/webhooks/{id}` | Delete one. | Payloads and signatures: [Webhooks](/docs/webhooks). ### Pages | Method | Path | Description | |---|---|---| | `GET` | `/pages/names/{name}` | Whether a site name is free: `{"name", "available", "reason"}`. `?org=SLUG` checks it for that organization. | | `GET` | `/{owner}/{name}/pages/sites` | The repo's sites: `{"sites": [...]}`. | | `POST` | `/{owner}/{name}/pages/sites` | Create one: `{"name", "source_dir"?, "spa_fallback"?}`. Org owner or admin. Deploys it and returns 201 with the site. | | `GET` | `/{owner}/{name}/pages/sites/{site}` | One site, with its live `deployment` (and `last_failure` when the newest attempt failed). | | `PATCH` | `/{owner}/{name}/pages/sites/{site}` | Change `name`, `source_dir`, `spa_fallback`, or `basic_auth` (`{"username", "password"}`, or `null` to remove). Org owner or admin. | | `DELETE` | `/{owner}/{name}/pages/sites/{site}` | Delete it (204). Org owner or admin. | | `GET` | `/{owner}/{name}/pages/sites/{site}/deployments` | Deployment history, newest first. | | `POST` | `/{owner}/{name}/pages/sites/{site}/deployments` | `{"action": "redeploy"}` or `{"action": "rollback", "to"?}`. Write access. A failed deploy returns 200 with `"status": "failed"` and a `failure`. | | `GET` | `/{owner}/{name}/pages/sites/{site}/domains[/{domain}]` | The site's [custom domains](/docs/pages#custom-domains), each with its status and the DNS records to create. | | `POST` | `/{owner}/{name}/pages/sites/{site}/domains` | Add one: `{"domain"}`. 201 when added. Org owner or admin. | | `POST` | `/{owner}/{name}/pages/sites/{site}/domains/{domain}/verify` | Check its TXT record and start serving it. Org owner or admin. | | `PATCH` | `/{owner}/{name}/pages/sites/{site}/domains/{domain}` | `{"primary": true}` makes it the site's main address. Org owner or admin. | | `DELETE` | `/{owner}/{name}/pages/sites/{site}/domains/{domain}` | Remove it (204). Org owner or admin. | | `GET` | `/orgs/{slug}/pages/sites` | Every site in an organization (members). | Unavailable names all return 409 with the same message. See [Pages](/docs/pages). ### CLI releases Public endpoints the installer and `oak upgrade` use to fetch and verify binaries. | Method | Path | Description | |---|---|---| | `GET` | `/releases` | Published CLI versions. | | `GET` | `/releases/latest` | The latest version. | | `GET` | `/releases/{version}/{platform}` | Download a binary. | | `GET` | `/releases/{version}/{platform}/sha256` | Its SHA-256. | | `GET` | `/releases/{version}/{platform}/minisig` | Its minisign signature. | | `GET` | `/releases/latest/{platform}` | Redirects (302) to the latest version's binary for `platform`, such as `darwin-arm64`. `/sha256` and `/minisig` after it redirect the same way. | ### Sync protocol Push, pull, and clone use content-addressed endpoints under `/{owner}/{name}/` — `push`, `pull`, `blobs/*`, and `chunks/*`. They're built for the CLI, which verifies every hash, and may change between versions; use the CLI rather than calling them directly. ## How Oak works For people who want to know what's under the hood: the object model, the chunking, and how Oak compares to the version control systems that influenced it. Oak is written in Rust; the CLI is a single binary. ### Manifests and commits, like Mercurial Oak borrows its names from [Mercurial](https://www.mercurial-scm.org/wiki/Design): each commit points at a **manifest**, the full snapshot of the tree as `(path, blob hash, mode)` entries. The manifest is stored as one tree object per directory, as in Git, so a directory that didn't change between commits is shared by its hash rather than written again. Everything is **content-addressed with BLAKE3**: a file's identity is its hash, so storing the same content twice costs nothing. Diffing two commits means walking two trees and skipping every directory whose hash matches. Commits on a branch carry no message. The narrative lives on the branch, as its description, and only the squash commit that lands on `main` gets a message — derived from that description. The squash keeps a pointer to the branch's last commit, so the detailed history stays reachable without cluttering `main`. ### Content-defined chunking with FastCDC Files are split into variable-length chunks with [FastCDC](https://www.usenix.org/system/files/conference/atc16/atc16-paper-xia.pdf). Chunk boundaries are chosen by the content itself rather than at fixed offsets, so inserting a line near the top of a 100 MB file changes only the chunks around the edit, not everything after it. Git stores each version of a large file as a separate blob and relies on packfile delta compression after the fact. Oak chunks at write time, so deduplication is immediate and works across files: two assets that share a header share those chunks. Each chunk is hashed with BLAKE3, each blob records its ordered chunk list, and push and pull transfer only the chunks the other side is missing. On the server, chunks are stored once across every repo in an organization. A push still sends the content its repo doesn't already have, even when another repo in the organization stored it first: a repo can only point at, check for or read content it has published or sent itself, so knowing a file's hash never gets you its content. ### Trust: the client verifies The client re-derives every commit's manifest hash from the entries the server sends, and rejects a mismatch. That's what makes clones and pulls trustworthy. To leave out directories you can't read under [path rules](/docs/path-permissions), or didn't ask for with `--path`, the server sends a *view*: each commit rebuilt over the pruned tree, under its own hash, which the client checks the same way. ### Local storage, like Fossil A local repository is a single SQLite database (`.oak/oak.db`) holding commits, manifests, and branch state, with large content stored as chunks — not a directory of loose objects. ### How Oak differs from Fossil [Fossil](https://fossil-scm.org) is the closest prior art in philosophy: a single local database file instead of a loose-object store, and a repository you can back up with `cp`. Where they diverge: - **Large files.** Fossil stores content inline in SQLite, which caps out on large binaries. Oak chunks content and stores chunks by hash, so large assets are stored the same way as everything else. - **Object model.** Fossil uses its own text artifact format. Oak uses manifests stored as content-addressed trees of directories. - **Branching.** In Fossil a branch is a tag on a commit in a timeline. Oak has named branches with a parent, and branches are the unit of work. - **Scope.** Fossil bundles a wiki, bug tracker, and forum. Oak stays close to version control, plus [marks](/docs/marks) and [access rules](/docs/path-permissions) set per directory. No wiki, issue tracker, or forum; keep the tools you already use for those. - **Agents.** Oak is built for branch-per-agent work: clone, commit on a personal branch, push. There's no separate pull-request object — the branch *is* the review unit, and its description is the change's story. ### The server oak.space is a single Rust binary (Axum) with PostgreSQL for metadata and object storage for chunks, running in Oregon. The web UI is server-rendered HTML with [htmx](https://htmx.org) for partial updates — no client-side framework or JavaScript bundle. Questions about the internals, or interested in working on Oak? Email [zach@oak.space](mailto:zach@oak.space) or join the [Discord](/discord). ## Contributors Oak is made by Oakspace, a small studio in Seattle. ### Zach Geier Founder, in Seattle, Washington. Zach grew up in a small town called [Forest, Virginia](https://en.wikipedia.org/wiki/Forest,_Virginia), which may have influenced the name. You can reach him at [zach@oak.space](mailto:zach@oak.space). ### Adam Morse Design, in Los Angeles, California. Adam ([@mrmrs_](https://x.com/mrmrs_)) works on how Oak looks and feels. More of his work is at [mrmrs.cc](https://mrmrs.cc/). ### Getting involved If you've found something wrong or missing, `oak feedback -m "…"` files it from your terminal, and we read all of it. If you'd like to talk, or you're interested in working on Oak, email [zach@oak.space](mailto:zach@oak.space) or join the [Discord](/discord).