# nikilster/clawflows architecture

> Architecture diagram of the GitHub repository nikilster/clawflows, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nikilster/clawflows
- Repository: https://github.com/nikilster/clawflows

## Overview

1. **What this repo is**
   ClawFlows is a workflow distribution and lifecycle system for OpenClaw. Its core artifact is a plain-text `WORKFLOW.md` file per workflow, with metadata like name and schedule plus the instructions the agent should follow.

2. **Primary storage layout**
   The repository separates workflows into three tiers:
   - `workflows/available/community`: curated, shipped workflows
   - `workflows/custom`: user-authored workflows
   - `workflows/enabled`: the active set the agent should currently load
   This separation is the main architectural boundary between “catalog,” “local edits,” and “runtime activation.”

3. **Workflow lifecycle**
   The lifecycle is: discover a workflow in `available` or create one in `custom`, validate it, enable it, and then let the agent execute it either on schedule or on demand. Enabled workflows are meant to be visible to the agent without restarting.

4. **CLI is the control plane**
   The `system/cli/clawflows` command is the operational entry point. It manages listing, enabling/disabling, creating, editing, opening, validating, running, sharing, backup/restore, updates, agent sync, and uninstall. In architectural terms, the CLI is the control layer that reads and mutates the workflow directories and local state.

5. **Agent integration boundary**
   `system/AGENT.md` and the `sync-agent` command indicate a second integration path: the repo updates the agent’s own workflow reference list so OpenClaw can discover enabled workflows. That means ClawFlows is not just a file store; it actively propagates workflow availability into the agent environment.

6. **Execution model**
   Workflows are driven by schedule metadata inside `WORKFLOW.md` rather than by code in this repo. The system is designed for both scheduled autopilot execution and explicit manual runs via `clawflows run <name>`. The repo therefore acts as a declarative workflow registry more than a traditional application server.

7. **Dashboard subsystem**
   `system/dashboard/server.js` plus `template.html` implement a small local web dashboard. Its role is observational and management-oriented: visualize workflow state, not execute workflows. The `.dashboard-state` file suggests persisted UI/runtime state for that dashboard.

8. **Installation and bootstrap**
   `system/install.sh` is the bootstrap path for local setup, wiring the CLI, dashboard, and agent integration into the user’s environment. The README’s curl-to-bash install flow makes this repo effectively a self-installing toolchain rather than a library.

9. **Community contribution pipeline**
   `community-submissions` is a staging area for contributed workflows, while `workflows/available/community` is the published catalog. The repo’s docs and submit command imply a review-and-merge workflow where community content is prepared, tested, and then promoted into the shipped set.

10. **Tests as the main safety net**
   The test suite is Bats-based (`tests/bats`, `tests/core`, `tests/edge_cases`, `tests/persistence`, `tests/sync`, `tests/workflows`). It covers install behavior, directory discovery, enable/disable semantics, validation, malformed YAML, broken symlinks, persistence backup/restore, and dashboard behavior. This is important architecturally because the repo depends on filesystem conventions and text parsing, so correctness is enforced through integration-style shell tests rather than a compiled runtime.

11. **External dependencies and tooling**
   The project is shell-first, with a small Node-based dashboard component. The vendored Bats libraries and Git submodule markers show that test tooling is part of the repo’s operational model. Git is also central: workflows are versioned, shareable, and updateable through pulls and submissions.

12. **End-to-end data flow**
   A typical flow is: workflow definition lands in `available` or `custom` → CLI validates and enables it → enabled state is synced to the agent → scheduler or user triggers execution → logs and dashboard reflect results → workflows can later be backed up, restored, or updated from the upstream repo. That loop is the core architecture to diagram.

