Skip to content

feat(cli): show tool call summaries with token estimates in watch recent steps - #64

Merged
zawakin merged 1 commit into
mainfrom
feature/watch-tool-step-summary
Jul 13, 2026
Merged

feat(cli): show tool call summaries with token estimates in watch recent steps#64
zawakin merged 1 commit into
mainfrom
feature/watch-tool-step-summary

Conversation

@zawakin

@zawakin zawakin commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Claude Code's adaptive thinking means thinking text is often absent from logs, making the reasoning-first Recent Steps display in agtrace watch useless (it also leaked chain-of-thought when present). This PR makes Recent Steps tool-centric and adds intuitive token visibility per step.

Changes

  • Priority flip in step previews: tool executions > message > reasoning. Reasoning-only steps show a Thinking... placeholder instead of the thinking text.
  • Rich tool summaries: tool name + salient argument (shortened file path for Read/Edit/Write, command for Bash, pattern for Grep/Glob, server.tool for MCP), execution duration ([1.2s]), and (+N more) for multi-tool steps. Existing TodoWrite/AskUserQuestion/Task special cases are preserved.
  • Token visibility:
    • →~3.4k — estimated tokens fed back into context by tool results (~chars/4), making the previously blackbox tool-result cost visible.
    • Δ+5.2k — context window growth vs the previous step (input token delta), color-coded: gray < 2k, yellow ≥ 2k, red ≥ 10k, cyan for negative (compaction).
  • Error highlighting: steps with failed tools render the description in red.
  • Deduplicated the two step-line render paths in turn_history.rs into a shared step_preview_line helper.
  • Re-exported MessageBlock/ReasoningBlock/ToolCallBlock/ToolResultBlock from agtrace-sdk (CLI depends on sdk only).

Tests

10 new unit tests covering priority order, thinking-text suppression, result token estimation, duration formatting, multi-tool counts, delta chaining across steps (including in-progress steps without usage), negative delta after compaction, and error flagging.

mise run verify passes.

🤖 Generated with Claude Code

@zawakin zawakin self-assigned this Jul 12, 2026
@zawakin
zawakin merged commit 409a13e into main Jul 13, 2026
8 checks passed
@zawakin
zawakin deleted the feature/watch-tool-step-summary branch July 13, 2026 02:25
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.

1 participant