Persistent Telemetry

Session tracking, cost analytics, and historical data with SQLite-backed persistence

Bootspring's telemetry system records every session, tool invocation, and cost metric to a local SQLite database. This gives you historical analytics, cost projection, and data export — all without sending data to any external service.

Overview

Telemetry captures three categories of data:

  1. Session lifecycle — Start, end, duration, task context
  2. Tool usage — Every MCP tool invocation with timing and token counts
  3. Cost tracking — Per-model token costs aggregated by session, day, and project

All data is stored locally in .bootspring/telemetry.db.

Database Schema

The telemetry database uses four tables.

sessions

ColumnTypeDescription
idTEXT (PK)Unique session identifier (UUID v4)
project_idTEXTProject directory hash
started_atINTEGERUnix timestamp (ms)
ended_atINTEGERUnix timestamp (ms), null if active
duration_msINTEGERComputed duration
task_idTEXTAssociated build task (e.g., bs-1042)
modelTEXTPrimary model used (e.g., claude-sonnet-4-20250514)
statusTEXTactive, completed, abandoned

events

ColumnTypeDescription
idINTEGER (PK)Auto-increment
session_idTEXT (FK)References sessions.id
typeTEXTEvent type (e.g., tool:invoke, command:run)
nameTEXTTool or command name
timestampINTEGERUnix timestamp (ms)
duration_msINTEGERExecution time
metadataTEXTJSON blob with event-specific data

costs

ColumnTypeDescription
idINTEGER (PK)Auto-increment
session_idTEXT (FK)References sessions.id
modelTEXTModel identifier
input_tokensINTEGERPrompt tokens consumed
output_tokensINTEGERCompletion tokens generated
cache_read_tokensINTEGERTokens served from cache
cost_usdREALComputed cost in USD
timestampINTEGERUnix timestamp (ms)

daily_aggregates

ColumnTypeDescription
dateTEXT (PK)ISO date (YYYY-MM-DD)
project_idTEXT (PK)Project directory hash
sessionsINTEGERSession count
total_tokensINTEGERSum of all tokens
total_cost_usdREALSum of costs
tools_invokedINTEGERTotal tool invocations
tasks_completedINTEGERBuild tasks marked done

Session Lifecycle

A session begins when any MCP tool is invoked or a CLI command runs. The lifecycle follows this flow:

[Tool invocation / CLI command] │ ▼ Session created (status: active) │ ├── Events recorded (tool calls, commands) ├── Costs accumulated (per-model tokens) │ ▼ Session ended (status: completed) │ ▼ Daily aggregates updated

Sessions end automatically after 30 minutes of inactivity or when bootspring session end is called explicitly. Abandoned sessions (process crash without clean shutdown) are cleaned up on next startup.

Cost Tracking

Costs are tracked per model using current token pricing:

ModelInput (per 1M)Output (per 1M)Cache Read (per 1M)
claude-sonnet-4-20250514$3.00$15.00$0.30
claude-opus-4-20250514$15.00$75.00$1.50
claude-haiku-3-20250307$0.25$1.25$0.03
gpt-4o$2.50$10.00
gpt-4o-mini$0.15$0.60

View cost data from the CLI:

Loading code block...

Historical Analytics

Query telemetry across three time windows.

7-Day View

Loading code block...

Shows daily session count, token usage, cost trend, and top tools for the past week.

30-Day View

Loading code block...

Adds weekly averages, cost projection for the remainder of the month, and tool usage distribution.

90-Day View

Loading code block...

Adds monthly trends, learning curve analysis (are sessions getting more efficient?), and cost-per-task metrics.

Example Output

Loading code block...

Data Export

Export telemetry data in CSV or JSON format.

Loading code block...

CSV Format

The CSV export includes one row per session with flattened metrics:

session_id,started_at,ended_at,duration_ms,model,input_tokens,output_tokens,cost_usd,tools_invoked,task_id a1b2c3,2026-04-10T09:00:00Z,2026-04-10T09:22:00Z,1320000,claude-sonnet-4-20250514,45200,12800,0.33,14,bs-1042

JSON Format

The JSON export includes the full event log per session:

Loading code block...

Retention Policy

Telemetry data is retained locally according to these defaults:

Data TypeDefault RetentionConfigurable
Raw events90 daysYes
Session records1 yearYes
Daily aggregatesIndefiniteYes
Cost records1 yearYes

Configure retention in bootspring.config.js:

Loading code block...

Run cleanup manually:

Loading code block...

This removes records older than the configured retention period and runs VACUUM on the SQLite database.

Privacy Considerations

Telemetry is designed with privacy as a default:

  • Local-only storage — All data stays in .bootspring/telemetry.db on your machine. Nothing is sent externally unless you explicitly export or upload.
  • No code content — Events record tool names and timing, never file contents or code snippets.
  • No PII — Session data does not include usernames, emails, or identifiable information.
  • Opt-out — Disable telemetry entirely with BOOTSPRING_TELEMETRY=false or in config.
  • Deletable — Run bootspring telemetry clear to wipe all local telemetry data.
  • Gitignored.bootspring/telemetry.db is excluded from version control by default.