Skip to content

research: token budget — what does claude CLI/API expose and how do we wire it? #364

@cmbays

Description

@cmbays

Problem

Every run.json has totalTokens: null. Token budget fields exist on cycles but are never populated at runtime. Budget tracking is declared but fictional.

What we need to understand

  1. What does the claude CLI return when invoked with --print? Does it include token usage in the output or headers?
  2. Does the Anthropic API return token usage on completion (input_tokens, output_tokens)?
  3. Can kata intercept/parse this from the subprocess stdout/JSON?
  4. Where in the run lifecycle should we collect and write tokens — at kiai complete? At each stage boundary?
  5. Should budget enforcement happen (warn when over) or just tracking?

This is a research-first issue

Do not build until the API surface is confirmed. Research output should answer the questions above and propose an implementation path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanRequires human judgment or design input before implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions