- Home
- Skills
- Agents & Orchestration
- tokenshield optimizer
Works with the AI Agents you already use
tokenshield optimizer
Reduce LLM prompt and vision tokens by up to 88% using context aliasing and saliency-based image cropping.
Free
tokenshield optimizer
Example session with this skill installed
Run tokenshield_client.py on this screenshot of a React error page and compress this 500-line JSON API response using aggressive mode.
- Read your context and instructions
- Compiled the tokenshield optimizer
I have processed your assets through the TokenShield engine. The vision tokens were reduced by 82% by targeting the error overlay, and the JSON payload was aliased for a 55% reduction.
Token Optimization Report
| Asset Type | Original Size | Optimized Size | Reduction % | Method Used |
|---|---|---|---|---|
| Screenshot (PNG) | 1080p (2.1MB) | 240x180 (ROI) | 88.4% | Saliency Cropping |
| API Response (JSON) | 12,400 tokens | 5,580 tokens | 55.0% | Context Aliasing |
| Total | ~14,200 tokens | ~6,000 tokens | 57.7% | Multi-Modal |
Optimized JSON Context (Aggressive Mode)
{
"ref_schema": "ALISED_01X",
"data": {
"status": 500,
"trace": "REF_STK_772",
"nodes": ["$VAR_A", "$VAR_B", "$VAR_C"]
}
}
Next steps
- Pass the
ALISED_01Xreference into your system prompt for the next reasoning cycle. - Use the cropped ROI image for the final vision inference call to save 0.02c per request.
- Check the local cache directory to see the perceptual hash for this UI state.
Connects securely to your tools. The creator never sees your data.
About this skill
Redundant context and high-resolution screenshots drain your LLM budget and hit rate limits. TokenShield-Optimizer is a pre-inference engine that compresses text prompts and vision assets by up to 88% before they reach the model.
What it does
- Context Aliasing replaces verbose schemas and logs with high-entropy references to save 40-60% on prompt tokens.
- ROI Vision Cropping detects relevant UI regions, like error banners or stack traces, to prune unnecessary pixels.
- Perceptual Hash Caching identifies near-identical frames to eliminate costs on repeated visual states.
- Variable Substitution compresses repetitive code blocks without degrading reasoning accuracy.
How it works
- Target context by providing a raw text payload or a path to a high-resolution screenshot.
- Select a mode between
lossless,balanced, oraggressiveto define the compression intensity. - Execute the client using
tokenshield_client.pyto process the assets locally. - Inject results into your agent's inference call using the optimized output.
Frameworks & tools
The skill uses a Python-based client engine designed for compatibility with Cursor, Claude Code, and Codex. It supports multi-modal models including Claude 3.5 Sonnet, GPT-4o, and Gemini 1.5 Pro.
Why this beats prompting it yourself
Manual prompt engineering cannot dynamically crop images or perform pHash caching at runtime. This skill automates technical token reduction that agents cannot perform on their own context windows.
Use cases
- Reduce costs when sending 4K screenshots to vision models for UI debugging.
- Shrink massive JSON schemas or system logs before agent reasoning tasks.
- Avoid rate limits during long-running autonomous coding sessions.
Known limitations
Requires a local Python environment to run the client script. Optimization results vary based on the entropy of the input text.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.
Requires local Python environment. Compression ratios depend on input redundancy. Vision cropping is optimized for UI elements like banners and traces.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 4 days ago
- Free with an Agensi account