Main entry points: [`system/cli/clawflows`](https://github.com/nikilster/clawflows/tree/main/system/cli/clawflows) (clawflows), [`system/dashboard/server.js`](https://github.com/nikilster/clawflows/blob/main/system/dashboard/server.js) (Dashboard server), [`system/install.sh`](https://github.com/nikilster/clawflows/blob/main/system/install.sh) (Install), [`workflows/available/community/activate-focus-mode/WORKFLOW.md`](https://github.com/nikilster/clawflows/blob/main/workflows/available/community/activate-focus-mode/WORKFLOW.md) (WORKFLOW.md)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflows["Workflow storage"]
  node_catalog_community[("Community catalog<br/>workflow catalog")]
  node_custom_workflows[("Custom workflows<br/>user workflows")]
  node_enabled_workflows[("Enabled set<br/>active workflows")]
  node_workflow_md["WORKFLOW.md<br/>declarative spec<br/>[WORKFLOW.md]"]
end

subgraph group_control["Control plane"]
  node_clawflows_cli["clawflows<br/>CLI control plane"]
  node_install_script["Install<br/>bootstrap script<br/>[install.sh]"]
  node_agent_md["Agent spec<br/>agent integration<br/>[AGENT.md]"]
  node_scheduler_md["Scheduler<br/>execution model<br/>[scheduler.md]"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard_server["Dashboard server<br/>node dashboard<br/>[server.js]"]
  node_dashboard_template["Dashboard UI<br/>html template<br/>[template.html]"]
  node_dashboard_state["UI state<br/>persisted state<br/>[.dashboard-state]"]
end

subgraph group_community["Community pipeline"]
  node_submissions[("Submissions<br/>community staging")]
end

subgraph group_docs["Docs"]
  node_docs_create["Creating<br/>workflow guide"]
  node_docs_merge["Merging<br/>workflow guide"]
  node_docs_updates["Updates<br/>release guide<br/>[updates.md]"]
end

subgraph group_tests["Tests"]
  node_tests_suite["Bats suite<br/>integration tests"]
end

node_clawflows_cli -->|"discover"| node_catalog_community
node_clawflows_cli -->|"create/edit"| node_custom_workflows
node_clawflows_cli -->|"enable/disable"| node_enabled_workflows
node_clawflows_cli -->|"validate/run"| node_workflow_md
node_clawflows_cli -->|"sync-agent"| node_agent_md
node_clawflows_cli -->|"status"| node_dashboard_server
node_install_script -->|"install"| node_clawflows_cli
node_install_script -->|"wire up"| node_dashboard_server
node_install_script -->|"configure"| node_agent_md
node_dashboard_server -->|"render"| node_dashboard_template
node_dashboard_server -->|"persist"| node_dashboard_state
node_catalog_community -->|"contains"| node_workflow_md
node_custom_workflows -->|"contains"| node_workflow_md
node_enabled_workflows -->|"links to"| node_workflow_md
node_submissions -.->|"promote"| node_catalog_community
node_docs_create -->|"author"| node_submissions
node_docs_merge -->|"review"| node_submissions
node_docs_updates -->|"operate"| node_clawflows_cli
node_tests_suite -->|"verify"| node_clawflows_cli
node_tests_suite -->|"verify"| node_dashboard_server
node_tests_suite -->|"verify"| node_install_script

click node_catalog_community "https://github.com/nikilster/clawflows/tree/main/workflows/available/community"
click node_custom_workflows "https://github.com/nikilster/clawflows/tree/main/workflows/custom"
click node_enabled_workflows "https://github.com/nikilster/clawflows/tree/main/workflows/enabled"
click node_workflow_md "https://github.com/nikilster/clawflows/blob/main/workflows/available/community/activate-focus-mode/WORKFLOW.md"
click node_clawflows_cli "https://github.com/nikilster/clawflows/tree/main/system/cli/clawflows"
click node_install_script "https://github.com/nikilster/clawflows/blob/main/system/install.sh"
click node_agent_md "https://github.com/nikilster/clawflows/blob/main/system/AGENT.md"
click node_scheduler_md "https://github.com/nikilster/clawflows/blob/main/system/scheduler.md"
click node_dashboard_server "https://github.com/nikilster/clawflows/blob/main/system/dashboard/server.js"
click node_dashboard_template "https://github.com/nikilster/clawflows/blob/main/system/dashboard/template.html"
click node_dashboard_state "https://github.com/nikilster/clawflows/blob/main/system/.dashboard-state"
click node_submissions "https://github.com/nikilster/clawflows/tree/main/community-submissions"
click node_docs_create "https://github.com/nikilster/clawflows/blob/main/docs/creating-workflows.md"
click node_docs_merge "https://github.com/nikilster/clawflows/blob/main/docs/merging-workflows.md"
click node_docs_updates "https://github.com/nikilster/clawflows/blob/main/docs/updates.md"
click node_tests_suite "https://github.com/nikilster/clawflows/tree/main/tests"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_catalog_community,node_custom_workflows,node_enabled_workflows,node_workflow_md toneBlue
class node_clawflows_cli,node_install_script,node_agent_md,node_scheduler_md toneAmber
class node_dashboard_server,node_dashboard_template,node_dashboard_state toneMint
class node_submissions toneRose
class node_docs_create,node_docs_merge,node_docs_updates toneIndigo
class node_tests_suite toneTeal
```

## Components

### Workflow storage

Declarative workflow registry split into catalog, local edits, and active runtime set

- [Community catalog](https://github.com/nikilster/clawflows/tree/main/workflows/available/community): workflow catalog · Shipped workflows available for discovery and enablement · `workflows/available/community`
- [Custom workflows](https://github.com/nikilster/clawflows/tree/main/workflows/custom): user workflows · User-authored workflow definitions maintained locally · `workflows/custom`
- [Enabled set](https://github.com/nikilster/clawflows/tree/main/workflows/enabled): active workflows · Workflows currently activated for the agent to load · `workflows/enabled`
- [WORKFLOW.md](https://github.com/nikilster/clawflows/blob/main/workflows/available/community/activate-focus-mode/WORKFLOW.md): declarative spec · Plain-text workflow definition with metadata, schedule, and instructions · `workflows/available/community/activate-focus-mode/WORKFLOW.md`

### Control plane

CLI, bootstrap, and agent sync surfaces that manage workflow lifecycle

- [clawflows](https://github.com/nikilster/clawflows/tree/main/system/cli/clawflows): CLI control plane · Primary command entrypoint for listing, validating, enabling, running, syncing, and managing workflows · `system/cli/clawflows`
- [Install](https://github.com/nikilster/clawflows/blob/main/system/install.sh): bootstrap script · Local setup path that wires CLI, dashboard, and agent integration · `system/install.sh`
- [Agent spec](https://github.com/nikilster/clawflows/blob/main/system/AGENT.md): agent integration · Reference surface used to propagate enabled workflows into the agent environment · `system/AGENT.md`
- [Scheduler](https://github.com/nikilster/clawflows/blob/main/system/scheduler.md): execution model · Schedule-driven execution model documented for workflow runs · `system/scheduler.md`

### Dashboard

Local observability and state for workflow management

- [Dashboard server](https://github.com/nikilster/clawflows/blob/main/system/dashboard/server.js): node dashboard · Local web UI for observing and managing workflow state · `system/dashboard/server.js`
- [Dashboard UI](https://github.com/nikilster/clawflows/blob/main/system/dashboard/template.html): html template · Rendered dashboard view for workflow status and management · `system/dashboard/template.html`
- [UI state](https://github.com/nikilster/clawflows/blob/main/system/.dashboard-state): persisted state · Stored dashboard/runtime state · `system/.dashboard-state`

### Community pipeline

Staging and publication path for contributed workflows

- [Submissions](https://github.com/nikilster/clawflows/tree/main/community-submissions): community staging · Incoming community workflow contributions before publication · `community-submissions`

### Docs

Operator and contributor guidance

- [Creating](https://github.com/nikilster/clawflows/blob/main/docs/creating-workflows.md): workflow guide · Contributor guidance for authoring workflows · `docs/creating-workflows.md`
- [Merging](https://github.com/nikilster/clawflows/blob/main/docs/merging-workflows.md): workflow guide · Process for reviewing and promoting community workflows · `docs/merging-workflows.md`
- [Updates](https://github.com/nikilster/clawflows/blob/main/docs/updates.md): release guide · Workflow and repository update guidance · `docs/updates.md`

### Tests

Bats-based integration and edge-case coverage

- [Bats suite](https://github.com/nikilster/clawflows/tree/main/tests): integration tests · Shell-based tests covering install, lifecycle, persistence, sync, and edge cases · `tests`

## Connections

- clawflows → Community catalog: discover · Lists and inspects shipped workflows from the catalog
- clawflows → Custom workflows: create/edit · Creates and mutates user-authored workflows
- clawflows → Enabled set: enable/disable · Moves workflows into and out of the active runtime set
- clawflows → WORKFLOW.md: validate/run · Parses workflow definitions and executes selected workflows
- clawflows → Agent spec: sync-agent · Propagates enabled workflow references into the agent environment
- clawflows → Dashboard server: status · Feeds dashboard-oriented management and observability
- Install → clawflows: install · Bootstraps the CLI into the local environment
- Install → Dashboard server: wire up · Sets up local dashboard support
- Install → Agent spec: configure · Initializes agent integration hooks
- Dashboard server → Dashboard UI: render · Serves the dashboard HTML UI
- Dashboard server → UI state: persist · Reads and writes local dashboard state
- Community catalog → WORKFLOW.md: contains · Catalog entries are workflow directories containing a WORKFLOW.md
- Custom workflows → WORKFLOW.md: contains · Custom workflows are also stored as WORKFLOW.md directories
- Enabled set → WORKFLOW.md: links to · Enabled set points at active workflow definitions
- Submissions → Community catalog: promote · Reviewed community submissions are merged into the shipped catalog
- Creating → Submissions: author · Documents how contributors create workflow submissions
- Merging → Submissions: review · Documents the merge path from staging into published workflows
- Updates → clawflows: operate · Documents update and lifecycle operations for the toolchain
- Bats suite → clawflows: verify · Exercises CLI lifecycle and filesystem behavior
- Bats suite → Dashboard server: verify · Covers dashboard behavior and persistence
- Bats suite → Install: verify · Checks installation/bootstrap behavior
