Clean re-setup
Inventory and remove everything Orchemax or a wired agent left in a workspace, then re-seed it from a known state — or uninstall Orchemax entirely.
Goal#
Over time a workshop accumulates state: .orch/ grows, dispatch worktrees
and logs pile up, and an agent can leave a scratch dot-directory or a stray
report file outside .sandbox/<seat>/. orch workspace clean inventories
all of it — grouped by who owns it — before anything is touched, and only
--apply ever deletes. This page also covers orch uninstall, for when you
want Orchemax gone from a workspace (or a machine) altogether.
1. Inventory first#
orch workspace clean --dry-run
(Bare orch workspace clean does the same thing — dry-run is the default;
nothing is ever deleted without --apply.) It walks the workspace root and
every registered project/shared root and prints four groups:
orch-regenerated— everythingorch init/orch setup/orch project add/orch guard wirerecreate on the next run: most of.orch/, theAGENTS.mddigest block,GEMINI.md/.github/copilot-instructions.md/.cursor/rules/orch*.mdcpointer files,.mcp.json/.cursor/mcp.json, the Orchemax-owned.cursor/hooks.jsonand.claude/settings.local.jsonhook entries (or the legacy.claude/settings.json, for a workspace that has not re-wired since the block moved),.sandbox/README.md, and the sealedorch-chair/orch-worker/orch-clarify/orch-recallskill folders.orch-runtime— per-run scratch: dispatch worktrees,.orch-agent-*.log,.orch-run.cmd, supervisor state, and everything under.sandbox/<seat>/except itsREADME.md.- agent-litter — what the litter guard (see
Hooks and guards) would have denied had it seen
the write: a dot-directory or a scratch/report-shaped file an agent left
outside
.sandbox/<seat>/or the docs folder. This also catches the literalnul/con/aux/prn/com1..9/lpt1..9files a bash> nulredirect leaves behind on Windows — Explorer cannot delete these (the OS intercepts the plain name), so--applymoves or purges them through the\\?\extended-length path instead. By hand, from Git Bash:rm -f ./nul. - yours-keep — never a valid
--group:orch.db,.orch/gates/user/,.orch/packs/.--applyrefuses this group outright.
Only Orchemax-touchable or litter-shaped paths are listed — ordinary project
files are never enumerated. Add --json to script against the same
structure.
A shared file that also carries your own content (AGENTS.md,
.claude/settings.local.json) is never deleted outright: only Orchemax's own
marked slice is stripped, and a snapshot of the file is still taken first.
2. Apply#
orch workspace clean --apply --group agent-litter --group orch-runtime --group orch-regenerated
Prints exactly what would move, then asks Move N item(s) in group(s) …? [y/N] (--yes to skip the prompt in a script). Matched paths move to
<workspace>/.orch/trash/<timestamp>/, preserving their relative layout, so
nothing is destroyed by mistake — pass --purge to hard-delete instead.
3. Re-seed#
orch init --yes
orch setup --yes --project <path> # per project, if you use per-project setup
init/setup regenerate every orch-regenerated path from live config —
that's the whole point of the split above.
4. What each project gets#
.sandbox/— a seat's own scratch lives at.sandbox/<seat>/, swept by the reaper afterguard.sandbox_days(default 14). Nothing an agent writes there is ever litter.AGENTS.md+ per-CLI pointers (GEMINI.md,.github/copilot-instructions.md,.cursor/rules/orch.mdc, the@AGENTS.mdinclude inCLAUDE.md) so every wired CLI reads the same workspace digest.- Gates (
.orch/gates/README.md+basics/manifest.json) and your own overrides in.orch/gates/user/— never touched by clean or re-seed. - The litter guard, on by default: an agent may read project code freely;
anything it writes that is not project code belongs in
.sandbox/<seat>/or the docs folder.
5. Acceptance check#
orch harness scan
orch guard litter --count
harness scan confirms every wired CLI still resolves its AGENTS.md
pointer and hooks; guard litter --count reports 0 hits against git's
current changed-file set.
Uninstall#
orch uninstall goes further than clean: it removes Orchemax from a workspace
(or, with --scope user, from the machine) rather than just re-seeding it.
--dry-run by default; nothing is deleted without an explicit yes.
Workspace scope (default)#
orch uninstall --dry-run
orch uninstall --yes
Two steps, two separate confirmations (--yes answers both):
- Deletes
orch-regenerated+orch-runtime+agent-litter— the same three groupsworkspace clean --applywould. - With a second, explicit confirmation, also relocates
orch.yamland the rest of.orch/— including.orch/gates/user/,.orch/packs/andorch.db— into<workspace>/orch-uninstall-<timestamp>/. Nothing here is ever hard-deleted (--purgeopts into that instead): a "yours-keep" path is moved, never destroyed, precisely so it can be recovered.
The output names the recovery folder and lists every "yours-keep" path it preserved there.
User scope#
orch uninstall --scope user --allow-user-scope
Removes only what Orchemax itself ever wrote outside a workspace:
~/.claude/settings.json (Orchemax's own marked hooks and its mcpServers.orch
entry — nothing else in that file), ~/.claude/orch-mcp.json,
~/.cursor/mcp.json's mcpServers.orch entry, the home skill trios
(.claude/.cursor/.commandcode/.config/opencode skills/orch-*),
agy's global MCP entry, the OpenCode plugin plus its opencode.json
provider.orchemax block, and the User environment variables a consented
wire set (ORCH_GATEWAY_KEY, OPENCODE_DISABLE_MOUSE). It never touches a
file it did not write into, and ~/.claude/settings.json is backed up
(.bak-<yyyymmdd-hhmmss>) before it is rewritten.
Interactively it lists every file it is about to touch and asks once;
--allow-user-scope is required non-interactively
(mirrors orch guard wire --scope user) — --yes alone never grants user scope.
Related#
- Hooks and guards — the litter guard and gate
profiles
workspace clean's inventory is built on. - Organize a workshop —
init/setup/project add, the commands that re-seed what clean removes. - Worktrees — what a dispatch worktree is, the
orch-runtimegroup's biggest occupant.