Saltar a contenido

rai telemetry

Query telemetry data from RaiSE's local SQLite database or from raise-server. Two subcommands serve different purposes:

Subcommand Data source Requires server?
query Local ~/.rai/raise.db No
tokens raise-server API Yes

rai telemetry query

Query the local SQLite signals table. Reads ~/.rai/raise.db directly — no server, no credentials required.

Flag Short Description
--type -t Filter by signal type (e.g. work_lifecycle)
--source -s Filter by source (e.g. claude_code)
--limit -n Max rows to return. Default: 20. Range: 1–500
--since ISO 8601 datetime — only signals after this time
--db Path to a specific raise.db file (default: project DB)
# Show last 20 signals
rai telemetry query

# Filter by signal type
rai telemetry query --type work_lifecycle --limit 5

# Filter by source
rai telemetry query --source claude_code

# Show signals since a specific date
rai telemetry query --since 2026-05-04T00:00:00Z

# Query a different database
rai telemetry query --db /path/to/other/raise.db

Output:

                          Signals (showing 3)
┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Timestamp          ┃ Type           ┃ Source      ┃ Session         ┃ Tokens ┃
┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━┩
│ 2026-05-06T16:16:… │ work_lifecycle │ claude_code │ S-E-260506-0828 │      — │
│ 2026-05-06T16:15:… │ work_lifecycle │ claude_code │ S-E-260506-0828 │      — │
│ 2026-05-06T16:14:… │ work_lifecycle │ claude_code │ S-E-260506-0828 │      — │
└────────────────────┴────────────────┴─────────────┴─────────────────┴────────┘

Common signal types: work_lifecycle, session_start, session_end, pattern_add, session_bind

Common sources: claude_code, mcp, cli

Relationship to rai signal: rai telemetry query is a read-only view of the same signals that rai signal emit-* writes. Use it to audit what was recorded during a session or pipeline run.


rai telemetry tokens

List token usage events from raise-server. Shows inference cost per phase and story across your team.

Requires raise-server

This subcommand calls the raise-server API. You must set two environment variables:

export RAISE_SERVER_URL=https://your-raise-server.fly.dev
export RAISE_API_KEY=your-api-key

Without these, the command exits with an error. Token data is not available in the local DB.

Flag Short Description
--story -s Filter by story ID (e.g. S3044.4)
--phase -p Filter by phase (e.g. implement, design)
--since ISO 8601 datetime — return records after this time
--limit -n Max records to return. Default: 20. Range: 1–100
--offset Pagination offset. Default: 0
# Show last 20 token events
rai telemetry tokens

# Filter by story
rai telemetry tokens --story S3044.4

# Filter by phase
rai telemetry tokens --phase implement --limit 10

# Show recent events only
rai telemetry tokens --since 2026-05-01T00:00:00Z

# Paginate through results
rai telemetry tokens --limit 20 --offset 20

See also: raise-server setup for configuring RAISE_SERVER_URL and RAISE_API_KEY.