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

# Claude Code plugin

> Track Claude Code sessions in Agent Lens for observability and debugging.

The Weave plugin for Claude Code automatically traces every Claude Code session and sends the structured data to Agent Lens. The plugin logs every turn, tool call, and subagent with no code changes required. Use these traces to debug sessions, audit tool usage, and monitor cost and latency across runs.

This guide walks you through installing the plugin, viewing your Claude Code traces in Agent Lens, configuring the plugin, and managing its lifecycle.

<Note>
  This is a Weights & Biases Weave plugin. A CoreWeave Forge version isn't available yet. Traces the plugin sends appear in Agent Lens, because Agent Lens and Weave share the same trace data.
</Note>

<Warning>
  This plugin sends Claude Code session data to Agent Lens. That data can include user prompts, Claude responses, tool inputs and outputs, file contents read by Claude Code tools, shell commands and output, and fetched URLs and page content.

  PII scrubbing and sensitive-data redaction aren't implemented. If you can't send this data to Agent Lens under your security or compliance requirements, don't install this plugin.
</Warning>

## Prerequisites

* [Node.js](https://nodejs.org/) v18 or later (includes `npm`).
* [Claude Code](https://claude.ai/code) installed and authenticated.
* A CoreWeave Forge account and [API key](https://forge.coreweave.com/settings#apikeys) set as a `WANDB_API_KEY` environment variable.
* An Agent Lens project (`[YOUR-TEAM]/[YOUR-PROJECT]`) to receive traces.

## Install the plugin

Install the CLI, run the installer to register the plugin with Claude Code, then start a Claude Code session to begin tracing.

<Steps>
  <Step title="Install the CLI">
    ```bash lines theme={"system"}
    npm install -g weave-claude-code
    ```
  </Step>

  <Step title="Run the installer">
    ```bash lines theme={"system"}
    weave-claude-code install
    ```

    The installer does the following:

    * Creates `~/.weave-claude-code/settings.json`.
    * Registers the plugin in Claude Code.
    * Prompts for your Agent Lens project (`[YOUR-TEAM]/[YOUR-PROJECT]`) and Forge API key if they aren't already set.

    To skip prompts in CI, bootstrap scripts, or other automated systems, set environment variables before running:

    ```bash lines theme={"system"}
    WEAVE_PROJECT=[YOUR-TEAM]/[YOUR-PROJECT] \
    WANDB_API_KEY=[YOUR-API-KEY] \
    weave-claude-code install --non-interactive
    ```

    In non-interactive mode, the installer still creates the config file and registers the plugin. It uses `WEAVE_PROJECT` and `WANDB_API_KEY` from the environment and warns if either is missing.
  </Step>

  <Step title="Start Claude Code">
    ```bash lines theme={"system"}
    claude
    ```

    The plugin traces sessions automatically from this point. Run a prompt or two, then open your Agent Lens project to see the traces appear.
  </Step>
</Steps>

## View Claude Code traces in Agent Lens

After running at least one Claude Code session, open your project in the Agent Lens UI:

1. Navigate to [CoreWeave Forge](https://forge.coreweave.com), select Agent Lens from the product menu, and then select your project in the project selector at the top of the side menu.
2. In the side menu, select **Conversations**.
3. Select the **Conversations** tab to view all agent conversations saved for your project.
4. Select a conversation to inspect the full conversation tree.

For more information about the Conversation tab, see [View agent activity](/products/agent-lens/conversations/view-activity).

Each user prompt produces one OTEL trace that follows the [GenAI semantic conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/). The trace shows a full turn hierarchy:

```text theme={"system"}
invoke_agent claude-code               (Root, one trace per user prompt.)
├─ chat <model>                        (Each LLM call within the turn.)
├─ execute_tool <tool_name>            (Each tool call such as Read, Bash, Grep.)
└─ invoke_agent <subagent_type>        (Subagent dispatched through the Agent tool.)
   ├─ chat <model>
   └─ execute_tool <tool_name>
```

The root `invoke_agent claude-code` span uses the top-level agent name, which defaults to `claude-code`. You can change it with the `agent_name` setting or the `WEAVE_AGENT_NAME` environment variable (see [Configure the plugin](#configure-the-plugin)). Subagents keep their own type names.

Multi-turn conversations are linked server-side by conversation ID, so you can follow a conversation across multiple traces. Each span includes token usage, model name, tool inputs and outputs, timing, and the textual content of prompts and responses. For more information about traced data, see [What Gets Traced](https://github.com/wandb/weave-claude-code/blob/main/README.md#what-gets-traced) in GitHub.

## Configure the plugin

Use the `weave-claude-code config` commands to view or update plugin settings after installation:

```bash lines theme={"system"}
# Show all current settings.
weave-claude-code config show

# Set your Weave project.
weave-claude-code config set weave_project [YOUR-TEAM]/[YOUR-PROJECT]

# Set your Forge API key.
weave-claude-code config set wandb_api_key [YOUR-API-KEY]

# (Optional) Customize the agent name shown in the Conversations tabs.
weave-claude-code config set agent_name [YOUR-AGENT-NAME]
```

By default, conversations appear under the agent name `claude-code` in the Conversations tab. Set `agent_name` to use a different name, for example to distinguish teams or projects. The name can't be empty, and surrounding whitespace is trimmed.

Environment variables take precedence over the settings file:

```bash lines theme={"system"}
export WEAVE_PROJECT=[YOUR-TEAM]/[YOUR-PROJECT]
export WANDB_API_KEY=[YOUR-API-KEY]
export WEAVE_AGENT_NAME=[YOUR-AGENT-NAME]
```

## Agent Lens skills

After installation, three Agent Lens-specific skills are available directly inside any Claude Code session.

| Skill | Command | Description |
| - | - | - |
| Install | `/weave:weave-install` | Walks through the installation and configuration flow interactively. Use this on a fresh machine or to diagnose a broken setup. |
| Status | `/weave:weave-status` | Checks the current plugin status and explains any issues. Equivalent to running `weave-claude-code status`, but Claude interprets the output and tells you what to fix. |
| Config | `/weave:weave-config` | Read or update plugin configuration without leaving Claude Code. |

You can use the `weave:weave-config` skill to set Agent Lens values from within Claude Code:

```text theme={"system"}
/weave:weave-config set weave_project [YOUR-TEAM]/[YOUR-PROJECT]
/weave:weave-config set wandb_api_key [YOUR-API-KEY]
/weave:weave-config set agent_name [YOUR-AGENT-NAME]
```

## Check plugin status

You can use these CLI commands to check plugin status or troubleshoot issues:

```bash lines theme={"system"}
weave-claude-code status
```

Each line shows `✓` (OK), `✗` (action needed), or `-` (not yet active but not an error).

If conversations aren't appearing in Agent Lens, check the daemon log:

```bash lines theme={"system"}
weave-claude-code logs
```

To tail the log in real time:

```bash lines theme={"system"}
weave-claude-code logs --follow
```

The log file is also at `~/.weave-claude-code/logs/daemon.log`.

## Uninstall

To remove the plugin from Claude Code, run:

```bash lines theme={"system"}
weave-claude-code uninstall
```

Pass `--keep-logs` to preserve the log directory.
