ClawFlows Documentation

repository·main·Indexed 23 days ago

https://github.com/nikilster/clawflows

A workflow system for OpenClaw agents that provides deterministic, versioned, and reusable workflows defined in plain text. It includes over 100 prebuilt workflows across domains such as Smart Home, Finance, and Productivity. The system features a CLI for managing, creating, and submitting workflows, supports natural language triggers, and allows for automated scheduling via WORKFLOW.md configurations.

Tokens
9.3K
Snippets
26
Records
59
Agent score
80%

What's inside ClawFlows

  1. Overview of ClawFlows workflow system

    main

    ClawFlows is a workflow system for OpenClaw that provides deterministic, versioned, and reusable workflows. It includes over 100 prebuilt workflows that can be enabled easily. Workflows are defined in plain text, making them easy to create, read, and share. Key benefits include:

    • Reliability: Deterministic execution without scattered instructions.
    • Version Control: Ability to modify, save, and rollback workflows.
    • Community Support: Access to 100+ prebuilt workflows for various domains like Smart Home, Daily Routines, Health, and Finance.
  2. Explore available ClawFlows workflows

    main

    ClawFlows provides over 100 pre-built workflows categorized by domain to give your agent specialized capabilities. Workflows can be scheduled to run automatically at specific times or triggered on-demand.

    Available categories include:

    • Smart Home: Control lights, thermostats, and modes (e.g., activate-sleep-mode, activate-away-mode).
    • Daily Routines: Morning briefings, calendar checks, and journaling (e.g., send-morning-briefing, check-calendar).
    • Health & Wellness: Habit tracking, hydration, and medication reminders (e.g., track-habits, check-medications).
    • Home & Family: Meal planning, weather alerts, and pet care (e.g., plan-meals, remind-pet-care).
    • Finance & Shopping: Bill tracking, subscription management, and expense reporting (e.g., check-bills, track-budget).
    • Communication: Email triage, message monitoring, and contact processing (e.g., check-email, check-messages).
    • Productivity & Planning: Task triage, weekly reviews, and deep work blocking (e.g., triage-tasks, plan-week).
    • Work & Meetings: Meeting prep, standup generation, and interview research (e.g., prep-next-meeting, build-standup).
    • Dev Tools: Repository scanning, dependency checking, and Docker cleanup (e.g., check-repos, clean-docker).
    • Digital Hygiene: Security audits, disk space checks, and password reviews (e.g., check-security, check-disk).
    • Other categories: Social & Relationships, Travel & Events, Content & Learning, Photos & Files, Seasonal, and System maintenance.
  3. Manage workflow run history in system/runs/

    main

    The scheduler uses a specific directory structure in system/runs/ to track execution and prevent duplicate runs.

    Crucial Rule: Run files are keyed by the scheduled time (the time the workflow was supposed to run), not the actual time the scheduler executed the task.

    Directory Structure: system/runs/YYYY-MM-DD/workflow-name/HH:MM

    Example: If a workflow named send-morning-briefing is scheduled for 07:00 and the scheduler runs at 06:50 on February 10, 2026, the run file must be created at: system/runs/2026-02-10/send-morning-briefing/07:00

    If this file exists, the scheduler will skip the workflow for that time slot.

  4. How the Scheduled Workflows system works

    main

    The scheduler is a periodic process (intended to run every 15 minutes via cron) that identifies and executes workflows based on their defined schedules.

    Workflow Discovery:

    • The scheduler only looks in workflows/enabled/.
    • It reads the WORKFLOW.md frontmatter of each file to find the name and schedule fields.
    • Workflows without a schedule field are treated as on-demand only and are ignored by the scheduler.

    Scheduling Logic:

    • Schedules can be specific times ("7am", "5:14pm"), intervals ("every hour", "every 2 hours"), or descriptive terms ("morning", "evening").
    • A workflow is considered "due" if the current time matches or is within 15 minutes of the scheduled time.

    Execution & Idempotency: To prevent double-running, the scheduler checks a run history in system/runs/. A workflow is only executed if a run file does not already exist for that specific scheduled time slot for the current day.

    Output:

    • If workflows run, the scheduler provides a summary of executions.
    • If no workflows were due, the scheduler responds with HEARTBEAT_OK.
  5. Check workflow service dependencies

    main

    When you enable or create a workflow, ClawFlows checks for required services (e.g., email, calendar, messaging).

    • Essential services: The CLI will notify you if they are missing and provide setup help.
    • Optional services: The CLI will suggest them as improvements but allow the workflow to run without them.
  6. Use placeholder syntax for secrets in workflows

    main

    When defining workflows that require sensitive information like API keys or credentials, do not hardcode the values. Instead, use the following placeholder syntax. This allows end-users to provide their own keys when they enable the workflow.

    Syntax: {{SECRET:API_KEY_NAME}} — Description of what this key is for

    Examples:

    • {{SECRET:OPENAI_API_KEY}} — OpenAI API key for GPT calls
    • {{SECRET:GITHUB_TOKEN}} — GitHub personal access token
    • {{SECRET:SLACK_WEBHOOK}} — Slack webhook URL for notifications
    {{SECRET:API_KEY_NAME}} — Description of what this key is for
  7. Configure workflow scheduling

    main

    Workflows can run automatically based on a schedule defined in their WORKFLOW.md file. You can use plain English descriptions for the schedule.

    Supported formats include:

    • Specific times: "8am", "7pm"
    • Intervals: "every 2 hours"
    • Relative times: "morning"

    Example YAML configuration within a workflow file:

    schedule: "8am, 6pm"
  8. Understand the workflow directory structure

    main

    A workflow is a directory containing a WORKFLOW.md file and optional supporting files:

    • WORKFLOW.md: Required. Contains instructions, frontmatter, and execution steps.
    • config.env: Optional. Stores environment variables (e.g., EMAIL=user@example.com). The agent will prompt users to fill these in when enabling.
    • scripts/: Optional. A directory for helper scripts (e.g., .sh or .py files) that the workflow can execute.
    my-workflow/
    ├── WORKFLOW.md          # Instructions (frontmatter + steps)
    ├── config.env           # Optional: environment variables
    └── scripts/             # Optional: helper scripts
        └── do-thing.sh
  9. Update the Top Contributors leaderboard in README.md

    main

    Maintain the 🏆 Top Contributors table in README.md by following these rules:

    1. Increment Count: If the author already has a row, increment their workflow count.
    2. New Contributors: If the author is new, add a new row.
    3. Sorting: Keep the table sorted by count in descending order.
    4. Emojis: Use 🥇 for 1st, 🥈 for 2nd, and 🥉 for 3rd. Use no emoji for 4th place and below.
    5. CTA: The final row must always be a "You!" Call-To-Action (CTA) linking to docs/creating-workflows.md.
  10. Uninstall ClawFlows

    main

    To completely remove ClawFlows, use the clawflows uninstall command. This performs a clean removal of:

    • The CLI symlink
    • The AGENTS.md block
    • The scheduler cron job

    Warning: The uninstaller will warn you about the deletion of your custom/ directory (where your personal workflows live) before proceeding.

    clawflows uninstall
  11. Create a run log for a scheduled workflow

    main

    When a scheduled workflow executes, you must create a run file to record the result and prevent re-execution. The file should be named after the scheduled time and contain a brief summary (2-5 lines) of the actions taken.

    Use the following pattern to create the run log:

    mkdir -p system/runs/YYYY-MM-DD/workflow-name
    cat > system/runs/YYYY-MM-DD/workflow-name/HH:MM << 'EOF'
    Brief summary of what the workflow did.
    Include key results, numbers, or actions taken.
    EOF

    Example Log Content:

    • "Sent briefing: 65°F, 3 meetings today, 2 priority tasks"
    • "Triaged 12 emails: archived 8 junk, flagged 2 urgent, 2 need reply"
    • "No calendar conflicts in next 48 hours. Next meeting: standup at 9am"
    mkdir -p system/runs/YYYY-MM-DD/workflow-name
    cat > system/runs/YYYY-MM-DD/workflow-name/HH:MM << 'EOF'
    Brief summary of what the workflow did.
    Include key results, numbers, or actions taken.
    EOF
  12. Create and share custom workflows

    main

    You can build your own workflows using the interactive CLI or submit them to the community.

    Workflow Creation Workflow:

    1. Create and test:
      • Run clawflows create to start the interactive builder.
      • Run clawflows run <your-workflow-name> to test it locally.
    2. Submit:
      • Run clawflows submit <your-workflow-name> to submit for community review.
      • Follow the instructions provided after submission to open a pull request.

    For a detailed guide, see the docs/creating-workflows.md documentation.

    # 1. Create and test your workflow
    clawflows create
    clawflows run your-workflow-name
    
    # 2. Submit it for review
    clawflows submit your-workflow-name