SLOPSHOPPER

prompt-box

Draws your own prompts in the scrollback inside a thick colored box; /prompt-color sets the color

rowscommandprompt
v0.1.0no licenseupdated 2026-10-06ekinertac/claude-code-mods/prompt-box
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · prompt-box
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ ❯ fix the failing auth test and add an audit log call ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ⏺ 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 › /prompt-color ⎿ prompt-box: Prompt color: gray. Use /prompt-color [red|blue|green|yellow|purple|orange|pink|cyan|default|#hex|reset]. Also ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Your message
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ ❯ fix the failing auth test and add an audit log call ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
README

claude-code-mods

Claude Code mods I use daily.

  • rewrite-prompt: press Ctrl+P and the draft in the prompt box is rewritten in place by a model (Sonnet, on your plan). Nothing is sent until you press Enter, and Ctrl+_ undoes it.
  • write-for-me: press Ctrl+N and the next prompt is written for you from the last 12 messages of the conversation. If the box has text, it is used as a hint ("tests too") and expanded. Nothing is sent, and Ctrl+_ undoes it.
  • prompt-box: the prompts you type are drawn in the scrollback inside a thick colored box instead of one > text line. /prompt-color [red|blue|green|yellow|purple|orange|pink|cyan|default|#hex|reset] sets the color, keeps it across sessions, and open sessions pick it up at their next prompt. The default is gray. Most names follow your terminal's color scheme. Purple, orange, pink and hex values are fixed. Task notifications and messages from other sessions keep their normal rows. No key binding needed.
  • tool-oneline: each tool call is drawn as one line (⏺ Bash(echo hello) (ctrl+o to expand)) with no result block under it. Set detail to runs for one line per run of calls (⏺ Ran 3 tools: Bash ×2, Read). Ctrl+O still shows the full rows. A failed call keeps its error text. Tools named in the show option (default SendUserFile, comma-separated) are drawn in full with their output and end a run.

Setup

claude plugin marketplace add ekinertac/claude-code-mods
claude plugin install rewrite-prompt@ekinertac-mods
claude plugin install write-for-me@ekinertac-mods
claude plugin install prompt-box@ekinertac-mods
claude plugin install tool-oneline@ekinertac-mods

Then bind the keys. Add these to the Global block of ~/.claude/keybindings.json and start a new session:

"ctrl+p": "app:toggleDiffNoiseFilter",
"ctrl+n": "app:toggleDiffPreSession"

To use the runs level, add this to ~/.claude/settings.json:

"pluginConfigs": { "tool-oneline": { "options": { "detail": "runs" } } }

How the shortcut works

No keybinding action runs a mod command. The mod draws a zero-size button above the prompt whose action is app:toggleDiffNoiseFilter (inert outside the diff panel; write-for-me uses app:toggleDiffPreSession the same way, so the two never share an action), and the chord you bind to that action presses it. Nothing shows on screen.

Limits

  • Tested on Claude Code 2.1.287. Mod events and methods can change between releases.
  • The rewrite replaces the draft. It keeps the intent, language and concrete details, and adds no requirements.
  • Not checked in every terminal: if you see a blank row above the prompt, open an issue.
  • Tests: claude plugin test <mod> (stubs the model, no network).
Source 2 files
hooks/register.tsx 132 lines
1// prompt-box: draws the prompts you typed in a thick colored box in the scrollback.
2//
3// Why: the engine draws a typed prompt as one `> text` line, which is easy to lose when you scroll
4// back through long agent output. A full-width bordered box is visible at scroll speed.
5// How: a ui.render hook on the UserMessage row, matched on origin.kind 'composer', so task
6// notifications, peer messages and plugin prompts keep the engine's own rows.
7// The chevron sits in its own column, so wrapped and multi-line prompts line up under the first
8// character of the text instead of under the chevron.
9// The text is drawn as given and wraps; the stored message and what the model reads do not change.
10// Pasted text is stored wrapped in <pasted_content id="..."> tags for the model; they are noise to
11// a reader, so they are removed from the drawn text only.
12// Color: /prompt-color <name|#hex|default|reset> sets the border and chevron color; `default` and
13// `reset` both go back to gray. The value lives in $.state (so the rows redraw at once) and in
14// $.store (so it survives a restart). Most names are the terminal's ANSI colors and follow its
15// color scheme; purple, orange, pink and any #hex are fixed colors, because ANSI has no such hue.
16// Global: the store is one file per user, but each session keeps its own copy in $.state, so a
17// change made in one session reaches the others when they next submit a prompt (syncColor).
18// Constraint: the box costs two extra rows per prompt (top and bottom border), and it also shows in
19// the ctrl+o transcript.
20// Related: ../types/index.d.ts is the $.state contract.
21
22import { atom, read, update } from 'claude-code'
23import type { Engine, Register } from 'claude-code'
24
25const DEFAULT_COLOR = 'gray'
26const BORDER = 'bold' // thick lines
27const CHEVRON = '❯'
28const STORE_KEY = 'color'
29
30const color = atom({ plugin: 'prompt-box', key: 'color' } as const, DEFAULT_COLOR)
31
32// The 16 ANSI names the terminal draws; the bright ones are Ink's `<name>Bright`.
33const BASE = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
34const NAMES = ['gray', ...BASE, ...BASE.filter(n => n !== 'black').map(n => `${n}Bright`)]
35const HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i
36
37// Hues the 16 ANSI colors lack, stored by name and resolved to their hex when drawn.
38const FIXED: Record<string, string> = { purple: '#a855f7', orange: '#f97316', pink: '#ec4899' }
39
40// What the command shows as the choices: the common names first, as people type them.
41const HINT = 'red|blue|green|yellow|purple|orange|pink|cyan|default|#hex|reset'
42
43const PASTE_TAG = /<\/?pasted_content[^>]*>/g
44
45// Tags out, then the blank lines they leave: trim the ends and keep at most one empty line between.
46function readable(text: string): string {
47  return text.replace(PASTE_TAG, '').trim().replace(/\n{3,}/g, '\n\n')
48}
49
50// A name is matched case-insensitively and returned in its canonical spelling; null when the input
51// is neither a known name nor a hex color.
52function parse(input: string): string | null {
53  const v = input.trim()
54  if (HEX.test(v)) return v.toLowerCase()
55  const all = [...NAMES, ...Object.keys(FIXED)]
56  return all.find(n => n.toLowerCase() === v.toLowerCase()) ?? null
57}
58
59// Declared at the top level because `claude plugin validate` only follows `$` into such functions.
60async function setColor($: Engine, value: string) {
61  await update($, color, () => value)
62  if (value === DEFAULT_COLOR) await $.store.delete(STORE_KEY)
63  else await $.store.set(STORE_KEY, value)
64}
65
66// Takes the saved color into this session's state, so a color set in another session shows here at
67// the next prompt without a restart. One small file read per prompt. An unset or invalid value means
68// the default.
69async function syncColor($: Engine) {
70  const saved = await $.store.get(STORE_KEY)
71  const value = (typeof saved === 'string' ? parse(saved) : null) ?? DEFAULT_COLOR
72  if (value !== (await read($, color))) await update($, color, () => value)
73}
74
75async function run($: Engine, args: string) {
76  const arg = args.trim()
77  await syncColor($)
78  const current = await read($, color)
79  if (!arg) {
80    return `Prompt color: ${current}. Use /prompt-color [${HINT}]. Also: ${NAMES.join(', ')}.`
81  }
82  if (['reset', 'default'].includes(arg.toLowerCase())) {
83    await setColor($, DEFAULT_COLOR)
84    return `Prompt color reset to ${DEFAULT_COLOR}.`
85  }
86  const next = parse(arg)
87  if (!next) return `"${arg}" is not a color. Use [${HINT}].`
88  await setColor($, next)
89  return `Prompt color set to ${next}.`
90}
91
92export const register: Register = on => {
93  on('session.start', async ($, e, next) => {
94    await $.command.register({
95      name: 'prompt-color',
96      description: 'Set the color of the box around your prompts',
97      argumentHint: `[${HINT}]`,
98    })
99    await syncColor($)
100    return next(e)
101  })
102
103  on('prompt.submit', async ($, e, next) => {
104    await syncColor($)
105    return next(e)
106  })
107
108  on('command.run', { command: 'prompt-color' }, async ($, e) => ({ text: await run($, e.args) }))
109
110  on('ui.render', { component: 'UserMessage', props: { origin: { kind: 'composer' } } }, async ($, e, next) => {
111    // Let the hooks beneath see this row too, though the drawing below replaces their result: the
112    // tool-oneline mod reads the ctrl+o "expanded" flag from user rows, and a hook that answers
113    // without next would hide every prompt from it.
114    await next(e)
115    const { Box, Text } = $.ui.resolve(e)
116    const name = await read($, color)
117    const c = FIXED[name] ?? name
118    return (
119      <Box borderStyle={BORDER} borderColor={c} paddingX={1} width="100%">
120        <Box marginRight={1}>
121          <Text color={c} bold>
122            {CHEVRON}
123          </Text>
124        </Box>
125        <Box flexGrow={1} flexShrink={1}>
126          <Text wrap="wrap">{readable(e.props.text)}</Text>
127        </Box>
128      </Box>
129    )
130  })
131}
132
types/index.d.ts 8 lines
1declare module 'claude-code' {
2  interface PluginState {
3    'prompt-box': { color: string }
4  }
5}
6
7export type PromptColor = string
8