Skip to content

Automatic 65% context rollover through safe semantic /ctx #92

Open

Description

@brettheap

Lane: openrepotools-3 (openRepoTools-3), queued after #91

Intent

Automatically perform the semantic /ctx workflow when an opted-in Claude lane coordinator reaches 65% context usage by default, without interrupting an active turn or bypassing crash-consistent lane state.

This item depends on #91. It is queued for the existing openRepoTools-3 Claude lane and does not create a second implementation claim.

Current behavior

  • statusline-command.sh publishes a session-keyed context_pct snapshot.
  • usage-guard.sh reads it on UserPromptSubmit and currently warns at 70%, 85%, and 95%.
  • /ctx invokes Claude's semantic handoff skill with --restart, then the backend respawns the pane.
  • No automatic rollover is currently deployed.

Required behavior

  • Automatic rollover is opt-in through user-owned configuration; repository content cannot enable pane replacement.
  • Enabled policy defaults to 65%, supports an explicit threshold, and supports a one-launch disable.
  • The controller evaluates only at a completed main-session turn boundary, not from a timer during generation or tool use.
  • It requires a fresh transcript-matched context snapshot and verified canonical lane, pane, owner, generation, and RUNNING state.
  • It atomically latches one request per lane/session generation before returning rollover feedback.
  • It invokes the semantic handoff path used by /ctx, including writer accounting and handoff refresh, rather than blindly calling the shell restart tail.
  • It uses Crash-consistent lane worktree recovery: canonical inventory and RUNNING → SWAPPING → SWAPPED lifecycle #91's locked RUNNING -> SWAPPING -> SWAPPED lifecycle and generation fencing.
  • Any ambiguity or failure leaves the current pane alive, reports the reason, and never retries in a Stop-hook loop.
  • Manual /ctx and the existing warning behavior remain available.

Governed artifacts

  • openspec/changes/add-automatic-context-rollover/proposal.md
  • openspec/changes/add-automatic-context-rollover/design.md
  • openspec/changes/add-automatic-context-rollover/specs/automatic-context-rollover/spec.md
  • openspec/changes/add-automatic-context-rollover/tasks.md
  • ideation/brainstorm/automatic-context-rollover-overview.md

Validation

  • openspec validate add-automatic-context-rollover --strict
  • Brainstorm packet validator: 5 documents (3 atomic, 1 synthesis, 1 overview)
  • Final implementation verification must run the repository's serialized tests/run.sh wrapper.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions