Get the FREE Ultimate OpenClaw Setup Guide →

flow-next-sync

Use Caution
npx machina-cli add skill gmickel/gmickel-claude-marketplace/flow-next-sync --openclaw
Files (1)
SKILL.md
4.5 KB

Manual Plan-Sync

Manually trigger plan-sync to update downstream task specs.

CRITICAL: flowctl is BUNDLED - NOT installed globally. Always use:

FLOWCTL="${DROID_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/flowctl"

Input

Arguments: $ARGUMENTS Format: <id> [--dry-run]

  • <id> - task ID fn-N-slug.M (or legacy fn-N.M, fn-N-xxx.M) or epic ID fn-N-slug (or legacy fn-N, fn-N-xxx)
  • --dry-run - show changes without writing

Workflow

Step 1: Parse Arguments

FLOWCTL="${DROID_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/flowctl"
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"

Parse $ARGUMENTS for:

  • First positional arg = ID
  • --dry-run flag = DRY_RUN (true/false)

Validate ID format first:

  • Must start with fn-
  • If no ID provided: "Usage: /flow-next:sync <id> [--dry-run]"
  • If doesn't match fn-* pattern: "Invalid ID format. Use fn-N-slug (epic) or fn-N-slug.M (task). Legacy fn-N, fn-N-xxx also work."

Detect ID type:

  • Contains . (e.g., fn-1.2 or fn-1-add-oauth.2) -> task ID
  • No . (e.g., fn-1 or fn-1-add-oauth) -> epic ID

Step 2: Validate Environment

test -d .flow || { echo "No .flow/ found. Run flowctl init first."; exit 1; }

If .flow/ missing, output error and stop.

Step 3: Validate ID Exists

$FLOWCTL show <ID> --json

If command fails:

  • For task ID: "Task <id> not found. Run flowctl list to see available."
  • For epic ID: "Epic <id> not found. Run flowctl epics to see available."

Stop on failure.

Step 4: Find Downstream Tasks

For task ID input:

# Extract epic from task ID (remove .N suffix)
EPIC=$(echo "<task-id>" | sed 's/\.[0-9]*$//')

# Get all tasks in epic
$FLOWCTL tasks --epic "$EPIC" --json

Filter to status: todo or status: blocked. Exclude the source task itself.

For epic ID input:

$FLOWCTL tasks --epic "<epic-id>" --json
  1. First, find a source task to anchor drift detection (agent requires COMPLETED_TASK_ID):

    • Prefer most recently updated task with status: done
    • Else: most recently updated task with status: in_progress
    • Else: error "No completed or in-progress tasks to sync from. Complete a task first."
  2. Then filter remaining tasks to status: todo or status: blocked (these are downstream).

If no downstream tasks:

No downstream tasks to sync (all done or none exist).

Stop here (success, nothing to do).

Step 5: Spawn Plan-Sync Agent

Build context and spawn via Task tool:

Sync task specs from <source> to downstream tasks.

COMPLETED_TASK_ID: <source task id - the input task, or selected source for epic mode>
FLOWCTL: ${DROID_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/flowctl
EPIC_ID: <epic id>
DOWNSTREAM_TASK_IDS: <comma-separated list from step 4>
DRY_RUN: <true|false>

<if DRY_RUN is true>
DRY RUN MODE: Report what would change but do NOT use Edit tool. Only analyze and report drift.
</if>

Use Task tool with subagent_type: flow-next:plan-sync

Note: COMPLETED_TASK_ID is always provided - for task-mode it's the input task, for epic-mode it's the source task selected in Step 4.

Step 6: Report Results

After agent returns, format output:

Normal mode:

Plan-sync: <source> -> downstream tasks

Scanned: N tasks (<list>)
<agent summary>

Dry-run mode:

Plan-sync: <source> -> downstream tasks (DRY RUN)

<agent summary>

No files modified.

Error Messages

CaseMessage
No ID provided"Usage: /flow-next:sync <id> [--dry-run]"
No .flow/"No .flow/ found. Run flowctl init first."
Invalid format"Invalid ID format. Use fn-N-slug (epic) or fn-N-slug.M (task). Legacy fn-N, fn-N-xxx also work."
Task not found"Task <id> not found. Run flowctl list to see available."
Epic not found"Epic <id> not found. Run flowctl list to see available."
No source (epic mode)"No completed or in-progress tasks to sync from. Complete a task first."
No downstream"No downstream tasks to sync (all done or none exist)."

Rules

  • Ignores config - planSync.enabled setting is for auto-trigger only; manual always runs
  • Any source status - source task can be todo, in_progress, done, or blocked
  • Includes blocked - downstream set includes both todo and blocked tasks
  • Reuses agent - spawns existing plan-sync agent, no duplication

Source

git clone https://github.com/gmickel/gmickel-claude-marketplace/blob/main/plugins/flow-next/skills/flow-next-sync/SKILL.mdView on GitHub

Overview

flow-next-sync provides a manual trigger to refresh downstream task specs by running plan-sync. It helps keep task definitions aligned when code changes outpace the documented specs.

How This Skill Works

The skill parses the target ID from arguments, validates the environment (requires a .flow directory), and verifies the ID with flowctl. It then finds downstream tasks, selects a source task for epic mode when needed, and spawns a plan-sync agent to synchronize specs, passing COMPILED_TASK_ID, EPIC_ID, and DOWNSTREAM_TASK_IDS. Note that flowctl is bundled and must be invoked via the FLOWCTL path shown in the script; a --dry-run option reports potential changes without applying edits.

When to Use It

  • When a code change alters behavior but specs lag behind, and downstream task specs must be updated.
  • When an epic's tasks drift due to new implementations and downstream tasks need refreshed references.
  • Before committing a release to verify that plan-sync would align all downstream specs.
  • When you want to audit potential changes with --dry-run to preview drift before applying.
  • When there are downstream tasks to sync; if none exist, the process will report and exit gracefully.

Quick Start

  1. Step 1: Set the FLOWCTL path as described in the SKILL.md and ensure you are in a repo with a .flow directory.
  2. Step 2: Run the command using a valid ID, e.g. /flow-next:sync fn-42.feature-update.2 [--dry-run].
  3. Step 3: Review the plan-sync agent output and the resulting downstream task updates.

Best Practices

  • Always start with --dry-run to preview drift before applying changes.
  • Validate the ID format and type (task vs epic) before proceeding.
  • Ensure the .flow directory exists by running flowctl init first.
  • For epic IDs, choose a source task with status done or in_progress as anchor.
  • After running, review the agent summary and the listed downstream changes for accuracy.

Example Use Cases

  • Sync a specific task: /flow-next:sync fn-42.feature-update.2 to refresh downstream specs after feature work.
  • Epic-based sync: /flow-next:sync fn-7-user-flow to align all downstream tasks from the latest completed source.
  • Dry-run audit: /flow-next:sync fn-3-auth-flow --dry-run to preview drift without applying.
  • Missing environment: The command fails with No .flow/ found. Run flowctl init first.
  • No downstream tasks: Epic with all downstream tasks already done yields 'No downstream tasks to sync (all done or none exist).'

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers