Skip to content

Setting: roll child token usage into parent (recursive) #2

Description

@XertroV

Request

Add a setting that adds child subagent token usage into the parent’s usage totals.

Requirements

  • Opt-in (or documented default — TBD, lean off so accounting stays as today unless enabled)
  • Works recursively: depth 2+ agents roll up through each ancestor
  • Cover components already tracked on lifetimeUsage: input, output, cacheWrite (cost only if/when we surface dollar cost)
  • When enabled, parent-facing accounting (widget / notifications / session surfaces we own) reflects rolled-up totals
  • Docs: clarify this is accounting visibility, not changing provider billing; child still runs its own session/API calls

Current behavior

Child usage stays only on the child AgentRecord. Nothing rolls into parent session stats. See src/usage.ts, AgentRecord.lifetimeUsage, manager onAssistantUsage.

Acceptance

  • Setting in subagents.json + /agents → Settings (or equivalent)
  • Recursive rollup on each child usage delta (or on child terminal + streaming option documented)
  • Tests for depth 1 and depth 2+
  • README / settings docs

Related

Local log: bugs.txt (setting: roll up child usage into parent)
Complementary (not the same): persist structured usage for extension consumers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions