Skip to content

feat: PACT v3.0 — Agent Teams integration#162

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

feat: PACT v3.0 — Agent Teams integration#162
michael-wojcik wants to merge 28 commits intomainfrom
feature/v3-agent-teams

Conversation

@michael-wojcik
Copy link
Collaborator

Summary

Replace the subagent execution model with Agent Teams as THE execution model for all PACT workflows.

Key changes across 57 files (9 implementation waves):

  • Wave 1: Rewrite pact-task-tracking skill for teammate self-management (TaskUpdate, TaskList, TaskCreate)
  • Wave 2: Rewrite all 5 command files (orchestrate, comPACT, imPACT, peer-review, plan-mode) for teammate spawning via Task(team_name=..., name=...) and SendMessage-based communication
  • Wave 3: Remove rePACT command (fully retired — Agent Teams handles sub-scope execution)
  • Wave 4: Rewrite CLAUDE.md orchestration section — Team Lifecycle, teammate spawning, plan approval workflow, shutdown protocol
  • Wave 5: Update 7 protocol files — algedonic dual-delivery HALT, teammate stall detection, scoped phases, task hierarchy, scope contracts
  • Wave 6: Update 12 hook files — session_init TeamCreate instruction, stop_audit team state, compaction_refresh team context, new team_utils.py shared module, refresh system team patterns
  • Wave 7: Update 8 agent definitions — replace duplicated HANDOFF/BLOCKER sections with skill references, update communication terminology
  • Wave 8: Update Python tests — 80+ new test cases, 963 total tests passing, new test_team_utils.py
  • Wave 9: Update README, create verify-agent-teams.sh (54 checks), update 4 existing verification scripts, update integration test scenarios, version bump to 3.0.0

Verification: 1139 total checks passing (176 verification script checks + 963 pytest)

Test plan

  • All 963 Python tests pass (python -m pytest tests/ -v)
  • verify-agent-teams.sh: 54/54 checks pass
  • verify-protocol-extracts.sh: 16/16 checks pass
  • verify-task-hierarchy.sh: 21/21 checks pass
  • verify-scope-integrity.sh: 65/65 checks pass
  • verify-worktree-protocol.sh: 20/20 checks pass
  • Manual: Standard orchestration scenario (testing/scenario-standard-orchestration.md)
  • Manual: Scoped orchestration scenario (testing/scenario-scoped-orchestration.md)
  • Manual: Canary checklist (testing/canary-checklist.md)

Replace the subagent text-based reporting model with Agent Teams
SendMessage-based communication and Task tool self-management.

