# Tool group summary

The one line above a folded run of tool calls, built on the client from calls already in the transcript. No model call, no backend change.

- **Settled**: Read 3 files, searched for "tl-toggle", edited execution-strip.tsx `+12 −4`
- **Running**: Read 2 files, running a command…
- **Failure**: Edited app.tsx, ran 2 commands · 1 failed `+3 −3`

## Phrases

Calls are bucketed by kind. Each bucket gives one phrase at the place of its first call, joined with ", " ("，" in Chinese); the first is capitalised.

| Kind (tools) | One | Several | Running |
| --- | --- | --- | --- |
| Command `bash terminal_use write_stdin execute_code` | Ran a command | Ran 3 commands | Running a command… |
| Created file `write` to a new path, `apply_patch` Add File | Created pill-shadow.html | Created 2 files | Creating pill-shadow.html… |
| Edited file `edit`, `write` over a file, `apply_patch` Update | Edited app.tsx | Edited 4 files | Editing app.tsx… |
| Deleted file `apply_patch` Delete File | Deleted old.css | Deleted 2 files | Deleting old.css… |
| Read `read pdf` | Read package.json | Read 3 files | Reading package.json… |
| List `list` | Listed a folder | Listed 2 folders | Listing a folder… |
| Code search `grep glob semble_* lsp_*` | Searched for "tl-toggle" | Ran 3 searches | Searching for "tl-toggle"… |
| Web search `web_search` | Searched the web | Searched the web 2 times | Searching the web… |
| Fetch `web_fetch` | Fetched docs.anthropic.com | Fetched 3 pages | Fetching docs.anthropic.com… |
| Browser `web_use`, `playwright_browser`, `browser_use`, `computer_use` on the built-in browser of this computer | Operated the browser | Operated the browser | Operating the browser… |
| GUI and computer `computer_use` on any other target, GUI tools | Ran a GUI call; Operated Calculator; Operated the screen; Operated Chrome; Operated Lab VM's screen | Ran 2 GUI calls; Operated 2 apps; Operated Chrome and the screen; Operated Chrome and 2 more | Running a GUI call…; Operating Calculator… |
| Sub-agent `agent task send_message mixture_of_agents` | Ran sub-agent Reviewer | Ran 2 sub-agents | Running sub-agent Reviewer… |
| Peer `send_message` to another conversation | Messaged another conversation | Counted once per conversation | Messaging another conversation… |
| Image `image_generate`, `image_analyze` | Generated an image; Analyzed an image | Generated 2 images; Analyzed 2 images | Generating an image…; Analyzing an image… |
| Task `task_start`, `task_step`, `task_list` | No phrase | No phrase; a line holding only task calls is not drawn | None. The [task block](https://fzkuji.github.io/OpenProgram/docs/reference/design/ui/chat/task-blocks.html) shows the task. |
| Stored todo calls `todo_*` | Updated todos, when the list is not drawn as a block | Updated todos | None |
| Question `ask_user_question` | Asked a question | Asked 2 questions | Asking a question… |
| Memory `memory_*` | Accessed memory | Accessed memory | Accessing memory… |
| Program, skill | Ran program deploy; Used skill pdf | Ran 2 programs | Running program deploy… |
| Anything else (MCP, custom) | Used linear_search; Used linear_search 2 times | Used linear_search and jira_create; Used 3 tools | Using linear_search… |

| Rule | Behaviour |
| --- | --- |
| Thinking | "Thought" or "Thinking…" only when the group has nothing else |
| Names | A bucket names its target only with exactly one distinct target; a computer bucket whose targets are not all applications names two, or the first and how many more. Repeated calls on one file count once. Files show the basename, search patterns are quoted and cut to 24 characters, fetches show the host, commands are never named. |
| Numbers | English: "a"/"an" for one, digits above. Chinese: always digits with a measure word. |
| Failures | Muted red "· N failed" after the label. A failed call counts in its bucket and adds nothing to the badge. A `computer_use` call stored without `is_error` has failed when its result starts with an error code (`Error:`, `UNKNOWN_TARGET:`). |
| Running | The bucket of the call in progress moves to the end, in the present tense with "…"; the shimmer stays. When the call finishes it returns to past tense at its first position. |
| Width | One 28px line. The label has `min-width:0` and a CSS ellipsis; failure note, badge and chevron are `flex:none`. No character budget. |
| Hover | No tip: transcript content, and expanding shows every call |
| Strings | `text(en, zh)`. Each bucket has a past and a present form, each with a one-target and a count variant. |

## Change badge

Shows when at least one file-writing call succeeded and every successful one has known counts. Sums them, shows zeros (`+16 −0`), reuses the `.turn-files-diff` pill.

| Tool | Counts |
| --- | --- |
| `apply_patch` | `+` and `-` lines of the patch body. Exact. |
| `edit` | Line diff of `old_string` against `new_string`, times the replacement count. Above 2,000 lines a side: plain line counts. |
| `write` | `create` in `turnFiles`: `+lines(content) −0`. `modify` with every write to the path in this group: the `turnFiles` numbers. Otherwise unknown, and the badge waits for the turn to settle. |

Before `turnFiles` exists, a `write` is "Created" only if the turn has not read or edited that path. `modify` makes it "Edited".

**What each call carries**

| Field | Source | Use |
| --- | --- | --- |
| `tool` | block | Category; falls back to `presentTool()`, as timeline rows do |
| `input` | block, full JSON | Paths, commands, patterns, URLs; `old_string`/`new_string`, `content`, the patch |
| `result`, `is_error`, `outcome` | block | Success; `(N replacements)`; `Added`, `Updated`, `Deleted` |
| running | `msg.tools[].status` | Call in progress |
| `turnFiles` | assistant message, from the mutation journal at finalize | Per-file `op`, `added`, `removed` for the whole turn. No tool-call id, so per-group stats derive from arguments and `turnFiles` fills gaps. |

**No turn-level summary line**

| Version | Why not |
| --- | --- |
| Deterministic | Free, but repeats the file card's totals and the group headers |
| Model-written | An extra call per turn through the [title-model path](https://fzkuji.github.io/OpenProgram/docs/reference/design/ui/sidebar/session-auto-rename.html): tokens, latency, only after the turn ends, content sent again, and likely says what the reply says |

A surface that must collapse a turn to one line (minimap, hover preview) calls the deterministic aggregate.

**Code**

| Path | Role |
| --- | --- |
| `assistant-bubble.tsx` | Splits ordered `blocks`: each run of thinking and tools becomes one `ExecutionStrip`. Passes the segment's and turn's blocks, `msg.turnFiles`, running ids and whether it is the live tail. |
| `tool-group-summary.ts` | Pure. `summarizeToolGroup(blocks, options)` returns `{label, failed, added, removed}`; counts are `null` with no badge. Owns `SPAWNING_TOOL_NAMES`; exports `lineDiff()` (`LINE_DIFF_CAP` = 2,000) and `parsePatch()`. |
| `execution-strip.tsx` | `label: string \| ToolGroupSummary`. A plain string (workflow card, debugger) renders with no note or badge. |
| `LegacyRuntimeTrace` | Records without ordered blocks: each call becomes a block named after its function. Legacy sub-agent strips pass spawn labels. |
| `execution-strip.css` | `.tl-label`, `.tl-fail`, `.tl-diff`, `.tl-chev` |
| `tool-group-summary.test.mjs` | `apps/web/tests/chat/messages/execution/`: grammar, plurals, order, tense, failures, badge sources, patch parsing, capped diff |

## Implementation status

Implemented. Not built: tool-call ids on mutation-journal entries with per-call `{path, op, added, removed}`, which would give exact `write` counts while streaming and per group; a `write` over an existing file shows its badge once the turn settles.
