Skip to content

Comments

feat: PACT v3.0 Agent Teams migration#164

Open
michael-wojcik wants to merge 20 commits intomainfrom
feature/v3-agent-teams-v2
Open

feat: PACT v3.0 Agent Teams migration#164
michael-wojcik wants to merge 20 commits intomainfrom
feature/v3-agent-teams-v2

Conversation

@michael-wojcik
Copy link
Collaborator

Summary

Migrates PACT from the subagent execution model (Task(subagent_type=..., run_in_background=true)) to Claude Code Agent Teams — a flat team model with TeamCreate/SendMessage/TeamDelete, externalized Task state, and Task-as-instruction dispatch.

Key changes:

  • Execution model: Hub-and-spoke subagent dispatch → flat two-tier team (lead + specialists) with SendMessage coordination
  • State management: Implicit context passing → externalized 5-level Task metadata (Feature, Phase, Agent, Scope, Review)
  • Agent bootstrap: Detailed dispatch prompts → Task-as-instruction with chain-read pattern (TaskGet → upstream metadata → artifact paths)
  • Scoped orchestration: ATOMIZE/CONSOLIDATE phases retired → recursive P→A→C→T at every level; new pact-scope-verification.md protocol
  • Agent definitions: "Report to orchestrator" → "Report to assigner" (v3.1-ready)
  • New hooks: TeammateIdle (stall detection) + TaskCompleted (handoff quality gate)
  • Version bump: 2.8.0 → 3.0.0

46 files changed (+2437/-926 lines) across commands, protocols, agents, hooks, skills, tests, and verification scripts.

Implementation Plan

Per docs/plans/2026-02-09-v3-agent-teams-implementation.md — 16 tasks across 5 dependency layers, all completed.

Test plan

  • All 1007 unit tests pass (pytest pact-plugin/tests/)
  • 172 new Agent Teams tests (patterns, transcript parser, workflow detector, fuzz)
  • 128 verification script checks pass (protocol extracts: 16, task hierarchy: 27, scope integrity: 67, worktree protocol: 18)
  • Version bump verified in both plugin.json and marketplace.json
  • Manual: Install plugin and run /PACT:orchestrate on a real task
  • Manual: Verify TeammateIdle and TaskCompleted hooks fire correctly

Replace text-only reporting with SendMessage-based communication.
Agents now have Task tools (TaskGet/TaskUpdate/TaskList) for
self-management and chain-read context inheritance. Uses 'report
to assigner' language for v3.1 compatibility.
Replaces retired pact-scope-phases.md (ATOMIZE/CONSOLIDATE).
Defines the scope verification protocol executed at the end of
the outer CODE phase: contract compatibility (architect), contract
fulfillment (lead metadata comparison), and integration testing.
Replace 'report to orchestrator' with 'report to assigner' across
all 8 agent definitions. Maintains v3.1 compatibility where a
coordinator (not just the lead) could assign work.
Retire ATOMIZE/CONSOLIDATE from task hierarchy and scope detection.
Replace 'subagent' terminology with 'specialist/agent'. Update
scope contract to position Agent Teams as primary executor. Add
scope verification protocol to SSOT. Update agent stall detection
for TeammateIdle hook model. Sync all SSOT extract sections and
update verification script line ranges.
Replace subagent dispatch with flat team model (TeamCreate,
SendMessage, Task-as-instruction). Retire ATOMIZE/CONSOLIDATE
sections — scoped orchestration uses recursive P→A→C→T within
standard ARCHITECT (decomposition) and CODE (rePACT + scope
verification) phases. Add team lifecycle management and 5-level
metadata model.
Sequential sub-scope execution using flat team model. Single
branch per feature (no suffix branches or per-scope worktrees).
Handoffs stored in Task metadata. Scope verification protocol
reference replaces CONSOLIDATE. Nesting depth tracked in
feature task metadata.
Update comPACT, peer-review, plan-mode, and imPACT dispatch
models from subagent to Agent Teams. Replace run_in_background
with teammate spawning. Update handoff reception to use
SendMessage signals + Task metadata chain-read.
TeammateIdle hook detects specialist stalls by validating handoff
metadata before allowing idle. TaskCompleted hook validates handoff
quality on task completion. Both marked as needing empirical
validation. Register new hooks in hooks.json.
Replace subagent dispatch with Agent Teams model. Add three-channel
coordination model. Update task tracking for externalized state and
chain-read pattern. Retire ATOMIZE/CONSOLIDATE from workflow
description. Add Task-as-instruction dispatch model.
Add Agent Teams context to validate_handoff and memory_enforce
comments. Add Agent Teams patterns to transcript parser alongside
existing subagent patterns for backward compatibility.
Replace ATOMIZE/CONSOLIDATE references. Note that v3.0 uses single
branch per feature — per-scope worktrees are a v3.1 capability.
Replace ATOMIZE/CONSOLIDATE checks with scope verification protocol
checks. Add Agent Teams pattern validation. Remove per-scope
worktree checks (v3.0 single-branch model). Update extract
verification for new and retired protocol files.
Add Agent Teams pattern helpers and fixtures alongside existing
subagent patterns. 172 new tests covering SendMessage, TeamCreate,
TeamDelete, team_name dispatch, and workflow detection. All 1007
tests passing.
PACT v3.0: Agent Teams execution model with externalized state,
three-channel coordination, Task-as-instruction, and recursive
P→A→C→T at every level.
- teammate_idle.py: change exit 2 to exit 0 (safe no-op until empirical
  validation confirms TaskGet access from hooks)
- task_completed.py: remove dead HANDOFF_FIELDS constant, clarify
  placeholder status with explicit comments
- patterns.py: replace deprecated typing.Pattern with re.Pattern
- Add 24 unit tests for both Agent Teams hooks
TeamDelete was running before peer-review, preventing reviewer
teammates from being spawned into the team. Reorder so peer-review
runs first, then team cleanup. Fix mirrored in CLAUDE.md.
- Phase Handoffs: update from stale 3-item text to v3.0 structured
  5-item HANDOFF format stored as JSON in Task metadata
- pact-scope-contract.md: "Mini-Code phase" → "inner CODE phase",
  rePACT delivery "Synchronous" → "Sequential with Agent Teams"
- Sync SSOT with extract files, update verification line ranges
Strip inline TeamCreate/TeamDelete syntax from orchestrate.md and
rePACT.md. All 5 command files now reference CLAUDE.md Team Lifecycle
section for HOW, keeping only WHEN in the workflow flow.
- TASK_WITH_TEAM_PATTERN + TEAM_NAME_PATTERN: add re.IGNORECASE
- Hook docstrings: "settings.json" → "hooks.json"
- task_completed.py: add comment for QUARANTINE prefix
- pact-task-tracking SKILL.md: add fallback for team config path
- Normalize "orchestrator" → "lead" in operational contexts across
  commands and protocols. Keep "Orchestrator" in CLAUDE.md identity.
- Add metadata.assigner field to agent task metadata model.
  Agents discover their assigner via TaskGet chain-read pattern.
- Update bootstrap prompt template to reference metadata.assigner.
- Sync SSOT with all extract files, update verification line ranges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant