SLOPSHOPPER

tool-oneline

Folds tool calls in the scrollback into one line per call, or one line per run of calls, with no result block

rowsguard
v0.1.0no licenseupdated 2026-10-11ekinertac/claude-code-mods/tool-oneline
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · tool-oneline
› fix the failing auth test and add an audit log call ⏺ Read(src/auth.ts) ⎿ Read 6 lines ⏺ Edit(/work/app/src/auth.ts) (ctrl+o to expand) ⏺ Bash(bun test) ⎿ 3 pass, 1 fail ● Done. refresh now rejects expired claims and logs an audit event. ✻ Worked for 42s · done 4:20 PM ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Tool row
⏺ Edit(/work/app/src/auth.ts) (ctrl+o to expand)
README

claude-code-mods

Claude Code mods I use daily.

  • rewrite-prompt: press Ctrl+P and the draft in the prompt box is rewritten in place by a model (Sonnet, on your plan). Nothing is sent until you press Enter, and Ctrl+_ undoes it.
  • write-for-me: press Ctrl+N and the next prompt is written for you from the last 12 messages of the conversation. If the box has text, it is used as a hint ("tests too") and expanded. Nothing is sent, and Ctrl+_ undoes it.
  • prompt-box: the prompts you type are drawn in the scrollback inside a thick colored box instead of one > text line. /prompt-color [red|blue|green|yellow|purple|orange|pink|cyan|default|#hex|reset] sets the color, keeps it across sessions, and open sessions pick it up at their next prompt. The default is gray. Most names follow your terminal's color scheme. Purple, orange, pink and hex values are fixed. Task notifications and messages from other sessions keep their normal rows. No key binding needed.
  • tool-oneline: each tool call is drawn as one line (⏺ Bash(echo hello) (ctrl+o to expand)) with no result block under it. Set detail to runs for one line per run of calls (⏺ Ran 3 tools: Bash ×2, Read). Ctrl+O still shows the full rows. A failed call keeps its error text. Tools named in the show option (default SendUserFile, comma-separated) are drawn in full with their output and end a run.

Setup

claude plugin marketplace add ekinertac/claude-code-mods
claude plugin install rewrite-prompt@ekinertac-mods
claude plugin install write-for-me@ekinertac-mods
claude plugin install prompt-box@ekinertac-mods
claude plugin install tool-oneline@ekinertac-mods

Then bind the keys. Add these to the Global block of ~/.claude/keybindings.json and start a new session:

"ctrl+p": "app:toggleDiffNoiseFilter",
"ctrl+n": "app:toggleDiffPreSession"

To use the runs level, add this to ~/.claude/settings.json:

"pluginConfigs": { "tool-oneline": { "options": { "detail": "runs" } } }

How the shortcut works

No keybinding action runs a mod command. The mod draws a zero-size button above the prompt whose action is app:toggleDiffNoiseFilter (inert outside the diff panel; write-for-me uses app:toggleDiffPreSession the same way, so the two never share an action), and the chord you bind to that action presses it. Nothing shows on screen.

Limits

  • Tested on Claude Code 2.1.287. Mod events and methods can change between releases.
  • The rewrite replaces the draft. It keeps the intent, language and concrete details, and adds no requirements.
  • Not checked in every terminal: if you see a blank row above the prompt, open an issue.
  • Tests: claude plugin test <mod> (stubs the model, no network).
Source 1 files
hooks/register.tsx 182 lines
1// tool-oneline: folds tool calls in the scrollback into one line, and hides the result block.
2//
3// Why: a tool call normally takes a header, up to several result lines and a "+N lines" row, and a
4// long agent turn buries the conversation text in that output. The stored results and what the
5// model reads do not change.
6// Two levels, set by the `detail` option (plugin.json userConfig):
7//   calls (default)  one line per call:            ⏺ Bash(echo hello) (ctrl+o to expand)
8//   runs             one line per run of calls:    ⏺ Ran 3 tools: Bash ×2, Read (ctrl+o to expand)
9// A run is the calls made between two messages that carry text (the assistant's, or your prompt).
10// Rows after the first of a run draw nothing, so the run costs one row and no blank lines.
11// Always shown: tools named in the `show` option (default SendUserFile) draw as the engine's own
12// row with their output, because that output is the point of the call. They are not counted in a
13// run and they end it, so the rows after one start a new run.
14// How: ui.render hooks on ToolUse, ToolGroup and ToolResult. Runs are derived from the transcript
15// ($.session.messages) each time it grows, not remembered, so a resumed session folds its old calls
16// the same way a live one does. tool.call only asks for a redraw, because a run's line must grow
17// when the next call joins it.
18// ctrl+o: tool rows carry no "expanded" flag, so the flag is read from the UserMessage and
19// ToolGroup rows, which do, and a change invalidates ui.render. In the expanded transcript every
20// hook passes, and the engine draws full rows and results.
21// Needs: any mod that replaces the user-message row (prompt-box does) must call next(e) first, or this
22// mod never sees the flag when a turn has no tool group.
23// Constraint: a failed call keeps its error block, because a hidden failure is worse than a long one.
24
25import type { Engine, Register, SessionMessage } from 'claude-code'
26
27const HINT = ' (ctrl+o to expand)'
28
29// The one input field that says what a call is about, per tool; any other tool falls back to its
30// first string field.
31const KEYS: Record<string, string> = {
32  Bash: 'command',
33  Read: 'file_path',
34  Edit: 'file_path',
35  Write: 'file_path',
36  NotebookEdit: 'notebook_path',
37  Grep: 'pattern',
38  Glob: 'pattern',
39  WebFetch: 'url',
40  WebSearch: 'query',
41  Agent: 'description',
42  Task: 'description',
43}
44
45type Call = {
46  tool_use_id?: string
47  tool: string
48  input: unknown
49  isRunning: boolean
50  isErrored: boolean
51  isInterrupted: boolean
52}
53
54type Run = { ids: string[]; tools: string[] }
55
56// Module variables start over on a reload, which is fine: they only hold options, the view flag and
57// a cache that is rebuilt from the transcript.
58let detail = 'calls'
59let shown = new Set<string>()
60let isExpanded = false
61let cache: { count: number; runs: Run[] } = { count: -1, runs: [] }
62
63function subject(tool: string, input: unknown): string {
64  const obj = (input && typeof input === 'object' ? input : {}) as Record<string, unknown>
65  const key = KEYS[tool]
66  const v = key ? obj[key] : Object.values(obj).find(x => typeof x === 'string')
67  // First line only: a heredoc or multi-line command must stay on one row.
68  return typeof v === 'string' ? v.split('\n')[0].trim() : ''
69}
70
71function summary(tools: string[]): string {
72  const counts = new Map<string, number>()
73  for (const t of tools) counts.set(t, (counts.get(t) ?? 0) + 1)
74  const parts = [...counts].map(([t, n]) => (n > 1 ? `${t} ×${n}` : t))
75  return `Ran ${tools.length} ${tools.length === 1 ? 'tool' : 'tools'}: ${parts.join(', ')}`
76}
77
78// The transcript keeps each text block and each tool call as its own message, so a run ends at any
79// message with text (the model's or yours) and at a shown tool. A tool_result row has no text.
80function derive(messages: readonly SessionMessage[]): Run[] {
81  const runs: Run[] = []
82  let current: Run | null = null
83  for (const m of messages) {
84    if (m.text.trim() !== '') current = null
85    for (const u of m.role === 'assistant' ? m.toolUses : []) {
86      if (shown.has(u.tool)) {
87        current = null
88        continue
89      }
90      if (!current) runs.push((current = { ids: [], tools: [] }))
91      current.ids.push(u.tool_use_id)
92      current.tools.push(u.tool)
93    }
94  }
95  return runs
96}
97
98// Declared at the top level because `claude plugin validate` only follows `$` into such functions.
99async function runsOf($: Engine): Promise<Run[]> {
100  const messages = await $.session.messages()
101  // Messages are only appended, so the length says whether anything changed since the last build.
102  if (messages.length !== cache.count) cache = { count: messages.length, runs: derive(messages) }
103  return cache.runs
104}
105
106function sync($: Engine, value: boolean) {
107  if (isExpanded === value) return
108  isExpanded = value
109  // Tool rows cannot read the flag themselves, so they are asked to draw again.
110  $.ui.invalidate('ui.render')
111}
112
113// isDim: the run summary is background information, so it recedes behind the conversation text.
114function line(Box: any, Text: any, key: string, color: string, name: string, text: string, isDim = false) {
115  return (
116    <Box key={key} width="100%">
117      <Box flexShrink={0} marginRight={1}>
118        <Text color={color} dimColor={isDim}>⏺</Text>
119      </Box>
120      <Box flexShrink={1}>
121        <Text wrap="truncate-end" dimColor={isDim}>
122          {name ? <Text bold>{name}</Text> : null}
123          {text}
124        </Text>
125      </Box>
126      <Box flexShrink={0}>
127        <Text dimColor>{HINT}</Text>
128      </Box>
129    </Box>
130  )
131}
132
133async function draw($: Engine, e: any, next: any, calls: Call[]) {
134  if (isExpanded || calls.some(c => shown.has(c.tool))) return next(e)
135  const { Box, Text } = $.ui.resolve(e)
136
137  if (detail === 'runs') {
138    const ids = calls.map(c => c.tool_use_id)
139    const run = (await runsOf($)).find(r => r.ids.some(id => ids.includes(id)))
140    if (run) {
141      return ids.includes(run.ids[0]) ? line(Box, Text, 'run', 'green', '', summary(run.tools), true) : <Box display="none" />
142    }
143    // A call the transcript does not hold yet (it is still being written): draw it as its own line.
144  }
145
146  const rows = calls.map((c, i) => {
147    const arg = subject(c.tool, c.input)
148    const color = c.isErrored || c.isInterrupted ? 'red' : c.isRunning ? 'yellow' : 'green'
149    return line(Box, Text, String(c.tool_use_id ?? i), color, c.tool, arg ? `(${arg})` : '')
150  })
151  return <Box flexDirection="column" width="100%">{rows}</Box>
152}
153
154export const register: Register = (on, options) => {
155  detail = options.detail === 'runs' ? 'runs' : 'calls'
156  shown = new Set(String(options.show ?? '').split(',').map(t => t.trim()).filter(Boolean))
157
158  // A new call may join a run, so its line has to be drawn again.
159  on('tool.call', ($, e, next) => {
160    if (e.agentId === undefined) $.ui.invalidate('ui.render')
161    return next(e)
162  })
163
164  on('ui.render', { component: 'ToolUse' }, ($, e, next) => draw($, e, next, [e.props]))
165
166  on('ui.render', { component: 'ToolGroup' }, ($, e, next) => {
167    sync($, e.props.isExpanded)
168    return draw($, e, next, [...e.props.calls])
169  })
170
171  on('ui.render', { component: 'ToolResult' }, ($, e, next) => {
172    if (isExpanded || e.props.isErrored || shown.has(e.props.tool)) return next(e)
173    const { Box } = $.ui.resolve(e)
174    return <Box display="none" />
175  })
176
177  on('ui.render', { component: 'UserMessage' }, ($, e, next) => {
178    sync($, e.props.isExpanded)
179    return next(e)
180  })
181}
182