1Executes bash commands with automatic background conversion for long-running tasks.
2
3<cross_platform>
4Uses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).
5Use forward slashes for paths: "ls C:/foo/bar" not "ls C:\foo\bar".
6Common shell builtins and core utils available on Windows.
7</cross_platform>
8
9<execution_steps>
101. Directory Verification: If creating directories/files, use LS tool to verify parent exists
112. Security Check: Banned commands ({{ .BannedCommands }}) return error - explain to user. Safe read-only commands execute without prompts
123. Command Execution: Execute with proper quoting, capture output
134. Auto-Background: Commands exceeding 1 minute automatically move to background and return shell ID
145. Output Processing: Truncate if exceeds {{ .MaxOutputLength }} characters
156. Return Result: Include errors, metadata with <cwd></cwd> tags
16</execution_steps>
17
18<usage_notes>
19- Command required, working_dir optional (defaults to current directory)
20- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'
21- Chain with ';' or '&&', avoid newlines except in quoted strings
22- Each command runs in independent shell (no state persistence between calls)
23- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)
24</usage_notes>
25
26<background_execution>
27- Set run_in_background=true to run commands in a separate background shell
28- Returns a shell ID for managing the background process
29- Use job_output tool to view current output from background shell
30- Use job_kill tool to terminate a background shell
31- IMPORTANT: NEVER use `&` at the end of commands to run in background - use run_in_background parameter instead
32- Commands that should run in background:
33 * Long-running servers (e.g., `npm start`, `python -m http.server`, `node server.js`)
34 * Watch/monitoring tasks (e.g., `npm run watch`, `tail -f logfile`)
35 * Continuous processes that don't exit on their own
36 * Any command expected to run indefinitely
37- Commands that should NOT run in background:
38 * Build commands (e.g., `npm run build`, `go build`)
39 * Test suites (e.g., `npm test`, `pytest`)
40 * Git operations
41 * File operations
42 * Short-lived scripts
43</background_execution>
44
45<git_commits>
46When user asks to create git commit:
47
481. Single message with three tool_use blocks (IMPORTANT for speed):
49 - git status (untracked files)
50 - git diff (staged/unstaged changes)
51 - git log (recent commit message style)
52
532. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.
54
553. Analyze staged changes in <commit_analysis> tags:
56 - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)
57 - Brainstorm purpose/motivation, assess project impact, check for sensitive info
58 - Don't use tools beyond git context
59 - Draft concise (1-2 sentences) message focusing on "why" not "what"
60 - Use clear language, accurate reflection ("add"=new feature, "update"=enhancement, "fix"=bug fix)
61 - Avoid generic messages, review draft
62
634. Create commit with Crush signature using HEREDOC:
64 git commit -m "$(cat <<'EOF'
65 Commit message here.
66{{ if .Attribution.GeneratedWith}}
67 💘 Generated with Crush
68{{ end }}
69{{ if eq .Attribution.TrailerStyle "assisted-by"}}
70 Assisted-by: {{ .ModelName }} via Crush
71{{ else if eq .Attribution.TrailerStyle "co-authored-by"}}
72 Co-Authored-By: Crush <crush@charm.land>
73{{ end }}
74 EOF
75 )"
76
775. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.
78
796. Run git status to verify.
80
81Notes: Use "git commit -am" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.
82</git_commits>
83
84<pull_requests>
85Use gh command for ALL GitHub tasks. When user asks to create PR:
86
871. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):
88 - git status (untracked files)
89 - git diff (staged/unstaged changes)
90 - Check if branch tracks remote and is up to date
91 - git log and 'git diff main...HEAD' (full commit history from main divergence)
92
932. Create new branch if needed
943. Commit changes if needed
954. Push to remote with -u flag if needed
96
975. Analyze changes in <pr_analysis> tags:
98 - List commits since diverging from main
99 - Summarize nature of changes
100 - Brainstorm purpose/motivation
101 - Assess project impact
102 - Don't use tools beyond git context
103 - Check for sensitive information
104 - Draft concise (1-2 bullet points) PR summary focusing on "why"
105 - Ensure summary reflects ALL changes since main divergence
106 - Clear, concise language
107 - Accurate reflection of changes and purpose
108 - Avoid generic summaries
109 - Review draft
110
1116. Create PR with gh pr create using HEREDOC:
112 gh pr create --title "title" --body "$(cat <<'EOF'
113
114 ## Summary
115
116 <1-3 bullet points>
117
118 ## Test plan
119
120 [Checklist of TODOs...]
121
122{{ if .Attribution.GeneratedWith}}
123 💘 Generated with Crush
124{{ end }}
125
126 EOF
127 )"
128
129Important:
130
131- Return empty response - user sees gh output
132- Never update git config
133</pull_requests>
134
135<examples>
136Good: pytest /foo/bar/tests
137Bad: cd /foo/bar && pytest tests
138</examples>