Public Beta. This content is updated as features change.

Distribute with managed settings

An Owner or Admin distributes the JSON the app shows as a managed settings file, and developers on Node.js 18 or later send sessions with no setup.

View as Markdownllms.txt
Claude Code install commands
/plugin marketplace add lambda-script/harnessforce-agent
/plugin install harnessforce@harnessforce-agent
/harnessforce:setup
Managed settings file
{
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "CLAUDE_CODE_ENHANCED_TELEMETRY_BETA": "1",
    "ENABLE_BETA_TRACING_DETAILED": "1",
    "BETA_TRACING_ENDPOINT": "https://ingest.harnessforce.dev",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_LOGS_EXPORTER": "otlp",
    "OTEL_TRACES_EXPORTER": "otlp",
    "OTEL_METRICS_INCLUDE_ENTRYPOINT": "true",
    "OTEL_LOGS_EXPORT_INTERVAL": "60000",
    "OTEL_TRACES_EXPORT_INTERVAL": "60000",
    "OTEL_METRIC_EXPORT_INTERVAL": "60000",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "https://ingest.harnessforce.dev",
    "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer <ingest key>",
    "OTEL_LOG_USER_PROMPTS": "<1 or 0>",
    "OTEL_LOG_ASSISTANT_RESPONSES": "<1 or 0>",
    "OTEL_LOG_TOOL_DETAILS": "<1 or 0>",
    "OTEL_LOG_TOOL_CONTENT": "<1 or 0>",
    "HARNESSFORCE_ENDPOINT": "https://ingest.harnessforce.dev",
    "HARNESSFORCE_INGEST_KEY": "<ingest key>"
  },
  "extraKnownMarketplaces": {
    "harnessforce-agent": { "source": { "source": "github", "repo": "lambda-script/harnessforce-agent" } }
  },
  "enabledPlugins": { "harnessforce@harnessforce-agent": true }
}

When you distribute Harnessforce through managed settings, developers on machines with Node.js 18 or later send sessions to Harnessforce without configuring anything. 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.

The actual JSON, including the key you issued, appears only in the Harnessforce app. This page explains the shape of the file and how to distribute it.

Before you begin

This procedure is for machines where Claude Code uses file-based managed settings. If a source that takes precedence over the file, such as MDM or server-managed settings, is present, distributing a file alone does not apply the configuration. For those machines, follow Machines with a higher-priority source.

  • Role: You're an Owner or Admin.
  • Machines: Target machines have Node.js 18 or later. The plugin hooks run on the machine's Node.js.
  • Distribution: You can place files in the managed settings directory on target machines.

Steps

  1. Issue a workspace ingest key in Harnessforce. In the workspace's Connections settings, choose "Rotate key" under "Claude Code for everyone" to issue the new key.
  2. Save the JSON exactly as shown as a managed settings file. Use managed-settings.json, or a .json file under managed-settings.d/. The JSON already contains the key you issued and the endpoint.
  3. Distribute the file to the managed settings directory on each machine. The location depends on the operating system.
/Library/Application Support/ClaudeCode/
  1. Confirm that the first session arrives. Sessions arrive once developers start working in Claude Code. The waiting screen in Harnessforce shows what has been received.

File shape

The JSON the app shows has three top-level keys.

KeyContents
envTurns on Claude Code telemetry (metrics, logs, and traces), sets the OpenTelemetry endpoint and the workspace ingest key, and sets HARNESSFORCE_ENDPOINT and HARNESSFORCE_INGEST_KEY for the hooks
marketplaceRegisters the marketplace that distributes the Harnessforce plugin
enabledPluginsEnables the Harnessforce plugin
  • The protocol is http/protobuf.
  • Metrics, logs, and traces are sent every 60 seconds, the same as harnessforce login sets. Data takes about a minute to appear after a prompt (When telemetry arrives).
  • A plugin enabled through managed settings still loads even if a developer disables it in their own settings.
  • The file writes each variable that sends content, such as OTEL_LOG_USER_PROMPTS, as 1 for a category the workspace stores and 0 otherwise. Remove the content lines to let each member choose on their own machine.
  • The file turns on detailed beta tracing (ENABLE_BETA_TRACING_DETAILED and BETA_TRACING_ENDPOINT) so that hook sessions and subagent names arrive. It sends with the ingest key in OTEL_EXPORTER_OTLP_HEADERS, so harnessforce login doesn't write it.

Distribution channel limits

Distribute HARNESSFORCE_ENDPOINT and HARNESSFORCE_INGEST_KEY in a managed settings file. The hooks don't read values distributed through MDM (macOS configuration profiles or the Windows registry) or through server-managed settings. On machines configured that way, the hooks don't send with the workspace ingest key.

