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
sidebutton install agents 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. Open a terminal
- title
- Agent: Wipe Workspace
- cwd
- {{entry_path}}
terminal.open - 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.
SB_PROMPT
)"