{
  "schemaVersion": "1.0",
  "item": {
    "slug": "openclaw-token-memory-optimizer",
    "name": "Openclaw Token Memory Optimizer",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/klautimus/openclaw-token-memory-optimizer",
    "canonicalUrl": "https://clawhub.ai/klautimus/openclaw-token-memory-optimizer",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/openclaw-token-memory-optimizer",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=openclaw-token-memory-optimizer",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "package.json",
      "scripts/check-optimization.sh"
    ],
    "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",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/openclaw-token-memory-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/openclaw-token-memory-optimizer",
    "agentPageUrl": "https://openagent3.xyz/skills/openclaw-token-memory-optimizer/agent",
    "manifestUrl": "https://openagent3.xyz/skills/openclaw-token-memory-optimizer/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/openclaw-token-memory-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": "Token Optimizer Skill",
        "body": "This skill provides the procedural knowledge to keep your OpenClaw instance lean and efficient."
      },
      {
        "title": "Quick Reference",
        "body": "ProblemSolutionBackground tasks bloating contextCron isolation (sessionTarget: \"isolated\")Reading entire history every turnLocal RAG with memory_searchContext exceeds 100k tokensReset & Summarize protocolFinding old conversationsSession transcript indexing"
      },
      {
        "title": "Workflow 1: Periodic Task Isolation",
        "body": "To prevent background tasks from bloating your main conversation context, always isolate them."
      },
      {
        "title": "Steps",
        "body": "Locate your openclaw.json config.\nIn the cron.jobs array, set sessionTarget: \"isolated\" for any task that doesn't need to be part of the main chat history.\nUse the message tool within the task's payload if human intervention is required."
      },
      {
        "title": "Example Config",
        "body": "{\n  \"cron\": {\n    \"jobs\": [\n      {\n        \"name\": \"Background Check\",\n        \"schedule\": { \"kind\": \"every\", \"everyMs\": 1800000 },\n        \"sessionTarget\": \"isolated\",\n        \"payload\": {\n          \"kind\": \"agentTurn\",\n          \"message\": \"Check for updates. If found, use message tool to notify user.\",\n          \"deliver\": true\n        }\n      }\n    ]\n  }\n}"
      },
      {
        "title": "Key Points",
        "body": "sessionTarget: \"isolated\" runs the task in a separate, transient session\nUse deliver: true to send results back to the main channel\nIsolated sessions don't pollute your main context with heartbeat/check history"
      },
      {
        "title": "Workflow 2: Reset & Summarize (The \"Digital Soul\" Protocol)",
        "body": "When your context usage (visible via 📊 session_status) exceeds 100k tokens, perform a manual consolidation."
      },
      {
        "title": "Steps",
        "body": "Check Context: Run 📊 session_status to see current token usage\nScan History: Review the current session for new facts, preferences, or project updates\nUpdate MEMORY.md: Append these new facts to your long-term memory file\nDaily Log: Ensure memory/YYYY-MM-DD.md is up to date with today's events\nRestart: Run openclaw gateway restart to clear the active history"
      },
      {
        "title": "When to Trigger",
        "body": "Context > 100k tokens\nSession running for several days\nNoticeably slower responses\nUser explicitly requests a \"fresh start\""
      },
      {
        "title": "Workflow 3: Local RAG Configuration",
        "body": "For efficient recall without token burn, configure local embeddings."
      },
      {
        "title": "Configuration (openclaw.json)",
        "body": "{\n  \"memorySearch\": {\n    \"embedding\": {\n      \"provider\": \"local\",\n      \"model\": \"hf:second-state/All-MiniLM-L6-v2-Embedding-GGUF\"\n    },\n    \"store\": \"sqlite\",\n    \"paths\": [\"memory/\", \"MEMORY.md\"],\n    \"extraPaths\": []\n  }\n}"
      },
      {
        "title": "Usage",
        "body": "Use memory_search to retrieve context from your logs instead of loading everything:\n\nmemory_search(query=\"what did we decide about the API design\")\n\nThe tool returns relevant snippets with file paths and line numbers. Use memory_get to pull specific sections."
      },
      {
        "title": "Workflow 4: Session Transcript Indexing (Advanced)",
        "body": "Index your session transcripts (.jsonl files) for searchable conversation history."
      },
      {
        "title": "How It Works",
        "body": "OpenClaw stores session transcripts in ~/.openclaw/sessions/. These can be indexed for semantic search, allowing you to find old conversations without loading them into context."
      },
      {
        "title": "Configuration",
        "body": "Add transcript paths to memorySearch.extraPaths:\n\n{\n  \"memorySearch\": {\n    \"extraPaths\": [\n      \"~/.openclaw/sessions/*.jsonl\"\n    ]\n  }\n}"
      },
      {
        "title": "Best Practices",
        "body": "Index selectively (recent sessions, important conversations)\nUse date-based filtering to limit search scope\nArchive old transcripts to cold storage after indexing"
      },
      {
        "title": "Workflow 5: Hybrid Search (Vector + BM25)",
        "body": "Combine semantic search with keyword matching for more accurate retrieval."
      },
      {
        "title": "Why Hybrid?",
        "body": "Search TypeStrengthsWeaknessesVector (semantic)Finds conceptually similar contentMay miss exact termsBM25 (keyword)Finds exact matchesMisses synonyms/paraphrasesHybridBest of both worldsSlightly more compute"
      },
      {
        "title": "How to Use",
        "body": "When memory_search returns low-confidence results:\n\nTry the search with different phrasing (semantic variation)\nSearch for exact keywords you remember (BM25 behavior)\nCombine results manually if needed"
      },
      {
        "title": "Future Enhancement",
        "body": "OpenClaw's RAG system may support native hybrid search in future versions. For now, run multiple queries when precision matters."
      },
      {
        "title": "\"My context is growing too fast\"",
        "body": "Check cron jobs: Are they isolated?\nCheck heartbeat frequency: Too frequent = more tokens\nAre you loading large files unnecessarily?"
      },
      {
        "title": "\"memory_search returns nothing\"",
        "body": "Verify memorySearch is configured in openclaw.json\nCheck that the embedding model is downloaded\nEnsure memory files exist and have content"
      },
      {
        "title": "\"Restart didn't clear context\"",
        "body": "The restart clears the session history, but:\n\nSystem prompt is always loaded\nWorkspace files (MEMORY.md, etc.) are injected fresh\nThis is by design for continuity"
      },
      {
        "title": "Credits",
        "body": "Pépère (shAde) — Original concept and documentation\nZayan (Clément) — Implementation and testing\n\nBuilt for the OpenClaw community. 🦦😸"
      }
    ],
    "body": "Token Optimizer Skill\n\nThis skill provides the procedural knowledge to keep your OpenClaw instance lean and efficient.\n\nQuick Reference\nProblem\tSolution\nBackground tasks bloating context\tCron isolation (sessionTarget: \"isolated\")\nReading entire history every turn\tLocal RAG with memory_search\nContext exceeds 100k tokens\tReset & Summarize protocol\nFinding old conversations\tSession transcript indexing\nWorkflow 1: Periodic Task Isolation\n\nTo prevent background tasks from bloating your main conversation context, always isolate them.\n\nSteps\nLocate your openclaw.json config.\nIn the cron.jobs array, set sessionTarget: \"isolated\" for any task that doesn't need to be part of the main chat history.\nUse the message tool within the task's payload if human intervention is required.\nExample Config\n{\n  \"cron\": {\n    \"jobs\": [\n      {\n        \"name\": \"Background Check\",\n        \"schedule\": { \"kind\": \"every\", \"everyMs\": 1800000 },\n        \"sessionTarget\": \"isolated\",\n        \"payload\": {\n          \"kind\": \"agentTurn\",\n          \"message\": \"Check for updates. If found, use message tool to notify user.\",\n          \"deliver\": true\n        }\n      }\n    ]\n  }\n}\n\nKey Points\nsessionTarget: \"isolated\" runs the task in a separate, transient session\nUse deliver: true to send results back to the main channel\nIsolated sessions don't pollute your main context with heartbeat/check history\nWorkflow 2: Reset & Summarize (The \"Digital Soul\" Protocol)\n\nWhen your context usage (visible via 📊 session_status) exceeds 100k tokens, perform a manual consolidation.\n\nSteps\nCheck Context: Run 📊 session_status to see current token usage\nScan History: Review the current session for new facts, preferences, or project updates\nUpdate MEMORY.md: Append these new facts to your long-term memory file\nDaily Log: Ensure memory/YYYY-MM-DD.md is up to date with today's events\nRestart: Run openclaw gateway restart to clear the active history\nWhen to Trigger\nContext > 100k tokens\nSession running for several days\nNoticeably slower responses\nUser explicitly requests a \"fresh start\"\nWorkflow 3: Local RAG Configuration\n\nFor efficient recall without token burn, configure local embeddings.\n\nConfiguration (openclaw.json)\n{\n  \"memorySearch\": {\n    \"embedding\": {\n      \"provider\": \"local\",\n      \"model\": \"hf:second-state/All-MiniLM-L6-v2-Embedding-GGUF\"\n    },\n    \"store\": \"sqlite\",\n    \"paths\": [\"memory/\", \"MEMORY.md\"],\n    \"extraPaths\": []\n  }\n}\n\nUsage\n\nUse memory_search to retrieve context from your logs instead of loading everything:\n\nmemory_search(query=\"what did we decide about the API design\")\n\n\nThe tool returns relevant snippets with file paths and line numbers. Use memory_get to pull specific sections.\n\nWorkflow 4: Session Transcript Indexing (Advanced)\n\nIndex your session transcripts (.jsonl files) for searchable conversation history.\n\nHow It Works\n\nOpenClaw stores session transcripts in ~/.openclaw/sessions/. These can be indexed for semantic search, allowing you to find old conversations without loading them into context.\n\nConfiguration\n\nAdd transcript paths to memorySearch.extraPaths:\n\n{\n  \"memorySearch\": {\n    \"extraPaths\": [\n      \"~/.openclaw/sessions/*.jsonl\"\n    ]\n  }\n}\n\nBest Practices\nIndex selectively (recent sessions, important conversations)\nUse date-based filtering to limit search scope\nArchive old transcripts to cold storage after indexing\nWorkflow 5: Hybrid Search (Vector + BM25)\n\nCombine semantic search with keyword matching for more accurate retrieval.\n\nWhy Hybrid?\nSearch Type\tStrengths\tWeaknesses\nVector (semantic)\tFinds conceptually similar content\tMay miss exact terms\nBM25 (keyword)\tFinds exact matches\tMisses synonyms/paraphrases\nHybrid\tBest of both worlds\tSlightly more compute\nHow to Use\n\nWhen memory_search returns low-confidence results:\n\nTry the search with different phrasing (semantic variation)\nSearch for exact keywords you remember (BM25 behavior)\nCombine results manually if needed\nFuture Enhancement\n\nOpenClaw's RAG system may support native hybrid search in future versions. For now, run multiple queries when precision matters.\n\nTroubleshooting\n\"My context is growing too fast\"\nCheck cron jobs: Are they isolated?\nCheck heartbeat frequency: Too frequent = more tokens\nAre you loading large files unnecessarily?\n\"memory_search returns nothing\"\nVerify memorySearch is configured in openclaw.json\nCheck that the embedding model is downloaded\nEnsure memory files exist and have content\n\"Restart didn't clear context\"\n\nThe restart clears the session history, but:\n\nSystem prompt is always loaded\nWorkspace files (MEMORY.md, etc.) are injected fresh\nThis is by design for continuity\nCredits\nPépère (shAde) — Original concept and documentation\nZayan (Clément) — Implementation and testing\n\nBuilt for the OpenClaw community. 🦦😸"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/klautimus/openclaw-token-memory-optimizer",
    "publisherUrl": "https://clawhub.ai/klautimus/openclaw-token-memory-optimizer",
    "owner": "klautimus",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/openclaw-token-memory-optimizer",
    "downloadUrl": "https://openagent3.xyz/downloads/openclaw-token-memory-optimizer",
    "agentUrl": "https://openagent3.xyz/skills/openclaw-token-memory-optimizer/agent",
    "manifestUrl": "https://openagent3.xyz/skills/openclaw-token-memory-optimizer/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/openclaw-token-memory-optimizer/agent.md"
  }
}