A

Autonomous Agents Agentic Workflow

Wipe Workspace — Autonomous Agents Agentic Workflow

Delete every folder in a workspace and clear the agent's local caches to free disk

Available free v1.32.0 Browser
$ sidebutton install agents
Download ZIP
ops

The hard reset of the housekeeping family. It empties the selected workspace (its entry path) — every folder goes, project repos included; the workspace's top-level files (AGENTS.md, CLAUDE.md, .mcp.json) stay — and then clears the agent-writable caches: everything under ~/.cache, npm's cache, the Chrome profile's cache folders, aged Claude Code session transcripts, and the agent's own /tmp leftovers.

Run it before repointing a workspace at a new project, after a workspace accumulated checkouts it no longer needs, or when disk pressure calls for more than a cache sweep. It is destructive by design: unpushed commits and uncommitted changes in the deleted repos are gone for good, and the repos return only when the portal re-applies the workspace's configured projects. Dispatch it only on a workspace whose work is pushed or disposable.

It never touches the agent's identity or shared infrastructure: ~/.agent-env and ~/.agent-env.d, ~/.sidebutton (registry clones, installed skills, job context), the Chrome profile and extension (logins live there — only Chrome's cache folders are cleared), and other workspaces on the VM all stay intact.

Steps

  1. 1.
    Open a terminal
    title
    Agent: Wipe Workspace
    cwd
    {{entry_path}}
    terminal.open
  2. 2.
    Run a terminal command
    cmd
    |
    terminal.run

Workflow definition

schema_version: 1
id: agent_wipe_workspace
title: "Wipe Workspace"
description: "Delete every folder in a workspace and clear the agent's local caches to free disk"
overview: |
  The hard reset of the housekeeping family. It empties the selected workspace (its entry path) — every folder goes, project repos included; the workspace's top-level files (AGENTS.md, CLAUDE.md, .mcp.json) stay — and then clears the agent-writable caches: everything under `~/.cache`, npm's cache, the Chrome profile's cache folders, aged Claude Code session transcripts, and the agent's own /tmp leftovers.

  Run it before repointing a workspace at a new project, after a workspace accumulated checkouts it no longer needs, or when disk pressure calls for more than a cache sweep. It is destructive by design: unpushed commits and uncommitted changes in the deleted repos are gone for good, and the repos return only when the portal re-applies the workspace's configured projects. Dispatch it only on a workspace whose work is pushed or disposable.

  It never touches the agent's identity or shared infrastructure: `~/.agent-env` and `~/.agent-env.d`, `~/.sidebutton` (registry clones, installed skills, job context), the Chrome profile and extension (logins live there — only Chrome's cache folders are cleared), and other workspaces on the VM all stay intact.

category:
  level: pipeline
  domain: engineering

metadata:
  agent: true
  role: ops

params:
  agentic_app:
    type: string
    default: "cc"
    description: "Agent-app slug selecting the per-run env file ~/.agent-env.d/<slug> (AAP-C); 'cc'/subscription clears provider vars"
  entry_path:
    type: string
    default: "~/workspace"
    description: "Workspace directory to wipe"

