Skip to content

Capture token usage + auto-detect repo in telemetry#370

Merged
justrach merged 1 commit intomainfrom
fix/telemetry-tokens
Mar 25, 2026
Merged

Capture token usage + auto-detect repo in telemetry#370
justrach merged 1 commit intomainfrom
fix/telemetry-tokens

Conversation

@justrach
Copy link
Copy Markdown
Owner

Telemetry was showing tokens=0 and repo=null for all swarms. Fixed:

  • agent_sdk.zig: extracts usage.input_tokens/output_tokens from Claude CLI result event, appends __USAGE__ marker
  • swarm.zig: parseMetricsFromOutput parses the marker for real token counts
  • swarm.zig: auto-detects repo via git remote get-url origin at swarm startup

🤖 Generated with Claude Code

agent_sdk.zig: parse usage.input_tokens and usage.output_tokens from
Claude CLI result event, append as __USAGE__ marker to output buffer.

swarm.zig: parseMetricsFromOutput now finds the __USAGE__ marker and
extracts tokens_in/tokens_out. Also auto-detects repo from git remote
at swarm startup for telemetry segmentation.

Before: tokens_in=0, tokens_out=0, repo=null in all telemetry
After: real token counts from Claude, real repo name

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@justrach justrach merged commit 353c2c6 into main Mar 25, 2026
2 checks passed
@justrach justrach deleted the fix/telemetry-tokens branch March 25, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant