SLOPSHOPPER

task-progress

A bar above the prompt: gradient task progress while Claude works, usage rings (context, 5h, 7d) while idle.

bandguardtoastprompttooltimer
v0.8.0no licenseupdated 2026-10-26Arkboi-GG/claude-mods/mods/task-progress
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · task-progress
› fix the failing auth test and add an audit log call ╭──────────────────────╮ │ task-progress │ ⏺ Read(src/auth.ts) │ task-progress loaded │ ⎿ Read 6 lines ╰──────────────────────╯ ⏺ Update(src/auth.ts) ⎿ Added 2 lines, removed 1 line ⏺ 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 ⟨undefined⟩ [ Compact ] ⟨Claude Code's own drawing⟩ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Band
⟨undefined⟩ [ Compact ] ⟨Claude Code's own drawing⟩
README

claude-mods

A small collection of Claude Code mods.

Install

/plugin install <mod> --marketplace Arkboi-GG/claude-mods

The bars stack above the prompt, so you can install any combination.

Mods

  • task-progress: the band above the prompt. While Claude works on a multi-step task it shows one block per step: the running step fills as "In Progress", finished steps turn green "Completed", and a turn that stops with steps still open turns amber "Paused". When Claude is idle it shows usage rings (context, 5-hour and 7-day limits) with a Compact button. It reads the task list Claude keeps while working, so it appears for multi-step tasks. The Compact button runs /compact with instructions to keep the thread (goal, decisions, files, key values, open questions, next steps) so work carries on in the same topic; change them with the compactInstructions option. The 5-hour and 7-day rings show the time left until they reset (the ring still fills with the share used). If you also use the skins mod, run /skin band off once so its own usage band doesn't show twice.
  • repo-status: branch, ahead/behind, changed-file count and the open PR's check state (needs git; gh is optional).
  • stack-health: status dots for your Docker Compose services and any local ports you list (web=5173,api=3000).
  • preflight: a live pre-commit checklist. After Claude edits files it re-runs your typecheck/lint (auto-detected, or set checks) and shows pass/fail with an error count.
  • env-guard: a green LOCAL badge that turns red PROD when a tool call matches your production patterns, and toasts when it happens.
  • agent-crabs: a pixel-art crab for every running subagent, dressed for its role (beret, hard hat, postman cap and more), with the agent's name, what it is working on and a timer. Finished crabs cheer and leave after a few seconds; failed ones turn grey. Name an agent by starting the Agent call's description with Name: , e.g. Olivia: rewrite welcome email; map names to outfits with the outfits option. While an agent runs, a playful stage word (Waking up, Analyzing, Cooking, Wrapping up) follows what its tool calls show it doing; "Wrapping up" is a guess, since an agent reports no progress.
