Skill flagged β€” suspicious patterns detected

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

🦐 Shrink β€” Three-Tier Multimodal Context Optimizer

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,...

MIT-0 Β· Free to use, modify, and redistribute. No attribution required.
⭐ 0 · 16 · 0 current installs · 0 all-time installs
byJoe Loves Tech@joelovestech
MIT-0
Security Scan
VirusTotalVirusTotal
Suspicious
View report β†’
OpenClawOpenClaw
Benign
medium confidence
βœ“
Purpose & Capability
Name/description claim (replace base64 images with vision-model descriptions to reduce token cost) matches what the SKILL.md and scripts do. Requesting ANTHROPIC_API_KEY and calling api.anthropic.com is appropriate for a vision-based description service. The skill's read/write access to session JSONL files and ability to restart the gateway is proportionate to the stated goal.
β„Ή
Instruction Scope
The SKILL.md and scripts instruct scanning session JSONL files, extracting up to N preceding messages, and sending the image plus surrounding conversation to Anthropic β€” this is necessary for context-aware descriptions but has privacy implications because images and conversational context are transmitted off-host. The instructions also include an optional 'openclaw gateway restart' command to apply changes; this is explicit and user-initiated in the docs. No unexpected system-wide or unrelated file access is instructed beyond session files and agent auth profiles.
βœ“
Install Mechanism
This is an instruction-only skill with a Python script. There is no install spec that downloads or executes arbitrary remote archives. The script uses the 'requests' library and standard file operations; nothing in the repository indicates a risky install mechanism.
β„Ή
Credentials
The only declared required env var is ANTHROPIC_API_KEY, which is appropriate. The script additionally optionally reads OpenClaw auth-profiles.json to auto-discover keys; that behavior is documented but broad (it can read stored auth files). Access to other agents' auth profiles or stored tokens is potentially sensitive β€” the skill uses those to implement 'auth failover' and model selection. The metadata documents this, but users should be aware this expands the set of credentials the tool can access.
βœ“
Persistence & Privilege
The skill does not request always:true and is user-invocable. It writes backups and modifies session JSONL files (explicitly documented), and can optionally restart the gateway when the user chooses. It does not claim to change other skills' configs or require permanent platform presence.
Assessment
This skill appears to do what it says, but it moves images and surrounding conversation off your machine to the Anthropic vision API and will modify session JSONL files in-place (creating .bak files by default). Before installing or running on production data: 1) Review the shrink.py source and test with --dry-run and --json to confirm behavior and outputs. 2) Consider privacy: any sensitive images or text will be transmitted to Anthropic; ensure that is acceptable under your policy. 3) If you do not want the script to read stored credentials, set ANTHROPIC_API_KEY in the environment and verify it doesn't auto-scan auth-profiles (the code documents some auto-discovery behavior). 4) Run on a copy of sessions first to verify idempotency and backups. 5) Note the documented minor inconsistencies (e.g., claims about scanning 'all agents' vs. code that defaults to 'main' unless configured) β€” if fleet-wide key discovery is important, inspect the get_all_api_keys behavior and test it. If you are uncomfortable with sending images or giving the tool access to local auth files, do not install or run it.

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

Current versionv1.1.3
Download zip
latestvk975fsg1bkrk0sxb4trmzcw46n83smzp

License

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

Runtime requirements

EnvANTHROPIC_API_KEY

SKILL.md

🦐 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

Files

5 total
Select a file
Select a file to preview.

Comments

Loading comments…