| name | nsw-workspace-cleanup |
| description | Build evidence-backed cleanup instructions for Nintendo Switch localization workspaces shared by Ryubing MCP and Eden MCP. Use when title work trees, emulator sessions, patches, captures, logs, or duplicate artifacts need pruning based on HANDOFF.md, handoff notes, WORK_LOG.md, session manifests, active process state, and cross-emulator ownership without deleting files from filename heuristics alone. |
NSW workspace cleanup
Generate a reviewed cleanup plan for Ryubing and Eden together. Do not infer
ownership or deletion eligibility from names such as tmp, copy, session,
old, or a timestamp. Treat handoff history and emulator ownership manifests as
the primary evidence.
Read references/handoff-classification.md
before classifying any artifact or session.
Establish scope
- Resolve each repository root, title root, project root, Ryubing session root,
and Eden session root to a literal absolute path.
- Locate the relevant
HANDOFF.md, handoff/**/*.md, and title-local
WORK_LOG.md files. Read every selected handoff document completely.
- Record the exact title/application ID and project ID. Stop on cross-title or
cross-project contradictions.
- Query both MCPs for live sessions and artifacts when their tools are
available. Treat filesystem manifests as persisted evidence, not proof that a
process is inactive.
Build a deterministic evidence snapshot
Run the bundled read-only collector with every relevant root. Repeat flags as
needed:
node .\scripts\build-cleanup-context.mjs `
--root "E:\NSW\_titles\Title [0100000000000000]" `
--handoff "D:\workspace\____personal____\ryubing-mcp\HANDOFF.md" `
--handoff "D:\workspace\____personal____\eden-mcp\HANDOFF.md" `
--session-root "ryubing=E:\NSW\_tools\Ryubing\mcp-bridge-v0.1.0\sessions" `
--session-root "eden=E:\NSW\_tools\Eden\mcp-v0.4.0\sessions" `
--json
The collector never writes or deletes files. It inventories bounded metadata,
indexes handoff references and status cues, validates Ryubing/Eden ownership
manifests, checks recorded PIDs, and reports duplicate hashes for review. If the
snapshot is truncated or has no handoff documents, do not issue removal steps.
Infer the current artifact chain
- Reconstruct each title's progression in chronological and dependency order:
source -> candidate -> static QA -> emulator staging -> runtime evidence ->
user review -> release.
- Correlate exact paths, hashes, title IDs, session IDs, patch names, and capture
paths across both emulators. A reference from either emulator protects the
artifact until its downstream purpose is resolved.
- Distinguish current/final artifacts from failed-but-still-diagnostic evidence.
FAIL, BLOCKED, and PENDING do not mean disposable.
- Mark an artifact eligible only when the handoff explicitly supersedes or
retires it, an exact replacement is preserved, no open investigation depends
on it, and it is not active or the sole evidence for a claim.
- Treat unreferenced and duplicate artifacts as
REVIEW, never as automatic
deletion candidates.
Generate cleanup instructions
Return a cleanup-plan.v1 document containing:
- evidence snapshot ID and all handoff document hashes;
- exact title/project/emulator scope;
KEEP, REVIEW, and ELIGIBLE_AFTER_APPROVAL tables;
- one instruction ID per exact path or MCP-owned session;
- evidence lines and hashes supporting each classification;
- required preconditions, action mechanism, and post-action verification;
- unresolved contradictions and a
BLOCKED verdict where applicable.
Do not use globs or broad recursive commands in an instruction. Prefer the
Ryubing/Eden MCP retention tools for MCP-owned sessions and diagnostic bundles.
For title artifacts, stop after producing the plan unless the user separately
approves the exact instruction IDs. Rebuild the evidence snapshot immediately
before any approved deletion and cancel the action if its snapshot ID, path,
hash, manifest, PID state, or handoff status changed.
Verify after an approved cleanup
Re-run the collector with the same arguments. Confirm that only approved exact
targets disappeared, retained hashes still match, active patch/session paths are
unchanged, and both emulator handoffs remain internally consistent. Append to an
existing canonical work log instead of creating timestamped duplicates.