首页龙虾技能列表 › Shadows Context Optimizer — Shadows 上下文优化器

Shadows Context Optimizer — Shadows 上下文优化器

v1.1.0

Shadows 上下文优化器工具。

0· 243·1 当前·1 累计
by @nakedoshadow (NakedoShadow)·MIT-0
下载技能包 项目主页
License
MIT-0
最后更新
2026/3/7
安全扫描
VirusTotal
无害
查看报告
OpenClaw
可疑
medium confidence
The skill's purpose (token/context optimization) matches its instructions, but the SKILL.md contains internal contradictions and grants the agent broad discretion (file reads, greps, spawning subagents) despite claiming 'zero risk'—this mismatch warrants caution.
评估建议
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 explici...
详细分析 ▾
用途与能力
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.
指令范围
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.
安装机制
Instruction-only skill with no install spec and no code files — low installation risk (nothing is written/downloaded).
凭证需求
The skill requests no environment variables, credentials, or config paths. Its listed requirements are proportional to its stated advisory purpose.
持久化与权限
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.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

🖥️ OSmacOS · Linux · Windows

版本

latestv1.1.02026/3/7

Initial HIGH TRUST release

● 无害

安装命令 点击复制

官方npx clawhub@latest install shadows-context-optimizer
镜像加速npx clawhub@latest install shadows-context-optimizer --registry https://cn.clawhub-mirror.com

技能文档

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/索引.ts handles..." 代替 的 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 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. 输出 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-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

  • 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."

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务