Agent Teams: TaskUpdate metadata does not persist to disk for background agents

Resolved 💬 2 comments Opened Feb 22, 2026 by michael-wojcik Closed Mar 22, 2026

Problem

When an agent is spawned with run_in_background=true and team_name (Agent Teams mode), calls to TaskUpdate(taskId, metadata={...}) do not persist the metadata to the task JSON file on disk.

The task file at ~/.claude/tasks/{team_name}/{taskId}.json retains only the original fields (id, subject, description, activeForm, status, blocks, blockedBy, owner) with no metadata key added after multiple TaskUpdate calls.

This breaks any hooks or workflows that read task metadata from disk (e.g., a hook that checks for required metadata before allowing task completion).

Reproduction

  1. Create a team and task
  2. Spawn a background agent: Task(name="bg-test", team_name="test", subagent_type="general-purpose", run_in_background=true, prompt="...")
  3. Agent calls TaskUpdate(taskId, status="in_progress", metadata={"key": "value"})
  4. Check file: cat ~/.claude/tasks/test/{taskId}.json — no metadata field present

Expected Behavior

TaskUpdate metadata should persist to the task JSON file regardless of whether the agent runs in foreground or background.

Environment

  • Claude Code CLI (terminal mode)
  • macOS Darwin 25.4.0
  • Agent Teams enabled

View original on GitHub ↗

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