Shadows Context Optimizer

Token and context window optimization — compact prompts, reduce redundancy, prioritize critical context. Use when hitting context limits or to improve agent...

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 136 · 0 current installs · 0 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Suspicious
medium confidence
Purpose & Capability
The name/description (context/token optimization) align with the guidance in SKILL.md: compacting prompts, summarization, selective file reads, and subagent delegation are appropriate techniques for that purpose.
!
Instruction Scope
The PREREQUISITES and SECURITY CONSIDERATIONS sections assert the skill is 'advisory' and 'does not execute commands, read files, make network calls, modify configuration, or store data.' Yet the Techniques and Principles explicitly instruct the agent to 'Read file.py lines 45-80', 'grep specific directories', and 'spawn a subagent for codebase exploration.' Those operations involve accessing files and tools and could cause the agent to read or transmit data. The instructions are also somewhat open-ended (e.g., 'use subagents', '3-search maximum') giving the agent broad discretion about when and how to access data.
Install Mechanism
Instruction-only skill with no install spec and no code files — low installation risk (nothing is written/downloaded).
Credentials
The skill requests no environment variables, credentials, or config paths. Its listed requirements are proportional to its stated advisory purpose.
Persistence & Privilege
Skill is not always-enabled and is user-invocable. It does not request persistent presence or modify other skills' configs. Note: the SKILL.md encourages spawning subagents and changing agent behavior at runtime — autonomous invocation is platform-default, so this is not flagged alone but should be considered when enabling the skill.
What to consider before installing
This skill appears to be a sensible advisory guide for reducing token usage, but its documentation contradicts itself: it claims 'no file access' while telling the agent to read specific file ranges, grep directories, and spawn subagents. Before installing or enabling it widely, consider: 1) Do you trust the agent to read project files? If not, limit the agent's tool/file access or run the skill only in a sandboxed session. 2) Ask the publisher to clarify the contradiction and to provide explicit, safe patterns for file access (e.g., require explicit user approval before reading files). 3) Monitor/log file reads and network calls when you first use the skill. 4) If you want stricter control, keep the skill disabled by default and enable it only for sessions where selective file access and subagent spawning are acceptable.

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

Current versionv1.1.0
Download zip
latestvk971xyq7m2sd6b38rayqp6bsah82fxtm

License

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

Runtime requirements

Clawdis
OSmacOS · Linux · Windows

SKILL.md

Context Optimizer — Token Economy Protocol

Version: 1.1.0 | Author: Shadows Company | License: MIT


WHEN TO TRIGGER

  • Context window approaching capacity (>70% usage)
  • Agent responses becoming slower or less coherent
  • User says "optimize context", "compact", "reduce tokens"
  • Working with very large codebases
  • Multi-file operations causing context bloat

WHEN NOT TO TRIGGER

  • Short conversations with plenty of context remaining
  • Simple single-file operations

PREREQUISITES

No binaries required. This is a pure reasoning skill about optimizing context window usage. It provides strategies and patterns — it does not execute commands or access external systems.


PRINCIPLES

1. Reference Over Inline

Instead of reading entire files into context, reference them:

  • "The auth module at src/auth/index.ts handles..." instead of pasting 500 lines
  • Read only the specific functions/sections needed
  • Use line ranges: Read file.py lines 45-80 instead of the whole file

2. DRY Prompts — Zero Duplication

  • Never repeat information already in system context
  • Don't re-describe tools you already know about
  • Don't re-state project conventions that are in CLAUDE.md/SOUL.md
  • If a fact was established earlier, reference it, don't restate it

3. Lazy-Load Strategy

  • Load detailed context only when needed for the current task
  • Use subagents/sub-tasks for exploration (protects main context)
  • Delegate research to agents, keep main context for execution

4. Smart File Reading

WRONG: Read the entire 2000-line file
RIGHT: Read lines 150-200 where the function is defined

WRONG: Read all 15 config files
RIGHT: Read only the config relevant to current task

WRONG: Grep the entire codebase for "import"
RIGHT: Grep specific directories for specific patterns

5. Output Compression

When reporting results:

  • Lead with the answer, not the reasoning
  • Skip filler words and unnecessary transitions
  • Use tables for comparative data
  • Use bullet points for lists, not paragraphs

TECHNIQUES

Technique 1 — Context Audit

Assess current context usage:

  1. Count how many files have been read in this session
  2. Identify which file contents are still relevant to the current task
  3. Determine what information can be summarized instead of kept verbatim
  4. Flag redundant tool results that repeat already-known information

Technique 2 — Compaction

When context is high:

  1. Summarize completed work (keep outcomes, drop process details)
  2. Drop file contents that are no longer needed for the active task
  3. Keep only active task context in working memory
  4. Preserve critical state: decisions made, errors encountered, current objectives

Technique 3 — Subagent Delegation

For research-heavy tasks:

  1. Spawn a subagent for codebase exploration
  2. Subagent returns only findings (not raw file contents)
  3. Main context stays clean for implementation
  4. Multiple subagents can run in parallel for independent queries

Technique 4 — Structured Responses

WRONG (100 tokens):
"I've looked at the file and after careful analysis I believe that
the issue is related to the authentication middleware where the
token validation function doesn't properly handle expired tokens."

RIGHT (30 tokens):
"Bug: `validateToken()` in auth middleware doesn't handle expired
tokens. Fix: add expiry check at line 45."

ANTI-PATTERNS TO AVOID

Anti-PatternFix
Reading whole files when you need 10 linesUse offset + limit
Listing all MCP serversAgent already knows them
Repeating deny rulesAlready in settings
Describing the OS/environmentAlready in system context
Re-reading files read earlierSummarize and reference
Multiple searches for one queryOne well-crafted search
Verbose status updatesConcise milestone updates

RULES

  1. Minimum viable context — load only what's needed NOW
  2. Summarize, don't accumulate — compress completed work
  3. Delegate exploration — use subagents for research
  4. Direct answers — skip preamble, lead with the point
  5. 3-search maximum — never use more than 3 search tools for one query

SECURITY CONSIDERATIONS

This skill is purely advisory — it provides strategies for token optimization. It does not execute commands, read files, make network calls, modify configuration, or store data. Zero risk profile.

  • Commands executed: None
  • Data read: None (advisory reasoning only)
  • Network access: None
  • Persistence: None
  • Credentials: None required
  • File modification: None

OUTPUT FORMAT

Apply the techniques above inline during agent operation. No separate report is generated — the skill manifests as improved efficiency in the agent's behavior: shorter responses, fewer tool calls, targeted file reads, and minimal context consumption.


Published by Shadows Company — "We work in the shadows to serve the Light."

Files

1 total
Select a file
Select a file to preview.

Comments

Loading comments…