SLOPSHOPPER

venv-guard

Rewrites Bash calls to use BackEnd/venv/bin explicitly instead of source activate.

newpaneguardcommandtoast
v0.2.0no licenseupdated 2026-10-13fhva29/claude-code-mods/venv-guard
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · venv-guard
│ ┃ venv-guard ✕ › fix the failing auth test and add an audit log call │ ┃ No rewrites yet. │ ⏺ 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 │ │ › /venv-guard │ ⎿ venv-guard: venv-guard pane opened. │ │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Pane · venv-guard
No rewrites yet.
README

claude-code-mods

Personal Claude Code mods, published as one local-style marketplace named heitor-mods.

Install

Requires a Claude Code build with mod (function hooks) support.

1. Add the marketplace. The repository is private, so gh auth login (or any git credential that can read it) must work first.

claude plugin marketplace add fhva29/claude-code-mods

Or clone it and add the folder; Claude Code then reads the mods straight from it, so an edit plus /reload-plugins is enough, with no reinstall:

git clone https://github.com/fhva29/claude-code-mods ~/.claude/mods
claude plugin marketplace add ~/.claude/mods

2. Install the mods you want (user scope):

claude plugin install next-lite@heitor-mods
claude plugin install tidy-tools@heitor-mods
# ...or all of them:
for m in blast-radius commit-gate model-stack next-lite pixel-quest prompt-git \
         replay-theater tidy-tools usage-weather brief-mode; do
  claude plugin install "$m@heitor-mods"
done

3. Reload inside Claude Code with /reload-plugins.

Options (userConfig) are set in /plugin → pick the mod → configure, then /reload-plugins. They are stored in ~/.claude/settings.json under pluginConfigs.

Mods

ModWhat it doesCommand
next-liteSuggests up to three next prompts above the input (press 1/2/3 to fill the prompt box, 0 to dismiss; the top one is also Tab ghost text). Sends a ~1–2k token digest of the turn to a small model instead of forking the whole session, so its cost does not grow with the conversation. Replacement for next-steps. Options: mode (auto/manual), model, minAnswerChars, suggestSkills./next
model-stackRoutes the model and effort of the main chat turn and of each subagent with TypeSafe's Jev, and shows the roster, decisions and agent graph in a pane. Needs TYPESAFE_API_KEY in the environment./stack
tidy-toolsDraws each tool call as one compact line, or folds a whole turn into one "N steps this turn" line./lines
blast-radiusHolds risky shell commands (rm -rf, git reset --hard, git clean, force push, migrations) and shows what they would change, with Proceed and Cancel buttons.
commit-gateHolds git commit in a pane listing the staged files, flags files not edited this session and blocks AI attribution trailers.
replay-theaterSteps through the file edits Claude made in the last turn, one diff at a time./replay
usage-weatherA forecast band above the prompt: context fill, sparkline, rate limits, model and effort.
prompt-gitAppends the git branch and working-tree counts to the hint line under the prompt.
pixel-questReplaces the spinner with a pixel RPG scene for each tool, with XP, levels and achievements. No model calls./toons
brief-modeAppends a short-answer style section to the system prompt: answer or next action first, numbered steps, lists capped at five, no preamble, recap or closers. Edit hooks/rules.ts to tune it.
midnight-neonDraws assistant replies with a dark neon palette: filled h1 banner, colored h2–h6, colored bullets, quote bars, highlighted bold, italic, inline code and links. Fences and tables keep the engine's renderer. Not installed by default; /neon flips it per session, `claude plugin enable\disable` flips it for good./neon

_archive holds mods that are kept but not in use (branch-hud); they are not listed in the marketplace.

Development

Each mod is a folder with .claude-plugin/plugin.json, hooks/hooks.json and a hooks module (register.ts or register.tsx). Check one with:

claude plugin validate <mod>
claude plugin test <mod>

claude plugin test does not type-check; run tsc against the SDK declarations Claude Code writes to <mod>/.claude-plugin/types/ as well.

next-lite builds on next-steps (MIT, Thariq Shihipar): it reuses the text sanitizer and the reply parsing, and replaces the session fork with a small digest.

