SLOPSHOPPER

review-ledger

Keeps review findings (H1, M3, L2...) per repo across sessions and ticks them off when their PR merges

paneguardcommandtoastprompttool
v0.1.0MITupdated 2026-10-11ipartington/claude-mods/review-ledger
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · review-ledger
│ ┃ Review items ✕ › fix the failing auth test and add an audit log call │ ┃ No review items yet. Ask Claude for a │ ┃ review. ⏺ Read(src/auth.ts) │ ⎿ 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 │ │ › /review │ ⎿ review-ledger: 0 review item(s) for this repo. │ │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Pane · Review items
No review items yet. Ask Claude for a review.
README

claude-mods

Six Claude Code mods that remove the routine I kept doing by hand. Each one comes from an audit of my last 30 Claude Code sessions. A mod is a plugin of function hooks: it runs inside Claude Code and can draw a band above the prompt, a pane, a toast or a status line, and can step into prompts, tool calls and the session's start and end.

ModThe habit it removesWhat you seeUsage cost
merge-followthroughTyping "616 merged" (61 times in 30 sessions), then Claude spending a turn on git checkout main && git pull and deleting the branch; ! git pull by hand at session startBand of your open PRs with CI ✓ ✗ …; toast when a merge has been pulled; /prsNone
handoff-on-clear"give me a prompt to restart", "I've lost your feedback, can you redisplay" after /clearToast on save; band ↺ Handoff from last session [Load] [Dismiss]; /handoffOne cached fork per /clear (option summarize, on by default)
bg-task-band"how are we looking", "any updates", "when's the estimated end time?"Band: ⏳ Wait for cp-22 recap 12m/25m · TASK [drain]; toast on finishNone
review-ledger"what's left to do from the review?", updating the H/M/L list by handSidebar of items by severity, docked right of the transcript while items are left (/review opens it any time); toast when an item's PR mergesNone
tts-liteA Stop hook starting a full claude -p per reply to speak a summary, which left 200 stray transcriptsAudio onlyShort replies none; longer ones one bare Haiku completion
command-guardA "never run X" lesson kept only in memory, which subagents never read; an agent deleting a CNPG primary pod and losing five weeks of dataA refused tool call with the reason; nothing otherwiseNone

How each one works

merge-followthrough: polls gh pr list --author @me every 60 s. When a PR it saw open is merged, it checks out the default branch, pull --ff-onlys, deletes the local branch and prunes, as long as the working tree is clean. On your next prompt it tells Claude what it already did, so Claude doesn't redo it. Typing 616 merged runs the same steps at once. At session start it fast-forwards the default branch if you're on it with no changes.

handoff-on-clear: on session.end (a /clear or an exit) it saves the last answer, your recent asks, PR numbers and artifact links mentioned, the branch, and (with summarize) a 200-word handoff from one $.model.fork, which the API serves mostly from the prompt cache. It's kept per directory for three days. It goes to Claude when you press Load, run /handoff, or ask something like "redisplay" or "prompt to restart".

bg-task-band: records background Bash, Monitor and Agent calls as they start, reads each one's output file every 10 s for the last line, and marks it done from the task notification that arrives when it ends. A TaskStop marks it stopped. Finished tasks stay on the band for 90 s.

