Public Beta. This content is updated as features change.

Configure Claude Code

With Harnessforce installed, Claude Code sends telemetry and the plugin hooks register each session's repository, branch, and commit.

View as Markdownllms.txt
Claude Code install commands
/plugin marketplace add lambda-script/harnessforce-agent
/plugin install harnessforce@harnessforce-agent
/harnessforce:setup

Once Harnessforce is installed, Claude Code sends metrics, logs, and traces to Harnessforce over OpenTelemetry. On top of that, the plugin hooks register the repository, branch, and commit of each session, which Harnessforce uses to link sessions to pull requests and issues. This page explains what the hooks, the CLI (harnessforce), and the MCP server do, and what they need to run.

Components

Harnessforce has three components that cover for each other depending on your setup. None of them is the primary one.

  • Plugin: Bundles the hooks, the MCP server configuration, skills, and commands. Both setup methods enable it in Claude Code.
  • CLI (harnessforce): Handles browser sign-in, stores your ingest key, imports past sessions, and starts an agent for a specific issue. When you set up on your own machine, /harnessforce:setup installs it.
  • MCP server: A remote server hosted by Harnessforce. You sign in through your browser once, the first time you use one of its tools.

What the hooks send

HookWhat it does
SessionStartRegisters the session: its ID and the git repository, branch, and commit of the working directory, with the start time. It also sends hashes of the session's configuration, such as skills, rules, hooks, and MCP servers, and never the contents of those files. It doesn't register a session that is resumed (resume) or continued after compaction (compact). It also sends the usage summaries that earlier sessions on this machine couldn't send
UserPromptSubmitOn the first prompt of a session only, adds that prompt's ID to the registration and sends it again
PostToolUse, PostToolUseFailure, UserPromptExpansion, PermissionRequest, PostCompactCount, on your machine, how many times the session calls each skill, command, subagent, and MCP server, how many permission requests it shows, and how many times it compacts. They keep only names and counts, and they don't make Claude Code wait
PostToolUse, CwdChangedAfter a file edit (Write or Edit) and after a change of directory, note the git repository and branch of that working tree. They read only the file path or the new directory, never the edited content
StopAt the end of a turn, sends the repository and branch of each working tree the session worked in, when they differ from the ones it last sent. It doesn't send paths, commits, or file names. This lets Harnessforce link a session to a pull request even when it moved to another branch or worktree
SessionEndWith a workspace ingest key distributed by your organization, sends the counts as the session's usage summary. With your own ingest key, or when sending fails, the next session that starts at least 10 minutes after that session's last activity sends it

The hooks never stop a Claude Code session. If sending fails, or if you start a session outside a git repository, the session carries on. Each send times out after 2 seconds.

If an ingest key has been revoked, the hooks show a message once per session:

  • For your own ingest key, the message tells you to run harnessforce login.
  • For an ingest key distributed by your organization, the message tells you to contact your workspace admin.

When telemetry can't be sent for another reason, the session also shows one line with the fix when it starts: there is no ingest key in the keychain (for example after a reboot cleared the kernel keyring), the keychain can't be read, the destination differs from the one harnessforce login saved, the telemetry settings that harnessforce login wrote are missing from your user settings, the hooks can't find the CLI, or Claude Code can't run otelHeadersHelper (see Switching Node.js versions). Nothing is shown while sending works or later in the session. Codex shows the same warnings in its UI.

Runtime requirements

The hooks ship with the plugin as JavaScript that runs on Node.js 18 or later on your machine. They don't download dependencies at runtime. The minimum is 18 because the hooks send HTTP requests with Node.js's built-in fetch.

  • Without Node.js, the hooks can't start, so no session registration or configuration is sent. Your session and prompts aren't blocked. The transcript may show a hook error notice.
  • On Node.js older than 18, the hooks exit without sending anything.
  • The CLI stores your ingest key and API token in your operating system's keychain: Keychain on macOS and Credential Manager on Windows. On Linux it uses the Secret Service (GNOME Keyring or KWallet). On a machine you reach only over SSH, or where the keyring can't be unlocked, it saves to the kernel keyring instead. It waits up to 60 seconds for you to unlock the Secret Service. The kernel keyring lives in memory and is cleared on reboot or after a period of disuse. Once you use Claude Code in a session where the Secret Service is unlocked, the CLI moves the key there automatically. If the key is cleared before that, follow the warning at session start and run harnessforce login again.
  • If neither is available (for example, in a container that blocks the kernel keyring), harnessforce login stops with an error. There's no fallback that stores keys in plain text. In containers and CI, ask an Owner or Admin to distribute a Workspace ingest key through managed settings.

Switching Node.js versions

With nvm or mise, npm install -g installs the CLI into the current Node.js version, so switching versions removes harnessforce from PATH. To keep sending, the CLI keeps a launcher and a cli.json file in a folder that doesn't depend on the Node.js version: ~/.local/share/harnessforce/bin on macOS and Linux (under XDG_DATA_HOME when set), %LOCALAPPDATA%\harnessforce\bin on Windows.

  • Every harnessforce command points these files at the CLI on PATH, or keeps the CLI they point to while it still exists.
  • harnessforce login writes the launcher's full path to otelHeadersHelper and to the Codex hooks. On Windows, a path with a space (such as C:\Users\John Doe) keeps the name harnessforce instead.
  • When harnessforce isn't on PATH, the hooks run the CLI that cli.json points to.
  • harnessforce status shows which CLI the hooks use, and changes an otelHeadersHelper that names harnessforce to the launcher's path. Restart Claude Code afterward.

Removing the old Node.js version (mise prune, nvm uninstall) also removes the CLI installed into it. The session then shows a warning when it starts; run /harnessforce:setup again to install the CLI into the current version.

