feat: implement core/team_runner.py and cli/agency.py #1

Open
hans-heinemann wants to merge 3 commits from hans/team-runner into main
Member

This is the final implementation item from the buildspec — core/team_runner.py and cli/agency.py.

What's in this PR

  • core/team_runner.py — full orchestration engine: spawn loop, gate logic, escalation, all tier lifecycle handling
  • cli/agency.pyagency run, agency watch, agency approve, agency reject, agency inspect, agency pause, agency resume commands
  • docs/agent-teams-design.md + docs/agent-teams-buildspec.md — added to repo for agent orientation
  • CLAUDE.md — agent quick reference
  • Submodule URL updated to Gitea

Status

All 15 buildspec steps complete. Design is fully locked (8 open questions resolved in PRs #8 + #9).

This is the final implementation item from the buildspec — `core/team_runner.py` and `cli/agency.py`. ## What's in this PR - `core/team_runner.py` — full orchestration engine: spawn loop, gate logic, escalation, all tier lifecycle handling - `cli/agency.py` — `agency run`, `agency watch`, `agency approve`, `agency reject`, `agency inspect`, `agency pause`, `agency resume` commands - `docs/agent-teams-design.md` + `docs/agent-teams-buildspec.md` — added to repo for agent orientation - `CLAUDE.md` — agent quick reference - Submodule URL updated to Gitea ## Status All 15 buildspec steps complete. Design is fully locked (8 open questions resolved in PRs #8 + #9).
hans-heinemann added 2 commits 2026-04-02 10:22:27 -04:00
- core/blackboard.py: add t3_task_lists table, extend event kinds to
  include full visibility vocabulary (gate_pending, gate_approved,
  gate_rejected, gate_paused, gate_resumed, path_amendment, log), and
  add query methods (get_events, get_latest_gate_event, get_t3_task_lists,
  all_t3_committed, get_briefs, get_workstreams, etc.)

- core/team_runner.py: full run lifecycle orchestrator
  - Loads team.yaml + role_registry.yaml, instantiates all four adapter types
  - T1 Plan (two-phase: plan + accept), T2 Lead/Specialist/Synthesis,
    T3 Squad Lead with mesh draft/commit cycle and mesh-timeout escalation,
    T4 swarm+pipeline with dep-ordering, T5 fan-out + joint verdict
  - Async (asyncio.gather) for parallel workstream and T4/T5 fan-out
  - Gate logic: gate_pending → notify → poll blackboard → gate_approved/rejected
  - Path amendment monitor (background task)
  - EscalationHandler integrated into _dispatch_with_retry
  - T3 mesh timeout → T2 re-scope escalation
  - Terminal failure → notify + run status=failed
  - VCS branch creation + PR at T1 Accept phase
  - Runtime selection: coding_agent runtime for preferred_runtime="coding_agent",
    tier_runtime_map overrides, fallback to default runtime

- cli/agency.py: agency CLI with subcommands
  - run: start pipeline, prints run_id + watch/inspect hints
  - watch: tails blackboard events live with ANSI-coloured output
  - inspect: run tree, --tier filter, --brief detail view
  - approve: write gate_approved directly to blackboard (universal gate path)
  - reject: write gate_rejected with --reason
  - pause: write gate_paused signal
  - resume: write gate_resumed signal

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
hans-heinemann added 1 commit 2026-06-01 09:00:18 -04:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin hans/team-runner:hans/team-runner
git checkout hans/team-runner
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cw-hans/the-agency#1