[FR] Add TeamCreated and TeamDeleted hooks for Agent Teams lifecycle

Resolved 💬 2 comments Opened Apr 2, 2026 by creepmane Closed May 11, 2026

Feature Request

Problem

When building platforms that orchestrate Claude Code Agent Teams, we need to detect when a team is created or deleted to synchronize state with an external system (dashboard, monitoring, CI/CD).

Currently, the only way to detect team creation is by polling ~/.claude/teams/ on the filesystem, which is fragile and has 3-5s latency. There's no hook to intercept TeamCreate or TeamDelete calls.

Proposed Solution

Add two new hook events:

TeamCreated
  • Fires: After TeamCreate tool successfully creates a team
  • Input: team_name, description, lead_agent_id, lead_session_id
  • Blocking: No (team already created)
  • Use case: Register the team in an external system, set up monitoring, associate with a project
TeamDeleted
  • Fires: When TeamDelete is called
  • Input: team_name
  • Blocking: Optional (could prevent deletion)
  • Use case: Cleanup external resources, archive team data

Alternatives Considered

  1. Filesystem polling (~/.claude/teams/): Works but adds 3-5s latency, fragile if file format changes
  2. PostToolUse hook on TeamCreate: PostToolUse doesn't fire for internal tools like TeamCreate — only for standard tools (Bash, Edit, etc.)
  3. Injecting team name via prompt: Instruct the lead to use a specific team name, but this is unreliable

Use Case

Multi-agent orchestration platforms that spawn Claude Code leads with --teammate-mode tmux. The leads create native Agent Teams. External systems need to track which team was created to display teammates and tasks in real-time.

Related issues:

  • #32723 (TeamCreate available to standalone subagents)
  • #32730 (Team configs persist after session ends)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