Skill flagged — suspicious patterns detected

ClawHub Security flagged this skill as suspicious. Review the scan results before using.

Context Shrink

Auto-compress session memories when context usage exceeds 85%

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 333 · 5 current installs · 5 all-time installs
byRao Lin@bg1avd
MIT-0
Security Scan
VirusTotalVirusTotal
Suspicious
View report →
OpenClawOpenClaw
Suspicious
medium confidence
!
Purpose & Capability
The handler implements deletion, compression into MEMORY.md, and git commits — which is coherent with 'context shrink'. However metadata/manifest inconsistencies exist: registry lists no required binaries/env, while HOOK.md documents required bins (node, git) and the code uses git. Defaults and comments in files disagree about trigger thresholds (60% vs 85%) and retention windows (HOOK.md says 7 days vs handler uses DAYS_TO_KEEP=3). These mismatches are unexpected and should be clarified.
!
Instruction Scope
The instructions and code are generally scoped to reading ~/.openclaw/workspace/memory, compressing and appending to MEMORY.md, deleting old files, and running git commits — all within the stated purpose. However the handler has a logic error: it checks for type === 'message' and then immediately checks for type === 'command', which cannot both be true, so the handler as written will early-return and never perform the intended work. SKILL.md/HOOK.md describe triggers (message:sent, command:reset) that the code does not properly handle. Also the code reads process.env.HOME and filesystem paths that are not declared in registry metadata.
Install Mechanism
No install script is provided (instruction-only + handler file). That keeps installation risk low. There are no remote downloads or archive extracts. However HOOK.md expects node and git to be present, which is a runtime requirement rather than an installation action.
Credentials
The skill declares no required environment variables or credentials, and its behavior mainly uses HOME (process.env.HOME) and the workspace path. That is proportionate, but the code performs file deletion and git commits which can affect local repositories and potentially expose data if a git remote is configured. The registry should explicitly declare required binaries (git) and any env assumptions.
Persistence & Privilege
always is false and the skill is a hook invoked on events (normal). It does not request permanent platform-wide privileges or modify other skills. Autonomous invocation is allowed by default and appropriate for a hook. No suspicious self-enablement behavior was found.
What to consider before installing
This skill intends to compress and delete old session memory files and then commit changes to git — that behavior matches the description, but there are several red flags you should consider before installing: - The handler contains a logic bug that makes it return immediately (it checks for both 'message' and 'command' at the same time). Expect it to be non-functional until fixed. - HOOK.md requires node and git, but the registry metadata doesn't list these; the code calls git via execSync. Ensure node/git exist and understand that commits (and any future push) may expose data to configured remotes. - The skill deletes files from ~/.openclaw/workspace/memory (filtered by YYYY-MM-DD.md). Back up that workspace before enabling the hook. Although it writes compressed content to MEMORY.md and attempts a git commit, deletion is destructive unless you have a safe backup or repo history. - There is minor command-execution risk: execSync is used with interpolated workspaceDir and shell commands (cd ${workspaceDir} && git add -A). If workspaceDir can be influenced by untrusted input, that could lead to command injection; prefer safe argument passing or sanitization. - There are several content mismatches (60% vs 85% thresholds, 7 days vs 3 days retention). Ask the author to clarify the intended defaults and update documentation and package metadata to match the code. Recommendations before enabling: 1) Test in a disposable workspace (no sensitive data, no active git remotes) to observe behavior. 2) Back up your memory directory and/or ensure the workspace repo is local-only or has no remote push configured. 3) Fix the event-type logic so the handler triggers correctly (handle message and command events separately), and normalize threshold/retention values across SKILL.md, HOOK.md, package.json and handler.ts. 4) Replace execSync shell interpolation with safe child_process invocation (or at least properly quote/sanitize paths) to reduce injection risk. 5) Ask the publisher to update registry metadata to list required binaries (node/git) and to document whether git push will be performed automatically. If you cannot validate these items, treat the skill as risky and do not enable it on any workspace containing sensitive or production data.
handler.ts:145
Shell command execution detected (child_process).
Patterns worth reviewing
These patterns may indicate risky behavior. Check the VirusTotal and OpenClaw results above for context-aware analysis before installing.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.2
Download zip
latestvk973n3dxzmvkmjcndsvhyv3ftd82qse4

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

Context Shrink Hook

Auto-compresses session memories when context usage exceeds 60% threshold. Cleans up old daily logs and compresses them into MEMORY.md for long-term storage.

Features

  • 自动触发: 当 context 使用率 ≥ 85% 时自动执行
  • 智能清理: 保留最近 3 天的详细日志
  • 压缩存储: 旧日志压缩后写入 MEMORY.md
  • Git 提交: 自动 commit 变更记录

Configuration

CONTEXT_THRESHOLD = 0.85     // 85% 触发阈值
DAYS_TO_KEEP = 3           // 保留最近 N 天日志
MIN_FILES_TO_KEEP = 5      // 至少保留文件数
COMPRESSION_MODEL = 'ollama/qwen2.5:3b'

Changelog

1.0.0

  • Initial release
  • Auto-compression at 60% threshold
  • Git commit on cleanup

Files

4 total
Select a file
Select a file to preview.

Comments

Loading comments…