SLOPSHOPPER

task-progress-mod

Live TodoWrite progress bar above the prompt, with tool-output summarization

bandguard
v0.2.0MITupdated 2026-10-11hahahahahahahahah6/task-progress-mod
A shopper browsing a rack in a slop shop
README

task-progress-mod

A Claude Code Mod that pins a live progress bar above the prompt while the agent works through a TodoWrite todo list — and, since v0.2, compresses the latest tool output into a one-line summary under the bar. Zero dependencies, pure JS, no build step.

When Claude Code grinds through a long task, the plan lives in the transcript — you have to scroll up to find it, or interrupt the agent to ask "where are you?". This mod watches TodoWrite tool calls and draws a one-line summary that stays visible the whole time:

██████░░░░ 60% · step 3/5 · Writing tests…
⏷ Bash · 214 passed, 2 failed — tests/test_thing.py::test_edge_a FAILED
  • Percentage bar — completed / total, 10-block resolution
  • step X/Y — position of the current step in the full list
  • Current step — the activeForm text of the in_progress todo (falls back to content, then to the first pending todo when nothing is in progress)
  • Tool-output summary (v0.2) — the latest tool result, compressed to one line: failure lines + pass counts from test logs, JSON skeletons instead of payloads, diffs with lockfile churn collapsed, short outputs shown as-is. Labeled with the tool name so you can see what just ran.

The bar appears as soon as there is an active todo list (at least one in_progress or pending todo) and disappears when the list is empty or everything is completed. Every TodoWrite call and every tool result re-renders it live.

Install

Requires Claude Code v2.1.287+ (Mods support).

# Try it for one session:
/plugin install ./task-progress-mod
# or point Claude Code at the folder directly:
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir ~/workspace/task-progress-mod

After installing, reload plugins (/reload-plugins) if a session is already open. No MCP server, no daemon, no accounts, no network calls.

Plugin layout:

task-progress-mod/
  .claude-plugin/plugin.json   # name, version, description, author
  hooks/hooks.json             # -> ./register.js (single module)
  hooks/register.js            # the mod: tool.call + tool.result + ui.render hooks
  tests/test_mod.js            # node smoke tests (mocked events)
  README.md
  LICENSE

What the user sees

Above the prompt, while a task is running:

████░░░░░░ 40% · step 3/5 · Writing tests
⏷ Bash · npm test: 41 passed

When the agent marks a todo completed and moves on, the bar updates on the next render — no scrolling, no asking, no tokens spent on status checks. When a tool finishes, its output is compressed into the second line: a 10,000-line test log becomes 214 passed, 2 failed — <first failure>, a lockfile-heavy diff becomes diff: 1 file — src/index.js (+2/−1) · 1 lockfile hidden, and a 300-item JSON response becomes {status: "ok", results: [...300 items], total: 300}. When the last todo completes, the whole thing hides itself.

Usage

Nothing to configure for the basics — install the plugin and run a task that uses TodoWrite. The summary line appears automatically after the first tool result lands, and always reflects the most recent tool output.

Tuning constants live at the top of hooks/register.js:

  • BAR_WIDTH (default 10) — blocks in the bar
  • LABEL_MAX (default 56) — max chars of the current-step label
  • OUTPUT_LONG_THRESHOLD (default 600) — outputs longer than this (chars) get summarized; shorter ones are shown as-is on one line
  • OUTPUT_SUMMARY_MAX (default 220) — max chars of the rendered summary line
  • SUMMARY_DETAIL_MAX (default 140) — max chars of a single failure detail

No config file, no settings UI. Edit the constants and reload the plugin.

