💡
All examples are ready to run

Replace placeholders like <your-path> with your actual values. Run with --dry-run first to preview actions.

File Management Automation

Organize Downloads Folder

Automatically sort a messy downloads folder by file type:

openclaw run "Sort all files in ~/Downloads into subdirectories by type:
- images/ for .jpg, .jpeg, .png, .gif, .webp, .svg
- videos/ for .mp4, .mov, .avi, .mkv
- documents/ for .pdf, .docx, .xlsx, .pptx, .txt
- code/ for .py, .js, .ts, .sh, .yaml, .json
- archives/ for .zip, .tar.gz, .rar, .7z
Skip files less than 1KB. Show me a summary of how many files were moved."

Batch File Rename

# Rename photos by date taken (reads EXIF data)
openclaw run "For each JPEG in ./photos, read the EXIF DateTimeOriginal tag
and rename the file to YYYY-MM-DD_HH-MM-SS.jpg format. 
Report files that don't have EXIF date data."

# Rename by content
openclaw run "Read each .md file in ./meeting-notes. Extract the meeting date 
from the first H1 heading (format: '# Meeting 2026-03-15'). 
Rename each file to YYYY-MM-DD-meeting-notes.md"

Find and Remove Duplicates

openclaw run "Scan ~/Documents for duplicate files using MD5 hash comparison.
List all duplicate groups. For each group, keep the most recently modified file
and move the rest to ~/Documents/.duplicates/ folder.
Show total space that would be freed."

Code Automation

Automated Refactoring

# Upgrade Python version compatibility
openclaw run "Update all Python files in ./src to be compatible with Python 3.12:
- Replace deprecated 'subprocess.run' calls that use shell=True
- Update f-string formats to use the latest syntax
- Replace 'typing.Optional[X]' with 'X | None'
Make changes directly and list every file modified."

# Convert to async
openclaw run "Find all functions in ./api_client.py that make HTTP requests
using the 'requests' library. Convert them to async functions using 'httpx'.
Update imports accordingly."

Test Generation

openclaw run "Read ./src/utils.py. For every public function that doesn't
have a corresponding test in ./tests/test_utils.py, write a pytest test.
Include both happy path and edge case tests (empty input, None, large values).
Add the tests to the existing test file."

Dependency Security Audit

openclaw run "Read requirements.txt. For each package, check pip-audit or
the PyPI JSON API to find known CVEs or security advisories. 
Write a security-audit.md file with a table: Package | Version | CVEs | Severity | Fix Version"

Data Processing Workflows

CSV Data Pipeline

openclaw run "Process ./sales_data.csv:
1. Remove rows where 'amount' is null or zero
2. Convert 'date' column from MM/DD/YYYY to ISO 8601 format
3. Add a new column 'month_year' (e.g., '2026-03')
4. Group by month_year and product_category, sum the amount
5. Write the aggregated result to ./monthly_summary.csv
6. Print the top 3 months by total revenue"

Log Analysis

openclaw run "Analyze /var/log/nginx/access.log:
- Count requests per status code (200, 404, 500...)
- Find the busiest hour of the day
- List top 10 endpoints by request count
- Find IP addresses with more than 100 requests/minute (potential DoS)
Output a formatted report to nginx-analysis.txt"

Scheduled Automation

Run OpenClaw on a schedule using cron or Task Scheduler:

Linux/macOS Cron Setup

# Edit crontab
crontab -e

# Daily standup report at 9 AM on weekdays
0 9 * * 1-5 openclaw run "Summarize git commits from yesterday and write standup.txt" >> ~/logs/standup.log 2>&1

# Weekly dependency check every Monday at 8 AM  
0 8 * * 1 openclaw run "Check requirements.txt for outdated packages and write update-report.md"

Python Scheduler Integration

import schedule
import time
from openclaw import Agent, Config

agent = Agent(Config(provider="openai", model="gpt-4o-mini"))

def daily_report():
    result = agent.run(
        "Read today's git log, summarize all commits, "
        "and append a summary to daily_report.md with today's date as heading"
    )
    print(f"Report generated: {result.output[:100]}...")

def weekly_cleanup():
    agent.run(
        "Scan ./tmp for files older than 7 days and delete them. "
        "Report how much space was freed."
    )

schedule.every().day.at("18:00").do(daily_report)
schedule.every().monday.at("09:00").do(weekly_cleanup)

while True:
    schedule.run_pending()
    time.sleep(60)

Multi-Agent Workflows

Chain multiple specialized agents together for complex pipelines:

from openclaw import Agent, Config, Pipeline

# Define specialized agents
researcher = Agent(Config(provider="openai", task="research"))
writer = Agent(Config(provider="openai", task="write"))
reviewer = Agent(Config(provider="anthropic", task="review"))

# Chain them in a pipeline
pipeline = Pipeline([
    (researcher, "Research the topic: {topic}. Output key facts as JSON."),
    (writer,     "Write a technical blog post based on: {previous_output}"),
    (reviewer,   "Review this blog post for accuracy and tone: {previous_output}"),
])

result = pipeline.run(topic="LLM context window optimizations in 2026")
print(result.final_output)
🔗
See Also

Explore related documentation to get more out of OpenClaw: