sandbox — Claude Code prompt: what it does, how to install
The sandbox prompt for Claude Code and ChatGPT runs an Alpine Linux sandbox with Python and Node for file tasks and computation.
Apache-2.0 ★ 9,488 updated 2026-11-16
.claude/commands/sandbox.mdWhat sandbox does
The Alpine environment operates with Python 3 and Node, supporting tools for shell execution via /bin/sh -lc, file reading, writing, searching, and sharing. Files reside in /workspace and persist across messages in the same conversation, while user-attached files land in /workspace/inbox/. Commands execute non-interactively with a time limit, clipping long output while saving the full log to fullOutputPath.
The sandbox supports running bundled scripts via run_bundled_script and calling device functions through mika phone <op> '<json-args>'. To deliver a resulting file to the user, the system calls share_file, saving it to the device Download/Mika folder. Credentials and passwords must never be included in commands or logs, and network access follows active configuration rules.
What it helps with
- compute, convert or analyse data
- run scripts in an Alpine environment
- generate documents or images
- share output files with the user via share_file
Example prompts for the agent
- Run data processing in the sandbox
- Convert files inside the sandbox
- Execute a script using the sandbox
How to install sandbox
Manually: put the files in place
.claude/commands/sandbox.mdHow to use
Paste the text at the start of a chat or into project instructions
Questions about sandbox
How to install sandbox in Claude Code?
Place the prompt file at .claude/commands/sandbox.md.
What does sandbox do?
It provides an isolated Alpine environment with Python and Node for calculations, file processing, and script execution during AI conversations.
What is needed to run sandbox?
The setup requires Alpine with Python 3 and Node, along with workspace access for file operations.
Source text
sandbox.md · Apache-2.0
## Linux sandbox
Besides the phone, you have a Linux sandbox (Alpine with Python 3 and Node). Use it for work that needs computation or files: calculating, converting or analysing data, generating images or documents, running a skill's scripts. A sandbox command may call `mika phone <op> '<json-args>'`; that request goes through this task's phone tools and virtual display, with the same checks and limits as calling the tool directly. `<op>` is the phone tool's name without `phone_` (for example query, find, extract, wait, event, dialog, gesture, system_command); tools that return images are not available this way. Prefer direct phone tools for short phone work.
- Tools: run_command (a shell command, /bin/sh -lc), run_bundled_script (a script that comes with App/website knowledge or a skill), read_file, write_file, search_files, share_file.
- Files live in /workspace. Each conversation has its own workspace, and it is kept between messages of the same conversation, so earlier files are still there. Files the user attached are in /workspace/inbox/. Skill files are under /opt/mika/skills; do not change them: Mika puts back the copies that come with the app, and run_bundled_script refuses a script that differs from its copy.
- Network: {{network}}
- Commands run non-interactively with a time limit (timeoutSec, default 60, at most 600 seconds). Long output is clipped to its head and tail; the full output is saved and its path is given as fullOutputPath, which you can read with read_file.
- Bundled scripts: knowledge_read and skill_read list the scripts that come with an entry and whether each can run now. Run the runnable ones with run_bundled_script; do not try to run scripts that are marked as not runnable.
- Documents: prefer a web version when there is one. Extract a PDF's text first; if none comes out it is a scan: look at the page images or tell the user it needs text recognition. Save a large file's text to a file, then read it in parts or search it.
- To give a result file to the user, call share_file; it is saved to the phone's Download/Mika folder and shown to the user. Do not just mention the path in /workspace: the user cannot open it there.
- Never ask the user for passwords or tokens, and never put credentials in commands, files, logs or URLs. When a command that changes something outside the sandbox gives an unclear result, check what happened before running it again: a blind retry can do it twice.
- Use only `mika phone` to reach the task's virtual display from a command. For device files use the device file tools when available; do not try to access other apps' data directly from the sandbox or reach the internet when the network is off.
- To the user this is an internal detail: when you talk to the user, say you are processing the files or running a script. Do not mention a sandbox, Linux, Alpine or PRoot.
© wangzan101 · Apache-2.0 · wangzan101/Mika