skills/context-management/SKILL.md
Use this skill for work likely to span many turns, branches, retries, research, reading several files/webpages, plan-then-execute phases, repeated cases, debugging, or interrupted/messy threads. It guides agents to maintain a clean working set with checkpoints, timeline review, and compaction at useful continuation boundaries. Usually skip for one-shot reads, bounded summaries, direct rewrites, simple lookups, or deterministic scripts.
npx skillsauth add ttttmr/pi-context context-managementInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill to maintain the active conversation as a useful working set for the next step. The goal is not to archive more history or compress more aggressively; it is to keep raw only the context that still needs direct reasoning, and carry the rest as compact task state when that is more efficient.
Core rhythm:
Use only these tools:
context_checkpointcontext_timelinecontext_compactBefore choosing a tool, ask:
Classify context into three forms:
If the active context is already small, coherent, and directly useful for the next step, do not manage it just to be tidy.
Use this mode when the user is asking for work that may outgrow one clean thread:
If one of these clearly applies, take a structural action now, usually a checkpoint. Do not merely describe the workflow. If the user has not yet provided enough task details, still create a checkpoint for the workflow shape before asking clarifying questions, and name the detected mode briefly (search/reading, planning, repeated batch, task switching/cleanup, development retry).
Usually skip this skill for one-shot reads, bounded summaries, direct rewrites, simple fact lookup, conceptual explanation, deterministic scripts, short tasks that can stay clean, or moments where the active context is already a good working set.
At the start of each new user message, classify it:
Think of the tools as a phase pipeline: context_checkpoint marks useful anchors, work happens, context_timeline shows the structure when orientation or target choice is unclear, and context_compact creates a new branch from the chosen continuation anchor with a summary of what happened after it. The target is a working-set choice, not an age choice: keep raw context only when it will help the next action; summarize or drop raw process when it would distract.
This prevents both premature cleanup after final answers and endless checkpoint-only behavior that lets stale work accumulate.
context_timeline before adding a new checkpoint.context_timeline when the active path structure affects the next decision or compact target.Read one primary reference based on task shape when the scenario pattern will affect tool timing, anchor choice, or summary content:
references/search-research-and-reading.mdreferences/development-and-troubleshooting.mdreferences/planning-and-execution.mdreferences/repeated-items-and-batch-work.mdreferences/task-switching-and-cleanup.mdAlso read references/retry-branch-and-pivot.md when multiple approaches, failed branches, comparisons, retries, or pivots become central. For code/debugging work with repeated attempts, use both references/development-and-troubleshooting.md and references/retry-branch-and-pivot.md.
context_checkpointDefault move. Use it before noisy work, a new phase, a risky attempt, switching subtasks, or after a meaningful milestone.
Use semantic names so the timeline stays readable:
<task>-start<task>-<phase><task>-<attempt><task>-<milestone>Examples: auth-oauth-start, timeout-analysis-search, db-migration-plan, parser-fix-attempt-2.
Avoid generic names like start, checkpoint-1, phase-1, or retry.
context_timelineUse it as the structural view of the active path, not only as a rescue tool:
When reading the timeline, ask:
context_compactUse it to replace raw history with a state summary when the next phase would benefit from a smaller working set.
Typical compact boundaries: investigation -> execution, diagnosis -> fix, implementation -> validation, failed attempt -> next attempt, representative item -> remaining batch, completed noisy task -> new user task.
Do not compact while exploration is still active, when the result is unstable, just because the skill triggered, or just because the user-visible task ended.
Before calling context_compact, require all three:
If the compact is prompted by a new user message, a direction shift, or several possible checkpoint targets, run context_timeline first and choose the target from the visible structure rather than from memory.
Condition 3 means the next action is a new phase, not just more of the same exploration. Examples: run the export, implement the fix, validate, process the next item, or try the chosen next approach.
If conditions 1 and 2 are true but the whole task is done and only the final answer remains, wait. Compact later only if the next user message makes it useful.
Choose the continuation anchor by designing the next working set:
The right target may be a recent phase-start, a plan-ready checkpoint, a pre-branch checkpoint, a repeated-work baseline, an older checkpoint, or root. root is appropriate when the old path no longer contributes raw context and the summary can carry the necessary state.
Avoid targets that create a poor working set:
For bounded phases, choose by what should remain raw:
research-start to summarize the whole research segmentresearch-end to keep research raw and summarize only later clutter before follow-up researchIf there are several checkpoints, a task switch, or any uncertainty about the best working set, run context_timeline first.
Use backupCheckpoint when the raw path may still matter later: long investigations, abandoned branches, risky compactions, or details that may be needed for recovery. A backup checkpoint is a recovery safety net, not a substitute for the summary; include details likely needed in the next phase because returning to backup is costly.
The summary is not a transcript recap. It is the state needed to resume work from the chosen anchor; older or cleaner anchors require stronger summaries.
Context tools change conversation state, not the outside world. Files, processes, browser state, tickets, databases, remote services, and other side effects stay current. If you compact to an anchor before those changes, the summary must bridge the gap between old conversation context and current external state.
A compact summary must restore:
Include why compacting is appropriate only when it helps future orientation. Avoid vague summaries like Done, Investigated, Switching context, or Going back.
Good examples:
Current task: plan mitigation for API timeouts. State: DB pool exhaustion is the likely root cause. Evidence: logs show pool wait timeouts during peak traffic; config has pool size 10; no network errors found. Rejected lead: API gateway timeout appears downstream of DB waits. Next step: propose mitigation and validation steps.Current task: validate the parser fix. State: implementation is done. External state: changed files src/parser.ts and test/parser.test.ts. Validation not yet run after the final edit. Next step: run targeted parser tests and summarize remaining edge cases. Backup: parser-fix-debug-history if exact failed attempts are needed.Before compacting, quickly check: stable state? real continuation? anchor gives the smallest sufficient working set? summary restores state after that anchor? external side effects and validation captured? explicit next step?
Avoid:
root feel riskyroot with a weak summary that drops current task statedevelopment
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.
development
End-to-end Parallels smoke, upgrade, and rerun workflow for OpenClaw across macOS, Windows, and Linux guests. Use when Codex needs to run, rerun, debug, or interpret VM-based install, onboarding, gateway smoke tests, latest-release-to-main upgrade checks, fresh snapshot retests, or optional Discord roundtrip verification under Parallels.