Differentiation

  • In-task progress, not platform status. A spinner that says "working…" tells you the platform is busy; it says nothing about your task. This mod shows the task's own state — which step of the plan you're on, what the current step is called, and what the last tool actually produced. The tool-call stream doubles as a deviation detector: if the agent drifts off-plan, the summary line shows it before the next todo update.
  • vs asking "where are you?" — interrupting the agent to check progress costs a turn and pollutes context; the mid-task answer is often stale by the time you read it. The mod is ambient: it reads the same TodoWrite state the agent maintains and shows it without any model involvement.
  • vs scrolling the transcript — TodoWrite updates are already in the transcript, but they scroll away during long tool runs. This pins the two lines you actually want (percent, step, current action, latest result) above the prompt where they never scroll off.
  • vs statusline hacks — a custom statusline is static shell config that can't see tool-call payloads. This hooks the real tool.call / tool.result events, so it tracks the authoritative todo list (including activeForm phrasing that never appears in a statusline) and the real tool outputs.
  • vs context-compression tools — tools that compress tool output for the model (to save context tokens) work invisibly in the pipeline. This mod compresses tool output for the human: the summary is drawn on screen, next to the progress bar, so you get the signal without reading the log. Same compression idea, opposite audience.
  • Mod form, not a sidecar. No dashboard to open, no polling script, no MCP server. It lives inside the Claude Code session as a Mod and draws in the existing AbovePrompt band — zero setup beyond install.

