Telemetry Insights
Scope Detection
| User Request |
Scope |
| "How efficient am I?" |
Current session |
| "Analyze this conversation" |
Current session |
| "this week" / "last 7 days" |
7 days |
| "today" / "last 24 hours" |
1 day |
| "last month" |
30 days |
| "productivity" / "project" / "traces" |
7 days (default historical) |
Data Access
Database: ~/.blueplane/telemetry.db
Schema Reference
Claude Code (claude_raw_traces table):
- Workspace filter:
WHERE cwd LIKE '/path/to/workspace%' (NOT workspace_hash)
- Token fields:
input_tokens, cache_creation_input_tokens, cache_read_input_tokens, output_tokens
- Model field:
message_model (e.g., "claude-sonnet-4-5-20250929")
- Role field:
message_role ('user' | 'assistant')
- Branch field:
git_branch
Cursor (cursor_sessions + cursor_raw_traces tables):
- Step 1: Get
workspace_hash from cursor_sessions WHERE workspace_path LIKE '/path/to/workspace%'
- Step 2: Get
composer_ids from cursor_raw_traces WHERE event_type='composer' AND workspace_hash=?
- Step 3: Filter bubbles by extracting composer_id from
item_key: "bubbleId:{composerId}:{bubbleId}"
- Bubbles have empty
workspace_hash in global storage
- Must join via composer_id from Step 2
- Token field:
token_count_up_until_here (cumulative context, NOT per-message tokens)
- Message type:
message_type (0=user, 1=assistant, but NULL for ~all events - use heuristics)
- Model: ❌ Not stored in database
Tool Usage Analysis (Claude Code only)
Data source: Decompress event_data blob from claude_raw_traces
import zlib, json
decompressed = zlib.decompress(row['event_data'])
event = json.loads(decompressed)
tools = event['payload']['entry_data']['message']['content']
# Filter: item['type'] == 'tool_use'
# Extract: item['name'], item['input']['file_path'], item['input']['command']
Tool operation churn (detect both productive and unproductive patterns):
Negative patterns (wasted effort):
- Files written then deleted without commit
- Same file edited multiple times in short succession (trial-and-error)
- Bash commands repeated with similar patterns (debugging loops)
- Write operations for files later removed (unwanted artifacts)
Positive patterns (intentional iteration):
- Progressive refinement: Write → Read → Edit (deliberate improvement)
- Test-driven flow: Write test → Run → Edit code → Run (TDD cycle)
- Exploration: Multiple Read/Grep before Write (research-based development)
- Read-before-edit ratio > 0.8 (careful, informed changes)
Workflow efficiency signals:
- Tool distribution (Bash, Write, Edit, Read, Task usage)
- Read-before-edit ratio (higher = more careful)
- File touch count (edits per unique file path)
- Time between tool uses (rapid = reactive, spaced = deliberate)
Cross-reference with git to classify churn:
- Compare Write/Edit file paths against final committed files
- Flag operations on files not in
git diff --name-only
- Distinguish exploration (positive) from mistakes (negative)
Raw Metrics
A. Flow & Structure
analysis_scope, session_duration, active_exchanges, total_ai_responses
context_switch_count, prompt_timing_buckets, session_summaries
B. Prompting Patterns
prompt_count, average_prompt_length, median_prompt_length
prompt_complexity_score (low/medium/high), reprompt_loop_count
C. Token Economics
total_input_tokens, total_output_tokens, input_output_ratio
estimated_cost_usd: (input/1M × $3) + (output/1M × $15)
D. Patch Behavior
patch_count, total_lines_added, total_lines_removed, add_remove_ratio
E. Behavioral Signals
delegation_style: high-level vs step-by-step indicators
positive_feedback / negative_feedback counts
F. Capability Usage
capabilities_invoked, agentic_mode_usage
G. Model Strategy (Claude Code only)
per_model_usage, per_model_tokens, dominant_model
H. Temporal Productivity
tokens_per_day, tokens_per_hour_utc, prompts_per_minute_by_session
I. Tool Usage & Workflow Patterns (Claude Code only)
tool_distribution: counts by tool name (Bash, Write, Edit, Read, etc.)
read_before_edit_ratio: Read operations / Edit operations
files_created_not_committed: count of Write file_paths not in git
file_touch_count: edits per unique file_path
high_churn_files: files edited 3+ times
pattern_classification: productive_iteration vs trial_and_error counts
Derived Insights
- Effort_vs_Progress_Score (0-1): lines_added / total_tokens
- Context_Sufficiency_Index (0-1): 1 - (corrections / prompts)
- AI_Utilization_Quality_Score (0-1): weighted agentic + efficiency + success
- Predicted_Task_Difficulty: easy/moderate/hard based on query rate, switches
- AI_vs_Human_Burden_Ratio: ai_output_chars / user_input_chars
- Persistence_vs_Abandonment: reprompt loops vs topic abandonment
- Patch_Efficiency_Curve: clean (ratio>3) vs thrashy, lines_per_prompt
- Intent_Shift_Map: task type transitions count
- Prompt_Quality_vs_Result: success rate by prompt length
- Confidence_Trajectory: improving/declining/mixed
- Stuckness_Prediction: risk_level based on correction rate, loops
- Prompt_Pacing_Profile: rapid_iterator/balanced/deliberate
- Model_Strategy_Assessment: single_model/tiered_models, cost_awareness
- Peak_Performance_Windows: top hours UTC
- Session_Focus_Profile: short_bursts/long_deep_work/mixed
- Workflow_Quality_Score (0-1): based on read-before-edit ratio, productive vs wasteful churn
- Development_Discipline: careful (high read-first) vs reactive (low read-first, high trial-and-error)
Output Format
1. RAW_METRICS: { JSON with metrics A-I above }
2. DERIVED_INSIGHTS: { JSON with insights 1-17 above }
3. SESSION_SUMMARY: 6-10 sentences covering:
- Analysis scope (first sentence)
- Duration and activity level
- Workflow patterns
- Token efficiency
- Key recommendations
Interpretation Guidelines
| Input:Output Ratio |
Assessment |
| < 10:1 |
Excellent |
| 10-25:1 |
Normal |
| 25-50:1 |
Context-heavy |
| > 50:1 |
Inefficient |
Recommendation Triggers
| Signal |
Recommendation |
| 0% agentic usage |
Enable agentic mode for multi-file tasks |
| >50:1 ratio frequently |
Start new conversations for simple queries |
| High negative feedback |
Provide more context upfront |
| High context switches |
Consider task batching |
Limitations
- Model info unavailable for Cursor (platform limitation)
- Token counts depend on capture completeness
- Task type inference is keyword-based (heuristic)
- Cost estimates based on Claude 3.5 Sonnet pricing
1---2name: telemetry-insights3description: Analyze AI coding session telemetry for usage patterns, token efficiency, and workflow optimization. Supports current session or historical time periods.4---5
6# Telemetry Insights
7
8## Scope Detection
9
10| User Request | Scope |
11|--------------|-------|
12| "How efficient am I?" | Current session |
13| "Analyze this conversation" | Current session |
14| "this week" / "last 7 days" | 7 days |
15| "today" / "last 24 hours" | 1 day |
16| "last month" | 30 days |
17| "productivity" / "project" / "traces" | 7 days (default historical) |
18
19---
20
21## Data Access
22
23**Database**: `~/.blueplane/telemetry.db`
24
25### Schema Reference
26
27**Claude Code** (`claude_raw_traces` table):
28- Workspace filter: `WHERE cwd LIKE '/path/to/workspace%'` (NOT workspace_hash)
29- Token fields: `input_tokens`, `cache_creation_input_tokens`, `cache_read_input_tokens`, `output_tokens`
30- Model field: `message_model` (e.g., "claude-sonnet-4-5-20250929")
31- Role field: `message_role` ('user' | 'assistant')
32- Branch field: `git_branch`
33
34**Cursor** (`cursor_sessions` + `cursor_raw_traces` tables):
35- **Step 1**: Get `workspace_hash` from `cursor_sessions WHERE workspace_path LIKE '/path/to/workspace%'`
36- **Step 2**: Get `composer_id`s from `cursor_raw_traces WHERE event_type='composer' AND workspace_hash=?`
37- **Step 3**: Filter bubbles by extracting composer_id from `item_key`: `"bubbleId:{composerId}:{bubbleId}"`
38 - Bubbles have empty `workspace_hash` in global storage
39 - Must join via composer_id from Step 2
40- Token field: `token_count_up_until_here` (cumulative context, NOT per-message tokens)
41- Message type: `message_type` (0=user, 1=assistant, but NULL for ~all events - use heuristics)
42- Model: ❌ Not stored in database
43
44### Tool Usage Analysis (Claude Code only)
45
46**Data source**: Decompress `event_data` blob from `claude_raw_traces`
47
48```python
49import zlib, json
50decompressed = zlib.decompress(row['event_data'])
51event = json.loads(decompressed)
52tools = event['payload']['entry_data']['message']['content']
53# Filter: item['type'] == 'tool_use'
54# Extract: item['name'], item['input']['file_path'], item['input']['command']
55```
56
57**Tool operation churn** (detect both productive and unproductive patterns):
58
59**Negative patterns** (wasted effort):
60- Files written then deleted without commit
61- Same file edited multiple times in short succession (trial-and-error)
62- Bash commands repeated with similar patterns (debugging loops)
63- Write operations for files later removed (unwanted artifacts)
64
65**Positive patterns** (intentional iteration):
66- Progressive refinement: Write → Read → Edit (deliberate improvement)
67- Test-driven flow: Write test → Run → Edit code → Run (TDD cycle)
68- Exploration: Multiple Read/Grep before Write (research-based development)
69- Read-before-edit ratio > 0.8 (careful, informed changes)
70
71**Workflow efficiency signals**:
72- Tool distribution (Bash, Write, Edit, Read, Task usage)
73- Read-before-edit ratio (higher = more careful)
74- File touch count (edits per unique file path)
75- Time between tool uses (rapid = reactive, spaced = deliberate)
76
77Cross-reference with git to classify churn:
78- Compare Write/Edit file paths against final committed files
79- Flag operations on files not in `git diff --name-only`
80- Distinguish exploration (positive) from mistakes (negative)
81
82---
83
84## Raw Metrics
85
86### A. Flow & Structure
87- `analysis_scope`, `session_duration`, `active_exchanges`, `total_ai_responses`
88- `context_switch_count`, `prompt_timing_buckets`, `session_summaries`
89
90### B. Prompting Patterns
91- `prompt_count`, `average_prompt_length`, `median_prompt_length`
92- `prompt_complexity_score` (low/medium/high), `reprompt_loop_count`
93
94### C. Token Economics
95- `total_input_tokens`, `total_output_tokens`, `input_output_ratio`
96- `estimated_cost_usd`: `(input/1M × $3) + (output/1M × $15)`
97
98### D. Patch Behavior
99- `patch_count`, `total_lines_added`, `total_lines_removed`, `add_remove_ratio`
100
101### E. Behavioral Signals
102- `delegation_style`: high-level vs step-by-step indicators
103- `positive_feedback` / `negative_feedback` counts
104
105### F. Capability Usage
106- `capabilities_invoked`, `agentic_mode_usage`
107
108### G. Model Strategy (Claude Code only)
109- `per_model_usage`, `per_model_tokens`, `dominant_model`
110
111### H. Temporal Productivity
112- `tokens_per_day`, `tokens_per_hour_utc`, `prompts_per_minute_by_session`
113
114### I. Tool Usage & Workflow Patterns (Claude Code only)
115- `tool_distribution`: counts by tool name (Bash, Write, Edit, Read, etc.)
116- `read_before_edit_ratio`: Read operations / Edit operations
117- `files_created_not_committed`: count of Write file_paths not in git
118- `file_touch_count`: edits per unique file_path
119- `high_churn_files`: files edited 3+ times
120- `pattern_classification`: productive_iteration vs trial_and_error counts
121
122---
123
124## Derived Insights
125
1261. **Effort_vs_Progress_Score** (0-1): lines_added / total_tokens
1272. **Context_Sufficiency_Index** (0-1): 1 - (corrections / prompts)
1283. **AI_Utilization_Quality_Score** (0-1): weighted agentic + efficiency + success
1294. **Predicted_Task_Difficulty**: easy/moderate/hard based on query rate, switches
1305. **AI_vs_Human_Burden_Ratio**: ai_output_chars / user_input_chars
1316. **Persistence_vs_Abandonment**: reprompt loops vs topic abandonment
1327. **Patch_Efficiency_Curve**: clean (ratio>3) vs thrashy, lines_per_prompt
1338. **Intent_Shift_Map**: task type transitions count
1349. **Prompt_Quality_vs_Result**: success rate by prompt length
13510. **Confidence_Trajectory**: improving/declining/mixed
13611. **Stuckness_Prediction**: risk_level based on correction rate, loops
13712. **Prompt_Pacing_Profile**: rapid_iterator/balanced/deliberate
13813. **Model_Strategy_Assessment**: single_model/tiered_models, cost_awareness
13914. **Peak_Performance_Windows**: top hours UTC
14015. **Session_Focus_Profile**: short_bursts/long_deep_work/mixed
14116. **Workflow_Quality_Score** (0-1): based on read-before-edit ratio, productive vs wasteful churn
14217. **Development_Discipline**: careful (high read-first) vs reactive (low read-first, high trial-and-error)
143
144---
145
146## Output Format
147
148```
1491. RAW_METRICS: { JSON with metrics A-I above }
150
1512. DERIVED_INSIGHTS: { JSON with insights 1-17 above }
152
1533. SESSION_SUMMARY: 6-10 sentences covering:
154 - Analysis scope (first sentence)
155 - Duration and activity level
156 - Workflow patterns
157 - Token efficiency
158 - Key recommendations
159```
160
161---
162
163## Interpretation Guidelines
164
165| Input:Output Ratio | Assessment |
166|--------------------|------------|
167| < 10:1 | Excellent |
168| 10-25:1 | Normal |
169| 25-50:1 | Context-heavy |
170| > 50:1 | Inefficient |
171
172### Recommendation Triggers
173
174| Signal | Recommendation |
175|--------|----------------|
176| 0% agentic usage | Enable agentic mode for multi-file tasks |
177| >50:1 ratio frequently | Start new conversations for simple queries |
178| High negative feedback | Provide more context upfront |
179| High context switches | Consider task batching |
180
181---
182
183## Limitations
184
185- Model info unavailable for Cursor (platform limitation)
186- Token counts depend on capture completeness
187- Task type inference is keyword-based (heuristic)
188- Cost estimates based on Claude 3.5 Sonnet pricing