⚡ Shadows Context Optimizer — Shadows 上下文优化器
v1.1.0Shadows 上下文优化器工具。
详细分析 ▾
运行时依赖
版本
Initial HIGH TRUST release
安装命令 点击复制
技能文档
Version: 1.1.0 | Author: Shadows Company | License: MIT
当...时 到 TRIGGER
- Context window approaching capacity (>70% usage)
- Agent responses becoming slower 或 更少 coherent
- 用户 says "optimize context", "compact", "归约 tokens"
- Working 带有 very large codebases
- Multi-file operations causing context bloat
当...时 不 到 TRIGGER
- Short conversations 带有 plenty 的 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 在...上 Inline
Instead of reading entire files into context, reference them:
- " auth 模块 在
src/auth/索引.tshandles..." 代替 的 pasting 500 lines - 读取 仅 specific functions/sections needed
- 使用 line ranges:
读取 file.py lines 45-80代替 的 whole file
2. DRY Prompts — Zero Duplication
- Never repeat information 已经 在...中 system context
- Don't re-describe tools 您 已经 know 关于
- Don't re-state project conventions 在...中 CLAUDE.md/SOUL.md
- 如果 fact 是 established earlier, reference , don't restate
3. Lazy-加载 Strategy
- 加载 detailed context 仅 当...时 needed 对于 current task
- 使用 subagents/sub-tasks 对于 exploration (protects main context)
- Delegate research 到 agents, keep main context 对于 execution
4. Smart File Reading
WRONG: Read the entire 2000-line file
RIGHT: Read lines 150-200 where the function is definedWRONG: 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. 输出 Compression
When reporting results:
- Lead 带有 answer, 不 reasoning
- Skip filler words 和 unnecessary transitions
- 使用 tables 对于 comparative data
- 使用 bullet points 对于 lists, 不 paragraphs
TECHNIQUES
Technique 1 — Context Audit
Assess current context usage:
- 计数 如何 many files 有 已 读取 在...中 会话
- Identify 哪个 file contents 仍然 relevant 到 current task
- Determine 什么 information 可以 summarized 代替 的 kept verbatim
- 标志 redundant tool results repeat 已经-known information
Technique 2 — Compaction
When context is high:
- Summarize 已完成 work (keep outcomes, drop process details)
- Drop file contents 否 longer needed 对于 活跃 task
- Keep 仅 活跃 task context 在...中 working memory
- Preserve critical state: decisions made, errors encountered, current objectives
Technique 3 — Subagent Delegation
For research-heavy tasks:
- Spawn subagent 对于 codebase exploration
- Subagent returns 仅 findings (不 raw file contents)
- Main context stays clean 对于 implementation
- Multiple subagents 可以 run 在...中 parallel 对于 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 到 AVOID
| Anti-Pattern | Fix |
|---|---|
| Reading whole files when you need 10 lines | Use offset + limit |
| Listing all MCP servers | Agent already knows them |
| Repeating deny rules | Already in settings |
| Describing the OS/environment | Already in system context |
| Re-reading files read earlier | Summarize and reference |
| Multiple searches for one query | One well-crafted search |
| Verbose status updates | Concise milestone updates |
RULES
- Minimum viable context — 加载 仅 什么's needed 现在
- Summarize, don't accumulate — compress 已完成 work
- Delegate exploration — 使用 subagents 对于 research
- Direct answers — skip preamble, lead 带有 point
- 3-搜索 maximum — never 使用 更多 比 3 搜索 tools 对于 one 查询
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: 无
- Data 读取: 无 (advisory reasoning 仅)
- Network access: 无
- Persistence: 无
- Credentials: 无 必填
- File modification: 无
输出 格式
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 由 Shadows Company — "我们 work 在...中 shadows 到 serve Light."
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制