Skip to content

session-flow/workflow: end-of-phase continuation router (continue / clear / handoff / subagent / compact) #1476

Description

@kyle-sexton

Goal

session-flow:workflow already answers "what stage comes next"; add the missing router for "which continuation mechanism" at end of phase. Inspired by Matt Pocock's decision tree (x.com/mattpocockuk/status/2079879414297330146, 2026-07-22) — adapted, not copied; the sweep audit tightened what that must mean (below).

Outcome set — derive, don't inherit (sweep amendment 2026-07-26)

The first draft of this issue locked Pocock's five outcomes in his order — inheritance, not the promised re-derivation. Before implementation:

  1. Derive the outcome set from the continuation mechanisms session-flow actually installs — including lanes his tree does not model: clean-stop (machine going away), reconcile/orient, background delegation, plus the built-ins (/clear, /compact).
  2. Diff against his five; keep what survives on merit; add what our topology has and his lacks.
  3. State the purpose behind each retained ordering edge — e.g. why disposable-context check precedes handoff (cheapest exit first), why compact is last (a model-written lossy summary produced at the least-intelligent point of the session — evidence now in context-guard: zone-crossing hooks (advisory/enforcing) + window-class token bands #1475's research); drop any edge whose only support is that the source diagram drew it.

Draft sequence to start from (zone-informed via the context-guard seam, presence-gated, conservative on unknown/absent):

  1. Enough smart zone left, or task simple enough for degraded context? → continue in session.
  2. Session context disposable? → /clear — cheapest path when available.
  3. Work passes to another agent/directory/colleague, or context must survive? → session-flow:handoff.
  4. Work can proceed without human input? → background delegation (session-flow:continue-in-background on explicit request / subagent). Source's node 4 has inverted header/subtitle polarity (verified against 2x crop); ours states the test positively.
  5. Machine going away / day ending? → session-flow:clean-stop.
  6. Fallthrough: /compact with a steering hint — phase boundary only; point at handoff SKILL.md's "Fork beats compaction when the window is deep" section (heading anchor, not line numbers) rather than restating it.

Handoff-relay orchestration convention (include as guidance)

Worker approaching zone boundary → writes its own handoff file → returns the PATH only; parent spawns a successor briefed "read this file, continue" — parent never reads the handoff itself. Converges independently with mattpocock/skills#647 (generic spawn skill). Candidate carrier for relay policy into workers: SubagentStart hook injection (see #1475's event survey / #1478). Cross-reference session-flow:orchestrate; its audit is #1479.

Constraints

  • Cross-plugin references presence-gated with documented fallback (PLUGIN-PHILOSOPHY.md); router degrades gracefully when context-guard absent (no zone data → judgment-based questions still work).
  • Zone vocabulary and inline floor values, if inlined, follow the reader contract's byte-identity + drift-check rule.
  • Pointer-not-copy: compact-vs-clear tradeoff prose exists in handoff SKILL.md and playbooks; the router routes, it does not restate.

Acceptance criteria

  • Invoking workflow at a phase end yields a mechanism recommendation with rationale, zone-informed when data present, conservative when not.
  • Every terminal in the derived outcome set is reachable and points at its owning skill (or built-in) rather than duplicating its guidance.
  • Each ordering edge carries a stated purpose in the skill body.
  • Works with context-guard absent.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.priority: mediumReal value, no hard deadline; normal backlog flow.work-class: scopedA briefed fix or small feature; blast radius bounded by the brief, tests exist.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions