{
  "schemaVersion": "1.0",
  "item": {
    "slug": "context-optimizer",
    "name": "Context Optimizer",
    "source": "tencent",
    "type": "skill",
    "category": "通讯协作",
    "sourceUrl": "https://clawhub.ai/ad2546/context-optimizer",
    "canonicalUrl": "https://clawhub.ai/ad2546/context-optimizer",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/context-optimizer",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=context-optimizer",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "chat-logger.js",
      "SUMMARY.md",
      "INSTALL.md",
      "README.md",
      "package.json",
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "slug": "context-optimizer",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-29T15:23:05.820Z",
      "expiresAt": "2026-05-06T15:23:05.820Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=context-optimizer",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=context-optimizer",
        "contentDisposition": "attachment; filename=\"context-optimizer-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "context-optimizer"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/context-optimizer"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/context-optimizer",
    "agentPageUrl": "https://openagent3.xyz/skills/context-optimizer/agent",
    "manifestUrl": "https://openagent3.xyz/skills/context-optimizer/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/context-optimizer/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Context Pruner",
        "body": "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."
      },
      {
        "title": "Key Features",
        "body": "DeepSeek-optimized: Specifically tuned for 64k context window\nAdaptive pruning: Multiple strategies based on context usage\nSemantic deduplication: Removes redundant information\nPriority-aware: Preserves high-value messages\nToken-efficient: Minimizes token overhead\nReal-time monitoring: Continuous context health tracking"
      },
      {
        "title": "Auto-compaction with dynamic context:",
        "body": "import { createContextPruner } from './lib/index.js';\n\nconst pruner = createContextPruner({\n  contextLimit: 64000, // DeepSeek's limit\n  autoCompact: true,    // Enable automatic compaction\n  dynamicContext: true, // Enable dynamic relevance-based context\n  strategies: ['semantic', 'temporal', 'extractive', 'adaptive'],\n  queryAwareCompaction: true, // Compact based on current query relevance\n});\n\nawait pruner.initialize();\n\n// Process messages with auto-compaction and dynamic context\nconst processed = await pruner.processMessages(messages, currentQuery);\n\n// Get context health status\nconst status = pruner.getStatus();\nconsole.log(`Context health: ${status.health}, Relevance scores: ${status.relevanceScores}`);\n\n// Manual compaction when needed\nconst compacted = await pruner.autoCompact(messages, currentQuery);"
      },
      {
        "title": "Archive Retrieval (Hierarchical Memory):",
        "body": "// When something isn't in current context, search archive\nconst archiveResult = await pruner.retrieveFromArchive('query about previous conversation', {\n  maxContextTokens: 1000,\n  minRelevance: 0.4,\n});\n\nif (archiveResult.found) {\n  // Add relevant snippets to current context\n  const archiveContext = archiveResult.snippets.join('\\n\\n');\n  // Use archiveContext in your prompt\n  console.log(`Found ${archiveResult.sources.length} relevant sources`);\n  console.log(`Retrieved ${archiveResult.totalTokens} tokens from archive`);\n}"
      },
      {
        "title": "Auto-Compaction Strategies",
        "body": "Semantic Compaction: Merges similar messages instead of removing them\nTemporal Compaction: Summarizes older conversations by time windows\nExtractive Compaction: Extracts key information from verbose messages\nAdaptive Compaction: Chooses best strategy based on message characteristics\nDynamic Context: Filters messages based on relevance to current query"
      },
      {
        "title": "Dynamic Context Management",
        "body": "Query-aware Relevance: Scores messages based on similarity to current query\nRelevance Decay: Relevance scores decay over time for older conversations\nAdaptive Filtering: Automatically filters low-relevance messages\nPriority Integration: Combines message priority with semantic relevance"
      },
      {
        "title": "Hierarchical Memory System",
        "body": "The context archive provides a RAM vs Storage approach:\n\nCurrent Context (RAM): Limited (64k tokens), fast access, auto-compacted\nArchive (Storage): Larger (100MB), slower but searchable\nSmart Retrieval: When information isn't in current context, efficiently search archive\nSelective Loading: Extract only relevant snippets, not entire documents\nAutomatic Storage: Compacted content automatically stored in archive"
      },
      {
        "title": "Configuration",
        "body": "{\n  contextLimit: 64000, // DeepSeek's context window\n  autoCompact: true, // Enable automatic compaction\n  compactThreshold: 0.75, // Start compacting at 75% usage\n  aggressiveCompactThreshold: 0.9, // Aggressive compaction at 90%\n  \n  dynamicContext: true, // Enable dynamic context management\n  relevanceDecay: 0.95, // Relevance decays 5% per time step\n  minRelevanceScore: 0.3, // Minimum relevance to keep\n  queryAwareCompaction: true, // Compact based on current query relevance\n  \n  strategies: ['semantic', 'temporal', 'extractive', 'adaptive'],\n  preserveRecent: 10, // Always keep last N messages\n  preserveSystem: true, // Always keep system messages\n  minSimilarity: 0.85, // Semantic similarity threshold\n  \n  // Archive settings\n  enableArchive: true, // Enable hierarchical memory system\n  archivePath: './context-archive',\n  archiveSearchLimit: 10,\n  archiveMaxSize: 100 * 1024 * 1024, // 100MB\n  archiveIndexing: true,\n  \n  // Chat logging\n  logToChat: true, // Log optimization events to chat\n  chatLogLevel: 'brief', // 'brief', 'detailed', or 'none'\n  chatLogFormat: '📊 {action}: {details}', // Format for chat messages\n  \n  // Performance\n  batchSize: 5, // Messages to process in batch\n  maxCompactionRatio: 0.5, // Maximum 50% compaction in one pass\n}"
      },
      {
        "title": "Chat Logging",
        "body": "The context optimizer can log events directly to chat:\n\n// Example chat log messages:\n// 📊 Context optimized: Compacted 15 messages → 8 (47% reduction)\n// 📊 Archive search: Found 3 relevant snippets (42% similarity)\n// 📊 Dynamic context: Filtered 12 low-relevance messages\n\n// Configure logging:\nconst pruner = createContextPruner({\n  logToChat: true,\n  chatLogLevel: 'brief', // Options: 'brief', 'detailed', 'none'\n  chatLogFormat: '📊 {action}: {details}',\n  \n  // Custom log handler (optional)\n  onLog: (level, message, data) => {\n    if (level === 'info' && data.action === 'compaction') {\n      // Send to chat\n      console.log(`🧠 Context optimized: ${message}`);\n    }\n  }\n});"
      },
      {
        "title": "Integration with Clawdbot",
        "body": "Add to your Clawdbot config:\n\nskills:\n  context-pruner:\n    enabled: true\n    config:\n      contextLimit: 64000\n      autoPrune: true\n\nThe pruner will automatically monitor context usage and apply appropriate pruning strategies to stay within DeepSeek's 64k limit."
      }
    ],
    "body": "Context Pruner\n\nAdvanced context management optimized for DeepSeek's 64k context window. Provides intelligent pruning, compression, and token optimization to prevent context overflow while preserving important information.\n\nKey Features\nDeepSeek-optimized: Specifically tuned for 64k context window\nAdaptive pruning: Multiple strategies based on context usage\nSemantic deduplication: Removes redundant information\nPriority-aware: Preserves high-value messages\nToken-efficient: Minimizes token overhead\nReal-time monitoring: Continuous context health tracking\nQuick Start\nAuto-compaction with dynamic context:\nimport { createContextPruner } from './lib/index.js';\n\nconst pruner = createContextPruner({\n  contextLimit: 64000, // DeepSeek's limit\n  autoCompact: true,    // Enable automatic compaction\n  dynamicContext: true, // Enable dynamic relevance-based context\n  strategies: ['semantic', 'temporal', 'extractive', 'adaptive'],\n  queryAwareCompaction: true, // Compact based on current query relevance\n});\n\nawait pruner.initialize();\n\n// Process messages with auto-compaction and dynamic context\nconst processed = await pruner.processMessages(messages, currentQuery);\n\n// Get context health status\nconst status = pruner.getStatus();\nconsole.log(`Context health: ${status.health}, Relevance scores: ${status.relevanceScores}`);\n\n// Manual compaction when needed\nconst compacted = await pruner.autoCompact(messages, currentQuery);\n\nArchive Retrieval (Hierarchical Memory):\n// When something isn't in current context, search archive\nconst archiveResult = await pruner.retrieveFromArchive('query about previous conversation', {\n  maxContextTokens: 1000,\n  minRelevance: 0.4,\n});\n\nif (archiveResult.found) {\n  // Add relevant snippets to current context\n  const archiveContext = archiveResult.snippets.join('\\n\\n');\n  // Use archiveContext in your prompt\n  console.log(`Found ${archiveResult.sources.length} relevant sources`);\n  console.log(`Retrieved ${archiveResult.totalTokens} tokens from archive`);\n}\n\nAuto-Compaction Strategies\nSemantic Compaction: Merges similar messages instead of removing them\nTemporal Compaction: Summarizes older conversations by time windows\nExtractive Compaction: Extracts key information from verbose messages\nAdaptive Compaction: Chooses best strategy based on message characteristics\nDynamic Context: Filters messages based on relevance to current query\nDynamic Context Management\nQuery-aware Relevance: Scores messages based on similarity to current query\nRelevance Decay: Relevance scores decay over time for older conversations\nAdaptive Filtering: Automatically filters low-relevance messages\nPriority Integration: Combines message priority with semantic relevance\nHierarchical Memory System\n\nThe context archive provides a RAM vs Storage approach:\n\nCurrent Context (RAM): Limited (64k tokens), fast access, auto-compacted\nArchive (Storage): Larger (100MB), slower but searchable\nSmart Retrieval: When information isn't in current context, efficiently search archive\nSelective Loading: Extract only relevant snippets, not entire documents\nAutomatic Storage: Compacted content automatically stored in archive\nConfiguration\n{\n  contextLimit: 64000, // DeepSeek's context window\n  autoCompact: true, // Enable automatic compaction\n  compactThreshold: 0.75, // Start compacting at 75% usage\n  aggressiveCompactThreshold: 0.9, // Aggressive compaction at 90%\n  \n  dynamicContext: true, // Enable dynamic context management\n  relevanceDecay: 0.95, // Relevance decays 5% per time step\n  minRelevanceScore: 0.3, // Minimum relevance to keep\n  queryAwareCompaction: true, // Compact based on current query relevance\n  \n  strategies: ['semantic', 'temporal', 'extractive', 'adaptive'],\n  preserveRecent: 10, // Always keep last N messages\n  preserveSystem: true, // Always keep system messages\n  minSimilarity: 0.85, // Semantic similarity threshold\n  \n  // Archive settings\n  enableArchive: true, // Enable hierarchical memory system\n  archivePath: './context-archive',\n  archiveSearchLimit: 10,\n  archiveMaxSize: 100 * 1024 * 1024, // 100MB\n  archiveIndexing: true,\n  \n  // Chat logging\n  logToChat: true, // Log optimization events to chat\n  chatLogLevel: 'brief', // 'brief', 'detailed', or 'none'\n  chatLogFormat: '📊 {action}: {details}', // Format for chat messages\n  \n  // Performance\n  batchSize: 5, // Messages to process in batch\n  maxCompactionRatio: 0.5, // Maximum 50% compaction in one pass\n}\n\nChat Logging\n\nThe context optimizer can log events directly to chat:\n\n// Example chat log messages:\n// 📊 Context optimized: Compacted 15 messages → 8 (47% reduction)\n// 📊 Archive search: Found 3 relevant snippets (42% similarity)\n// 📊 Dynamic context: Filtered 12 low-relevance messages\n\n// Configure logging:\nconst pruner = createContextPruner({\n  logToChat: true,\n  chatLogLevel: 'brief', // Options: 'brief', 'detailed', 'none'\n  chatLogFormat: '📊 {action}: {details}',\n  \n  // Custom log handler (optional)\n  onLog: (level, message, data) => {\n    if (level === 'info' && data.action === 'compaction') {\n      // Send to chat\n      console.log(`🧠 Context optimized: ${message}`);\n    }\n  }\n});\n\nIntegration with Clawdbot\n\nAdd to your Clawdbot config:\n\nskills:\n  context-pruner:\n    enabled: true\n    config:\n      contextLimit: 64000\n      autoPrune: true\n\n\nThe pruner will automatically monitor context usage and apply appropriate pruning strategies to stay within DeepSeek's 64k limit."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/ad2546/context-optimizer",
    "publisherUrl": "https://clawhub.ai/ad2546/context-optimizer",
    "owner": "ad2546",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/context-optimizer",
    "downloadUrl": "https://openagent3.xyz/downloads/context-optimizer",
    "agentUrl": "https://openagent3.xyz/skills/context-optimizer/agent",
    "manifestUrl": "https://openagent3.xyz/skills/context-optimizer/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/context-optimizer/agent.md"
  }
}