[EPIC] Context-flush & orchestrator session-leasing: role state_class registry + flush_policy + lease lifecycle (plan-only) #820

Open
opened 2026-07-17 18:09:37 +00:00 by jason.woltje · 1 comment
Owner

Status: PLAN-ONLY — SPEC → PLAN → DECOMPOSE (no implementation authorized by this issue)

This epic tracks a Jason-directed, framework-native workstream. It is plan-only until the coordinator ratifies the plan. No implementation, PR, or live mutation is authorized by opening it. Decomposition into sub-issues / PR tranches is itself a PLAN output and follows the SPEC.

Motivation

Long-lived agent sessions accrue context that must be flushed or compacted on a per-role basis to preserve correctness and control token budget. A bleed-stop hotfix (dispatch-fresh.sh busy-guard, exit-4) has already shipped operationally; this epic codifies and generalizes it.

Scope

  • AC-0 — Codify the shipped hotfix. Land dispatch-fresh.sh (fresh-session dispatch with busy-guard, exit 4) as a reviewed framework PR (author ≠ reviewer) in mosaicstack/stack under packages/mosaic/.
  • (1) Role state_class registry. Config in policy/*.yaml, resolution order DB > local > framework-default. stateful = orchestrator / team leads / enhance → flush policy compact (never hard-flush). stateless = coders / reviewers / secrev / delegates → flush.
  • (2) flush_policy tunable per-role: flush | compact | carry.
  • (3) Per-runtime flush verb. Claude = /clear; Codex = respawn/verb; mosaic-agent@ respawn is fenced behind #791.
  • (4) Orchestrator-owned session leasing (end-state). Acquire → assign self-contained task → observe → reclaim; token-budget-aware; pool/reuse warm idle workers.

Constraints

  • Framework-native (lands in packages/mosaic/) — NOT jarvis-brain / operator-specific.
  • Framework-PR firewall (L0): no SOUL.md / USER.md / operator / jarvis-brain content in any framework PR.
  • Rides the same policy/*.yaml → composeContract → env plumbing as the delegation-remediation + model-tiering config streams (design shares that spine).
  • Precondition: self-contained task specs (leasing assumes tasks are dispatchable without carried context).
  • Invariant preserved: the dispatch-fresh.sh busy-guard must not regress.

Deliverables

  1. SPEC — capability + config surface + resolution semantics.
  2. PLAN — sequencing, dependencies, PR tranches.
  3. DECOMPOSE — sub-issues (created after SPEC/PLAN ratified).
  4. Adversarial planner pass (author + red-team) iff a genuine design fork appears in the lease-protocol / reclaim design.

Dependencies

  • #791mosaic-agent@ respawn fence (per-runtime flush verb item 3).
  • Shared design spine with the delegation-remediation + model-tiering config streams (coordinator-held).

Provenance

Directed by Jason via a coordinator-authored durable brief; folded alongside the existing delegation-remediation + model-tiering config work. Plan ratification authority: coordinator.

## Status: PLAN-ONLY — SPEC → PLAN → DECOMPOSE (no implementation authorized by this issue) This epic tracks a Jason-directed, framework-native workstream. It is **plan-only until the coordinator ratifies the plan**. No implementation, PR, or live mutation is authorized by opening it. Decomposition into sub-issues / PR tranches is itself a PLAN output and follows the SPEC. ## Motivation Long-lived agent sessions accrue context that must be flushed or compacted on a per-role basis to preserve correctness and control token budget. A bleed-stop hotfix (`dispatch-fresh.sh` busy-guard, exit-4) has already shipped operationally; this epic codifies and generalizes it. ## Scope - **AC-0 — Codify the shipped hotfix.** Land `dispatch-fresh.sh` (fresh-session dispatch with busy-guard, exit 4) as a **reviewed** framework PR (author ≠ reviewer) in `mosaicstack/stack` under `packages/mosaic/`. - **(1) Role `state_class` registry.** Config in `policy/*.yaml`, resolution order DB > local > framework-default. `stateful` = orchestrator / team leads / enhance → flush policy `compact` (never hard-flush). `stateless` = coders / reviewers / secrev / delegates → `flush`. - **(2) `flush_policy` tunable** per-role: `flush | compact | carry`. - **(3) Per-runtime flush verb.** Claude = `/clear`; Codex = respawn/verb; `mosaic-agent@` respawn is **fenced behind #791**. - **(4) Orchestrator-owned session leasing (end-state).** Acquire → assign self-contained task → observe → reclaim; token-budget-aware; pool/reuse warm idle workers. ## Constraints - **Framework-native** (lands in `packages/mosaic/`) — NOT jarvis-brain / operator-specific. - **Framework-PR firewall** (L0): no SOUL.md / USER.md / operator / jarvis-brain content in any framework PR. - Rides the **same `policy/*.yaml → composeContract → env` plumbing** as the delegation-remediation + model-tiering config streams (design shares that spine). - **Precondition:** self-contained task specs (leasing assumes tasks are dispatchable without carried context). - **Invariant preserved:** the `dispatch-fresh.sh` busy-guard must not regress. ## Deliverables 1. **SPEC** — capability + config surface + resolution semantics. 2. **PLAN** — sequencing, dependencies, PR tranches. 3. **DECOMPOSE** — sub-issues (created after SPEC/PLAN ratified). 4. Adversarial planner pass (author + red-team) **iff** a genuine design fork appears in the lease-protocol / reclaim design. ## Dependencies - **#791** — `mosaic-agent@` respawn fence (per-runtime flush verb item 3). - Shared design spine with the delegation-remediation + model-tiering config streams (coordinator-held). ## Provenance Directed by Jason via a coordinator-authored durable brief; folded alongside the existing delegation-remediation + model-tiering config work. Plan ratification authority: coordinator.
Author
Owner

HELD — not authorized for work. Per coordinator ruling, this epic is on hold pending a direct user instruction to the owning session. A peer relay does not establish genuine user-role authorization. No SPEC/PLAN/decomposition, sub-issues, PR, or implementation is authorized until the user directly instructs. This issue is a placeholder only; do not action it.

**HELD — not authorized for work.** Per coordinator ruling, this epic is on hold pending a **direct user instruction to the owning session**. A peer relay does not establish genuine user-role authorization. No SPEC/PLAN/decomposition, sub-issues, PR, or implementation is authorized until the user directly instructs. This issue is a placeholder only; do not action it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#820