context-optimization
>-
供給アセットの概要
リサーチとナレッジ作業
Deep research, source comparison, literature review, RAG, knowledge search, and reports.
シナリオ
リサーチ Agent
I need my agent to research a topic, compare sources, and produce a concise report.
Agent 適合
Claude Code + CLI + Codex
Codex、Claude Code、Cursor、CLI、またはカスタム Agent に対応します。
インストール
準備完了
npx skills add shipshitdev/skills --skill context-optimization
メンテナンス
新しい
最終プッシュから 2 日
リスク
要レビュー
ライセンスが不明確です
GitHub 品質
33
57/100 品質 · 71/100 信頼
対象タグ
レビュー注記
ライセンスが不明確です · Low GitHub adoption signal
Agent 導入スコアカード
信頼、監査、インストール準備状況を一目で確認
公開リポジトリのメタデータ、OpenAgentSkill のレビューシグナル、保守の鮮度、インストール準備状況を組み合わせたスコアです。候補選定の目安であり、人によるレビューの代替ではありません。
品質
有望有用な候補ですが、採用前に代替と比較してください。
信頼
サンドボックス限定信頼シグナルが不足または混在する有用な候補です。結果ループがタスク適合を示すまで、隔離されたワークスペースで使用してください。
監査
要レビューインストール準備、安全メタデータ、保守、採用リスクの機械可読なレビュー。
OpenAgentSkill Trust Score v5
インストール前に人のレビュー
実作業で使う前に、サンドボックスでのみ実行し、近い代替と比較してください。
スター
GitHub スター 33
リポジトリ活動
スター 33、フォーク 3
メンテナンス
最終プッシュから 2 日
ライセンス
不明
インストール
npx skills add shipshitdev/skills --skill context-optimization
インストール安全性
標準パッケージまたはランタイムのインストールパス
権限範囲
secrets or environment access
Agent の成果
Agent の成果データはまだありません
ドキュメント
Usable metadata, review docs
リスク概要
本番前にレビュー
- ライセンスが不明確です
- Low GitHub adoption signal
- Quality score needs review
- GitHub adoption: 33 GitHub stars
インストール準備状況
インストールパスを利用可能
- インストールパスを利用できます
- リポジトリの根拠を利用できます
- ライセンスが不明確です
- Agent-Proven の成果エビデンスはまだありません
Agent 可読メタデータ
このスキルの機械可読な判断データ。
このブロックまたは埋め込み JSON を使い、Agent がこのスキルをインストールすべきか、代替を選ぶべきか、先に人のレビューを求めるべきかを判断できます。
適したタスク
- Browser automation ワークフロー
- Claude Code チーム
- builders willing to evaluate younger projects
- Navigate pages
適した Agent
インストール判断
- コマンド
- npx skills add shipshitdev/skills --skill context-optimization
- ポリシー
- レビュー
- 人によるレビュー
- はい
信頼とリスク
- 信頼
- 63/100
- 監査
- 74/100
- リスクレベル
- 要レビュー
成果ループ
- エンドポイント
- /api/agent/outcome
- イベント ID
- resolve
- 成果
- 5
インストールコマンド
npx skills add shipshitdev/skills --skill context-optimization使わない場合
- ベンダー提供の SLA が必要なチーム
- production agents without a repository review
- Low GitHub adoption signal
- OpenAgentSkill の利用フィードバックはまだありません
- 高リスク権限のヒント: Secrets or environment access
Agent セーフティ v2
46/100 · 自動インストールを避ける
Sparse or mixed signals. Useful for discovery, but not for autonomous installation.
Test manually in an isolated workspace and compare against safer alternatives.
中
ネットワークアクセス
Skill はリモートページ、API、リポジトリ、外部サービスにアクセスする可能性があります。
高
Secrets or environment access
Skill metadata references credentials, tokens, environment variables, or secret-bearing workflows.
中
データベースアクセス
Skill はスキーマを確認し、データベースを照会し、永続ストアを扱う可能性があります。
- 高リスク権限のヒント: Secrets or environment access
- ライセンスが不明確です
インストール先
Agent ワークフローにこのスキルをインストール
公開インストールエンドポイントからコマンド、安全チェックリスト、対象プロンプト、正規リンクを取得します。
OpenAgentSkill CLI
Resolve policy, run the source installer safely, and report a verified install receipt.
$ npx --yes https://github.com/Leon-Drq/openagentskill/releases/download/cli-v0.2.1/openagentskill-0.2.1.tgz install shipshitdev-context-optimizationAgent 解決プラン
インストール前に Agent に適合性を検証させます。
Resolve API は第一候補、代替、安全ポリシー、監査メモ、インストール先、Agent がそのまま使えるプロンプトを返します。
JSON を開く
/api/agent/resolve?task=Use%20context-optimization%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve テキスト
/api/agent/resolve?task=Use%20context-optimization%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
インストール引き継ぎ
/api/skills/shipshitdev-context-optimization/install
Agent が確認すべきこと
- Resolve API でタスク適合と代替を確認。
- 監査・信頼スコアと安全ポリシーの警告を確認。
- Codex、Claude Code、Cursor、CLI のインストール先互換性を確認。
プロンプトをコピー
Task: Use context-optimization in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20context-optimization%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/shipshitdev-context-optimization/install
Install command: npx skills add shipshitdev/skills --skill context-optimization
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent 引き継ぎ
別のディレクトリではなく、インストール経路を Agent に渡します。
公開インストールエンドポイントからコマンド、安全チェックリスト、対象プロンプト、正規リンクを取得します。
インストール引き継ぎ
/api/skills/shipshitdev-context-optimization/install
LLM テキスト形式
/api/skills/shipshitdev-context-optimization/install?format=text
代替を探す
/api/skills/search?q=context-optimization&limit=3
Agent プロンプト
Use context-optimization for this task. Review https://www.openagentskill.com/api/skills/shipshitdev-context-optimization/install, then install with: npx skills add shipshitdev/skills --skill context-optimizationRegistry メタデータ
自動スキル選択用の Agent 可読プロファイル。
Registry API 経由で判断、信頼、監査、ユースケース、インストールのシグナルを提供し、UI をスクレイピングせずに Agent が順位付けできます。
Manifest
/api/registry/manifest/shipshitdev-context-optimization
LLM テキスト
/api/registry/manifest/shipshitdev-context-optimization?format=text
インストール別名
/api/registry/install/shipshitdev-context-optimization
推奨
/api/registry/recommend?task=Use%20context-optimization%20in%20an%20agent%20workflow&limit=3
Agent 適合
Browser automation
プラットフォーム
Claude Code
Agent 判断パネル
Needs validation for Browser automation
Agent ワークフローに追加する前に手動でリポジトリをレビューしてください。
スタック内の役割
検証が必要
主な適合
Browser automation
信頼ラベル
手動レビューが必要
インストールパス
コマンド準備済み
使う場面
- Browser automation ワークフロー
- Claude Code チーム
- builders willing to evaluate younger projects
根拠
- 最近のリポジトリ活動
- インストールコマンドまたは GitHub リポジトリが利用可能
- 品質プロファイル 57/100
先にレビュー
- Low GitHub adoption signal
- OpenAgentSkill の利用フィードバックはまだありません
実装パス
- 1サンドボックスの Agent にインストールし、Browser automation タスクを一度最初から最後まで実行します。
- 2Compare output quality, latency, and failure behavior against at least one alternative.
- 3Promote it into production only after reviewing repository permissions, license, and maintenance signals.
信頼プロファイル
サンドボックス限定
信頼シグナルが不足または混在する有用な候補です。結果ループがタスク適合を示すまで、隔離されたワークスペースで使用してください。
GitHub 採用度
確認GitHub スター 33
スター/フォーク活動
確認スター 33、フォーク 3; 現在のメタデータでは Issue 活動を利用できません
最近のメンテナンス
合格最終プッシュから 2 日
ライセンスの明確さ
確認不明
良いシグナル
- AI レビュー承認済み
- インストールパスを利用できます
- リポジトリの根拠を利用できます
- 最近保守されたリポジトリ
- インストールコマンドに明確な高リスクパターンはありません
- 成果ループは準備済みですが、最初の実行が必要です
インストール前にレビュー
- ライセンスが不明確です
- Low GitHub adoption signal
- Quality score needs review
- GitHub adoption: 33 GitHub stars
- Stars/forks activity: 33 stars, 3 forks; issue activity unavailable in current metadata
- License clarity: Unknown
- 実際の Agent 成果レポートはまだありません
- 無人インストールの前に人によるレビューが必要です
推奨アクション
実作業で使う前に、サンドボックスでのみ実行し、近い代替と比較してください。
品質プロファイル
有望 Agent ワークフロー向けの候補
有用な候補ですが、採用前に代替と比較してください。
ワークフロー適合
このスキルを使うシナリオ
Operate web apps
Browser automation
I need my agent to control a browser, fill forms, and verify web app workflows.
Investigate faster
Research agents
I need my agent to research a topic, compare sources, and produce a concise report.
Parse messy files
Document processing
I need my agent to read PDFs, extract tables, and turn documents into structured data.
ワークフロー適合
完全なワークフローに追加
Operate and verify web apps
Browser QA agent
A workflow for agents that navigate products, fill forms, take screenshots, and verify real user flows across web applications.
Find, compare, and synthesize
Research report agent
A workflow for agents that gather sources, compare claims, summarize long material, and draft useful research briefs.
Inspect, patch, and verify code
Coding review agent
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
代替候補
インストール前に比較
このタスクに適する可能性のある類似スキル。
UI-TARS Desktop
Run multimodal agents that operate desktop interfaces
MoneyPrinterTurbo
利用AI大模型,一键生成高清短视频 Generate short videos with one click using AI LLM.
Cua
Open-source infrastructure for Computer-Use Agents. Sandboxes, SDKs, and benchmarks to train and evaluate AI agents that can control full desktops (macOS, Linux, Windows).
概要
--- name: context-optimization description: >- Improve context efficiency through context budgeting, observation masking, prefix or KV-cache strategy, partitioning, token-cost reduction, retrieval scoping, and extending effective context capacity without lowering answer quality. Use when token costs or context budgets constrain a task, tool outputs are verbose, cache hit rate is low, or context must be partitioned across agents. metadata: version: "2.1.0" source: https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/blob/main/skills/context-optimization/SKILL.md upstream_repo: muratcankoylan/Agent-Skills-for-Context-Engineering upstream_ref: main upstream_commit: cbc2c978133d last_synced: "2026-06-12" license: MIT tags: "context, optimization, agents" --- # Context Optimization Techniques
Context optimization extends the effective capacity of limited context windows through compression, masking, caching, and partitioning, applied with measurement discipline. The techniques below are ordered by impact and risk.
## When to Activate
- Context budgets or token costs constrain task complexity - Observation masking can replace verbose tool outputs with retrievable references - Prefix or KV-cache hit rate needs improvement - Retrieval scoping can reduce irrelevant loaded context - Context partitioning can extend effective capacity across agents - Budget triggers are needed for masking, compaction, or partitioning
Do not activate this skill for adjacent work owned by other skills:
- Explaining why attention or context windows behave this way: `context-fundamentals`. - Diagnosing active lost-in-middle, poisoning, distraction, confusion, or clash: `context-degradation`.
## Core Concepts
Apply four primary strategies in this priority order:
1. **KV-cache optimization** — Reorder and stabilize prompt structure so the inference engine reuses cached Key/Value tensors. This is the cheapest optimization when the runtime supports prefix caching: low quality risk, immediate cost and latency savings. Apply it first when stable prefixes exist.
2. **Observation masking** — Replace verbose tool outputs with compact references once their purpose has been served. Tool outputs can dominate agent trajectories (claim-context-optimization-tool-output-dominance), so masking often yields the largest capacity gains. The original content remains retrievable if needed downstream.
3. **Compaction** — Summarize accumulated context when utilization exceeds 70%, then reinitialize with the summary. This distills the window's contents while preserving task-critical state. Compaction is lossy — apply it after masking has already removed the low-value bulk.
4. **Context partitioning** — Split work across sub-agents with isolated contexts when a single window cannot hold the full problem. Each sub-agent operates in a clean context focused on its subtask. Reserve this for tasks where estimated context exceeds 60% of the window limit, because coordination overhead is real.
The governing principle: context quality matters more than quantity. Every optimization preserves signal while reducing noise. Measure before optimizing, then measure the optimization's effect.
## Detailed Topics
### Compaction Strategies
Trigger compaction when context utilization exceeds 70%: summarize the current context, then reinitialize with the summary. This distills the window's contents in a high-fidelity manner, enabling continuation with minimal performance degradation. Prioritize compressing tool outputs first (they consume 80%+ of tokens), then old conversation turns, then retrieved documents. Never compress the system prompt — it anchors model behavior and its removal causes unpredictable degradation.
Preserve different elements by message type:
- **Tool outputs**: Extract key findings, metrics, error codes, and conclusions. Strip verbose raw output, stack traces (unless debugging is ongoing), and boilerplate headers. - **Conversational turns**: Retain decisions, commitments, user preferences, and context shifts. Remove filler, pleasantries, and exploratory back-and-forth that led to a conclusion already captured. - **Retrieved documents**: Keep claims, facts, and data points relevant to the active task. Remove supporting evidence and elaboration that served a one-time reasoning purpose.
Target 50-70% token reduction with less than 5% quality degradation. If compaction exceeds 70% reduction, audit the summary for critical information loss — over-aggressive compaction is the most common failure mode.
### Observation Masking
Mask observations selectively based on recency and ongoing relevance — not uniformly. Apply these rules:
- **Never mask**: Observations critical to the current task, observations from the most recent turn, observations used in active reasoning chains, and error outputs when debugging is in progress. - **Mask after 3+ turns**: Verbose outputs whose key points have already been extracted into the conversation flow. Replace with a compact reference: `[Obs:{ref_id} elided. Key: {summary}. Full content retrievable.]` - **Always mask immediately**: Repeated/duplicate outputs, boilerplate headers and footers, outputs already summarized earlier in the conversation.
Masking should achieve 60-80% reduction in masked observations with less than 2% quality impact. The key is maintaining retrievability — store the full content externally and keep the reference ID in context so the agent can request the original if needed.
### KV-Cache Optimization
Maximize prefix cache hits by structuring prompts so that stable content occupies the prefix and dynamic content appears at the end. KV-cache stores Key and Value tensors computed during inference; when consecutive requests share an identical prefix, the cached tensors are reused, saving both cost and latency.
Apply this ordering in every prompt:
1. System prompt (most stable — never changes within a session) 2. Tool definitions (stable across requests) 3. Frequently reused templates and few-shot examples 4. Conversation history (grows but shares prefix with prior turns) 5. Current query and dynamic content (least stable — always last)
Design prompts for cache stability: remove timestamps, session counters, and request IDs from the system prompt. Move dynamic metadata into a separate user message or tool result where it does not break the prefix. Even a single whitespace change in the prefix invalidates the entire cached block downstream of that change.
Target 70%+ cache hit rate for stable workloads. At scale, this translates to 50%+ cost reduction and 40%+ latency reduction on cached tokens.
### Context Partitioning
Partition work across sub-agents when a single context cannot hold the full problem without triggering aggressive compaction. Each sub-agent operates in a clean, focused context for its subtask, then returns a structured result to a coordinator agent.
Plan partitioning when estimated task context exceeds 60% of the window limit. Decompose the task into independent subtasks, assign each to a sub-agent, and aggregate results. Validate that all partitions completed before merging, merge compatible results, and apply summarization if the aggregated output still exceeds budget.
This approach achieves separation of concerns — detailed search context stays isolated within sub-agents while the coordinator focuses on synthesis. However, coordination has real token cost: the coordinator prompt, result aggregation, and error handling all consume tokens. Only partition when the savings exceed this overhead.
### Budget Management
Allocate explicit token budgets across context categories before the session begins: system prompt, tool definitions, retrieved documents, message history, tool outputs, and a reserved buffer (5-10% of total). Monitor usage against budget continuously and trigger optimization when any category exceeds its allocation or total utilization crosses 70%.
Use trigger-based optimization rather than periodic optimization. Monitor these signals:
- Token utilization above 80% — trigger compaction - Attention degradation indicators (repetition, missed instructions) — trigger masking + compaction - Quality score drops below baseline — audit context composition before optimizing
## Practical Guidance
### Optimization Decision Framework
Select the optimization technique based on what dominates the context:
| Context Composition | First Action | Second Action | |---|---|---| | Tool outputs dominate (>50%) | Observation masking | Compaction of remaining turns | | Retrieved documents dominate | Summarization | Partitioning if docs are independent | | Message history dominates | Compaction with selective preservation | Partitioning for new subtasks | | Multiple components contribute | KV-cache optimization first, then layer masking + compaction | — | | Near-limit with active debugging | Mask resolved tool outputs only — preserve error details | — |
### Performance Targets
Track these metrics to validate optimization effectiveness:
- **Compaction**: 50-70% token reduction, <5% quality degradation, <10% latency overhead from the compaction step itself - **Masking**: 60-80% reduction in masked observations, <2% quality impact, near-zero latency overhead - **Cache optimization**: 70%+ hit rate for stable workloads, 50%+ cost reduction, 40%+ latency reduction - **Partitioning**: Net token savings after accounting for coordinator overhead; break-even typically requires 3+ subtasks
Iterate on strategies based on measured results. If an optimization technique does not measurably improve the target metric, remove it — optimization machinery itself consumes tokens and adds latency.
## Examples
**Example 1: Compaction Trigger**
```python if context_tokens / context_limit > 0.8: context = compact_context(context) ```
**Example 2: Observation Masking**
```python if len(observation) > max_length: ref_id = store_observation(observation) return f"[Obs:{ref_id} elided. Key: {extract_key(observation)}]" ```
**Example 3: Cache-Friendly Ordering**
```python # Stable content first context = [system_prompt, tool_definitions] # Cacheable context += [reused_templates] # Reusable context += [unique_content] # Unique ```
**Example 4: Budget-triggered optimization policy**
```yaml budgets: tool_outputs: 35% message_history: 30% retrieved_documents: 20% reserved_buffer: 15% triggers: tool_outputs_over_budget: mask resolved observations total_context_over_70_percent: compact message history repeated_irrelevant_retrievals: tighten retrieval scope ```
## Guidelines
1. Measure before optimizing—know your current state 2. Apply masking before compaction — remove low-value bulk first, then summarize what remains 3. Design for cache stability with consistent prompts 4. Partition before context becomes problematic 5. Monitor optimization effectiveness over time 6. Balance token savings against quality preservation 7. Test optimization at production scale 8. Implement graceful degradation for edge cases
## Gotchas
1. **Whitespace breaks KV-cache**: Even a single whitespace or newline change in the prompt prefix invalidates the entire KV-cache block downstream of that point. Pin system prompts as immutable strings — do not interpolate timestamps, version numbers, or session IDs into them. Diff prompt templates byte-for-byte between deployments.
2. **Timestamps in system prompts destroy cache hit rates**: Including `Current date: {today}` or similar dynamic content in the system prompt forces a full cache miss on every new day (or every request, if using time-of-day). Move dynamic metadata into a user message or a separate tool result appended after the stable prefix.
3. **Compaction under pressure loses critical state**: When the model performing compaction is itself under context pressure (>85% utilization), its summarization quality degrades — it omits task goals, drops user co
技術詳細
- バージョン
- 1.0.0
- ライセンス
- Unknown
- 最終更新
- 2026年8月23日
- 公開日
- 2026年8月23日
判断の要約
検証が必要
最近のリポジトリ活動
Agent 実証エビデンス
Agent 実証エビデンス
Resolve、レビュー、インストール、限定実行後の成果レポート。
- 成功率
- —
- 直近の失敗
- —
- 成果
- 0
- 出力品質
- —
- 失敗
- 0
- 非該当
- 0
- インストール数
- 0
- リスクによりブロック
- 0
- 設定が必要
- 0
- 本番
- 0
Agent の実行結果はまだありません。最初の実行では /api/agent/outcome を通じて成功、設定要件、リスクによるブロック、失敗、非該当を報告できます。
成長ループ
共有キット
context-optimization 用のシナリオベース草案です。X へ手動投稿できます。
A practical pick for a repeatable workflow: context-optimization: >- 33 stars https://www.openagentskill.com/skills/shipshitdev-context-optimization?ref=x
任意:インストールコマンド付きの返信
Listing + install path for context-optimization: https://www.openagentskill.com/skills/shipshitdev-context-optimization?ref=x Install: npx skills add shipshitdev/skills --skill context-optimization
掲載元
Registry により登録
この掲載は公開ソースから登録されており、メンテナー申請が承認されるまで公式として表示されません。
- 作成者
- shipshitdev
- インデックス作成者
- OpenAgentSkill コミュニティインデックス
帰属は公開リポジトリまたは作成者プロフィールにリンクされています。作成者は掲載を申請して所有権シグナルを更新できます。
このスキルを申請所有者の申請
このスキル掲載を申請
この Registry により登録 掲載は shipshitdev に帰属していますが、まだ公式として表示されていません。申請すると、確認済み所有者シグナルが追加され、今後の公開、インストール、監査更新の信頼性が高まります。
クリエイター被リンクキット
README にエビデンスバッジを追加
開発者がリポジトリを評価する場所で、正規掲載、現在の信頼・監査シグナル、実際の Agent-Proven エビデンスを表示します。
[](https://www.openagentskill.com/skills/shipshitdev-context-optimization)
[](https://www.openagentskill.com/skills/shipshitdev-context-optimization)
[](https://www.openagentskill.com/skills/shipshitdev-context-optimization/audit)
[](https://www.openagentskill.com/skills/shipshitdev-context-optimization)作者
shipshitdev
@shipshitdev
プラットフォーム適合
健全性シグナル
- GitHub スター
- 33
- 品質スコア
- 34/100
- 最終 GitHub プッシュ
- 2026年8月20日
- フレームワークのヒント
- 不明
- OpenAgentSkill 閲覧数
- 0
- インストールコピー数
- 0
- 外部クリック
- 0
コミュニティシグナル
このスキルが Agent ワークフローに役立つかを共有してください。集約されたフィードバックがランキングを改善します。
信頼と安全性
サンドボックス限定
- GitHub 採用度GitHub スター 33確認
- スター/フォーク活動スター 33、フォーク 3; 現在のメタデータでは Issue 活動を利用できません確認
- 最近のメンテナンス最終プッシュから 2 日合格
- ライセンスの明確さ不明確認
- README/SKILL.md の完全性公開メタデータにはより十分な README/SKILL.md の文脈が必要です情報
- 依存関係/ランタイムのリスク認証情報または環境変数アクセス情報
関連スキル
UI-TARS Desktop
Run multimodal agents that operate desktop interfaces
37.0K スターMoneyPrinterTurbo
利用AI大模型,一键生成高清短视频 Generate short videos with one click using AI LLM.
88.5K スターCua
Open-source infrastructure for Computer-Use Agents. Sandboxes, SDKs, and benchmarks to train and evaluate AI agents that can control full desktops (macOS, Linux, Windows).
21.4K スター