SLOPSHOPPER

tape

/tape: a live pane of every tool call, grouped by turn, with status, target and duration.

paneguardcommand
v0.4.0MITupdated 2026-10-26shalom2552/agent-skills/mods/tape
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · tape
│ ┃ tape ✕ › fix the failing auth test and add an audit log call │ ┃ turn:1 │ ┃ toolu_09 ⏺ Read(src/auth.ts) │ ┃ toolu_08 ⎿ Read 6 lines │ ┃ toolu_07 ⏺ Update(src/auth.ts) │ ┃ toolu_06 ⎿ Added 2 lines, removed 1 line │ ┃ toolu_05 ⏺ Bash(bun test) │ ┃ toolu_04 ⎿ 3 pass, 1 fail │ ┃ toolu_03 │ ┃ toolu_02 ● Done. refresh now rejects expired claims and logs an audit event. │ ┃ toolu_01 │ ┃ ✻ Worked for 42s · done 4:20 PM │ │ › /tape │ ⎿ tape: Tape closed. │ │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Pane · tape
turn:1 toolu_09 toolu_08 toolu_07 toolu_06 toolu_05 toolu_04 toolu_03 toolu_02 toolu_01
README

Agent Skills

Skills and mods for Claude-Code.

Install

curl -fsSL shalom2552.github.io/agent-skills/install | bash

Or clone and run ./install. See ./install --help for options.

Skills

SkillDescription
docs-syncFind and fix drift between docs and code.
dotconfAnswer, change, and remember dotfile and app configs.
read-onlyLock the session to read-only; change nothing.
setup-sh25-skillsInstall, manage and wire up shalom2552's agent-skills assets.
system-auditRead-only health, security and cleanliness audit of this machine.
system-fixDiagnose, fix, and document a system or config fault on this machine.
to-promptWrite a handoff prompt for a fresh agent.
visualizeTurn any subject into a visual HTML page.
walk-with-meLearn languages and idioms by coding with a coach.

Mods

Claude Code plugins.

/plugin install <mod> --marketplace shalom2552/agent-skills
ModDescription
spinner-wordsSwap the spinner verbs for dev ones.
tape/tape pane of tool calls per turn.
frameRounded frame around your prompts.
beatTurn time and usage as pills.
statuslineBottom status line for claude.
badgesBadge above the prompt for active skill.
tdiffLive diff of session changes.

Settings

Small JSON files that ./install merges into the scope's settings.json.

