Conversation
Parse additional JSONL fields (session context, usage extras, stop reasons) and derived session metrics into edge_telemetry, with UI and tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the documented Claude JSONL edge telemetry gaps by extracting session metadata, extended usage fields, and derived productivity signals from local logs — without API keys or network calls.
Token Meter already surfaces token counts, cost, tool calls, and context pressure from
~/.claude/projects/*/*.jsonl. Several high-value fields were present in the raw logs but not aggregated. This PR adds a structurededge_telemetryblock to Claude session state and surfaces the most actionable metrics in the dashboard.Scope: Claude Code CLI / Claude Desktop JSONL only. No Anthropic API integration. Codex and Cursor are out of scope for this PR.
Motivation
docs/edge-telemetry.mdcatalogs what Token Meter already collects and what was still missing. The gaps fell into three buckets:userrecords —gitBranch,entrypoint(cli vs vscode), CLIversionservice_tier,speed, ephemeral cache tiers (5m/1h), server-side tool use (web_search,web_fetch)stop_reason, tokens per turn/tool, files edited, repeat queriesThese are all available locally at the edge. This PR implements extraction and display so developers can reason about session quality and efficiency without cloud analytics.
What changed
Backend —
state.edge_telemetry(Claude sessions only)New
claude_edge_telemetry()aggregates:Backward compatibility
edge_telemetryis additive — existing state fields unchangededge_telemetryabsent)history.jsonlis optional; repeat-query metrics degrade gracefully if missingTest plan
python3 -m unittest tests.test_meter -v— 101 passedcurl http://127.0.0.1:8722/statereturnsedge_telemetryfor active Claude sessionend_turnpresentedge_telemetry(no regression)Related
docs/edge-telemetry.mdcursor-telemetrybranch) — agent transcript JSONL +ai-code-tracking.db