ad2546

Context Optimizer

AIエージェントv1.0.0
作者:ad2546更新日 2026-05-11context-optimizer@clawhub_ad2546/context-optimizer
プロンプト最適化コンテキスト管理メモリ強化#Context Management#Memory System

AlphaMoatによると、2026-10時点でContext Optimizerのダウンロード数は22,036、スター数は21で、累計ダウンロード数で今回のランキング対象AIスキル10,914件中1,276位、AIエージェントでは1,632件中187位です。

一覧の初期表示は累計ダウンロード数順で、スター数順にも並べ替えできます。詳細ページの順位は累計ダウンロード数で計算しています。

ダウンロード数
2.2万
スター数
21
累計ダウンロード順位
#1,276
全体の上位 12% · AIエージェントの上位 12%
プラットフォームダウンロード数スター数コメント
ClawHub ↗841015-
SkillHub ↗2.2万21—

プラットフォームごとに集計方法と集計時点が異なります。

このスキルでできること

自動圧縮、質問に応じた文脈の選択、意味的な重複の除去、階層化した記憶の保管を提供し、重要な情報を残しつつ文脈のあふれを避けることを狙います。圧縮の方法には、意味の近いメッセージの統合、時間窓ごとの要約、必要な断片だけの読み込みがあります。原文はライセンスを MIT と記載しています。 アーカイブ機能は要約・削除された会話をディスクに保存し、後でプロンプトに戻す場合があります。機密作業では無効にし、取得内容を確認してください。

資料公開日 2026-10-27

できること

  • 長い会話が上限に近づいたとき、早い段階のメッセージを圧縮する。
  • 現在の問いに関係する断片だけを取り出す。

使う場面

  • 文脈が上限に近づき、情報が落ち始めたとき。
  • 大きな文書から必要な部分だけを都度取りたいとき。

プロンプト例

スキルのドキュメントをもとに生成した例であり、実際の実行結果ではありません。

この会話が長すぎるので、早い段階のメッセージを圧縮し、結論と未完了の項目は残してください。
現在の問いに関係する段落だけを選び、文書全体を入れないでください。

月次の推移

ダウンロード数2.2万
71111.5万2.3万2026-03 · ダウンロード数 82172026-05 · ダウンロード数 1万2026-06 · ダウンロード数 1.1万2026-07 · ダウンロード数 1.1万2026-08 · ダウンロード数 1.2万2026-09 · ダウンロード数 1.3万2026-10 · ダウンロード数 2.2万26-0326-0926-10
スター数21
1318222026-03 · スター数 142026-05 · スター数 212026-06 · スター数 212026-07 · スター数 212026-08 · スター数 212026-09 · スター数 212026-10 · スター数 2126-0326-0926-10

2026-09 から集計方法を変更し、同名スキルを作者ごとに分けて集計し、全スキルを対象にしました。破線は変更前の月で、変更後のデータとは直接比較せず、変更をまたぐ増減も計算していません。 同名の別スキルがあるため、変更前のデータは現在ダウンロード数が最も多いこのスキルに帰属させています。

月ダウンロード数前月比スター数
2026-102.2万—21
2026-091.3万—21
2026-081.2万+2.4%21
2026-071.1万+4.1%21
2026-061.1万+4.0%21
2026-051万—21
2026-038217—14

SKILL.md 原文

作者が公開した元のファイルをテキストのまま表示しています。AlphaMoat による編集や審査はしていません。リンクはクリックできません。コマンドは内容を確認してから実行してください。取得日 2026-10-23。

6.2 KB・ClawHub v1.0.0
---
name: context-optimizer
description: Advanced context management with auto-compaction and dynamic context optimization for DeepSeek's 64k context window. Features intelligent compaction (merging, summarizing, extracting), query-aware relevance scoring, and hierarchical memory system with context archive. Logs optimization events to chat.
homepage: https://github.com/clawdbot/clawdbot
metadata:
  clawdbot:
    emoji: "🧠"
    requires:
      bins: []
      npm: ["tiktoken", "@xenova/transformers"]
