# Send Openclaw Token Memory Optimizer to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- 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.
## Suggested prompts
### New install

```text
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.
```
### Upgrade existing

```text
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.
```
## Machine-readable fields
```json
{
  "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": {
    "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",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "package.json",
      "scripts/check-optimization.sh"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "openclaw-token-memory-optimizer",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-03T00:46:39.950Z",
      "expiresAt": "2026-05-10T00:46:39.950Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=openclaw-token-memory-optimizer",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=openclaw-token-memory-optimizer",
        "contentDisposition": "attachment; filename=\"openclaw-token-memory-optimizer-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "openclaw-token-memory-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/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."
      ]
    }
  },
  "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"
  }
}
```
## Documentation

### Token Optimizer Skill

This skill provides the procedural knowledge to keep your OpenClaw instance lean and efficient.

### Quick Reference

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

### Workflow 1: Periodic Task Isolation

To prevent background tasks from bloating your main conversation context, always isolate them.

### Steps

Locate your openclaw.json config.
In the cron.jobs array, set sessionTarget: "isolated" for any task that doesn't need to be part of the main chat history.
Use the message tool within the task's payload if human intervention is required.

### Example Config

{
  "cron": {
    "jobs": [
      {
        "name": "Background Check",
        "schedule": { "kind": "every", "everyMs": 1800000 },
        "sessionTarget": "isolated",
        "payload": {
          "kind": "agentTurn",
          "message": "Check for updates. If found, use message tool to notify user.",
          "deliver": true
        }
      }
    ]
  }
}

### Key Points

sessionTarget: "isolated" runs the task in a separate, transient session
Use deliver: true to send results back to the main channel
Isolated sessions don't pollute your main context with heartbeat/check history

### Workflow 2: Reset & Summarize (The "Digital Soul" Protocol)

When your context usage (visible via 📊 session_status) exceeds 100k tokens, perform a manual consolidation.

### Steps

Check Context: Run 📊 session_status to see current token usage
Scan History: Review the current session for new facts, preferences, or project updates
Update MEMORY.md: Append these new facts to your long-term memory file
Daily Log: Ensure memory/YYYY-MM-DD.md is up to date with today's events
Restart: Run openclaw gateway restart to clear the active history

### When to Trigger

Context > 100k tokens
Session running for several days
Noticeably slower responses
User explicitly requests a "fresh start"

### Workflow 3: Local RAG Configuration

For efficient recall without token burn, configure local embeddings.

### Configuration (openclaw.json)

{
  "memorySearch": {
    "embedding": {
      "provider": "local",
      "model": "hf:second-state/All-MiniLM-L6-v2-Embedding-GGUF"
    },
    "store": "sqlite",
    "paths": ["memory/", "MEMORY.md"],
    "extraPaths": []
  }
}

### Usage

Use memory_search to retrieve context from your logs instead of loading everything:

memory_search(query="what did we decide about the API design")

The tool returns relevant snippets with file paths and line numbers. Use memory_get to pull specific sections.

### Workflow 4: Session Transcript Indexing (Advanced)

Index your session transcripts (.jsonl files) for searchable conversation history.

### How It Works

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.

### Configuration

Add transcript paths to memorySearch.extraPaths:

{
  "memorySearch": {
    "extraPaths": [
      "~/.openclaw/sessions/*.jsonl"
    ]
  }
}

### Best Practices

Index selectively (recent sessions, important conversations)
Use date-based filtering to limit search scope
Archive old transcripts to cold storage after indexing

### Workflow 5: Hybrid Search (Vector + BM25)

Combine semantic search with keyword matching for more accurate retrieval.

### Why Hybrid?

Search TypeStrengthsWeaknessesVector (semantic)Finds conceptually similar contentMay miss exact termsBM25 (keyword)Finds exact matchesMisses synonyms/paraphrasesHybridBest of both worldsSlightly more compute

### How to Use

When memory_search returns low-confidence results:

Try the search with different phrasing (semantic variation)
Search for exact keywords you remember (BM25 behavior)
Combine results manually if needed

### Future Enhancement

OpenClaw's RAG system may support native hybrid search in future versions. For now, run multiple queries when precision matters.

### "My context is growing too fast"

Check cron jobs: Are they isolated?
Check heartbeat frequency: Too frequent = more tokens
Are you loading large files unnecessarily?

### "memory_search returns nothing"

Verify memorySearch is configured in openclaw.json
Check that the embedding model is downloaded
Ensure memory files exist and have content

### "Restart didn't clear context"

The restart clears the session history, but:

System prompt is always loaded
Workspace files (MEMORY.md, etc.) are injected fresh
This is by design for continuity

### Credits

Pépère (shAde) — Original concept and documentation
Zayan (Clément) — Implementation and testing

Built for the OpenClaw community. 🦦😸
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: klautimus
- Version: 1.0.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-03T00:46:39.950Z
- Expires at: 2026-05-10T00:46:39.950Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/openclaw-token-memory-optimizer)
- [Send to Agent page](https://openagent3.xyz/skills/openclaw-token-memory-optimizer/agent)
- [JSON manifest](https://openagent3.xyz/skills/openclaw-token-memory-optimizer/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/openclaw-token-memory-optimizer/agent.md)
- [Download page](https://openagent3.xyz/downloads/openclaw-token-memory-optimizer)