Files
stack/packages/mosaic/framework/skills/mosaic-context-refresh/SKILL.md
jason.woltje 2509eb7646
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
ci/woodpecker/push/ci Pipeline was successful
WI-6 (#833): constrained recovery command + mosaic-context-refresh skill wrapper (#846)
2026-07-20 03:33:00 +00:00

66 lines
3.9 KiB
Markdown

---
name: mosaic-context-refresh
description: Run the constrained Mosaic context-recovery flow after compaction or directive-loss. This is a thin wrapper over the broker-backed recovery command; it never treats a receipt as a safety or residency proof.
---
# mosaic-context-refresh
Use this only after compaction, session resume, or confirmed directive drift. It invokes the
**single ungated mutator**, `tools/lease-broker/recover-context.py`; every other consequential
mutator remains behind the verified lease gate.
## Wrapper procedure
1. The runtime supplies the exact validated normative-fragment construction and the current
compaction/request epochs.
- **Claude:** invoke only this direct command shape (no shell composition):
```bash
python3 /absolute/path/to/mosaic/tools/lease-broker/recover-context.py begin --construction /absolute/path/to/mosaic-context-refresh-construction.json --compaction-epoch 0 --request-epoch 0
```
This is a literal argv template: replace the recover-context.py path and construction JSON path
with the literal absolute paths for your install, then replace each epoch with literal decimal
digits. Do not use variables, quoting, globs, redirects,
shell operators, substitutions, or line continuations. Claude's all-tools gate maps only this
fully literal recovery shape to `mosaic_context_recover`; ordinary `Bash` remains gated.
- **Pi:** call the registered `mosaic_context_recover` tool with `phase: "begin"`,
`construction`, `compactionEpoch`, and `requestEpoch`. It is the exact broker-exempt tool name;
Pi `bash` and every other tool remain gated.
Both forms delegate to the shipped WI-5 broker transition: revoke first, build the canonical
`B_payload`/`H_payload`, enter `PENDING_DELIVERY`, and mint a fresh one-time challenge. They print
the terminal receipt envelope to deliver exactly as returned.
2. The current assistant message copies that one terminal receipt verbatim. It does not compute a
hash, add prose, quote a prior receipt, or present a caller-supplied receipt/challenge.
3. The production trusted-observer transport records that finalized assistant entry before completion:
- **Claude** selects the latest assistant entry at its `Stop` hook.
- **Pi** records only finalized assistant content at `message_end` (never
`after_provider_response`).
Then invoke completion with the same adapter form: Claude runs
`python3 /absolute/path/to/mosaic/tools/lease-broker/recover-context.py complete`; Pi calls
`mosaic_context_recover` with `phase: "complete"`. Completion supplies no receipt or challenge
argument. The broker observes the exact latest assistant entry, commits evidence, consumes its own
fresh challenge, and promotes VERIFIED last. If observation is absent, malformed, stale, or
duplicated, recovery remains UNVERIFIED and a retry begins a new cycle.
## Scope and honesty
- A receipt from the normal verification path cannot be replayed through recovery: recovery mints a
distinct current challenge and does not accept caller-provided receipt text as evidence.
- Observable absent, malformed, prefix-truncated, and adapter-mutated terminal receipts do not
promote. “Tail-only” is non-promoting only when the delivered terminal bytes are concretely
malformed or incomplete.
- **Negative capability:** a tail-preserving middle drop is not represented as receipt-detectable.
It is a T-C injection-contract residual deferred to WI-7 server-side evidence; do not claim this
skill or receipt catches it.
- The receipt is a T-A delivery/liveness prerequisite only. It never proves obedience, comprehension,
durable residency, or safety; the whole mutator-class gate and server-side branch protection retain
those roles.
This source-resident skill is projected by the Mosaic skill bridge after framework install/upgrade.
Do not create a live symlink manually.