Cursor Origin
Origin CloneKit: Faster Clones in CI
origin repo clone-fast replaces git clone in CI jobs. It downloads a prebuilt clone kit, a packed snapshot Cursor builds for each repository with CloneKit turned on, then fetches only the objects added since the kit was built. CloneKit is available on Enterprise plans and is turned on per repository, and the job needs a short-lived Origin token in CURSOR_AUTH_TOKEN.

On this page
What does origin repo clone-fast do differently from git clone?
git clone clones from scratch. origin repo clone-fast {owner}/{repo} [DIR] starts from a clone kit instead, a packed snapshot of the repository that Cursor builds ahead of time, and then catches up on whatever changed since. The numbered sequence below is what one run does.
- 1Fetch the kit manifest from Origin using the token in
CURSOR_AUTH_TOKEN. The manifest lists the kit's artifacts and the commit at its tip. - 2Download the pack artifacts from
gitcdn.origin.cursor.comand check their sizes. With--verify, the hashes are checked while the download runs. - 3Install the artifacts into the destination directory, which must be empty.
- 4Top up the clone: fetch the objects added since the kit was built and check out the current tip of the default branch.
The top-up is what makes the result a current clone instead of a stale one. A kit is a snapshot, so on its own it would sit at whatever commit it was built from. The fetch brings in the newer objects and the checkout moves to the default branch tip. Two flags change that last part: --no-top-up leaves the checkout at the kit's tip, and --bare creates a bare repository with no working tree.
When the kit path succeeds the command prints mode: clone-kit on stdout. If any step fails, the default --fallback auto runs a plain git clone and prints mode: git-clone, while --fallback never exits with status 1 instead. A pipeline can therefore stay green without once using the kit, which is why the last section of this page turns the fallback off for the first run.
One more behavior is worth knowing before you wire it in. The clone ends on the default branch tip, so a job that builds a specific commit has to fetch and check it out afterwards, with git fetch origin SHA and git checkout SHA. Origin serves any reachable commit by SHA.
This is covered hands-on in Cursor Compile 2026 — 1 short Unit, free to read.
Rather do it than read about it? Run 11 interactive Cursor walkthroughs in a simulated editor. Free, no account needed.
What do you need before turning CloneKit on?
CloneKit is available on Enterprise plans and is turned on per repository. There is no self-serve toggle, so the first step is a conversation with your Cursor account team about each repository you clone. origin repo clone-fast --help lists the command's options.
The runner needs the Origin CLI, installed with curl -fsSL https://downloads.cursor.com/origin/install.sh | sh, which puts the binary at $HOME/.local/bin/origin. Linux runners need glibc on x64 or arm64, and macOS runners are supported. Alpine and other musl images are not supported. The runner also needs bash, git, jq, curl 7.55 or later and openssl 1.1.1 or later, since clone-fast uses curl for its downloads.
The runner needs network egress to four hosts, and each one covers a different phase of the job.
- Host
downloads.cursor.com- Used for
- Installing the CLI
- Host
origin.cursor.com- Used for
- The kit manifest and git operations
- Host
gitcdn.origin.cursor.com- Used for
- Kit downloads
- Host
api.cursor.com- Used for
- Minting tokens and mirror sync requests from an Origin App
| Host | Used for |
|---|---|
downloads.cursor.com | Installing the CLI |
origin.cursor.com | The kit manifest and git operations |
gitcdn.origin.cursor.com | Kit downloads |
api.cursor.com | Minting tokens and mirror sync requests from an Origin App |
Egress hosts listed in the CloneKit CI docs.
How does the token get onto the runner?
Every CI system ends up in the same place, with a short-lived token exported as CURSOR_AUTH_TOKEN in the shell that runs origin. They differ only in who mints it. Buildkite does it for you through its Agent API, while GitHub Actions, GitLab CI, Jenkins, CircleCI and self-hosted fleets mint their own through an Origin App.
- CI system
- Buildkite (hosted or self-hosted), with Origin connected as the repository provider
- Where the token comes from
- The Buildkite Agent API, in a
checkouthook
- CI system
- GitHub Actions
- Where the token comes from
- Your Origin App, in a workflow step
- CI system
- GitLab CI, Jenkins, CircleCI, self-hosted fleets
- Where the token comes from
- Your Origin App, in the job
| CI system | Where the token comes from |
|---|---|
| Buildkite (hosted or self-hosted), with Origin connected as the repository provider | The Buildkite Agent API, in a checkout hook |
| GitHub Actions | Your Origin App, in a workflow step |
| GitLab CI, Jenkins, CircleCI, self-hosted fleets | Your Origin App, in the job |
The path depends on the CI system, not on the repository.
The one rule that applies everywhere is the expiry. Tokens last at most 15 minutes and cannot be refreshed, so you mint one immediately before the clone. A later job, or a git operation more than 15 minutes after the mint, needs a fresh token from the same request.
On Buildkite, you replace the agent's default checkout with a checkout hook. It requests a token from the Buildkite Agent API scoped to the pipeline's repository, exports it, runs origin repo clone-fast with --verify, registers the credential helper with origin auth setup-git, and checks out $BUILDKITE_COMMIT. The hook cannot live in the repository itself, because the repository is not checked out yet when the hook runs. Connecting Origin takes a Buildkite organization administrator and an Origin administrator to install the Buildkite app.
Three details decide whether that hook works. The repo_url you send must match the URL registered on the pipeline exactly, .git included, or the Agent API returns HTTP 400, so send $BUILDKITE_REPO unchanged. If the Agent API answers HTTP 503, wait for its Retry-After header and retry. And if the agent keeps its build directory between builds, empty $BUILDKITE_BUILD_CHECKOUT_PATH before the hook runs, since clone-fast falls back to git clone when it finds files there.
Everywhere else, you create an Origin App once, install it on the repositories you clone, and hand each job the private key as ORIGIN_APP_PRIVATE_KEY plus two plain variables, ORIGIN_APP_ID and ORIGIN_INSTALLATION_ID. The job signs an app JWT and exchanges it for an installation token that asks for repository:contents:read, which covers clone, fetch and pull. Push needs repository:contents:write, and the installation must have granted it.
The App JWT reference suggests about five minutes, but an installation token never outlives the JWT that minted it. The recipe therefore signs a 15-minute JWT so the token gets its full 15 minutes. The recipe also feeds the private key to openssl through a file descriptor and the bearer header to curl through stdin, so neither shows up on a command line where other processes on the runner could read it.
origin_app_token origin repo clone-fast acme/widgets . --verify origin auth setup-git git fetch origin "$COMMIT_SHA" git checkout -q "$COMMIT_SHA"
How do you run CloneKit in GitHub Actions?
GitHub Actions uses the Origin App path, with one extra step caused by where the code lives. The repository is on GitHub and Origin holds it as a mirror, so the workflow first asks Origin to pull the build's commit and only then clones. It never calls GitHub, which means it needs no GITHUB_TOKEN permissions and does not use actions/checkout.
- 1On the app's page in Origin app settings, select Sync mirrors from upstream (
repository:mirror:sync) under Permissions. If the app is already installed, open the installation's page and select Review & Update. - 2In your repository, go to Settings > Secrets and variables > Actions and add the secret
ORIGIN_APP_PRIVATE_KEYwith the full private key PEM. - 3On the same page, add the repository variables
ORIGIN_APP_IDandORIGIN_INSTALLATION_ID. - 4Save the workflow as
.github/workflows/ci.yml, setORIGIN_REPOto the mirror's{owner}/{repo}on Origin, and add your build steps after the clone step.
The workflow installs the CLI, mints a token, calls Sync Mirror with "wait":true, then clones and checks out the build's commit. github.sha on a pull_request event is a merge commit that exists only on GitHub, so the workflow builds the pull request's head commit and branch instead. Pull requests from forks are not mirrored at all, because their head branch is not in your repository, so those builds have to run from GitHub.
Sync Mirror is documented as its own API call. It accepts the installation token, needs repository:mirror:sync, and returns 200 with "synced": true or 202 with "synced": false once its wait budget of about two minutes runs out. The workflow treats anything but synced as a failure and exits 1. If Origin is the source of truth and GitHub is the mirror, delete the sync request, because the commit is already on Origin and Origin rejects sync requests for repositories that do not pull from an upstream source.
Secret handling carries over from the generic recipe. The workflow masks both the app JWT and the installation token with ::add-mask::, and a later step that needs Origin git access mints again instead of reading the token from $GITHUB_ENV or $GITHUB_OUTPUT, which are files on disk.
How do you verify the first run and read the errors?
Run the first job with --fallback never. A missing kit then fails the job with exit status 1 instead of quietly running a slow git clone, and you keep the flag on until the kit path succeeds. A good run prints clone-kit: manifest=..., one download line per artifact, a clone-kit timings: block and clone-kit: ready DIR (head SHA) on stderr, then mode: clone-kit on stdout, and exits 0.
The timings block splits the run into manifest, download, verify and checkout phases. To measure the gain, compare its total with a plain git clone of the same repository on the same runner. The docs publish no figure for the gain.
When the kit path does not finish, stderr carries one machine-readable line, clone-kit-result: status=fallback phase=PHASE or clone-kit-result: status=failed phase=PHASE, followed by the reason. That line is also the one your Cursor account team asks for if you escalate. The table maps the common messages to their causes.
- Log line
phase=manifestwithHTTP 404- Cause
- No clone kit exists for the repository yet, or the command received a clone URL (
https://twice in the message) instead of{owner}/{repo} - Fix
- Ask your Cursor account team to turn CloneKit on, or pass
{owner}/{repo}
- Log line
manifest fetch failed: HTTP 401- Cause
- Origin rejected the token: expired, never valid, or its installation was removed
- Fix
- Mint a new token immediately before the clone
- Log line
manifest fetch failed: HTTP 403- Cause
- The installation or Buildkite pipeline token does not cover this repository
- Fix
- Reinstall the app or reselect its repositories
- Log line
phase=authwithNot authenticated- Cause
CURSOR_AUTH_TOKENis not exported into the process that runsorigin- Fix
- Export it in the same shell
- Log line
could not read Username for 'https://origin.cursor.com'- Cause
- The CLI is out of date, or the token is not exported where
gitruns - Fix
- Run
origin update, or export the variable
- Log line
401withIssuer is not authorized- Cause
- The
issclaim is not a registered App ID, or the signing key is not registered on that app - Fix
- Confirm
ORIGIN_APP_IDmatches and the app lists the signing key
| Log line | Cause | Fix |
|---|---|---|
phase=manifest with HTTP 404 | No clone kit exists for the repository yet, or the command received a clone URL (https:// twice in the message) instead of {owner}/{repo} | Ask your Cursor account team to turn CloneKit on, or pass {owner}/{repo} |
manifest fetch failed: HTTP 401 | Origin rejected the token: expired, never valid, or its installation was removed | Mint a new token immediately before the clone |
manifest fetch failed: HTTP 403 | The installation or Buildkite pipeline token does not cover this repository | Reinstall the app or reselect its repositories |
phase=auth with Not authenticated | CURSOR_AUTH_TOKEN is not exported into the process that runs origin | Export it in the same shell |
could not read Username for 'https://origin.cursor.com' | The CLI is out of date, or the token is not exported where git runs | Run origin update, or export the variable |
401 with Issuer is not authorized | The iss claim is not a registered App ID, or the signing key is not registered on that app | Confirm ORIGIN_APP_ID matches and the app lists the signing key |
On 401 and 403 the fallback `git clone` fails with the same code and exit status 128, so the log shows both errors.
The trap in this list is origin auth status. It derives Token: valid or Token: expired from the expiry claim inside CURSOR_AUTH_TOKEN and never asks Origin whether the token is accepted, so valid means only that the token has not expired. The CLI also treats a token as expired five minutes before its expiry claim and refuses to make requests with it, which is how clone-fast ends up logging phase=auth with an expired-session message. If the kit path still fails after all of this, send your account team the job log with the clone-kit-result line, the repository and the output of origin --version.
Frequently asked questions
Who can use origin repo clone-fast?
CloneKit is available on Enterprise plans and is turned on per repository. There is no self-serve toggle, so you contact your Cursor account team to turn it on for each repository you clone.
What happens if the clone kit is missing or a step fails?
With the default --fallback auto, the command runs a plain git clone and prints mode: git-clone. With --fallback never it exits with status 1 instead. The docs suggest running the first job with --fallback never so a missing kit fails loudly.
How long does the Origin token last?
At most 15 minutes, and it cannot be refreshed. Mint it immediately before the clone, and mint again for any later job or any git operation more than 15 minutes after the mint.
Sources & last verified
- Cursor docs: CloneKit in CI
- Cursor docs: Install the Origin CLI
- Cursor docs: Build an Origin App
- Cursor docs: Mirror from GitHub
- Cursor API: App JWT
- Cursor API: Create Installation Access Token
- Cursor API: Sync Mirror
Cursor ships frequently. Facts verified against primary sources on October 17, 2026.