agentgolf commands that customers use, with their arguments, flags, and exit codes. Add --help to any command for the same detail, for example agentgolf harness setup --help. agentgolf attribution --help also lists diagnostic commands for Agent Golf support, which this page does not describe.
Workspace commands use the workspace that you selected when you logged in.
harness setup --organization creates a key in the organization of that workspace. logout, otel-headers, and harness managed-settings with --endpoint do not use a workspace. Each command section lists only its own exit codes. For the meaning of each code, and the codes that every command can return, see Exit codes.
agentgolf login
1 when you deny the sign-in or the credential store fails. 4 when the code expires.
agentgolf logout
0 even when no login was saved. The CLI shows Logged out. in both cases.
agentgolf harness setup
--all, it connects each harness that it finds on this machine. Give exactly one of <harness> and --all. The command:
- Signs you in when you are not logged in.
- With
--organization, finds the organization of your workspace. It stops when the workspace has no organization, or when you cannot create a publishing key without a workspace. - Without
--endpoint, reads the endpoint of your workspace’s Cloud Uplink instance. It stops when Cloud Uplink is not on. With--organization, it also stops when your organization runs no Cloud Uplink instance. - Reads the harness settings file. With
--all, it reads the file of each harness that it found before it creates a key. When a setting already has another value, the command stops, names the setting, and creates no key. With--all, it skips only that harness. See All harnesses on the machine. Forclaude-code, it also opens the system keychain. - Creates a personal publishing key for each harness that it sets up. This needs the Connect Your Harness permission. With
--organization, the key has no workspace. - Writes the harness settings: the endpoint, the key in the
x-agentgolf-publishing-keyheader, and every content setting on. The Harness Setup card on Settings > Uplink > Publishing Keys shows the same settings. Forclaude-code, the command saves the key in the system keychain and writes a helper command in place of the header. See Claude Code and the system keychain.
- The command keeps the file’s other settings, their order, and the TOML comments. When the file is a symbolic link with an existing target, the command updates the target. When the target does not exist, the command replaces the link with a file. The file gets mode
0600, because it can hold the key. - A file that a run of this command wrote already holds a key, so a second run for one harness needs
--replace. After--replace, the earlier key stays valid. Revoke it in Settings > Uplink > Publishing Keys. Forclaude-code, the key in the system keychain counts in the same way. See Claude Code and the system keychain. - For
copilot, an existingtelemetry.headersProvideralways counts as another value. The header file also gets mode0600. - Copilot accepts comments and trailing commas in
settings.json. The command reads only strict JSON, and refuses such a file. Remove them, or change a setting withcopilot config: Copilot then writes the file again without them. - A running harness reads its settings only when it starts. Restart the harness after the command.
- A Self-Hosted Uplink instance needs Uplink 0.1.22 or later to link sessions to the owner of the key.
Claude Code and the system keychain
Forclaude-code, the command saves the publishing key in the system keychain: the macOS Keychain, or on Linux the Secret Service, for example GNOME Keyring or KWallet. The entry has the service agentgolf and the user <environment>/claude-code/publishing-key, for example prod/claude-code/publishing-key for https://api.agent.golf. Each environment has one entry, so all Claude Code settings files of one environment use the same key, for example the files of two CLAUDE_CONFIG_DIR profiles. Claude Code then gets the key from agentgolf otel-headers through its otelHeadersHelper setting. agentgolf 0.1.11 added the system keychain. Codex and GitHub Copilot keep the key in their files, and omp gets it from the export lines.
- The command writes the
envblock withoutOTEL_EXPORTER_OTLP_HEADERS, and adds"otelHeadersHelper": "agentgolf otel-headers". For an API other than production, the value isagentgolf otel-headers --environment <env>. The key never goes tosettings.json. - When
settings.jsonhas anOTEL_EXPORTER_OTLP_HEADERSwith another header, the command keeps that header and removes only thex-agentgolf-publishing-keyentry. - Claude Code must find
agentgolfon itsPATH. The output of the command says this too. If Claude Code does not find it, replace the value with the full path of the binary, for example the output ofcommand -v agentgolf. A value with the full path, for example/opt/homebrew/bin/agentgolf otel-headers, counts as the Agent Golf helper, and the command keeps it. - Claude Code runs the helper when it starts and every 29 minutes. When the helper fails, Claude Code exports nothing, and
/statusshows the error. See Dynamic headers. - A key that the system keychain already holds. When a run would replace the stored key, for example the setup of another settings file of the same environment, the command stops and creates no key. The message says that another Claude Code settings file can use the stored key. With
--all, the command skips Claude Code and names the--replacecommand. With--replace, the command creates a new key, and each Claude Code settings file of the environment then uses it. The earlier key stays valid. Revoke it in Settings > Uplink > Publishing Keys. - Move from an earlier release. An earlier CLI wrote the key to
OTEL_EXPORTER_OTLP_HEADERSinsettings.json. Run the command again with the same endpoint, and without--replace,--organization, and--name. The command moves the key to the system keychain, rewrites the file, and creates no key. The output starts withMoved the publishing key from <path> to the system keychain. No key was created.--allmoves the key in the same way.- When the system keychain already holds another key for the environment, the command stops as above.
- In the other cases, the earlier header is a setting with another value, so the command needs
--replace. With--replace, the command creates a new key, and the earlier key stays valid.
- A second run. When the file has the helper and the endpoint of the run, and the system keychain has the key, a second run without
--replacestops and creates no key.--allshowsAlready set up. When the file has the helper but the system keychain has no key, the command creates a key without--replace. - A device without a system keychain, for example a Linux server without a Secret Service.
agentgolf harness setup claude-codestops with exit code1before it creates a key.--allskips Claude Code with one line, and sets up the other harnesses. The CLI never saves the key in a plain file by itself. To set up such a device, runagentgolf harness setup claude-code --print, and put the printed settings where you choose. They hold the key inOTEL_EXPORTER_OTLP_HEADERS.
All harnesses on the machine
With--all, the command sets up each Claude Code, Codex, and GitHub Copilot harness that it finds on this machine. It signs you in once, and reads the endpoint once.
--alldoes not include omp, because omp has no settings file. Runagentgolf harness setup ompfor it.- The command creates one personal publishing key for each harness that it sets up. Each key has the default name, for example
Grace's laptop (Codex). - When the file of a harness already holds the Agent Golf settings with a publishing key, the command creates no key for it and writes nothing. The output shows
Already set up: <Harness> (<path>). No key was created for it.For Claude Code and Codex, this needs the same endpoint as the run. For Claude Code, the system keychain must also hold the key. Copilot settings hold no endpoint, so for Copilot it means only that the publishing-key file and the provider exist. After the line, the command prints the Copilotexportlines. They always show the endpoint of the run. - With
--organization, eachAlready set upline also names the commandagentgolf harness setup <harness> --replace --organization, because the file cannot show the scope of the earlier key.--allnever changes the scope of an existing key by itself. - When the file of a harness has another value for a setting, the command skips that harness: it creates no key for it and writes nothing. The output names the file, the values, and the command
agentgolf harness setup <harness> --replace. That command also has--endpoint,--allow-insecure-endpoint, and--organizationwhen your run had them. The command continues with the other harnesses. - So a second run with the same flags changes nothing and exits with
0. - The output shows the summary of each harness that the command set up, then one line for each harness that is already set up or that it skipped. For Copilot, the summary also has the
exportlines. - When the setup of a harness fails, the command stops with the error. Before the error, it writes to stderr the summary of each harness that it already set up, and the line of each harness that it skipped. Each harness that it set up keeps its key and settings, and a new run without
--replacecan show it as already set up. A skipped harness is not set up. - When the command finds no harness, it stops with exit code
3and creates no key. Give the harness name in place of--all.
Keys without a workspace
With--organization, the command creates a personal publishing key without a workspace in the organization of your workspace. One such key works for all workspaces of the organization. Its sessions belong to the organization, and each workspace sees them through the organization session permissions.
- The key works only on the uplink instances of the organization: the Cloud Uplink instance of the organization, and the Self-Hosted Uplink instances of the organization (Organization Settings > Uplink > Self-Hosted). It does not work on an uplink instance of a workspace.
- Without
--endpoint, your organization must run its Cloud Uplink instance. With--endpoint, give the endpoint of a Self-Hosted Uplink instance of the organization. The command cannot check that the instance belongs to the organization. - You need the Connect Your Harness permission in a workspace of the organization.
- Without
--name, the name of the key ends withorganization, for exampleGrace's laptop (Claude Code, organization). - Revoke the key in Organization Settings > Uplink > Publishing Keys.
1: a setting already has another value and you did not give--replace, or the settings file cannot be read, parsed, or written. Forclaude-code, also when the system keychain cannot be opened, or already holds a key that the run would replace without--replace. With--all, a settings conflict or one of these Claude Code keychain cases skips that harness. A file read or parse error stops the run before it creates a key. A write error stops further setup.2: you give both or none of<harness>and--all, or you give--allwith--nameor--print. Also when the--endpointURL is not valid, or it is anhttpURL on a host that is not loopback without--allow-insecure-endpoint.3: your Agent Golf deployment does not offer Cloud Uplink. With--organization, also when your workspace has no organization. With--all, also when the command finds no harness.5: Cloud Uplink is off for your workspace, or you do not have Connect Your Harness. With--organization, also when your organization runs no Cloud Uplink instance, or your Agent Golf deployment does not offer keys without a workspace.
agentgolf harness managed-settings
agentgolf 0.1.10 added this command. The document holds the endpoint and the content settings. It holds no publishing key, and the command creates no key. Each developer then runs agentgolf harness setup --all to add their personal publishing key. When you gave --endpoint, each developer gives the same URL: agentgolf harness setup --all --endpoint <url>. See Roll out to a team.
- The command writes only the document to stdout, so you can redirect it to a file. It writes one note to stderr that names where to install the file.
- Without
--endpoint, the command signs you in when you are not logged in, and reads the endpoint of your workspace’s Cloud Uplink instance. Cloud Uplink must be on. - With
--endpoint, the command does not sign in and does not call the API. It checks the URL with the same rules asagentgolf harness setup. - The command does not accept
omp, because omp has no settings file. - With
--otel-headers-helper, the Claude Code document also names the helperagentgolf otel-headers, with--environment <env>for an API other than production. When you merge theenvblock intomanaged-settings.json, mergeotelHeadersHelpertoo. A managedotelHeadersHelperwins over the value of each user. See Settings precedence. Each developer still runsagentgolf harness setup claude-code, which saves their personal publishing key in the system keychain, and needsagentgolfon thePATHof Claude Code. The command does not accept the flag forcodexorcopilot. - Install the managed helper only after each developer ran
agentgolf harness setup claude-codewith a release that saves the key in the system keychain, 0.1.11 or later. A helper that fails stops all exports of the device, also on a device that still has the static header of an earlier release.
Exit codes:
2 when the harness is not claude-code, codex, or copilot, you give --otel-headers-helper with codex or copilot, the --endpoint URL is not valid, or it is an http URL on a host that is not loopback without --allow-insecure-endpoint. Without --endpoint, also 3 when your Agent Golf deployment does not offer Cloud Uplink, and 5 when Cloud Uplink is off for your workspace.
agentgolf otel-headers
otelHeadersHelper setting. agentgolf harness setup claude-code writes this setting, and saves the key in the system keychain. Claude Code runs the command when it starts and every 29 minutes. agentgolf 0.1.11 added this command. See Claude Code and the system keychain.
- The command reads only the system keychain. It does not read
AGENTGOLF_API_BASE_URL, does not sign in, and does not call the network. - On success, stdout has one line:
{"x-agentgolf-publishing-key":"<key>"}. - No message on stderr holds the key.
3 when the system keychain has no key for the environment. Stdout is then empty, and stderr names agentgolf harness setup claude-code. For an environment other than prod, the message adds that AGENTGOLF_API_BASE_URL must name the API of that environment. 1 when the system keychain cannot be read.
agentgolf attribute
On success, the command shows
Associated <conversation-id> with <owner>/<repository>#<number>. When the link exists already, Agent Golf keeps it and the command succeeds.
Exit codes: 2 when the URL is not a GitHub pull-request URL. 3 when you have no session with this ID, or your workspace has no such pull request. 5 when you do not have Attribute Own Sessions.
agentgolf attribution
agentgolf attribution audit reads the pull requests of your workspace and their linked sessions.
agentgolf attribution audit
--since up to, but not including, --before. You need the View Pull Requests and Repositories permission.
For example, the pull requests that changed in October 2026:
1 when the --before value is not valid, or it is not later than --since. 2 when a flag is missing, or the --since value is not valid. 5 when you do not have View Pull Requests and Repositories.
agentgolf mcp
read_local_session, which reads local Claude Code, Codex, and GitHub Copilot CLI transcripts. For each tool and the permission that it needs, see MCP Tools. To connect an AI tool without the CLI, for example claude.ai or ChatGPT, use the remote server. See Connect an AI Tool with MCP.
To add the server to an AI tool:
-
Log in with
agentgolf login. -
Add the server to the MCP settings of the AI tool. For example, Claude Desktop and Cursor use this form:
- Restart the AI tool. It lists the tools of the server.
- A desktop app may not have the
PATHof your shell. When the AI tool cannot startagentgolf, give the full path of the binary, for example the output ofcommand -v agentgolf. - The server starts without a login. A tool that reads Agent Golf then returns an error that names
agentgolf login. After you log in, the next call works without a restart. - The token of your login never appears in a tool result.
read_local_sessionreads only files on this machine. It needs no login and sends nothing to Agent Golf. Its excerpts enter the context of your AI tool. Seeread_local_session.- Some tools and transcript formats need a later CLI release. See Local transcripts for the versions. Run
agentgolf --versionto see your version.
0 when the AI tool closes the connection. 1 when the MCP connection does not start, or fails.
Environment variables
harness setup also reads CLAUDE_CONFIG_DIR, CODEX_HOME, COPILOT_HOME, and HOME to find the settings file. With --all, it also reads PATH to find each harness. The login uses XDG_CONFIG_HOME on Linux. See Where the CLI keeps the login.
Output
- The CLI writes the result to stdout. It writes the sign-in instructions, notes, and errors to stderr.
agentgolf mcpwrites only MCP messages to stdout, andagentgolf otel-headerswrites only the header JSON. - Each error has the form
error: <message>. - Each request to the API stops after 10 seconds.
Exit codes
Each command can also stop with
1 when your login is not valid or the CLI cannot reach the API, and with 4 when the API answers that it is not available for a short time.