Honest limitations

  • Component choice is deliberate. The spec sketch said Pane, but a Pane only draws at ≥144 terminal columns (110 once explicitly opened). The band above the prompt is AbovePrompt, which always draws — so the mod hooks { component: 'AbovePrompt' }. Two short lines don't need a sidebar.
  • Event shapes are defensive, not pinned. Public docs don't pin the exact tool.call payload for TodoWrite — or the tool.result payload at all — so the mod extracts the todo list and the tool output from every plausible location (e.input.todos, e.output, e.result, e.data…). If a future build moves something somewhere new, that part silently stops updating instead of crashing (fail-open).
  • The summarizer is heuristic, not a parser. It looks for framework summary lines (2 failed, 214 passed), failure-ish lines, JSON shapes, and diff headers. Weird formats degrade to "first meaningful line" — never a crash, occasionally a bland summary.
  • Only the latest tool output is shown. History lives in the transcript; the band is a glanceable "what just happened", not a log viewer.
  • State is module-level, not $.state. A hot reload resets the snapshot and the bar hides until the next TodoWrite call re-captures it. Self-healing, but if you stare at the bar across a reload you'll see it blink out once.
  • Only TodoWrite is tracked. Plans kept in prose, or tools other than TodoWrite, are invisible to the mod — by design; it shows the plan the agent committed to the todo list, nothing inferred.
  • Drawing surfaces vary. The bar renders in the terminal and the Desktop Code tab. Hooks still run in VS Code, claude -p, and the Agent SDK, but nothing drawn appears there (engine behavior, not this mod's choice).
  • Not validated against the real engine here. The mod follows the published Mods API shape (register(on), $.ui.resolve(e), $.ui.invalidate('ui.render'), next(e) passthrough) and passes mocked-event smoke tests, but claude plugin validate / claude plugin test were not run in this environment — run them before publishing.

Development

node tests/test_mod.js   # 63 checks, mocked on/$/e/next, zero dependencies

The suite covers: bar math at 0%/40%/75%, step numbering, activeForm vs content fallback, hiding when idle (empty / all-completed returns next(e)), three TodoWrite event shapes, malformed-input fail-open, $.ui.invalidate on capture, label truncation, a static scan of register.js for loader-banned globals (require, process, fetch, timers, JSX) — plus the v0.2 summarizer: long pytest logs (failure detail

  • pass counts), all-pass logs, short-output passthrough, JSON skeletons,

diff lockfile-noise filtering, failure truncation, render integration (summary under the bar, latest-wins, tool-name labeling), malformed tool.result fail-open, and invalidate on result capture.

License

MIT

Source 1 files
hooks/register.js 458 lines
1// task-progress-mod — live TodoWrite progress bar above the prompt,
2// now with tool-output summarization (v0.2).
3//
4// Hooks:
5//   tool.call { tool: 'TodoWrite' }      -> capture the todo list, invalidate ui.render
6//   tool.call (any)                      -> remember the tool name for labeling
7//   tool.result (any)                    -> summarize the output, invalidate ui.render
8//   ui.render { component: 'AbovePrompt' } -> draw the progress bar (+ summary line)
9//
10// Why summarize: long tool runs (test logs, build logs, diffs) dump tens of
11// thousands of characters into the transcript — pages of PASSED lines. v0.2
12// compresses the most recent tool output into one line and shows it under the
13// bar, so the band reads as "progress + compressed":
14//
15//   ██████░░░░ 60% · step 3/5 · Writing tests…
16//   ⏷ Bash · 214 passed, 2 failed — FAILED tests/test_thing.py::test_edge_a
17//
18// Pure JS, zero dependencies, no JSX: elements are called as plain functions
19// (Box({...}), Text({...})), which the mod loader supports without a build step.
20//
21// Loader constraints honored (static scan): `$` appears only as
22// `$.noun.method(...)` at call sites; event names are string literals;
23// no require/fetch/Node globals.
24
25'use strict';
26
27var BAR_WIDTH = 10;
28var FILLED = '█'; // U+2588 FULL BLOCK
29var EMPTY = '░'; // U+2591 LIGHT SHADE
30var LABEL_MAX = 56; // max chars of the current-step label before truncation
31
32// ---- v0.2 tuning ----
33var OUTPUT_LONG_THRESHOLD = 600; // outputs longer than this get summarized
34var OUTPUT_SUMMARY_MAX = 220; // max chars of the rendered summary line
35var SUMMARY_DETAIL_MAX = 140; // max chars of a single failure detail line
36var SUMMARY_PREFIX = '⏷ '; // marker for the summary line under the bar
37
38// Snapshot of the latest todo list from the most recent TodoWrite call.
39// Module-level: a hot reload resets this to [] (bar hides), and the next
40// TodoWrite call re-captures it. Self-healing, no persistence needed.
41var latestTodos = [];
42
43// Most recent tool-output summary ({ tool, text }), or null when nothing
44// captured yet. Rendered under the bar while a todo list is active.
45var latestSummary = null;
46
47// Tool name of the most recent tool.call, so a tool.result event that does
48// not name its tool can still be labeled.
49var lastToolName = '';
50
51function isTodoList(v) {
52  return (
53    Array.isArray(v) &&
54    v.every(function (t) {
55      return t !== null && typeof t === 'object';
56    })
57  );
58}
59
60// The exact tool.call event shape for TodoWrite input is not pinned down in
61// public docs, so extract defensively from every plausible location.
62function extractTodos(e) {
63  if (!e || typeof e !== 'object') return null;
64  var candidates = [
65    e.input && e.input.todos,
66    e.todos,
67    e.params && e.params.todos,
68    e.arguments && e.arguments.todos,
69  ];
70  for (var i = 0; i < candidates.length; i++) {
71    if (isTodoList(candidates[i])) return candidates[i];
72  }
73  return null;
74}
75
76// Tool name and output are extracted the same defensive way: the exact
77// tool.result event shape is not pinned down in public docs.
78function extractToolName(e) {
79  if (!e || typeof e !== 'object') return '';
80  var candidates = [e.tool, e.name, e.toolName];
81  for (var i = 0; i < candidates.length; i++) {
82    if (typeof candidates[i] === 'string' && candidates[i]) return candidates[i];
83  }
84  return '';
85}
86
87function extractOutput(e) {
88  if (!e || typeof e !== 'object') return null;
89  var candidates = [e.output, e.result, e.text];
90  if (e.data && typeof e.data === 'object') {
91    candidates.push(e.data.output, e.data.result, e.data.text);
92  }
93  for (var i = 0; i < candidates.length; i++) {
94    var c = candidates[i];
95    if (typeof c === 'string' && c.length > 0) return c;
96    if (
97      c !== null &&
98      typeof c === 'object' &&
99      typeof c.text === 'string' &&
100      c.text.length > 0
101    ) {
102      return c.text;
103    }
104  }
105  return null;
106}
107
108function todoStatus(t) {
109  return typeof t.status === 'string' ? t.status : 'pending';
110}
111
112// Returns { pct, filled, step, total, label }, or null when there is nothing
113// worth showing (no todos, all completed, or no active step found).
114function progressView(todos) {
115  var total = todos.length;
116  if (total === 0) return null;
117  var done = 0;
118  var currentIdx = -1;
119  for (var i = 0; i < total; i++) {
120    var s = todoStatus(todos[i]);
121    if (s === 'completed') {
122      done++;
123    } else if (currentIdx === -1 && (s === 'in_progress' || s === 'pending')) {
124      currentIdx = i;
125    }
126  }
127  if (done === total || currentIdx === -1) return null;
128  var pct = Math.round((done / total) * 100);
129  var current = todos[currentIdx];
130  var label =
131    (typeof current.activeForm === 'string' && current.activeForm) ||
132    (typeof current.content === 'string' && current.content) ||
133    '';
134  if (label.length > LABEL_MAX) label = label.slice(0, LABEL_MAX - 1) + '…';
135  return {
136    pct: pct,
137    filled: Math.round((done / total) * BAR_WIDTH),
138    step: currentIdx + 1,
139    total: total,
140    label: label,
141  };
142}
143
144function barString(filled) {
145  var bar = '';
146  for (var i = 0; i < BAR_WIDTH; i++) bar += i < filled ? FILLED : EMPTY;
147  return bar;
148}
149
150// ---- v0.2: tool-output summarizer ----
151
152function splitLines(t) {
153  return String(t).split(/\r?\n/);
154}
155
156function oneLine(t) {
157  return String(t)
158    .replace(/\s+/g, ' ')
159    .replace(/^\s+|\s+$/g, '');
160}
161
162function trunc(t, n) {
163  t = String(t);
164  return t.length > n ? t.slice(0, n - 1) + '…' : t;
165}
166
167// A line counts as failure evidence, unless it explicitly reports zero.
168// ("0 failed", "no failures" are good news, not failures.)
169function isFailLine(line) {
170  if (/\b0\s+(failed|failures|errors)\b/i.test(line)) return false;
171  if (/\bno\s+(failures|errors)\b/i.test(line)) return false;
172  return (
173    /\b(fail|failed|failure|error|errors|exception|panic|traceback|assert)\b/i.test(
174      line
175    ) || /[✗✘×]/.test(line)
176  );
177}
178
179// Look for framework summary counts, e.g. pytest "2 failed, 214 passed",
180// jest "Tests: 2 failed, 214 passed, 216 total", vitest "3 failed | 187 passed".
181function findSummaryCounts(lines) {
182  var failed = 0;
183  var passed = 0;
184  var found = false;
185  for (var i = 0; i < lines.length; i++) {
186    var line = lines[i];
187    var m =
188      line.match(/(\d+)\s+failed\s*[,|]\s*(\d+)\s+passed/i) ||
189      line.match(/tests:\s*(\d+)\s+failed\s*,\s*(\d+)\s+passed/i);
190    if (m) return { failed: +m[1], passed: +m[2] };
191    var mp = line.match(/(\d+)\s+(?:tests?\s+)?passed\b/i);
192    if (mp && !/\b0\s+passed\b/i.test(line)) {
193      passed = Math.max(passed, +mp[1]);
194      found = true;
195    }
196    var mf = line.match(/(\d+)\s+(?:tests?\s+)?failed\b/i);
197    if (mf && !/\b0\s+failed\b/i.test(line)) {
198      failed = Math.max(failed, +mf[1]);
199      found = true;
200    }
201  }
202  return found ? { failed: failed, passed: passed } : null;
203}
204
205// The first concrete failure line (skipping the counts summary itself).
206function firstFailDetail(lines) {
207  for (var i = 0; i < lines.length; i++) {
208    var line = lines[i].trim();
209    if (!line) continue;
210    if (/(\d+)\s+failed\s*[,|]\s*(\d+)\s+passed/i.test(line)) continue;
211    if (/tests:\s*\d+\s+failed/i.test(line)) continue;
212    if (isFailLine(line)) return trunc(oneLine(line), SUMMARY_DETAIL_MAX);
213  }
214  return '';
215}
216
217function countPassLines(lines) {
218  var n = 0;
219  for (var i = 0; i < lines.length; i++) {
220    var line = lines[i].trim();
221    if (!line || /\b0\s+passed\b/i.test(line)) continue;
222    if (/[✓✔]/.test(line) || /\b(passed|ok|success|successful)\b/i.test(line))
223      n++;
224  }
225  return n;
226}
227
228// Test/build logs: failures first, then pass counts.
229function summarizeLog(text) {
230  var lines = splitLines(text);
231  var counts = findSummaryCounts(lines);
232  var detail = firstFailDetail(lines);
233  if (counts) {
234    var s = '';
235    if (counts.passed) s += counts.passed + ' passed';
236    if (counts.failed) s += (s ? ', ' : '') + counts.failed + ' failed';
237    if (detail) s += ' — ' + detail;
238    if (s) return s;
239  }
240  if (detail) return detail;
241  var n = countPassLines(lines);
242  if (n > 0) return n + ' passed';
243  return '';
244}
245
246function tryJsonValue(text) {
247  var t = text.trim();
248  if (t.charAt(0) !== '{' && t.charAt(0) !== '[') return undefined;
249  try {
250    return JSON.parse(t);
251  } catch (err) {
252    return undefined;
253  }
254}
255
256// JSON output: show the skeleton, not the payload.
257// {status: "ok", results: [...300 items], total: 300}
258function jsonSkeleton(v, depth) {
259  if (Array.isArray(v)) return '[...' + v.length + ' items]';
260  if (v !== null && typeof v === 'object') {
261    if (depth >= 1) return '{...}';
262    var keys = Object.keys(v);
263    if (keys.length === 0) return '{}';
264    var shown = keys.slice(0, 8).map(function (k) {
265      return k + ': ' + jsonSkeleton(v[k], depth + 1);
266    });
267    return '{' + shown.join(', ') + (keys.length > 8 ? ', …' : '') + '}';
268  }
269  if (typeof v === 'string') return JSON.stringify(trunc(v, 40));
270  return String(v);
271}
272
273var LOCKFILE_RE =
274  /(^|\/)(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|Cargo\.lock|poetry\.lock|Pipfile\.lock|Gemfile\.lock|go\.sum|composer\.lock)$/;
275
276function isDiffText(text) {
277  return /(^|\n)diff --git |(^|\n)\+\+\+ b\//.test(text);
278}
279
280// Diffs: per-file +/- counts, lockfile churn collapsed to one note.
281function summarizeDiff(text) {
282  var lines = splitLines(text);
283  var files = [];
284  var cur = null;
285  for (var i = 0; i < lines.length; i++) {
286    var line = lines[i];
287    var m = line.match(/^diff --git a\/(.+?) b\/(.+)$/);
288    var mp = m ? null : line.match(/^\+\+\+ b\/(.+)$/);
289    var path = m ? m[2] : mp ? mp[1] : null;
290    if (path) {
291      // A `+++ b/` line right after its `diff --git` line is the same file,
292      // not a new one.
293      if (!cur || cur.path !== path) {
294        cur = { path: path, add: 0, del: 0 };
295        files.push(cur);
296      }
297      continue;
298    }
299    if (cur) {
300      if (/^\+(?!\+)/.test(line)) cur.add++;
301      else if (/^-(?!-)/.test(line)) cur.del++;
302    }
303  }
304  if (files.length === 0) return '';
305  var lock = files.filter(function (f) {
306    return LOCKFILE_RE.test(f.path);
307  });
308  var code = files.filter(function (f) {
309    return !LOCKFILE_RE.test(f.path);
310  });
311  function totals(fs) {
312    var a = 0;
313    var d = 0;
314    fs.forEach(function (f) {
315      a += f.add;
316      d += f.del;
317    });
318    return { a: a, d: d };
319  }
320  if (code.length === 0) {
321    var t = totals(files);
322    return (
323      'diff: ' +
324      files.length +
325      ' lockfile-only file' +
326      (files.length > 1 ? 's' : '') +
327      ' changed (+' +
328      t.a +
329      '/−' +
330      t.d +
331      '), noise hidden'
332    );
333  }
334  var parts = code.map(function (f) {
335    return f.path + ' (+' + f.add + '/−' + f.del + ')';
336  });
337  var s =
338    'diff: ' +
339    code.length +
340    ' file' +
341    (code.length > 1 ? 's' : '') +
342    ' — ' +
343    parts.slice(0, 4).join(', ');
344  if (parts.length > 4) s += ', …';
345  if (lock.length)
346    s += ' · ' + lock.length + ' lockfile' + (lock.length > 1 ? 's' : '') + ' hidden';
347  return s;
348}
349
350// Compress one tool output into a single summary line.
351// Returns { tool, text }, or null for empty input.
352export function summarizeOutput(tool, text) {
353  var t = typeof text === 'string' ? text : String(text == null ? '' : text);
354  var toolName = typeof tool === 'string' && tool ? tool : '';
355  if (!t.trim()) return null;
356  // Short outputs: show as-is, collapsed to one line.
357  if (t.length <= OUTPUT_LONG_THRESHOLD) {
358    return { tool: toolName, text: trunc(oneLine(t), OUTPUT_SUMMARY_MAX) };
359  }
360  var s = '';
361  if (isDiffText(t)) {
362    s = summarizeDiff(t) || summarizeLog(t);
363  } else {
364    var j = tryJsonValue(t);
365    s = j === undefined ? summarizeLog(t) : jsonSkeleton(j, 0);
366  }
367  if (!s) {
368    var first = splitLines(t).filter(function (l) {
369      return l.trim();
370    })[0];
371    s = trunc(oneLine(first || ''), OUTPUT_SUMMARY_MAX);
372  }
373  return { tool: toolName, text: trunc(oneLine(s), OUTPUT_SUMMARY_MAX) };
374}
375
376// Test seam: reset module state between smoke-test scenarios.
377// The mod loader ignores this export.
378export function __resetModState() {
379  latestTodos = [];
380  latestSummary = null;
381  lastToolName = '';
382}
383
384export function register(on) {
385  // Observe TodoWrite calls: snapshot the list and ask the engine to re-render.
386  on('tool.call', { tool: 'TodoWrite' }, async function ($, e, next) {
387    var t = extractTodos(e);
388    if (t) {
389      latestTodos = t;
390      $.ui.invalidate('ui.render');
391    }
392    return next(e);
393  });
394
395  // Remember the tool name of every tool call, so a tool.result event that
396  // does not name its own tool can still be labeled in the summary line.
397  on('tool.call', async function ($, e, next) {
398    var n = extractToolName(e);
399    if (n) lastToolName = n;
400    return next(e);
401  });
402
403  // Observe tool results: summarize the output, then re-render.
404  // Malformed events (no output) are fail-open: nothing changes, next runs.
405  on('tool.result', async function ($, e, next) {
406    var out = extractOutput(e);
407    if (out) {
408      var s = summarizeOutput(extractToolName(e) || lastToolName, out);
409      if (s) {
410        latestSummary = s;
411        $.ui.invalidate('ui.render');
412      }
413    }
414    return next(e);
415  });
416
417  // Band above the prompt. Return next(e) (draw nothing) when idle.
418  on('ui.render', { component: 'AbovePrompt' }, async function ($, e, next) {
419    var v = progressView(latestTodos);
420    if (!v) return next(e);
421    // await works whether resolve() is sync or async in this build.
422    var resolved = await $.ui.resolve(e);
423    var Box = resolved.Box;
424    var Text = resolved.Text;
425    var suffix =
426      ' ' +
427      v.pct +
428      '% · step ' +
429      v.step +
430      '/' +
431      v.total +
432      (v.label ? ' · ' + v.label : '');
433    var barLine = Box({
434      flexDirection: 'row',
435      children: [
436        Text({ color: 'green', children: barString(v.filled) }),
437        Text({ dimColor: true, children: suffix }),
438      ],
439    });
440    if (latestSummary && latestSummary.text) {
441      return Box({
442        flexDirection: 'column',
443        children: [
444          barLine,
445          Text({
446            dimColor: true,
447            children:
448              SUMMARY_PREFIX +
449              (latestSummary.tool ? latestSummary.tool + ' · ' : '') +
450              latestSummary.text,
451          }),
452        ],
453      });
454    }
455    return barLine;
456  });
457}
458