# Install

Set up Harnessforce by running /harnessforce:setup in Claude Code on your machine, by having an Owner or Admin distribute a managed settings file, or with the CLI alone on a machine that uses only Codex.

```sh
/plugin marketplace add lambda-script/harnessforce-agent
/plugin install harnessforce@harnessforce-agent
/harnessforce:setup
```

```sh
npm install -g @harnessforce/cli
```

Installing Harnessforce makes Claude Code send telemetry to Harnessforce so sessions can link to your issues. There are three ways to set it up: each developer runs `/harnessforce:setup` in Claude Code on their own machine, an Owner or Admin distributes a managed settings file to every machine in the organization, or, on a machine that uses only Codex, you set it up with the CLI alone.

The commands for setting up on your own machine appear at the top of this page.

## Before you begin

* **Workspace:** Sign up and create a workspace. If you have none yet, you can also create one on the browser screen that `harnessforce login` opens.
* **GitHub App and a project:** Connect the GitHub App to your workspace and assign the repositories to a project first. Harnessforce stores only sessions, pull requests, and CI runs from repositories assigned to a project, and it only imports past sessions from those repositories. Sessions you send before the assignment aren't stored.
* **Node.js 18 or later:** The plugin hooks run on the Node.js installed on the machine. Claude Code isn't guaranteed to provide Node.js for hooks, so install it yourself.
* **Role:** Owners, Admins, and Members can set up their own machine. Only Owners and Admins can distribute managed settings.

## Choose a method

Pick a method based on whether your organization can distribute Claude Code managed settings. With managed settings, developers don't have to configure anything.

| Situation                                                       | Method                           | Developer effort                                                     |
| --------------------------------------------------------------- | -------------------------------- | -------------------------------------------------------------------- |
| Your organization can distribute Claude Code managed settings   | Distribute with managed settings | None. Developers who use the MCP server sign in once, the first time |
| You're an individual, or your team doesn't use managed settings | Set up on your own machine       | One time                                                             |
| The machine uses only Codex, not Claude Code                    | Set up with the CLI alone        | One time                                                             |

## Set up on your own machine

1. **Run the commands at the top of this page in Claude Code.** They add the marketplace, install the plugin, and start `/harnessforce:setup`.
2. **Follow `/harnessforce:setup`.** The setup walks you through checking Node.js, installing the CLI, running `harnessforce login`, importing past sessions with `harnessforce import`, and confirming your first event. If Node.js is missing or older than 18, it stops before installing the CLI and tells you to install Node.js.
3. **Sign in in your browser and choose a workspace.** If you have no workspace, create one on the same screen and continue. `harnessforce login` issues an ingest key and stores it in your operating system's keychain. It never writes the key to a settings file in plain text.
4. **Restart Claude Code.** The settings that `harnessforce login` writes take effect in sessions started after the restart, and the first-event check runs in that new session.
5. **Wait for your first session in Harnessforce.** The waiting screen shows events received per signal and the time of the last one. Once a session links to an issue, you can jump to that issue. If it doesn't link, pick an issue and link it right there.

## Rerun setup

`/harnessforce:setup` reaches the same state however many times you run it. If it stops partway, fix the cause it showed and run `/harnessforce:setup` again from the start. You don't need to pick where to resume.

