Skip to content

compozy session cleanup

Delete archived sessions in bulk, in the background

574 pages in CLI Reference

On this page7

Usage

compozy session cleanup [flags]

Subcommands2

Examples4

  1. Preview what a cleanup of the current workspace would delete

    compozy session cleanup
  2. Delete every thread archived more than 30 days ago, across all workspaces

    compozy session cleanup --older-than 30 --all-workspaces --yes
  3. Keep main sessions; delete only their archived subagents

    compozy session cleanup --subagents --any-time --yes
  4. Follow or stop the running cleanup

    Terminal
    compozy session cleanup status
    compozy session cleanup stop

Options11

--all-workspaces
Clean up every project and User scope
--any-time
Pick every archived thread, whenever it was archived
--beforestring
Pick threads archived before this date: YYYY-MM-DD (local midnight) or RFC 3339
--children
Delete archived child sessions, keeping main sessions
--everything
Delete picked threads whole: main sessions, child sessions, and subagents (the default)
--help-h
help for cleanup
--older-thanint
Pick threads archived more than this many days ago (default 7)
--sessionstrings
Limit the cleanup to these archived main sessions, as a retry of failed threads does
--subagents
Delete archived subagents, keeping main sessions
--workspacestring
Workspace ID, name, or path (defaults to the current workspace)
--yes
Delete; without it the command only previews

Inherited options3

--json
Emit JSON output
--output-ostring
Output format: human, json, jsonl, or toon (default "human")
--profilestring
Act as a profile for this command

Synopsis

Plan a cleanup of the profile's archived sessions and, with --yes, delete them in the daemon's background. Without --yes it only previews what would go. Only archived sessions are deleted: child sessions still in the session list or in Later stay, with everything under them. Worktrees stay, as with a single delete. By default it picks threads archived more than 7 days ago in the current workspace and deletes them whole.

Output Formats

The root -o, --output flag accepts these values. A renderer is supported only when this command writes that result; jsonl is for commands that emit one JSON record per line.

FormatCommand result
humanInteractive terminal rendering
jsonMachine-readable JSON rendering
jsonlOne JSON record per line when supported
toonCompact agent-readable rendering

Example:

compozy session cleanup -o json