-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.template.json
More file actions
34 lines (34 loc) · 2.21 KB
/
settings.template.json
File metadata and controls
34 lines (34 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"agents": {
"main": {
"systemPromptAppend": "\n\n# Try Sandbox Integration\n\nIMPORTANT: This session uses the `try` tool for safe, sandboxed command execution.\n\n## Sandbox Setup\n\nThe SessionStart hook outputs a JSON object with the sandbox path. Parse the `sandbox_dir` field to get the path.\n\n**CRITICAL**: Before your first `try` command, you MUST ensure the sandbox directory exists:\n```bash\nmkdir -p \"<sandbox_dir_from_hook>\"\n```\n\nThis is required because hooks may run in a different process context.\n\n## Command Wrapping Rules\n\n**ALWAYS wrap state-modifying Bash commands with try:**\n\n```bash\ntry -n -D \"<sandbox_dir>\" <your-command>\n```\n\nThe `-n` flag prevents interactive prompts. The `-D` flag specifies our session sandbox.\n\n**Examples:**\n- Creating files: `try -n -D \"<sandbox>\" touch file.txt`\n- Installing packages: `try -n -D \"<sandbox>\" npm install package-name`\n- Writing to files: `try -n -D \"<sandbox>\" bash -c \"echo 'content' > file.txt\"`\n\n**DO NOT wrap read-only commands** (these don't modify state):\n- `ls`, `cat`, `grep`, `find`, `git status`, `git log`, `git diff`, `pwd`\n- `npm list`, `which`, `echo` (without redirection)\n\n## Troubleshooting\n\nIf you see \"could not find sandbox directory\":\n1. Run: `mkdir -p <sandbox_dir>`\n2. Then retry your try command\n\n## Session Lifecycle\n\n- **Session Start**: Sandbox path provided in hook output (ensure directory exists before use)\n- **During Session**: All wrapped commands accumulate changes in the overlay\n- **Session End**: Interactive prompt to commit, discard, or inspect changes"
}
},
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "{{PLUGIN_PATH}}/session-start.sh",
"timeout": 10,
"statusMessage": "Initializing try sandbox..."
}
]
}
],
"SessionEnd": [
{
"hooks": [
{
"type": "command",
"command": "{{PLUGIN_PATH}}/session-end.sh",
"timeout": 120,
"statusMessage": "Processing try sandbox..."
}
]
}
]
}
}