Skip to main content
Connect Claude Code to track command-line AI-assisted development and code generation metrics.

What’s tracked

  • Code generation — AI-generated code from Claude Code sessions
  • Session activity — CLI usage frequency and duration
  • Task completion — Tasks completed with AI assistance
  • Tool usage — Which Claude Code features are used
  • Cost tracking — Claude Code usage and costs

Choosing a connection

Weave has three ways to capture Claude Code activity. They measure different things, and you can run all of them at once. Keep telemetry connected even if you add the plugin. It covers sessions on machines where the plugin isn’t installed.

Using them together

Running all three is encouraged, and nothing is double counted:
  • Telemetry and plugin: when both report the same session or prompt, Weave keeps one copy
  • Git attribution: it only changes how code is split between AI and human. When git attribution has data for a developer’s AI tool on a given day, it replaces that tool’s telemetry-based estimate for that day instead of adding to it. Git attribution only counts commits in merged PRs, dated by when the PR merged

Spend per engineer vs. cost per PR

These are two different numbers:
  • Spend per engineer is your AI spend per person. It comes from the most accurate cost source available, and the Claude Enterprise analytics key is the only one that matches your invoice.
  • Cost per PR estimates how much AI usage went into each PR. The plugin records which branch and files each prompt worked on, so Weave can tie that prompt’s cost to the right PR. Without the plugin, Weave can usually only link whole sessions to PRs, which is much rougher.

Prerequisites

  • Claude Code CLI installed
  • Active Claude Code account
  • API access enabled

Setup

Claude Code connects to Weave via managed settings that configure OpenTelemetry export. The easiest way to deploy these settings is through Claude Code’s built-in Admin Settings UI, which automatically distributes the configuration to everyone on your plan.
1

Create a telemetry API key in Weave

Go to Data → Claude Code → Connect, answer How do you pay for Claude Code?, and click Set up telemetry on the Telemetry card (if you selected only Claude Enterprise plan, it’s under Other). Create a new API key and save the configuration JSON. You will only see the full key once.
2

Add to Claude Code Admin Settings (recommended)

If your organization uses Claude for Teams or Enterprise, you can deploy the configuration to all users at once — no scripts or MDM required.
  1. Open the Claude Code Admin Settings page
  2. Paste the configuration JSON from the previous step into the managed settings editor
  3. Save — Claude Code clients automatically pick up the settings on their next launch
This is the simplest approach and works for any team size. See Server-managed settings documentation for details.
3

Alternative: deploy the configuration file manually

If you’re not on Claude for Teams/Enterprise, or need to configure individual machines, you can place a managed-settings.json file directly on each device.Quick install — run a one-liner on each machine (replace CONFIG_URL with the URL shown in the Weave configuration modal):macOS:
Linux:
Windows (PowerShell as Administrator):
For large-scale deployments without Admin Settings, you can also distribute the file via MDM solutions like Fleet, Intune, Kandji, or Jamf.
managed-settings.json sits at the top of Claude Code’s settings precedence — it cannot be overridden by CLI flags, project settings, or a user’s own ~/.claude/settings.json. That makes it reliable for a fleet rollout, but it also means rotating your Weave API key requires re-running the quick install (or re-uploading the file) on every machine — editing any other settings file has no effect while a stale key is baked into managed-settings.json. If telemetry looks like it’s still using an old key after a rotation, this file is almost always why.
4

Verify connection

Run a Claude Code session and check that activity appears in Weave

Using AWS Bedrock or Google Vertex AI

If you’re running Claude Code through AWS Bedrock or Google Vertex AI (Vertex), follow the Setup steps above with one extra change: each user’s configuration must include their email. These providers typically don’t expose the user.account_uuid we normally use to attribute activity, so we fall back to user.email. Append user.email to the OTEL_RESOURCE_ATTRIBUTES value in the configuration JSON, using each developer’s address:
Because the email is per-user, you can’t deploy a single shared managed-settings.json via Admin Settings — distribute a per-user file through your MDM (with user templating) or have each developer set the variable locally.

Metrics enabled

Once connected, you can track:

Cost tracking

Weave shows Claude Code spend per engineer. There are three sources, in order of preference. Weave uses the most accurate one available for each user and day:
  1. Actual billing — Claude Enterprise analytics key (recommended). On a Claude Enterprise plan, add an analytics key from claude.ai/analytics/api-keys (scope read:analytics, created by a Primary Owner). Weave reads the real per-user cost Anthropic billed, broken down by model. This is the only source that reflects your actual invoice rather than an estimate.
  2. Claude Console admin API key. If your Claude Code usage runs through the Anthropic Console, add a Console admin key (sk-ant-admin…) from console.anthropic.com. Weave reads the Console Cost Report (real, organization-level) and the Claude Code usage report (per-user, with Anthropic’s estimated costs by model).
  3. Telemetry (estimated). For everything else, Weave prices the token counts in the OpenTelemetry stream you set up above at list rates (the Telemetry option is badged “Usage + cost data”). It uses Claude Code’s own cost_usd value only when token counts are missing or the model isn’t in Weave’s price list. Either way this is an estimate that ignores any negotiated pricing, and Weave skips it for users the Console usage report lists on a subscription plan.
