Session Context Compressor
ReviewAudited by ClawScan on May 10, 2026.
Overview
The skill’s purpose is coherent, but it rewrites OpenClaw session history and stores an automatically generated summary as a system message, which can influence future agent behavior.
Before installing, understand that this skill changes OpenClaw session files, not just temporary text. Use dry-run first, keep backups, inspect compressed summaries, and avoid unattended compression for important sessions.
Findings (3)
Artifact-based informational review of SKILL.md, metadata, install specs, static scan signals, and capability signals. ClawScan does not execute the skill or run runtime probes.
After compression, the agent may rely on a lossy or manipulated summary as if it were authoritative session context.
The script summarizes prior conversation content and persists it as a system-role message. Because the summarized material can include old user, assistant, system, and tool content, this can elevate inaccurate or untrusted text into future high-priority context.
compacted_message = { "role": "system", "content": f"[CONTEXT COMPACTED - Previous {len(to_summarize)} messages summarized]\n\n{compacted_content}", "_compacted": TrueRun compression only after user approval, inspect the generated summary before continuing important work, and consider storing the compacted summary in a less-authoritative role or clearly marking summarized prior content as untrusted context.
If run on the wrong session or without reviewing the output, detailed conversation history may be lost or reduced to an imperfect summary.
The script intentionally renames the original session to a .backup file and rewrites the selected session file. This is central to compression, but it mutates active local agent state.
os.rename(filepath, backup_path) ... with open(filepath, 'w', encoding='utf-8') as f:
Use --dry-run first, verify the target session path, keep an extra backup for important sessions, and avoid automatic --apply runs unless you are comfortable with the context loss.
Installing dependencies may download code or data from external package sources that are not pinned in the artifact.
The skill relies on unpinned package and NLTK data downloads during setup. That is expected for NLP summarization, but it introduces normal package-supply-chain trust considerations.
install: |
pip install sumy
python3 -c "import nltk; nltk.download('punkt_tab'); nltk.download('stopwords')"Install in a virtual environment, pin and review dependency versions where possible, and use trusted package indexes.
