Propose an Agent Teams design for `pydantic-ai-harness` and `clai2`
- Part of #9145 (doesn't close it; this PR only proposes a design)
Why we make these changes
This PR proposes a Claude Code Agent Teams-style experience. A lead session runs a large team of named, long-lived teammates. The teammates share a task board with dependencies and atomic claims, and they message each other directly. The PR also covers how capability events drive that experience in the clai2 TUI and the clai2 --web GUI. It adds only PLAN.md, so maintainers can agree on the approach before any code; this follows the root AGENTS.md. Implementation will follow as stacked PRs (§6), and PLAN.md can be deleted afterwards.
What the analysis found:
- Most of the pieces exist.
DelegationTasks(background, resumable, steerable children with persistence),planning(dependencies), and theclai2task panel and web Workers view already cover most of the design. - Missing primitives: atomic task claiming, host-driven start and wake, lossless messages between agents and to the lead, member names, gates, and anything that keeps a large team from swamping the UI and the lead's budget.
- Proposed split: harness gets only the primitives that are hard to build correctly on public APIs (§3.1
DelegationTasksadditions, §3.2ClaimablePlanStore). Where the team composition lives is open question Q2, in light of the "application pattern" comment on #9145. - Event routing: run-caused events flow through the existing
TaskEventand lead stream. Owner- and user-caused events go through aTeamobserver andhost.team/TeamEvent. UIs rebuild state from events plus a snapshot.
Decisions needed (§7)
- Board model:
OwnedPlanItem+ClaimablePlanStoreinplanning, or a separateTaskBoard? - Where the team composition lives: a harness
teams/package, orclai2? - Idle semantics: "idle = settled run; wake = host-driven rerun"?
- Default workspace: one shared workspace, or a worktree per member?
- TUI key bindings.
New public surface
None. The PR adds only PLAN.md. The API it proposes is listed in §3.
User-visible behavior
None.
Verification
There's no code to test. Several local review passes checked every claim about current code in PLAN.md against main; the final pass found no issues.
What changes for existing users
Nothing.
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
- PR title is fit for the release changelog.