./install settings --scope global -y
SettingDescription
tmux-truecolorTruecolor inside tmux, so mod hex colors render right.
Source 2 files
hooks/register.tsx 381 lines
1import { atom, read, update } from 'claude-code'
2import type { CoreEngineInterface, Register } from 'claude-code'
3
4import type { TapeCall, TapeStatus, TapeTurn } from '../types'
5
6const PANE = 'tape'
7const TITLE = 'Tape'
8const MAX_CALLS = 300
9const MAX_TURNS = 50
10const MAX_SESSIONS = 5
11const SESSIONS_KEY = 'sessions'
12const MAX_TARGET = 1000
13const MAX_LABEL = 16
14const INDENT = 2
15const GLYPH = 2
16const MIN_TARGET_WIDTH = 10
17const MIN_COLUMNS = 24
18const MIN_PROMPT_COLUMNS = 40
19const FOCUS_COLOR = 'suggestion'
20const TARGET_KEYS = ['command', 'file_path', 'notebook_path', 'pattern', 'url', 'query', 'skill', 'description', 'prompt']
21
22const calls = atom({ plugin: 'tape', key: 'calls' } as const, [])
23const turns = atom({ plugin: 'tape', key: 'turns' } as const, [])
24const folds = atom({ plugin: 'tape', key: 'folds' } as const, {})
25const focused = atom({ plugin: 'tape', key: 'focused' } as const, null)
26const open = atom({ plugin: 'tape', key: 'open' } as const, null)
27
28const ICON: Record<TapeStatus, { glyph: string; color: string }> = {
29  running: { glyph: '●', color: 'warning' },
30  ok: { glyph: '✓', color: 'success' },
31  error: { glyph: '✗', color: 'error' },
32  denied: { glyph: '⊘', color: 'error' },
33}
34
35const TAG = /<\/?[a-z][\w-]*(?:\s[^<>]*)?>/gi
36
37export const labelOf = (text: string) => {
38  for (const line of text.split('\n')) {
39    const trimmed = line.trim()
40    const label = /^<\/?[a-z]/i.test(trimmed) ? trimmed.replace(TAG, '').trim() : trimmed
41    if (label.length > 0) return label
42  }
43  return ''
44}
45
46const escapeRegExp = (text: string) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
47
48export const flatten = (text: string, cwd: string) => {
49  const here = escapeRegExp(cwd)
50  const flat = text
51    .split('\n')
52    .map(line => line.replace(/\s+/g, ' ').trim())
53    .filter(line => line.length > 0)
54    .join(' ⏎ ')
55    .replace(new RegExp(`^cd (['"]?)${here}/?\\1 *(?:&&|;|⏎) *`), '')
56    .replace(new RegExp(`(^|[\\s'"=(:])${here}/`, 'g'), '$1')
57  const chars = Array.from(flat)
58  return chars.length > MAX_TARGET ? `${chars.slice(0, MAX_TARGET - 1).join('')}…` : flat
59}
60
61export const targetOf = (input: Record<string, unknown>, cwd: string) => {
62  for (const key of TARGET_KEYS) {
63    const value = input[key]
64    if (typeof value === 'string' && value.trim().length > 0) return flatten(value, cwd)
65  }
66  return ''
67}
68
69const noop = () => undefined
70const width = (text: string) => Array.from(text).length
71const padStart = (text: string, room: number) => ' '.repeat(Math.max(0, room - width(text))) + text
72const padEnd = (text: string, room: number) => text + ' '.repeat(Math.max(0, room - width(text)))
73
74export const clip = (text: string, room: number) => {
75  const chars = Array.from(text)
76  if (chars.length <= room) return text
77  return room <= 0 ? '' : `${chars.slice(0, room - 1).join('')}…`
78}
79
80const labelOfCall = (call: TapeCall) => {
81  const name =
82    call.tool === 'Bash' ? '$' : call.tool.length > MAX_LABEL ? `${call.tool.slice(0, MAX_LABEL - 1)}…` : call.tool
83  return call.isAgent ? `↳${name}` : name
84}
85
86export const formatSeconds = (ms: number) => (ms < 10_000 ? `${(ms / 1000).toFixed(1)}s` : `${Math.round(ms / 1000)}s`)
87
88const timeOf = (call: TapeCall) =>
89  call.endedAt !== undefined ? formatSeconds(call.endedAt - call.startedAt) : call.status === 'running' ? '…' : ''
90
91const turnName = (n: number) => (n === 0 ? 'Before first turn' : `Turn ${n}`)
92
93const shortTool = (tool: string) => (tool.startsWith('mcp__') ? tool.split('__').slice(2).join('__') || tool : tool)
94
95type Engine = Pick<CoreEngineInterface, 'state' | 'store' | 'session'>
96type Live = { turn: number; sessionId?: string; queue: Promise<void> }
97
98const callsKey = (id: string) => `calls:${id}`
99const turnsKey = (id: string) => `turns:${id}`
100const listOf = <T,>(value: unknown): T[] => (Array.isArray(value) ? (value as T[]) : [])
101
102async function adopt($: Engine, live: Live, id: string) {
103  live.sessionId = id
104  const savedCalls = listOf<TapeCall>(await $.store.get(callsKey(id))).map(call =>
105    call.status === 'running' ? { ...call, status: 'error' as const } : call,
106  )
107  const savedTurns = listOf<TapeTurn>(await $.store.get(turnsKey(id)))
108  live.turn = savedTurns[savedTurns.length - 1]?.n ?? 0
109  await update($, calls, () => savedCalls)
110  await update($, turns, () => savedTurns)
111  await update($, folds, () => ({}))
112  await update($, open, () => null)
113
114  const ids = [...listOf<string>(await $.store.get(SESSIONS_KEY)).filter(one => one !== id), id]
115  for (const stale of ids.slice(0, -MAX_SESSIONS)) {
116    await $.store.delete(callsKey(stale))
117    await $.store.delete(turnsKey(stale))
118  }
119  await $.store.set(SESSIONS_KEY, ids.slice(-MAX_SESSIONS))
120}
121
122async function sync($: Engine, live: Live) {
123  const id = await $.session.id()
124  if (id !== live.sessionId) await adopt($, live, id)
125}
126
127function ensure($: Engine, live: Live) {
128  live.queue = live.queue.then(() => sync($, live)).catch(() => undefined)
129  return live.queue
130}
131
132async function persist($: Engine, key: string, value: unknown) {
133  await $.store.set(key, value).catch(() => undefined)
134}
135
136async function saveCalls($: Engine, live: Live, list: TapeCall[]) {
137  if (live.sessionId !== undefined) await persist($, callsKey(live.sessionId), list)
138}
139
140async function saveTurns($: Engine, live: Live, list: TapeTurn[]) {
141  if (live.sessionId !== undefined) await persist($, turnsKey(live.sessionId), list)
142}
143
144export const register: Register = on => {
145  const live: Live = { turn: 0, queue: Promise.resolve() }
146
147  on('session.start', async ($, e, next) => {
148    const started = await next(e)
149    await $.command.register({
150      name: 'tape',
151      description: 'Toggle a live pane of tool calls, grouped by turn',
152      immediate: true,
153    })
154    await ensure($, live)
155    return started
156  })
157
158  on('command.run', { command: 'tape' }, async $ => {
159    const isOpen = (await $.ui.panes()).some(pane => pane.id === PANE)
160    if (isOpen) {
161      await $.ui.close({ id: PANE })
162      return { text: 'Tape closed.' }
163    }
164    await $.ui.open({ id: PANE, title: TITLE })
165    return { text: 'Tape opened.' }
166  })
167
168  on('session.end', async ($, e, next) => {
169    await saveCalls($, live, await read($, calls))
170    await saveTurns($, live, await read($, turns))
171    const ended = await next(e)
172    if (e.reason === 'clear' || e.reason === 'resume') await ensure($, live)
173    return ended
174  })
175
176  on('turn.start', async ($, e, next) => {
177    await ensure($, live)
178    live.turn += 1
179    const entry: TapeTurn = { n: live.turn, prompt: labelOf(e.text) }
180    await saveTurns($, live, await update($, turns, list => [...list, entry].slice(-MAX_TURNS)))
181    return next(e)
182  })
183
184  on('turn.complete', async ($, e, next) => {
185    await saveCalls($, live, await read($, calls))
186    return next(e)
187  })
188
189  on('tool.call', async ($, e, next) => {
190    await ensure($, live)
191    const call: TapeCall = {
192      id: e.tool_use_id,
193      turn: live.turn,
194      tool: shortTool(String(e.tool)),
195      target: targetOf(e as unknown as Record<string, unknown>, await $.session.cwd()),
196      isAgent: e.agentId !== undefined,
197      startedAt: await $.clock.now(),
198      status: 'running',
199    }
200    const before = (await read($, calls)).length
201    await saveCalls($, live, await update($, calls, list => [...list, call].slice(-MAX_CALLS)))
202    if (before === 0 && !(await $.ui.panes()).some(pane => pane.id === PANE)) {
203      await $.ui.open({ id: PANE, title: TITLE }).catch(noop)
204    }
205
206    let status: TapeStatus = 'error'
207    try {
208      const ran = await next(e)
209      status = ran.deny !== undefined ? 'denied' : ran.isError === true ? 'error' : 'ok'
210      return ran
211    } finally {
212      const endedAt = await $.clock.now()
213      await saveCalls(
214        $,
215        live,
216        await update($, calls, list => list.map(one => (one.id === call.id ? { ...one, status, endedAt } : one))),
217      )
218    }
219  })
220
221  on('ui.focus', { requestId: PANE }, async ($, e, next) => {
222    const moved = await next(e)
223    if (moved.deny === undefined) await update($, focused, () => e.element ?? null)
224    return moved
225  })
226
227  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
228    const { Box, Text, Button, Code } = $.ui.resolve(e)
229    const list = await read($, calls)
230    const known = await read($, turns)
231    const folded = await read($, folds)
232    const shownId = await read($, open)
233    const ring = e.props.isFocused ? await read($, focused) : null
234    const columns = Math.max(MIN_COLUMNS, e.props.bodyColumns)
235
236    const ink = (isLit: boolean, color?: string, isDim?: boolean) =>
237      isLit ? { color: FOCUS_COLOR } : { color, dimColor: isDim }
238
239    const shown = list.find(call => call.id === shownId)
240    if (shown !== undefined) {
241      const icon = ICON[shown.status]
242      const prompt = known.find(t => t.n === shown.turn)?.prompt ?? ''
243      const back = {
244        key: 'back',
245        hotkey: 'b',
246        label: 'back',
247        onPress: async () => {
248          await update($, open, () => null)
249          await $.ui.focus({ requestId: PANE, key: shown.id }).catch(noop)
250        },
251      }
252      return (
253        <Box flexDirection="column">
254          <Box flexDirection="row" justifyContent="space-between">
255            {ring === 'back' ? (
256              <Button {...back}>
257                <Text color={FOCUS_COLOR}>back</Text>
258              </Button>
259            ) : (
260              <Button {...back} />
261            )}
262            <Text dimColor>{timeOf(shown)}</Text>
263          </Box>
264          <Text>
265            <Text color={icon.color}>{icon.glyph}</Text>{' '}
266            <Text bold>
267              {shown.isAgent ? '↳' : ''}
268              {shown.tool}
269            </Text>
270            <Text dimColor> · {turnName(shown.turn)}</Text>
271          </Text>
272          {prompt.length > 0 && (
273            <Text dimColor italic wrap="truncate-end">
274              {prompt}
275            </Text>
276          )}
277          {shown.target.length > 0 &&
278            (shown.tool === 'Bash' ? (
279              <Code key="target" source={shown.target.replaceAll(' ⏎ ', '\n')} language="bash" />
280            ) : (
281              <Text>{shown.target}</Text>
282            ))}
283        </Box>
284      )
285    }
286
287    if (list.length === 0) {
288      return (
289        <Box flexDirection="column">
290          <Text dimColor>No tool calls yet.</Text>
291        </Box>
292      )
293    }
294
295    const order: number[] = []
296    const byTurn = new Map<number, TapeCall[]>()
297    for (const call of list) {
298      const group = byTurn.get(call.turn)
299      if (group === undefined) {
300        byTurn.set(call.turn, [call])
301        order.push(call.turn)
302      } else {
303        group.push(call)
304      }
305    }
306
307    const latest = order[order.length - 1]
308    const labelWidth = Math.max(...list.map(call => width(labelOfCall(call)))) + 1
309    const timeWidth = Math.max(1, ...list.map(call => width(timeOf(call))))
310    const room = Math.max(MIN_TARGET_WIDTH, columns - INDENT - GLYPH - labelWidth - 1 - timeWidth)
311
312    const toggle = (n: number, isOpen: boolean) => async () => {
313      await update($, folds, now => ({ ...now, [String(n)]: !isOpen }))
314      await $.ui.focus({ requestId: PANE, key: `turn:${n}` }).catch(noop)
315    }
316
317    const renderCall = (call: TapeCall) => {
318      const icon = ICON[call.status]
319      const isLit = ring === call.id
320      const target = clip(call.target, room)
321      return (
322        <Box key={`row:${call.id}`} flexDirection="row" paddingLeft={INDENT}>
323          <Button
324            key={call.id}
325            plain
326            onPress={async () => {
327              await update($, open, () => call.id)
328              await $.ui.focus({ requestId: PANE, key: 'back' }).catch(noop)
329            }}
330          >
331            <Text {...ink(isLit, icon.color)}>{icon.glyph} </Text>
332            <Text bold={!call.isAgent} {...ink(isLit, undefined, call.isAgent)}>
333              {padEnd(labelOfCall(call), labelWidth)}
334            </Text>
335            <Text {...ink(isLit, undefined, call.isAgent)}>{padEnd(target, room)}</Text>
336            <Text mono {...ink(isLit, undefined, true)}>
337              {' '}
338              {padStart(timeOf(call), timeWidth)}
339            </Text>
340          </Button>
341        </Box>
342      )
343    }
344
345    return (
346      <Box flexDirection="column" width={e.props.bodyColumns}>
347        {order.reverse().map(n => {
348          const group = byTurn.get(n) ?? []
349          const failed = group.filter(call => call.status === 'error' || call.status === 'denied').length
350          const isOpen = folded[String(n)] ?? (n === latest || group.some(call => call.status === 'running'))
351          const isLit = ring === `turn:${n}`
352          const head = turnName(n)
353          const note = ` · ${group.length} call${group.length === 1 ? '' : 's'}`
354          const fail = failed > 0 ? ` · ✗${failed}` : ''
355          const asked = known.find(t => t.n === n)?.prompt ?? ''
356          const prompt =
357            columns >= MIN_PROMPT_COLUMNS ? clip(asked, columns - GLYPH - width(head) - width(note) - width(fail) - 1) : ''
358          return (
359            <Box key={`turn-${n}`} flexDirection="column" marginBottom={1}>
360              <Box flexDirection="row">
361                <Button key={`turn:${n}`} plain onPress={() => void toggle(n, isOpen)()}>
362                  <Text {...ink(isLit, undefined, true)}>{isOpen ? '▾ ' : '▸ '}</Text>
363                  <Text bold {...ink(isLit, 'claude')}>
364                    {head}
365                  </Text>
366                  <Text {...ink(isLit, undefined, true)}>{note}</Text>
367                  <Text {...ink(isLit, 'error')}>{fail}</Text>
368                  <Text italic {...ink(isLit, undefined, true)}>
369                    {prompt.length > 0 ? ` ${prompt}` : ''}
370                  </Text>
371                </Button>
372              </Box>
373              {isOpen && [...group].reverse().map(renderCall)}
374            </Box>
375          )
376        })}
377      </Box>
378    )
379  })
380}
381
types/index.d.ts 27 lines
1export type TapeStatus = 'running' | 'ok' | 'error' | 'denied'
2
3export type TapeCall = {
4  id: string
5  turn: number
6  tool: string
7  target: string
8  isAgent: boolean
9  startedAt: number
10  endedAt?: number
11  status: TapeStatus
12}
13
14export type TapeTurn = { n: number; prompt: string }
15
16declare module 'claude-code' {
17  interface PluginState {
18    tape: {
19      calls: TapeCall[]
20      turns: TapeTurn[]
21      folds: Record<string, boolean>
22      focused: string | null
23      open: string | null
24    }
25  }
26}
27