#How do i build this workflow in openclaw?

1 messages · Page 1 of 1 (latest)

sour ravine
#

Workflow Orchestration

1. Plan Mode Default

  • Enter plan mode for ANY non-trivial task (3+ steps or architectural decisions)
  • If something goes sideways, STOP and re-plan immediately – don't keep pushing
  • Use plan mode for verification steps, not just building
  • Write detailed specs upfront to reduce ambiguity

2. Subagent Strategy

  • Use subagents liberally to keep main context window clean
  • Offload research, exploration, and parallel analysis to subagents
  • For complex problems, throw more compute at it via subagents
  • One task per subagent for focused execution

3. Self-Improvement Loop

  • After ANY correction from the user: update tasks/lessons.md with the pattern
  • Write rules for yourself that prevent the same mistake
  • Ruthlessly iterate on these lessons until mistake rate drops
  • Review lessons at session start for relevant project

5. Demand Elegance (Balanced)

  • For non-trivial changes: pause and ask "is there a more elegant way?"
  • If a fix feels hacky: "Knowing everything I know now, implement the elegant solution"
  • Skip this for simple, obvious fixes – don't over-engineer
  • Challenge your own work before presenting it

6. Autonomous Bug Fixing

Task Management

  1. Plan First: Write plan to tasks/todo.md with checkable items
  2. Verify Plan: Check in before starting implementation
  3. Track Progress: Mark items complete as you go
  4. Explain Changes: High-level summary at each step
  5. Document Results: Add review section to tasks/todo.md
  6. Capture Lessons: Update tasks/lessons.md after corrections

Core Principles

  • Simplicity First: Make every change as simple as possible. Impact minimal code.
  • No Laziness: Find root causes. No temporary fixes. Senior developer standards.
  • Minimal Impact: Changes should only touch what's necessary. Avoid introducing bugs.
supple sundialBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> âś… Mark Solution

sudden valveBOT
#

You can build almost all of that workflow in OpenClaw with (a) workspace files + (b) strict instructions in AGENTS.md. “Plan mode” isn’t a built-in toggle — it’s a behavior you enforce by making the agent write a plan file first and wait for approval.

1) Create the workflow files in your agent workspace

In your workspace (default is ~/.openclaw/workspace), add:

tasks/todo.md (template)

# TODO

## Plan (must be written before execution)
- [ ] Step 1:
- [ ] Step 2:
- [ ] Step 3:

## Progress
- [ ] ...
#

## Review (fill in at end)
- What changed:
- How verified:
- Risks / follow-ups:

tasks/lessons.md

# Lessons

## Patterns to avoid (and the rule that prevents it)
- Date:
  Mistake:
  Fix:
#
  New rule:

(Any folder structure is fine — the key is: give the agent a single obvious place to write plans + lessons.)

2) Put the orchestration rules into AGENTS.md

Add a “Workflow Orchestration” section that’s unambiguous and enforceable. Example:

## Workflow Orchestration (must follow)
- For any task requiring 3+ steps or any architectural decision:
  1) Write a plan to `tasks/todo.md` using checkboxes
  2) Ask for confirmation BEFORE executing the plan
  3) Mark progress in `tasks/todo.md` as you go
  4) Finish by filling the Review section
#

- If anything goes sideways: STOP, write a new plan, ask again.

- Use sub-agents for parallel research/exploration. One task per sub-agent.

- After any user correction:
  - Append a new entry to `tasks/lessons.md` with a concrete prevention rule.

That gets you “plan mode default”, “stop and re-plan”, “track progress”, “document results”, and “self-improvement loop”.

3) Use Sub-agents for the parallelism part

OpenClaw has first-class subagents:

  • /subagents spawn <agentId> <task>
  • /subagents list
#
  • /subagents log <id|#>

Docs: https://docs.openclaw.ai/tools/subagents

If you want the Discord thread to stay bound to a spawned sub-agent session (so follow-ups in the thread keep going to that worker), enable thread bindings (docs + keys are here):
https://docs.openclaw.ai/tools/subagents#discord-thread-bound-sessions

4) Optional: enforce “verification steps”

If you want “use plan mode for verification steps” to be real, explicitly require a Verification checklist in tasks/todo.md (and have the agent fill it before marking the task done).


If you tell me which surface you’re using most (Discord threads vs DMs vs Telegram) and whether you want one orchestrator agent + worker agents or one agent that spawns subagents, I can suggest the cleanest setup pattern.

sour ravine
#

discord DM, one orchestrator agent + worker agents

sudden valveBOT
#

For Discord DM + one orchestrator agent + worker agents, the clean pattern is:

  • Orchestrator = the DM-bound “main” agent (owns tasks/todo.md + tasks/lessons.md, enforces the workflow)
  • Workers = separate agents with their own workspaces (research/build/review), invoked via sub-agents targeting agentId

That gives you parallelism + clean context, without needing Discord thread bindings.


1) Create the agents (workspaces kept separate)

CLI (run on the gateway host):

openclaw agents add main --workspace ~/.openclaw/workspace-main
openclaw agents add research --workspace ~/.openclaw/workspace-research
openclaw agents add builder --workspace ~/.openclaw/workspace-builder
#
openclaw agents add reviewer --workspace ~/.openclaw/workspace-reviewer

Docs: https://docs.openclaw.ai/cli/agents


2) Configure the orchestrator so it’s allowed to spawn worker agents

In ~/.openclaw/openclaw.json (JSON5), make sure the main agent has:

{
  agents: {
    list: [
      {
#
        id: "main",
        default: true,
        workspace: "~/.openclaw/workspace-main",
        subagents: {
          // key point: otherwise you can’t target other agent ids in sessions_spawn
          allowAgents: ["research", "builder", "reviewer"],
        },
      },
      { id: "research", workspace: "~/.openclaw/workspace-research" },
      { id: "builder", workspace: "~/.openclaw/workspace-builder" },
      { id: "reviewer", workspace: "~/.openclaw/workspace-reviewer" },
    ],
  },
}
#

(Config reference explicitly calls out subagents.allowAgents.)
Docs: https://docs.openclaw.ai/tools/subagents


3) Put the workflow “contract” in the orchestrator workspace

In ~/.openclaw/workspace-main/ create:

  • tasks/todo.md (plan/progress/review template)
  • tasks/lessons.md
  • and put your rules in ~/.openclaw/workspace-main/AGENTS.md

Important detail: sub-agents only inherit AGENTS.md + TOOLS.md context-wise, so put any “must-follow” orchestration rules in AGENTS.md (not only SOUL/IDENTITY/USER).


4) How you use it in the Discord DM

#

From your DM with the orchestrator:

Spawn workers (one task per worker):

  • /subagents spawn research <task>
  • /subagents spawn builder <task>
  • /subagents spawn reviewer <task>

Then:

  • /subagents list (see what’s running)
  • /subagents log <id> / /subagents info <id>
  • /subagents steer <id> <new instruction> if it’s going sideways

The workers will announce results back into the DM when done.