sandbox — промпт для Claude Code: что делает и как установить
Промпт sandbox для Claude Code и ChatGPT запускает Linux-песочницу Alpine с Python и Node для работы с файлами и расчётами.
Apache-2.0 ★ 9 488 обновлён 2026-11-16
.claude/commands/sandbox.mdЧто делает sandbox
Окружение Alpine работает на базе Python 3 и Node, предоставляя инструменты для выполнения команд через /bin/sh -lc, чтения и записи файлов, поиска и обмена документами. Файлы хранятся в /workspace, сохраняясь между сообщениями одной беседы, а файлы пользователя попадают в /workspace/inbox/. Команды выполняются неинтерактивно с ограничением по времени, при этом длинный вывод обрезается, а полный лог сохраняется по пути fullOutputPath.
Песочница позволяет запускать встроенные скрипты с помощью run_bundled_script и вызывать телефонные инструменты через команду mika phone <op> '<json-args>'. Для передачи готового файла пользователю используется вызов share_file, который сохраняет результат в папку Download/Mika. Внешние учетные данные и пароли передавать запрещено, а сетевые запросы зависят от текущих сетевых настроек.
Какие задачи решает
- вычислить, конвертировать или проанализировать данные
- запустить скрипты в окружении Alpine
- сгенерировать документы или изображения
- передать готовый файл пользователю через share_file
Примеры запросов агенту
- Запусти расчёт данных в песочнице sandbox
- Сконвертируй файлы внутри sandbox
- Выполни скрипт через sandbox
Как установить sandbox
Вручную: положить файлы
.claude/commands/sandbox.mdКак использовать
Вставьте текст в начало диалога или в инструкции проекта
Вопросы о sandbox
Как установить sandbox в Claude Code?
Поместите файл промпта в .claude/commands/sandbox.md.
Что делает sandbox?
Предоставляет изолированное окружение Alpine с Python и Node для выполнения вычислений, обработки файлов и запуска скриптов внутри беседы с ИИ.
Какие требования нужны для работы sandbox?
Окружение требует наличия Alpine с Python 3 и Node, а также доступа к системным инструментам выполнения команд в /workspace.
Исходный текст
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