すべて表示(全 176 行)
    install:
      - id: npm
        kind: npm
        label: Install Context Pruner dependencies
        command: "cd ~/.clawdbot/skills/context-pruner && npm install"
---

# Context Pruner

Advanced context management optimized for DeepSeek's 64k context window. Provides intelligent pruning, compression, and token optimization to prevent context overflow while preserving important information.

## Key Features

- **DeepSeek-optimized**: Specifically tuned for 64k context window
- **Adaptive pruning**: Multiple strategies based on context usage
- **Semantic deduplication**: Removes redundant information
- **Priority-aware**: Preserves high-value messages
- **Token-efficient**: Minimizes token overhead
- **Real-time monitoring**: Continuous context health tracking

## Quick Start

### Auto-compaction with dynamic context:
```javascript
import { createContextPruner } from './lib/index.js';

const pruner = createContextPruner({
  contextLimit: 64000, // DeepSeek's limit
  autoCompact: true,    // Enable automatic compaction
  dynamicContext: true, // Enable dynamic relevance-based context
  strategies: ['semantic', 'temporal', 'extractive', 'adaptive'],
  queryAwareCompaction: true, // Compact based on current query relevance
});

await pruner.initialize();

// Process messages with auto-compaction and dynamic context
const processed = await pruner.processMessages(messages, currentQuery);

// Get context health status
const status = pruner.getStatus();
console.log(`Context health: ${status.health}, Relevance scores: ${status.relevanceScores}`);

// Manual compaction when needed
const compacted = await pruner.autoCompact(messages, currentQuery);
```

### Archive Retrieval (Hierarchical Memory):
```javascript
// When something isn't in current context, search archive
const archiveResult = await pruner.retrieveFromArchive('query about previous conversation', {
  maxContextTokens: 1000,
  minRelevance: 0.4,
});

if (archiveResult.found) {
  // Add relevant snippets to current context
  const archiveContext = archiveResult.snippets.join('\n\n');
  // Use archiveContext in your prompt
  console.log(`Found ${archiveResult.sources.length} relevant sources`);
  console.log(`Retrieved ${archiveResult.totalTokens} tokens from archive`);
}
```

## Auto-Compaction Strategies

1. **Semantic Compaction**: Merges similar messages instead of removing them
2. **Temporal Compaction**: Summarizes older conversations by time windows  
3. **Extractive Compaction**: Extracts key information from verbose messages
4. **Adaptive Compaction**: Chooses best strategy based on message characteristics
5. **Dynamic Context**: Filters messages based on relevance to current query

## Dynamic Context Management

- **Query-aware Relevance**: Scores messages based on similarity to current query
- **Relevance Decay**: Relevance scores decay over time for older conversations
- **Adaptive Filtering**: Automatically filters low-relevance messages
- **Priority Integration**: Combines message priority with semantic relevance

## Hierarchical Memory System

The context archive provides a RAM vs Storage approach:

- **Current Context (RAM)**: Limited (64k tokens), fast access, auto-compacted
- **Archive (Storage)**: Larger (100MB), slower but searchable
- **Smart Retrieval**: When information isn't in current context, efficiently search archive
- **Selective Loading**: Extract only relevant snippets, not entire documents
- **Automatic Storage**: Compacted content automatically stored in archive

## Configuration

```javascript
{
  contextLimit: 64000, // DeepSeek's context window
  autoCompact: true, // Enable automatic compaction
  compactThreshold: 0.75, // Start compacting at 75% usage
  aggressiveCompactThreshold: 0.9, // Aggressive compaction at 90%
  
  dynamicContext: true, // Enable dynamic context management
  relevanceDecay: 0.95, // Relevance decays 5% per time step
  minRelevanceScore: 0.3, // Minimum relevance to keep
  queryAwareCompaction: true, // Compact based on current query relevance
  
  strategies: ['semantic', 'temporal', 'extractive', 'adaptive'],
  preserveRecent: 10, // Always keep last N messages
  preserveSystem: true, // Always keep system messages
  minSimilarity: 0.85, // Semantic similarity threshold
  
  // Archive settings
  enableArchive: true, // Enable hierarchical memory system
  archivePath: './context-archive',
  archiveSearchLimit: 10,
  archiveMaxSize: 100 * 1024 * 1024, // 100MB
  archiveIndexing: true,
  
  // Chat logging
  logToChat: true, // Log optimization events to chat
  chatLogLevel: 'brief', // 'brief', 'detailed', or 'none'
  chatLogFormat: '📊 {action}: {details}', // Format for chat messages
  
  // Performance
  batchSize: 5, // Messages to process in batch
  maxCompactionRatio: 0.5, // Maximum 50% compaction in one pass
}
```