The hooks read the workspace ingest key and endpoint only from managed settings files, never from process environment variables. A repository's .claude/settings.json can set environment variables, so reading them would let a repository point the hooks at its own endpoint and collect developers' session registrations.

Warning

When a registration arrives with a workspace ingest key, any issue it names doesn't become a confirmed link. On machines set up through managed settings, sessions link to issues through the issue identifiers in branch names and pull requests. See Linking sessions to issues for the rules.

Machines with a higher-priority source

The JSON distributed as a managed settings file takes effect as is only on machines where Claude Code uses that file as its managed settings source. By default (managedSourcesBehavior is "first-wins"), Claude Code uses only the single highest-priority source that delivers a policy, in this order: server-managed settings (such as the claude.ai console), MDM (a macOS configuration profile or the Windows HKLM registry), then the managed settings file.

  • On a machine with a higher-priority source, the file's marketplace entry and enabledPlugins are not used, and the plugin is not enabled.
  • From Claude Code v2.1.223, the file's env applies only to variables the higher-priority source doesn't set. Earlier versions don't use it at all. If the higher-priority source sets any telemetry variable (OTEL_EXPORTER_OTLP_*, OTEL_LOG_*, OTEL_LOGS_EXPORTER, and so on), none of the file's telemetry variables are used.
  • Even when the organization sets managedSourcesBehavior to "merge" (Claude Code v2.1.242 or later), the marketplace entry and enabledPlugins come only from the highest-priority source that sets that key. If the higher-priority source sets those keys, the file's values are not used.

To distribute to a machine with a higher-priority source:

  1. Add the JSON's entries to the highest-priority source with the same values. Add the marketplace entry, enabledPlugins, and every env entry except HARNESSFORCE_ENDPOINT and HARNESSFORCE_INGEST_KEY. Add them to the highest-priority source listed in the parentheses of Setting sources in /status, in the order remote, plist or HKLM, then file. That source's values are used under both the default and "merge".
    • If that source already sends to another endpoint or with other credentials through OTEL_EXPORTER_OTLP_*, telemetry doesn't reach Harnessforce unless you replace them with this JSON's values.
    • If that source has variables that send content, such as OTEL_LOG_USER_PROMPTS, they apply to sending to Harnessforce as part of the telemetry variables. Give them the same values as this JSON's content variables.
  2. Put HARNESSFORCE_ENDPOINT and HARNESSFORCE_INGEST_KEY in the managed settings file on the same machine. The hooks read these two only from the managed settings file and never from a higher-priority source. The hooks read the file whichever source Claude Code uses. You can put the whole JSON in the file.
  3. Keep the key and endpoint the same. The higher-priority source's OTEL_EXPORTER_OTLP_HEADERS and the file's HARNESSFORCE_INGEST_KEY must hold the same workspace ingest key, and the source's OTEL_EXPORTER_OTLP_ENDPOINT and the file's HARNESSFORCE_ENDPOINT the same endpoint, so session registrations and telemetry reach the same workspace. Using the values of the one JSON the app shows meets this.

When you distribute through server-managed settings:

  • Because the settings include OTEL_EXPORTER_OTLP_ENDPOINT, developers see an approval dialog in their interactive session, and the settings don't apply until they approve. If a developer declines, Claude Code exits. OpenTelemetry exporter settings take effect the next time Claude Code starts.
  • The settings also reach cloud sessions run by Anthropic, but cloud sessions have no managed settings file, so their runs don't link to issues automatically.

To see which source is in use, run /status in Claude Code on the developer's machine and check the Setting sources line (the sources used) and the Skipped sources line (sources found but not used; Claude Code v2.1.242 or later).

Rotate the ingest key

A workspace can have up to two active workspace ingest keys at a time. "Rotate key" issues a new key and lets the old key keep working for 24 hours, so you can switch machines and CI over:

  1. Choose "Rotate key". Copy the new key from the dialog. It is shown only once, and the dialog shows when the old key stops working. If two keys are already active, wait for the old one to expire.
  2. Redistribute the managed settings file with the new key. Put the new key in the JSON, and update HARNESSFORCE_INGEST_KEY wherever you set it.
  3. Confirm the old key has stopped receiving data. Ingestion health shows the last time each key received data.

The old key stops working 24 hours after you rotate.

If a key distributed by your organization is revoked, developers see a message in Claude Code, once per session, telling them to contact their workspace admin.

Plugin updates

harnessforce login doesn't write managed settings. To decide automatic updates for the whole organization, add "autoUpdate": true or false next to source in the marketplace entry of the file above. Claude Code uses that entry as a whole and ignores the one in each developer's user settings.

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.