# WAKE-EMIT-ANCHOR plan — v0.24.0

> JIT plan (AGENTS.md discipline). Scope: the wake EMIT flip (stage 2 of the staged rename,
> REQ-WAKE-RENAME-STAGED said "the emit flips next release") + the win32 live-anchor fix
> (REQ-LIVE-ANCHOR-WIN32, gaki-n field report 2026-07-16). Gate: build + cargo test +
> `traceable-reqs check` + run-gates green, then the release runbook spine.

## Scope

1. **Wake emit flip** (mint REQ-WAKE-EMIT-FLIP, activate impl+unit):
   - `hook.rs wake_arm_payload` emits `{"wake_arm":"v1"[,"directive":…]}` (was legacy
     `{"checkpoint":"v1"[,"wake":…]}`).
   - `hook.rs wake_fire_payload` emits `{"wake_fire":"v1"}` (was `{"checkpoint_fire":"v1"}`).
   - RECEIVE side keeps BOTH generations this release (translate.rs unchanged); legacy
     envelope + `!!checkpoint!!` marker acceptance retires the release AFTER (needs one full
     release where every resident translate is post-rename).
   - Units updated to assert the NEW wire; receive-both units keep feeding legacy shapes.

2. **Win32 live anchor** (activate REQ-LIVE-ANCHOR-WIN32 impl+unit):
   - SessionStart self-resolves the REAL claude host winpid on win32: kernel32 toolhelp
     snapshot (hand-rolled FFI — the crate stays dependency-light, serde_json only; a
     PowerShell shell-out would reintroduce the interpreter-on-PATH hazard the crate exists
     to avoid). Walk own pid → parent chain, first ancestor whose exe basename matches the
     manifest's `host_binaries` ("claude") wins.
   - Resolution order (win32): toolhelp walk → plausible dispatch `--host-pid` → omit (loud).
     Unix keeps dispatch `--host-pid` (real `$PPID`, never the msys artifact).
   - Both consumers heal: the SessionStart seed `--pid` AND the `SPT_HOST_PID` export.
   - Pure walk logic split from the FFI snapshot for unit tests.
   - `live.md` relay step becomes CHECK-THEN-RUN: the empty/bogus anchor check moves ABOVE
     the command block with the proc-walk as the explicit else-branch — an agent never runs
     the chain with an empty `--pid` (gaki-n's exit 2).

## Open design questions

- None blocking. Walk-fails-AND-host-pid-bogus → omit + loud log (existing degrade path,
  live.md fallback covers the agent).

## Tasks

1. traceable-reqs: mint REQ-WAKE-EMIT-FLIP; activate REQ-LIVE-ANCHOR-WIN32.
2. hook.rs: emit flip + payload/units; win32 anchor resolution + units; comment catch-up.
3. adapter/strings/skills/live.md: check-then-run restructure.
4. Version 0.24.0 + CHANGELOG + manifest version-history comment.
5. Gates: cargo test · run-gates.sh · traceable-reqs check.
6. Release runbook spine: parked-work check → tag → build both triples → package →
   gh release on the private home → node update + acceptance (live across-commune cycle
   proves the flipped emit end-to-end) → mirror snapshot.

## Non-goals

- Retiring legacy RECEIVE acceptance (next release, not this one).
- cplugs skeleton bump (no structural plugin change).
- min_spt_core bump (no new core seam).
