Persistent DSH context-budget, checkpoint, and loop-safety policy for local-model sessions. It is automatically reinforced by the harness; do not wait for a user invocation.
Instal·la
npx skillscat add xoykor/dsh-backup/context-guard Instal·la des del registre de SkillsCat.
Context Guard
This skill is automatically active with the DSH context guard. Follow its budget notices and deterministic tool blocks.
The effective context window and every dependent threshold are runtime values for
the selected preset. Read the first ACTIVE CONTEXT POLICY notice and the native
context meter as the source of truth. The sliders/settings derive the economy,
checkpoint, compaction, response, summary, safety and retention values from the
configured ratios. Never replace an active value with a number remembered from a
model capacity, another preset, or this document.
- Normal operation is below the active economy threshold.
- Economy mode runs from the active economy threshold to the active checkpoint threshold: use targeted reads, concise results, and diffs.
- Checkpoint preparation runs from the active checkpoint threshold to the active compaction threshold: preserve the live objective, constraints, work completed, decisions, changed files, relevant commands/results, unresolved errors, failed approaches, current state, and one next action.
- Pause → state summary → persistence → compaction begins at the active compaction threshold for the active context window.
When the threshold is reached, the executor pauses normal work, waits for the interrupted turn to settle, asks the session model for a text-only state summary of the full balanced durable history (including the latest work), flushes that summary to storage, then replaces the history and resumes. No tools execute during the summary. Preserve job IDs, artifact/log paths, uncertain side effects, failed attempts and one next action. The executor prices the summary input plus instructions and schemas, reduces its output cap if necessary, and requires input + output cap + safety margin < context capacity. A missing, truncated, failed or unsaved summary never authorizes history replacement. Compaction does not reset logical execution budgets or anti-loop evidence. Summary output reserve: 8192 tokens (including model reasoning); safety reserve: 4096 tokens.
The executor measures progress from result fingerprints, successful workspace mutations, referenced files, and recent action sequences. Identical reads, repeated timeouts, and materially equivalent calls without new evidence do not reset the budget. Assistant prose is only a signal; it never counts as progress.
Local Robust 9B and 27B have no cumulative call, step or whole-turn time ceiling (maxTurnToolCalls: null, maxTurnSteps: null, maxTurnMs: null). Continue productive authorized work through compaction until delivery is implemented and verified. Anti-loop checks, tool-specific timeouts and diagnostic limits remain active. Other presets retain their configured budgets. Execution-token caps apply only if explicitly configured; context capacity is not a cumulative usage cap. Compaction does not erase evidence of repeated failures or renew diagnostic allowances. Stop on user cancellation, missing authority or a demonstrated blocker with no productive alternative.
After a timeout, the existing managed process executor must settle the process tree and collect available output before the guard enters diagnostic mode. Diagnostic mode permits at most three executor-verified read-only calls and two minutes. Managed-job wait expiry with a running job is not an execution timeout. The exact timed-out command is blocked until the executor observes a relevant code/configuration change or a changed execution strategy.
When the guard emits PAUSE, it cancels the active agent turn and denies subsequent tool calls at the executor boundary. A model-written explanation or a context notice cannot override that state. A repeated cycle such as read → grep → rerun → read is closed when the tool/file/result sequence repeats, even if the individual calls are not identical.