Go to main content
Team agent setupChoose · Review · Connect

CLI reference

Commands and local connection state

Accepted command forms, option values, authorization boundaries, support labels, and local state locations.

Use this reference when you know which operation you need. The diagnostic guide helps you choose an operation when the failure is still unclear.

01 / CLI reference

Read the examples against your installed release

Obtain the approved setup package from the administrator. Release availability is deployment-specific. A source build does not establish that a package has been published.

Use npx @betterloop/setup for initial package invocation. The shorter betterloop command applies when your approved installation provides it.

Substitute HARNESS with claude-code, codex, or mimir. Substitute PATH with an existing local repository. Enclose a path containing spaces in quotes.

PROJECT_ID names a configured knowledge project. KEY names an approved MCP server. UUID names an existing optimization candidate. These examples do not create identifiers.

Read resource identities and pinned versions from the connected catalog. Obtain learning entry and session identifiers from the applicable existing exposure.

Check the available options and installed setup release before relying on a feature.
npx @betterloop/setup --help
npx @betterloop/setup --version

In verify, the double dash separates Betterloop options from the selected program and its arguments. The command runs locally.

Choose a check that evaluates the intended result. A passing unrelated program supplies no evidence that the task or learning entry worked.

02 / CLI reference

Device and repository operations

Device and repository operations
Accepted command formReason to run itEffect
setup --harness HARNESSCreate a device connection or add an agentEnrolls or resumes authorization and enables the selected agent integration.
statusRead the current device connectionInspects state without modifying it.
doctor --harness HARNESS --project PATHInspect a specific agent and repositoryReads diagnostic evidence without modifying the connection.
sync --harness HARNESS --project PATHObtain signed content or retry preparationRefreshes rules and learning, retries bounded events, and reports control coverage.
forget --harness HARNESS --project PATHRebuild the cache for one repositoryArchives that cache while preserving enrolled-device authorization.
uninstall --harness HARNESSStop managing one selected agentRemoves owned integration state and revokes the agent’s restricted credentials.
disconnectLeave the enrolled organization/team connectionRevokes device authorization and disables all managed integrations.
Setup repeats the harness flag. Doctor inspects one selected agent and repository at a time.
betterloop setup --harness claude-code --harness codex
betterloop doctor --harness codex --project /path/to/repository

Uninstall retains the native agent, its provider credentials, and unrelated plugins. Disconnect affects the entire device connection. Choose the intended scope.

A revoked enrollment cannot reconnect through cached credentials. When authorization has been revoked, obtain fresh enrollment rather than reusing an archive.

Explicit older-workflow options

Use --migrate when intentionally converting an existing runtime connection. The first migration needs fresh device enrollment and a matching legacy team.

Use --legacy only when intentionally retaining repository enrollment. Device enrollment is the default setup path. These flags select different workflows.

03 / CLI reference

Options and environment inputs

Options and environment inputs
OptionValueInterpretation
--harnessclaude-code, codex, mimirSelects an agent. Setup repeats the flag; library commands accept comma-separated agent names.
--projectLocal repository pathIdentifies session context while leaving enrollment scoped to the device.
--knowledge-projectConfigured project identifierChooses the intended knowledge match during setup or sync when several matches exist.
--api-urlDeployment URLSelects the deployment endpoint. HTTPS is required except for loopback development.
--jsonNo valueRequests machine-readable results from commands that support this option.
--yesNo valueAccepts installation of a missing agent. Native sign-in and trust still require completion.
--accountcodex, claude-code, cursor, apiSelects the Mimir account route. Native subscription integration and API access remain separate.
--provideropenai, anthropicChooses the provider when using the Mimir API-key route.
Options and environment inputs
Environment variablePurposeRequired handling
BETTERLOOP_ENROLLMENT_CODEPersonal code for unattended device setupLoad through the process environment. Exclude the value from source files and shell history.
BETTERLOOP_PROVIDER_API_KEYProvider secret for Mimir API accessSelect --account api and --provider. Setup transfers the secret through stdin.
BETTERLOOP_API_URLEndpoint for a private deploymentUse the deployment owner’s supplied URL.
BETTERLOOP_HOMESeparate local state location for testsA different directory does not create authorization or restore a revoked connection.

Use the approved secret-loading method for sensitive values. Exclude secrets from command examples and shared diagnostics. Keep them out of repository files.

Provider subscription access does not produce an API key. Confirm that the chosen authentication route is available in your deployment.

04 / CLI reference

Optional resource selection

Optional resource selection
Command formLocal resultReading the result
library browserOpens a read-only catalog session lasting ten minutesPrepared installation commands still require execution on the connected device.
library listLists approved resources available for selectionAvailability alone does not establish installation on any selected agent.
library show IDDisplays the selected catalog recordRead its version, files, instructions, and dependency identities.
library install ID --version VERSION --harness AGENTSInstalls an approved pinned selection locallyRequired organization and team resources remain binding.
library update ID --version VERSION --harness AGENTSChanges the explicitly selected pinned versionThe selection does not track a mutable latest version.
library uninstall ID --harness AGENTSRemoves a developer-selected optional resourceRequired team selections are unaffected by this operation.
library statusReports local selections for each agentSelection state cannot establish later use or execution.
Substitute the catalog-approved identity and exact version for these illustrative values.
betterloop library show org.review
betterloop library install org.review --version 1.0.0 --harness claude-code,codex
betterloop library status

