> ## Documentation Index
> Fetch the complete documentation index at: https://docs.originhq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Preview: Capturing Claude Code Activity in WSL2

> Configure WSL2 loopback networking so the Origin agent on the Windows host captures Claude Code OTel activity from inside WSL2, via automatic managed settings or manual settings.json.

<Note>
  **Preview.** Capturing Claude Code activity from inside WSL2 is available in preview. Configuration may change as WSL2 support matures.
</Note>

The Origin agent instruments AI tools that run natively on Windows by pointing their OTel exporter at a local collector on the endpoint's loopback interface (`127.0.0.1:4318` by default — see [Prerequisites](/kb/prerequisites#otlp-collector-port)). Claude Code running inside **WSL2** runs in a separate Linux environment, so it can only reach that collector once WSL2's networking is set up to see the Windows host's loopback interface.

This works with WSL2 configured in either **mirrored** or **NAT** networking mode — the only requirement is that `127.0.0.1` inside WSL2 reaches the Windows host's loopback interface.

## Before you start

* The Origin agent version 1.10.0 or higher installed and verified on the Windows host. See [Windows Install](/getting-started/windows-installation) and [Verifying Agent Installations](/getting-started/verifying-installation).
* WSL2 with a Linux distribution installed.
* WSL2 networking configured (mirrored or NAT) so that `127.0.0.1` inside WSL2 reaches the Windows host's loopback interface — see Step 1.

## Step 1: Confirm WSL2 reaches the host over loopback

### Mirrored networking mode

Mirrored networking mode shares the host's loopback interface with WSL2 directly. On Windows, create or edit `%UserProfile%\.wslconfig`:

```ini theme={null}
[wsl2]
networkingMode=mirrored
```

Restart WSL from an elevated PowerShell or Command Prompt:

```powershell theme={null}
wsl --shutdown
```

Reopen your WSL terminal. With mirrored networking active, `127.0.0.1` inside WSL2 resolves to the same loopback interface as Windows.

<Note>
  Mirrored networking mode requires Windows 11 version 22H2 or later and WSL 2.0.0 or later. Confirm with `wsl --version`.
</Note>

### NAT networking mode

WSL2's default NAT networking mode also works for this capture path, as long as `127.0.0.1` inside WSL2 reaches the Windows host's loopback interface. Verify this from inside your WSL2 terminal before continuing — for example, by confirming a service listening on the host's `127.0.0.1:4318` is reachable.

## Step 2: Ensure the Origin Agent provisions the Open Telemetry Collector settings inside WSL via Claude<br /> Step 2: Configure Claude Code to send OTel data to the agent

* At Origin Agent service startup, it provisions every currently logged-in user’s registered WSL distributions.
* It then waits for Windows SessionLogon events and provisions that user’s distributions again after each logon.
* It does **not** run on a timer, watch WSL files, run for every WSL launch, or run for every Claude session.
* If a distribution is registered while the user remains logged in, it waits until the next Windows logon or Origin Agent restart.

Inside WSL2 — not the Windows filesystem —  `cat /etc/claude-code/managed-settings.d`:

### Automatic — managed settings (recommended)

The Origin agent automatically configures Claude Code running inside WSL2 by writing a managed settings file to:

```text theme={null}
/etc/claude-code/managed-settings.d/90-origin-otel.json
```

Claude Code merges every JSON file it finds in this directory into its managed settings, so no manual edits to `~/.claude/settings.json` are required. This is the default path — confirm capture is working (Step 3) before making any manual changes.

### Manual — settings.json (alternative)

If you need to configure OTel export yourself — for troubleshooting, or on a setup where the automatic managed settings file isn't present — set the following inside WSL2 (not the Windows filesystem) in `~/.claude/settings.json`:

```json theme={null}
{
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "CLAUDE_CODE_ENHANCED_TELEMETRY_BETA": "",
    "OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE": "",
    "OTEL_EXPORTER_OTLP_CLIENT_KEY": "",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "http://127.0.0.1:4318",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
    "OTEL_LOGS_EXPORTER": "otlp",
    "OTEL_LOG_ASSISTANT_RESPONSES": "1",
    "OTEL_LOG_RAW_API_BODIES": "file:/mnt/c/ProgramData/Origin/claude-bodies",
    "OTEL_LOG_TOOL_CONTENT": "",
    "OTEL_LOG_TOOL_DETAILS": "",
    "OTEL_LOG_USER_PROMPTS": "1",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_METRICS_INCLUDE_VERSION": "1"
  }
}
```

<Note>
  `OTEL_LOG_RAW_API_BODIES` points at `/mnt/c/ProgramData/Origin/claude-bodies` — the Windows host path `C:\ProgramData\Origin\claude-bodies`, reached through WSL2's automatic drive mount — so the Origin agent can read the raw bodies directly from the host filesystem.
</Note>

<Warning>
  If your tenant uses a non-default **OTLP collector port** (set fleet-wide under **Settings → Settings**), update `OTEL_EXPORTER_OTLP_ENDPOINT` to match — for example `http://127.0.0.1:<port>`. See [Console Setup](/getting-started/console-setup) and [Prerequisites](/kb/prerequisites#otlp-collector-port).
</Warning>

Restart Claude Code — exit and reopen the CLI — for new settings to take effect.

## Step 3: Verify

Send a prompt from Claude Code inside WSL2, then confirm the session appears against the Windows endpoint in Origin. Follow the **Claude Code** track in [Verifying Agent Installations](/getting-started/verifying-installation).

## Limitations

* This is a preview capability and configuration may change as WSL2 support matures.
* Requires that `127.0.0.1` inside WSL2 reach the Windows host's loopback interface — supported in both **mirrored** and **NAT** networking modes, but depends on your WSL2 configuration.
