首页龙虾技能列表 › session-compress — 技能工具

session-compress — 技能工具

v1.0.1

Compress OpenClaw session .jsonl files by trimming old messages while preserving system messages, recent turns, and task-relevant context.

0· 50·0 当前·0 累计
by @zzqsama066 (ZZQSAMA066)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/4/8
安全扫描
VirusTotal
可疑
查看报告
OpenClaw
可疑
medium confidence
The instructions claim to compress OpenClaw session files, which is coherent, but the skill is instruction-only and refers to a local PowerShell script (scripts/compress.ps1) and <OPENCLAW_DIR> without providing that script or explaining where it comes from — an inconsistency users should verify before running anything.
评估建议
This skill is instruction-only and does not include the PowerShell script it tells you to run. Before using it: 1) Verify that scripts/compress.ps1 actually exists on your system and inspect its contents line-by-line to ensure it only touches the intended session files and does not exfiltrate data or run network calls. 2) Back up any .jsonl files or use -OutputPath / DryRun as recommended. 3) Confirm <OPENCLAW_DIR> location and platform (instructions use PowerShell; they assume a Windows/PowerSh...
详细分析 ▾
用途与能力
The skill's stated purpose (compress .jsonl session files) matches the instructions' goal, but it presumes the presence of a local PowerShell script (scripts/compress.ps1) and an <OPENCLAW_DIR> path. Because the skill includes no code or install spec, it cannot itself perform compression; it only documents how to run an external script that is not provided. That mismatch is an incoherence a user should confirm.
指令范围
Instructions tell the operator/agent to list and modify files under <OPENCLAW_DIR>\agents\main\sessions\*.jsonl and to run powershell -File scripts/compress.ps1. These are narrowly scoped to main agent sessions (appropriate), but they instruct execution of an external PowerShell script whose content is unknown. The SKILL.md does not include the script contents, nor does it define how <OPENCLAW_DIR> is resolved — both gaps increase risk and ambiguity.
安装机制
No install spec and no bundled code means nothing will be written to disk by installing the skill itself, which lowers risk. However, the runtime instructions rely on an external script rather than installing it.
凭证需求
The skill does not request environment variables, credentials, or config paths. The only filesystem access referenced is the agent's session directory, which is proportional to the stated purpose.
持久化与权限
The skill does not request persistent/always-on presence (always:false) and is user-invocable. It does allow the agent to invoke the instructions autonomously by default (disable-model-invocation:false), which is platform normal; combined with other issues this is worth noting but not flagged by itself.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.12026/4/8

- Documentation updated to use <OPENCLAW_DIR> as a placeholder for the directory path, replacing the previous user-specific example. - Task relevance keywords in the compression logic now use English terms instead of Chinese. - Minor improvements to clarity and instructions in the workflow and important notes. - Removed references to a fixed session path; now specifies applicability to main agent session files in general.

● 可疑

安装命令 点击复制

官方npx clawhub@latest install session-compress
镜像加速npx clawhub@latest install session-compress --registry https://cn.clawhub-mirror.com

技能文档

Compress an OpenClaw .jsonl session file by trimming old messages while retaining active task context and basic message structure.

When to Use

  • User asks to compress, shrink, or trim a session file
  • Session context is too large and causing performance issues
  • Before archiving an old session but wanting to preserve task memory

Workflow

Step 1: Identify the target file

Session files are located at:

\agents\main\sessions\.jsonl

List files by size to find candidates:

Get-ChildItem \agents\main\sessions\.jsonl | Sort-Object Length -Descending | Select-Object Name, @{N='SizeMB';E={[math]::Round($_.Length/1MB,2)}}

Step 2: Dry run first

Always dry run before modifying anything:

powershell -File scripts/compress.ps1 -FilePath "" -DryRun

Review: how many messages will be kept, what the output size will be.

Step 3: Compress

# In-place compress (overwrites original):
powershell -File scripts/compress.ps1 -FilePath ""

# Compress to a new file (preserves original): powershell -File scripts/compress.ps1 -FilePath "" -OutputPath ""

Compression Logic

  • Always kept: All system role messages
  • Always kept: Last 30 message turns (configurable via -KeepRecent)
  • Conditionally kept (task context keywords): messages containing keywords like next step, todo, plan, task, pending, in progress, remember, dont forget, important
  • Summarized: Culled messages are replaced with a single placeholder message — preserving the file structure so OpenClaw can still load it
  • Deduplicated: No message appears twice in the output

Parameters

ParameterDefaultDescription
-FilePath(required)Path to the .jsonl file
-KeepRecent30Number of recent turns to always keep
-OutputPath(none)If set, writes to a new file instead of overwriting
-DryRunoffPreview without modifying files

What Gets Preserved

Each message in the output .jsonl retains:

  • role (system / user / assistant)
  • content (as array of content blocks)
  • timestamp

What Gets Removed

  • Older messages not in the recent window and not flagged as task-relevant
  • Tool call metadata is stripped (content blocks are kept as text)

Important Notes

  • Always dry run first — compression is destructive unless -OutputPath is used
  • This skill is for the main agent session files only
  • After compression the file remains a valid .jsonl that OpenClaw can load normally
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务