The signed optional manifest binds each selection to the team release and reviewed organization revision. Clients validate scope, expiry, digests, and dependencies.

Missing, expired, revoked, or unsupported selections are disabled. Revocations survive sync. A developer selection cannot reverse a shared revocation.

Successful selections remain when another agent fails. Repair the failed agent’s installation, authentication, or trust. Repeat the operation only for that agent.

05 / CLI reference

MCP account authorization

MCP expands to Model Context Protocol. A reviewed connection definition identifies the server that supplies external tools or resources.

Definition installation, account authorization, tool permission, and verified discovery are distinct results. Completing provider sign-in does not authorize all available tools.

Use the approved KEY and select the agent whose server authorization you intend to manage.
betterloop mcp-auth-status --harness codex --server KEY
betterloop mcp-login --harness codex --server KEY
betterloop mcp-logout --harness codex --server KEY

Approved macOS OAuth connections store tokens in Keychain through the shared Betterloop proxy. A Keychain failure does not trigger plaintext token storage.

A changed endpoint, issuer, resource, or approved scope invalidates authorization reuse. Complete the required authorization for the changed connection before repeating discovery.

New Linux OAuth and Windows device setup or OAuth remain deferred. Existing supported Linux behavior does not imply those deferred additions are available.

06 / CLI reference

Optimization and contribution operations

Optimization and contribution operations
Command formLocal purposeSharing or publication effect
optimize --harness HARNESS --action listFind existing private candidatesDiscovery does not upload local drafts.
optimize --harness HARNESS --candidate UUID --action reviewRead the candidate’s current private revisionOffers a decision to share, retain privately, or dismiss.
optimize --harness HARNESS --candidate UUID --action keepRetain a selected local candidateLeaves the draft private without fleet publication.
optimize --harness HARNESS --candidate UUID --action dismissDismiss the selected candidateStops further notices for that candidate.
optimize --harness HARNESS --action disableTurn off native optimizationDoes not replace the separate connection or shared rules state.
optimize --harness HARNESS --action enableTurn on native optimizationCandidate drafting still supplies advisory material.
optimize --harness HARNESS --candidate UUID --action stageCopy script-backed files to a local staging directoryDoes not stage Git changes or publish a resource.
optimize --harness HARNESS --candidate UUID --action referenceGenerate a reviewable skill variantThe resulting variant still needs the Team Rules Git review process.
contribute --harness HARNESS --candidate UUIDDisplay bounded submission content and request confirmationThe bridge cannot automatically submit the candidate.

Native optimization supports claude-code and codex. Choose an existing candidate UUID. A script-backed candidate needs meaningful passing verification before submission.

Select the candidate and a real test program. Candidate verification uses the staged candidate directory.
betterloop verify --harness codex --candidate UUID -- node tests/check.test.mjs

The program runs directly without a shell. Execution has a two-minute timeout. Verification checks the exact file bytes before and after the run.

A passing receipt identifies the candidate digest. Failure remains neutral; it is not attributed as a fleet lesson failure.

Choose an entry already exposed in the matching session, plus a meaningful repository check.
betterloop verify --harness codex --entry ENTRY_ID --session SESSION_ID -- npm test

A later success report can cite the passing receipt for its existing exposure. A completed model turn cannot supply that verified outcome on its own.

Fleet publication still requires human review and signing. Skill and script variants follow Team Rules review. Executable scripts do not become fleet packs.

07 / CLI reference

Support labels and retained local state

Support labels and retained local state
Reported supportWhat you can conclude
enforcedAn enrolled compatible runtime evaluates the supported action through its native gate.
conditionalThe check depends on the stated execution route and required conditions.
advisoryInstructions are delivered without guaranteed runtime enforcement.
unsupportedThe adapter lacks support for the relevant control, event, catalog version, or runtime version.

Assess support per action and lifecycle event. A required unsupported control prevents a fully governed result. Review the exact required conditions.

Native hook errors or timeouts can permit execution. Client evidence is not independent machine attestation. Native managed settings retain their authority.

Support labels and retained local state
Local locationStored or coordinated stateRecovery consideration
~/.betterloop/setup.lockSerializes installation changesConfirm process exit before removing an abandoned empty lock directory.
~/.betterloop/device/library.lockSerializes catalog selection changesClear an abandoned empty directory only after its library process has exited.
~/.betterloop/runtimes/User-owned stable plugin handlersRuntime handlers remain independent of the temporary npx package cache.
~/.betterloop/removed/Private archives for recoveryRetained revoked credentials cannot restore authorization.
.betterloop/optimizations/UUID/revision-N/Explicit staging copies for candidate verificationFiles are not added to Git through this staging operation.

Use status and doctor for supported inspection. Preserve modified or unowned files during recovery. Select a targeted operation for an isolated resource problem.

The diagnostic guide maps symptoms to repairs. The task recipes combine these command forms into complete procedures.

Prepare your first rollout

Make setup a
team decision.

Bring a repository and a concrete requirement. Agree on the checks that will determine your next step.