Turns an approved plan into a todo list above the prompt; Claude checks each step off only with verification evidence


A Claude Code mod that turns the plan you approve in plan mode into a todo list, and lets Claude check a step off only when it shows how it verified it.
━━━━──────── 1/3 Next Fix the refund logic [Show all]
At the prompt of a Claude Code terminal session:
/plugin install plan-checklist --marketplace Jh-jaehyuk/plan-checklist
Answer y to add the marketplace, then pick a scope (user scope loads it in every session). It is active right away.
plan_check tool, and must say which verification it ran and what came out (for example pytest tests/test_refund.py → 12 passed). A check without real evidence is refused. Only the main agent checks: any other agent (a subagent, a teammate, a workflow agent) is refused and reports its evidence instead, and the main agent verifies it before checking the step./compact, and /clear wipes it./checklist close stops tracking a plan that still has steps left, and tells Claude not to carry on with them. A resumed session does not bring it back.When every step is checked you get a toast and the bar turns green.
| Command | What it does |
|---|---|
/checklist | Lists every step with the evidence Claude gave for it |
/checklist close | Stops tracking the plan in progress, steps left or not, and tells Claude to stop working on it |
| Option | Values | Default |
|---|---|---|
language | en, ko | en |
Change it from /config, or in settings.json:
{ "pluginConfigs": { "plan-checklist": { "options": { "language": "ko" } } } }
The language applies to the band, the toasts, /checklist and the reminder Claude reads.
--resume, /resume) or a branch (/branch) rebuilds the list from its transcript, starting after the last /checklist close, so a plan approved more than 4096 messages back is not found.plan-checklist is a mod: it hooks these Claude Code events and changes nothing else.
| Event | What the hook does |
|---|---|
tool.call on ExitPlanMode | Lets the tool run, then reads the approved plan from its result. The result goes back unchanged. |
tool.call on plan_check | Stands in for the tool mcp__plan-checklist__plan_check on every call. That tool is the plugin's own, registered at session start, and this hook is its implementation: it checks the step off or refuses the check. No other tool stands behind it, so there is nothing for next to give back. |
command.run on checklist | Answers the plugin's own /checklist command, and /checklist close, which drops the list and leaves Claude a note that the plan was closed. |
UserPromptSubmit | While a plan is in progress, hands Claude the remaining steps with each prompt. The prompt itself is left as it is. |
Stop | When Claude ends a turn with steps unchecked, blocks it once and asks it to check what it verified or say why a step must wait. It blocks again only after a step is checked, so a step that waits on something else does not block every turn. |
session.start, SessionStart | Registers plan_check and /checklist. On a resume or a branch, reads the session's transcript to rebuild the list. |
session.end | On /clear, drops the list. |
ui.render on AbovePrompt | Draws the progress band above the prompt while a plan is in progress. |
plan-checklist sends nothing outside Claude Code. It makes no network requests and writes no files: the plan lives in the session's state, and a resumed session rebuilds it from its own transcript.
See CONTRIBUTING.md. Changes are listed in CHANGELOG.md.
MIT
hooks/register.tsx 206 lines1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register } from 'claude-code'
3
4import type { Messages } from './messages'
5import { messagesFor } from './messages'
6import { bandLayout, checkItem, checklistMarkdown, doneCount, extractPlan, filledCells, replayPlan, reminder, sinceLastClose, stepTitle } from './plan'
7
8const plan = atom({ plugin: 'plan-checklist', key: 'plan' } as const, null)
9const isExpanded = atom({ plugin: 'plan-checklist', key: 'isExpanded' } as const, false)
10// How many steps were done when a stop was last blocked: a step Claude cannot check yet blocks once, not every turn.
11const nudgedAt = atom({ plugin: 'plan-checklist', key: 'nudgedAt' } as const, null)
12
13const CHECK_TOOL = 'mcp__plan-checklist__plan_check'
14
15// Session state does not survive a resume (agent view's ←, /resume) or /branch: rebuild it from the transcript.
16async function restore($: EngineInterface, t: Messages) {
17 if ((await read($, plan)) !== null) {
18 return
19 }
20 const messages = await $.session.messages()
21 const restored = replayPlan(sinceLastClose(messages).flatMap(one => one.toolUses), CHECK_TOOL, t)
22 if (restored !== null) {
23 await update($, plan, () => restored)
24 }
25}
26
27export const register: Register = (on, options) => {
28 const t = messagesFor(options.language)
29
30 on('session.start', async ($, e, next) => {
31 await $.tool.register({
32 name: 'plan_check',
33 description: t.toolDescription,
34 inputSchema: {
35 type: 'object',
36 properties: {
37 item: { type: 'integer', description: t.itemParam },
38 evidence: { type: 'string', description: t.evidenceParam },
39 },
40 required: ['item', 'evidence'],
41 },
42 isDeferred: false,
43 })
44 await $.command.register({ name: 'checklist', description: t.commandDescription })
45 await restore($, t)
46
47 return next(e)
48 })
49
50 on('classic.SessionStart', async ($, e, next) => {
51 if (e.source === 'resume' || e.source === 'fork') {
52 await restore($, t)
53 }
54 return next(e)
55 }).catch(($, e, next) => next(e))
56
57 on('tool.call', { tool: 'ExitPlanMode' }, async ($, e, next) => {
58 const ran = await next(e)
59 if (ran.deny !== undefined || ran.isError === true || ran.result.plan === null) {
60 return ran
61 }
62
63 const extracted = extractPlan(ran.result.plan, t)
64 if (extracted === null) {
65 $.ui.toast(t.noStepsFound)
66 return ran
67 }
68 await update($, plan, () => extracted)
69 await update($, nudgedAt, () => null)
70 $.ui.toast(t.tracking(extracted.items.length))
71
72 return ran
73 }).catch(($, e, next) => next(e))
74
75 on('tool.call', { tool: CHECK_TOOL }, async ($, e) => {
76 // A subagent's word is not verification: it reports evidence, the main agent checks it and the step.
77 // This also keeps every check in the main transcript, which a resumed session replays.
78 if (e.agentId !== undefined) {
79 return { result: t.subagentCheck, isError: true as const }
80 }
81 const input = e as unknown as { item: number; evidence: string }
82 const outcome = checkItem(await read($, plan), Number(input.item), String(input.evidence ?? ''), t)
83 if ('error' in outcome) {
84 return { result: outcome.error, isError: true as const }
85 }
86
87 await update($, plan, () => outcome.plan)
88 const done = doneCount(outcome.plan)
89 const total = outcome.plan.items.length
90 $.ui.toast(done === total ? t.finished(outcome.plan.title) : t.checked(done, total))
91
92 return { result: t.checkResult(input.item, done, total) }
93 })
94
95 on('command.run', { command: 'checklist' }, async ($, e) => {
96 const current = await read($, plan)
97 if (current === null) {
98 return { text: t.commandNoPlan }
99 }
100 // The person ends the plan with steps left: stop tracking it and tell Claude not to carry on with them.
101 if (e.args.trim() === 'close') {
102 await update($, plan, () => null)
103 await update($, nudgedAt, () => null)
104 return { text: t.closed(current.title), context: [t.closedNote(current.title)] }
105 }
106 return { text: checklistMarkdown(current) }
107 })
108
109 // The reminder rides each prompt, next to the work, rather than the system prompt.
110 on('classic.UserPromptSubmit', async ($, e, next) => {
111 const result = await next(e)
112 const current = await read($, plan)
113 const text = current === null ? null : reminder(current, CHECK_TOOL, t)
114 if (text === null) {
115 return result
116 }
117 return { ...result, additionalContext: [...(result.additionalContext ?? []), text] }
118 }).catch(($, e, next) => next(e))
119
120 // A reminder can be read past; ending the turn with unchecked steps is stopped once per bit of progress.
121 on('classic.Stop', async ($, e, next) => {
122 const result = await next(e)
123 const current = await read($, plan)
124 const text = current === null ? null : reminder(current, CHECK_TOOL, t)
125 if (e.stop_hook_active || result.block !== undefined || current === null || text === null) {
126 return result
127 }
128 const done = doneCount(current)
129 if ((await read($, nudgedAt)) === done) {
130 return result
131 }
132 await update($, nudgedAt, () => done)
133 return { ...result, block: [text, t.stopGate].join('\n') }
134 }).catch(($, e, next) => next(e))
135
136 on('session.end', async ($, e, next) => {
137 if (e.reason === 'clear') {
138 await update($, plan, () => null)
139 await update($, nudgedAt, () => null)
140 }
141 return next(e)
142 })
143
144 on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
145 const current = await read($, plan)
146 if (e.props.hasSurvey || current === null) {
147 return next(e)
148 }
149
150 const done = doneCount(current)
151 const total = current.items.length
152 const isDone = done === total
153 const nextItem = current.items.findIndex(one => one.evidence === null)
154 const expanded = await read($, isExpanded)
155 const layout = bandLayout(e.props.bodyColumns)
156 const filled = filledCells(done, total, layout.barWidth)
157 const { Box, Button, Text } = $.ui.resolve(e)
158
159 // Collapsed: one line with the progress and the step Claude is on, or that all are done.
160 // Expanded: the same line titled with the plan, then every step.
161 const label = expanded ? current.title : isDone ? t.allDone(total) : stepTitle(current.items[nextItem]?.text ?? '')
162 return (
163 <Box flexDirection="column">
164 <Box columnGap={layout.gap}>
165 {layout.barWidth > 0 && (
166 <Text>
167 <Text color={isDone ? 'success' : 'suggestion'}>{'━'.repeat(filled)}</Text>
168 <Text color="subtle">{'─'.repeat(layout.barWidth - filled)}</Text>
169 </Text>
170 )}
171 <Text bold color={isDone ? 'success' : undefined}>
172 {done}/{total}
173 </Text>
174 <Box flexGrow={1}>
175 <Text wrap="truncate-end" color={isDone && !expanded ? 'success' : undefined}>
176 {!expanded && !isDone && layout.showLabel && <Text dimColor>{t.next} </Text>}
177 {label}
178 </Text>
179 </Box>
180 <Button
181 key="toggle"
182 label={expanded ? t.hide : t.showAll}
183 onPress={() => update($, isExpanded, now => !now)}
184 />
185 </Box>
186 {expanded &&
187 current.items.map((one, i) => (
188 <Text key={`item-${i}`} wrap="truncate-end" dimColor={i !== nextItem} bold={i === nextItem}>
189 {' '}
190 <Text color={one.evidence !== null ? 'success' : undefined}>
191 {one.evidence !== null ? '✓' : i === nextItem ? '›' : '○'}
192 </Text>{' '}
193 {i + 1}. {stepTitle(one.text)}
194 </Text>
195 ))}
196 {expanded && (
197 <Text color="subtle">
198 {' '}
199 {t.evidenceHint}
200 </Text>
201 )}
202 </Box>
203 )
204 })
205}
206hooks/messages.ts 99 lines1export type Lang = 'en' | 'ko'
2
3export type Messages = {
4 untitled: string
5 noPlan: string
6 noSuchItem: (item: number, total: number) => string
7 needEvidence: string
8 subagentCheck: string
9 reminderTitle: (title: string, done: number, total: number) => string
10 reminderLeft: string
11 reminderRule: (tool: string) => string
12 stopGate: string
13 toolDescription: string
14 itemParam: string
15 evidenceParam: string
16 commandDescription: string
17 commandNoPlan: string
18 closed: (title: string) => string
19 closedNote: (title: string) => string
20 noStepsFound: string
21 tracking: (count: number) => string
22 checked: (done: number, total: number) => string
23 finished: (title: string) => string
24 checkResult: (item: number, done: number, total: number) => string
25 next: string
26 allDone: (total: number) => string
27 showAll: string
28 hide: string
29 evidenceHint: string
30}
31
32export const MESSAGES: Record<Lang, Messages> = {
33 en: {
34 untitled: 'Plan',
35 noPlan: 'No plan in progress.',
36 noSuchItem: (item, total) => `There is no item ${item}. Pick one from 1 to ${total}.`,
37 needEvidence: 'Evidence is required. Give the verification command you actually ran and its result.',
38 subagentCheck: 'Only the main agent checks steps off. Put the commands you ran and their results in your report; the main agent verifies them and checks the step.',
39 reminderTitle: (title, done, total) => `# Plan in progress: ${title} (${done}/${total})`,
40 reminderLeft: 'Remaining items:',
41 reminderRule: tool =>
42 `When you finish an item, call ${tool} with { item, evidence }. Put the verification commands you actually ran in evidence, one per line as "command → result". Do not check an item you have not verified.`,
43 stopGate:
44 'Before ending the turn, check every step you have verified. For a step you cannot verify yet, say in one line why and what it waits for.',
45 toolDescription:
46 'Mark one item of the plan in progress as done. Call it only for an item you have verified, and put the verification command you ran and its result in evidence.',
47 itemParam: 'Item number (starting at 1)',
48 evidenceParam: 'One check per line, "command → result" (e.g. "pytest tests/x.py → 12 passed")',
49 commandDescription: 'Show the steps of the plan in progress with their evidence; close stops tracking it',
50 commandNoPlan: 'No plan in progress. Approve a plan in plan mode to start tracking it.',
51 closed: title => `Closed the plan: ${title}`,
52 closedNote: title =>
53 `The user closed the plan "${title}" with steps left. Stop tracking it: do not continue its remaining steps unless the user asks.`,
54 noStepsFound: 'plan-checklist: no steps found in the plan (use a numbered list or checkboxes)',
55 tracking: count => `Tracking ${count} steps from the approved plan`,
56 checked: (done, total) => `Step done (${done}/${total})`,
57 finished: title => `All steps done: ${title}`,
58 checkResult: (item, done, total) => `Item ${item} checked (${done}/${total})`,
59 next: 'Next',
60 allDone: total => `✓ All ${total} steps done`,
61 showAll: 'Show all',
62 hide: 'Hide',
63 evidenceHint: '/checklist shows the evidence for each step · /checklist close ends the plan',
64 },
65 ko: {
66 untitled: '계획',
67 noPlan: '진행 중인 계획이 없습니다.',
68 noSuchItem: (item, total) => `항목 ${item}은 없습니다. 1~${total} 중에서 고르세요.`,
69 needEvidence: '증거가 필요합니다. 실제로 돌린 검증 명령과 그 결과를 적으세요.',
70 subagentCheck: '단계 체크는 메인 에이전트만 합니다. 돌린 명령과 결과를 보고서에 담으세요. 메인 에이전트가 확인하고 체크합니다.',
71 reminderTitle: (title, done, total) => `# 진행 중인 계획: ${title} (${done}/${total})`,
72 reminderLeft: '남은 항목:',
73 reminderRule: tool =>
74 `항목을 끝내면 ${tool}를 { item, evidence }로 호출한다. evidence에는 실제로 돌린 검증을 "명령 → 결과" 형식으로 한 줄에 하나씩 적는다. 검증하지 않은 항목은 체크하지 않는다.`,
75 stopGate: '턴을 끝내기 전에 검증을 마친 항목을 모두 체크한다. 아직 검증할 수 없는 항목은 이유와 무엇을 기다리는지 한 줄로 적는다.',
76 toolDescription:
77 '진행 중인 계획의 항목 하나를 완료로 체크한다. 실제로 검증을 끝낸 항목에만 호출하고, evidence에 돌린 검증 명령과 결과를 적는다.',
78 itemParam: '항목 번호 (1부터)',
79 evidenceParam: '검증 하나당 한 줄, "명령 → 결과" (예: "pytest tests/x.py → 12 passed")',
80 commandDescription: '진행 중인 계획의 항목과 증거를 보여준다. close로 추적을 끝낸다',
81 commandNoPlan: '진행 중인 계획이 없어요. plan 모드에서 계획을 승인하면 생겨요.',
82 closed: title => `계획을 닫았어요: ${title}`,
83 closedNote: title =>
84 `사용자가 단계가 남은 계획 "${title}"을 닫았다. 더 이상 추적하지 않는다. 사용자가 요청하지 않으면 남은 단계를 이어서 진행하지 않는다.`,
85 noStepsFound: 'plan-checklist: 계획에서 항목을 찾지 못했어요 (번호 목록이나 체크박스가 필요해요)',
86 tracking: count => `승인된 계획에서 단계 ${count}개를 추적해요`,
87 checked: (done, total) => `단계 완료 (${done}/${total})`,
88 finished: title => `모든 단계 완료: ${title}`,
89 checkResult: (item, done, total) => `항목 ${item} 체크됨 (${done}/${total})`,
90 next: '다음',
91 allDone: total => `✓ ${total}단계 모두 완료`,
92 showAll: '전체 보기',
93 hide: '접기',
94 evidenceHint: '/checklist 로 단계별 증거를 볼 수 있어요 · /checklist close 로 계획을 닫아요',
95 },
96}
97
98export const messagesFor = (language: unknown): Messages => MESSAGES[language === 'ko' ? 'ko' : 'en']
99hooks/plan.ts 131 lines1import type { Plan, PlanItem } from '../types'
2
3import type { Messages } from './messages'
4
5const MAX_ITEMS = 20
6const MIN_EVIDENCE = 8
7
8const clean = (text: string) => text.replace(/\*\*|`/g, '').trim()
9
10// The first format that matches becomes the steps: checkboxes, then top-level numbers, then top-level bullets.
11const PATTERNS = [/^\s*[-*]\s+\[[ xX]\]\s+(.+)$/, /^\d+[.)]\s+(.+)$/, /^[-*]\s+(.+)$/]
12
13export function extractPlan(markdown: string, t: Messages): Plan | null {
14 const lines = markdown.split('\n')
15 const title = clean(lines.find(line => /^#\s+/.test(line))?.replace(/^#\s+/, '') ?? t.untitled)
16
17 for (const pattern of PATTERNS) {
18 const items: PlanItem[] = lines
19 .map(line => pattern.exec(line)?.[1])
20 .filter((text): text is string => text !== undefined)
21 .map(text => ({ text: clean(text), evidence: null }))
22 if (items.length > 0) {
23 return { title, items: items.slice(0, MAX_ITEMS) }
24 }
25 }
26 return null
27}
28
29export type CheckOutcome = { plan: Plan } | { error: string }
30
31export function checkItem(plan: Plan | null, item: number, evidence: string, t: Messages): CheckOutcome {
32 if (plan === null) {
33 return { error: t.noPlan }
34 }
35 const target = plan.items[item - 1]
36 if (target === undefined) {
37 return { error: t.noSuchItem(item, plan.items.length) }
38 }
39 if (evidence.trim().length < MIN_EVIDENCE) {
40 return { error: t.needEvidence }
41 }
42 const items = plan.items.map((one, i) =>
43 i === item - 1 ? { ...one, evidence: evidence.trim() } : one,
44 )
45 return { plan: { ...plan, items } }
46}
47
48// What the transcript holds of one tool call, as `$.session.messages()` lists it.
49export type ToolUseRecord = { tool: string; input: Record<string, unknown>; result?: unknown; text?: string }
50
51// `/checklist close` as the transcript keeps it. The note it leaves Claude is a meta row `$.session.messages()` skips.
52const CLOSE_ROW = /<command-name>\/(?:plan-checklist:)?checklist<\/command-name>[\s\S]*<command-args>\s*close\s*<\/command-args>/
53
54// Only what came after the last `/checklist close`: a closed plan must not come back on resume.
55export function sinceLastClose<M extends { role: string; text: string }>(messages: readonly M[]): M[] {
56 for (let i = messages.length - 1; i >= 0; i--) {
57 const one = messages[i]
58 if (one !== undefined && one.role === 'user' && CLOSE_ROW.test(one.text)) {
59 return messages.slice(i + 1)
60 }
61 }
62 return [...messages]
63}
64
65// A resumed session starts with empty state: replay its approved plans and checks to get the plan back.
66export function replayPlan(toolUses: ToolUseRecord[], checkTool: string, t: Messages): Plan | null {
67 let plan: Plan | null = null
68 for (const use of toolUses) {
69 const record = use.result as { plan?: unknown } | undefined
70 if (use.tool === 'ExitPlanMode' && typeof record?.plan === 'string') {
71 plan = extractPlan(record.plan, t) ?? plan
72 } else if (use.tool === checkTool && use.text !== undefined) {
73 const outcome = checkItem(plan, Number(use.input.item), String(use.input.evidence ?? ''), t)
74 if ('plan' in outcome) {
75 plan = outcome.plan
76 }
77 }
78 }
79 return plan
80}
81
82export const doneCount = (plan: Plan) => plan.items.filter(one => one.evidence !== null).length
83
84export function reminder(plan: Plan, tool: string, t: Messages): string | null {
85 const left = plan.items
86 .map((one, i) => ({ ...one, n: i + 1 }))
87 .filter(one => one.evidence === null)
88 if (left.length === 0) {
89 return null
90 }
91 return [
92 t.reminderTitle(plan.title, doneCount(plan), plan.items.length),
93 t.reminderLeft,
94 ...left.map(one => `${one.n}. ${one.text}`),
95 t.reminderRule(tool),
96 ].join('\n')
97}
98
99// How many of `width` cells the progress bar fills.
100export const filledCells = (done: number, total: number, width: number) =>
101 total === 0 ? 0 : Math.round((done / total) * width)
102
103export type BandLayout = { barWidth: number; gap: number; showLabel: boolean }
104
105// The band shrinks for narrow panes (tmux splits): the word label goes first, then the bar.
106export const bandLayout = (columns: number): BandLayout =>
107 columns >= 70
108 ? { barWidth: 12, gap: 2, showLabel: true }
109 : columns >= 45
110 ? { barWidth: 6, gap: 1, showLabel: false }
111 : { barWidth: 0, gap: 1, showLabel: false }
112
113// "Write the test: run pytest" → "Write the test"; a colon inside a word (localhost:8000) is not a split.
114export const stepTitle = (text: string) => text.split(/:\s/)[0]?.trim() || text
115
116export const evidenceLines = (evidence: string) =>
117 evidence
118 .split(/\n|;\s/)
119 .map(line => line.trim())
120 .filter(line => line.length > 0)
121
122export function checklistMarkdown(plan: Plan): string {
123 const nextItem = plan.items.findIndex(one => one.evidence === null)
124 const blocks = plan.items.map((one, i) => {
125 const mark = one.evidence !== null ? '✓' : i === nextItem ? '›' : '○'
126 const evidence = one.evidence === null ? [] : evidenceLines(one.evidence).map(line => ` ${line}`)
127 return [`${mark} ${i + 1}. ${stepTitle(one.text)}`, ...evidence].join('\n')
128 })
129 return [`${plan.title} · ${doneCount(plan)}/${plan.items.length}`, ...blocks].join('\n\n')
130}
131types/index.d.ts 10 lines1export type PlanItem = { text: string; evidence: string | null }
2
3export type Plan = { title: string; items: PlanItem[] }
4
5declare module 'claude-code' {
6 interface PluginState {
7 'plan-checklist': { plan: Plan | null; isExpanded: boolean; nudgedAt: number | null }
8 }
9}
10