oak/oak

Version control for agents

Sparse clones

Checking out only part of a repository.

A sparse clone checks out only the directories you name:

oak clone acme/monorepo --path services/api --path libs/shared
# or: --path services/api,libs/shared

Add others as you need them:

oak clone acme/monorepo --path services/api
cd monorepo
oak sparse add libs/shared       # brings in libs/shared

oak status and oak commit read only what's checked out, so they stay quick however big the repository is.

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 the same. Commit, push, pull and merge work as in a full clone.

Change the directories

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, at the same history depth, so it needs a clean working tree and nothing unpushed: commit and push first. Directories you already have aren't sent again (the new checkout copies them from the old one), and files already on disk are left as they are. oak sparse disable is refused; clone again with --path / for a full checkout.

Sparse clones and path rules

Sparse clones and path rules use the same mechanism: a directory you can't read is left out of your tree the same way. You choose a sparse clone; path rules are set by whoever manages the repository.

Other ways to clone less

FlagEffect
oak clone --shallowOnly the newest commit on main (or on --branch NAME), no history.
oak clone --from ../other-checkoutReuse content already in another local checkout of the same repo instead of downloading it again.
oak clone --detachedCheck out main's head without making a branch, for read-only tools.

Recovery switch

If a clone or pull fails on a file the server is missing, OAK_ALLOW_PARTIAL_CLONE=1 skips and reports each missing file instead of failing. It's for recovery only; use --path to clone part of a repository on purpose.