BACKS Session Rollover
Keep the mission alive while replacing its crowded model session. Prepare a
checkpoint at 110000 active context tokens. Request a fresh session at 125000,
or earlier when the next bounded operation would cross that threshold or the
model has a smaller usable window. Preserve the original request, corrections,
current work, and remaining mission budgets through every rotation.
A skill supplies the procedure; a host observer and supervisor execute the
automatic transition. Do not report automatic handoff as enabled until the
actual host path has run.
For the standalone Bash installer, existing project updates, scheduler loading,
coverage reports and rollback, read installation and boot.
That installer applies native compaction policy and skill registration; its
report keeps live provider handoff unbound until the host integration is proven.
Ground and bind once
- Load Optimus, the current invariant floor and canonical
law, Session Handoff,
Context Compiler, and
Bounded Loops. Apply the current operator profile.
- Discover the real provider launcher, active-context telemetry, memory
authority, task journal, build loop, and writer ownership. Follow the live
installation over historical paths. Use the source audit
as a search map, then recheck current source. Storage retention is not active
context compaction.
- Preserve the configured model, provider, reasoning effort, tools, sandbox,
credential route, and permission scope. Rotation does not authorize a model
switch, fresh spend budget, deployment, or unrelated action.
- Bind the support code into the existing controller. Follow
runtime integration and
provider controls. Reuse the runtime's
durable state store and writer lease. Do not install a competing memory
database or replace its grounding hook.
- Merge native compaction settings as a second protection where supported.
Preserve existing configuration and hooks. Capability-check installed
CLI/SDK versions and verify the effective setting.
Preserve intent before compressing history
Maintain these records in the existing private task journal:
- The original operator request, verbatim, in an immutable record.
- An append-only record of corrections, decisions, permissions, and explicit
cancellations. Pin a version for each checkpoint.
- Current mission ID, step, generation, provider session ID, worktree, branch,
HEAD, dirty and untracked files, worker receipts, tests, failed approaches,
next action, and remaining budgets.
- Evidence objects and artifact references with hashes and provenance.
Keep secrets in the existing credential system and private task records out of
public commits. Handoffs carry credential references, never credential values.
Preserve image and specification references when prose cannot replace them.
Compile each handoff from the original records and current evidence. Never
make a chain of summaries the only surviving specification. Keep operator
instructions distinct from inferred lessons, retrieved material, and model
proposals. Resolve conflicts using the latest applicable operator instruction.
Observe outside the model
Run the observer before each model dispatch, after completed tool results,
after each build iteration, and on native compaction/reset events.
| Condition |
Controller action |
| Below the preparation threshold |
Continue; checkpoint each completed iteration. |
| At or above 110000 |
Refresh the handoff while the session still has room. |
| At or above 125000 |
Latch rollover; stop dispatching new build work. |
| Pending input crosses the boundary |
Request rollover before sending that input. |
| Verified model window is smaller |
Use available context minus reserved headroom. |
| Worker reaches its configured age limit |
Rotate at a safe boundary; default four hours when age tracking is enabled. |
| Telemetry missing, invalid, or stale |
Refresh or obtain a labeled conservative estimate; never treat unknown as zero. |
Use active context occupancy, including cached tokens once. Track cumulative
session spend and subagent spend separately. A display percentage, accumulated
character count, lifetime token count, or output max_tokens is not the required
measurement. Count instructions, tools, retrieved memory, pending tool output,
and reserved completion space in the dispatch budget.
Use scripts/session_guard.py for deterministic policy and checkpoint checks.
Its default reserve is 16000 tokens against the verified model window; size
pending input separately. Record whether telemetry is measured or estimated.
The 125000 setting is a scheduling boundary, not a guarantee that an unbounded
in-flight result can never overshoot it. Bound or externalize large results
before they enter context.
Rotate at a safe boundary
- Latch. Persist the reason and generation before compaction resets the
meter. A later low reading cannot cancel a pending rollover.
- Quiesce. Stop new worker dispatch. Finish, drain, or reconcile active
transactions and worker receipts. Interrupted does not mean completed.
Keep the operator's UI and controls available.
- Checkpoint. Write a complete generation atomically and retain earlier
generations. Record the exact continuation action and unchanged mission
budgets. Preserve uncommitted work without committing, stashing, resetting,
or deleting another session's files.
- Verify. Check the schema, referenced hashes, immutable intent, correction
version, Git identity, dirty inventory, and operation states. Follow the
checkpoint contract.
- Compact. Produce the bounded continuation packet. Native /compact may
also run on the old session if supported; verify its completion event.
Its summary is supplementary. A validated packet can proceed to a fresh
session without an additional model summarization call.
- Start fresh. Use the provider adapter and a durable idempotency key.
Require empty prior history and a new provider session ID. History-preserving
resume and fork operations do not qualify.
- Hydrate and acknowledge. Load the current BACKS floor, exact intent and
corrections, compact task state, and only the evidence needed next. Before
granting writes, independently validate task ID, generation, checkpoint
digest, instruction hashes, repository fingerprint, step, and next action.
- Transfer and resume. Transfer the single-writer lease with compare-and-
swap and a fencing token. Old workers must reject stale tokens. Activate
the successor on the same mission and unfinished step. Retire the old
worker after the successor accepts work. Keep receipts for both.
Use scripts/rollover_supervisor.py for the ordered transition contract. The
real host must provide its durable store and provider adapter. Bundled
in-memory adapters are tests only. Persist launch identity before launching
and reconcile it after a crash to avoid duplicate successors.
Keep the next session small
Target at most 30000 tokens for the complete assembled startup context, counted
by the active provider tokenizer or count endpoint. This is a configurable
engineering budget. Account for the mandatory harness and tools before
allocating retrieved memory. The utility's 48000-byte checkpoint bound is not
a token measurement.
Keep exact instruction records addressable and load their applicable parts
faithfully. Retrieve evidence by task, file, failure, or decision. Deduplicate
facts and apply freshness and provenance. Keep traces and old turns in durable
storage instead of replaying them. Do not silently truncate requirements to
meet a budget; partition the work and keep the complete scope indexed.
Recover without losing the mission
- Retain the last complete checkpoint after compaction, launch, hydration, or
acknowledgement failure. Do not clear the journal or declare completion.
- Persist and bound rollover retries, default three failures with host backoff.
Exhaustion yields a recoverable hold and a concrete repair action. It does
not revoke operator tools or reset mission limits.
- Reconcile uncertain external side effects before repeating them. Persist
operation IDs and receipts; do not claim universal exactly-once execution.
- Recheck repository and instruction versions before successor activation.
Operator changes during handoff require a refreshed checkpoint.
- Apply this policy per coordinator and worker context. Parent rollover does
not silently kill subagents or add their tokens to its own context count.
- Retain existing operator stop, continue, and reversible disable controls.
Do not modify grounding or permissions to escape a failed handoff.
Prove the live connection
Run the bundled regression suites, then test the actual launcher and control
surface in an isolated authorized worktree. Fixtures prove controller behavior;
they do not prove a live host-harness integration.
Require a trace showing the threshold event, complete checkpoint digest,
different provider session ID with empty history, loaded instruction hashes,
validated repository state, one active writer, and execution of the saved
next step with unchanged budgets. Inject launch failure and a stale handoff
to verify recovery. Exercise the provider routes actually in use.
Report skill/code status separately from live activation. State what was
verified on the operator's surface and the exact remaining blocker. Settings,
a mock, and a skill-loading receipt do not establish automatic continuation.
1---2name: backs-session-rollover3description: Install, repair, and operate automatic context compaction and fresh-session handoff in BACKS build loops. Use for Claude Code, Codex, Hydra, or other frontier coder sessions approaching 125000 active context tokens; prolonged sessions; lost intent after compaction; stale memory; or repeated manual restarts. Preserve the original task and corrections, checkpoint verified work, replace the provider session, and resume the same unfinished step through the existing supervisor.4metadata:5 source: https://skillmd.com/skills/tcuzzo/backs-session-rollover6---78# BACKS Session Rollover910Keep the mission alive while replacing its crowded model session. Prepare a11checkpoint at 110000 active context tokens. Request a fresh session at 125000,12or earlier when the next bounded operation would cross that threshold or the13model has a smaller usable window. Preserve the original request, corrections,14current work, and remaining mission budgets through every rotation.1516A skill supplies the procedure; a host observer and supervisor execute the17automatic transition. Do not report automatic handoff as enabled until the18actual host path has run.1920For the standalone Bash installer, existing project updates, scheduler loading,21coverage reports and rollback, read [installation and boot](references/install-and-boot.md).22That installer applies native compaction policy and skill registration; its23report keeps live provider handoff unbound until the host integration is proven.2425## Ground and bind once26271. Load [Optimus](../optimus/SKILL.md), the current invariant floor and canonical28 law, [Session Handoff](../session-handoff/SKILL.md),29 [Context Compiler](../context-engineer/SKILL.md), and30 [Bounded Loops](../bounded-loops/SKILL.md). Apply the current operator profile.312. Discover the real provider launcher, active-context telemetry, memory32 authority, task journal, build loop, and writer ownership. Follow the live33 installation over historical paths. Use the [source audit](references/source-audit.md)34 as a search map, then recheck current source. Storage retention is not active35 context compaction.363. Preserve the configured model, provider, reasoning effort, tools, sandbox,37 credential route, and permission scope. Rotation does not authorize a model38 switch, fresh spend budget, deployment, or unrelated action.394. Bind the support code into the existing controller. Follow40 [runtime integration](references/runtime-integration.md) and41 [provider controls](references/provider-controls.md). Reuse the runtime's42 durable state store and writer lease. Do not install a competing memory43 database or replace its grounding hook.445. Merge native compaction settings as a second protection where supported.45 Preserve existing configuration and hooks. Capability-check installed46 CLI/SDK versions and verify the effective setting.4748## Preserve intent before compressing history4950Maintain these records in the existing private task journal:5152- The original operator request, verbatim, in an immutable record.53- An append-only record of corrections, decisions, permissions, and explicit54 cancellations. Pin a version for each checkpoint.55- Current mission ID, step, generation, provider session ID, worktree, branch,56 HEAD, dirty and untracked files, worker receipts, tests, failed approaches,57 next action, and remaining budgets.58- Evidence objects and artifact references with hashes and provenance.5960Keep secrets in the existing credential system and private task records out of61public commits. Handoffs carry credential references, never credential values.62Preserve image and specification references when prose cannot replace them.6364Compile each handoff from the original records and current evidence. Never65make a chain of summaries the only surviving specification. Keep operator66instructions distinct from inferred lessons, retrieved material, and model67proposals. Resolve conflicts using the latest applicable operator instruction.6869## Observe outside the model7071Run the observer before each model dispatch, after completed tool results,72after each build iteration, and on native compaction/reset events.7374| Condition | Controller action |75| --- | --- |76| Below the preparation threshold | Continue; checkpoint each completed iteration. |77| At or above 110000 | Refresh the handoff while the session still has room. |78| At or above 125000 | Latch rollover; stop dispatching new build work. |79| Pending input crosses the boundary | Request rollover before sending that input. |80| Verified model window is smaller | Use available context minus reserved headroom. |81| Worker reaches its configured age limit | Rotate at a safe boundary; default four hours when age tracking is enabled. |82| Telemetry missing, invalid, or stale | Refresh or obtain a labeled conservative estimate; never treat unknown as zero. |8384Use active context occupancy, including cached tokens once. Track cumulative85session spend and subagent spend separately. A display percentage, accumulated86character count, lifetime token count, or output max_tokens is not the required87measurement. Count instructions, tools, retrieved memory, pending tool output,88and reserved completion space in the dispatch budget.8990Use scripts/session_guard.py for deterministic policy and checkpoint checks.91Its default reserve is 16000 tokens against the verified model window; size92pending input separately. Record whether telemetry is measured or estimated.93The 125000 setting is a scheduling boundary, not a guarantee that an unbounded94in-flight result can never overshoot it. Bound or externalize large results95before they enter context.9697## Rotate at a safe boundary98991. **Latch.** Persist the reason and generation before compaction resets the100 meter. A later low reading cannot cancel a pending rollover.1012. **Quiesce.** Stop new worker dispatch. Finish, drain, or reconcile active102 transactions and worker receipts. Interrupted does not mean completed.103 Keep the operator's UI and controls available.1043. **Checkpoint.** Write a complete generation atomically and retain earlier105 generations. Record the exact continuation action and unchanged mission106 budgets. Preserve uncommitted work without committing, stashing, resetting,107 or deleting another session's files.1084. **Verify.** Check the schema, referenced hashes, immutable intent, correction109 version, Git identity, dirty inventory, and operation states. Follow the110 [checkpoint contract](references/checkpoint-contract.md).1115. **Compact.** Produce the bounded continuation packet. Native /compact may112 also run on the old session if supported; verify its completion event.113 Its summary is supplementary. A validated packet can proceed to a fresh114 session without an additional model summarization call.1156. **Start fresh.** Use the provider adapter and a durable idempotency key.116 Require empty prior history and a new provider session ID. History-preserving117 resume and fork operations do not qualify.1187. **Hydrate and acknowledge.** Load the current BACKS floor, exact intent and119 corrections, compact task state, and only the evidence needed next. Before120 granting writes, independently validate task ID, generation, checkpoint121 digest, instruction hashes, repository fingerprint, step, and next action.1228. **Transfer and resume.** Transfer the single-writer lease with compare-and-123 swap and a fencing token. Old workers must reject stale tokens. Activate124 the successor on the same mission and unfinished step. Retire the old125 worker after the successor accepts work. Keep receipts for both.126127Use scripts/rollover_supervisor.py for the ordered transition contract. The128real host must provide its durable store and provider adapter. Bundled129in-memory adapters are tests only. Persist launch identity before launching130and reconcile it after a crash to avoid duplicate successors.131132## Keep the next session small133134Target at most 30000 tokens for the complete assembled startup context, counted135by the active provider tokenizer or count endpoint. This is a configurable136engineering budget. Account for the mandatory harness and tools before137allocating retrieved memory. The utility's 48000-byte checkpoint bound is not138a token measurement.139140Keep exact instruction records addressable and load their applicable parts141faithfully. Retrieve evidence by task, file, failure, or decision. Deduplicate142facts and apply freshness and provenance. Keep traces and old turns in durable143storage instead of replaying them. Do not silently truncate requirements to144meet a budget; partition the work and keep the complete scope indexed.145146## Recover without losing the mission147148- Retain the last complete checkpoint after compaction, launch, hydration, or149 acknowledgement failure. Do not clear the journal or declare completion.150- Persist and bound rollover retries, default three failures with host backoff.151 Exhaustion yields a recoverable hold and a concrete repair action. It does152 not revoke operator tools or reset mission limits.153- Reconcile uncertain external side effects before repeating them. Persist154 operation IDs and receipts; do not claim universal exactly-once execution.155- Recheck repository and instruction versions before successor activation.156 Operator changes during handoff require a refreshed checkpoint.157- Apply this policy per coordinator and worker context. Parent rollover does158 not silently kill subagents or add their tokens to its own context count.159- Retain existing operator stop, continue, and reversible disable controls.160 Do not modify grounding or permissions to escape a failed handoff.161162## Prove the live connection163164Run the bundled regression suites, then test the actual launcher and control165surface in an isolated authorized worktree. Fixtures prove controller behavior;166they do not prove a live host-harness integration.167168Require a trace showing the threshold event, complete checkpoint digest,169different provider session ID with empty history, loaded instruction hashes,170validated repository state, one active writer, and execution of the saved171next step with unchanged budgets. Inject launch failure and a stale handoff172to verify recovery. Exercise the provider routes actually in use.173174Report skill/code status separately from live activation. State what was175verified on the operator's surface and the exact remaining blocker. Settings,176a mock, and a skill-loading receipt do not establish automatic continuation.