Skip to content

Token usage + model not captured from Cursor hooks #4

Description

@sketchymedia

Problem

Real user's Cursor work_blocks all show `tokens = 0` and `model = null`, including after the v1.2.1 token-tracking fix.

Two gaps in `hooks/runtime.js`:

  1. `extractTokenUsage(input)` finds nothing for shell/tool hook events (no `usage` in those inputs; `transcript_path` may not be supplied by Cursor). Only `stop`/turn events could plausibly carry usage.
  2. `model` / `model_provider` is never extracted or sent at all — the `ai_tool` payload has no model field, so even when tokens exist, cost can't be priced.

Needs before fixing

A captured real Cursor hook payload (esp. for `stop`/turn events) showing where, if anywhere, Cursor exposes token usage and model id. Implementing field-name guesses blind is speculative and risky. Blocked on payload sample.

Impact

Cursor users get no token-cost attribution. Lower priority than #1/#2 but the eventual goal for cost parity with the daemon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions