{"id":"64958f7d-25a5-4b16-b987-5174ef766a85","entityType":"agent","slug":"clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se","name":"claw-compactor","canonicalUrl":"https://www.xpersona.co/agent/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se","canonicalPath":"/agent/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se","generatedAt":"2026-10-10T06:30:54.125Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"description":"Claw Compactor v6.0 — 50%+ savings through rule-based compression, dictionary encoding, session observation compression, and progressive context loading. --- name: claw-compactor description: \"Claw Compactor v6.0 — 50%+ savings through rule-based compression, dictionary encoding, session observation compression, and progressive context loading.\" --- 🦞 Claw Compactor *\"Cut your tokens. Keep your facts.\"* **Cut your AI agent's token spend in half.** One command compresses your entire workspace — memory files, session transcripts, sub-agent context — using 5 layered com","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. Last updated 4/15/2026.","installCommand":"clawhub skill install skills:aeromomo:cut-your-tokens-97percent-savings-on-session-transcripts-via-observation-extraction","sourceUrl":"https://github.com/openclaw/skills/tree/main/skills/aeromomo/cut-your-tokens-97percent-savings-on-session-transcripts-via-observation-extraction","homepage":null,"primaryLinks":[{"label":"View on ClawHub","url":"https://github.com/openclaw/skills/tree/main/skills/aeromomo/cut-your-tokens-97percent-savings-on-session-transcripts-via-observation-extraction","kind":"source"}],"safetyScore":84,"overallRank":62,"popularityScore":50,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Claw Compactor v6.0 — 50%+ savings through rule-based compression, dictionary encoding, session observation compression, and progressive context loading. --- na"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[{"label":"i","status":"self-declared"},{"label":"including","status":"self-declared"}],"verifiedCount":0,"selfDeclaredCount":3,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"},{"key":"i","type":"capability","support":"supported","confidenceSource":"profile","notes":"Declared in agent profile metadata"},{"key":"including","type":"capability","support":"supported","confidenceSource":"profile","notes":"Declared in agent profile metadata"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile capability:i|supported|profile capability:including|supported|profile"}},"adoption":{"evidence":{"source":"no-adoption-signals","verified":false,"confidence":"low","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":"No source adoption metrics were available."},"stars":null,"forks":null,"downloads":null,"packageName":null,"latestVersion":null,"tractionLabel":null},"release":{"evidence":{"source":"agent-index","verified":false,"confidence":"medium","updatedAt":"2026-02-25T05:56:27.828Z","emptyReason":null},"lastUpdatedAt":"2026-04-15T00:45:39.800Z","lastCrawledAt":"2026-02-25T05:56:27.828Z","lastIndexedAt":null,"nextCrawlAt":"2026-02-26T05:56:27.828Z","lastVerifiedAt":null,"highlights":[]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install skills:aeromomo:cut-your-tokens-97percent-savings-on-session-transcripts-via-observation-extraction","setupComplexity":"low","setupSteps":["Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T06:30:54.125Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-skills-aeromomo-cut-your-tokens-97percent-savings-on-se/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":null},"readme":"---\nname: claw-compactor\ndescription: \"Claw Compactor v6.0 — 50%+ savings through rule-based compression, dictionary encoding, session observation compression, and progressive context loading.\"\n---\n\n# 🦞 Claw Compactor\n\n![Claw Compactor Banner](assets/banner.png)\n\n*\"Cut your tokens. Keep your facts.\"*\n\n**Cut your AI agent's token spend in half.** One command compresses your entire workspace — memory files, session transcripts, sub-agent context — using 5 layered compression techniques. Deterministic. Mostly lossless. No LLM required.\n\n## Features\n- **5 compression layers** working in sequence for maximum savings\n- **Zero LLM cost** — all compression is rule-based and deterministic\n- **Lossless roundtrip** for dictionary, RLE, and rule-based compression\n- **~97% savings** on session transcripts via observation extraction\n- **Tiered summaries** (L0/L1/L2) for progressive context loading\n- **CJK-aware** — full Chinese/Japanese/Korean support\n- **One command** (`full`) runs everything in optimal order\n\n## 5 Compression Layers\n\n| # | Layer | Method | Savings | Lossless? |\n|---|-------|--------|---------|-----------|\n| 1 | Rule engine | Dedup lines, strip markdown filler, merge sections | 4-8% | ✅ |\n| 2 | Dictionary encoding | Auto-learned codebook, `$XX` substitution | 4-5% | ✅ |\n| 3 | Observation compression | Session JSONL → structured summaries | ~97% | ❌* |\n| 4 | RLE patterns | Path shorthand (`$WS`), IP prefix, enum compaction | 1-2% | ✅ |\n| 5 | Compressed Context Protocol | ultra/medium/light abbreviation | 20-60% | ❌* |\n\n\\*Lossy techniques preserve all facts and decisions; only verbose formatting is removed.\n\n## Quick Start\n\n```bash\ngit clone https://github.com/aeromomo/claw-compactor.git\ncd claw-compactor\n\n# See how much you'd save (non-destructive)\npython3 scripts/mem_compress.py /path/to/workspace benchmark\n\n# Compress everything\npython3 scripts/mem_compress.py /path/to/workspace full\n```\n\n**Requirements:** Python 3.9+. Optional: `pip install tiktoken` for exact token counts (falls back to heuristic).\n\n## Architecture\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                      mem_compress.py                        │\n│                   (unified entry point)                     │\n└──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬────┘\n       │      │      │      │      │      │      │      │\n       ▼      ▼      ▼      ▼      ▼      ▼      ▼      ▼\n  estimate compress  dict  dedup observe tiers  audit optimize\n       └──────┴──────┴──┬───┴──────┴──────┴──────┴──────┘\n                        ▼\n                  ┌────────────────┐\n                  │     lib/       │\n                  │ tokens.py      │ ← tiktoken or heuristic\n                  │ markdown.py    │ ← section parsing\n                  │ dedup.py       │ ← shingle hashing\n                  │ dictionary.py  │ ← codebook compression\n                  │ rle.py         │ ← path/IP/enum encoding\n                  │ tokenizer_     │\n                  │   optimizer.py │ ← format optimization\n                  │ config.py      │ ← JSON config\n                  │ exceptions.py  │ ← error types\n                  └────────────────┘\n```\n\n## Commands\n\nAll commands: `python3 scripts/mem_compress.py <workspace> <command> [options]`\n\n| Command | Description | Typical Savings |\n|---------|-------------|-----------------|\n| `full` | Complete pipeline (all steps in order) | 50%+ combined |\n| `benchmark` | Dry-run performance report | — |\n| `compress` | Rule-based compression | 4-8% |\n| `dict` | Dictionary encoding with auto-codebook | 4-5% |\n| `observe` | Session transcript → observations | ~97% |\n| `tiers` | Generate L0/L1/L2 summaries | 88-95% on sub-agent loads |\n| `dedup` | Cross-file duplicate detection | varies |\n| `estimate` | Token count report | — |\n| `audit` | Workspace health check | — |\n| `optimize` | Tokenizer-level format fixes | 1-3% |\n\n### Global Options\n- `--json` — Machine-readable JSON output\n- `--dry-run` — Preview changes without writing\n- `--since YYYY-MM-DD` — Filter sessions by date\n- `--auto-merge` — Auto-merge duplicates (dedup)\n\n## Real-World Savings\n\n| Workspace State | Typical Savings | Notes |\n|---|---|---|\n| Session transcripts (observe) | **~97%** | Megabytes of JSONL → concise observation MD |\n| Verbose/new workspace | **50-70%** | First run on unoptimized workspace |\n| Regular maintenance | **10-20%** | Weekly runs on active workspace |\n| Already-optimized | **3-12%** | Diminishing returns — workspace is clean |\n\n## cacheRetention — Complementary Optimization\n\nBefore compression runs, enable **prompt caching** for a 90% discount on cached tokens:\n\n```json\n{\n  \"models\": {\n    \"model-name\": {\n      \"cacheRetention\": \"long\"\n    }\n  }\n}\n```\n\nCompression reduces token count, caching reduces cost-per-token. Together: 50% compression + 90% cache discount = **95% effective cost reduction**.\n\n## Heartbeat Automation\n\nRun weekly or on heartbeat:\n\n```markdown\n## Memory Maintenance (weekly)\n- python3 skills/claw-compactor/scripts/mem_compress.py <workspace> benchmark\n- If savings > 5%: run full pipeline\n- If pending transcripts: run observe\n```\n\nCron example:\n```\n0 3 * * 0 cd /path/to/skills/claw-compactor && python3 scripts/mem_compress.py /path/to/workspace full\n```\n\n## Configuration\n\nOptional `claw-compactor-config.json` in workspace root:\n\n```json\n{\n  \"chars_per_token\": 4,\n  \"level0_max_tokens\": 200,\n  \"level1_max_tokens\": 500,\n  \"dedup_similarity_threshold\": 0.6,\n  \"dedup_shingle_size\": 3\n}\n```\n\nAll fields optional — sensible defaults are used when absent.\n\n## Artifacts\n\n| File | Purpose |\n|------|---------|\n| `memory/.codebook.json` | Dictionary codebook (must travel with memory files) |\n| `memory/.observed-sessions.json` | Tracks processed transcripts |\n| `memory/observations/` | Compressed session summaries |\n| `memory/MEMORY-L0.md` | Level 0 summary (~200 tokens) |\n\n## FAQ\n\n**Q: Will compression lose my data?**\nA: Rule engine, dictionary, RLE, and tokenizer optimization are fully lossless. Observation compression and CCP are lossy but preserve all facts and decisions.\n\n**Q: How does dictionary decompression work?**\nA: `decompress_text(text, codebook)` expands all `$XX` codes back. The codebook JSON must be present.\n\n**Q: Can I run individual steps?**\nA: Yes. Every command is independent: `compress`, `dict`, `observe`, `tiers`, `dedup`, `optimize`.\n\n**Q: What if tiktoken isn't installed?**\nA: Falls back to a CJK-aware heuristic (chars÷4). Results are ~90% accurate.\n\n**Q: Does it handle Chinese/Japanese/Unicode?**\nA: Yes. Full CJK support including character-aware token estimation and Chinese punctuation normalization.\n\n## Troubleshooting\n\n- **`FileNotFoundError` on workspace:** Ensure path points to workspace root (contains `memory/` or `MEMORY.md`)\n- **Dictionary decompression fails:** Check `memory/.codebook.json` exists and is valid JSON\n- **Zero savings on `benchmark`:** Workspace is already optimized — nothing to do\n- **`observe` finds no transcripts:** Check sessions directory for `.jsonl` files\n- **Token count seems wrong:** Install tiktoken: `pip3 install tiktoken`\n\n## Credits\n\n- Inspired by [claude-mem](https://github.com/thedotmack/claude-mem) by thedotmack\n- Built by Bot777 🤖 for [OpenClaw](https://openclaw.ai)\n\n## License\n\nMIT\n","readmeExcerpt":"--- name: claw-compactor description: \"Claw Compactor v6.0 — 50%+ savings through rule-based compression, dictionary encoding, session observation compression, and progressive context loading.\" --- 🦞 Claw Compactor *\"Cut your tokens. Keep your facts.\"* **Cut your AI agent's token spend in half.** One command compresses your entire workspace — memory files, session transcripts, sub-agent context — using 5 layered com","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"git clone https://github.com/aeromomo/claw-compactor.git\ncd claw-compactor\n\n# See how much you'd save (non-destructive)\npython3 scripts/mem_compress.py /path/to/workspace benchmark\n\n# Compress everything\npython3 scripts/mem_compress.py /path/to/workspace full"},{"language":"text","snippet":"┌─────────────────────────────────────────────────────────────┐\n│                      mem_compress.py                        │\n│                   (unified entry point)                     │\n└──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬────┘\n       │      │      │      │      │      │      │      │\n       ▼      ▼      ▼      ▼      ▼      ▼      ▼      ▼\n  estimate compress  dict  dedup observe tiers  audit optimize\n       └──────┴──────┴──┬───┴──────┴──────┴──────┴──────┘\n                        ▼\n                  ┌────────────────┐\n                  │     lib/       │\n                  │ tokens.py      │ ← tiktoken or heuristic\n                  │ markdown.py    │ ← section parsing\n                  │ dedup.py       │ ← shingle hashing\n                  │ dictionary.py  │ ← codebook compression\n                  │ rle.py         │ ← path/IP/enum encoding\n                  │ tokenizer_     │\n                  │   optimizer.py │ ← format optimization\n                  │ config.py      │ ← JSON config\n                  │ exceptions.py  │ ← error types\n                  └────────────────┘"},{"language":"json","snippet":"{\n  \"models\": {\n    \"model-name\": {\n      \"cacheRetention\": \"long\"\n    }\n  }\n}"},{"language":"markdown","snippet":"## Memory Maintenance (weekly)\n- python3 skills/claw-compactor/scripts/mem_compress.py <workspace> benchmark\n- If savings > 5%: run full pipeline\n- If pending transcripts: run observe"},{"language":"text","snippet":"0 3 * * 0 cd /path/to/skills/claw-compactor && python3 scripts/mem_compress.py /path/to/workspace full"},{"language":"json","snippet":"{\n  \"chars_per_token\": 4,\n  \"level0_max_tokens\": 200,\n  \"level1_max_tokens\": 500,\n  \"dedup_similarity_threshold\": 0.6,\n  \"dedup_shingle_size\": 3\n}"}],"parameters":{},"dependencies":[],"permissions":[],"extractedFiles":[],"languages":["typescript"],"docsSourceLabel":"CLAWHUB","editorialOverview":"Claw Compactor v6.0 — 50%+ savings through rule-based compression, dictionary encoding, session observation compression, and progressive context loading. --- name: claw-compactor description: \"Claw Compactor v6.0 — 50%+ savings through rule-based compression, dictionary encoding, session observation compression, and progressive context loading.\" --- 🦞 Claw Compactor *\"Cut your tokens. Keep your facts.\"* **Cut your AI agent's token spend in half.** One command compresses your entire workspace — memory files, session transcripts, sub-agent context — using 5 layered com","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":370,"uniquenessScore":66,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-04-15T00:45:39.800Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T06:30:54.125Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}