Tips & Tricks
Power user techniques for getting more out of OpenClaw AI every day.
Shell Aliases
# Add to ~/.bashrc or ~/.zshrc
alias ai='openclaw run'
alias aif='openclaw run --file'
alias ais='openclaw run --stdin'
# Usage
ai "What is the capital of France?"
aif report.csv "Analyse this CSV"
cat error.log | ais "Find the root cause"Output Formats
# JSON output for piping to jq
openclaw run "Extract name, email from this text as JSON" --file contacts.txt --format json | jq '.[]'
# Markdown for documents
openclaw run "Write a README for this project" --file src/ --format markdown --output README.md
# Plain text for scripts
openclaw run "Should I buy or sell? Reply: buy, sell, or hold" --file stock-data.csv --format textPer-Command Environment Overrides
# Use a different model for just one command
OPENCLAW_MODEL=gpt-4o openclaw run "Complex analysis task" --file big-doc.pdf
# Temporarily increase timeout
OPENCLAW_TIMEOUT=180 openclaw run "Very long task" --file huge-file.txt
# Use a different config file
openclaw run "task" --config ~/configs/local.yamlstdin Tricks
# Analyse clipboard contents (macOS)
pbpaste | openclaw run "Check this text for grammar errors"
# Analyse git diff before committing
git diff --staged | openclaw run "Review this diff for bugs and suggest a commit message"
# Process command output
df -h | openclaw run "Which disk is most full? Should I be worried?"Profile Switching
# Switch between work (expensive cloud) and home (free local) profiles
openclaw run "task" --profile work # uses gpt-4o
openclaw run "task" --profile home # uses ollama/llama3.2# ~/.openclaw/config.yaml
profiles:
work:
provider: openai
model: gpt-4o
home:
provider: ollama
model: llama3.2Chaining Commands in Pipelines
# Pipe output of one task to the next
git log --oneline --since="7 days ago" | \
openclaw run "Convert these commits to a user-facing changelog" | \
openclaw run "Translate the changelog to Spanish"
# Pass multiple files and merge results
cat report-1.txt report-2.txt | openclaw run "Summarize all findings"
# Store intermediate results
openclaw run "Extract action items" --file meeting.md > actions.txt
openclaw run "Prioritize by urgency and assign estimates" --file actions.txtDebug and Verbose Mode
# See the full prompt sent to the AI
openclaw run "Analyze this" --file data.txt --debug
# Verbose output: token count, latency, model
openclaw run "Hello!" --verbose
# Dry run: print what OpenClaw would do without executing
openclaw run "Delete all temp files" --dry-run
# Log all API calls to a file
openclaw run "Process report" --log /tmp/openclaw-debug.logCustom System Prompts
Set a persistent system prompt to tune AI behavior for your workflow:
# Set a system prompt globally
openclaw config set system_prompt "You are a senior Python developer. Always use type hints, write docstrings, and include error handling in every function."
# Override system prompt for a single run
openclaw run "Write a URL parser" \
--system "You are a security-focused developer. Always validate input and sanitize URLs."
# Use a system prompt file
openclaw run "Review this code" \
--system-file ./prompts/code-reviewer.txt \
--file main.pyBatch Multi-File Processing
# Process all files in a directory
for f in ./reports/*.pdf; do
echo "Processing $f..."
openclaw run "Extract: title, date, key findings, recommendations" \
--file "$f" \
--format json \
--output "./summaries/$(basename $f .pdf).json"
done
# Parallel processing (faster, uses more API quota)
ls *.md | xargs -P4 -I{} openclaw run "Summarize this document" --file {} --output {}.summary.txtIntegration Shortcuts
# Quick Telegram notification from a script
openclaw telegram send "Backup complete: $(du -sh /backups | cut -f1)"
# Git-aware automation
git diff HEAD~1 | openclaw run "Summarize what changed in this diff"
# Clipboard integration (macOS)
pbpaste | openclaw run "Fix grammar and rephrase professionally" | pbcopy
# Clipboard integration (Linux, requires xclip)
xclip -o | openclaw run "Translate to French" | xclip -sel clip
# Quick web page summary (using curl)
curl -s https://example.com | openclaw run --stdin "Summarize this webpage"Prompt Template Files
Store reusable prompts in .txt files and reference them with --prompt-file:
# prompts/code-review.txt
Review the following code as a senior engineer:
1. Flag any bugs or logic errors
2. Identify security vulnerabilities
3. Suggest performance improvements
4. Check adherence to clean code principles
Format output as a numbered checklist.
# Use the template
openclaw run --prompt-file prompts/code-review.txt --file main.py
# Combine template + extra instruction
openclaw run --prompt-file prompts/code-review.txt --append "Focus on async safety" --file async_handler.py
Discussion