cleanup-ephemeralslisted
Install: claude install-skill produtoramaxvision/maxvision
# Cleanup ephemerals
Argument: `$ARGUMENTS` — `[--scope=user|project] [--dry-run] [--force-all] [--skip-agents]`
> **When called by the SessionEnd hook**, no confirmation is shown — the script
> just runs and appends a JSON report to the session log. When called by the
> user, the helper's `--dry-run` flag lets you preview safely first.
## Workflow
### 1. Pre-flight
Verify `${CLAUDE_PLUGIN_ROOT}/scripts/cleanup_ephemerals.py` exists. If it does
not, abort with exit 1 — the plugin install is corrupt.
### 2. Run the sweep
```bash
set -euo pipefail
python "${CLAUDE_PLUGIN_ROOT}/scripts/cleanup_ephemerals.py" $ARGUMENTS
```
By default the helper walks BOTH locations:
- `~/.claude/skills/<name>/.maxvision-source.json` (nested skill sidecars)
- `~/.claude/agents/.maxvision-source-<name>.json` (flat agent sidecars)
Each child entry is classified by reading its sidecar:
| Sidecar state | Decision | Result bucket |
| --- | --- | --- |
| missing | SKIP — orphan, cannot decide | `skipped_no_sidecar` |
| name starts with `maxvision-` | SKIP — synthesized, own re-synthesis flow | `skipped_maxv` |
| name fails `^[a-zA-Z][a-zA-Z0-9_-]*$` regex (agents only, WR-05) | error recorded, sweep continues | `errors` |
| `$schema_version` = `1.0.0`, **kind = "agent"**, no `ephemeral` (WR-04, v1.1.7+) | auto-migrate → treat as ephemeral=true | follows ephemeral branch below |
| `$schema_version` = `1.0.0` (skill or unknown kind), no `ephemeral` | KEEP — backward compat | `kept_permanent` |