A calm view of Claude Code for non-technical users — tool calls, diffs and command output are hidden while one checklist above the prompt shows the plan, the…

A mod (a hooks plugin, not a skill) that makes Claude Code feel calm for people who aren't technical. While Claude works, tool calls, file diffs and command output are hidden, and one checklist above the prompt shows the plan, what is happening now and how far along it is.
Build my landing page · 1m 12s
✓ Read your brand notes ■■■■■■■■■■ Done
▶ Build the pricing section ■■■■■■□□□□ 60%
○ Add the contact form □□□□□□□□□□ Next
○ Polish the footer □□□□□□□□□□ Up next
plan_steps lays out the steps up front, report_progress fills the meter; TodoWrite and TaskCreate lists also feed the checklist/plugin install clean-view@ai-marketplace
Choose the user scope to have it in every session. It is a terminal (/plugin) install.
Nothing to do: the card appears when you send a request. To stop using it, disable the plugin with /plugin.
plan_steps (or TodoWrite / TaskCreate) every other tool call is denied, so each request costs one extra tool call. After 3 denials in one job the gate lets calls through, so it cannot deadlock. Subagents are never gated.claude plugin validate plugins/clean-view
claude plugin test plugins/clean-viewhooks/register.tsx 8 lines1import type { Register } from 'claude-code'
2
3import { registerCleanView } from './clean-view'
4
5export const register: Register = on => {
6 registerCleanView(on)
7}
8hooks/clean-view.tsx 528 lines1import { atom, read, update } from 'claude-code'
2import type { Register } from 'claude-code'
3
4import type { Checklist, CleanPhase, CleanTask } from '../types'
5
6type On = Parameters<Register>[0]
7
8const tick = atom({ plugin: 'clean-view', key: 'tick' } as const, 0)
9const isCommandDraft = atom({ plugin: 'clean-view', key: 'isCommandDraft' } as const, false)
10
11export const IDLE: Checklist = {
12 title: '',
13 phase: 'idle',
14 tasks: [],
15 needsYouReason: null,
16 stuckReason: null,
17 startedAt: 0,
18 finishedAt: null,
19}
20const checklist = atom({ plugin: 'clean-view', key: 'checklist' } as const, IDLE)
21
22const PLAN = 'mcp__clean-view__plan_steps'
23const REPORT = 'mcp__clean-view__report_progress'
24const ALWAYS_ALLOWED = new Set([
25 'ToolSearch', 'TodoWrite', 'TaskCreate', 'TaskUpdate', 'AskUserQuestion', PLAN, REPORT,
26])
27const MAX_NAME = 40
28const METER = 10
29const LABEL = 8
30const CARD_WIDTH = 76
31const PHASE_COLOR: Record<string, string> = {
32 working: 'cyan',
33 'needs-you': 'yellow',
34 stuck: 'red',
35 paused: 'gray',
36 stopped: 'gray',
37 done: 'green',
38}
39
40// ---------- pure helpers (exported for tests) ----------
41
42const CODE_EXT = /\.(tsx?|jsx?|mjs|cjs|json|ya?ml|toml|md|mdx|py|rb|go|rs|java|kt|cs|php|css|scss|html?|sh|sql|lock|env)\b/i
43
44export const cleanName = (raw: string): string => {
45 const words = raw
46 .replace(/`[^`]*`/g, ' ')
47 .split(/\s+/)
48 .filter(w => w !== '' && !w.includes('/') && !w.includes('\\') && !CODE_EXT.test(w))
49 let s = words.join(' ').trim()
50 if (s === '') return 'Working on it'
51 s = s.charAt(0).toUpperCase() + s.slice(1)
52 if (s.length > MAX_NAME) {
53 const cut = s.slice(0, MAX_NAME - 1)
54 const at = cut.lastIndexOf(' ')
55 s = `${(at > 8 ? cut.slice(0, at) : cut).trimEnd()}…`
56 }
57 return s
58}
59
60// The naming model sometimes answers a vague follow-up ("also update that page")
61// with a refusal or a question instead of a name; that must never become the title.
62const NOT_A_NAME = /^(i|i'm|im|sorry|unfortunately|as an)\b|\b(can't|cannot|unable|don't have|not enough|more context|no context|clarify)\b|\?/i
63
64export const jobName = (reply: string): string | null => {
65 const line = reply.split('\n').map(l => l.trim()).find(l => l !== '') ?? ''
66 const bare = line.replace(/^["'*\s]+|["'*.\s]+$/g, '')
67 if (bare === '' || NOT_A_NAME.test(bare) || bare.split(/\s+/).length > 8) return null
68 const name = cleanName(bare)
69 return name === 'Working on it' ? null : name
70}
71
72const task = (id: string, name: string): CleanTask => ({
73 id, name, status: 'upcoming', percent: 0, hasReported: false,
74})
75
76export const normalize = (tasks: CleanTask[]): CleanTask[] => {
77 let seen = false
78 return tasks.map(t => {
79 if (t.status === 'done') return { ...t, percent: 100, hasReported: true }
80 if (!seen) {
81 seen = true
82 return { ...t, status: 'active' as const }
83 }
84 return { ...t, status: 'upcoming' as const, percent: 0, hasReported: false }
85 })
86}
87
88export const placeholders = (): CleanTask[] =>
89 normalize([task('ph-1', 'Understand your request'), task('ph-2', 'Plan the steps')])
90
91export const hasRealPlan = (tasks: readonly CleanTask[]): boolean =>
92 tasks.some(t => !t.id.startsWith('ph-'))
93
94export const planSteps = (names: readonly string[]): CleanTask[] =>
95 normalize(names.slice(0, 8).map((n, i) => task(`s-${i + 1}`, cleanName(n))))
96
97export const reportProgress = (
98 tasks: readonly CleanTask[],
99 name: string,
100 rawPercent: number,
101): CleanTask[] => {
102 const percent = Math.min(100, Math.max(0, Math.round(Number.isFinite(rawPercent) ? rawPercent : 0)))
103 const clean = cleanName(name)
104 const key = clean.toLowerCase()
105 let list = tasks.filter(t => !t.id.startsWith('ph-')).map(t => ({ ...t }))
106 let i = list.findIndex(t => t.name.toLowerCase() === key)
107 if (i < 0) i = list.findIndex(t => t.name.toLowerCase().includes(key) || key.includes(t.name.toLowerCase()))
108 if (i < 0) {
109 list = [...list, task(`s-${list.length + 1}`, clean)]
110 i = list.length - 1
111 }
112 list = list.map((t, j) => (j < i ? { ...t, status: 'done' as const } : t))
113 list[i] =
114 percent >= 100
115 ? { ...list[i], status: 'done', percent: 100, hasReported: true }
116 : { ...list[i], status: 'active', percent, hasReported: true }
117 return normalize(list)
118}
119
120export const fromTodos = (
121 todos: ReadonlyArray<{ content: string; status: string }>,
122): CleanTask[] =>
123 normalize(
124 todos.map((t, i) => ({
125 ...task(`t-${i + 1}`, cleanName(t.content)),
126 status: t.status === 'completed' ? ('done' as const) : ('upcoming' as const),
127 })),
128 )
129
130export const errorSentence = (text: string): string => {
131 const s = text.toLowerCase()
132 if (/rate.?limit|usage limit|429|quota/.test(s)) return 'you hit your usage limit, try again a little later'
133 if (/overload|529|busy|unavailable|503/.test(s)) return "Claude's servers are busy, try again in a minute"
134 if (/context|too long|too many tokens|prompt is too long/.test(s)) return 'type /compact and try again'
135 if (/network|econn|enotfound|fetch failed|connection|timed? ?out|offline/.test(s)) return 'the internet connection dropped'
136 if (/auth|login|api key|401|credential|token expired/.test(s)) return 'type /login'
137 return 'something went wrong, try again'
138}
139
140export const asksQuestion = (answer: string): boolean => answer.trimEnd().slice(-200).includes('?')
141
142export const isCommandText = (text: string): boolean => text.trimStart().startsWith('/')
143
144export const formatElapsed = (ms: number): string => {
145 const s = Math.max(0, Math.floor(ms / 1000))
146 const m = Math.floor(s / 60)
147 return m > 0 ? `${m}m ${s % 60}s` : `${s}s`
148}
149
150export const meter = (t: CleanTask, frame: number, isWaiting: boolean): string => {
151 if (t.status === 'done') return '■'.repeat(METER)
152 if (t.status === 'upcoming') return '□'.repeat(METER)
153 if (!t.hasReported && !isWaiting) {
154 const pos = (frame % (METER + 3)) - 3
155 return Array.from({ length: METER }, (_, i) => (i >= pos && i < pos + 3 ? '■' : '□')).join('')
156 }
157 const filled = Math.round((t.percent / 100) * METER)
158 return '■'.repeat(filled) + '□'.repeat(METER - filled)
159}
160
161const pad = (s: string, width: number): string => {
162 const cut = s.length > width ? `${s.slice(0, Math.max(1, width - 1))}…` : s
163 return cut.padEnd(width)
164}
165
166// ---------- the mod ----------
167
168let timer: { cancel: () => void } | undefined
169let failures = 0
170let denials = 0
171
172
173function syncTimer($: any, phase: CleanPhase): void {
174 const isLive = phase === 'working' || phase === 'needs-you'
175 if (isLive && timer === undefined) {
176 timer = $.clock.every(250, () => {
177 void update($, tick, n => n + 1)
178 })
179 } else if (!isLive && timer !== undefined) {
180 timer.cancel()
181 timer = undefined
182 }
183}
184
185async function patch($: any, fn: (c: Checklist) => Checklist): Promise<Checklist> {
186 const next = await update($, checklist, fn)
187 const c = (next ?? (await read($, checklist))) as Checklist
188 syncTimer($, c.phase)
189 return c
190}
191
192async function finish($: any, phase: CleanPhase, extra: Partial<Checklist>): Promise<void> {
193 const now = await $.clock.now()
194 await patch($, c => ({ ...c, phase, finishedAt: now, ...extra }))
195}
196
197async function resume($: any): Promise<void> {
198 await patch($, c => ({ ...c, phase: 'working', needsYouReason: null, stuckReason: null, finishedAt: null }))
199}
200
201
202export const registerCleanView = (on: On): void => {
203 on('session.start', async ($, e, next) => {
204 await $.tool.register({
205 name: 'plan_steps',
206 description:
207 'Lay out every step of the job up front, 2 to 8 short plain-English names in order. The first step starts right away.',
208 inputSchema: {
209 type: 'object',
210 properties: { steps: { type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 8 } },
211 required: ['steps'],
212 },
213 isDeferred: false,
214 })
215 await $.tool.register({
216 name: 'report_progress',
217 description:
218 'Report progress on a step of the plan. percent is 0 to 100; send 100 the moment the step finishes.',
219 inputSchema: {
220 type: 'object',
221 properties: { task: { type: 'string' }, percent: { type: 'number' } },
222 required: ['task', 'percent'],
223 },
224 isDeferred: false,
225 })
226 return next(e)
227 })
228
229 // A local command (/model, /clear ...) empties the prompt without a prompt.submit,
230 // so the "command draft" flag has to be released here or the band stays hidden.
231 on('command.run', async ($, e, next) => {
232 if (await read($, isCommandDraft)) await update($, isCommandDraft, () => false)
233 return next(e)
234 })
235
236 on('prompt.compose', async ($, e, next) => {
237 const out = await next(e)
238 const text = [
239 'Clean View is active: the person sees only a checklist of your plan, not your tool calls.',
240 '- Write every step name in plain English a non-technical person understands, under 40 characters, starting with a verb, like "Build the pricing section".',
241 '- Never put file paths, file names, commands, code or tool names in a step name.',
242 `- For every request, even a quick question, call ${PLAN} first (load it with ToolSearch if it is deferred). Then call ${REPORT} as real progress happens, and with percent 100 the moment a step finishes.`,
243 '- If TodoWrite or TaskCreate is available, its to-do list can serve as the plan instead.',
244 ].join('\n')
245 return { ...out, sections: [...out.sections, { id: 'clean-view:rules', text, scope: 'session' as const }] }
246 })
247
248 on('turn.start', async ($, e, next) => {
249 if (e.text.trim().startsWith('/')) return next(e)
250 const c = await read($, checklist)
251 if (c.phase === 'working' || c.phase === 'needs-you') {
252 await patch($, cur => ({ ...cur, phase: 'working', needsYouReason: null }))
253 return next(e)
254 }
255 // A turn with no typed prompt (e.g. the retry after /login) carries on the same job.
256 if (e.text === '' && c.phase !== 'idle' && c.phase !== 'done') {
257 await resume($)
258 return next(e)
259 }
260 const now = await $.clock.now()
261 failures = 0
262 denials = 0
263 await patch($, () => ({
264 ...IDLE,
265 title: 'Working on it',
266 phase: 'working',
267 tasks: placeholders(),
268 startedAt: now,
269 }))
270 void $.model
271 .complete({
272 model: 'haiku',
273 effort: 'low',
274 maxTokens: 30,
275 prompt: [
276 'Name this job in 2 to 6 plain words, starting with a verb. Reply with the name only.',
277 'The request may be a follow-up to earlier work you cannot see. Never refuse, apologise or ask a question: name it from its own words, like "Update the review findings page".',
278 '',
279 `Request: ${e.text.slice(0, 500)}`,
280 ].join('\n'),
281 })
282 .then(async (r: any) => {
283 if (!r.isAnswered) return
284 const name = jobName(String(r.text))
285 if (name === null) return
286 await update($, checklist, cur => (cur.startedAt === now ? { ...cur, title: name } : cur))
287 })
288 .catch(() => undefined)
289 return next(e)
290 })
291
292 on('tool.call', async ($, e, next) => {
293 if (e.agentId !== undefined) return next(e)
294 const c = await read($, checklist)
295 const isJob = c.phase === 'working' || c.phase === 'needs-you' || c.phase === 'stuck'
296 if (isJob && !hasRealPlan(c.tasks) && !ALWAYS_ALLOWED.has(e.tool) && denials < 3) {
297 denials += 1
298 return {
299 deny: `Clean View needs a plan first. Call ${PLAN} with 2 to 8 short plain-English steps, then continue.`,
300 }
301 }
302 if (c.phase === 'needs-you' || (c.phase === 'working' && c.needsYouReason !== null)) {
303 await patch($, cur => ({ ...cur, phase: 'working', needsYouReason: null }))
304 }
305 if (e.tool === 'AskUserQuestion') {
306 await patch($, cur => ({ ...cur, phase: 'needs-you', needsYouReason: 'Claude has a question for you' }))
307 } else if (e.tool === 'TodoWrite') {
308 const todos = (e as { todos?: Array<{ content: string; status: string }> }).todos ?? []
309 await patch($, cur => ({ ...cur, tasks: fromTodos(todos) }))
310 } else if (e.tool === 'TaskCreate') {
311 const subject = String((e as { subject?: string }).subject ?? '')
312 await patch($, cur => {
313 const real = cur.tasks.filter(t => !t.id.startsWith('ph-'))
314 return { ...cur, tasks: normalize([...real, task(`n-${real.length + 1}`, cleanName(subject))]) }
315 })
316 } else if (e.tool === 'TaskUpdate') {
317 const u = e as { taskId?: string; status?: string; subject?: string }
318 await patch($, cur => {
319 const list = cur.tasks
320 .filter(t => !(u.status === 'deleted' && t.id === `n-${u.taskId}`))
321 .map(t => {
322 if (t.id !== `n-${u.taskId}`) return t
323 const name = u.subject !== undefined ? cleanName(u.subject) : t.name
324 if (u.status === 'completed') return { ...t, name, status: 'done' as const }
325 return { ...t, name }
326 })
327 return { ...cur, tasks: normalize(list) }
328 })
329 }
330 return next(e)
331 }).catch(($, e, next) => next(e))
332
333 on('tool.call', { tool: PLAN }, async ($, e) => {
334 const steps = ((e as { steps?: unknown }).steps ?? []) as unknown
335 const names = Array.isArray(steps) ? steps.map(String) : []
336 if (names.length === 0) return { deny: 'Give at least one step.' }
337 const tasks = planSteps(names)
338 await patch($, c => ({ ...c, tasks }))
339 return { result: `Planned ${tasks.length} steps. The first one has started.` }
340 })
341
342 on('tool.call', { tool: REPORT }, async ($, e) => {
343 const r = e as { task?: string; percent?: number }
344 const percent = Math.min(100, Math.max(0, Number(r.percent ?? 0)))
345 await patch($, c => ({ ...c, tasks: reportProgress(c.tasks, String(r.task ?? ''), percent) }))
346 return { result: `Progress noted: ${Math.round(percent)}%.` }
347 })
348
349 on('classic.Notification', async ($, e, next) => {
350 const c = await read($, checklist)
351 if (c.phase === 'working' || c.phase === 'needs-you') {
352 await patch($, cur => ({ ...cur, phase: 'needs-you', needsYouReason: 'Claude needs your OK to continue' }))
353 }
354 return next(e)
355 })
356
357 on('classic.PermissionDenied', async ($, e, next) => {
358 await patch($, c => ({
359 ...c, phase: 'stuck', stuckReason: 'you said no to a step, so Claude paused',
360 }))
361 return next(e)
362 })
363
364 on('classic.PostToolUseFailure', async ($, e, next) => {
365 if (e.is_interrupt === true) return next(e)
366 failures += 1
367 if (failures >= 3) {
368 await patch($, c => ({
369 ...c, phase: 'stuck', stuckReason: 'a step keeps failing, Claude is trying another way',
370 }))
371 }
372 return next(e)
373 })
374
375 on('classic.PostToolUse', async ($, e, next) => {
376 failures = 0
377 const c = await read($, checklist)
378 if (c.phase === 'stuck') await patch($, cur => ({ ...cur, phase: 'working', stuckReason: null }))
379 return next(e)
380 })
381
382 // A turn that died on an API error leaves the card Stuck; the next model request means
383 // the work is going again (the engine retries after /login without a new turn.start).
384 on('turn.step', async function* ($, e, next) {
385 if (e.agentId === undefined) {
386 const c = await read($, checklist)
387 if (c.phase === 'stuck' && c.finishedAt !== null) await resume($)
388 }
389 return yield* next(e)
390 })
391
392 on('turn.complete', async ($, e, next) => {
393 if (e.agentId !== undefined) return next(e)
394 const c = await read($, checklist)
395 if (c.phase === 'idle') return next(e)
396 if (e.reason === 'error') {
397 await finish($, 'stuck', { stuckReason: errorSentence(e.answer) })
398 } else if (e.reason === 'refusal') {
399 await finish($, 'stuck', { stuckReason: "Claude couldn't help with that request" })
400 } else if (e.reason === 'aborted') {
401 await finish($, 'stopped', {})
402 } else if (c.tasks.some(t => t.status !== 'done')) {
403 if (asksQuestion(e.answer)) {
404 await patch($, cur => ({
405 ...cur, phase: 'needs-you', needsYouReason: 'Claude is waiting for your reply',
406 }))
407 syncTimer($, 'idle')
408 } else {
409 await finish($, 'paused', {})
410 }
411 } else {
412 await finish($, 'done', {})
413 }
414 return next(e)
415 })
416
417 // While a slash command is being typed the engine's command menu opens just above
418 // the band; step out of its way until the draft is sent or cleared.
419 on('prompt.edit', async ($, e, next) => {
420 const r = await next(e)
421 const is = isCommandText(r.text)
422 if (is !== (await read($, isCommandDraft))) await update($, isCommandDraft, () => is)
423 return r
424 })
425
426 on('prompt.submit', async ($, e, next) => {
427 if (await read($, isCommandDraft)) await update($, isCommandDraft, () => false)
428 return next(e)
429 })
430
431 // Hide the technical rows.
432 for (const component of ['ToolUse', 'ToolResult', 'ToolGroup'] as const) {
433 on('ui.render', { component }, async ($, e, next) => {
434 const { Box } = $.ui.resolve(e)
435 return <Box />
436 })
437 }
438
439 on('ui.render', { component: 'ToolProgress' }, async ($, e, next) => {
440 return next({ ...e, props: { ...e.props, hint: '' } })
441 })
442
443 on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
444 if (e.props.hasSurvey) return next(e)
445 const { Box, Text } = $.ui.resolve(e)
446 // Keep the mods below this one in the band (e.g. session-header) instead of replacing them, and
447 // draw the card above them.
448 const below = await next(e).catch(() => null)
449 const stack = (band: any) => (
450 <Box flexDirection="column">
451 {band}
452 {below}
453 </Box>
454 )
455 const c = await read($, checklist)
456 const frame = await read($, tick)
457 const isCommand = await read($, isCommandDraft)
458 const now = await $.clock.now()
459
460 if (isCommand || c.phase === 'idle') return below ?? <Box />
461
462 const cardWidth = Math.min(e.props.bodyColumns, CARD_WIDTH)
463 const inner = cardWidth - 4
464
465 const took = formatElapsed((c.finishedAt ?? now) - c.startedAt)
466 let left: any
467 if (c.phase === 'working') {
468 left = <Text bold>{c.title} · {took}</Text>
469 } else if (c.phase === 'needs-you') {
470 left = (
471 <Text>
472 <Text inverse bold> Needs you </Text> {c.needsYouReason}
473 </Text>
474 )
475 } else if (c.phase === 'stuck') {
476 left = <Text color="red">⚠ Stuck: {c.stuckReason}</Text>
477 } else if (c.phase === 'paused') {
478 const remaining = c.tasks.filter(t => t.status !== 'done').length
479 left = <Text dimColor>{`⏸ Paused · ${c.title} · ${remaining} step${remaining === 1 ? '' : 's'} left`}</Text>
480 } else if (c.phase === 'stopped') {
481 left = <Text dimColor>■ Stopped · {c.title} · you pressed Esc</Text>
482 } else {
483 left = <Text color="green">✓ All done · {c.title} · took {took}</Text>
484 }
485
486 const header = <Box width={inner}>{left}</Box>
487
488 const isWaiting = c.phase === 'needs-you' || c.phase === 'paused'
489 const nameWidth = Math.max(8, Math.min(MAX_NAME, inner - 2 - 1 - METER - 2 - LABEL))
490 const first = c.tasks.find(x => x.status === 'upcoming')
491
492 return stack(
493 <Box
494 marginTop={1}
495 flexDirection="column"
496 width={cardWidth}
497 paddingX={1}
498 borderStyle="round"
499 borderColor={PHASE_COLOR[c.phase] ?? 'gray'}
500 >
501 {header}
502 {c.tasks.length > 0 && <Text dimColor>{'─'.repeat(inner)}</Text>}
503 {c.tasks.map(t => {
504 const icon = t.status === 'done' ? '✓' : t.status === 'active' ? (isWaiting ? '‖' : '▶') : '○'
505 const label =
506 t.status === 'done'
507 ? 'Done'
508 : t.status === 'active'
509 ? t.hasReported ? `${t.percent}%` : 'Working'
510 : t === first ? 'Next' : 'Up next'
511 const isActive = t.status === 'active'
512 return (
513 <Text key={t.id} dimColor={!isActive}>
514 <Text color={t.status === 'done' ? 'green' : isActive ? PHASE_COLOR[c.phase] : undefined}>{icon} </Text>
515 <Text bold={isActive}>{pad(t.name, nameWidth)}</Text>
516 {' '}
517 <Text color={t.status === 'done' ? 'green' : isActive ? PHASE_COLOR[c.phase] : undefined}>
518 {meter(t, frame, isWaiting)}
519 </Text>
520 {' '}{label.padEnd(LABEL)}
521 </Text>
522 )
523 })}
524 </Box>
525 )
526 })
527}
528types/index.d.ts 26 lines1export type CleanTask = {
2 id: string
3 name: string
4 status: 'done' | 'active' | 'upcoming'
5 percent: number
6 hasReported: boolean
7}
8
9export type CleanPhase = 'idle' | 'working' | 'needs-you' | 'stuck' | 'paused' | 'stopped' | 'done'
10
11export type Checklist = {
12 title: string
13 phase: CleanPhase
14 tasks: CleanTask[]
15 needsYouReason: string | null
16 stuckReason: string | null
17 startedAt: number
18 finishedAt: number | null
19}
20
21declare module 'claude-code' {
22 interface PluginState {
23 'clean-view': { checklist: Checklist; tick: number; isCommandDraft: boolean }
24 }
25}
26