CLI commands

CommandWhat it does
harnessforce loginSigns you in through the browser, lets you choose one workspace, issues your personal ingest key and API token, and stores them in the keychain. Writes OpenTelemetry settings without the key, otelHeadersHelper, and the plugin setting to your Claude Code user settings
harnessforce logoutRevokes this machine's ingest key and login in Harnessforce, removes them from the keychain, and removes only the settings harnessforce login wrote
harnessforce config set send-content on|offSets whether this machine sends content. A machine that never chose sends it. harnessforce login reads it, so logging in again doesn't change it (Change the content setting or disconnect)
harnessforce importImports metadata for past sessions stored on your machine, from repositories that are synced through the GitHub App and assigned to a project
harnessforce run --issue <identifier> -- <agent>Starts an agent for a specific issue and links that session to the issue with confidence 1.0
harnessforce otel-headersPrints the Authorization header built from the ingest key in your keychain. Claude Code calls it as the otelHeadersHelper

Running harnessforce login again issues a new ingest key and revokes the old one left in your keychain. Restart Claude Code after harnessforce login.

To link work to an issue when the branch name doesn't contain the issue identifier, start the agent with harnessforce run:

harnessforce run --issue ENG-42 -- claude

When telemetry arrives

harnessforce login sets Claude Code to send metrics, logs, and traces every 60 seconds. Data takes about a minute to appear in Harnessforce after you send a prompt, so wait a minute before checking whether it arrived.

When Claude Code exits, it waits briefly to send what's left. Data it hasn't finished sending by then may be lost, and so may the last minute of data if Claude Code stops without exiting normally.

The status line left by the retired harnessforce usage-limits command

Early versions of the CLI had a harnessforce usage-limits on command that wrapped your Claude Code status line in a harnessforce usage-limits command. Later versions removed that command, so on those machines the status line shows nothing. Update the CLI to the latest version and run harnessforce login to repair it. It copies your Claude Code user settings file next to the original as a backup, then restores the status line the command replaced, or removes the status line so Claude Code's default returns when the replaced one wasn't recorded. It shows one line saying which it did and where the backup is, and deletes the files the retired command left in ~/.harnessforce. It doesn't touch any other status line.

If it can't make the backup, harnessforce login leaves the status line unchanged, writes the other settings, and tells you so. Run harnessforce login again.

When harnessforce login fails

When harnessforce login fails, it prints one of the messages below and exits with a nonzero code. Failures during login don't issue or revoke ingest keys and don't change the keychain or user settings.

MessageWhat to do
The OS keychain is unavailable, so the ingest key cannot be savedThere's no plaintext fallback. In containers and CI, ask an Owner or Admin to distribute a workspace ingest key through managed settings
Cannot read the Claude Code user settingsMake the user settings file readable as a JSON object with env and enabledPlugins as objects, then run it again
Communication with Harnessforce failed. Run `harnessforce login` againCheck your network and run it again. Networks that only reach the internet through a proxy can't send to Harnessforce (Proxies and TLS inspection)
Could not start waiting for the login. Stop the process using port <port>, or specify another port with `harnessforce login --port` Stop the process using that port, or choose another port with harnessforce login --port
The login did not complete in time. Run `harnessforce login` againRun it again and finish signing in and choosing a workspace in the browser that opens, within 5 minutes of the command starting to wait
The login was deniedRun it again and give consent in the browser
You are not a member of any Workspace. Create a Workspace or accept an invitation, then run `harnessforce login` againCreate a workspace on the login page, or join from the link in your invitation email, then run it again
The login failed. Run `harnessforce login` againRun it again
The view-only role cannot issue an ingest key. Contact a Workspace administratorContact a workspace administrator
The number of active ingest keys has reached the limit. Ask members to revoke unused keys in My ingest keys on their account pageMembers revoke keys for machines they no longer use in My ingest keys on their account page
The ingest key limit has been reached. Contact a Workspace administratorContact a workspace administrator
Could not apply the change on the receiving side. Nothing was changed. Try againNothing was changed. Run it again
Could not save the ingest key. Run `harnessforce login` againRun it again
Could not write the Codex configuration. Run `harnessforce login` againRun it again. The ingest key is already saved in the keychain

Importing past sessions

harnessforce import sends only the session ID, first prompt ID, start and end times, repository, branch, model, token counts, and which tools were called and whether they succeeded. It never sends prompts, responses, or tool input and output.

It imports sessions that ended within the window your plan allows: 14 days on Free and 30 days on Team. Claude Code deletes session records older than 30 days by default, so older sessions may no longer be on your machine. Running harnessforce import twice doesn't create duplicate sessions.

It imports only sessions from repositories assigned to a project, because sessions from other repositories aren't stored. After you assign a repository, run harnessforce import again to import its sessions.

Proxies and TLS inspection

Before sending anything, the hooks and harnessforce restart themselves without the following environment variables and connect directly to Harnessforce:

  • HTTP_PROXY, HTTPS_PROXY, and NO_PROXY, including the lowercase names
  • NODE_TLS_REJECT_UNAUTHORIZED, NODE_EXTRA_CA_CERTS, and NODE_OPTIONS
  • OPENSSL_CONF, SSL_CERT_FILE, and SSL_CERT_DIR

A repository's .claude/settings.json can set these variables. If they stayed in place, a server other than Harnessforce could terminate the TLS connection that carries your ingest key.

Warning

On a network that only reaches the internet through a proxy, or behind a proxy that inspects TLS by trusting a custom CA through NODE_EXTRA_CA_CERTS, the hooks and harnessforce can't send data. Claude Code's own telemetry follows Claude Code's environment, so it isn't affected.