# Send Smart Context Manager 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. 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. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "context-manager",
    "name": "Smart Context Manager",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/plgonzalezrx8/context-manager",
    "canonicalUrl": "https://clawhub.ai/plgonzalezrx8/context-manager",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/context-manager",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=context-manager",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "compress.sh",
      "SKILL.md",
      "config.json"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "context-manager",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-03T19:06:19.350Z",
      "expiresAt": "2026-05-10T19:06:19.350Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=context-manager",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=context-manager",
        "contentDisposition": "attachment; filename=\"context-manager-1.0.3.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "context-manager"
      },
      "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-manager"
    },
    "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/context-manager",
    "downloadUrl": "https://openagent3.xyz/downloads/context-manager",
    "agentUrl": "https://openagent3.xyz/skills/context-manager/agent",
    "manifestUrl": "https://openagent3.xyz/skills/context-manager/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/context-manager/agent.md"
  }
}
```
## Documentation

### Context Manager Skill

AI-powered context management for OpenClaw sessions. Uses the agent itself to generate intelligent summaries, then resets the session with compressed context.

### Quick Start

# List all sessions with usage stats
~/openclaw/skills/context-manager/compress.sh list

# Check status of a specific session
~/openclaw/skills/context-manager/compress.sh status agent:main:main

# Generate AI summary (read-only, safe)
~/openclaw/skills/context-manager/compress.sh summarize agent:main:main

# Compress session: generate summary, reset, inject (DESTRUCTIVE)
~/openclaw/skills/context-manager/compress.sh summarize agent:main:main --replace

### When to Use

Context usage approaching 70-80%+
Long sessions with extensive conversation history
Before the session becomes slow or loses coherence
Proactively to maintain fast, focused sessions

### How It Works

AI Summarization: Sends a prompt to the agent asking it to summarize its own context
Backup: Saves the original JSONL session file to memory/compressed/
Reset: Deletes the JSONL file (official reset method)
Inject: Sends the AI-generated summary as the first message in the fresh session
Result: Same session key, new session ID, compressed context

Key insight: The agent has full visibility into its own context, so it generates the best possible summary.

### Session Commands

CommandDescriptionlistList all sessions with token usagestatus [KEY]Show detailed status for a sessionsummarize [KEY]Generate AI summary (read-only)summarize [KEY] --replaceSummarize AND reset session with compressed contextcompress [KEY]Legacy grep-based extraction (not recommended)check [KEY]Check if session exceeds thresholdcheck-allCheck all sessions at once

### Configuration Commands

CommandDescriptionset-threshold NSet compression threshold (50-99%, default: 80)set-depth LEVELSet depth: brief/balanced/comprehensiveset-quiet-hours HHSet quiet hours (e.g., "23:00-07:00")helpShow help and usage examples

### List All Sessions

$ ~/openclaw/skills/context-manager/compress.sh list
📋 Available Sessions (4 total)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#    SESSION KEY                              KIND       TOKENS    USAGE
1    agent:main:main                          direct      70188      70%
2    agent:main:slack:channel:c0aaruq2en9     group       20854      20%
3    agent:main:cron:0d02af4b-...             direct      18718      18%

### Check Session Status

$ ~/openclaw/skills/context-manager/compress.sh status agent:main:main
📊 Context Manager Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  Session Key: agent:main:main
  Session ID:  fc192a2d-091c-48c7-9fad-12bf34687454
  Kind:        direct
  Model:       gemini-3-flash
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  Threshold:   80%
  Tokens:      70188 / 100000
  Usage:       70%

### Generate AI Summary (Safe, Read-Only)

$ ~/openclaw/skills/context-manager/compress.sh summarize agent:main:main
🧠 Requesting AI summary for session: agent:main:main
  Session ID: fc192a2d-091c-48c7-9fad-12bf34687454

✅ AI Summary generated!
  Saved to: memory/compressed/20260127-123146.ai-summary.md

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
### Session Summary: January 27, 2026

#### 1. What was accomplished
- System audit completed
- Essay generation with sub-agents
...

### Full Compression (Summarize + Reset + Inject)

$ ~/openclaw/skills/context-manager/compress.sh summarize agent:main:main --replace
🧠 Requesting AI summary for session: agent:main:main
  Session ID: fc192a2d-091c-48c7-9fad-12bf34687454
  Mode: REPLACE (will reset session after summary)

✅ AI Summary generated!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[AI-generated summary displayed]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🔄 Resetting session and injecting compressed context...
  Backing up session file...
  Backup saved: memory/compressed/20260127-123146.session-backup.jsonl
  Deleting session JSONL to reset...
  Injecting compressed context into fresh session...
✅ Session compressed successfully!
  Old session ID: fc192a2d-091c-48c7-9fad-12bf34687454
  New session ID: a1b2c3d4-...
  Session is ready to continue with compressed context

Result: 70k tokens → 16k tokens (77% reduction)

### Output Files

When compression occurs, these files are created in memory/compressed/:

FileDescription{timestamp}.ai-summary.mdAI-generated session summary{timestamp}.session-backup.jsonlFull backup of original session (can restore if needed){timestamp}.transcript.mdRaw transcript extraction (legacy){timestamp}.summary.mdGrep-based summary (legacy)

### Requirements

openclaw - Gateway must be running
jq - JSON parsing (brew install jq)
Gateway access - Script uses openclaw agent and openclaw sessions

### Session Reset Method

The script uses JSONL deletion to reset sessions (official method):

Backup JSONL to memory/compressed/
Delete ~/.openclaw/agents/{agent}/sessions/{sessionId}.jsonl
Send compressed context via openclaw agent --to main
New session is created automatically with summary as first message

### Why Not /reset?

The /reset slash command only works in the chat interface. When sent via openclaw agent --session-id, it's treated as a regular message and the agent tries to interpret it as a task.

### AI Summarization Prompt

The script asks the agent to provide:

What was accomplished (key tasks)
Key decisions made (with rationale)
Current state (where we left off)
Pending tasks (what still needs doing)
Important context (critical info to remember)

### Summary Text Empty

If the AI summary extraction fails, check stderr redirect:

# The script uses 2>/dev/null to avoid Node deprecation warnings breaking JSON
openclaw agent --session-id $ID -m "..." --json 2>/dev/null

### Session Not Resetting

Verify the JSONL file path:

ls ~/.openclaw/agents/main/sessions/

### Restore From Backup

If something goes wrong:

cp memory/compressed/{timestamp}.session-backup.jsonl \\
   ~/.openclaw/agents/main/sessions/{sessionId}.jsonl

### Check Logs

Use openclaw logs to troubleshoot:

openclaw logs --limit 50 --json | grep -i "error\\|fail"

### Best Practices

Backup first: The script auto-backs up, but you can also manually backup before testing
Test on non-critical sessions first: Try on a Slack channel or cron session before main
Check the summary: Run summarize without --replace first to verify the summary quality
Monitor token count: Use status to verify compression worked

### See Also

openclaw sessions --help
openclaw agent --help
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: plgonzalezrx8
- Version: 1.0.3
## 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-03T19:06:19.350Z
- Expires at: 2026-05-10T19:06:19.350Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/context-manager)
- [Send to Agent page](https://openagent3.xyz/skills/context-manager/agent)
- [JSON manifest](https://openagent3.xyz/skills/context-manager/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/context-manager/agent.md)
- [Download page](https://openagent3.xyz/downloads/context-manager)