10 sections: task self-management, progress reporting, blocker
delivery, algedonic signals (dual-delivery HALT + direct ALERT),
pre-completion self-validation, memory preservation, HANDOFF
format/delivery, peer communication guidance, plan approval workflow.
Replace subagent dispatch with teammate spawning pattern. Add Team
Lifecycle, Plan Approval workflow, SendMessage-based monitoring,
teammate shutdown between phases, and HALT signal handling for
concurrent teammates.
comPACT: Replace subagent dispatch with teammate spawning into session
team. Add Plan Approval, shutdown pattern, peer-review team reuse.
imPACT: Remove rePACT references, update terminology to teammate model,
use SendMessage for blocker reporting.
peer-review: Spawn reviewer teammates with SendMessage-based review
delivery, plan_mode_required for all reviewers, structured shutdown.
plan-mode: Spawn consultant teammates in planning-only mode with
SendMessage-based perspective collection and plan approval workflow.
Delete commands/rePACT.md and remove its entry from plugin.json.
rePACT functionality replaced by recursive /PACT:orchestrate calls.
Replace 'Always Run Agents in Background' with Team Lifecycle (spawning,
Plan Approval, shutdown). Update Agent Task Tracking for teammate
self-management. Remove rePACT from command list. Update PR Review
Workflow for teammate reviewers with SendMessage delivery.
Rewrite 5 protocol files for SendMessage-based communication:
- algedonic.md: dual-delivery HALT, teammate signal delivery
- pact-scope-contract.md: Agent Teams as sole executor
- pact-scope-phases.md: teammate spawning in ATOMIZE/CONSOLIDATE
- pact-agent-stall.md: teammate stall detection with SendMessage
- pact-task-hierarchy.md: teammate self-managed tasks
Replace subagent/background references with teammate terminology
in pact-protocols.md and pact-workflows.md extract files.
Replace subagent references with teammate communication patterns.
HANDOFF/BLOCKER delivery now via SendMessage to team lead.
Skill references replace duplicated format definitions.
Add team_utils.py shared module with derive_team_name, team_exists,
get_team_members, and find_active_teams. Update session_init to output
TeamCreate instruction, stop_audit to audit team state, and
compaction_refresh to include team context in recovery messages.
Add team interaction patterns (TEAM_NAME, SEND_MESSAGE, TEAM_CREATE,
TEAM_DELETE) to refresh/patterns.py. Add has_send_message(),
has_team_create(), find_send_messages() to transcript_parser.py.
Update workflow_detector confidence with team interaction counting.
Add teammate naming conventions and tool names to constants. Update
checkpoint_builder with _get_team_context(). Update validate_handoff
and memory_enforce docstrings for teammate terminology.
Add test_team_utils.py with 44 tests covering all team_utils functions.
Add 80+ new test cases across 9 files for Agent Teams patterns, transcript
parser methods (has_send_message, has_team_create, find_send_messages),
workflow detector team interactions, compaction refresh team context,
and pattern fuzz tests. Fix 4 pre-existing test failures (assertion text
changes in test_task_integration, environmental mock gaps in test_staleness).
All 963 tests pass.
Update four SSOT sections (Task Hierarchy, Teammate Stall Detection,
Scope Contract, Scoped Phases) to match their protocol extract files
that were updated in earlier waves.
Update README with Agent Teams prerequisites, v3.0 features, and
7 commands (rePACT removed). Update integration test scenarios and
canary checklist with teammate spawning, SendMessage handoffs,
plan approval, and shutdown patterns.
Create verify-agent-teams.sh with 54 checks across 13 sections.
Update 4 existing verification scripts to remove rePACT references
and add Agent Teams equivalents. Bump version to 3.0.0 in both
plugin.json and marketplace.json. All 176 checks pass across 5 scripts.
The correct Agent Teams API parameter is mode="plan", not
plan_mode_required. Fix 12 references across 5 files: peer-review.md,
comPACT.md, plan-mode.md, orchestrate.md, and SKILL.md.
Replace all rePACT references with Agent Teams equivalents across 5
protocol files and SSOT. rePACT sub-scope execution is now handled
by teammate spawning via ATOMIZE phase. Update workflow family table
to 4 workflows. Update verify-protocol-extracts.sh line ranges.
Add docstring to TEAMMATE_NAME_PATTERN noting it matches any JSON
"name" field (M2). Add comment to _team_instruction about storage
path assumption and graceful fallback (M3). Align team member
overflow formatting between compaction_refresh and stop_audit (M6).
Add test_session_init.py (14 tests for _team_instruction branches),
test_stop_audit.py (25 tests for audit_tasks and audit_team_state),
and 15 tests in test_checkpoint_builder.py for _get_team_context and
team context rendering. Fix test_multiple_teams assertion to match
M6 formatting change. Total: 1017 tests passing.
Replace deprecated typing.Pattern with re.Pattern in patterns.py (F2).
Remove unused TEAMMATE_NAME_CONVENTION, TEAM_TOOL_NAMES, and
SEND_MESSAGE_TYPES constants (F3-F4). Add TeamDelete cleanup
instruction to stop_audit.py per brainstorm Decision 11 (F6).
Update related tests. 1014 tests passing.
Add create_orchestrate_with_teams_transcript() factory to helpers.py
and conftest.py. Add 6 E2E tests covering full pipeline with TeamCreate,
SendMessage, and Task team_name patterns: PreCompact→SessionStart flow,
confidence scoring with team interactions, SendMessage parsing,
TeamCreate detection, team interaction counting, and terminated
workflow handling. 1020 tests passing.
…essage handoffs

Address 3 gaps found during plan-vs-implementation assessment:
- Add Delegate Mode (Shift+Tab) as optional recommendation in README Prerequisites
- Add peer communication via SendMessage section to pact-s2-coordination.md
- Add SendMessage delivery mechanism to pact-phase-transitions.md
- Sync both protocol changes to pact-protocols.md SSOT
- Fix stale line ranges in verify-protocol-extracts.sh
Replace ASCII downgrades introduced during Wave 2B/2C rewrites:
- Tree diagrams: +--/|-- → └──/├──/│
- Em dashes: -- → —
- Arrows: -> → →

Aligns comPACT, peer-review, plan-mode, and imPACT with the
Unicode conventions used in orchestrate.md and protocol files.
Remove SendMessage API examples, Task tool parameter lists, and
platform workflow descriptions that duplicate what agents already
know from their tool definitions. Keep only PACT-specific guidance
(review criteria, timing conventions, message formats).

Reduces context window consumption by ~158 lines across 9 files.
The v3 rewrite replaced '## On Start' with '## Task Self-Management'
but the test wasn't updated alongside the change, causing a persistent
test failure.
Lead assigns tasks when spawning teammates — that's the default.
Self-claiming from TaskList is the exception for batch scenarios
(multiple teammates sharing a pool of tasks in the same domain).
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

Comments