Rewrite dev-agent.sh from tmux session manager to synchronous bash loop:
- Replace tmux + phase-handler with synchronous claude -p invocations
- Define agent_run() wrapping claude -p with --resume for session continuity
- Use .sid file to persist session_id across crash recovery
- Delegate CI/review loop to pr_walk_to_merge() from lib/pr-lifecycle.sh
- Replace inline label management with lib/issue-lifecycle.sh
(issue_claim, issue_release, issue_block, issue_close, issue_check_deps)
- Replace inline worktree management with lib/worktree.sh
(worktree_create, worktree_recover, worktree_cleanup)
- Use pr_create/pr_find_by_branch from lib/pr-lifecycle.sh
- Use build_phase_protocol_prompt for push instructions
- Keep: issue fetch, recovery mode, prior art, prompt composition,
concurrency lock, memory guard, refusal handling
The script drops from 745 to ~500 lines. No tmux sessions, no phase
file monitoring, no phase-handler.sh dependency.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>