steps:
  - type: terminal.open
    title: "Agent: Wipe Workspace"
    cwd: "{{entry_path}}"
  - type: terminal.run
    cmd: |
      source ~/.agent-env
      # AAP-C (SCRUM-1506) + AAP-17 (SCRUM-1653): clear EVERY provider var an agent-app can deliver so
      # none hijacks/poisons a subscription run. A stray global ANTHROPIC_MODEL / ANTHROPIC_SMALL_FAST_MODEL
      # needs no CLAUDE_CODE_USE_* flag, so the old ${!CLAUDE_CODE_USE_@} glob never caught it — it survived
      # into the run and 404-ed aux/small-fast calls against api.anthropic.com. This explicit list mirrors
      # AGENT_APP_ENV_KEYS 1:1 (the-assistant website/src/lib/cloud/agent-app-env.ts — the single source of
      # truth; a parity test in each repo guards the two from drifting). Explicit over a glob: the union has
      # non-ANTHROPIC_ members (AWS_REGION, AWS_PROFILE, CLOUD_ML_REGION, CLAUDE_CODE_MAX_OUTPUT_TOKENS) and
      # a ${!AWS_@} glob would over-clear unrelated creds. Then source the per-run app env by slug when it
      # exists; no file => subscription/default. base/19-secrets stages ~/.agent-env.d/<slug>.
      unset \
        ANTHROPIC_API_KEY ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN CCR_CONFIG_B64 \
        CLAUDE_CODE_USE_BEDROCK AWS_REGION AWS_PROFILE ANTHROPIC_MODEL \
        ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION ANTHROPIC_SMALL_FAST_MODEL CLAUDE_CODE_MAX_OUTPUT_TOKENS \
        CLAUDE_CODE_USE_VERTEX CLOUD_ML_REGION ANTHROPIC_VERTEX_PROJECT_ID ANTHROPIC_VERTEX_BASE_URL \
        CLAUDE_CODE_USE_FOUNDRY ANTHROPIC_FOUNDRY_RESOURCE ANTHROPIC_FOUNDRY_BASE_URL \
        ANTHROPIC_DEFAULT_OPUS_MODEL ANTHROPIC_DEFAULT_SONNET_MODEL ANTHROPIC_DEFAULT_HAIKU_MODEL
      if [ -f "$HOME/.agent-env.d/{{agentic_app}}" ]; then
        source "$HOME/.agent-env.d/{{agentic_app}}"
      fi
      claude --dangerously-skip-permissions "$(cat <<'SB_PROMPT'
      the current directory is your workspace. wipe it and free disk space. first a sanity check: confirm the current directory is a workspace and not a home directory — if it contains .agent-env or .sidebutton, stop and report instead. then record disk usage (df -h /, du -sh of the workspace and ~/.cache). then delete every folder inside the workspace, visible and hidden, project repos included; the workspace's top-level files (AGENTS.md, CLAUDE.md, .mcp.json and any other loose files) stay. then clear your local caches: everything under ~/.cache; npm's ~/.npm/_cacache; the Chrome profile's cache folders (the Default profile's Cache, Code Cache and Service Worker/CacheStorage), keeping the profile itself (logins and the extension live there); Claude Code session transcripts older than 3 days under ~/.claude/projects plus ~/.claude/todos, keeping settings, memory and CLAUDE.md files; and your own /tmp leftovers (chrome crashpad, chromium, puppeteer dirs, your files older than a day). everything else — ~/.agent-env, ~/.agent-env.d, ~/.sidebutton, the Chrome profile, other workspaces — stays. report disk usage before and after, every folder you deleted from the workspace, and roughly how much each cache freed.
      DESTRUCTIVE BY DESIGN — emptying the workspace IS the deliverable, so unpushed commits, uncommitted edits and untracked files inside those folders are expected casualties and are never a reason to spare a folder, skip a step, or stop and report instead of deleting. The judgement about whether this workspace's work was disposable was made when the job was dispatched; do not re-take it here, and do not stash, commit, push, archive or relocate anything first. The ONE thing that stops this run is the sanity check above: a directory holding .agent-env or .sidebutton is not a workspace.
      UNATTENDED RUN — this is a dispatched job: nobody is watching this terminal and nobody will answer, so never call AskUserQuestion and never end your turn by putting a question to the operator. Apply the policy stated above and carry it out as written, including where carrying it out is destructive — the call to run this job was made when it was dispatched, and it is not yours to re-take. Where that policy leaves a genuine choice, make it yourself and keep going; only where it is genuinely SILENT, prefer the option that does not destroy work nobody can recreate. Say what you decided and what you skipped and why — but INSIDE the report this prompt already specifies: wherever a report shape, a token vocabulary or a last-line verdict is stated above, that format still binds exactly as written, and this clause adds no section, no token and nothing after the last line. Questions the deliverable is MEANT to contain are content, not an unanswered prompt. Asking does not pause the job either: an unanswered prompt is auto-answered from the option ordering once the unattended wait budget lapses (KAN-204), so asking only burns ~15 minutes of the run and hands a real decision to a default.
      SB_PROMPT
      )"