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.
- Open the Claude Code Admin Settings page
- Paste the configuration JSON from the previous step into the managed settings editor
- Save — Claude Code clients automatically pick up the settings on their next launch
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 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 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: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 theuser.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:
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:- AI code LOC — Lines generated by Claude Code
- AI output percentage — Portion of output from Claude Code
- AI efficiency index — Impact on productivity
- AI tool costs — Claude Code usage costs
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:- 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. - 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). - 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_usdvalue 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.
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:- Confirm Prevent prompt text retention and Prevent Claude Code prompt retention are off under Settings → Organization → General → Prompt retention
- In Claude, a Primary Owner enables the Compliance API under Organization settings → Data and privacy → Compliance API
- Create a key with the
read:compliance_activitiesscope, plusread:compliance_user_dataso Weave can read session transcripts - In Weave, go to Data → Claude Code → Connect, select Other, and click Set up API key on the Compliance API key card
- 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
API key not working
API key not working
If connection fails:
- Verify the API key is valid and not expired
- Ensure you have an active Claude Code subscription
- Check that API access is enabled in your account
- Try regenerating the API key
Sessions not tracked
Sessions not tracked
If Claude Code activity isn’t appearing:
- Verify team members are using the latest CLI version
- Check that users are logged into Claude Code
- Ensure sessions are completing successfully
- Wait a few minutes for real-time data, or up to 3 hours for a full sweep
LOC metrics missing
LOC metrics missing
If code generation metrics are missing:
- Verify commits include Claude Code metadata
- Check that git repositories are connected to Weave
- Ensure code changes are being committed
- 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)
- Source code content or diffs
- Claude’s responses
- File paths or project structure
Turning off prompt collection
Telemetry sends prompt text only because the configuration JSON setsOTEL_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.
Related integrations
- 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
