Autonomous Agents Agentic Workflow
PM: Drive Epic — Autonomous Agents Agentic Workflow
Self-driving push of a planned epic to Done — schedules its own loop, merges ready PRs, dispatches the next unblocked child, closes out.
sidebutton install agents Drives an already-planned epic to completion and OWNS its own loop — the operator kicks it off once and it keeps itself going. On the first run it registers a recurring schedule (about every 5 minutes) that re-fires this same workflow on the epic; each tick merges any ready PRs (after reviewing the diff and running tests) and dispatches the next unblocked child to a free peer agent. When every child is Done it closes the epic and deletes its own schedule. The child tickets and their dependencies already exist — this workflow only ships them; it does not plan or decompose.
Steps
- 1. Open a terminal
- title
- Agent: PM Drive Epic
- cwd
- {{entry_path}}
terminal.open - 2. Run a terminal command
- cmd
- |
terminal.run
Workflow definition
schema_version: 1
id: agent_pm_drive
title: "PM: Drive Epic"
description: "Self-driving push of a planned epic to Done — schedules its own loop, merges ready PRs, dispatches the next unblocked child, closes out."
overview: |
Drives an already-planned epic to completion and OWNS its own loop — the operator kicks it
off once and it keeps itself going. On the first run it registers a recurring schedule
(about every 5 minutes) that re-fires this same workflow on the epic; each tick merges any
ready PRs (after reviewing the diff and running tests) and dispatches the next unblocked
child to a free peer agent. When every child is Done it closes the epic and deletes its own
schedule. The child tickets and their dependencies already exist — this workflow only ships
them; it does not plan or decompose.
category:
level: pipeline
domain: engineering
metadata:
agent: true
role: pm
params:
ticket_url:
type: string
description: "Epic / parent Jira ticket URL (children already created with dependencies)"
hint:
type: string
default: ""
description: "Optional extra instructions (dependency notes, preferred agents)"
entry_path:
type: string
default: "~/workspace"
description: "Working directory for the agent"
steps:
- type: terminal.open
title: "Agent: PM Drive Epic"
cwd: "{{entry_path}}"
- type: terminal.run
cmd: |
source ~/.agent-env && claude --dangerously-skip-permissions "$(cat <<'SB_PROMPT'
You are a PM agent driving epic {{ticket_url}} to Done, and you OWN the loop — you are NOT re-run by hand. The child tickets and their blocks / blocked-by links already exist; your job is only to ship them in dependency order.
SELF-SCHEDULE: on this run, ensure a recurring schedule exists that re-fires this same pm-drive workflow on this epic about every 5 minutes (use your scheduler — a SideButton recurring job, or a cron routine). Create it ONLY if one does not already exist for this epic; never duplicate. You will delete it yourself at CLOSE.
Then do ONE drive tick:
1. ASSESS. Read the epic, every child ticket, and the latest comment on each (agents post their PR link and report there). Map each child to Done / In Review (PR open) / In Progress (dispatched) / To Do, plus the blocks graph. Trust PRs and comments over the Jira status field.
2. MERGE what is ready. For each child with an open PR: do NOT trust the agent summary — read the diff against the ticket acceptance criteria and run the test suite plus type-check (there is no CI, you are the gate). Correct and green: squash-merge, delete the branch, transition the child to Done. Wrong or red: comment the specific problems and dispatch agent_se_followup (do not merge).
3. DISPATCH next. Pick a child that is To Do with ALL its blockers Done and dispatch agent_se_work to a FREE PEER agent (not yourself — you are the orchestrator). One coding job per agent; let a child PR merge before dispatching another child that touches the same files (parallel branches off stale main collide on migrations and config). Transition the dispatched child to In Progress.
4. UNSTICK. A dispatched agent that has gone idle with no PR: confirm by its live session before calling it failed (fleet status can lag). If it left an uncommitted feature branch, re-dispatch agent_se_work to FINISH that branch WITHOUT resetting; if it produced nothing, re-dispatch once.
5. CLOSE. When every child is Done and merged, transition the epic to Done and DELETE the recurring schedule (stop the loop).
Every dispatch hint MUST: begin with the repo refresh (cd <repo> && git fetch origin && git checkout main && git reset --hard origin/main); be PLAIN TEXT with NO backticks and NO dollar signs (they execute as shell commands on the worker); name the existing files and helpers to reuse so the agent does not reinvent; and tell the agent to run tests, open a PR against main, and comment the PR link on the ticket.
Post exactly ONE status comment on the epic this tick: N of M children Done, what you merged or dispatched, any blockers, next step.
{{hint}}
SB_PROMPT
)"