context-budget-guard
Context Budget Guard proactively monitors token consumption during extended conversations and initiates context cleanup when usage reaches 70 percent capacity, preventing model degradation before it occurs. Deploy this skill at the beginning of sessions expected to exceed 30 minutes or before each major task phase in multi-hour workflows to estimate current context load and trigger compression before the model's reasoning coherence declines.
git clone --depth 1 https://github.com/ArchieIndian/openclaw-superpowers /tmp/context-budget-guard && cp -r /tmp/context-budget-guard/skills/openclaw-native/context-budget-guard ~/.claude/skills/context-budget-guardSKILL.md
# Context Budget Guard State file: `~/.openclaw/skill-state/context-budget-guard/state.yaml` Don't wait for the model to go incoherent. Act at 70%, not 95%. ## When to Use - At the start of any long-running session (>30 min expected) - Before each major task step in a multi-hour workflow - When `long-running-task-management` advances to a new stage ## The Process ### Step 1: Initialize (Session Start) Write to state: `session_start` timestamp, `compaction_count: 0`, `status: monitoring`, `threshold_pct: 70`. ### Step 2: Check Budget (Before Each Major Step) Estimate current context usage as a rough percentage: - **Low (<50%)** — continue normally - **Medium (50–70%)** — note in state, proceed with caution (avoid loading large files) - **High (>70%)** — trigger `context-window-management` NOW, before continuing To estimate: count approximate tokens from recent messages, loaded file contents, and active task context. ### Step 3: After Compaction - Increment `compaction_count` in state - Write `last_compacted_at`, `strategy_used` (passed from `context-window-management`) - Reset mental estimate to ~20% (post-compaction baseline) ### Step 4: Session End Update state: `status: idle`, `session_end` timestamp. ## Key Principles - The 70% threshold is the trigger — earlier is always better than later - Check budget BEFORE loading large files or running subagents, not after - If in doubt: compact. A clean context costs less than a confused one. - Works best paired with `long-running-task-management` — check budget at every checkpoint
Syncs agent daily memory and MEMORY.md to an Obsidian vault so notes are human-browsable. Use nightly or on demand.
Structured ideation before any implementation. Use when starting any non-trivial task.
Scaffolds and validates new superpowers skills. Use when creating a new skill for this repository.
Executes plans task-by-task with verification. Use when implementing a plan.
Triggers a secondary verification pass for any agent output containing factual claims, numbers, dates, or named entities before the output is acted on
Crawls a new codebase to infer stack, conventions, and key invariants, then generates a PROJECT.md context file for the agent
Handles PR review feedback by fetching comments, grouping issues, fixing one group at a time, and verifying before replies.
Detects skill name shadowing and description-overlap conflicts that cause OpenClaw to trigger the wrong skill or silently ignore one when two skills compete for the same intent.