Metadata-Version: 2.5
Name: convergent-cli
Version: 0.1.0
Summary: Convergent command-line interface
Project-URL: Homepage, https://convergent.dev
Project-URL: Source, https://github.com/convergent-technologies/convergent-cli
License-Expression: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: pyyaml<7,>=6.0.3
Requires-Dist: questionary<3,>=2.1.0
Description-Content-Type: text/markdown

# Convergent CLI

`cv` is the Convergent command line tool. It signs in to a Convergent
deployment, sets up coding agents, and reads production issues, findings,
traces, and hosted evaluation runs over the public API.

Implementation: `src/convergent_cli`.

Install on macOS or Linux with Python 3.12 or newer:

```bash
uv tool install convergent-cli
cv --version
```

The [changelog](https://github.com/convergent-technologies/convergent-cli/blob/main/CHANGELOG.md)
lists the commands each release supports. To keep a script on one version, pin
it with `uv tool install convergent-cli==<version>`; add `--force` to change
the pin. `uv tool upgrade convergent-cli` moves an unpinned install to
the newest version. Upgrades keep your profiles and sessions, which live
outside the package (see [Local State](#local-state)).

Run `cv --help` to list the commands. The
[CLI page](https://app.convergent.dev/docs/cli) has more detail.

## Write confirmation

Write commands that ask for confirmation wait for an explicit yes on a
terminal before they store anything. Pass `--yes` or `-y` on that same
invocation to approve the write without a prompt. Use this for scripts and
coding agents. If stdin is not a terminal and you omit the flag, the write
is refused.

```bash
cv findings review er2_... occ_... --judgment incorrect --reason "..." --yes
```

## Hosted Task QC assessments

```bash
cv task-qc assess --task-id TASK --version-id VERSION --yes
cv task-qc get ASSESSMENT_ID --format json
cv task-qc latest --task-id TASK --version-id VERSION
cv task-qc evidence ASSESSMENT_ID SHA256 --out evidence.txt
cv task-qc cancel ASSESSMENT_ID --yes
cv task-qc batch submit --task TASK:VERSION --check CHECK --yes
cv task-qc batch get BATCH_ID
cv task-qc batch cancel BATCH_ID --yes
cv task-qc batch retry BATCH_ID ASSESSMENT_ID --yes
cv task-qc batch scorecard BATCH_ID [BATCH_ID ...] --dataset-id DATASET --dataset-version-id VERSION
cv task-qc batch compare BASELINE CANDIDATE --dataset-id DATASET --dataset-version-id VERSION
```

These commands require a hosted session and an organization with Task QC enabled.
Assessment creation can spend money. Save the printed `Idempotency-Key` and pass
`--idempotency-key KEY` to replay a submission safely. JSON output preserves the
server body and writes the key to stderr. Reads show the server readiness facts;
call `get` again to refresh. Evidence downloads verify the cited SHA256, write a
sibling `.part` file, then replace the destination atomically. Existing output
files require `--force`. Evidence is downloaded locally and is never returned
as MCP file bytes.

`cv task-qc batch submit` takes either repeated `--task TASK_ID:VERSION_ID` values
or both `--dataset-id` and `--dataset-version-id`. It can spend money. Save the
printed `Idempotency-Key` and pass `--idempotency-key KEY` to replay that
submission. `batch get` prints the server status, hold, inventory, and member
readiness. `batch cancel` stops further admissions. `batch retry` asks the
server to retry one preflight sample and can spend one more member launch cap.
These commands do not poll, list batches, or retry on their own.

`batch scorecard` scores batches against the sealed check labels on a dataset
version: per check, each status count, TP, FP, FN and TN, cost and models. More
than one batch of the same selection reads as trials, with how many scored
tasks gave the same verdict in every trial. `batch compare` compares two batches, or two sets of trials with
`--baseline-trial` and `--candidate-trial`, and lists the tasks whose result
changed. The server refuses a different task selection or label set.

The existing `cv task-qc dev` commands run the local development workflow.

## Local world projects

```bash
cv worlds init ./my-world
cv worlds validate ./my-world
cv worlds validate ./my-world --format json
```

These commands need no login, network, Docker, or cloud credentials. `init`
creates an editable starter in an absent or empty directory. It never replaces
an existing project. Use `--name my-world` when the directory name is not a valid
world name. The parent directory must already exist.

`validate` checks contract file paths, TOML and JSON syntax, known field types,
schema file references, the default example, and Compose structure. Contract
files have a limit of 64 files and 512 KiB. These limits do not apply to unrelated
source files. Metadata files must be regular UTF-8 files without symlinks.
Metadata traversal also stops after 4096 filesystem entries, including directories.

Unknown TOML and Compose fields are left to server validation. This lets an older
CLI check worlds that use fields added by a newer server. Local success does not
confirm that the server accepts those fields.

Passing these local checks does not mean server validation or runtime checks
passed. Full JSON Schema evaluation, reference fragments, image access, and image
behavior still need server validation. Offline validation does not build, run, or
register an image.

### Local Docker validation

```bash
cv worlds validate ./my-world --live
cv worlds validate ./my-world --live --task ../private-task --format json
```

`--live` requires a local Unix-socket Docker context and Docker Engine 28 or newer.
It needs no Convergent login. Image pulls and builds may use the network.
It builds the root `Dockerfile`, or pulls `main.image` from `docker-compose.yaml`
when there is no Dockerfile. Live Compose accepts only `services` with `image`
entries. A separate service image may use a tag or a digest. Without Compose, a world
with declared inputs uses a second container from the main image as its service.

The main container has no network. Its image command does not run. Validation
checks its working directory, reserved paths, Python verifier prerequisites,
and exact installed contract files under `/world`. It does not run a verifier,
agent, or model. A main-only world does not need an image start command.

For a service, validation delivers the service's declared inputs from
`examples/default/environment`, or from `TASK/environment` when you pass `--task TASK`. An input
with a schema must be JSON. A `directory = true` input delivers every file under its folder as
raw bytes, outside the contract's 512 KiB text limit, so pass it with `--task`: examples hold
only text. Inputs for `main` (the agent's starting files) are not part of live validation.
Neither directory needs `instruction.md`. Missing optional inputs are allowed.
An explicit task supplies all inputs; missing files do not fall back to the example.
If the world declares no inputs, validation ignores `--task` without reading its path
and reports `task: null`. No example directory is required for worlds without required inputs.
Worlds with required inputs must still bundle those example files.
Private task directories used for inputs must be outside the build context. The command checks input readability as the image user and starts the
image command with the same user and working directory as hosted startup.
It then performs MCP initialization and lists tools. Zero tools fails.
Full JSON Schema validation remains a server check.

The default service endpoint is port 8000 at `/mcp`. Override it in `convergent.toml`:

```toml
[world.service]
port = 8765
path = "/api/mcp"
```

The service and a small MCP probe container share an isolated internal network.
They publish no ports and receive no host mounts or caller environment variables.
The probe uses the official MCP SDK in a generated image with pinned dependencies.
The CLI wheel does not import the server package or install MCP on the host.

Builds and pulls have a combined 20-minute limit. Runtime checks have a 5-minute
limit, including 30 seconds for readiness and 30 seconds for MCP discovery.
Responses are limited to 1 MiB, 16 pages, and 256 tools of up to 128 characters. Docker output is bounded
and is not printed because it can contain private data.

The command removes owned containers, networks, and temporary image tags before
returning. It keeps pulled images and build cache. Cleanup has a separate
30-second limit. If cleanup fails, the report lists the remaining resource names.
Ctrl-C, `SIGTERM`, and `SIGHUP` also run cleanup. If the command is killed before
cleanup, its containers stop and remove themselves after 6 minutes.
Exit codes are 0 for a pass, 1 for a runtime failure, 2 for invalid arguments or
missing prerequisites, and 130 for interruption. JSON output includes named
checks and immutable image IDs. A local pass never registers a world or changes
hosted state. The command catalog marks validation as a write because `--live`
creates local Docker resources; offline validation still only reads files.

### Registering a world

```bash
cv worlds register --image REPOSITORY:TAG --version 1.0
cv worlds register --image docker.io/vendor/tool:1.2 --files ./world-metadata --version 1.0
```

`register` asks the server to register a pushed image as a world version that
only your organization sees. The image can be in any public registry that
serves it without credentials, such as Docker Hub, GHCR or Quay, or in
Convergent's `customer-box` repository under a tag that starts with your
organization id. A private registry that needs credentials is refused. The server pins a tag to its digest once. It reads
the contract from `/world` in the image, or from `--files` for an image with
no `/world`. Then it runs the hosted live check, and it writes the version,
named by `convergent.toml`, only when the check passes. The world runs with no
provider keys. Run the command again with the same arguments to see the
registration: `queued`, `running`, `passed`, `failed` with the reason,
`canceled`, or `exhausted` when the server's infrastructure failed three times.
To register the same arguments again, for example after pushing a fixed image
under the same tag, add `--attempt 2`. A world whose `docker-compose.yaml`
names a service image needs `--files`, so the server can pin that image too. The hosted
check waits up to 180 seconds for the service to listen, longer than the local
30 seconds, so a slow service can pass hosted and fail locally. Errors show the
server's code and message.

### Registering a world from source, and pulling it back

```bash
cv worlds register ./my-world --version 1.0
cv worlds pull my-world@1.0 --out ./my-world-copy
```

Without `--image`, `register` checks the project locally, packs it as a
reproducible tar.gz, and shows the files it will upload. The server builds the
root `Dockerfile` as the world's `main` image, reads the contract from the
archive, and then registers it as above. A `docker-compose.yaml` may add one
service; its `main` names no image. The service names an image for the server
to pin, or names none and is built from `SERVICE/Dockerfile`. The packed
archive leaves out `.git`, `.hg`, `.svn`, `.venv`, `venv`, `node_modules`,
`__pycache__`, `.mypy_cache`, `.pytest_cache`, `.ruff_cache`, `.tox`, `.aws`,
`.docker`, `.gnupg`, `.kube`, `.ssh`, `.DS_Store`, `.env`, `.env.*`, `.envrc`,
`.git-credentials`, `.netrc`, `.npmrc`, `.pgpass`, and `.pypirc` at any depth,
and it does not read `.dockerignore`. Check the listed files before you confirm:
the server keeps the archive for as long as the version exists. It must be 6 MiB
or less compressed. The server keeps the exact archive with the version.

`pull` downloads that archive into an absent or empty directory, `./NAME` by
default. Only your organization can pull its own versions, even public ones.
A version registered from an image has no source and fails with
`source_unavailable`. The command refuses links, special files, paths outside
the directory, and archives over 25 MiB compressed or 100 MiB expanded, and it
writes nothing unless the whole archive extracts.

From the package root, maintainers can refresh the probe dependency lock with:

```bash
printf 'mcp==1.28.1\n' | uv pip compile --python-version 3.12 --python-platform linux --no-annotate --no-header --no-emit-index-url -o src/convergent_cli/world_probe_requirements.txt -
```

## Example Commands

```bash
cv --help
cv --version
cv profile list
cv profile show
cv profile use default
cv login
cv login --headless
cv whoami
cv workspaces list
cv workspaces list --format json
cv workspaces use ws_...
cv workspaces use ws_... --format json
cv environments list
cv environments list --format json
cv agents list
cv agents set --agent-id agt_... --next-major 2
cv agents versions list --agent-id agt_...
cv agents versions register --agent-id agt_... --description "first cut" --model gpt-5
cv agents versions set --agent-id agt_... --version-number 1 --description "the good one"
cv graders create --rubric-id rub_... --definition grader.json
cv graders versions create --grader-id grd_... --definition grader-version.json
cv graders versions activate --grader-id grd_... --version-id gv_... --expected-active-version-id gv_...
cv datasets create --dataset-id ds_... --name "Regression suite"
cv datasets register --manifest dataset.json
cv datasets task-add --dataset-id ds_... --request-file tasks.json --idempotency-key add-1
cv findings review er2_... occ_... --judgment incorrect --reason "why it is wrong"
cv verdicts review er2_... --judgment correct --reason "why it is right"
cv docs list
cv docs list --format json
cv docs read /agent-skills/convergent
cv docs read /agent-skills/convergent --format json
cv agents list --format json
cv logout
cv doctor
```

## Local State

By default `cv` reads and writes:

```text
$XDG_CONFIG_HOME/convergent-cli/config.json
$XDG_CONFIG_HOME/convergent-cli/sessions/<profile>.json
```

When `XDG_CONFIG_HOME` is unset, it falls back to
`~/.config/convergent-cli/config.json`.

Set `CONVERGENT_CLI_CONFIG=/path/to/config.json` to use another file in
tests or automation. Session files live beside that config file, under
`sessions/`.

The config stores `schema_version`, `active_profile`, and profile names with
hosted origins. A profile can also store the selected `workspace_id` after
`cv workspaces use`. It does not store access tokens, refresh tokens, or
derived data-plane tokens. OAuth session material is stored per profile in
`sessions/<profile>.json` with owner-only file permissions on POSIX systems.

Staff calibration tokens are cached separately in `calibration-tokens/` with
those same permissions. Commands reuse a token until 60 seconds before its expiry or a 401
refusal. Concurrent calibration requests serialize control-session refresh.
`cv logout` removes the calibration token cache. Each entry belongs to one control session, origin, organization, and
workspace; changing sessions never reuses another session's credential. The
server continues to restrict tokens to calibration-purpose objects.

`cv calibration finish` sends up to two tenants concurrently. Pass
`--concurrency N` to change that positive bound, or `--concurrency 1` for
serial sends. Each tenant has its own `--send-timeout` budget (default 600
seconds), starting when its send begins. A refused, failed, or timed-out send
is reported alongside the other tenants and makes the command exit nonzero.
Completed sends remain stored; rerunning finish checks the same declaration
and immutable send choices. On an interrupt or an unexpected coordinator error,
finish cancels pending sends without waiting for queued work. JSON output keeps
completed receipts in manifest order and marks unstarted tenants `not_sent`.
An HTTP request already in flight may finish; its unresolved receipt stays
`sending`. Use
`cv calibration show <treatment>` to check stored contributions, including after
a send timeout.

## Hosted Login

```bash
cv login
cv login --profile staging
cv login --profile preview --control-api-url https://app.staging.convergent.dev
cv login --headless
cv whoami
cv logout
```

`cv login` uses the active profile's hosted origin by default. A new named
profile must pass `--control-api-url ORIGIN`; `cv` will not guess an origin
for names it has not seen before.

The built-in public OAuth clients cover the current production and staging
hosted origins:

- `https://app.convergent.dev`
- `https://app.staging.convergent.dev`

For another hosted origin, pass `--client-id CLIENT` or set
`CONVERGENT_CLI_OAUTH_CLIENT_ID`.

## Hosted Workspaces

```bash
cv workspaces list
cv workspaces list --format json
cv workspaces use ws_...
cv workspaces use ws_... --format json
```

`cv workspaces list` reads the active profile's workspaces from the control
API and marks the selected workspace with `*`. With `--format json`, it includes
the active profile, selected workspace id, and the workspace objects returned by
the server. `cv workspaces use` verifies that the workspace is available to
the active profile, then stores only that workspace id in local config. With
`--format json`, it prints a selection receipt with the profile, selected
workspace id, and verified workspace object.

## Hosted Environments

```bash
cv environments list
cv environments list --format json
```

`cv environments list` reads the selected workspace's environments from the
control API (`GET /v1/organization/environments`) and prints the ids a run
can pass to `--environment-id` when the runner type provisions compute.
Archived environments are omitted. With `--format json`, it includes the
active profile, selected workspace id, and the environment ids.

## Hosted Agents

```bash
cv agents list
cv agents list --format json
```

`cv agents list` uses the active hosted profile, resolves a workspace,
discovers that workspace's data plane from the control API, mints a short-lived
data-plane token, and calls `GET /v1/agents` with that derived token. The
derived token is never written to local state.

## Evaluation Datasets

Use `cv datasets` to list, import, create, clone, and edit evaluation datasets.
Structured task writes accept a JSON request file. `task-add` and `task-update`
also accept a complete Harbor tar archive. Versioned edits require the dataset
version that you read and send it as an HTTP `If-Match` condition. A dry run
shows this condition or the `Idempotency-Key` without sending the request.
`task-update --ops-file ops.json` accepts a JSON array of patch operations. Its
dry run calls the server so the server can validate the pinned task package. It
returns the new content hash and the changed file list without writing data.
Task operations require both the `eval-dataset-update` and
`eval-dataset-package-read` capability scopes.
`task-add` takes one or more Harbor archives (repeat `--harbor-archive`, or pass
`--harbor-dir` for every `.tar` file in a directory). It uploads each archive in
6 MiB parts, read from disk one at a time. The server checks an archive of up to
32 MiB at once. An archive over 32 MiB (up to 1 GiB), one with a task of more
than 1,000 files, or one with a symbolic or hard link, is checked by a server-side
staging Job, which the command polls every 5 seconds until it finishes. The Job
stores each link inside a task as a copy of its target. Staging by a Job needs the organization's
`harbor_task_staging_jobs` flag; without it the server answers 403
`feature_not_enabled`. Then one request
adds them all as one new dataset version. If any archive fails, the command lists
every failed archive and adds nothing. `--parallel` sets how many archives upload
at once (default 4). Rerun with the same `--idempotency-key` after an interruption:
staged tasks are named by content, so a rerun stores nothing new.
`task-add --task-type coding` and `import-source --task-type coding` mark every
written task whose `task.toml` sets no `[metadata] task_type` as a coding task,
so Task QC runs its coding checks on it.
`cv datasets register --manifest` posts a trajectory-backed manifest to
`POST /v1/eval-datasets/import/trajectory`.
`cv datasets reference-labels-update --labels-file` patches trusted reference
labels onto one dataset version and mints a successor version. Inspect that
exact version first with `cv datasets get --dataset-version-id --include-reference-labels`.
A Task QC check key, such as `verifier_soundness`, takes a label on any member
task with `expect` set to `pass`, `fail`, `warn` or `not_assessable`. Read those
labels back with `--include-item-reference-labels`.

```bash
cv datasets create --dataset-id ds_... --name "Regression suite"
cv datasets register --manifest dataset.json
cv datasets clone --source-dataset-id ds_... --source-dataset-version-id edv_... \
  --dataset-id ds_clone --name "Editable copy" \
  --idempotency-key clone-1
cv datasets task-add --dataset-id ds_... --request-file tasks.json --idempotency-key add-1
cv datasets task-add --dataset-id ds_... --harbor-dir ./tasks --idempotency-key add-2
cv datasets task-update --dataset-id ds_... --dataset-version-id edv_... \
  --task-id task_... --ops-file ops.json --dry-run --format json
cv datasets membership-update --dataset-id ds_... --dataset-version-id edv_... \
  --task-id task_a --task-id task_b
cv datasets get --dataset-id ds_... --dataset-version-id edv_... \
  --include-reference-labels --task-id task_a --format json
cv datasets reference-labels-update --dataset-id ds_... --dataset-version-id edv_... \
  --labels-file labels.json
cv datasets task-export --dataset-id ds_... --task-id task_a --format tar --output task_a.tar
```

`cv` auto-selects the workspace only when the active profile has exactly one.
If the profile has several workspaces, the command fails before minting a
customer-plane token. Use `cv workspaces use WORKSPACE_ID` to pick one
workspace for later customer-plane commands.

### Agent grader context

```bash
cv agents grader-context get AGENT
cv agents grader-context versions AGENT
cv agents grader-context read-file AGENT PATH
cv agents grader-context put AGENT --file guide.md --file rules.txt
cv agents grader-context archive AGENT --base-version-id agctxv_...
```

`put` replaces the complete file set and asks for confirmation before it writes.
Use `--base-version-id` to protect an existing version from a stale update.
`read-file` returns at most 32,768 characters at a time.

## Agent Versions

```bash
cv agents versions list --agent-id agt_...
cv agents versions list --agent-id agt_... --format json
cv agents versions register --agent-id agt_... --description "first cut" --model gpt-5
cv agents versions set --agent-id agt_... --version-number 1 --custom '{"team": "checkout"}'
cv agents set --agent-id agt_... --next-major 2
```

`--agent-id` takes an agent id or an exact agent name. `list` prints each
version's `version`, `label`, `source`, `description`, `custom`,
`trajectory_count`, and `created_at`, newest first; `--all` follows
`next_cursor`. `register` and `set` print the saved version with the same
fields except `trajectory_count`; use `list` for counts. `register` needs at
least one of `--model`, `--system-instructions`, `--tools`, or a nonempty
`--custom` map. The API
uses the agent's selected identity fields; an identity that already has a version
returns it unchanged. `set` replaces the whole `custom` map. `cv agents set
--next-major` sets the major the agent's next new version starts at; existing
labels never change. Each write shows the fields it will send and asks for
confirmation first.

### Choose version identity fields

Automatic versioning starts off. New invocations share the agent's Default
version (`v0.0.0`) until an administrator enables it. The selected identity
fields start as `model`, `system_instructions`, and `tools`. Enable automatic
versioning and replace that selection with:

```bash
cv agents set --agent-id agt_... --automatic-versioning --identity-fields '["model","custom.acme.prompt_version"]'
cv agents list --format json
cv agents versions register --agent-id agt_... --description "Prompt v2" --model example-model --custom '{"acme.prompt_version":"v2"}'
```

Use `--no-automatic-versioning` to send future invocations back to Default.
Earlier assignments stay unchanged. Without a pending major bump, the first
ordinary version starts at `v1.0.0`. Default has its own positive creation ordinal,
separate from its label.
Agent reads include `automatic_versioning_enabled` and `default_version`.
Version reads include `is_default`. Explicit registration and moves work with
automatic versioning off. Omitting the flag preserves the saved setting.

`custom.acme.prompt_version` reads the literal key `acme.prompt_version` in
custom attributes. Dots do not traverse nested objects. Attach it to the agent
invocation with SDK `attributes={"acme.prompt_version": "v2"}` or an OTel span
attribute of the same name. Existing resource attributes remain a fallback.
No fields are inferred from child spans.

Changing the selection affects future ingestion batches and registrations.
It creates no version by itself and does not backfill or change historical
versions. Matching identities reuse their existing version. Restore defaults
with `--identity-fields '["model","system_instructions","tools"]'`. Empty selections and
duplicate or unsupported references are rejected. Field order has no effect.

See the [instrumentation guide](https://app.convergent.dev/docs/sdk/python/reference/api) for the
complete field mappings, source precedence, and prompt and tool normalization.

## Review a finding or a verdict

`cv findings list --trajectory-id <id>` prints one row per finding on that
trace. Add `--verdict-id er2_...` to keep one verdict. A failed verdict with
several findings gives several rows. Each row has a `verdict_id` and an
`occurrence_id` (`occ_...`).

`cv verdicts list --trajectory-id <id>` prints the latest verdict of each
grader on that trace, passed or failed, like the grader scorecard. Add
`--verdict-id er2_...` to keep one verdict.

```bash
cv findings review er2_... occ_... \
  --judgment incorrect \
  --reason "The finding does not match the trace."

cv verdicts review er2_... \
  --judgment correct \
  --reason "The grader passed this trace correctly."
```

`cv findings review` records feedback on one finding, like the thumbs on a
finding card. `cv verdicts review` records feedback on the whole verdict,
passed or failed, like the thumbs on the grader scorecard. Both show the target
and ask for confirmation before they write. Repeating the same review safely
reuses the first result.

## Register a harness

```sh
cv harness register ./my-agent
cv harness register --image registry.example/my-agent@sha256:<digest> --entrypoint '["python", "/agent.py"]'
```

A directory with a root `Dockerfile` is packed into a reproducible tar.gz (at most 6 MiB, with
no symlinks, and without version-control, cache, credential, and `.env` files) and built on the
server. The root `.dockerignore` applies as it does for `docker build`: what it excludes is not
packed, so it does not count toward the size limit, and a symlink it excludes is not refused. The
server records the image's entrypoint and user as a harness version, then checks that an eval
attempt can install the image and start its entrypoint, without running your code. Only an eval
run has the task's world, inputs, and model, so run one task before a full run. `--image`
registers a pushed image pinned by digest instead. The command waits for the
verdict and exits 1 when the registration fails; running it again with the same files waits on the
same registration, or starts a new one when that one failed or was canceled. `--no-wait` returns once the registration is queued.
`cv datasets harness-register` is the same command.

## Pull, list, and name harness versions

```sh
cv harness versions [--agent AGENT_ID]
cv harness pull HARNESS_VERSION --output ./my-agent-v1
cv harness register --box-config ./my-agent-v2/box-config.json --corpus-root ./my-agent-v2/files \
  --parent HARNESS_VERSION --name "v2" --note "What changed"
cv harness label HARNESS_VERSION --status experiment
```

`pull` writes `box-config.json` (the stored image reference, start command, user, and file list),
`version.json` (name, note, status, parent, and promotion), and the version's files under `files/`,
into an absent or empty directory. It needs the same permission as `register`. A name, note, and
status are labels outside the version's digest; the parent is kept from the version's first
registration. The status is `proposed`, `experiment`, or `archived`. Production is not a status:
a version is in production when it is promoted, and `versions` shows the promoted agent version.

## Run a harness on one task with local Docker

```sh
cv harness run-local ./my-agent --task ./task --world ./my-world --provider anthropic --model claude-haiku-4-5
cv harness run-local --image my-harness:local --task ./task-with-its-own-environment
cv harness run-local --image my-harness:local --task ./task --harness-files ./prompts-v2
cv harness run-local ./my-agent --task ./task --world ./my-world --world-files ./handlers-v2
```

Supply exactly one harness directory with a Dockerfile, or a prebuilt image with `--image`.
`--world` names an unregistered world directory. Without it, the task must bring its own
environment (`environment/Dockerfile`, `[environment].docker_image`, or the supported Compose
file). A task bound to a registered Convergent world runs only hosted; use `cv runs create`,
or pass a directory of that world with `--world`: its `[world].name` must match the task's.
Keep the task outside the world and harness directories, and point `--output` at an absent or
empty directory outside the inputs. Each input directory is copied first: it may hold at most
4,096 entries and 256 MiB, with no file over 64 MiB and no symlinks. The harness directory is
copied as `docker build` sends it: what its `.dockerignore` leaves out is not copied and does not
count toward these limits. `--timeout` caps the agent
phase in seconds; by default it is the task's own agent timeout. A verifier that asks for
`network_mode = "public"` on a task's own environment runs only hosted, and so does a task
with `[[verifier.collect]]` hooks, `[[artifacts]]`, or its own verifier image.

The command needs a login. It first sends the task and the world's contract files to
`POST /v1/harness/preflight`, which runs upload's checks and the hosted run's admission and
returns what to run. The harness, its image, and your provider keys never leave your machine.
Then it runs the attempt on your Docker as a hosted run does: the harness is installed into
the world's main image and runs as uid 10001 in its WORKDIR, the world's service inputs reach
only its service, its `main` inputs are placed in the WORKDIR at their `dest` before the
harness starts, and the hosted verifier grades a fresh main container. A `main` input with an
absolute `dest` is a file for the harness and lands there, outside the WORKDIR. The task's
`trajectory.json` and the files it references reach the harness next to `instruction.md`.
Files under a world's `directory = true` inputs are not sent to preflight:
the command names them, and delivers their bytes from your task directory itself.

`--harness-files DIR` tries a harness version's files without a rebuild. The command packs
every file under `DIR` the way a hosted run packs a version's files: at most 128 files, 16 MB each
and 128 MB in all, no symlinks and no ELF files. The files are relative to `--harness-files-root
PATH`, an absolute image folder, or else to the harness image's WORKDIR, as a hosted version
without `harness_files_root` is. A WORKDIR of `/` is refused. `--harness-files-root /` makes
`DIR` mirror the image from `/`, so each file is an absolute image path, as a hosted version's
absolute `harness_manifest_paths` are. No file may land in a folder the
platform owns: `/convergent`, `/logs`, `/proc`, `/sys`, or `/dev`, or on a file the runtime
writes: `/etc/convergent-ca.pem`, `/run/convergent-container-egress`, `/etc/hosts`, or
`/etc/resolv.conf`. A path with a control character is refused. Before the harness starts, the
wrapper writes each file over the installed image at `PATH/<file>`, as root and read-only. So a
local run reads the same files as a hosted run of a version registered with
`harness_files_root: PATH` and those files. `result.json` records them as a hosted case does:
`harness_overlay` holds the root, the file paths, and the sha256 of the packed tar.

`--world-files DIR` does the same for the world's service, so a change to how a tool behaves
needs no new world image. The files are packed with the same rules, at most 64 files and 512 KiB
in all. They are relative to `--world-files-root PATH`, or else to the service image's WORKDIR,
and a WORKDIR of `/` is refused. No file may land in a folder the platform owns, the service's
input folder, `/world`, or a path starting `/tmp/convergent-world`; a refusal says
`world overlay refused`. After the service's own setup
and before its start command, the service container writes each file at `PATH/<file>`, as root
and read-only, with the image's own `tar`, and removes the bytecode cache of a replaced `.py`
file. A world version does the same with the files under its `files/` folder, relative to
`files_root` in its `convergent.toml` `[world]` table or else to its service image's WORKDIR. A
`--world` directory with a `files/` folder gets them on a local run too, unless `--world-files`
replaces them. The files stay on your machine: the preflight request never carries them. `result.json` records `world_overlay` with the root, the paths, and the sha256.

The harness image must be linux/amd64. On an arm64 machine, build it with
`docker build --platform linux/amd64`, or pass the harness directory, which the command builds
for linux/amd64.

`--provider openai|anthropic|gemini` lets the harness call that provider with the matching
`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, or `GEMINI_API_KEY` from your shell. A world service
or verifier that reads one of these keys gets it only when you pass its `--provider`; no other
variable from your shell reaches a container. Keys reach the containers by name only and are
redacted from the logs. `--model` sets `HARBOR_MODEL`. The harness's container, and a world
service or verifier that reaches a provider, get internet access on a network the run owns.
Docker cannot limit them to the provider's hosts, as hosted runs do, so only pass `--provider`
for a task whose code you trust with your key.

Results include `result.json` with the checklist and reward, `output.json`, `spans.jsonl`, the
agent and verifier logs, the world service's log, the agent's workspace archive, and the
`initial_state` and `workdir` tars. A WORKDIR, less `.git`, over 2 GiB of files or 200,000
entries fails the attempt with agent exit code 76; a hosted run keeps such a tree in a main
image pinned by digest, with no task input in WORKDIR, instead. A completed attempt exits zero for any reward. As on hosted
runs, an agent that exits nonzero, or a world that leaves out a log its task's `[[artifacts]]`
declares, fails the attempt before grading. A failed attempt exits one, a usage or preflight
problem exits two, a missing or rejected login exits three, a refusal from the server exits
four, a server that cannot be reached or answers with an error exits five, and an interruption
exits 130. Every container and network the
run creates is labeled `convergent.local-run` and removed when it ends.

This needs Docker Engine 28 or newer and runs linux/amd64 images, including through Docker
Desktop's emulation on Apple silicon. The harness image needs its own `sh` and `tar`, and the
main image needs Python 3.11 or newer for the verifier. On first use it downloads the pinned
patchelf release and pulls the pinned BusyBox image.
