CLI commands
ak projects prune
Remove stale project registry entries
ak projects prune
Remove stale project registry entries
Synopsis
What it does: Remove entries from ~/.agentkit/projects.json that no longer correspond to a directory on disk (orphans). Default is dry-run - pass --yes to actually prune. Use --all --force --yes to wipe the entire registry.
Who it's for: Power devs who need to clean up stale registry entries after moving or deleting projects.
When to use it:
ak doctor reports orphaned registry entries and suggests ak projects prune --orphans.
Examples: ak projects prune --orphans # dry-run: preview orphans ak projects prune --orphans --yes # remove orphan entries ak projects prune --orphans --yes --json # machine-readable output ak projects prune --all --force --yes # wipe entire registry
What changes on disk: Writes ~/.agentkit/projects.json atomically (removes matched entries). No-op in dry-run mode.
Output modes: pretty default on TTY (colors, ASCII markers) plain auto when stdout piped or --no-interactive json --json (single-object envelope, NDJSON-safe)
Exit codes: 0 success 1 runtime error 2 invalid flags 3 user-cancel (SIGINT, prompt-cancel)
ak projects prune [flags]Options
--all Remove every registry entry (requires --force and --yes)
--dry-run Preview what would be removed without modifying the registry
--force Required safety gate when using --all
-h, --help help for prune
--json Emit machine-readable JSON (implies --no-interactive)
--no-interactive Disable interactive prompts (CI-safe)
--orphans Remove entries whose project directory no longer exists on disk
-q, --quiet Suppress non-error output on stderr
-V, --verbose Extra diagnostic output on stderr (loses to --quiet)
-y, --yes Assume yes for all promptsSEE ALSO
- ak projects - Manage the global AK project registry