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.
/plugin marketplace add lambda-script/harnessforce-agent
/plugin install harnessforce@harnessforce-agent
/harnessforce:setupOnce 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:setupinstalls 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
| Hook | What it does |
|---|---|
SessionStart | Registers 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 |
UserPromptSubmit | On the first prompt of a session only, adds that prompt's ID to the registration and sends it again |
PostToolUse, PostToolUseFailure, UserPromptExpansion, PermissionRequest, PostCompact | Count, 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, CwdChanged | After 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 |
Stop | At 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 |
SessionEnd | With 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 errornotice. - 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 loginagain. - If neither is available (for example, in a container that blocks the kernel keyring),
harnessforce loginstops 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
harnessforcecommand points these files at the CLI onPATH, or keeps the CLI they point to while it still exists. harnessforce loginwrites the launcher's full path tootelHeadersHelperand to the Codex hooks. On Windows, a path with a space (such asC:\Users\John Doe) keeps the nameharnessforceinstead.- When
harnessforceisn't onPATH, the hooks run the CLI thatcli.jsonpoints to. harnessforce statusshows which CLI the hooks use, and changes anotelHeadersHelperthat namesharnessforceto 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
| Command | What it does |
|---|---|
harnessforce login | Signs 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 logout | Revokes 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|off | Sets 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 import | Imports 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-headers | Prints 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 -- claudeWhen 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.
| Message | What to do |
|---|---|
The OS keychain is unavailable, so the ingest key cannot be saved | There'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 settings | Make 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` again | Check 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` again | Run 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 denied | Run 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` again | Create 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` again | Run it again |
The view-only role cannot issue an ingest key. Contact a Workspace administrator | Contact 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 page | Members 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 administrator | Contact a workspace administrator |
Could not apply the change on the receiving side. Nothing was changed. Try again | Nothing was changed. Run it again |
Could not save the ingest key. Run `harnessforce login` again | Run it again |
Could not write the Codex configuration. Run `harnessforce login` again | Run 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, andNO_PROXY, including the lowercase namesNODE_TLS_REJECT_UNAUTHORIZED,NODE_EXTRA_CA_CERTS, andNODE_OPTIONSOPENSSL_CONF,SSL_CERT_FILE, andSSL_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.
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.
Read next
- Distribute with managed settings: Roll out to every machine in your organization
- Linking sessions to issues: How hook, CLI, and MCP registrations link to issues
- Semantic conventions: The shape of the data the hooks and CLI send