vibe/vibe/core/tools/builtins/prompts/bash.md
Mathias Gesbert d33db9fff8 2.0.0
Co-Authored-By: Quentin Torroba <quentin.torroba@mistral.ai>
Co-Authored-By: Michel Thomazo <michel.thomazo@mistral.ai>
Co-Authored-By: Clément Drouin <clement.drouin@mistral.ai>
Co-Authored-By: Vincent Guilloux <vincent.guilloux@mistral.ai>
Co-Authored-By: Clément Siriex <clement.sirieix@mistral.ai>
Co-Authored-By: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai>
Co-Authored-By: Thaddee Tyl <thaddee.tyl@gmail.com>
Co-Authored-By: David Brochart <david.brochart@gmail.com>
Co-Authored-By: Joseph Guhlin <joseph.guhlin@gmail.com>
Co-Authored-By: Thomas Kenbeek <thomaskenbeek@gmail.com>
Co-Authored-By: Remenby31 <baptiste.cruvellier31@gmail.com>
2026-01-27 16:44:55 +01:00

2.8 KiB

Use the bash tool to run one-off shell commands.

Key characteristics:

  • Stateless: Each command runs independently in a fresh environment

Timeout:

  • The timeout argument controls how long the command can run before being killed
  • When timeout is not specified (or set to None), the config default is used
  • If a command is timing out, do not hesitate to increase the timeout using the timeout argument

IMPORTANT: Use dedicated tools if available instead of these bash commands:

File Operations - DO NOT USE:

  • cat filename → Use read_file(path="filename")
  • head -n 20 filename → Use read_file(path="filename", limit=20)
  • tail -n 20 filename → Read with offset: read_file(path="filename", offset=<line_number>, limit=20)
  • sed -n '100,200p' filename → Use read_file(path="filename", offset=99, limit=101)
  • less, more, vim, nano → Use read_file with offset/limit for navigation
  • echo "content" > file → Use write_file(path="file", content="content")
  • echo "content" >> file → Read first, then write_file with overwrite=true

Search Operations - DO NOT USE:

  • grep -r "pattern" . → Use grep(pattern="pattern", path=".")
  • find . -name "*.py" → Use bash("ls -la") for current dir or grep with appropriate pattern
  • ag, ack, rg commands → Use the grep tool
  • locate → Use grep tool

File Modification - DO NOT USE:

  • sed -i 's/old/new/g' file → Use search_replace tool
  • awk for file editing → Use search_replace tool
  • Any in-place file editing → Use search_replace tool

APPROPRIATE bash uses:

  • System information: pwd, whoami, date, uname -a
  • Directory listings: ls -la, tree (if available)
  • Git operations: git status, git log --oneline -10, git diff
  • Process info: ps aux | grep process, top -n 1
  • Network checks: ping -c 1 google.com, curl -I https://example.com
  • Package management: pip list, npm list
  • Environment checks: env | grep VAR, which python
  • File metadata: stat filename, file filename, wc -l filename

Example: Reading a large file efficiently

WRONG:

bash("cat large_file.txt")  # May hit size limits
bash("head -1000 large_file.txt")  # Inefficient

RIGHT:

# First chunk
read_file(path="large_file.txt", limit=1000)
# If was_truncated=true, read next chunk
read_file(path="large_file.txt", offset=1000, limit=1000)

Example: Searching for patterns

WRONG:

bash("grep -r 'TODO' src/")  # Don't use bash for grep
bash("find . -type f -name '*.py' | xargs grep 'import'")  # Too complex

RIGHT:

grep(pattern="TODO", path="src/")
grep(pattern="import", path=".")

Remember: Bash is best for quick system checks and git operations. For file operations, searching, and editing, always use the dedicated tools when they are available.