SLOPSHOPPER

read-only

Band above the prompt showing READ-ONLY or APPLY; blocks file edits while read-only.

bandguardprompttool
v0.2.0MITupdated 2026-10-25shalom2552/agent-skills/skills/read-only
A shopper browsing a rack in a slop shop
README

Agent Skills

Skills and mods for Claude-Code.

Install

curl -fsSL shalom2552.github.io/agent-skills/install | bash

Or clone and run ./install. See ./install --help for options.

Skills

SkillDescription
docs-syncFind and fix drift between docs and code.
dotconfAnswer, change, and remember dotfile and app configs.
read-onlyLock the session to read-only; change nothing.
setup-sh25-skillsInstall, manage and wire up shalom2552's agent-skills assets.
system-auditRead-only health, security and cleanliness audit of this machine.
system-fixDiagnose, fix, and document a system or config fault on this machine.
to-promptWrite a handoff prompt for a fresh agent.
visualizeTurn any subject into a visual HTML page.
walk-with-meLearn languages and idioms by coding with a coach.

Mods

Claude Code plugins.

/plugin install <mod> --marketplace shalom2552/agent-skills
ModDescription
spinner-wordsSwap the spinner verbs for dev ones.
tape/tape pane of tool calls per turn.
frameRounded frame around your prompts.
beatTurn time and usage as pills.
statuslineBottom status line for claude.
badgesBadge above the prompt for active skill.
tdiffLive diff of session changes.

Settings

Small JSON files that ./install merges into the scope's settings.json.

./install settings --scope global -y
SettingDescription
tmux-truecolorTruecolor inside tmux, so mod hex colors render right.
Source 2 files
hooks/register.tsx 124 lines
1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register } from 'claude-code'
3
4import type { Mode } from '../types'
5
6export const TOOL = 'mcp__read-only__mode'
7
8const SESSIONS = 'sessions'
9const MAX_SESSIONS = 20
10
11const mode = atom({ plugin: 'read-only', key: 'mode' } as const, 'off' as Mode)
12
13const savedOf = (raw: unknown): Record<string, unknown> =>
14  typeof raw === 'object' && raw !== null && !Array.isArray(raw) ? { ...(raw as Record<string, unknown>) } : {}
15
16const save = async ($: EngineInterface, next: Mode) => {
17  const id = await $.session.id()
18  const saved = savedOf(await $.store.get(SESSIONS))
19  delete saved[id]
20  const kept = Object.entries(saved).slice(1 - MAX_SESSIONS)
21  await $.store.set(SESSIONS, Object.fromEntries(next === 'off' ? kept : [...kept, [id, next]]))
22}
23
24const restore = async ($: EngineInterface) => {
25  if (savedOf(await $.store.get(SESSIONS))[await $.session.id()] === 'read-only') await update($, mode, () => 'read-only')
26}
27
28const set = async ($: EngineInterface, next: Mode) => {
29  await update($, mode, () => next)
30  if (next !== 'apply') await save($, next).catch(() => undefined)
31}
32
33export const register: Register = on => {
34  on('session.start', async ($, e, next) => {
35    await $.tool.register({
36      name: 'mode',
37      description:
38        'Set the /read-only mode band. "apply" right before making a change the user explicitly approved; "off" when the user leaves read-only.',
39      inputSchema: {
40        type: 'object',
41        properties: { mode: { type: 'string', enum: ['apply', 'off'] } },
42        required: ['mode'],
43      },
44    })
45    await restore($).catch(() => undefined)
46
47    return next(e)
48  })
49
50  on('session.end', async ($, e, next) => {
51    if (e.reason === 'clear' || e.reason === 'resume') await update($, mode, () => 'off')
52
53    return next(e)
54  })
55
56  on('skill.prompt', { skill: 'read-only' }, async ($, e, next) => {
57    await set($, 'read-only')
58
59    return next(e)
60  })
61
62  on('tool.call', { tool: TOOL }, async ($, e) => {
63    const asked = (e as { mode?: unknown }).mode
64    if (asked !== 'apply' && asked !== 'off') return { result: 'mode must be "apply" or "off".' }
65    if (asked === 'apply' && (await read($, mode)) === 'off') return { result: 'Read-only is not on.' }
66    await set($, asked)
67
68    return { result: asked === 'apply' ? 'APPLY until this turn ends.' : 'Read-only off.' }
69  })
70
71  on('tool.call', { tool: ['Edit', 'Write', 'NotebookEdit'] }, async ($, e, next) =>
72    (await read($, mode)) === 'read-only'
73      ? { deny: `Read-only: edits are blocked. Get the user's explicit approval for this change, then call ${TOOL} with "apply".` }
74      : next(e),
75  ).catch(($, e, next) => (next.called ? next(e) : { deny: 'Read-only: its edit guard failed.' }))
76
77  on('turn.complete', async ($, e, next) => {
78    if (e.agentId === undefined && (await read($, mode)) === 'apply') await set($, 'read-only')
79
80    return next(e)
81  })
82
83  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
84    const current = await read($, mode)
85    if (current === 'off' || e.props.hasSurvey) return next(e)
86
87    const { Box, Button, Text } = $.ui.resolve(e)
88    const isApply = current === 'apply'
89    const rest = await next(e)
90
91    return (
92      <Box flexDirection="column">
93        <Box gap={1}>
94          <Text bold inverse color={isApply ? 'warning' : 'planMode'}>
95            {isApply ? ' APPLY ' : ' READ-ONLY '}
96          </Text>
97          {!e.props.isWorking && !isApply && (
98            <Button
99              variant="primary"
100              key="apply"
101              label="Apply"
102              onPress={async () => {
103                await set($, 'apply')
104                void $.prompt.submit({ text: 'Apply that.', asUser: true })
105              }}
106            />
107          )}
108          {!e.props.isWorking && (
109            <Button
110              key="exit"
111              label="Exit"
112              onPress={async () => {
113                await set($, 'off')
114                void $.prompt.submit({ text: 'Leave read-only.', asUser: true })
115              }}
116            />
117          )}
118        </Box>
119        {rest}
120      </Box>
121    )
122  })
123}
124
types/index.d.ts 8 lines
1export type Mode = 'off' | 'read-only' | 'apply'
2
3declare module 'claude-code' {
4  interface PluginState {
5    'read-only': { mode: Mode }
6  }
7}
8