Skip to content
FieldmouseWorksPublic

About

The ledger and landing engine for code that agents write, on top of git and GitHub. Rust, early development.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Conary

The ledger and landing engine for code that agents write, on top of git and GitHub.

Why it exists

Code review, approvals, merge queues and release freezes all assume two things: writing a change is slow, and undoing one is expensive. A bad change cost days to write and days to unwind, so it was worth stopping everything to check it first. With agents writing the code, a change takes minutes, and so does a revert. Most of those gates now cost more than the mistakes they catch.

What lets them go is undo you can trust, and undo needs a record git doesn't keep. git knows what changed. It doesn't know why, which agent session made the change, what checked it, or whether that check ran somewhere the agent couldn't touch. Without that, "undo everything that session did, across four repos" is an afternoon of git revert by hand, and "is this green check real" is a guess.

Conary keeps that record and builds on it:

  • Every change has a why. Each pull request becomes a change with its intent (the task, a summary), its author and session, its class, every head it was pushed at, the evidence it landed on, and the landing itself. The record is an append-only, signed op log, anchored on GitHub so a log that loses entries is refused.
  • why works from anywhere. Ask why a line looks the way it does and get the change, its task, its session and its evidence. A fresh clone with no access to the ledger answers from git notes on the landed commits.
  • Evidence has to mean something. Agents don't grade their own work: a result counts only when it came from outside the authoring session and its producer vouches for it. A new test has to fail on the old code. Evidence names the exact tree it ran on, and never stands in for another.
  • Changes land when their proof allows. The train checks every change that's ready with one gate run instead of one per PR, and lands the green ones in order.
  • Anything can be undone. One change, every change one agent session landed, or everything since a point in time. An undo is always a new change through the same flow; nothing is rewritten.
  • Only what undo can't fix waits for a person. Leaked secrets, dropped data and the owner's own decisions (class R2) still need someone to say yes. Everything else lands on evidence.

Conary isn't a new version control system. Agents keep cloning, committing and pushing with plain git, and trunk is the default branch on GitHub. An early draft planned a VCS of its own; that's parked until something turns up that can't be built on git, with the case written down. Nor does it run builds or tests: CI and other runners produce evidence, and Conary records it.

The design, the platform it runs in and what's parked and why live in the Canon.

Where it stands

Early. conaryd lands the repositories its machine configures: it records every PR, decides each change's class (which ones need a review round, and which a person), asks for reviews, runs proofs and the merge train, lands what the evidence allows, and opens undos. cn flow pause OWNER/REPO --reason TEXT (pointed at conaryd's data directory with --data/CONARY_DATA or --events-config/CONARY_EVENTS_CONFIG) stops a repository's landing at once, with no conaryd, GitHub or deploy needed, and cn flow resume carries on from each PR's saved state. cn flow pause --all stops the whole machine's: conaryd then passes a repository only while its records show work to take off (workers, seats, grants, a submitted merge, a deferred run), and once there's none asks GitHub nothing for it until cn flow resume --all.

Where it's going, what's done and what's next are in the Canon's roadmap.

Trying it

Conary records its own PRs, so this repository is the quickest look. With a full clone and cargo:

git clone https://github.com/FieldmouseWorks/Conary && cd Conary
cargo run --release -p conary-cli -- why --human crates/conary-core/src/why.rs:1

cn why fetches the notes from origin and names the PR that last touched that line, what it was for, who made it and what it landed on. After that, git log --notes=conary shows every landed commit's note.

Using it

cn keeps the ledger in $XDG_STATE_HOME/conary (or --ledger) and reads GitHub with GH_TOKEN, or with each repository's own token from a command (CONARY_TOKEN_COMMAND), as a GitHub App's are: one owner's each. The ledger is anchored at a ref in the repository CONARY_ANCHOR_REPO names (the token writes it): cn init sets it up once, and every write moves it on, so a log that loses ops is refused. It prints JSON; add --human for people.

An account the machine trusts, on the command line (LOGIN:ID) or in the flow's configuration ({"login": …, "id": …}), is matched by its numeric id alone: the login is a label, so renaming an App changes only that label. An account's id is gh api users/LOGIN --jq .id (an App's bot is users/SLUG%5Bbot%5D, whose id is the App's accountId, not its App id).

cn init
cn backfill FieldmouseWorks/burrow --reviewer <landing-app>[bot]:<id> \
  --review-author chatgpt-codex-connector[bot]:199175422
cn ingest FieldmouseWorks/burrow 61 --reviewer <landing-app>[bot]:<id> \
  --review-author chatgpt-codex-connector[bot]:199175422
cn sync FieldmouseWorks/burrow owner/repo --reviewer <landing-app>[bot]:<id> \
  --review-author chatgpt-codex-connector[bot]:199175422    # a line per repository; `cn sync --help`
