Why manifest-first + bounded (EXP-L21): what a decision needs is flat (~50-70k tokens)
regardless of session length; the accumulating transcript is almost pure decoration by
late session. A handoff that says "read the conversation" recreates the waste. A handoff
that pins exact selectors + phases lets the next session reconstruct ONLY the load-bearing
state.
Reference: skills/context-mgmt/SKILL.md
Context section — the attention budget is the design center:
- policy.mode: advisory (default) | bounded (extra loads must be justified + ledgered)
| sealed (forbidden globs hook-blocked; for controlled experiments)
- required: SELECTORS, not whole files, wherever a section suffices:
{path, heading: "## X"} · {path, lines: "A-B"} · {path, grep: "pat", context: N}
· {git_diff: "revA..revB"} — each with a reason
- forbidden: globs the resume must NOT touch (sealed mode enforces via guard-context hook)
- budget: target_tokens (aim: boot + manifest + 2-12k selected history, per EXP-L21),
max_tokens (hard stop)
Execution section: entry_phase, entrypoint (the literal first operation), stop_conditions,
checkpoints (when to emit kernel.checkpoint/v1 during the resumed work).
Resume section: one-line continuation prompt:
/kernel:ingest resume from _meta/handoffs/{file}.json
JSON strings are always quoted, so sha/commit fields cannot type-drift (the old YAML
fails validation).
1---2name: handoff3description: "Save provenance, decisions, phases, context policy, and next steps as kernel.handoff/v1. Triggers: handoff, save, pause, context, continue later."4user-invocable: true5allowed-tools: Read, Bash, Grep, Glob, Write6kernel:7 kind: state_transition8 version: 29 side_effects: writes_meta10 confirmation: none11 produces:12 - kernel.handoff/v113---1415<skill id="handoff">1617<purpose>18Compile the current task into an authoritative, resumable JSON manifest.19The JSON file is CANONICAL. A markdown rendering may be generated for humans but is20never a second source of truth.2122Why manifest-first + bounded (EXP-L21): what a decision needs is flat (~50-70k tokens)23regardless of session length; the accumulating transcript is almost pure decoration by24late session. A handoff that says "read the conversation" recreates the waste. A handoff25that pins exact selectors + phases lets the next session reconstruct ONLY the load-bearing26state.2728Reference: skills/context-mgmt/SKILL.md29</purpose>3031<on_start>32```bash33agentdb read-start34```35</on_start>3637<phase id="1_extract" name="EXTRACT STATE">38Capture (these become manifest sections, not prose):39- objective: goal, success_conditions (observable), non_goals40- contract: governing _meta/contracts/ file if one exists, invariants, assumptions,41 decisions_accepted (+rationale), alternatives_rejected (+reason) — rejected paths are42 as valuable as accepted ones; they stop re-exploration43- workflow.phases: name each phase of the work; status inherited (done, with evidence)44 | required (still to do). Add invalidation_rules: what live-state change would flip an45 inherited phase back to required. Rules use typed `when.event` plus optional46 `when.path_glob`; never prose trigger strings.47- open_threads, warnings (failed approaches — never re-explore silently)48- tier (1/2/3) in identity49</phase>5051<phase id="2_gather" name="GATHER EVIDENCE">52```bash53git branch --show-current && git rev-parse HEAD && git status --short54git log --oneline -1055agentdb query "SELECT * FROM context WHERE type IN ('contract','checkpoint') ORDER BY ts DESC LIMIT 5"56```57Pin artifacts: for each file the next session must trust unchanged,58`shasum -a 256 <path>` → provenance.artifacts[{path, sha256, purpose}].59</phase>6061<ask_user>62 Use AskUserQuestion when: state extraction complete, before writing the manifest63 Ask: "Anything to add to the handoff? Blockers, decisions, or context I might have missed?"64 Options: looks complete, add context, skip handoff65</ask_user>6667<phase id="3_hygiene" name="GIT HYGIENE">68uncommitted: commit with "wip: checkpoint before handoff" or stash (document it)69push: push current branch to remote — a local-only handoff is stranded work70</phase>7172<phase id="4_compile" name="COMPILE THE MANIFEST">73Write `_meta/handoffs/{name}-{date}.json` conforming to schemas/kernel.handoff.v1.schema.json.7475Context section — the attention budget is the design center:76- policy.mode: advisory (default) | bounded (extra loads must be justified + ledgered)77 | sealed (forbidden globs hook-blocked; for controlled experiments)78- required: SELECTORS, not whole files, wherever a section suffices:79 `{path, heading: "## X"}` · `{path, lines: "A-B"}` · `{path, grep: "pat", context: N}`80 · `{git_diff: "revA..revB"}` — each with a reason81- forbidden: globs the resume must NOT touch (sealed mode enforces via guard-context hook)82- budget: target_tokens (aim: boot + manifest + 2-12k selected history, per EXP-L21),83 max_tokens (hard stop)8485Execution section: entry_phase, entrypoint (the literal first operation), stop_conditions,86checkpoints (when to emit kernel.checkpoint/v1 during the resumed work).8788Resume section: one-line continuation prompt:89 `/kernel:ingest resume from _meta/handoffs/{file}.json`9091JSON strings are always quoted, so sha/commit fields cannot type-drift (the old YAML92fails validation).93</phase>9495<phase id="5_validate" name="VALIDATE — MANDATORY">96```bash97"${CLAUDE_PLUGIN_ROOT:-.}/orchestration/manifest/kernel-manifest" validate _meta/handoffs/{file}.json98```99A handoff that does not validate DOES NOT EXIST. Fix and re-validate before reporting done.100Optional human rendering: a .md next to it, first line101`# RENDERED FROM {file}.json — NOT AUTHORITATIVE`.102</phase>103104<delivery>1051. `kernel-manifest validate` passes (above)1062. Commit: "docs: handoff manifest for {name}"1073. Push to remote108</delivery>109110<on_complete>111```bash112agentdb write-end '{"skill":"handoff","saved_to":"_meta/handoffs/{file}.json","branch":"X","tier":N}'113# If non-local profile: post handoff summary to GitHub Discussions (Agent Logs category)114# Suggest /kernel:retrospective if learnings accumulated across sessions115```116</on_complete>117118</skill>