To add a key, go to Data → Claude Code → Connect. The page first asks How do you pay for Claude Code? Select Claude Enterprise plan to get the API key card (the Claude Enterprise analytics key, option 1) along with the Plugin option. The Console API key card (the Console admin key, option 2) is under Other.

Compliance API (activity and audit feed)

Some Claude Enterprise organizations cannot use the Claude Code plugin (for example, when per-machine installs are blocked). For those cases, Weave can ingest Anthropic’s Compliance API Activity Feed instead. This path provides organization-wide activity and audit data with per-user attribution via account email. It does not replace the analytics key for cost tracking — connect an analytics or Console key separately if you need billed spend. The Compliance API returns unmasked session transcripts (prompts, replies, and tool I/O). Weave only accepts a Compliance API key when prompt retention is enabled for Claude Code: both Prevent prompt text retention and Prevent Claude Code prompt retention must be off under Settings → Organization → General → Prompt retention. If you later turn either one on, Weave disconnects the Compliance API key and permanently deletes stored compliance session transcripts. To set it up:
  1. Confirm Prevent prompt text retention and Prevent Claude Code prompt retention are off under Settings → Organization → General → Prompt retention
  2. In Claude, a Primary Owner enables the Compliance API under Organization settings → Data and privacy → Compliance API
  3. Create a key with the read:compliance_activities scope, plus read:compliance_user_data so Weave can read session transcripts
  4. In Weave, go to Data → Claude Code → Connect, select Other, and click Set up API key on the Compliance API key card
  5. Paste the key and link Claude users to Weave accounts on the Members page
AWS Bedrock and Google Vertex AI deployments are billed by AWS/Google, not Anthropic, so the cost APIs above aren’t available — cost for those falls back to the telemetry estimate.

Claude.ai / Claude web usage

The same Claude.ai Enterprise Analytics API key also surfaces spend for your team’s Claude.ai (web and desktop chat) usage, separate from Claude Code. Once the key is connected, Weave tracks per-user Claude.ai cost alongside Claude Code so you can see total Anthropic spend per engineer. No additional setup is required beyond the analytics key. Admins can link Claude.ai users to Weave accounts from the Members page — use the Claude Code connections column (Claude.ai links appear there alongside Claude Code) — or from the Claude Code configure page.

Sync frequency

Claude Code data syncs in real-time via OpenTelemetry when sessions are active, with a full data sweep every 3 hours.

Troubleshooting

If connection fails:
  1. Verify the API key is valid and not expired
  2. Ensure you have an active Claude Code subscription
  3. Check that API access is enabled in your account
  4. Try regenerating the API key
If Claude Code activity isn’t appearing:
  1. Verify team members are using the latest CLI version
  2. Check that users are logged into Claude Code
  3. Ensure sessions are completing successfully
  4. Wait a few minutes for real-time data, or up to 3 hours for a full sweep
If code generation metrics are missing:
  1. Verify commits include Claude Code metadata
  2. Check that git repositories are connected to Weave
  3. Ensure code changes are being committed
  4. Review attribution settings in Claude Code CLI

Data privacy

Weave syncs usage metadata and prompt content from Claude Code:
  • Session metadata (duration, frequency, terminal type, OS)
  • Lines of code added and removed per session
  • Token usage and costs per model
  • Commit and pull request counts
  • Tool usage decisions (accept/reject counts)
  • User prompt text (used for activity classification; system messages are excluded)
We never access:
  • Source code content or diffs
  • Claude’s responses
  • File paths or project structure
The Claude Code plugin is a separate install. If you add it, it sends more detailed session data, including Claude’s replies.

Turning off prompt collection

Telemetry sends prompt text only because the configuration JSON sets OTEL_LOG_USER_PROMPTS to "1". To stop Claude Code from sending prompt text to Weave, set it to "0" (or remove the line) wherever you deployed the configuration: Claude Code Admin Settings or each machine’s managed-settings.json.
Claude Code picks up the change on its next launch. Usage, cost, and AI code LOC keep working. Prompt-based metrics, such as prompt quality, stop updating because Weave no longer receives the text. To keep prompt-based scoring without keeping the text, leave telemetry as is and turn on Prevent prompt text retention under Settings → Organization → General → Prompt retention. Weave still receives prompts, scores them, and then deletes the text. The same section also lets you wipe prompt text that’s already stored.
  • Claude Code plugin — per-machine plugin for per-developer session telemetry (works on any plan)
  • Cline — VS Code extension alternative
  • Cursor — AI IDE alternative
  • Windsurf — AI IDE alternative
Last modified on October 17, 2026