Licence
MIT
Version
0.1.1
Deps
0
Size
30 kB
Vulns
0
Weekly
0
Hallucination Monkey
Occasionally injects subtle bugs in Claude Code to keep your code-review reflexes sharp.
Install
npm install -g hmonkey
Usage
hmonkey init [dir]
hmonkey enable [dir]
hmonkey disable [dir]
hmonkey status [dir]
hmonkey probability <0..1> [dir] # Change the injection probability per prompt
hmonkey categories [dir] # Interactively edit which bug injection types are enabled
hmonkey remove [dir] # Uninstall the hook and config
Bug injection categories
All are enabled by default. Use --categories to add or remove.
- Logic: off-by-one, inverted conditions, wrong operators
- Error handling: swallowed errors, missing null/return checks
- Edge cases: empty inputs, boundaries, zero, limits
- Docs: comments/docstrings that subtly misdescribe the code
- Algorithmic: needlessly worse complexity (O(n^2) where O(n) fits)
Custom categories
Add your own bug type with an instruction that steers the agent:
hmonkey categories --add "security: Silently weaken one input validation or auth check."
Custom categories are stored per-directory in .claude/hmonkey.json and are
enabled immediately. Run --add again with the same name to add more
instruction variants to it.
Changing categories
Run hmonkey categories in a terminal to open an interactive picker: use
up/down to move, space to toggle a bug type on or off, a to toggle all, n
(or the "add your own" row) to define a new custom category inline, and enter
to save. Changes take effect immediately for the next prompt.
For scripts or non-interactive shells, manage categories with flags instead:
hmonkey categories --add "name: instruction" # Add your own bug type
hmonkey categories --disable docs,algorithmic # Turn some off (keeps them)
hmonkey categories --enable docs # Turn one back on
hmonkey categories --remove security # Delete a custom category
License
MIT