agentgolf harness setup claude-code. Add --endpoint <url> for a Self-Hosted Uplink instance. Then set the content limit. See Content length. The rest of this page is for manual setup and content policy.
Settings
The Harness Setup card on Settings > Uplink > Publishing Keys shows these settings for manual setup, with the publishing key inOTEL_EXPORTER_OTLP_HEADERS. agentgolf harness setup claude-code writes the same settings, but keeps the key in the system keychain. See Publishing key in the system keychain and Set up with the CLI. To copy the settings by hand, replace:
<endpoint>withhttps://uplink.agent.golffor Cloud Uplink, or with the listener of your Self-Hosted Uplink instance, for examplehttp://127.0.0.1:4318.<publishing-key>with your personal publishing key. See Publishing keys.
- settings.json
- Shell
Add the variables to the Each user has their own publishing key, so do not put the header in the Claude Code managed settings. To roll out the other variables to every developer, see Team rollout.
env block of ~/.claude/settings.json, or of $CLAUDE_CONFIG_DIR/settings.json, and keep the file’s other settings:claude-code is the default Claude Code service name. Set it anyway: a shell that exports OTEL_SERVICE_NAME for another tool changes the service name of Claude Code. Then Agent Golf does not record the session. Keep the other default settings of Claude Code, and do not set OTEL_METRICS_INCLUDE_SESSION_ID to false.
Publishing key in the system keychain
agentgolf harness setup claude-code saves your publishing key in the system keychain, not in settings.json. agentgolf 0.1.11 added the system keychain. The command writes the env block above without OTEL_EXPORTER_OTLP_HEADERS, and sets the otelHeadersHelper setting to agentgolf otel-headers. Claude Code runs this helper, which reads the key from the system keychain.
- Claude Code must find
agentgolfon itsPATH. If it does not, give the full path of the binary inotelHeadersHelper, for example the output ofcommand -v agentgolf. - When the helper fails, Claude Code exports nothing, and
/statusshows the error. - On a device without a system keychain, run
agentgolf harness setup claude-code --print. It prints the settings with the key inOTEL_EXPORTER_OTLP_HEADERS, and writes no file. Keep the file where you put them readable only by you.
Team rollout
An admin can roll out every variable except the publishing key in the Claude Code managed settings. Each developer then adds only their key, withagentgolf harness setup claude-code. See Roll out to a team.
agentgolf harness managed-settings claude-code prints the managed settings: an env block with each variable above except OTEL_EXPORTER_OTLP_HEADERS. Add --endpoint <url> for a Self-Hosted Uplink instance. See agentgolf harness managed-settings. Install the file in one of these places:
- Linux:
/etc/claude-code/managed-settings.d/agentgolf.json. - macOS:
/Library/Application Support/ClaudeCode/managed-settings.d/agentgolf.json. - Or merge the
envblock into your existingmanaged-settings.json.
agentgolf harness setup --all, or agentgolf harness setup --all --endpoint <url> with the same URL for a Self-Hosted Uplink instance. The command saves their personal publishing key in the system keychain, and sets otelHeadersHelper in ~/.claude/settings.json, or in $CLAUDE_CONFIG_DIR/settings.json. It does not write OTEL_EXPORTER_OTLP_HEADERS.
Claude Code merges env variable by variable. When more than one settings file sets a variable, the file with the highest precedence applies. The managed settings leave OTEL_EXPORTER_OTLP_HEADERS and otelHeadersHelper unset, so the values of each user apply. Between managed-settings.json and the files of managed-settings.d, env also merges key by key.
To lock the helper too, add --otel-headers-helper. The managed settings then also set otelHeadersHelper to agentgolf otel-headers, with --environment <env> for an API other than production. If you merge the env block into managed-settings.json, merge the otelHeadersHelper setting too. A managed otelHeadersHelper wins over the value of each user. See Settings precedence. The helper holds no key: on each device, it reads the personal publishing key of the user from the system keychain. Each device needs agentgolf on the PATH of Claude Code. agentgolf 0.1.11 added the flag and the helper.
Roll out the managed helper in this order:
- Each developer runs
agentgolf harness setup claude-codewith a release that saves the key in the system keychain, 0.1.11 or later. - Then install the managed settings with the helper.
Session content
By default, Claude Code sends lengths, tool names, and token counts, but no text and no tool arguments. These variables add content. The settings above turn on each one:
Remove a variable where your policy does not allow the uplink instance to receive that content. With less content, Agent Golf links fewer sessions to pull requests automatically. See Session content.
Content length
Claude Code truncates each content value at a content limit. The default limit is 61,440 UTF-16 code units. A raw request body holds the full conversation history, so in a long session the default limit can truncate it. When you setOTEL_LOG_RAW_API_BODIES=1, also set the limit to 262144 for the claude process:
env block of ~/.claude/settings.json. Uplink does not read it.
- This value raises the limit. It does not remove it. Claude Code still truncates a longer body.
- If you set
OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT, or one of its log record or span variants, to a lower value, Claude Code truncates at that lower value.
CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH in the Claude Code monitoring reference.
TLS with a private CA
If your Self-Hosted Uplink instance’s certificate comes from a private CA, point Claude Code at the CA bundle:Known limits
- A tool call that fails input validation sends no tool telemetry. The session does not show that call.
- Another failed tool call sends no tool output event. The session shows its outcome, but no output.
Verify the setup
- Start
claudeand send a prompt. Then do the checks in Verify the setup. - If requests show no model, provider, or latency, confirm
CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1andOTEL_TRACES_EXPORTER=otlp. - If Uplink receives requests but no session shows, confirm that
OTEL_SERVICE_NAMEisclaude-codein the environment of Claude Code. - If
/statusshows anotelHeadersHelpererror, run theotelHeadersHelpercommand of your settings in a shell, for exampleagentgolf otel-headers > /dev/null. Exit code3means that the system keychain has no key: runagentgolf harness setup claude-code. For an--environmentother thanprod, setAGENTGOLF_API_BASE_URLto the API of that environment for the setup. Exit code1means that the CLI cannot read the system keychain. If the shell findsagentgolfbut Claude Code does not, give the full path inotelHeadersHelper.