Repository navigation
Sandbox Sessions
A sandbox session can run headless, in a tmux TUI, or behind a capture proxy.
This page shows each way and how to clean up.
Read Sandbox first.
-p runs one turn and prints the reply.
Use it for hook behavior that the reply shows.
-
Put test files in
project/first, such as apkg/CLAUDE.mdwith a rule the reply must show. -
Run the prompt:
just sandbox --model claude-sonnet-5-5 -p "Run cat pkg/a.ts and describe it." -
Add
--debug-file <path>to see which hooks ran and what they returned.
- The script warns when a
--modelvalue is not inavailableModelsof the sandboxsettings.json. Claude Code gives no error, and the session runs on another model. - Put the prompt before variadic flags such as
--allowedTools. A variadic flag takes all later arguments, and thenclaudefinds no prompt. - A headless run cannot answer a permission prompt.
List each tool the test needs, such as
--allowedTools 'Bash' 'Write' 'Edit'. An unlisted tool is denied.
The status line, the Reply button, and dialogs show only in the TUI.
Run it in a detached tmux session and read the screen:
tmux new-session -d -s sandbox -x 150 -y 40 "just sandbox; sleep 60"
tmux send-keys -t sandbox -l 'your prompt'
tmux send-keys -t sandbox Enter
tmux capture-pane -p -t sandbox | tail -30
tmux kill-session -t sandbox- Wait some seconds after the start and after each prompt, then read the screen.
- Send the text with
-landEnterin a second command. Otherwisetmuxcan read words of the text as key names.
just capture runs claudetto-capture, a proxy that writes each request body.
Use it to size each part of the first request of a session.
-
In a terminal, run
just capture. It listens on port8787and writes toclaudetto-capturein$TMPDIR. The options are--port N,--out DIR,--upstream URL, and--no-count. -
In a second terminal, start the session with the proxy:
ANTHROPIC_BASE_URL=http://127.0.0.1:8787 ENABLE_TOOL_SEARCH=true claude
- The proxy forwards to
--upstream URL, else toANTHROPIC_BASE_URL, else tohttps://api.anthropic.com. It stops with an error when the upstream is its own address, because the requests would loop. This happens when you exportANTHROPIC_BASE_URLin the terminal ofjust capture. -
ENABLE_TOOL_SEARCH=truekeeps tool search on, because Claude Code turns it off for a base URL that is not first-party. - The proxy does not write request headers, because they hold the credential.
- A session with a sandbox can block the local port.
The user sets
sandbox.network.allowLocalBinding: truein the settings of the session that runs the proxy.
To test the status line script without a session, give it input on stdin:
echo '<input JSON>' | bun plugins/claudetto/bin/claudetto-statuslineRead the input fields in the status line docs of Claude Code and in the script.
To see the real input, set a status line command in config/settings.json that writes stdin to a file.
-
Stop each
tmuxsession you started. -
Run
just sandbox-clean. It removes theclaudetto-sandboxfolder withconfig/,project/,home/, and the.claudetto-sandboxmarker. -
For
just sandbox-alone, run the recipe again, or run:bun plugins/claudetto-lab/bin/claudetto-sandbox --dir /tmp/claudetto-sandbox-alone --clean
-
For
just sandbox-install, use the same command with--dir /tmp/claudetto-sandbox-install.
The sandbox writes a marker into each folder it makes.
--clean of a folder other than the default refuses a folder without the marker and refuses a symlink.
Remove such a folder by hand.
A sandbox session also writes into your checkout.
Claude Code writes .claude-plugin/types/ and a tsconfig.json into each plugin folder it loads, and git ignores them (Types).
just sandbox keeps sessions and settings, so you can continue a test, but an old sandbox can hide a first-run problem.
just sandbox-alone starts empty on each run, so it shows a first-run problem.
claudetto
- Start
- Slices
- Add-Ons
- Reference
- Rationale
- Evidence
- Development
Claude Code