HigorAlves/orc / codex/orc/content/skills/phases
phases
VerifiedPer-phase playbooks for orc commands, loaded one phase at a time
references/flow/PHASE-9-CLEANUP.md
View on GitHub<!-- orc-flow/P9 -->
# $orc-flow — Phase 9-CLEANUP
_Loaded on demand via orc-phases. Do not run this phase from memory — this file is the phase._
After merge in GitHub, the user re-invokes `$orc-flow` and orc detects `gh pr view <ref> --json state` returns `merged`. Run `orc-state close --merged` at once, BEFORE the cleanup-plan gate: a user who skips cleanup still gets a completed session. Then run `$orc-cleanup` logic for this session:
- Tear down the Docker environment if `docker-env-state.json` exists (execute its `teardownCommand` BEFORE removing state — the state file holds the command; volumes kept unless `--down-volumes`)
- Remove `.orc/<branch>/`
- Remove worktree (if clean)
- Remove local branch (if merged)
- Update central registry
In workspace mode, cleanup runs only when **every** PR in `linkedPRs` is merged (use `gh pr view` per URL). When some are merged and others are still open, surface that list and `the available user-question tool (or ask in chat)`: wait, clean per-repo (using `--per-repo`), or abort. After all merge, clean each repo's worktree + per-repo `.orc/<branch>/` AND the workspace-level `<workspaceRoot>/.orc/<branch>/` together.
```
the available user-question tool (or ask in chat) (preview the cleanup plan):
- Apply as shown
- Edit (skip individual items)
- Skip cleanup — keep state for now
- Abort cleanup
```
Before the cleanup plan runs, offer the retro — a soft-inward gate (`orc-gates` §6: auto-advances to *skip* under `guided`/`full`, asks under `manual`): **Run `$orc-retro` on this session first?** The retro reads `.orc/<branch>/files/` (usage ledger, slice history, escalations), which cleanup is about to delete, so it has to come first. On yes, run `$orc-retro --session <branch>` and return here when it closes.
After cleanup: echo a summary. The session is already closed; `orc-state close --merged` is the only step that completes it.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |