Sandbox-Backed Blind Destructive Chaos Lab for AI Coding Agents
Snapshot first. Blind sabotage second. Tri-channel catch & zero-pollution restore.
English · 简体中文 · Install Guide
Meet Test Subject #02. Backward slate cap. Burnt-terracotta hoodie. Zero patience for loading spinners. While UserSpec's Subject #01 politely wonders what your landing screen means, Subject #02 clicks "Create" five times in 180 milliseconds, pastes a 220-character unbroken string, deletes the record, and immediately slams Browser Back just to watch an unguarded detail component explode into a white screen.
MonkeySpec unleashes him inside a snapshot-protected sandbox—so he wrecks your edge cases before real users corrupt your production database.
When a coding agent writes a feature and "tests edge cases" in the same context window, two failure modes happen:
- White-Box Pull-Punching: Having just read
if (isLoading) returnormaxLength={60}, the agent subconsciously avoids the exact buttons, race windows, or secondary modals where guards were forgotten. - Dev-Environment Pollution: Destructive testing sprays duplicate rows, whitespace-only ghost records, layout-breaking strings, and fake
.pnguploads straight into your local database.
MonkeySpec separates the Host Coordinator (who snapshots local data, stages malformed consumables, inspects backend DB state, patches approved bugs, and restores the clean snapshot) from an isolated Blind Saboteur subagent that never touches a single repository file.
| Dimension | Standard Code-Aware AI "Edge Check" | MonkeySpec Blind Chaos Lab |
|---|---|---|
| Source Code Access | Reads if-else guards, form schemas, and route handlers first. |
0 repo files read; receives only a bare URL or desktop window PID. |
| Local Data Safety | Leaves test garbage in SQLite, JSON files, and uploads/. |
Hard pre-test snapshot (sandbox_snapshot) + one-click clean restore that never overwrites code fixes. |
| Click & Async Stress | Clicks once and waits politely for the response. | Mashes primary/delete CTAs 5× within 200ms and thrashes tabs mid-request. |
| Input & File Payloads | Tries "test 123" or a clean sample image. |
Feeds 220+ unbroken chars, " ", -1, ZWJ emoji, regex [, 0B files, and text disguised as .png. |
| Bug Verification | Checks whether the UI "looks fine." | Tri-channel forensics: UI layout/crash + Console/HTTP 5xx + backend DB dirty-row inspection, followed by exact-path replay. |
- Host Coordinator: Starts the dev server or desktop window, runs
sandbox_snapshotto back up local SQLite/LibSQL DBs, JSON/YAML stores, anduploads/folders (or localhostpg_dump/mysqldump), and hard-stops (SNAPSHOT_BLOCKED) if a remote/cloud database is detected. - Blind Saboteur: Runs in an isolated subagent (
browserfor Web/H5; sandboxedself+ native window resizer/capture for Desktop/Electron) with zero repository access. Halts cleanly (AUTH_REQUIRED/PAYMENT_REQUIRED) on CAPTCHAs, real OTPs, mandatory OAuth, or real payment checkouts.
- Rapid-Fire & Concurrency Race: Triggers 5 clicks within
200mson submit/create/delete/generate buttons; rapidly switches tabs and routes while async requests are still in flight. - Poison Inputs & Layout Bombs: Injects
220+unbroken non-space characters (exposing missingmin-w-0/break-words), multiline newline blocks, whitespace-only" "(exposing missing.trim()), numeric extremes (0,-1,9007199254740993,1e309), compound ZWJ emoji (👨👩👧👦🏳️🌈🧑🏽🚀), unescaped regex[/\, and benign tag probes ("'\\</div><h1>PROBE). - Mid-Flow Abort & Delete-Backtrack: Half-fills modals then presses
Esc, clicks the backdrop, or reloads; immediately after deleting a record, triggers BrowserBackto revisit its detail URL (the #1 cause ofCannot read properties of undefinedwhite screens). - Critical Viewport Squeeze & Network Faults: Squeezes across
1440×900→768×900→375×667→320×568and short landscape1280×480(with modals open) to catch clipped/unclickable modal footers; simulates offline/failed submissions to verify draft retention and Loading-spinner unlock. - Malformed & Disguised File Feeding: Stages and uploads
0 Byteempty files, plain-text files disguised as.png, truncated JSON, and95+char#/%20filenames—then immediately uploads a valid1×1PNG to confirm the input isn't permanently wedged.
Every run audits three channels simultaneously:
- Channel 1 — Visual & DOM: White-screen crashes, horizontal page overflow, overlapping controls, unclickable off-screen modal buttons, permanent spinner deadlocks.
- Channel 2 — Console & Network: Uncaught
TypeError/SyntaxError, unhandled promise rejections, duplicatePOSTbursts, HTTP500responses. - Channel 3 — Storage & Database (Coordinator Forensics): Duplicate rows from rapid clicks,
" "ghost rows, negative balances, orphaned foreign keys, or0 Bytefiles saved on disk.
During reporting, MonkeySpec preserves the dirty crime scene so you can inspect live UI or database rows yourself. Once you select which P0 / P1 / P2 items to fix, the Coordinator patches the code, the Saboteur re-smashes along the exact reproduction paths, and sandbox_snapshot restore wipes all test pollution while keeping every code fix intact.
Every MonkeySpec report concludes with a standardized Chaos Receipt proving blind isolation, sandbox state, and tri-channel counts:
---
**MonkeySpec Chaos Receipt** | Mode: `havoc` | Sandbox: `DIRTY SCENE KEPT (snap_20261128_110500)`
**Isolation**: Blind Saboteur (0 repo files read) · **Smashed**: `/tasks`, `/tasks/:id`, `/settings` (Tactics 1–5) · **Tri-Channel Catch**: `UI: 2 | Console/Net: 3 | Storage/DB: 2`- Web Desktop: Built-in
browsersubagent with<200msevent-burst dispatching, host-verified navigation, and screenshot evidence. - Mobile H5 / Responsive Web: Multi-breakpoint viewport squeezing (
768px,375px,320px, and1280×480modal-clip checks). - Native Desktop / Electron / Tauri: Sandboxed blind subagent paired with zero-dependency window resize & DPI-aware DWM capture scripts (
capture_window.ps1on Windows;capture_window.shon macOS/Linux).
Clone the repository and reference skills in your project's .agents/skills.json (or globally in ~/.gemini/config/skills.json):
{
"entries": [
{ "path": "/path/to/MonkeySpec/skills" }
]
}/plugin marketplace add marksimZ/MonkeySpec
/plugin install monkeyspec@monkeyspec
mkdir -p ~/.agents/skills && git clone https://github.com/marksimZ/MonkeySpec.git /tmp/MonkeySpec && cp -R /tmp/MonkeySpec/skills/blind-monkey-chaos-test ~/.agents/skills/blind-monkey-chaos-testLoad skills/blind-monkey-chaos-test/SKILL.md directly, or copy adapters/AGENTS.md into your target project. Full OS-specific instructions are available in INSTALL.md.
Run MonkeySpec (havoc mode) on http://localhost:5173 — back up our local database first, unleash the blind saboteur across all 5 tactics, and show me the P0/P1/P2 findings before editing code.
$blind-monkey-chaos-test poke
Do a quick destructive sting on http://localhost:3000 focusing on double-submit races and main form poison inputs. Report only and restore the snapshot right after.
$blind-monkey-chaos-test rampage
Carpet-bomb our Electron app ("QuantStudio") with full viewport squeezing, mid-flow aborts, malformed file imports, and offline recovery checks.
MonkeySpec/
├── assets/ # Mascot & light/dark workflow + intensity SVGs
├── skills/
│ └── blind-monkey-chaos-test/
│ ├── SKILL.md # Core protocol, sandbox hard gate, modes & prompt
│ ├── agents/openai.yaml # Codex / OpenAI skill display metadata
│ ├── references/
│ │ ├── tactics-01-concurrency-and-abort.md # 200ms×5 click bursts, tab races & delete→Back
│ │ ├── tactics-02-poison-inputs-and-files.md # 220c bombs, spaces, extremes, emoji & 0B/fake files
│ │ ├── tactics-03-viewport-and-network.md # 320px/short-modal squeeze & offline unlock checks
│ │ ├── sandbox-and-platform-adapters.md # Snapshot workflow, multi-surface & DB forensics
│ │ └── monkey-report-template.md # Tri-channel P0/P1/P2 report & replay templates
│ └── scripts/
│ ├── sandbox_snapshot.ps1 / .sh # Pre-test DB/JSON/uploads snapshot, diff & restore
│ ├── generate_poison_files.ps1 / .sh # Zero-dep 0-byte & disguised file generator
│ └── capture_window.ps1 / .sh # Native window resizer & DPI-accurate capture
├── adapters/AGENTS.md # Compact ruleset for rules-only agents
├── .claude-plugin/ # Claude Code marketplace & plugin manifests
├── INSTALL.md # Multi-agent installation guide
├── README.md # English documentation (default)
├── README.zh-CN.md # Simplified Chinese documentation
└── LICENSE # MIT License
Does sandbox_snapshot restore overwrite code fixes made after the test?
No. sandbox_snapshot exclusively tracks stateful data files (.sqlite, .db, .db-wal, runtime uploads/, and non-code data files in data/ / storage/) while explicitly excluding source code extensions (.ts, .tsx, .js, .py, .go, .rs, .vue, .css, .prisma, etc.). Restoring wipes duplicate DB rows and dirty uploaded files while keeping 100% of your bugfixes intact.
What happens if my .env points to a remote Supabase, Neon, or RDS database?
sandbox_snapshot parses .env files before testing and immediately halts with SNAPSHOT_BLOCKED (exit code 2) when it detects a non-local database host, preventing accidental chaos testing against shared staging or production databases.
How do UserSpec and MonkeySpec complement each other?
Run UserSpec first to verify a stranger understands your UI in 5 seconds and cross-view state syncs without F5. Then run MonkeySpec to verify impatient clicks, dirty inputs, mid-flow aborts, squeezed viewports, and broken uploads cannot crash your UI or corrupt your database.
Released under the MIT License.