Source 2 files
hooks/register.tsx 369 lines
1import { atom, read, update } from 'claude-code'
2import type { Register } from 'claude-code'
3
4import type { Step, Usage } from '../types'
5
6const steps = atom({ plugin: 'task-progress', key: 'steps' } as const, [] as Step[])
7
8const stoppedAt = atom({ plugin: 'task-progress', key: 'stoppedAt' } as const, 0)
9const tick = atom({ plugin: 'task-progress', key: 'tick' } as const, 0)
10const usage = atom({ plugin: 'task-progress', key: 'usage' } as const, { context: null, limits: [] } as Usage)
11
12const ORANGE = '#f97316'
13const TRACK = '#2b2b2b'
14const STOPS: Array<[number, number, number]> = [
15  [99, 102, 241],
16  [168, 85, 247],
17  [244, 114, 182],
18]
19
20const hex = (c: number[]) => '#' + c.map(v => Math.round(v).toString(16).padStart(2, '0')).join('')
21
22// Colour at t (0..1) along the gradient.
23const grad = (t: number) => {
24  const x = Math.min(1, Math.max(0, t)) * (STOPS.length - 1)
25  const i = Math.min(STOPS.length - 2, Math.floor(x))
26  const f = x - i
27  return hex(STOPS[i].map((v, k) => v + (STOPS[i + 1][k] - v) * f))
28}
29
30// Marks when each step started, so its block can fill while it runs.
31const stamp = (prev: Step[], next: Step[], now: number): Step[] =>
32  next.map((s, i) => {
33    if (s.status !== 'in_progress') return { content: s.content, status: s.status }
34    const was = prev[i]
35    return { content: s.content, status: s.status, startedAt: was?.status === 'in_progress' && was.startedAt ? was.startedAt : now }
36  })
37
38// Applies one update_plan call (the desktop app's task list) to the steps.
39const applyPlan = (prev: Step[], e: Record<string, unknown>): Step[] => {
40  if (Array.isArray(e.items)) {
41    return (e.items as Array<{ content?: string; status?: Step['status'] }>).map(i => ({
42      content: String(i.content ?? ''),
43      status: i.status ?? 'pending',
44    }))
45  }
46  const next = prev.map(s => ({ ...s }))
47  if (e.advance === true) {
48    const cur = next.findIndex(s => s.status === 'in_progress')
49    if (cur >= 0) next[cur].status = 'completed'
50    const nxt = next.findIndex(s => s.status === 'pending')
51    if (nxt >= 0) next[nxt].status = 'in_progress'
52  }
53  if (Array.isArray(e.done)) {
54    for (const n of e.done as number[]) if (next[n - 1]) next[n - 1].status = 'completed'
55  }
56  if (typeof e.start === 'number' && next[e.start - 1]) next[e.start - 1].status = 'in_progress'
57  return next
58}
59
60// A sibling mod's element by key ('devrow', 'agent-crabs'), found anywhere in what is beneath.
61function findKeyed(node: any, key: string): any {
62  if (!node || typeof node !== 'object') return null
63  if (node.props?.key === key) return node
64  for (const kid of node.children ?? []) {
65    const hit = findKeyed(kid, key)
66    if (hit) return hit
67  }
68  return null
69}
70
71// 'five_hour' -> '5h', 'seven_day' -> '7d'; any other window keeps its own name.
72function limitLabel(kind: string): string {
73  const k = kind.toLowerCase()
74  if (k.includes('five') || k.includes('5h') || k.includes('5_h')) return '5h'
75  if (k.includes('seven') || k.includes('7d') || k.includes('week')) return '7d'
76  return k.replace(/_/g, ' ')
77}
78
79// Time until a limit resets: '42m', '4h 37m', '5d 3h'.
80function timeLeft(ms: number): string {
81  const m = Math.max(0, Math.round(ms / 60000))
82  if (m < 60) return `${m}m`
83  const h = Math.floor(m / 60)
84  if (h < 24) return `${h}h ${String(m % 60).padStart(2, '0')}m`
85  return `${Math.floor(h / 24)}d ${h % 24}h`
86}
87
88// What a limit's window is called next to its time left.
89const WINDOW_NAME: Record<string, string> = { '5h': 'session', '7d': 'week' }
90
91// The idle band: a ring per meter (context, 5-hour and 7-day limits), drawn as one SVG.
92// A limit that knows when it resets shows the time left; the ring still fills with the share used.
93function ringsSvg(meters: Array<{ label: string; percent: number; resetsAt?: number }>, narrow: boolean, now: number) {
94  const R = 11
95  const C = 2 * Math.PI * R
96  let x = 0
97  let body = ''
98  const alt: string[] = []
99  for (const m of meters) {
100    const pct = Math.max(0, Math.min(100, Math.round(m.percent)))
101    const left = m.resetsAt && m.resetsAt > now ? timeLeft(m.resetsAt - now) : null
102    // Narrow chat: the context label shortens, the window name goes and the gap between rings tightens.
103    const big = left ?? `${pct}%`
104    const small = left ? (narrow ? '' : (WINDOW_NAME[m.label] ?? m.label)) : narrow && m.label === 'context' ? 'ctx' : m.label
105    const text = small ? `${big} ${small}` : big
106    const w = Math.ceil(R * 2 + 14 + text.length * 7.6 + (narrow ? 8 : 26))
107    const cx = x + R + 4
108    const color = pct >= 95 ? '#ef4444' : pct >= 80 ? '#f59e0b' : '#a78bfa'
109    const dash = (C * pct) / 100
110    body +=
111      `<circle cx="${cx}" cy="15" r="${R}" fill="none" stroke="#8b8b9b" stroke-opacity=".25" stroke-width="3"/>` +
112      `<circle cx="${cx}" cy="15" r="${R}" fill="none" stroke="${color}" stroke-width="3" stroke-linecap="round" stroke-dasharray="${dash} ${C}" transform="rotate(-90 ${cx} 15)"/>` +
113      `<text x="${cx + R + 8}" y="19.5" font-family="system-ui,sans-serif" font-size="13"><tspan fill="#ffffff" font-weight="600">${big}</tspan>${small ? `<tspan fill="#7c8bd4"> ${small}</tspan>` : ''}</text>`
114    alt.push(`${m.label} ${pct}% used${left ? `, resets in ${left}` : ''}`)
115    x += w
116  }
117  return {
118    source: `<svg xmlns="http://www.w3.org/2000/svg" width="${x}" height="30" viewBox="0 0 ${x} 30">${body}</svg>`,
119    alt: alt.join(', '),
120  }
121}
122
123async function refreshUsage($: any) {
124  try {
125    const u = await $.session.usage()
126    const snap: Usage = {
127      context: u.context?.percent ?? null,
128      limits: (u.rateLimits ?? []).map((l: any) => {
129        const at = l.resetsAt ? Date.parse(String(l.resetsAt)) : NaN
130        return { label: limitLabel(String(l.kind)), percent: Number(l.percentUsed), resetsAt: Number.isFinite(at) ? at : undefined }
131      }),
132    }
133    await update($, usage, prev => (JSON.stringify(prev) === JSON.stringify(snap) ? prev : snap))
134    // The time left changes with the clock, not with the reading: redraw once a minute.
135    await update($, tick, n => n + 1)
136  } catch {
137    // no usage figures yet: keep the last reading
138  }
139}
140
141// The model's own way to show steps where the host has no task list tool (TodoWrite, update_plan): the mod declares one
142// tool and serves it. mcp__task-progress__update_steps takes the whole list each time, like TodoWrite.
143const STEPS_TOOL = 'update_steps'
144const STEPS_TOOL_FULL = 'mcp__task-progress__update_steps'
145const STEPS_TOOL_DESCRIPTION =
146  'Shows the person your progress as a bar above the prompt. At the start of any task that takes several steps, call it with the full list of steps (3 to 8, short, imperative), the first one in_progress and the rest pending. The steps must be real phases of the work that happen one after another, not labels over one batch of edits. Call it again, with the whole list, at every real change: when a step finishes, mark it completed and the next one in_progress before you start that next one. Never mark several steps completed in one call, and never finish with one call that completes everything. Skip it for a one-step answer or a quick question.'
147
148// What the Compact button asks the summary to keep, so work carries on in the same thread.
149const DEFAULT_COMPACT_FOCUS =
150  'Keep what is needed to carry on the same topic without re-explaining: the current goal and where we stand, ' +
151  'decisions made and why, files and paths touched, exact names, values and commands that matter, ' +
152  'problems hit and how they were fixed, open questions and the next steps. Drop chatter and dead ends.'
153
154export const register: Register = (on, options) => {
155  const compactFocus = String(options.compactInstructions ?? '').trim() || DEFAULT_COMPACT_FOCUS
156
157  on('session.start', async ($, e, next) => {
158    $.ui.toast('task-progress loaded')
159    try {
160      await $.tool.register({
161        name: STEPS_TOOL,
162        description: STEPS_TOOL_DESCRIPTION,
163        isDeferred: false,
164        inputSchema: {
165          type: 'object',
166          properties: {
167            steps: {
168              type: 'array',
169              description: 'The whole list of steps, in order. Replaces the list shown now.',
170              items: {
171                type: 'object',
172                properties: {
173                  content: { type: 'string', description: 'The step, short and imperative.' },
174                  status: { type: 'string', enum: ['pending', 'in_progress', 'completed'] },
175                },
176                required: ['content', 'status'],
177              },
178            },
179          },
180          required: ['steps'],
181        },
182      })
183    } catch {
184      // A host without tool registration still gets the bar from TodoWrite or update_plan.
185    }
186    await refreshUsage($)
187    $.clock.every(60000, () => refreshUsage($))
188    // Once a second while a step runs, so its block keeps filling.
189    $.clock.every(1000, async () => {
190      const list = await read($, steps)
191      if (list.some(st => st.status === 'in_progress') && (await read($, stoppedAt)) === 0) await update($, tick, n => n + 1)
192    })
193    return next(e)
194  })
195
196  on('turn.complete', async ($, e, next) => {
197    await refreshUsage($)
198    const list = await read($, steps)
199    const isOpen = list.length > 0 && list.some(st => st.status !== 'completed')
200    await update($, stoppedAt, () => 0)
201    if (isOpen) {
202      const at = await $.clock.now()
203      await update($, stoppedAt, () => at)
204    }
205    return next(e)
206  })
207
208  on('prompt.submit', async ($, e, next) => {
209    await update($, steps, () => [])
210    await update($, stoppedAt, () => 0)
211    return next(e)
212  })
213
214  on('tool.call', async ($, e, next) => {
215    const now = await $.clock.now()
216    if (e.tool === 'TodoWrite') {
217      const todos = (e as { todos?: Step[] }).todos ?? []
218      await update($, steps, prev => stamp(prev, todos, now))
219    } else if (e.tool === 'mcp__ccd_turn__update_plan') {
220      await update($, steps, prev => stamp(prev, applyPlan(prev, e as Record<string, unknown>), now))
221    } else if (e.tool === 'mcp__ccd_turn__wrap_up') {
222      await update($, steps, prev => prev.map(s => ({ content: s.content, status: 'completed' as const })))
223    }
224    return next(e)
225  })
226
227  on('tool.call', { tool: STEPS_TOOL_FULL }, async ($, e, next) => {
228    const raw = (e as { steps?: Array<{ content?: unknown; status?: unknown }> }).steps
229    if (!Array.isArray(raw)) return { deny: 'steps must be a list of { content, status }.' }
230    const now = await $.clock.now()
231    const list: Step[] = raw.map(i => ({
232      content: String(i.content ?? ''),
233      status: i.status === 'in_progress' || i.status === 'completed' ? i.status : 'pending',
234    }))
235    // Steps that became completed in this one call. Two or more at once means the list was kept for show and ticked off in a
236    // batch, so the bar jumps instead of following the work: say so in the result, where the model reads it, and still accept it.
237    const before = await read($, steps)
238    const alreadyDone = new Set(before.filter(st => st.status === 'completed').map(st => st.content))
239    const justDone = list.filter(st => st.status === 'completed' && !alreadyDone.has(st.content)).length
240    await update($, steps, prev => stamp(prev, list, now))
241    if (justDone >= 2) {
242      return {
243        result:
244          'Steps updated, but ' + justDone + ' steps were completed in this one call, so the bar jumped instead of following your work. Update the list when each step really finishes: mark it completed and the next one in_progress, then do that step. Make the steps phases that happen one after another.',
245      }
246    }
247    return { result: 'Steps updated.' }
248  })
249
250  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
251    const below = await next(e)
252    const list = await read($, steps)
253    // Only while Claude works: then the bar stands in for the other stats bands,
254    // keeping just the dev row; when the turn ends they come back.
255    if (e.props.hasSurvey) return below
256
257    const isOpen = list.length > 0 && list.some(st => st.status !== 'completed')
258    // Paused: the turn ended with steps still open, so the bar stays, in amber.
259    const isPaused = !e.props.isWorking && isOpen
260
261    if (list.length === 0 || (!e.props.isWorking && !isPaused)) {
262      // Idle: the usage rings, with a Compact button on the right.
263      const u = await read($, usage)
264      await read($, tick)
265      const idleNow = await $.clock.now()
266      const meters = [...(u.context === null ? [] : [{ label: 'context', percent: u.context }]), ...u.limits]
267      const { Box, Button, Svg, Text } = $.ui.resolve(e)
268      if (meters.length === 0) {
269        const wait = (
270          <Box paddingX={1}>
271            <Text dimColor>usage: waiting for the first reading</Text>
272          </Box>
273        )
274        return below ? <Box flexDirection="column">{wait}{below}</Box> : wait
275      }
276      const rings = ringsSvg(meters, e.props.bodyColumns < 70, idleNow)
277      // Wraps when the chat is too narrow for both, so the button drops below the rings
278      // instead of being clipped.
279      const idle = (
280        <Box paddingX={1} justifyContent="space-between" alignItems="center" flexWrap="wrap" marginBottom={1}>
281          <Box flexShrink={0}>
282            <Svg source={rings.source} alt={rings.alt} />
283          </Box>
284          <Box flexShrink={0}>
285          <Button key="compact" label="Compact" onPress={async () => {
286            // Runs as if "/compact <instructions>" was typed, once the session is idle. The
287            // instructions are what a person would add by hand: keep what is needed to carry on.
288            // $.session.compact() is not available in every host (desktop/SDK sessions reject it).
289            try {
290              await $.command.run({ command: 'compact', args: compactFocus })
291            } catch (err) {
292              $.ui.toast(`Compact failed: ${String((err as Error)?.message ?? err)}`)
293            }
294          }} />
295          </Box>
296        </Box>
297      )
298      return below ? <Box flexDirection="column">{idle}{below}</Box> : idle
299    }
300
301    const { Box, Text, Svg } = $.ui.resolve(e)
302    await read($, tick)
303    const stopped = await read($, stoppedAt)
304    const now = stopped || (await $.clock.now())
305    const done = list.filter(s => s.status === 'completed').length
306    const pct = Math.round((done / list.length) * 100)
307    const label = `Tasks ${done}/${list.length}`
308
309    // One block per step, a thin gap between them. A running step fills toward 90%
310    // as time passes, a finished one is green, a paused one amber.
311    const W = 640
312    const H = 22
313    const SEP = 3
314    const n = list.length
315    const bw = (W - SEP * (n - 1)) / n
316    const fit = (t: string) => {
317      const max = Math.max(3, Math.floor(bw / 7.2) - 1)
318      return t.length > max ? t.slice(0, max - 1) + '…' : t
319    }
320    const esc = (t: string) => t.replace(/&/g, '&amp;').replace(/</g, '&lt;')
321    let blocks = ''
322    list.forEach((st, i) => {
323      const x = i * (bw + SEP)
324      blocks += `<rect x="${x}" width="${bw}" height="${H}" fill="${TRACK}"/>`
325      let text = fit(st.content)
326      let color = '#9ca3af'
327      if (st.status === 'completed') {
328        blocks += `<rect x="${x}" width="${bw}" height="${H}" fill="#22c55e"/>`
329        text = 'Completed'
330        color = '#ffffff'
331      } else if (st.status === 'in_progress') {
332        const secs = Math.max(0, (now - (st.startedAt ?? now)) / 1000)
333        const frac = 0.9 * (1 - Math.exp(-secs / 25))
334        const fill = isPaused ? '#f59e0b' : `url(#g${i})`
335        blocks +=
336          `<defs><linearGradient id="g${i}" x1="0" x2="1"><stop offset="0" stop-color="#6366f1"/><stop offset="0.55" stop-color="#a855f7"/><stop offset="1" stop-color="#f472b6"/></linearGradient></defs>` +
337          `<rect x="${x}" width="${Math.max(4, bw * frac)}" height="${H}" fill="${fill}"/>`
338        text = isPaused ? 'Paused' : 'In Progress'
339        color = '#ffffff'
340      }
341      blocks += `<text x="${x + bw / 2}" y="${H / 2 + 4.2}" text-anchor="middle" font-family="system-ui,sans-serif" font-size="12" font-weight="600" fill="${color}">${esc(text)}</text>`
342    })
343    const source =
344      `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${W} ${H}" width="${W}" height="${H}">` +
345      `<defs><clipPath id="c"><rect width="${W}" height="${H}" rx="${H / 2}"/></clipPath></defs>` +
346      `<g clip-path="url(#c)">${blocks}</g></svg>`
347
348    const row = (
349      <Box paddingX={1} alignItems="center" marginBottom={1}>
350        <Box flexShrink={0}>
351          <Text color={isPaused ? '#f59e0b' : '#a855f7'}>● </Text>
352        </Box>
353        <Box flexShrink={0}>
354          <Text bold>{label}  </Text>
355        </Box>
356        <Box flexGrow={1} flexShrink={1} minWidth={0}>
357          <Svg source={source} alt={`${label}, ${pct}%${isPaused ? ', paused' : ''}`} />
358        </Box>
359        <Text dimColor>  {pct}%  </Text>
360        <Text color={ORANGE}>×{list.length}</Text>
361      </Box>
362    )
363    // Keeps the dev row and the agent crabs (agent-crabs mod) while the other bands step aside.
364    const devrow = findKeyed(below, 'devrow')
365    const crabs = findKeyed(below, 'agent-crabs')
366    return devrow || crabs ? <Box flexDirection="column">{crabs}{row}{devrow}</Box> : row
367  })
368}
369
types/index.d.ts 10 lines
1export type Step = { content: string; status: 'pending' | 'in_progress' | 'completed'; startedAt?: number }
2
3export type Usage = { context: number | null; limits: Array<{ label: string; percent: number; resetsAt?: number }> }
4
5declare module 'claude-code' {
6  interface PluginState {
7    'task-progress': { steps: Step[]; usage: Usage; stoppedAt: number; tick: number }
8  }
9}
10