Skip to content

add usage info to branch summary, compaction and tool result entries - #6671

Merged
badlogic merged 9 commits into
mainfrom
add-usage-to-more-entry-types
Jul 20, 2026
Merged

badlogic merged 9 commits into
mainfrom
add-usage-to-more-entry-types

Conversation

@davidbrai

@davidbrai davidbrai commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Added usage metadata to:

  1. Branch summarization entries
  2. Compaction entries
  3. Tool results

for tool results, it currently doesn't pass usage or allow modifying it via the tool_result events.
I looked into adding it, and seems like that would require adding usage? to ToolResultEventBase & ToolCallEventBase which seemed a bit much.
let me know if you think it's important to add and whether there's a better way to do it.

fixes: #6509

@davidbrai davidbrai changed the title add usage info to branch summary entries draft: add usage info to branch summary entries Jul 15, 2026
@davidbrai davidbrai changed the title draft: add usage info to branch summary entries add usage info to branch summary entries Jul 15, 2026
@davidbrai
davidbrai requested a review from badlogic July 15, 2026 12:26
@davidbrai
davidbrai marked this pull request as ready for review July 15, 2026 12:26
@davidbrai davidbrai changed the title add usage info to branch summary entries add usage info to branch summary, compaction and tool result entries Jul 15, 2026
@badlogic

Copy link
Copy Markdown
Collaborator

lgtm

we should also add this to tool_result for extensions as you outlined

and we need to also port this over to the new agent harness in the agent package.

@davidbrai

Copy link
Copy Markdown
Member Author

@badlogic ready for more reviewing

@badlogic badlogic added the inprogress Issue is being worked on label Jul 20, 2026
@badlogic
badlogic merged commit 2fd3868 into main Jul 20, 2026
3 checks passed
@badlogic badlogic removed the inprogress Issue is being worked on label Jul 20, 2026
@badlogic

Copy link
Copy Markdown
Collaborator

Merged. Follow-up cleanup preserves the existing generateSummary() return contract, adds generateSummaryWithUsage(), reconciles /session cost breakdowns, reports usage from the custom compaction example, updates the usage documentation, and adds persistence/accounting regression coverage.

Validation: npm run check; 66 targeted tests passed.

This comment is AI-generated by /wr

@davidbrai
davidbrai deleted the add-usage-to-more-entry-types branch July 20, 2026 15:49
gojack10 pushed a commit to gojack10/pi-mono that referenced this pull request Aug 25, 2026
…arendil-works#6671)

* add usage info to branch summary entries

* add usage to compaction entries

* allow custom tools to report llm usage in tool results

* allow observing and patching usage in tool_result hooks

* agent-harness: save usage in entries

for compaction, branch summaries and tool results
jinhuang712 pushed a commit to jinhuang712/pi that referenced this pull request Sep 11, 2026
…arendil-works#6671)

* add usage info to branch summary entries

* add usage to compaction entries

* allow custom tools to report llm usage in tool results

* allow observing and patching usage in tool_result hooks

* agent-harness: save usage in entries

for compaction, branch summaries and tool results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extension-reported usage in the footer cost display (ctx.ui.setUsage)

2 participants