| 1 |
# Oxygen |
| 2 |
|
| 3 |
[](https://oxygenhub.io/andymccall/oxygen/flow) [](https://oxygenhub.io/andymccall/oxygen/coverage) |
| 4 |
|
| 5 |
Oxygen (`oxy`) is a distributed, commutative version control system written in Rust for large repositories. See [docs/spec.md](docs/spec.md) for the specification, [docs/guide.md](docs/guide.md) for a user guide by task, and [docs/protocol.md](docs/protocol.md) if you are implementing a client or server. |
| 6 |
|
| 7 |
It is self-hosting: this directory is an Oxygen repository, and the project's own history is kept with `oxy`, not with Git. |
| 8 |
|
| 9 |
## Working with agents |
| 10 |
|
| 11 |
An AI agent works in Oxygen under a key of its own, which you delegate to for a scope and a time. For example: |
| 12 |
|
| 13 |
``` |
| 14 |
oxy identity delegate add agent.identity --scope changes --expires 8h |
| 15 |
``` |
| 16 |
|
| 17 |
Every change the agent makes is attributed to you and signed by the agent. `oxy log`, `oxy verify` and the hub therefore show who did the work, such as "Andy McCall · via Claude Code", and a policy can require that a person has approved it before it lands. |
| 18 |
|
| 19 |
See [docs/ai_native_agent_workflows.md](docs/ai_native_agent_workflows.md) for the design and [docs/guide.md](docs/guide.md) §9 for the setup. |
| 20 |
|
| 21 |
## What is different |
| 22 |
|
| 23 |
- **History is a set of changes, not a chain of snapshots.** A change records what it did to identified lines and tree nodes and which earlier changes it depends on. Changes that do not depend on each other commute, so there are no merge commits and rebasing independent work rewrites nothing. |
| 24 |
- **Conflicts are data.** A conflicted state can be committed, pushed and pulled. Resolving one is an ordinary edit followed by a commit. |
| 25 |
- **Every change has a stable ID and a content hash.** The ID survives rewrites; the hash makes history tamper-evident. |
| 26 |
- **Everything is signed.** Composite Ed25519 + ML-DSA-65 signatures on changes and on every bookmark update, verified against a trust policy that lives in the repository. |
| 27 |
- **Every operation is undoable** through an operation log. |
| 28 |
- **Large files are chunked** with content-defined chunking into a BLAKE3-addressed store. |
| 29 |
|
| 30 |
## Status |
| 31 |
|
| 32 |
Early, but usable for its own development. Implemented: the object model, the change graph with conflict detection and resolution, the working copy (`status`, `commit`, `checkout`, `diff`, `undo`), identities and signatures, remotes over local paths and HTTP(S) with `clone`, `fetch`, `pull`, `push`, the reference server `oxy serve`, the trust policy, and packed storage. |
| 33 |
|
| 34 |
Not yet: checkpoints for very long histories, history editing (`rebase`, `split`, `edit`), multiple workspaces, garbage collection with retention, and the Thin client profile for constrained machines. |
| 35 |
|
| 36 |
## Install |
| 37 |
|
| 38 |
Builds for Linux, macOS, Windows and Haiku are on the [releases page](https://oxygenhub.io/andymccall/oxygen/releases). These are early releases: the macOS and Windows builds are not signed and have had little testing. |
| 39 |
|
| 40 |
- **Debian, Ubuntu and other Linux with apt** (x86_64, arm64 or riscv64): add the repository at https://oxygenhub.io/apt and install with apt, so `apt upgrade` keeps oxy current: |
| 41 |
|
| 42 |
```sh |
| 43 |
sudo curl -fsSLo /usr/share/keyrings/oxygenhub-archive-keyring.gpg https://oxygenhub.io/apt/oxygenhub.gpg |
| 44 |
sudo tee /etc/apt/sources.list.d/oxygenhub.sources >/dev/null <<EOF |
| 45 |
Types: deb |
| 46 |
URIs: https://oxygenhub.io/apt |
| 47 |
Suites: stable |
| 48 |
Components: main |
| 49 |
Signed-By: /usr/share/keyrings/oxygenhub-archive-keyring.gpg |
| 50 |
EOF |
| 51 |
sudo apt update && sudo apt install oxy |
| 52 |
``` |
| 53 |
|
| 54 |
Or download `oxy_VERSION_amd64.deb` (or `_arm64`, `_riscv64`) from a release and run `sudo apt install ./oxy_VERSION_amd64.deb`: from 0.3.1 it adds the repository by itself. It needs glibc 2.28 or later (Debian 10, Ubuntu 20.04 and newer). The repository's key is `82DD DD14 8BC9 0BDF 6006 09E9 522E 288F 265B DE6F`. |
| 55 |
- **Other Linux:** unpack `oxy-VERSION-linux-x86_64.tar.gz` (or `-linux-arm64`) and put `oxy` on your `PATH`. |
| 56 |
- **macOS** (Apple Silicon or Intel): unpack `oxy-VERSION-macos-arm64.tar.gz` (or `-macos-x86_64`), then `xattr -d com.apple.quarantine oxy`, since the build is not notarised, and put it on your `PATH`. |
| 57 |
- **Windows:** unzip `oxy-VERSION-windows-x86_64.zip` and put the folder on your `PATH`. SmartScreen may warn on first run, since the build is not signed. |
| 58 |
- **Haiku** (R1/beta6, x86_64): unpack `oxy-VERSION-haiku-x86_64.tar.gz` and copy `oxy` to `~/config/non-packaged/bin`. It is built in a Haiku guest rather than by OxygenFlow, so it has its own `SHA256SUMS-haiku` and no build attestation. |
| 59 |
|
| 60 |
`oh`, the OxygenHub command line, is released the same way from [OxygenHub's releases](https://oxygenhub.io/andymccall/oxygenhub/releases). |
| 61 |
|
| 62 |
Check a download against the release's `SHA256SUMS` with `sha256sum -c SHA256SUMS --ignore-missing`. |
| 63 |
|
| 64 |
## Building |
| 65 |
|
| 66 |
``` |
| 67 |
cargo build --release |
| 68 |
cargo test --workspace |
| 69 |
``` |
| 70 |
|
| 71 |
The binary is `target/release/oxy`. |
| 72 |
|
| 73 |
On Haiku, install `rust_bin` and `zstd_devel` with pkgman and build with `ZSTD_SYS_USE_PKG_CONFIG=1 cargo build --release`: zstd-sys then links Haiku's libzstd, since a system library also references zstd and ld refuses the bundled copy's hidden symbols. |
| 74 |
|
| 75 |
**Changelog:** a commit that changes code adds a line under `## Unreleased` in CHANGELOG.md (Added, Changed, Fixed or Security, with the issue number); versions change only at release. `scripts/changelog-check.sh [PATH...]` checks it for the paths a commit takes (the working copy's changes without any) and runs in the gate; `NO_CHANGELOG=1` for code changes users won't notice. |
| 76 |
|
| 77 |
## Quick start |
| 78 |
|
| 79 |
``` |
| 80 |
oxy identity create --name "Your Name" --email [email protected] |
| 81 |
oxy config --user core.sign change # sign every commit |
| 82 |
oxy init # in a project directory |
| 83 |
oxy status |
| 84 |
oxy commit -m "First change" |
| 85 |
oxy log # -n 10 for the latest ten, -v for full messages |
| 86 |
oxy log -r 'v0.3.1..main & author(me)' # a revset: set algebra over history |
| 87 |
``` |
| 88 |
|
| 89 |
Output uses colour, glyphs, and relative times on a UTF-8 terminal, and |
| 90 |
falls back to plain ASCII when piped, with `--plain`, or with `NO_COLOR` set. |
| 91 |
|
| 92 |
Collaborating through a hub such as OxygenHub: sign in once, in the |
| 93 |
browser, and every repository on that hub clones, fetches and pushes with it. |
| 94 |
|
| 95 |
``` |
| 96 |
oxy auth login https://oxygenhub.io |
| 97 |
oxy clone https://oxygenhub.io/owner/project |
| 98 |
oxy push |
| 99 |
oxy pull |
| 100 |
``` |
| 101 |
|
| 102 |
Or with your own server: |
| 103 |
|
| 104 |
``` |
| 105 |
oxy serve --root /srv/oxy --bind 0.0.0.0:8890 --tls-cert cert.pem --tls-key key.pem --token SECRET |
| 106 |
echo SECRET | oxy auth login https://host:8890 --with-token |
| 107 |
oxy clone https://host:8890/project |
| 108 |
``` |
| 109 |
|
| 110 |
A repository kept on your own storage, with no server in between (Oxygen |
| 111 |
Strata, see `docs/strata.md`): a bucket in your cloud account, in your |
| 112 |
region, under your keys, or a directory on a shared drive. |
| 113 |
|
| 114 |
``` |
| 115 |
oxy remote add cloud s3://my-bucket/repos/project --profile work # or gs://, az://, dir:// |
| 116 |
oxy remote check cloud # reachable, what it holds, and that it behaves |
| 117 |
oxy push cloud |
| 118 |
oxy clone s3://my-bucket/repos/project?profile=work |
| 119 |
``` |
| 120 |
|
| 121 |
Trust policy, so a server accepts only changes from keys you have granted: |
| 122 |
|
| 123 |
``` |
| 124 |
oxy policy init # your key becomes the root |
| 125 |
oxy identity export # a contributor sends you this file |
| 126 |
oxy policy grant alice.identity |
| 127 |
oxy push # publishes the policy |
| 128 |
``` |
| 129 |
|
| 130 |
Bookmarks (`oxy bookmark create|switch`, `oxy merge`), submodules (`oxy submodule add|update`), |
| 131 |
partial commits (`oxy commit PATH..`, `oxy commit -i`), `oxy blame`, `oxy bisect`, `oxy squash` and |
| 132 |
`oxy rebase` cover the everyday Git toolbox; see the guide. |
| 133 |
|
| 134 |
Working alongside Git: `oxy git import <repo> <dest>` converts a Git history, `oxy git fetch <url>` |
| 135 |
brings new commits of a Git remote into the bookmark, `oxy git push <url>` publishes the bookmark as |
| 136 |
commits on top of them, and `oxy git export <dir>` writes a plain Git mirror. |
| 137 |
|
| 138 |
Keys have a lifecycle: `oxy identity rotate` moves to a fresh key pair (the policy follows), |
| 139 |
`oxy identity renew --expires 365` sets an expiry, `oxy identity delegate add agent.identity --scope changes --expires 8h` |
| 140 |
lets another key sign changes for you (an AI agent, say) for a while without ever being able |
| 141 |
to move a bookmark, and `oxy identity revoke` retires a key. With several root |
| 142 |
keys, `oxy policy root add|remove|threshold` and `oxy policy sign` gather the required signatures |
| 143 |
through proposal files. |
| 144 |
|
| 145 |
## Layout |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
| `crates/oxy-core` | Library: encoding, hashing, objects, the change graph, storage, identities, policy, protocol, repository operations | |
| 150 |
| `crates/oxy-server` | Reference HTTP(S) server for the wire protocol | |
| 151 |
| `crates/oxy-strata` | The S3, Google Cloud Storage and Azure stores a repository can be kept on | |
| 152 |
| `src/cli` | The `oxy` command-line interface | |
| 153 |
| `docs/spec.md` | The specification | |
| 154 |
| `docs/guide.md` | User guide, organised by task | |
| 155 |
| `docs/strata.md` | Keeping a repository on your own storage: S3, GCS, Azure, a directory | |
| 156 |
| `docs/protocol.md` | Wire protocol for other implementers | |
| 157 |
| `docs/prompt.md` | Shell prompt integration | |
| 158 |
|
| 159 |
## Licence |
| 160 |
|
| 161 |
MIT or Apache-2.0, at your option (see `LICENSE`). |