review-ledger: registers the tool mcp__review-ledger__items, which Claude calls to record findings (H1, M3, L2) and their state: open, in-progress with a PR number, done, or won't do. It's stored per repository root, so it survives /clear and new sessions. Every 5 minutes it checks in-progress PRs and marks an item done when its PR merges. A prompt that says "review" or names an item gets the ledger as context. While items are left it opens its pane by itself (option sidebar, on by default), at session start or when Claude records the first new ones. In the fullscreen layout ("tui": "fullscreen") from 144 columns (110 once you've opened it before), the pane docks right of the transcript as a 44-column sidebar: open items grouped by severity, notes underneath, finished ones folded into a count. On the main screen, or when narrower, it sits above the prompt as a compact list.

tts-lite: on turn.complete it reads replies of 20 words or fewer out as they are, and asks Haiku for one sentence about anything longer. It plays them through Piper and paplay, or espeak. It reads the same CLAUDE_TTS, CLAUDE_TTS_SPEED, CLAUDE_TTS_VOICE and CLAUDE_TTS_MODEL variables as the shell hook it replaces, and stays silent while that hook (tts-speak.sh) is still in ~/.claude/settings.json, so you never hear double.

command-guard: on every Bash and Monitor call, the main loop's and each subagent's, it reads <project root>/.claude/command-guards.json and refuses the command when a guard matches, giving Claude the guard's reason. A guard names a command and regexes the rest of that shell segment must match (allOf, and at least one of anyOf). The command has to be in command position (segment start, after a quote, sudo, timeout N or ssh host), so a commit message that only mentions it passes. No rules file, no effect; the rules live in each project, not here. Commands you type with ! are not tool calls and are never refused.

Install

Requirements: Claude Code 2.1.288 or later (function-hook mods are early access and the API moves between releases), plus git and an authenticated gh for merge-followthrough and review-ledger. tts-lite needs paplay and Piper or espeak.

Load them for every session by listing the folders in CLAUDE_CODE_PLUGIN_DIRS (colon-separated) in the env block of ~/.claude/settings.json:

{
  "env": {
    "CLAUDE_CODE_PLUGIN_DIRS": "~/code/claude-mods/merge-followthrough:~/code/claude-mods/handoff-on-clear:~/code/claude-mods/bg-task-band:~/code/claude-mods/review-ledger:~/code/claude-mods/tts-lite:~/code/claude-mods/command-guard"
  }
}

For one session only:

claude --plugin-dir ./merge-followthrough --plugin-dir ./bg-task-band

Or copy them into a session's hot-reload folder:

scripts/sync.sh ~/.claude/dev-mods/<session-id>

Layout

<mod>/
  .claude-plugin/plugin.json   manifest (name, version, options, state contract)
  hooks/hooks.json             { "modules": ["./register.tsx"] }
  hooks/register.tsx           the hooks module
  types/index.d.ts             $.state contract (mods that keep state)
  tests/*.test.ts              claude plugin test
scripts/
  check-mods.sh                validate / test the mods given files touch
  typecheck.sh                 tsc against Claude Code's generated API types
  sync.sh                      copy mods into a load folder

Development

pip install pre-commit && pre-commit install
claude plugin validate <mod>
claude plugin test <mod>
scripts/typecheck.sh            # all mods

The pre-commit hooks run standard hygiene, gitleaks, shellcheck, and for the mods a commit touches: claude plugin validate, a TypeScript check and claude plugin test. The type-check needs the API declarations Claude Code writes into .claude-plugin/types/ when it loads a mod. Those are generated per build, git-ignored, and found automatically in any ~/.claude/dev-mods copy. Without them the type-check is skipped with a note.

See AGENTS.md for the conventions an agent (or a person) should follow when changing a mod.

License

MIT

Source 2 files
hooks/register.tsx 233 lines
1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register } from 'claude-code'
3
4import type { ReviewItem } from '../types'
5
6// A per-repo ledger of review findings (H1, M3, L2...) that survives /clear.
7// Claude writes to it through a tool; merged PRs tick items off; a pane and
8// /review show it; prompts that name an item get the ledger as context.
9// With the `sidebar` option (on by default) the pane opens by itself while
10// items are left: in the fullscreen layout it docks to the right of the
11// transcript as a narrow sidebar, grouped by severity.
12
13const items = atom({ plugin: 'review-ledger', key: 'items' } as const, [])
14
15const PANE = 'review-ledger'
16const TOOL = 'items'
17const TOOL_ID = `mcp__review-ledger__${TOOL}`
18const POLL_MS = 5 * 60_000
19const SIDEBAR_COLUMNS = 44
20const SEVERITY = { H: 'High', M: 'Medium', L: 'Low' } as Record<string, string>
21const ITEM_REF = /\b[HMLhml]\d{1,2}\b/
22const ORDER = { H: 0, M: 1, L: 2 } as Record<string, number>
23
24let repoKey = ''
25
26async function repoRoot($: EngineInterface): Promise<string> {
27  const r = await $.process.run(['git', 'rev-parse', '--show-toplevel']).catch(() => undefined)
28  return r?.exitCode === 0 ? r.stdout.trim() : await $.session.cwd()
29}
30
31async function save($: EngineInterface, list: ReviewItem[]) {
32  const sorted = [...list].sort(
33    (a, b) => (ORDER[a.id[0]?.toUpperCase() ?? ''] ?? 9) - (ORDER[b.id[0]?.toUpperCase() ?? ''] ?? 9)
34      || Number(a.id.slice(1)) - Number(b.id.slice(1)),
35  )
36  await update($, items, () => sorted)
37  await $.store.set(repoKey, sorted)
38}
39
40function summary(list: ReviewItem[], only?: Set<string>): string {
41  const rows = list
42    .filter(i => !only || only.has(i.id) || i.status === 'open' || i.status === 'in-progress')
43    .map(i => `- ${i.id} [${i.status}${i.pr ? ` #${i.pr}` : ''}] ${i.title}${i.note ? ` (${i.note})` : ''}`)
44  const done = list.filter(i => i.status === 'done').length
45  const wont = list.filter(i => i.status === 'wontdo').length
46  return `[review-ledger] Review items for this repo (${done} done, ${wont} won't do, ${list.length - done - wont} left):\n${rows.join('\n')}\n` +
47    `Update it with the ${TOOL_ID} tool as items change.`
48}
49
50function remaining(list: ReviewItem[]): number {
51  return list.filter(i => i.status === 'open' || i.status === 'in-progress').length
52}
53
54async function openPane($: EngineInterface) {
55  await $.ui.open({ id: PANE, title: 'Review items', columns: SIDEBAR_COLUMNS })
56}
57
58async function checkMerged($: EngineInterface) {
59  const list = await read($, items)
60  const waiting = list.filter(i => i.status === 'in-progress' && i.pr > 0)
61  if (waiting.length === 0) return
62  let changed = false
63  const next = [...list]
64  for (const item of waiting) {
65    const r = await $.process.run(['gh', 'pr', 'view', String(item.pr), '--json', 'state']).catch(() => undefined)
66    if (!r || r.exitCode !== 0) continue
67    const state = (JSON.parse(r.stdout) as { state: string }).state
68    if (state === 'MERGED') {
69      const at = next.findIndex(i => i.id === item.id)
70      next[at] = { ...item, status: 'done' }
71      changed = true
72      $.ui.toast(`${item.id} done: #${item.pr} merged`)
73    }
74  }
75  if (changed) await save($, next)
76}
77
78export const register: Register = (on, options) => {
79  const sidebar = options.sidebar !== false
80
81  on('session.start', async ($, e, next) => {
82    repoKey = `ledger:${await repoRoot($)}`
83    const saved = ((await $.store.get(repoKey)) as ReviewItem[] | undefined) ?? []
84    await update($, items, () => saved)
85
86    await $.command.register({
87      name: 'review',
88      description: 'Open the review-items pane for this repo',
89      argumentHint: '[list]',
90    })
91    await $.tool.register({
92      name: TOOL,
93      description:
94        'The persistent ledger of code/security review findings for this repo (ids like H1, M3, L2 by severity). ' +
95        'Call it with action "upsert" to record findings when you finish a review, and whenever an item\'s state ' +
96        'changes: "in-progress" with the PR number once a fix PR is open (it is marked done automatically when that PR merges), ' +
97        '"wontdo" with a note when the user declines one, "done" when fixed without a PR. Action "list" returns the ledger.',
98      inputSchema: {
99        type: 'object',
100        properties: {
101          action: { type: 'string', enum: ['list', 'upsert', 'remove'] },
102          items: {
103            type: 'array',
104            items: {
105              type: 'object',
106              properties: {
107                id: { type: 'string', description: 'Severity letter and number, e.g. H4' },
108                title: { type: 'string' },
109                status: { type: 'string', enum: ['open', 'in-progress', 'done', 'wontdo'] },
110                pr: { type: 'number' },
111                note: { type: 'string' },
112              },
113              required: ['id'],
114            },
115          },
116        },
117        required: ['action'],
118      },
119    })
120    $.clock.every(POLL_MS, () => void checkMerged($))
121    void checkMerged($)
122    if (sidebar && remaining(saved) > 0) $.clock.after(0, () => void openPane($))
123
124    return next(e)
125  })
126
127  on('tool.call', { tool: /^mcp__review-ledger__items$/ }, async ($, e) => {
128    const input = e as unknown as { action: string; items?: Partial<ReviewItem>[] }
129    const list = await read($, items)
130
131    if (input.action === 'upsert' || input.action === 'remove') {
132      const byId = new Map(list.map(i => [i.id, i]))
133      for (const raw of input.items ?? []) {
134        const id = String(raw.id ?? '').toUpperCase()
135        if (!id) continue
136        if (input.action === 'remove') {
137          byId.delete(id)
138          continue
139        }
140        const old = byId.get(id)
141        byId.set(id, {
142          id,
143          title: raw.title ?? old?.title ?? '',
144          status: raw.status ?? old?.status ?? 'open',
145          pr: raw.pr ?? old?.pr ?? 0,
146          note: raw.note ?? old?.note ?? '',
147        })
148      }
149      const had = remaining(list)
150      await save($, [...byId.values()])
151      if (sidebar && had === 0 && remaining(await read($, items)) > 0) $.clock.after(0, () => void openPane($))
152    }
153
154    return { result: summary(await read($, items)) }
155  })
156
157  on('command.run', { command: 'review' }, async ($, e) => {
158    const list = await read($, items)
159    if (e.args.trim() === 'list') return { text: list.length ? summary(list) : 'No review items for this repo yet.' }
160    await openPane($)
161    return { text: `${list.length} review item(s) for this repo.` }
162  })
163
164  on('prompt.submit', async ($, e, next) => {
165    const list = await read($, items)
166    if (list.length === 0 || e.origin.kind !== 'composer') return next(e)
167    const named = new Set([...e.text.matchAll(new RegExp(ITEM_REF, 'g'))].map(m => m[0].toUpperCase()))
168    if (named.size === 0 && !/\breview\b/i.test(e.text)) return next(e)
169    return next({ ...e, context: [...(e.context ?? []), summary(list, named)] })
170  })
171
172  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
173    const { Box, Text } = $.ui.resolve(e)
174    const list = await read($, items)
175    const mark = { open: '○', 'in-progress': '◐', done: '●', wontdo: '–' } as const
176    const color = { open: 'yellow', 'in-progress': 'cyan', done: 'green', wontdo: 'gray' } as const
177    const left = remaining(list)
178    const isDocked = e.props.placement === 'dock'
179
180    if (list.length === 0) return <Text dimColor>No review items yet. Ask Claude for a review.</Text>
181
182    const row = (i: ReviewItem) => (
183      <Box key={i.id}>
184        <Text color={color[i.status]}>{mark[i.status]} </Text>
185        <Text bold>{i.id.padEnd(4)}</Text>
186        <Text dimColor={i.status === 'done' || i.status === 'wontdo'} wrap="truncate">
187          {i.title}
188          {i.pr ? ` #${i.pr}` : ''}
189        </Text>
190      </Box>
191    )
192
193    if (!isDocked) {
194      return (
195        <Box flexDirection="column">
196          <Text bold>{left} left of {list.length}</Text>
197          {list.map(row)}
198        </Box>
199      )
200    }
201
202    // Docked sidebar: open work first, grouped by severity, notes on a second
203    // line; finished items collapse to a count at the bottom.
204    const active = list.filter(i => i.status === 'open' || i.status === 'in-progress')
205    const finished = list.length - active.length
206    const groups = ['H', 'M', 'L']
207      .map(sev => ({ sev, rows: active.filter(i => i.id[0]?.toUpperCase() === sev) }))
208      .filter(g => g.rows.length > 0)
209
210    return (
211      <Box flexDirection="column">
212        <Text bold>{left} left of {list.length}</Text>
213        {groups.map(g => (
214          <Box key={g.sev} flexDirection="column" marginTop={1}>
215            <Text bold dimColor>{SEVERITY[g.sev]} ({g.rows.length})</Text>
216            {g.rows.map(i => (
217              <Box key={i.id} flexDirection="column">
218                {row(i)}
219                {i.note && <Text dimColor wrap="truncate">{'      '}{i.note}</Text>}
220              </Box>
221            ))}
222          </Box>
223        ))}
224        {finished > 0 && (
225          <Box marginTop={1}>
226            <Text dimColor>{finished} done or won't do</Text>
227          </Box>
228        )}
229      </Box>
230    )
231  })
232}
233
types/index.d.ts 16 lines
1export type ReviewItem = {
2  id: string
3  title: string
4  status: 'open' | 'in-progress' | 'done' | 'wontdo'
5  pr: number
6  note: string
7}
8
9declare module 'claude-code' {
10  interface PluginState {
11    'review-ledger': {
12      items: ReviewItem[]
13    }
14  }
15}
16