Skip to content

Managing codebases

A codebase is a reusable starting workspace for a run. Use one when the agent should modify an existing project instead of starting from an empty directory.

Scope separates the codebase's mutable identity from its immutable revisions:

  • The codebase stores its name, slug, description, source type, and Git settings.
  • Each revision is a numbered snapshot such as my-service@r3.
  • A request resolves its codebase selection to one exact revision ID before it is queued.

This keeps a run reproducible even when the Git branch moves or a newer archive is uploaded later.

Source typeUse it forHow revisions are created
Git repositoryA repository hosted on GitHubScope resolves a branch, tag, or commit and snapshots the exact commit.
Uploaded archiveSource supplied as .tar.gz, .tgz, .tar, or .zipEach upload becomes an immutable normalized snapshot.

Git sources use owner/repo format. Uploaded archives are limited to 1 MB by the current ingress configuration.

  1. Open Codebases and select Create Codebase.
  2. Choose Git repository or Uploaded archive.
  3. Enter a name. You can keep the generated slug or edit it.
  4. For Git, enter the GitHub repository and optionally a default branch. For an archive, select the archive file.
  5. Select Create codebase.

Scope immediately tries to create the first revision:

  • A Git codebase resolves its default branch. If GitHub resolution fails, the codebase still exists and you can select Resolve latest later.
  • An archive codebase and its first revision are created together. If the archive cannot be processed, Scope rolls the codebase back.

Create a Git codebase:

Terminal window
scope codebase create \
--name "Inventory service" \
--source-type git \
--source contoso/inventory \
--default-branch main

Create an archive codebase:

Terminal window
scope codebase create \
--name "Inventory fixture" \
--source-type archive \
--archive ./inventory-fixture.tar.gz

Codebase creation and listing use the active project. Use the CLI's --project option when you need to target a different project.

Create a Git codebase:

Terminal window
curl --request POST \
--url 'https://your-scope.example.com/api/v1/codebases?projectId=your-project-id' \
--header 'Content-Type: application/json' \
--data '{
"name": "Inventory service",
"sourceType": "git",
"source": "contoso/inventory",
"defaultBranch": "main"
}'

Archive creation uses multipart/form-data with the metadata fields and a file field named archive. See the Codebases API reference for the generated request schema.

Revisions are immutable and numbered sequentially. Open a codebase in the Portal to inspect its commit or archive provenance, file count, size, content hash, and revision ID. You can also download the normalized .tar.gz snapshot.

Select Resolve latest to snapshot the default branch, or Resolve ref… to resolve a branch, tag, or commit SHA.

CLI equivalents:

Terminal window
scope codebase resolve your-codebase-id
scope codebase resolve your-codebase-id --ref release/2026-10
scope codebase revisions your-codebase-id

API equivalent:

Terminal window
curl --request POST \
--url https://your-scope.example.com/api/v1/codebases/your-codebase-id/revisions \
--header 'Content-Type: application/json' \
--data '{ "requestedRef": "release/2026-10" }'

If the resolved commit is unchanged from the latest revision, Scope reuses that revision instead of creating a duplicate.

In the Portal, select Upload new revision. From the CLI:

Terminal window
scope codebase upload your-codebase-id ./inventory-fixture-v2.zip

If the uploaded content is identical to the latest revision, Scope reuses the existing revision.

You can select codebases in three forms:

ValueBehavior
inventory-serviceUse the latest archive revision, or resolve the Git codebase's default branch at submission time.
inventory-service@r3Pin revision 3.
Revision UUIDPin the exact revision by its internal ID.

On New Run, select Add codebase, then choose the codebase or a specific revision. Scope stores the resolved revision ID on the request before queueing it.

Use --codebase with scope run submit:

Terminal window
scope run submit \
-m "Add input validation to the inventory API." \
-w coder-acp-copilot \
-c validates_request_body \
--codebase inventory-service@r3

Pass a slug, numbered ref, or revision ID in codebase:

Terminal window
curl --request POST \
--url 'https://your-scope.example.com/api/v1/requests?projectId=your-project-id' \
--header 'Content-Type: application/json' \
--data '{
"scenario": {
"task": "Add input validation to the inventory API.",
"criteria": ["validates_request_body"]
},
"workerType": "coder-acp-copilot",
"codebase": "inventory-service@r3"
}'

You can also pass an already resolved revision UUID as codebaseRevisionId.

Before the agent starts, Scope downloads the selected revision and extracts it into the workspace root. Skills and AGENTS.md content are applied after the codebase, so they can add instructions alongside the seeded project.

Codebase seeding is required when a revision is attached. If Scope cannot fetch or extract it, the run fails rather than silently starting from an empty workspace.

Downloaded run archives include the exact starting snapshot as codebase.tar.gz, and run.yaml records its revision and provenance.

Deleting a codebase is a soft delete. It disappears from lists and can no longer be selected for new requests, but its revisions remain available to historical and in-flight runs.

From the CLI:

Terminal window
scope codebase delete your-codebase-id
  • Use a numbered ref such as inventory-service@r3 in CI and published benchmarks.
  • Use a bare Git slug when you intentionally want the branch's current commit at submission time.
  • Review the resolved commit SHA or content hash on the codebase detail page before comparing runs.
  • Keep task prompts independent of repository setup. Select the codebase on the request instead of telling the agent to clone it.