Source 3 files
hooks/register.tsx 66 lines
1import { atom, read, update } from 'claude-code'
2import type { Register } from 'claude-code'
3
4import type { RewriteEntry } from '../types'
5import { rewriteCommand } from './rewrite'
6
7const PANE = 'venv-guard'
8const history = atom({ plugin: 'venv-guard', key: 'history' } as const, [])
9
10export const register: Register = on => {
11  on('session.start', async ($, e, next) => {
12    await $.command.register({
13      name: 'venv-guard',
14      description: 'Show the Bash commands venv-guard rewrote in this session',
15    })
16
17    return next(e)
18  })
19
20  on('command.run', { command: 'venv-guard' }, async $ => {
21    await $.ui.open({ id: PANE, title: 'venv-guard' })
22
23    return { text: 'venv-guard pane opened.' }
24  })
25
26  on('tool.call', { tool: 'Bash' }, async ($, e, next) => {
27    const root = await $.session.root()
28    const venv = await $.fs.stat(`${root}/BackEnd/venv/bin/python`).catch(() => undefined)
29    if (venv === undefined) {
30      return next(e)
31    }
32
33    const { command, changes } = rewriteCommand(e.command, root)
34    if (changes.length === 0) {
35      return next(e)
36    }
37
38    const entry: RewriteEntry = { before: e.command, after: command, changes }
39    await update($, history, list => [...list, entry].slice(-50))
40    $.ui.toast(`venv-guard: ${changes.join(' · ')} (/venv-guard for details)`)
41
42    return next({ ...e, command })
43  })
44
45  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
46    const { Box, Text } = $.ui.resolve(e)
47    const list = await read($, history)
48
49    return (
50      <Box flexDirection="column">
51        {list.length === 0 && <Text dimColor>No rewrites yet.</Text>}
52        {list
53          .slice()
54          .reverse()
55          .map(entry => (
56            <Box flexDirection="column" marginBottom={1}>
57              <Text bold>{entry.changes.join(' · ')}</Text>
58              <Text dimColor>- {entry.before}</Text>
59              <Text>+ {entry.after}</Text>
60            </Box>
61          ))}
62      </Box>
63    )
64  })
65}
66
hooks/rewrite.ts 51 lines
1export type Rewrite = { command: string; changes: string[] }
2
3const ACTIVATE = /(?:source|\.)\s+\S*venv\/bin\/activate\s*(?:&&|;)\s*/g
4const RELATIVE_CD = /(^|&&|\|\||;)(\s*)cd\s+(BackEnd|FrontEnd)(?=[\s/;&|]|$)/g
5
6// A command position: the start of the line or right after an operator.
7const POSITION = String.raw`(^|&&|\|\||;|\||\(|\$\()(\s*)`
8const ALWAYS_VENV = new RegExp(`${POSITION}(pytest|celery|django-admin)(?=\\s|$)`, 'g')
9const DJANGO_PYTHON = new RegExp(
10  `${POSITION}(python3?)(?=\\s+(?:manage\\.py|-m\\s+(?:pytest|celery|django)))`,
11  'g',
12)
13const ANY_VENV_TOOL = new RegExp(`${POSITION}(python3?|pytest|celery|pip3?|django-admin)(?=\\s|$)`, 'g')
14
15export function rewriteCommand(command: string, root: string): Rewrite {
16  const bin = `${root}/BackEnd/venv/bin`
17  const changes: string[] = []
18  let next = command
19
20  const hadActivate = ACTIVATE.test(next)
21  ACTIVATE.lastIndex = 0
22  if (hadActivate) {
23    next = next.replace(ACTIVATE, '')
24    changes.push('dropped `source venv/bin/activate`')
25  }
26
27  const toolPattern = hadActivate ? ANY_VENV_TOOL : ALWAYS_VENV
28  const prefixed = new Set<string>()
29  const prefix = (_: string, op: string, space: string, tool: string): string => {
30    prefixed.add(tool)
31    return `${op}${space}${bin}/${tool}`
32  }
33  next = next.replace(toolPattern, prefix)
34  if (!hadActivate) {
35    next = next.replace(DJANGO_PYTHON, prefix)
36  }
37  if (prefixed.size > 0) {
38    changes.push(`venv ${[...prefixed].join(', ')}`)
39  }
40
41  const cdFixed = next.replace(RELATIVE_CD, (_, op: string, space: string, dir: string) => {
42    return `${op}${space}cd ${root}/${dir}`
43  })
44  if (cdFixed !== next) {
45    changes.push('absolute `cd`')
46    next = cdFixed
47  }
48
49  return { command: next, changes }
50}
51
types/index.d.ts 8 lines
1export type RewriteEntry = { before: string; after: string; changes: string[] }
2
3declare module 'claude-code' {
4  interface PluginState {
5    'venv-guard': { history: RewriteEntry[] }
6  }
7}
8