Skip to main content
command CX Codex

team-shutdown — Claude Code command: shutdown and install

Stops an agent team, gathers final responses, and cleans up its resources. Use it when an active team needs a controlled shutdown.

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add wshobson/agents
/plugin install agent-teams@claude-code-workflows
Open on GitHub

What team-shutdown does

The command reads ~/.claude/teams/{team-name}/config.json and checks task state with TaskList. When work is still running, it lists those tasks and asks whether to continue, unless --force is used.

Each teammate receives a shutdown_request through SendMessage. The command waits for replies, prints a shutdown summary, and then calls TeamDelete. The --keep-tasks flag preserves the task directory at ~/.claude/tasks/{team-name}/; without it, team and task directories are removed.

What it helps with

  • shut down an active agent team
  • collect final replies from teammates
  • review unfinished tasks before shutdown
  • remove team resources after completion

Example prompts for the agent

  • Shut down the backend-team and wait for teammate responses.
  • Run /agent-teams:team-shutdown frontend-team --keep-tasks and preserve the task list.
  • Force-stop the active test-team with the --force flag.

How to install team-shutdown

1Plugin marketplace

/plugin marketplace add wshobson/agents
/plugin install agent-teams@claude-code-workflows

2Manually: put the files in place

.claude/commands/team-shutdown.md

Call it with /team-shutdown. For all projects use ~/.claude/commands/

Questions about team-shutdown

How do I install team-shutdown in Claude Code?

Add the marketplace with /plugin marketplace add wshobson/agents, install the plugin with /plugin install agent-teams@claude-code-workflows, then use .claude/commands/team-shutdown.md.

What does team-shutdown do?

It asks every teammate to finish, gathers their responses, reports task status, and removes the team resources.

What does --keep-tasks change?

It keeps the task list at ~/.claude/tasks/{team-name}/ after cleanup. Without this flag, the command calls TeamDelete.

Source text

team-shutdown.md · MIT
---
description: "Gracefully shut down an agent team, collect final results, and clean up resources"
argument-hint: "[team-name] [--force] [--keep-tasks]"
---

# Team Shutdown

Gracefully shut down an active agent team by sending shutdown requests to all teammates, collecting final results, and cleaning up team resources.

## Phase 1: Pre-Shutdown

1. Parse `$ARGUMENTS` for team name and flags:
   - If no team name, check for active teams (same discovery as team-status)
   - `--force`: skip waiting for graceful shutdown responses
   - `--keep-tasks`: preserve task list after cleanup

2. Read team config from `~/.claude/teams/{team-name}/config.json` using the Read tool
3. Call `TaskList` to check for in-progress tasks

4. If there are in-progress tasks and `--force` is not set:
   - Display warning: "Warning: {N} tasks are still in progress"
   - List the in-progress tasks
   - Ask user: "Proceed with shutdown? In-progress work may be lost."

## Phase 2: Graceful Shutdown

For each teammate in the team:

1. Use `SendMessage` with `type: "shutdown_request"` to request graceful shutdown
   - Include content: "Team shutdown requested. Please finish current work and save state."
2. Wait for shutdown responses
   - If teammate approves: mark as shut down
   - If teammate rejects: report to user with reason
   - If `--force`: don't wait for responses

## Phase 3: Cleanup

1. Display shutdown summary:

   ```
   Team "{team-name}" shutdown complete.

   Members shut down: {N}/{total}
   Tasks completed: {completed}/{total}
   Tasks remaining: {remaining}
   ```

2. Unless `--keep-tasks` is set, call `TeamDelete` to remove team and task directories

3. If `--keep-tasks` is set, inform user: "Task list preserved at ~/.claude/tasks/{team-name}/"

© Seth Hobson · MIT · wshobson/agents

Similar slash commands

All slash commands for Agent setup: memory, context, orchestration →

From the same set405

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor