Agent skill
flow-next-sync
Manually trigger plan-sync to update downstream task specs after implementation drift. Use when code changes outpace specs.
Install this agent skill to your Project
npx add-skill https://github.com/gmickel/flow-next/tree/main/plugins/flow-next/codex/skills/flow-next-sync
SKILL.md
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:-$HOME/.codex}}/scripts/flowctl"
[ -x "$FLOWCTL" ] || FLOWCTL=".flow/bin/flowctl"
Input
Arguments: $ARGUMENTS
Format: <id> [--dry-run]
<id>- task IDfn-N-slug.M(or legacyfn-N.M,fn-N-xxx.M) or epic IDfn-N-slug(or legacyfn-N,fn-N-xxx)--dry-run- show changes without writing
Workflow
Step 1: Parse Arguments
FLOWCTL="${DROID_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$HOME/.codex}}/scripts/flowctl"
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
Parse $ARGUMENTS for:
- First positional arg =
ID --dry-runflag =DRY_RUN(true/false)
Validate ID format first:
- Must start with
fn- - If no ID provided: "Usage: /flow-next:sync [--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 not found. Run
flowctl listto see available." - For epic ID: "Epic not found. Run
flowctl epicsto 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
-
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."
- Prefer most recently updated task with
-
Then filter remaining tasks to
status: todoorstatus: 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:-$HOME/.codex}}/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
| Case | Message |
|---|---|
| No ID provided | "Usage: /flow-next:sync [--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 not found. Run flowctl list to see available." |
| Epic not found | "Epic 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.enabledsetting 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
todoandblockedtasks - Reuses agent - spawns existing plan-sync agent, no duplication
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
flow-next-impl-review
John Carmack-level implementation review via RepoPrompt or Codex. Use when reviewing code changes, PRs, or implementations. Triggers on /flow-next:impl-review.
flow-next
Manage .flow/ tasks and epics. Triggers: 'show me my tasks', 'list epics', 'what tasks are there', 'add a task', 'create task', 'what's ready', 'task status', 'show fn-1-add-oauth'. NOT for /flow-next:plan or /flow-next:work.
flow-next-plan
Create structured build plans from feature requests or Flow IDs. Use when planning features or designing implementation. Triggers on /flow-next:plan with text descriptions or Flow IDs (fn-1-add-oauth, fn-1-add-oauth.2, or legacy fn-1, fn-1.2, fn-1-xxx, fn-1-xxx.2).
flow-next-worktree-kit
Manage git worktrees (create/list/switch/cleanup) and copy .env files. Use for parallel feature work, isolated review, clean workspace, or when user mentions worktrees.
flow-next-rp-explorer
Token-efficient codebase exploration using RepoPrompt CLI. Use when user says "use rp to..." or "use repoprompt to..." followed by explore, find, understand, search, or similar actions.
flow-next-deps
Show epic dependency graph and execution order. Use when asking 'what's blocking what', 'execution order', 'dependency graph', 'what order should epics run', 'critical path', 'which epics can run in parallel'.
Didn't find tool you were looking for?