## Chat Logging

The context optimizer can log events directly to chat:

```javascript
// Example chat log messages:
// 📊 Context optimized: Compacted 15 messages → 8 (47% reduction)
// 📊 Archive search: Found 3 relevant snippets (42% similarity)
// 📊 Dynamic context: Filtered 12 low-relevance messages

// Configure logging:
const pruner = createContextPruner({
  logToChat: true,
  chatLogLevel: 'brief', // Options: 'brief', 'detailed', 'none'
  chatLogFormat: '📊 {action}: {details}',
  
  // Custom log handler (optional)
  onLog: (level, message, data) => {
    if (level === 'info' && data.action === 'compaction') {
      // Send to chat
      console.log(`🧠 Context optimized: ${message}`);
    }
  }
});
```

## Integration with Clawdbot

Add to your Clawdbot config:

```yaml
skills:
  context-pruner:
    enabled: true
    config:
      contextLimit: 64000
      autoPrune: true
```

The pruner will automatically monitor context usage and apply appropriate pruning strategies to stay within DeepSeek's 64k limit.

AIエージェントの人気スキル

self-improving agentAIエージェント

開発中の学び、エラー、訂正を Markdown ファイルに記録し、再利用やワークスペースの記憶への昇格に備えます。

↓ 160.3万★ 4544pskoett
技能发现·Find SkillsAIエージェント

やりたいことを自然文で伝えると、ローカルとリモートのカタログからスキルを探して推薦するスキルです。

↓ 157.4万★ 1810桂皮
Agent BrowserAIエージェント

AI エージェント向けのブラウザ自動化コマンドラインスキルです。

↓ 122.3万★ 1001Nicolas Kleiber
Self-Improving + Proactive AgentAIエージェント

利用者の訂正と自己点検を層構造の記憶に蓄え、使われ方に応じて昇格や保管を行うスキルです。

↓ 69.6万★ 1622Iván
Proactive AgentAIエージェント

AI エージェントの先回り、作業記憶、振り返りの手順を計画するためのワークスペース設定ガイドです。

↓ 57.9万★ 916halthelobster
Skill CreatorAIエージェント

効果的な Claude スキルの作成・更新ガイドです。

↓ 47.7万★ 485chindden
Skill VetterAIエージェント

第三者のスキルを入れる前に、出所と権限と危険な作りを手順に沿って調べるスキルです。

↓ 44.5万★ 1328spclaudehome
唐朝诗仙李白 · Ai Agent SkillAIエージェント

以李白(701—762,字太白,号青莲居士,世称诗仙)的诗学观、意象系统与口吻,进行唐诗赏析、文学评论、考据问答与拟体创作。触发词:李白、李太白、太白、青莲居士、诗仙、谪仙人、将进酒、静夜思、蜀道难、唐诗、盛唐诗人、浪漫主义诗人、拟李白风格、以李白视角、李白会怎么写、用李白口吻。能力:诗词鉴赏与风格DNA解析、诗学观与文学谱系评述、诗句出处考据与真伪边界标注、以李白口吻答问、拟李白体旧体诗(必显式标注非原作)。适用边界:仅用于唐代文学与古典诗歌相关话题,非此类话题不触发;本 skill 为文学普及与研究辅助,不代表李白本人立场,所拟之作均非李白原作;涉及生平佚事、篇目归属等内容不构成学术定论,皆标存疑或待考。

↓ 43.6万★ 4user_ff4d9420

データ月:2026-10 · ダウンロード数とスター数は公開スキルレジストリ(ClawHub、SkillHub)から月単位で集計しています。詳しくはデータの方法論をご覧ください。