shutdownlisted
Install: claude install-skill rudi193-cmd/willow-2.0
@markdownai
# /shutdown — Willow 2.0 Graceful Close
Stack position: this skill is the **end-of-session persistence** layer — it absorbed the former `/handoff` skill, so the handoff write is step 2 of this sequence, not a separate skill. See the Persistent memory section in `willow.md` for the full 4-layer stack.
## Sequence
1. **Resolve open process flags** — call `soil_list(app_id, collection="{AGENT}/flags")` and filter for any
record where `flag_state` is `running`, `open`, or `awaiting authorization` and the `id`
starts with `process-`. For each one: check whether the process completed this session by
reading its log file (the flag's `note` field usually contains the log path) or checking
`pgrep`. If the process finished, close the flag with `soil_put` (`flag_state: complete`,
resolution note, elapsed time if known) **before** writing the handoff. If it is still
running, update the flag with current progress so the next session reads accurate state, not
the state from when the flag was first opened. A handoff with a stale open process flag is a
lie to the next session.
2. **Write the handoff** — this runs early by design: it is the one artifact that must survive
even if the session dies partway through the steps below.
a. **Load current state** — call `handoff_latest` to see prior open threads. The flag state
from step 1 must appear in the handoff. Do not rely on memory; read SOIL.
b. **Draft** — copy [`docs/templates/HANDOFF.