cn log --human
cn why -C ~/src/burrow flake.nix:1 --human
cn at 1762300800000 log --human    # as the ledger stood then (ms since the epoch)
cn verify    # the log against the anchor on GitHub; --full, all of its history
cn ledger segments --human    # the log's sealed segments (docs/standalone.md)

Each write also brings the repository's notes up to date, and cn why in a clone with no ledger beside it answers from them.

cn class says what a PR's class is at a head, and whether it's documentation only, so needs green CI and no review round (class). The policy is a JSON file (CONARY_POLICY) the machine gives it. The PR's labels can only raise it: r2 makes it R2, and review asks for a review round, and a raise stays once it's recorded. The class is recorded once per revision, policy and labels, so asking again costs no more than reading the PR.

cn class owner/repo 174 --head <sha> --human

cn policy FILE checks a policy file the way cn class reads it, refusing a key it doesn't know, so a machine that checks its file when it builds it can't pair a newer policy with an older cn.

A repository's train (the train) is the landing flow's to join, step and land, in conaryd. cn train show prints it as the ledger holds it, and cn train drop drops a candidate whose gate never finished, refused while the machine or the repository is paused.

cn train show owner/repo --human
cn train drop owner/repo <candidate>

cn undo opens the PR that reverts a landed change and records it as the change's undo (undo); by session or time, one PR per repo reverts each change, newest first. A revert that conflicts with what came after it opens all the same, for its conflict to be resolved. Every request needs --reason: a nonblank operational explanation, kept on the undo operation and at the start of its PR body. For a red run, give the run's URL, failing checks and first error line. Reasons enter permanent history: never include secrets, personal data or prompt text.

cn undo owner/repo#174 --reason 'Red run https://github.com/owner/repo/actions/runs/123: check / check failed; error: build failed'
cn undo --actor https://claude.ai/code/session_01... --reason 'The session deployed the wrong configuration'
cn undo --since 1793750400000 --repo owner/repo --reason 'Deployments since this time broke the health check'

cn attest is a CI job's side of the same evidence: it writes a gate's or a negative run's attestation in the format, and with --sign signs it with the job's own OIDC token (the job needs id-token: write).

cn attest revision <base> <head> --result pass --tree <tree> \
  --log flake.log --log-artifact flake-log-<uuid> --out "$RUNNER_TEMP/conary" --sign

cn attest job --audience AUDIENCE --repo OWNER/NAME is a door's side: whether a job's own token, on stdin, may hand the machine something (a job's own token).

cn plugin check PATH checks an executable against the versioned plugin contract, with a copyable Rust example.

cn lessons check checks the lessons register as the gate does, and cn lessons exit M6 is the lessons part of a milestone's exit check: it fails while an open lesson applies to a component the milestone ships (the Canon).

cn --help and each command's --help list the rest, environment variables included.

conaryd serves the same ledger over a Unix socket, as JSON-RPC, for anything on the box, and conary-mcp offers it to agents as MCP tools. A conaryd of its own can tell a gate whether CI already attested a pass on the same tree, and another runs the flow; neither serves the socket. Their calls and configuration are in the Canon.

Building

Plain Cargo is the primary standalone build and check path. The Rust workspace is in crates/ and needs only rustup, cargo, and git on Linux: rustup reads rust-toolchain.toml and installs the toolchain it pins. These are the exact commands the plain-Cargo CI workflow (.github/workflows/cargo.yml) runs (followed by smoke-testing the release tarball and SHA256SUMS produced by .github/workflows/release.yml):

cargo fmt --all -- --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test --workspace --locked
cargo build --release --locked --bin cn --bin conaryd --bin conary-mcp

SQLite, for the cache of GitHub's answers, is compiled in by the default bundled-sqlite feature (a C compiler is all it needs); build with --no-default-features to link the system's libsqlite3 instead.

It runs all of them on each merge train candidate, where it is one of the candidate's checks, so the standalone build gates every landing, and on main; a PR runs the first two, formatting and clippy, for a fast answer.

For standalone Linux installation from release tarballs or plain Cargo, the sample non-NixOS systemd unit (packaging/systemd/conaryd.service), and the audited GitHub App permissions table, see docs/standalone.md.

flake.nix is an optional standalone Nix packaging and dev-shell wrapper with no FieldmouseWorks/burrow dependency. It builds the same binaries wrapped with git and runs the workspace checks in a sandbox (also used by the existing attested gate in .github/workflows/flake.yml):

nix develop        # a shell with the pinned toolchain and git
nix build          # build cn, conaryd and conary-mcp wrapped with git
nix flake check    # rustfmt, clippy, workspace tests, package-git and secrets

License

MIT licensed. See LICENSE.

About

The ledger and landing engine for code that agents write, on top of git and GitHub. Rust, early development.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages