Phase: Orchestration Automation

phase-pal-e-docs-orchestration-automation Phase

Goal: Close the loop — agent actions automatically trigger the next step without Betty Sue manually intervening. status:qa auto-spawns QA agent. Merge auto-updates sprint board.
Owner: Betty Sue (Claude config development per sop-claude-config-development)
Repo: forgejo_admin/claude-custom (symlinked as ~/.claude/)
Forgejo Issue: TBD

Architecture

Phases 3 and 4 make the workflow work manually — hooks set labels, Betty Sue runs skills to sync boards. Phase 5 makes it automatic — hooks trigger the next agent in the chain without Betty Sue initiating.
Trigger Automation What Happens
Dev submits PR (status:qa set by Phase 3 hook) Auto-QA trigger QA agent spawned automatically to review the PR
PR merged Auto-board sync Sprint item moved to done, plan phase updated
QA sets status:needs-fix Auto-dev respawn Dev agent respawned with fix instructions (stretch goal)

Design Considerations

  • Hooks must be lightweight — spawn a subagent for heavy work, don't block the hook
  • Auto-QA trigger must pass the PR number and issue number to the QA agent
  • Auto-board sync must identify which sprint item corresponds to the merged PR
  • All auto-spawns must follow agent-spawn-conventions (plan slug, boundary statement)
  • Consider a "manual mode" flag to disable auto-triggers during debugging

Implementations

1. Auto-QA trigger (PostToolUse on mcp__forgejo__submit_pr):
  • After Phase 3's label-on-pr hook sets status:qa, inject context telling Betty Sue to spawn QA
  • Or: directly spawn QA subagent from the hook (if hooks can spawn agents)
  • Fallback: PostToolUse injects "status:qa set — run /review-pr owner/repo#N" as additionalContext
2. Auto-board sync — ABSORBED by plan-pal-e-agency Phase 11:
  • DONE — Delivered by Agency Phase 11e (board-item-on-merge.sh hook, PR #98 on claude-custom)
  • Post-merge hook calls pal-e-docs API to move board item to done column
  • Session-start auto-sync also deployed (Agency Phase 11d)
3. Auto-dev respawn (stretch goal):
  • When QA sets status:needs-fix, auto-spawn dev agent with fix instructions
  • Only viable if QA comment clearly describes what needs fixing
  • Defer to Phase 6 or a future plan if too complex

Steps

  • Determine whether hooks can spawn subagents or only inject context
  • Implement auto-QA trigger (extend label-on-pr.sh or new hook)
  • Implement auto-board sync (extend post-mcp-merge-rebase.sh)
  • Add manual mode flag (.claude-no-auto-trigger file disables auto-spawns)
  • Test full cycle: issue → dev → PR → auto-QA → verdict → merge → auto-board-sync
  • Evaluate auto-dev-respawn feasibility
Deliverable: Dev submits PR → QA automatically reviews → verdict auto-sets label → merge auto-updates board. The full loop runs with minimal Betty Sue intervention.
Depends on: Phase 3 (hooks set labels), Phase 4 (skill exists to sync boards).