Skip to content

feat(cmd): add grut clean to remove transient session and diagnostic data#345

Open
jongio wants to merge 1 commit into
mainfrom
idea/clean-command
Open

feat(cmd): add grut clean to remove transient session and diagnostic data#345
jongio wants to merge 1 commit into
mainfrom
idea/clean-command

Conversation

@jongio

@jongio jongio commented Jul 19, 2026

Copy link
Copy Markdown
Owner

What

Add a grut clean command that removes grut's transient data: saved session
state (DataDir/sessions) and watchdog diagnostic logs (DataDir/diagnostics).

Why

These directories grow over time and there was no built-in way to reclaim the
space. You had to find the data dir and delete subdirectories by hand.

Behavior

  • grut clean (default): preview mode. Lists each target, its size, and the
    full path, plus the total space that would be reclaimed. Deletes nothing.
  • grut clean --force: deletes the targets and prints the reclaimed size.
  • Missing targets are reported as not present and skipped, so running on a
    fresh machine is a safe no-op.

What it never touches

  • config.toml
  • extensions/ (user-installed)
  • crashes/ (use grut report --clear)
  • mcp-audit.log
  • the first-run marker

Testing

  • go build ./...
  • go test ./cmd/... (8 new tests: preview, force, exclude preservation,
    missing dirs, arg rejection, registration, dir sizing, byte humanizing)
  • go vet ./..., mage lint (0 issues), mage deadcode (OK), gofumpt clean
  • Manual smoke test: preview is non-destructive, --force removes both
    targets, second --force run is idempotent.

Closes #342

…c data

grut accumulates saved session state under DataDir/sessions and watchdog
diagnostic logs under DataDir/diagnostics over time, with no built-in way to
reclaim that space short of deleting directories by hand.

Add a `grut clean` command. Without --force it previews each target, its size,
and the total space it would reclaim. With --force it deletes them. Missing
targets are reported and skipped, so running on a fresh machine is a no-op.

clean deliberately leaves alone anything that isn't regenerable cache: the
config file, installed extensions, crash reports (owned by `grut report
--clear`), the MCP audit log, and the first-run marker.

Closes #342

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 07f6eb49-d72f-4f2a-9285-065b5d835f5b
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 19, 2026
@jongio jongio self-assigned this Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a grut clean command to clear transient data

1 participant