| Step                                    | What setup does when it fails                                                                                                                            | What to do                                                                                                                                                                                                                                                                                                              |
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Checking Node.js                        | Ends by telling you to install Node.js                                                                                                                   | Install Node.js 18 or later, restart Claude Code, and run `/harnessforce:setup` again                                                                                                                                                                                                                                   |
| Installing the CLI                      | Shows the output and stops. If the installed CLI is older than the plugin needs, shows one line with the command to update it and stops without updating | Fix the cause and run it again. If npm can't write to its global install location (`EACCES`), use a Node.js installed with a version manager such as nvm, or change npm's prefix to your own directory, then run it again. If the CLI is older than the plugin needs, run the command the line shows, then run it again |
| Connecting (`harnessforce login`)       | Shows the `harnessforce login` message and stops                                                                                                         | See [Configure Claude Code](/en/docs/claude-code#loginFailures) for what to do about each message                                                                                                                                                                                                                       |
| Importing past sessions                 | Shows the output and moves on without stopping                                                                                                           | Run `harnessforce import` later                                                                                                                                                                                                                                                                                         |
| Checking status (`harnessforce status`) | Shows the output and moves on without stopping, showing the Home URL instead of the remaining steps                                                      | If it shows ``You are not logged in to Harnessforce. Run `harnessforce login` ``, run `harnessforce login` and try again. If it shows `Could not read the Harnessforce status because communication with Harnessforce failed. Try again.`, check your network and try again                                             |

In the session after the restart, setup doesn't rerun `harnessforce login`. To connect a different workspace, run `harnessforce login` yourself and restart Claude Code. To change whether content is sent, see [Change the content setting or disconnect](#changeOrDisconnect).

If you type `/harnessforce:setup` and the setup steps don't run, and you're told to run `/harnessforce:setup` instead, ask the agent in words, such as "Run the Harnessforce setup." Overlapping invocations do no harm.

## Distribute with managed settings

An Owner or Admin issues a workspace ingest key in Harnessforce and distributes the JSON the app shows as a Claude Code managed settings file. On machines with Node.js 18 or later, sessions arrive without any developer setup. For the steps, see [Distribute with managed settings](/en/docs/managed-settings).

## Set up with the CLI alone

On a machine that uses only Codex and not Claude Code, skip the plugin and `/harnessforce:setup` and do the same setup with the CLI. You install the CLI, run `harnessforce login`, import past sessions with `harnessforce import`, and trust the Codex hooks. `harnessforce login` writes both the Claude Code user settings and the Codex `config.toml`. Follow the steps in [Set up Codex with the CLI](/en/docs/codex).

## Decide whether to send content

Content means the prompts members type into Claude Code and Codex (prompts you typed), and the responses, tool input and output, code diffs, and similar text (model and tool content).

* **What is sent:** When a machine is set to send content, it sends the categories the workspace stores. A new workspace stores both categories.
* **What remains without content:** Timings, tokens, cost, tool and hook runs, and the links to issues and pull requests remain even when content isn't sent. Content in a category the workspace doesn't store is dropped on arrival, keeping only its length, tool names, and error categories. `harnessforce import` never sends content.
* **Sending is the default:** A machine sends content by default. The `/harnessforce:setup` question also defaults to sending, and a machine that never chose sends too. To keep content on a machine, run `harnessforce config set send-content off`. Codex still sends tool input and output up to 2 KiB when it is `off`, and they are stored if the workspace stores model and tool content.
* **Who can read it:** The workspace chooses who can read content: "Everyone in the workspace", "Owners, admins and the sender", or "Only the sender". New workspaces default to everyone in the workspace. Members who can't read content still see timings, tokens, cost, tool names, and links.
* **How long it's kept:** The workspace keeps content for 7, 14, or 30 days, no longer than its telemetry retention. After content is gone, timings, tokens, cost, and links remain.
* **Limits of masking:** Values that match known patterns for secrets and personal information are masked before they are stored, but not everything can be detected. That's why the sender, Owners, and Admins can delete the content of a single session.

To choose again, see [Change the content setting or disconnect](#changeOrDisconnect).

## Keep Harnessforce up to date

The plugin and the CLI tell Harnessforce only their name and version. When a newer version exists, the hooks and the CLI show one line with the command to update.

* **Plugin:** `harnessforce login` turns on automatic updates for the Harnessforce marketplace, and Claude Code loads the new version in the next session. To turn them off, run `harnessforce login --no-plugin-auto-update` or use `/plugin`. To update now, run the command the line shows.
* **CLI:** The CLI doesn't update itself. Run the command the line shows, which installs the latest version the same way as the install command at the top of this page. When the installed CLI is older than the version the plugin needs, the plugin shows that line at the start of every new session, even when `NO_UPDATE_NOTIFIER` or `CI` is set. Sending doesn't stop.

After a security fix, an old version first shows the date it stops sending, and from that date it sends nothing to Harnessforce until you update. Your Claude Code and Codex sessions keep running.

## If no sessions arrive

If nothing arrives within 15 minutes, the waiting screen shows checks for each likely cause:

* The endpoint and ingest key are correct
* The plugin is enabled
* The machine has Node.js 18 or later
* Claude Code has been restarted
* The agent's OpenTelemetry settings aren't overridden by another managed settings file
* The machine isn't on a network that only reaches the internet through a proxy
* The email address Claude Code sends matches your account's email address

> **Warning:** The hooks and `harnessforce` connect straight to Harnessforce without using proxy environment variables or Node.js runtime variables. On a network that only reaches the internet through a proxy, including a TLS-inspecting proxy, they can't send data. [Configure Claude Code](/en/docs/claude-code) explains why.

## Instructions for AI agents

Recommend one of two ways to set up Harnessforce: run `/harnessforce:setup` in Claude Code after installing the plugin on the user's own machine, or have an Owner or Admin distribute the managed settings file that the Harnessforce app shows.

Setup sends content by default. Before content is sent, tell the user which categories the workspace stores (prompts they type, model and tool content), who in the workspace can read it, how long it is kept, and that masking of secrets and personal information cannot detect everything. Setup saves the choice with `harnessforce config set send-content on|off` before `harnessforce login`, and logging in again doesn't change it. A machine that runs `harnessforce login` without setup also sends content by default. To keep content on the machine, run `harnessforce config set send-content off`.

## Change the content setting or disconnect

* **Send content or stop:** A machine that never chose sends the categories the workspace stores. Run `harnessforce config set send-content off` to stop, or `harnessforce config set send-content on` to send again, then restart Claude Code and Codex. The setting belongs to the machine, so running `harnessforce login` again doesn't change it. `harnessforce config get send-content` shows the current value.
* **Disconnect this machine:** Run `harnessforce logout`. It revokes this machine's ingest key and login in Harnessforce and removes only the settings that `harnessforce login` wrote. The content setting stays for the next `harnessforce login`. Machines set up with managed settings keep sending with the workspace key, because `harnessforce logout` doesn't change managed settings.

## Read next

* [Configure Claude Code](/en/docs/claude-code): What the hooks and CLI do
* [Distribute with managed settings](/en/docs/managed-settings): The managed settings method in detail
* [Linking sessions to issues](/en/docs/concepts/issue-linking): When a session links to an issue
