From devflow
Use during PREVC Execution phase when autonomy is assisted or autonomous — manages story-by-story loop with specialist agent dispatch, TDD enforcement, and bidirectional escalation
npx claudepluginhub nexuz-sys/devflow --plugin devflowThis skill uses the workspace's default tool permissions.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Executes pre-written implementation plans: critically reviews, follows bite-sized steps exactly, runs verifications, tracks progress with checkpoints, uses git worktrees, stops on blockers.
Processes stories from stories.yaml one at a time, dispatching specialist agents, enforcing quality gates, and escalating to human when needed.
Announce at start: "I'm using the devflow:autonomous-loop skill to execute stories autonomously."
stories.yaml exists at .context/workflow/stories.yamlRead .context/workflow/stories.yaml. Validate:
status: pendingescalation config is presentIf validation fails, escalate to human immediately.
Track the total number of story execution attempts in the loop. If the total exceeds a hard ceiling (default: 50 iterations), exit the loop and generate the final report. This prevents infinite loops from stories that flip-flop between failed and in_progress.
Select the next story to execute using this priority:
status: in_progress (session died mid-execution — treat as retry)status: failed and attempts < max_retries_per_story (retry)status: pending (new work)priority valueblocked_by contains any story not yet completedblocked_by references a non-existent story ID, treat as an error and escalate that storyIf no story is selectable (all blocked, escalated, or completed): exit loop.
Distinguish exit reasons for the final report:
completed → "All stories complete"escalated, rest completed → "Loop paused, N stories escalated"blocked (circular deps or deps on escalated stories) → "All remaining stories are blocked. Unblock dependencies or re-plan."For the selected story:
3a. Update status:
# In stories.yaml
status: in_progress
attempts: <current + 1>
3b. Update checkpoint:
Write to .context/workflow/.checkpoint/handoff.md:
## Autonomous Loop Progress
- Feature: <feature name>
- Current story: <story.id> — <story.title>
- Attempt: <story.attempts>
- Completed: <stats.completed>/<stats.total>
- Mode: <current_autonomy>
3c. Dispatch specialist agent:
Use devflow:agent-dispatch to load the agent specified in story.agent.
Priority chain:
agent({ action: "getInfo", agent: "<story.agent>" }).context/agents/<story.agent>.mdagents/<story.agent>.md3d. Execute with TDD enforced (RED → GREEN → REFACTOR): The agent must follow this sequence:
Test types per story:
| Story touches... | Required tests |
|---|---|
| Pure functions, business logic | Unit |
| API, DB, service boundaries | Unit + Integration |
| Auth, payments, user flows, CLI | Unit + Integration + E2E |
3e. Quality gates: After implementation:
devflow:security-audit (lightweight mode)If all gates pass:
git add -A which may stage unrelated files):
git add <relevant files>
git commit -m "feat(<story.id>): <story.title>"
status: completed
completed_at: "<ISO 8601>"
duration_s: <elapsed seconds>
stats.completed: <+1>
stats.consecutive_failures: 0
escalation.upgrade_after_streak AND current mode is assisted:
stats.current_autonomy: autonomousIf gates fail:
Increment stats.consecutive_failures
Record error: story.error: "<failure description>"
Security check:
story.status: escalatedRetry check:
story.attempts < escalation.max_retries_per_story:
story.status: failedstory.attempts >= escalation.max_retries_per_story:
story.status: escalatedCircuit breaker check:
stats.consecutive_failures >= escalation.max_consecutive_failures:
When escalation is triggered:
stories.yaml with current statestats.current_autonomy: assisted━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Autonomous Loop — Escalation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Reason: <reason>
Story: <story.id> — <story.title>
Error: <story.error>
Progress: <completed>/<total> stories
Suggestions:
- <specific suggestion based on error>
To resume: fix the issue and say "continue"
To abort: say "stop" or "/devflow-status"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
When the loop exits (all stories processed or stopped):
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Autonomous Loop — Complete
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Feature: <feature name>
Completed: <n>/<total> stories
Escalated: <n> stories
Duration: <total time>
Stories:
✓ S1 — Create Product model (45s)
✓ S2 — POST /products endpoint (62s)
✗ S3 — ProductForm component (escalated)
⬚ S4 — Product list page (blocked by S3)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Exit message depends on state:
completed → "All stories complete. Ready for Validation phase."escalated → "Loop paused. <n> stories need attention before Validation."blocked → "All remaining stories are blocked. Unblock dependencies or re-plan."agent({ action: "orchestrate", task: "<story>" })plan({ action: "updateStep", ... })workflow-manage({ action: "handoff", ... }).context/agents/<name>.mdagents/ directory| Thought | Reality |
|---|---|
| "Skip TDD for small stories" | TDD is enforced for ALL stories. No exceptions. |
| "Retry indefinitely" | Max retries exist for a reason. Escalate and move on. |
| "Skip security for non-auth stories" | Security scan triggers are story-content-aware. Trust the gate. |
| "Push after each story" | Never push. Commit locally only. Push happens in Confirmation. |
| "Decompose a large story mid-loop" | If a story is too large, escalate. Re-planning happens in P phase. |
| "Run two sessions on the same stories.yaml" | No locking mechanism exists. Two sessions will pick up the same story. Use one session at a time. |