Skill flagged โ€” suspicious patterns detected

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

๐Ÿฆ Shrink โ€” Three-Tier Multimodal Context Optimizer

v1.2.0

Replace base64 images in session history with context-aware text descriptions, reducing image token cost by 96-99%. Use when: (1) user says /shrink, /shrink,...

โญ 0ยท 133ยท0 currentยท0 all-time
byJoe Loves Tech@joelovestech

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for joelovestech/shrink.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "๐Ÿฆ Shrink โ€” Three-Tier Multimodal Context Optimizer" (joelovestech/shrink) from ClawHub.
Skill page: https://clawhub.ai/joelovestech/shrink
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Required env vars: ANTHROPIC_API_KEY
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install shrink

ClawHub CLI

Package manager switcher

npx clawhub@latest install shrink
Security Scan
VirusTotalVirusTotal
Benign
View report โ†’
OpenClawOpenClaw
Suspicious
medium confidence
โ„น
Purpose & Capability
Name/description align with required capabilities: the skill needs an Anthropic key and must read/write OpenClaw session JSONL to replace images. Requesting ANTHROPIC_API_KEY and performing vision calls is consistent. Minor mismatch: SKILL.md claims fleet-wide auth auto-discovery across agents, but the code's key discovery is more conservative (defaults to 'main' or skips disk scanning when ANTHROPIC_API_KEY is set).
!
Instruction Scope
The runtime instructions (and code) read session JSONL files, extract up to N preceding messages, and send images plus conversation context to the Anthropic vision API. Sending surrounding conversation (potential PII, secrets, or other sensitive content) to an external API is required for the feature but is a significant privacy surface. The SKILL.md also instructs optionally restarting the gateway and writing modified JSONL files in place โ€” both are destructive/impactful operations that should be explicitly confirmed by the user. The redaction option delegates redaction to the remote model rather than performing local redaction, which may not guarantee removal of secrets before transmission.
โœ“
Install Mechanism
No install spec (instruction + shipped script) โ€” lowest install risk. The single included script uses standard libraries and requests; nothing in the manifest indicates downloading remote archives or running unknown installers.
!
Credentials
Declared requirement is a single ANTHROPIC_API_KEY which is proportional. However, the skill will also read ~/.openclaw/agents/*/agent/auth-profiles.json to discover additional Anthropic tokens if an env key is not set, which may expose other stored tokens. That disk access to auth-profiles.json (and session JSONLs) is broad relative to a trivial 'image shrink' utility and could surface credentials for other agents; the code's behavior (skip disk scan if env key present) partially mitigates this but the SKILL.md wording suggests broader scanning than the code implements.
โ„น
Persistence & Privilege
The skill does not request always:true and is user-invocable only. It will modify session files in place (with .bak backups by default) and can optionally run 'openclaw gateway restart' to apply changes immediately. Those are expected for this functionality but are high-impact actions โ€” allowlisting/autonomous invocation combined with write-and-restart capability increases risk if misused. The SKILL.md says restart is user-initiated only; ensure interactive prompts are enforced in the deployment environment.
What to consider before installing
This skill generally does what it claims: it finds base64 images in OpenClaw session JSONL files, sends the images plus surrounding conversation to an Anthropic vision model, and replaces the raw image blocks with three-tier text descriptions. Before installing or running it, consider the following: (1) Privacy: images and the surrounding messages (possibly containing PII, passwords, keys, or IPs) are sent to an external API. If that is unacceptable, do not run this skill or run it on copies of sessions with sensitive content removed. (2) Credentials on disk: the script may read auth-profiles.json to auto-discover Anthropic tokens for agents โ€” review those files and prefer setting ANTHROPIC_API_KEY in the environment to prevent disk scanning. (3) Backups & testing: always run the --dry-run and keep .bak backups enabled; inspect the JSON output before committing. (4) Redaction: the '--redact' option relies on the remote model to remove secrets โ€” that does not guarantee secrets are never transmitted. If you need strong guarantees, perform local redaction before using the skill. (5) Scope and restart: the skill writes session files in-place and can restart the gateway (global impact) โ€” be prepared for brief downtime and confirm interactive prompts will be enforced in your deployment. (6) Code review: because this is an instruction-only install with a shipped script, review scripts/shrink.py yourself (or run in an isolated environment) to validate behavior and endpoints. If you want lower risk, run it only against targeted session files via --session-file or use an isolated agent account with no sensitive data.

Like a lobster shell, security has layers โ€” review code before you run it.

Runtime requirements

EnvANTHROPIC_API_KEY
latestvk9761b3fdpv27sf4a36km92tk183tv78
133downloads
0stars
6versions
Updated 4w ago
v1.2.0
MIT-0

๐Ÿฆ Shrink โ€” Multimodal Context Optimizer

Replace base64 image blocks in session JSONL with concise, context-aware text descriptions. Images consuming 15,000โ€“25,000+ tokens become ~100 token descriptions โ€” a 99%+ reduction. OpenClaw's built-in pruning explicitly skips images. This is the only tool that solves this.

Interactive Flow

When triggered, present an interactive menu using inline buttons (Telegram/Discord).

Step 1: Scan & Present

Run a dry-run first to show the user what's available:

python3 <skill_dir>/scripts/shrink.py --agent <agentId> --dry-run --json

Parse the JSON output and present:

๐Ÿ” Context Scan Complete

๐Ÿ“Š Found {images_found} images in this session
   โ€ข {images_deduped} duplicates detected
   โ€ข Est. savings: ~{tokens_saved:,} tokens ({savings_percent}%)
   โ€ข Est. cost: ~${estimated_cost_usd:.3f}

Then offer buttons:

  • ๐Ÿš€ Shrink Now โ†’ run without --dry-run
  • ๐Ÿ”Ž Details โ†’ show per-image breakdown from the dry-run
  • โš™๏ธ Options โ†’ show configurable settings

If no images found: "โœ… No unprocessed images found. Session is already optimized!"

Step 2: Execute

On "Shrink Now", run live and keep the user informed with progress updates.

For large runs (10+ images), send a progress message and update it as images complete:

๐Ÿ–ผ๏ธ Shrinking Wayne (36 images)...
โœ… 1/36 โ€” Quicknode dashboard (23K tokens saved)
โœ… 2/36 โ€” โ™ป๏ธ Duplicate (reused)
โœ… 3/36 โ€” Wagyu portfolio (21K tokens saved)
...running total: 68K saved
python3 <skill_dir>/scripts/shrink.py --agent <agentId>

Report the full summary stats when complete.

Step 2b: Apply Changes

After shrinking completes, inform the user that changes are saved to disk but agents still hold old context in memory. Offer to apply immediately:

โš ๏ธ Changes saved to disk. Agents are still using old context in memory.

Present buttons:

  • โšก Apply Now โ†’ run openclaw gateway restart (~5 sec downtime, all agents reload clean)
  • โฐ Apply Later โ†’ changes take effect at next session load (daily reset, /compact, or /reset)

If user chooses "Apply Now", run:

openclaw gateway restart

Then confirm: "โœ… Gateway restarted. All agents now running on shrunk sessions."

Important: Warn that "Apply Now" causes ~5 seconds of downtime for ALL agents, not just the shrunk one.

Step 3: Options (if requested)

Show current settings and let the user adjust:

  • Model: auto (detects key type), claude-sonnet-4-6, claude-haiku-4-5
  • Context depth: 1-10 preceding messages (default: 5)
  • Min tokens: skip images below threshold (default: 500)
  • Scope: this session only, or all sessions

Present buttons:

  • ๐Ÿ“Š All Sessions โ†’ --all-sessions
  • ๐ŸŽฏ This Session โ†’ single session (default)

Variant: /shrink all

When user says "shrink all", "shrink all sessions", or "shrink everything":

python3 <skill_dir>/scripts/shrink.py --agent <agentId> --all-sessions --dry-run --json

Present totals across all sessions, then confirm before running live.

Script Reference

# Basic: current session dry-run
python3 scripts/shrink.py --agent main --dry-run

# Live shrink with all defaults
python3 scripts/shrink.py --agent main

# All sessions for an agent
python3 scripts/shrink.py --agent main --all-sessions

# Specific session file
python3 scripts/shrink.py --session-file path/to/session.jsonl

# Budget-conscious: limit images and use cheaper model
python3 scripts/shrink.py --agent main --max-images 5 --model claude-haiku-4-5

# JSON output for programmatic use
python3 scripts/shrink.py --agent main --all-sessions --json

All Flags

FlagDefaultDescription
--session-fileโ€”Path to specific JSONL file
--agent <id>โ€”Target agent's sessions directory
--all-sessionsoffProcess all JSONL files for the agent
--dry-runoffPreview without modifying
--modelautoVision model (auto-detects from auth type)
--max-images NallLimit to first N images
--min-tokens N500Skip images below token threshold
--context-depth N5Preceding messages for context-aware descriptions
--no-backupoffSkip .bak backup creation
--jsonoffJSON output (suppresses pretty-print)
--no-verboseoffSuppress per-image details

Key Behaviors

  • Idempotent โ€” re-runs skip already-deflated images (marker: [๐Ÿ–ผ๏ธ Image deflated:)
  • Dedup โ€” identical images get one API call, description reused for copies
  • Context-aware โ€” reads preceding messages + user text + agent response for rich descriptions
  • Auth failover โ€” tries API key first (Sonnet), falls back to OAuth (Haiku) automatically
  • Safe โ€” creates .bak backup before writing, gracefully skips failed images
  • Redaction โ€” --redact pii|keys|all strips sensitive data during extraction for compliance

Comments

Loading comments...