AGENTS.md@claude/dev-mods/tool-history · git:20261105.4ba4217 · 2026-11-05 · sha256 3e3b3c258bf78630
AGENTS.md@claude/dev-mods/tool-history git:20261105.4ba4217A
Immutable. This exact content never changes and is served at /api/v1/blob/3e3b3c258bf78630.
# tool-history
## Card spacing
- Cards in the pane (tool calls and agent messages) sit flush: the `list` Box
in `hooks/register.tsx` uses `gap={0}`. No blank line between cards — the
round border already separates them.
- Do not add `gap`, `marginY`, `marginTop` or `marginBottom` to the `list` Box
or to individual cards. `tests/collapse.test.tsx` asserts `gap` is `0`.
- Why: when cards were grouped per agent, `gap={1}` only separated groups.
After the groups were flattened (each card names its agent), the same
`gap={1}` landed between every card and the pane got sparse.
## Border colors
- Yellow border = subagent, and only in the messages tab (agent message cards).
- Tool call cards (Bash, Read, etc.) never use yellow, even when a subagent
made the call: `danger` on error, `subtle` when done, `claude` while running.
`tests/subagent-border.test.tsx` asserts this.
## Agent tool calls in the messages tab
- Each `Agent` tool call also adds a `kind: "agent"` card to the messages tab
(key `agent-call-<tool_use_id>`): `subagent_type`, `description` and the
full `prompt`. Border follows the caller (yellow only if a subagent spawned
it). `tests/agent-call-message.test.tsx` asserts this.
## All tab (🔀)
- Third tab mixes messages and tool calls in one list, sorted by each
record's `at` (ms when it entered). Cards reuse the same renderers as the
other tabs. `tests/all-tab.test.tsx` asserts the interleaved order.
- Text/thinking get `at` from their first streamed chunk, not step end:
tools run mid-stream, so an end stamp sorts text after its own calls.
## Band redraw after each press
- Every band Button (`expand`, tabs, `collapse`, `to-end`) goes through
`onBand`, which asks `$.ui.invalidate("ui.render")` 100ms after the press.
`tests/band-redraw.test.tsx` asserts this.
- Why: router (alexei-led/claude-router) wraps AbovePrompt; two band renders
settled out of order and the terminal kept stale handles
(`ui.press: no Button of tool-history is held under handle …`). Nothing
redraws the band mid-turn, so clicks died until the turn ended.
## Errors tab (🚨)
- Fourth tab lists only tool calls whose result has `isError`; no messages.
Empty text: "No failed tool calls." `tests/errors-tab.test.tsx` asserts it.
- In tests, `isError`/`text` sit at the top of the `tool.call` answer, not
inside `result` (`{ result: {}, text, isError: true }`).
## Duration per call
- `durationMs` = `$.clock.now()` after `next(e)` minus before; shown in the
card header as `40ms` / `2.3s`. Uses `$.clock`, not `Date.now()`, so tests
drive it with `mock.clock`. `tests/duration.test.tsx` asserts it.
- `setupHooks` mocks the clock for every test (nothing else answers
`clock.now`) and returns it; don't call `mock.clock` again in a test.