{"id":"f1188e5a-cd55-4236-b111-c4b4cbd89b92","entityType":"agent","slug":"clawhub-globalcaos-token-efficiency-guide","name":"TinkerClaw Token Efficiency Guide","canonicalUrl":"https://www.xpersona.co/agent/clawhub-globalcaos-token-efficiency-guide","canonicalPath":"/agent/clawhub-globalcaos-token-efficiency-guide","generatedAt":"2026-10-10T13:30:15.130Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-10T11:16:56.196Z","emptyReason":null},"description":"Reference material, not an executable tool: one document (GUIDE.md) with ten concrete steps for cutting OpenClaw token consumption on a Claude subscription — heartbeat model, session compaction, cron model and frequency, bash-ified crons, workspace file size, cache retention. Read it when asked why token usage is high or how to lower it. Skill: TinkerClaw Token Efficiency Guide Owner: globalcaos Summary: Reference material, not an executable tool: one document (GUIDE.md) with ten concrete steps for cutting OpenClaw token consumption on a Claude subscription — heartbeat model, session compaction, cron model and frequency, bash-ified crons, workspace file size, cache retention. Read it when asked why token usage is high or how to lower it. Tags: latest","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.5K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s17324vfeqe0ptzp84z2z9vttx883zdg:token-efficiency-guide","sourceUrl":"https://clawhub.ai/globalcaos/token-efficiency-guide","homepage":"https://clawhub.ai/globalcaos/skills/token-efficiency-guide","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/globalcaos/token-efficiency-guide","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/globalcaos/skills/token-efficiency-guide","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":63,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Reference material, not an executable tool: one document (GUIDE.md) with ten concrete steps for cutting OpenClaw token consumption on a Claude subscription — he"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T11:16:56.196Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T11:16:56.196Z","emptyReason":null},"stars":null,"forks":null,"downloads":1470,"packageName":null,"latestVersion":"1.2.0","tractionLabel":"1.5K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T11:16:56.196Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T11:16:56.196Z","lastCrawledAt":"2026-10-10T11:16:56.196Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T11:16:56.196Z","lastVerifiedAt":null,"highlights":[{"version":"1.2.0","createdAt":"2026-09-17T12:00:12.162Z","changelog":"Replaced with session-archive; Removed all three from section 10 (they were name-only, no code shipped) and the 'install all four' crontab bl; Replaced with a manual reset (/new) after big tasks; Total Impact table updated to match; SKILL","fileCount":4,"zipByteSize":8590},{"version":"1.1.1","createdAt":"2026-06-06T16:50:33.286Z","changelog":"TinkerClaw rebrand + funnel to github.com/globalcaos/tinkerclaw","fileCount":4,"zipByteSize":6697},{"version":"1.1.0","createdAt":"2026-02-21T07:06:44.069Z","changelog":"Marketia copy (Hook/Sell/Convert), metadata.openclaw block, humor grade 6/10","fileCount":3,"zipByteSize":5441},{"version":"1.0.1","createdAt":"2026-02-20T23:13:14.198Z","changelog":"Republish. 10-step guide to cut OpenClaw token consumption by 80-90%.","fileCount":3,"zipByteSize":5345},{"version":"1.0.0","createdAt":"2026-02-20T15:41:45.228Z","changelog":"Initial release: 10 actionable steps with config snippets, bash scripts, and maintenance cron templates","fileCount":3,"zipByteSize":5344}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17324vfeqe0ptzp84z2z9vttx883zdg:token-efficiency-guide","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-globalcaos-token-efficiency-guide/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-globalcaos-token-efficiency-guide/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-globalcaos-token-efficiency-guide/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-globalcaos-token-efficiency-guide/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-globalcaos-token-efficiency-guide/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-globalcaos-token-efficiency-guide/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-10T13:30:15.126Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-globalcaos-token-efficiency-guide/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-globalcaos-token-efficiency-guide/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-globalcaos-token-efficiency-guide/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-globalcaos-token-efficiency-guide/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-10-10T11:16:56.196Z","emptyReason":null},"readme":"Skill: TinkerClaw Token Efficiency Guide\n\nOwner: globalcaos\n\nSummary: Reference material, not an executable tool: one document (GUIDE.md) with ten concrete steps for cutting OpenClaw token consumption on a Claude subscription — heartbeat model, session compaction, cron model and frequency, bash-ified crons, workspace file size, cache retention. Read it when asked why token usage is high or how to lower it.\n\nTags: latest:1.2.0\n\nVersion history:\n\nv1.2.0 | 2026-09-17T12:00:12.162Z | user\n\nReplaced with session-archive; Removed all three from section 10 (they were name-only, no code shipped) and the 'install all four' crontab bl; Replaced with a manual reset (/new) after big tasks; Total Impact table updated to match; SKILL\n\nv1.1.1 | 2026-06-06T16:50:33.286Z | user\n\nTinkerClaw rebrand + funnel to github.com/globalcaos/tinkerclaw\n\nv1.1.0 | 2026-02-21T07:06:44.069Z | user\n\nMarketia copy (Hook/Sell/Convert), metadata.openclaw block, humor grade 6/10\n\nv1.0.1 | 2026-02-20T23:13:14.198Z | user\n\nRepublish. 10-step guide to cut OpenClaw token consumption by 80-90%.\n\nv1.0.0 | 2026-02-20T15:41:45.228Z | user\n\nInitial release: 10 actionable steps with config snippets, bash scripts, and maintenance cron templates\n\nArchive index:\n\nArchive v1.2.0: 4 files, 8590 bytes\n\nFiles: GUIDE.md (10655b), skill-card.md (2121b), SKILL.md (4790b), _meta.json (141b)\n\nFile v1.2.0:SKILL.md\n\n---\nname: token-efficiency-guide\nversion: 1.2.0\ndescription: \"Reference material, not an executable tool: one document (GUIDE.md) with ten concrete steps for cutting OpenClaw token consumption on a Claude subscription — heartbeat model, session compaction, cron model and frequency, bash-ified crons, workspace file size, cache retention. Read it when asked why token usage is high or how to lower it.\"\n---\n\n# Token Efficiency Guide\n\n## What this is\n\nA single markdown document, `GUIDE.md`. There is no script, no CLI and no other\nfile in this directory — nothing here executes. It is written for an operator\nrunning OpenClaw against a Claude subscription who is exhausting the weekly\nlimit, and it lists ten changes with the config snippets or shell commands the\noperator applies by hand.\n\nThe ten steps, in the order the guide gives them:\n\n1. Set the heartbeat model to Haiku (`agents.defaults.heartbeat.model` in `openclaw.json`).\n2. Compact sessions and control context growth (`/compact`, a manual reset after big tasks).\n3. Rewrite cron jobs that are pure logic as bash scripts on the system crontab.\n4. Set the remaining cron jobs to Sonnet via a `model` field in the job payload.\n5. Keep large command output out of the main session (sub-agents; `head`/`grep`/`wc -l`).\n6. Lower cron frequency, with a small table of interval swaps.\n7. Shrink the workspace files that are injected into every message, with a\n   `wc -c` measuring snippet and a target of under 15 KB total.\n8. Enable `cacheRetention: \"long\"` in the model params.\n9. Coordinate time blocks when several agents share one subscription.\n10. Do housekeeping in bash instead of the LLM, with one session-archiver script\n    that is a dry run unless given `--apply`.\n\nEach step carries a percentage saving and the closing table totals them to\n\"~80-90%\". Those figures are the author's own estimates — the document shows no\nmeasurement or methodology behind them, so treat them as ordering hints (step 1\nmatters more than step 9), not as numbers to quote. The guide states it is\ncompatible with OpenClaw 2026.2+.\n\n## When to use / when not to\n\nUse it when:\n\n- The operator asks why token or subscription usage is high, or how to bring it down.\n- A weekly or 5-hour limit is being hit and the causes have to be enumerated.\n- Deciding which model a heartbeat or a cron job should run on.\n- Auditing the size of the workspace files that ship with every message.\n- A cron job is being written and the question is whether it needs an LLM at all.\n\nDo not use it for:\n\n- Measuring current usage. It contains no telemetry, no counters and no reporting.\n  It cannot tell anyone what is being spent right now.\n- Applying anything automatically. Every change in it is manual.\n- Provider pricing, rate-limit APIs, or billing questions — none are covered.\n- Anything outside OpenClaw's own config, sessions, crons and workspace files.\n\n## Entry points\n\nThere is one:\n\n```\nskills/token-efficiency-guide/GUIDE.md\n```\n\nRead it. That is the whole interface. The code blocks inside it are meant to be\ncopied by the operator into `openclaw.json`, into `AGENTS.md`, or into\n`crontab -e`; nothing in this directory does that on its own.\n\nTwo details worth knowing before quoting the file:\n\n- Section 10 gives one complete script, a session archiver. It is the only\n  maintenance script in the guide; the guide recommends no backup, upload,\n  scheduled session-reset or API-key-switching job.\n- The top of `GUIDE.md` is a promotional header for the wider project, not part\n  of the procedure.\n\n## Permissions & Data Flow\n\n- **Reads:** only `GUIDE.md`, from this directory. Nothing else.\n- **Writes:** nothing. This skill has no write path.\n- **Network:** no calls. The only URLs are two links to the project's public\n  repository in the header text, which nothing here fetches.\n- **Credentials:** none touched, none required. No API key, no token, no session\n  file is read.\n\nThe caution is about what the operator does _after_ reading it, since the\ndocument hands over commands to run by hand:\n\n- Its config snippets change model selection in `openclaw.json`, which affects\n  cost and answer quality on heartbeats and cron jobs.\n- Its crontab lines schedule work on the operator's machine.\n- The session-archiver script in section 10 only lists session `.jsonl` files\n  untouched for 7 days unless run with `--apply`; with it, it moves them to a\n  `sessions-archive` directory and logs each move. It deletes nothing and never\n  overwrites an archived file.\n\n## Changelog\n\n- 1.2.0 — Section 10 session script is now dry-run by default (`--apply` to move), never deletes, never overwrites, logs moves; removed the recommended backup/upload, nightly session-reset and API-key-switching cron jobs and the automatic nightly reset in step 2.\n\nFile v1.2.0:_meta.json\n\n{\n  \"ownerId\": \"kn7623hrcwt6rg73a67xw3wyx580asdw\",\n  \"slug\": \"token-efficiency-guide\",\n  \"version\": \"1.2.0\",\n  \"publishedAt\": 1789646412162\n}\n\nFile v1.2.0:GUIDE.md\n\n> One of dozens of skills and plugins in **[TinkerClaw](https://github.com/globalcaos/tinkerclaw)** — a self-improving OpenClaw fork that's been running 24/7 for months.\n\n# Token Efficiency Guide\n\nBurning your weekly Claude Max limit in two days?\n\nIt's not that you use too much AI — it's that you spend it in the wrong places. Heartbeats on Opus. Context that balloons every turn. Crons that never needed a genius.\n\nMove the cheap work onto cheap models and you reclaim 80–90% of your budget for the work that actually matters. This is the exact playbook that keeps a 24/7 OpenClaw fork alive on a single account — Haiku heartbeats, session compaction, bash-ified crons — with the math behind each move.\n\n**Part of [TinkerClaw](https://github.com/globalcaos/tinkerclaw)** — real-time token tracking, self-improving crons, persistent cognitive memory. This is one piece of that stack; the repo has dozens more.\n\n👉 **https://github.com/globalcaos/tinkerclaw**\n\n_Clone it. Fork it. Break it. Make it yours._\n\n---\n\n# How to Reduce Your Token Consumption by 80-90% Instantly\n\n**For:** Anyone running OpenClaw on a Claude Max subscription\n**Goal:** Go from burning through your weekly limit in 2 days to making it last all week\n\n---\n\n## How Claude Max Limits Work\n\n- **5-hour rolling window:** Burns as you use it, resets gradually\n- **7-day rolling window:** If this hits 100%, you're stuck for days\n- **Multiple agents on one account share the same pool**\n\n**Where your tokens actually go:**\nMost users discover that 80%+ of their token budget is consumed by heartbeats on expensive models, bloated context windows, and cron jobs running on Opus. Fix these and you keep 80-90% of your budget for actual work.\n\n---\n\n## 1. Set Heartbeat Model to Haiku (~25% of total budget saved)\n\nHeartbeats fire every few minutes just to check if anything needs attention. They almost never need intelligence. Running them on Opus is like hiring a surgeon to take your temperature.\n\n**In your OpenClaw config (`openclaw.json`):**\n\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"heartbeat\": {\n        \"model\": \"anthropic/claude-haiku-4-5\"\n      }\n    }\n  }\n}\n```\n\n---\n\n## 2. Compact Sessions and Control Context Growth (~20% of total budget saved)\n\nContext accumulation is the single biggest token drain. Every message re-sends the full conversation history. A 50-message session means 200K+ tokens of cached context on every single interaction — even for a simple \"yes.\"\n\n**What to do:**\n\n- Use `/compact` during long sessions to summarize and shrink context\n- After completing a big task, reset the session yourself (`/new`) before starting the next one\n\n**In AGENTS.md or your system prompt, add:**\n\n```\nAfter completing major tasks, proactively suggest a session reset to save tokens.\n```\n\n---\n\n## 3. Convert Simple Cron Jobs to Bash Scripts (~15% of total budget saved)\n\nIf a cron job does pure logic (check a value, compare thresholds, send a notification), it doesn't need an LLM. Write a bash script and run it via system crontab.\n\n**How to identify candidates:** If the job doesn't need to _understand_ or _generate_ text, it can be bash.\n\n**Example:** A usage monitor that reads a JSON file, checks if a value exceeds a threshold, and sends a notification. That's an `if` statement, not intelligence.\n\n```bash\ncrontab -e\n# Add: */30 * * * * /path/to/your-script.sh\n```\n\n---\n\n## 4. Set Remaining Cron Jobs to Sonnet (~10% of total budget saved)\n\nCron jobs run unattended. Most don't need Opus. Each cron job on Opus uses ~5x the tokens it would on Sonnet.\n\n**For each cron job**, add a `model` field to the payload:\n\n```json\n{\n  \"payload\": {\n    \"kind\": \"agentTurn\",\n    \"model\": \"sonnet\",\n    \"message\": \"...\"\n  }\n}\n```\n\n**Rule of thumb:**\n\n- Simple monitoring, summaries, reports → **Sonnet**\n- Complex analysis, multi-step reasoning, code generation → **Opus**\n\n---\n\n## 5. Isolate Large Output Operations (~10% of total budget saved)\n\nRunning commands that produce huge outputs (directory listings, full configs, log dumps) in the main session permanently bloats it. All that output stays in session history and gets re-sent with every future message.\n\n**What to do:**\n\n- Run diagnostic/exploration commands in a sub-agent or separate session\n- Always pipe output through `head -n 20`, `grep`, or `wc -l` instead of dumping full results\n- Never run `find /`, `config.schema`, or full log exports in the main session\n\n**In AGENTS.md, add:**\n\n```\nWhen running shell commands, always limit output. Use head, grep, tail, or wc -l.\nNever dump large outputs into the main session.\n```\n\n---\n\n## 6. Reduce Cron Frequency (~8% of total budget saved)\n\nDoes this really need to run every 30 minutes? Every day?\n\n| Instead of   | Try                     | Savings         |\n| ------------ | ----------------------- | --------------- |\n| Every 30 min | Every 2 hours           | 75% of that job |\n| Daily        | Every other day         | 50% of that job |\n| Daily        | Weekly (for non-urgent) | 85% of that job |\n\n---\n\n## 7. Clean Up Workspace Files (~7% of total budget saved)\n\nEvery file listed under workspace injection gets sent with **EVERY SINGLE MESSAGE**. If these files total 20KB, that's ~5,000 tokens burned per interaction — before anyone says a word.\n\n### Step-by-step:\n\n**A. Measure current size:**\n\n```bash\ncd ~/.openclaw/workspace\ntotal=0\nfor f in SOUL.md AGENTS.md TOOLS.md USER.md IDENTITY.md MEMORY.md HEARTBEAT.md; do\n  if [ -f \"$f\" ]; then\n    size=$(wc -c < \"$f\")\n    echo \"$size bytes  $f\"\n    total=$((total + size))\n  fi\ndone\necho \"---\"\necho \"$total bytes TOTAL\"\n```\n\n**B. Target: under 15KB total (ideally under 10KB)**\n\n**C. For each file over 3KB:**\n\n1. Open the file\n2. Separate _identity_ (needed every message) from _reference_ (looked up occasionally)\n3. Move reference content to `bank/reference/FILENAME-details.md`\n4. Replace in original with a pointer:\n   ```\n   Full details: see bank/reference/FILENAME-details.md\n   ```\n\n**D. Common bloat:**\n\n| File      | Typical bloat                  | Fix                                                                         |\n| --------- | ------------------------------ | --------------------------------------------------------------------------- |\n| USER.md   | Full biography, family tree    | Keep: name, language, timezone, preferences. Move rest to `bank/reference/` |\n| TOOLS.md  | Detailed instructions per tool | Keep: 1-line per tool. Move examples to `bank/reference/`                   |\n| AGENTS.md | Long workflow descriptions     | Keep: core rules. Move procedures to `bank/reference/`                      |\n| MEMORY.md | Growing list of everything     | Keep: index with pointers. Actual memories in `memory/` directory           |\n| SOUL.md   | Personality essays             | Keep under 2KB. Personality doesn't need paragraphs                         |\n\n**E. Verify:**\n\n```bash\ncat SOUL.md AGENTS.md TOOLS.md USER.md IDENTITY.md MEMORY.md HEARTBEAT.md 2>/dev/null | wc -c\n# Should be under 15000\n```\n\n---\n\n## 8. Enable Cache Retention (~3% of total budget saved)\n\nAnthropic's prompt cache expires after 5 minutes of inactivity. Every \"cold start\" pays full price for the entire system prompt again. If you use your agent sporadically, this adds up fast.\n\n**In your config:**\n\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"models\": {\n        \"anthropic/claude-opus-4-6\": {\n          \"params\": {\n            \"cacheRetention\": \"long\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nThis tells OpenClaw to keep the prompt cache alive longer, reducing cold-start costs.\n\n---\n\n## 9. Coordinate Usage Between Agents (~2% of total budget saved)\n\nIf multiple agents share one subscription, avoid simultaneous heavy usage. The 5-hour window drains twice as fast with two active agents.\n\nAgree on time blocks. One agent does heavy work in the morning, the other in the afternoon.\n\n---\n\n## 10. Keep Maintenance Out of the LLM (~5% of total budget saved)\n\nHousekeeping does not need a model. A plain bash script costs zero tokens.\n\n### Session archiver\n\nLists session transcripts not modified in 7 days. **By default it only prints them and changes nothing.** With `--apply` it moves them into an archive directory and appends each move to `trim.log` there. It never deletes anything, never overwrites a file already in the archive, and does not touch any file changed in the last 7 days (so live sessions are left alone). To undo a move, move the file back.\n\n```bash\n#!/bin/bash\n# session-archive.sh\n#   session-archive.sh           dry run: list what would be archived\n#   session-archive.sh --apply   move those files to ARCHIVE_DIR\nset -euo pipefail\nSESSION_DIR=\"$HOME/.openclaw/agents/main/sessions\"\nARCHIVE_DIR=\"$HOME/.openclaw/agents/main/sessions-archive\"\nAPPLY=0\n[ \"${1:-}\" = \"--apply\" ] && APPLY=1\n\nfind \"$SESSION_DIR\" -maxdepth 1 -type f -name '*.jsonl' -mtime +7 -print0 |\n  while IFS= read -r -d '' f; do\n    dest=\"$ARCHIVE_DIR/$(basename \"$f\")\"\n    if [ \"$APPLY\" -eq 0 ]; then\n      echo \"would archive: $f\"\n    elif [ -e \"$dest\" ]; then\n      echo \"skip (already in archive): $f\"\n    else\n      mkdir -p \"$ARCHIVE_DIR\"\n      mv -- \"$f\" \"$dest\"\n      echo \"$(date -Is) $f -> $dest\" >> \"$ARCHIVE_DIR/trim.log\"\n    fi\n  done\n```\n\nRun it by hand without `--apply` first and read the list. Only if you want it to run on a schedule, add it to your crontab yourself with the flag:\n\n```bash\ncrontab -e\n# Add (optional):\n0 2 * * * /path/to/session-archive.sh --apply\n```\n\n---\n\n## Total Impact\n\n| Step                                  | Saves       | Effort                     |\n| ------------------------------------- | ----------- | -------------------------- |\n| 1. Heartbeat → Haiku                  | ~25%        | 1 minute (config change)   |\n| 2. Compact sessions / control context | ~20%        | 10 minutes (prompt)        |\n| 3. Simple crons → bash                | ~15%        | 1-2 hours (per script)     |\n| 4. Cron jobs → Sonnet                 | ~10%        | 5 minutes (per job)        |\n| 5. Isolate large outputs              | ~10%        | 10 minutes (prompt rules)  |\n| 6. Reduce cron frequency              | ~8%         | 5 minutes                  |\n| 7. Workspace cleanup                  | ~7%         | 30 minutes                 |\n| 8. Cache retention                    | ~3%         | 1 minute (config change)   |\n| 9. Coordinate agents                  | ~2%         | Agreement                  |\n| 10. Maintenance as bash, not LLM      | ~5%         | 15 minutes (one script)    |\n| **Combined**                          | **~80-90%** | **One afternoon**          |\n\n---\n\n_Compatible with OpenClaw 2026.2+_\n\nFile v1.2.0:skill-card.md\n\n## Description:\n\nA documentation-only agent skill that guides OpenClaw operators through manual configuration, session, cron, and workspace changes for reducing Claude subscription token consumption.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[globalcaos](https://clawhub.ai/user/globalcaos)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and OpenClaw operators use this skill as a reference when diagnosing high Claude subscription usage and choosing manual changes to model selection, cron scheduling, session management, cache retention, and workspace file size.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Manual configuration changes can affect model selection, operating cost, and answer quality.\n\nMitigation: Review openclaw.json and AGENTS.md edits before applying them, and keep changes scoped to the documented settings.\n\nRisk: Manual crontab entries can schedule recurring local work.\n\nMitigation: Inspect each crontab command, frequency, and model choice before enabling it.\n\nRisk: The session archiver moves old session files when run with --apply.\n\nMitigation: Run it without --apply first, review the listed files, and confirm the archive location before scheduling or applying it.\n\n## Reference(s):\n\n- [GUIDE.md](artifact/GUIDE.md)\n- [ClawHub skill page](https://clawhub.ai/globalcaos/skills/token-efficiency-guide)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown guidance with inline JSON and bash code blocks]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Documentation-only; no runtime tool calls, network access, writes, or credential access by the skill itself.]\n\n## Skill Version(s):\n\n1.2.0 (source: frontmatter and server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.1.1: 4 files, 6697 bytes\n\nFiles: _meta.json (141b), GUIDE.md (8794b), skill-card.md (2132b), SKILL.md (1808b)\n\nFile v1.1.1:SKILL.md\n\n---\nname: token-efficiency-guide\nversion: 1.1.0\ndescription: \"Go from weekly limit on Tuesday to weekly limit on Sunday. 10 steps, one afternoon. Built for the TinkerClaw fork — github.com/globalcaos/tinkerclaw.\"\nmetadata:\n  openclaw:\n    owner: kn7623hrcwt6rg73a67xw3wyx580asdw\n    category: optimization\n    tags:\n      - tokens\n      - efficiency\n      - claude-max\n      - cost-reduction\n      - maintenance\n    license: MIT\n---\n\n# Token Efficiency Guide\n\nMake your Claude Max subscription last the whole week. One afternoon, 10 steps, 80-90% fewer tokens burned.\n\n## What You Get\n\n10 changes ordered by impact. Most take minutes.\n\n| Step | Saves | Effort |\n|------|-------|--------|\n| 1. Heartbeat → Haiku | ~25% | 1 minute |\n| 2. Session compaction | ~20% | 10 minutes |\n| 3. Simple crons → bash | ~15% | 1-2 hours |\n| 4. Cron jobs → Sonnet | ~10% | 5 minutes |\n| 5. Isolate large outputs | ~10% | 10 minutes |\n| 6. Reduce cron frequency | ~8% | 5 minutes |\n| 7. Workspace file cleanup | ~7% | 30 minutes |\n| 8. Enable cache retention | ~3% | 1 minute |\n| 9. Coordinate multi-agent usage | ~2% | Agreement |\n| 10. Automated maintenance crons | ~5% | 1-2 hours |\n\nStep 1 alone buys you an extra day. Steps 1-3 together cover 60%.\n\n## Who This Is For\n\n- OpenClaw users on Claude Max who know what \"it's Tuesday and the limit hit\" feels like\n- Teams sharing one subscription across multiple agents\n- Anyone who'd rather spend tokens on work than on heartbeats\n\n## What's Included\n\n- Step-by-step instructions with config snippets\n- Ready-to-use maintenance scripts\n- Model routing recommendations per task type\n\n*Clone it. Fork it. Break it. Make it yours.*\n\n👉 Explore the full project: [github.com/globalcaos/clawdbot-moltbot-openclaw](https://github.com/globalcaos/clawdbot-moltbot-openclaw)\n\nFile v1.1.1:_meta.json\n\n{\n  \"ownerId\": \"kn7623hrcwt6rg73a67xw3wyx580asdw\",\n  \"slug\": \"token-efficiency-guide\",\n  \"version\": \"1.1.1\",\n  \"publishedAt\": 1780764633286\n}\n\nFile v1.1.1:GUIDE.md\n\n# How to Reduce Your Token Consumption by 80-90% Instantly\n\n**For:** Anyone running OpenClaw on a Claude Max subscription\n**Goal:** Go from burning through your weekly limit in 2 days to making it last all week\n\n---\n\n## How Claude Max Limits Work\n\n- **5-hour rolling window:** Burns as you use it, resets gradually\n- **7-day rolling window:** If this hits 100%, you're stuck for days\n- **Multiple agents on one account share the same pool**\n\n**Where your tokens actually go:**\nMost users discover that 80%+ of their token budget is consumed by heartbeats on expensive models, bloated context windows, and cron jobs running on Opus. Fix these and you keep 80-90% of your budget for actual work.\n\n---\n\n## 1. Set Heartbeat Model to Haiku (~25% of total budget saved)\n\nHeartbeats fire every few minutes just to check if anything needs attention. They almost never need intelligence. Running them on Opus is like hiring a surgeon to take your temperature.\n\n**In your OpenClaw config (`openclaw.json`):**\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"heartbeat\": {\n        \"model\": \"anthropic/claude-haiku-4-5\"\n      }\n    }\n  }\n}\n```\n\n---\n\n## 2. Compact Sessions and Control Context Growth (~20% of total budget saved)\n\nContext accumulation is the single biggest token drain. Every message re-sends the full conversation history. A 50-message session means 200K+ tokens of cached context on every single interaction — even for a simple \"yes.\"\n\n**What to do:**\n- Use `/compact` during long sessions to summarize and shrink context\n- Configure automatic session resets nightly (cron job or bash script)\n- After completing a big task, reset the session before starting the next one\n\n**In AGENTS.md or your system prompt, add:**\n```\nAfter completing major tasks, proactively suggest a session reset to save tokens.\n```\n\n---\n\n## 3. Convert Simple Cron Jobs to Bash Scripts (~15% of total budget saved)\n\nIf a cron job does pure logic (check a value, compare thresholds, send a notification), it doesn't need an LLM. Write a bash script and run it via system crontab.\n\n**How to identify candidates:** If the job doesn't need to *understand* or *generate* text, it can be bash.\n\n**Example:** A usage monitor that reads a JSON file, checks if a value exceeds a threshold, and sends a notification. That's an `if` statement, not intelligence.\n\n```bash\ncrontab -e\n# Add: */30 * * * * /path/to/your-script.sh\n```\n\n---\n\n## 4. Set Remaining Cron Jobs to Sonnet (~10% of total budget saved)\n\nCron jobs run unattended. Most don't need Opus. Each cron job on Opus uses ~5x the tokens it would on Sonnet.\n\n**For each cron job**, add a `model` field to the payload:\n```json\n{\n  \"payload\": {\n    \"kind\": \"agentTurn\",\n    \"model\": \"sonnet\",\n    \"message\": \"...\"\n  }\n}\n```\n\n**Rule of thumb:**\n- Simple monitoring, summaries, reports → **Sonnet**\n- Complex analysis, multi-step reasoning, code generation → **Opus**\n\n---\n\n## 5. Isolate Large Output Operations (~10% of total budget saved)\n\nRunning commands that produce huge outputs (directory listings, full configs, log dumps) in the main session permanently bloats it. All that output stays in session history and gets re-sent with every future message.\n\n**What to do:**\n- Run diagnostic/exploration commands in a sub-agent or separate session\n- Always pipe output through `head -n 20`, `grep`, or `wc -l` instead of dumping full results\n- Never run `find /`, `config.schema`, or full log exports in the main session\n\n**In AGENTS.md, add:**\n```\nWhen running shell commands, always limit output. Use head, grep, tail, or wc -l. \nNever dump large outputs into the main session.\n```\n\n---\n\n## 6. Reduce Cron Frequency (~8% of total budget saved)\n\nDoes this really need to run every 30 minutes? Every day?\n\n| Instead of | Try | Savings |\n|-----------|-----|---------|\n| Every 30 min | Every 2 hours | 75% of that job |\n| Daily | Every other day | 50% of that job |\n| Daily | Weekly (for non-urgent) | 85% of that job |\n\n---\n\n## 7. Clean Up Workspace Files (~7% of total budget saved)\n\nEvery file listed under workspace injection gets sent with **EVERY SINGLE MESSAGE**. If these files total 20KB, that's ~5,000 tokens burned per interaction — before anyone says a word.\n\n### Step-by-step:\n\n**A. Measure current size:**\n```bash\ncd ~/.openclaw/workspace\ntotal=0\nfor f in SOUL.md AGENTS.md TOOLS.md USER.md IDENTITY.md MEMORY.md HEARTBEAT.md; do\n  if [ -f \"$f\" ]; then\n    size=$(wc -c < \"$f\")\n    echo \"$size bytes  $f\"\n    total=$((total + size))\n  fi\ndone\necho \"---\"\necho \"$total bytes TOTAL\"\n```\n\n**B. Target: under 15KB total (ideally under 10KB)**\n\n**C. For each file over 3KB:**\n\n1. Open the file\n2. Separate *identity* (needed every message) from *reference* (looked up occasionally)\n3. Move reference content to `bank/reference/FILENAME-details.md`\n4. Replace in original with a pointer:\n   ```\n   Full details: see bank/reference/FILENAME-details.md\n   ```\n\n**D. Common bloat:**\n\n| File | Typical bloat | Fix |\n|------|--------------|-----|\n| USER.md | Full biography, family tree | Keep: name, language, timezone, preferences. Move rest to `bank/reference/` |\n| TOOLS.md | Detailed instructions per tool | Keep: 1-line per tool. Move examples to `bank/reference/` |\n| AGENTS.md | Long workflow descriptions | Keep: core rules. Move procedures to `bank/reference/` |\n| MEMORY.md | Growing list of everything | Keep: index with pointers. Actual memories in `memory/` directory |\n| SOUL.md | Personality essays | Keep under 2KB. Personality doesn't need paragraphs |\n\n**E. Verify:**\n```bash\ncat SOUL.md AGENTS.md TOOLS.md USER.md IDENTITY.md MEMORY.md HEARTBEAT.md 2>/dev/null | wc -c\n# Should be under 15000\n```\n\n---\n\n## 8. Enable Cache Retention (~3% of total budget saved)\n\nAnthropic's prompt cache expires after 5 minutes of inactivity. Every \"cold start\" pays full price for the entire system prompt again. If you use your agent sporadically, this adds up fast.\n\n**In your config:**\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"models\": {\n        \"anthropic/claude-opus-4-6\": {\n          \"params\": {\n            \"cacheRetention\": \"long\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nThis tells OpenClaw to keep the prompt cache alive longer, reducing cold-start costs.\n\n---\n\n## 9. Coordinate Usage Between Agents (~2% of total budget saved)\n\nIf multiple agents share one subscription, avoid simultaneous heavy usage. The 5-hour window drains twice as fast with two active agents.\n\nAgree on time blocks. One agent does heavy work in the morning, the other in the afternoon.\n\n---\n\n## 10. Automate Maintenance with System Cron (~5% of total budget saved)\n\nDon't rely on the LLM to keep itself clean. Set up bash scripts on system crontab for recurring maintenance. These run without any token cost.\n\n**Recommended nightly cron scripts:**\n\n### a. Session Trimmer (02:00)\nArchives session files larger than 5MB or older than 7 days. Prevents context bloat from accumulating silently.\n\n```bash\n#!/bin/bash\n# nightly-session-trim.sh\nSESSION_DIR=\"$HOME/.openclaw/agents/main/sessions\"\nARCHIVE_DIR=\"$HOME/.openclaw/agents/main/sessions-archive\"\nmkdir -p \"$ARCHIVE_DIR\"\n\n# Archive sessions > 5MB\nfind \"$SESSION_DIR\" -name \"*.jsonl\" -size +5M -exec mv {} \"$ARCHIVE_DIR/\" \\;\n\n# Archive sessions not touched in 7 days\nfind \"$SESSION_DIR\" -name \"*.jsonl\" -mtime +7 -exec mv {} \"$ARCHIVE_DIR/\" \\;\n\n# Delete archives older than 30 days\nfind \"$ARCHIVE_DIR\" -name \"*.jsonl\" -mtime +30 -delete\n```\n\n### b. Daily Backup (03:00)\nGit push for md files + Google Drive upload for databases. See disaster recovery section.\n\n### c. Session Reset (23:00)\nReset group and agent sessions nightly to prevent context snowball.\n\n### d. Usage Guard (every 30 min)\nMonitor subscription utilization and auto-switch to API key at 90% threshold.\n\n**Install all four:**\n```bash\ncrontab -e\n# Add:\n0 2 * * * /path/to/nightly-session-trim.sh\n0 3 * * * /path/to/daily-backup.sh\n0 23 * * * /path/to/reset-whatsapp-sessions.sh\n*/30 * * * * /path/to/claude-usage-guard.sh\n```\n\nThese scripts cost zero tokens and prevent the problems that waste tokens.\n\n---\n\n## Total Impact\n\n| Step | Saves | Effort |\n|------|-------|--------|\n| 1. Heartbeat → Haiku | ~25% | 1 minute (config change) |\n| 2. Compact sessions / control context | ~20% | 10 minutes (prompt + cron) |\n| 3. Simple crons → bash | ~15% | 1-2 hours (per script) |\n| 4. Cron jobs → Sonnet | ~10% | 5 minutes (per job) |\n| 5. Isolate large outputs | ~10% | 10 minutes (prompt rules) |\n| 6. Reduce cron frequency | ~8% | 5 minutes |\n| 7. Workspace cleanup | ~7% | 30 minutes |\n| 8. Cache retention | ~3% | 1 minute (config change) |\n| 9. Coordinate agents | ~2% | Agreement |\n| 10. Automate maintenance crons | ~5% | 1-2 hours (scripts) |\n| **Combined** | **~80-90%** | **One afternoon** |\n\n---\n\n*Compatible with OpenClaw 2026.2+*\n\nFile v1.1.1:skill-card.md\n\n## Description:\n\nGo from weekly limit on Tuesday to weekly limit on Sunday with a 10-step guide for reducing OpenClaw token consumption.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[globalcaos](https://clawhub.ai/user/globalcaos)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and OpenClaw users use this skill to reduce Claude Max token consumption through model routing, context management, workspace cleanup, and scheduled maintenance guidance.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The guide recommends persistent cron jobs that can move, delete, upload, and reset sensitive agent data.\n\nMitigation: Do not install the cron jobs as written; replace them with reviewed scripts that use narrow file allowlists, dry-run output, logs, restore instructions, and explicit opt-in approval for deletion, uploads, session resets, and API-key switching.\n\nRisk: Token-saving configuration changes may alter model routing, session behavior, or maintenance automation in ways that affect reliability.\n\nMitigation: Review each proposed change in a non-production setup, keep backups, and apply changes incrementally so behavior can be verified before wider use.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/globalcaos/skills/token-efficiency-guide)\n- [TinkerClaw project link from skill documentation](https://github.com/globalcaos/clawdbot-moltbot-openclaw)\n\n## Skill Output:\n\n**Output Type(s):** [Guidance, Markdown, Code, Shell commands, Configuration]\n\n**Output Format:** [Markdown with JSON, bash, cron, and configuration snippets]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Produces advisory optimization steps; users should review scripts and commands before applying them.]\n\n## Skill Version(s):\n\n1.1.1 (source: server release metadata)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.1.0: 3 files, 5441 bytes\n\nFiles: GUIDE.md (8794b), SKILL.md (1740b), _meta.json (141b)\n\nFile v1.1.0:SKILL.md\n\n---\nname: token-efficiency-guide\nversion: 1.1.0\ndescription: \"Go from weekly limit on Tuesday to weekly limit on Sunday. 10 steps, one afternoon.\"\nmetadata:\n  openclaw:\n    owner: kn7623hrcwt6rg73a67xw3wyx580asdw\n    category: optimization\n    tags:\n      - tokens\n      - efficiency\n      - claude-max\n      - cost-reduction\n      - maintenance\n    license: MIT\n---\n\n# Token Efficiency Guide\n\nMake your Claude Max subscription last the whole week. One afternoon, 10 steps, 80-90% fewer tokens burned.\n\n## What You Get\n\n10 changes ordered by impact. Most take minutes.\n\n| Step | Saves | Effort |\n|------|-------|--------|\n| 1. Heartbeat → Haiku | ~25% | 1 minute |\n| 2. Session compaction | ~20% | 10 minutes |\n| 3. Simple crons → bash | ~15% | 1-2 hours |\n| 4. Cron jobs → Sonnet | ~10% | 5 minutes |\n| 5. Isolate large outputs | ~10% | 10 minutes |\n| 6. Reduce cron frequency | ~8% | 5 minutes |\n| 7. Workspace file cleanup | ~7% | 30 minutes |\n| 8. Enable cache retention | ~3% | 1 minute |\n| 9. Coordinate multi-agent usage | ~2% | Agreement |\n| 10. Automated maintenance crons | ~5% | 1-2 hours |\n\nStep 1 alone buys you an extra day. Steps 1-3 together cover 60%.\n\n## Who This Is For\n\n- OpenClaw users on Claude Max who know what \"it's Tuesday and the limit hit\" feels like\n- Teams sharing one subscription across multiple agents\n- Anyone who'd rather spend tokens on work than on heartbeats\n\n## What's Included\n\n- Step-by-step instructions with config snippets\n- Ready-to-use maintenance scripts\n- Model routing recommendations per task type\n\n*Clone it. Fork it. Break it. Make it yours.*\n\n👉 Explore the full project: [github.com/globalcaos/clawdbot-moltbot-openclaw](https://github.com/globalcaos/clawdbot-moltbot-openclaw)\n\nFile v1.1.0:_meta.json\n\n{\n  \"ownerId\": \"kn7623hrcwt6rg73a67xw3wyx580asdw\",\n  \"slug\": \"token-efficiency-guide\",\n  \"version\": \"1.1.0\",\n  \"publishedAt\": 1771657604069\n}\n\nFile v1.1.0:GUIDE.md\n\n# How to Reduce Your Token Consumption by 80-90% Instantly\n\n**For:** Anyone running OpenClaw on a Claude Max subscription\n**Goal:** Go from burning through your weekly limit in 2 days to making it last all week\n\n---\n\n## How Claude Max Limits Work\n\n- **5-hour rolling window:** Burns as you use it, resets gradually\n- **7-day rolling window:** If this hits 100%, you're stuck for days\n- **Multiple agents on one account share the same pool**\n\n**Where your tokens actually go:**\nMost users discover that 80%+ of their token budget is consumed by heartbeats on expensive models, bloated context windows, and cron jobs running on Opus. Fix these and you keep 80-90% of your budget for actual work.\n\n---\n\n## 1. Set Heartbeat Model to Haiku (~25% of total budget saved)\n\nHeartbeats fire every few minutes just to check if anything needs attention. They almost never need intelligence. Running them on Opus is like hiring a surgeon to take your temperature.\n\n**In your OpenClaw config (`openclaw.json`):**\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"heartbeat\": {\n        \"model\": \"anthropic/claude-haiku-4-5\"\n      }\n    }\n  }\n}\n```\n\n---\n\n## 2. Compact Sessions and Control Context Growth (~20% of total budget saved)\n\nContext accumulation is the single biggest token drain. Every message re-sends the full conversation history. A 50-message session means 200K+ tokens of cached context on every single interaction — even for a simple \"yes.\"\n\n**What to do:**\n- Use `/compact` during long sessions to summarize and shrink context\n- Configure automatic session resets nightly (cron job or bash script)\n- After completing a big task, reset the session before starting the next one\n\n**In AGENTS.md or your system prompt, add:**\n```\nAfter completing major tasks, proactively suggest a session reset to save tokens.\n```\n\n---\n\n## 3. Convert Simple Cron Jobs to Bash Scripts (~15% of total budget saved)\n\nIf a cron job does pure logic (check a value, compare thresholds, send a notification), it doesn't need an LLM. Write a bash script and run it via system crontab.\n\n**How to identify candidates:** If the job doesn't need to *understand* or *generate* text, it can be bash.\n\n**Example:** A usage monitor that reads a JSON file, checks if a value exceeds a threshold, and sends a notification. That's an `if` statement, not intelligence.\n\n```bash\ncrontab -e\n# Add: */30 * * * * /path/to/your-script.sh\n```\n\n---\n\n## 4. Set Remaining Cron Jobs to Sonnet (~10% of total budget saved)\n\nCron jobs run unattended. Most don't need Opus. Each cron job on Opus uses ~5x the tokens it would on Sonnet.\n\n**For each cron job**, add a `model` field to the payload:\n```json\n{\n  \"payload\": {\n    \"kind\": \"agentTurn\",\n    \"model\": \"sonnet\",\n    \"message\": \"...\"\n  }\n}\n```\n\n**Rule of thumb:**\n- Simple monitoring, summaries, reports → **Sonnet**\n- Complex analysis, multi-step reasoning, code generation → **Opus**\n\n---\n\n## 5. Isolate Large Output Operations (~10% of total budget saved)\n\nRunning commands that produce huge outputs (directory listings, full configs, log dumps) in the main session permanently bloats it. All that output stays in session history and gets re-sent with every future message.\n\n**What to do:**\n- Run diagnostic/exploration commands in a sub-agent or separate session\n- Always pipe output through `head -n 20`, `grep`, or `wc -l` instead of dumping full results\n- Never run `find /`, `config.schema`, or full log exports in the main session\n\n**In AGENTS.md, add:**\n```\nWhen running shell commands, always limit output. Use head, grep, tail, or wc -l. \nNever dump large outputs into the main session.\n```\n\n---\n\n## 6. Reduce Cron Frequency (~8% of total budget saved)\n\nDoes this really need to run every 30 minutes? Every day?\n\n| Instead of | Try | Savings |\n|-----------|-----|---------|\n| Every 30 min | Every 2 hours | 75% of that job |\n| Daily | Every other day | 50% of that job |\n| Daily | Weekly (for non-urgent) | 85% of that job |\n\n---\n\n## 7. Clean Up Workspace Files (~7% of total budget saved)\n\nEvery file listed under workspace injection gets sent with **EVERY SINGLE MESSAGE**. If these files total 20KB, that's ~5,000 tokens burned per interaction — before anyone says a word.\n\n### Step-by-step:\n\n**A. Measure current size:**\n```bash\ncd ~/.openclaw/workspace\ntotal=0\nfor f in SOUL.md AGENTS.md TOOLS.md USER.md IDENTITY.md MEMORY.md HEARTBEAT.md; do\n  if [ -f \"$f\" ]; then\n    size=$(wc -c < \"$f\")\n    echo \"$size bytes  $f\"\n    total=$((total + size))\n  fi\ndone\necho \"---\"\necho \"$total bytes TOTAL\"\n```\n\n**B. Target: under 15KB total (ideally under 10KB)**\n\n**C. For each file over 3KB:**\n\n1. Open the file\n2. Separate *identity* (needed every message) from *reference* (looked up occasionally)\n3. Move reference content to `bank/reference/FILENAME-details.md`\n4. Replace in original with a pointer:\n   ```\n   Full details: see bank/reference/FILENAME-details.md\n   ```\n\n**D. Common bloat:**\n\n| File | Typical bloat | Fix |\n|------|--------------|-----|\n| USER.md | Full biography, family tree | Keep: name, language, timezone, preferences. Move rest to `bank/reference/` |\n| TOOLS.md | Detailed instructions per tool | Keep: 1-line per tool. Move examples to `bank/reference/` |\n| AGENTS.md | Long workflow descriptions | Keep: core rules. Move procedures to `bank/reference/` |\n| MEMORY.md | Growing list of everything | Keep: index with pointers. Actual memories in `memory/` directory |\n| SOUL.md | Personality essays | Keep under 2KB. Personality doesn't need paragraphs |\n\n**E. Verify:**\n```bash\ncat SOUL.md AGENTS.md TOOLS.md USER.md IDENTITY.md MEMORY.md HEARTBEAT.md 2>/dev/null | wc -c\n# Should be under 15000\n```\n\n---\n\n## 8. Enable Cache Retention (~3% of total budget saved)\n\nAnthropic's prompt cache expires after 5 minutes of inactivity. Every \"cold start\" pays full price for the entire system prompt again. If you use your agent sporadically, this adds up fast.\n\n**In your config:**\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"models\": {\n        \"anthropic/claude-opus-4-6\": {\n          \"params\": {\n            \"cacheRetention\": \"long\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nThis tells OpenClaw to keep the prompt cache alive longer, reducing cold-start costs.\n\n---\n\n## 9. Coordinate Usage Between Agents (~2% of total budget saved)\n\nIf multiple agents share one subscription, avoid simultaneous heavy usage. The 5-hour window drains twice as fast with two active agents.\n\nAgree on time blocks. One agent does heavy work in the morning, the other in the afternoon.\n\n---\n\n## 10. Automate Maintenance with System Cron (~5% of total budget saved)\n\nDon't rely on the LLM to keep itself clean. Set up bash scripts on system crontab for recurring maintenance. These run without any token cost.\n\n**Recommended nightly cron scripts:**\n\n### a. Session Trimmer (02:00)\nArchives session files larger than 5MB or older than 7 days. Prevents context bloat from accumulating silently.\n\n```bash\n#!/bin/bash\n# nightly-session-trim.sh\nSESSION_DIR=\"$HOME/.openclaw/agents/main/sessions\"\nARCHIVE_DIR=\"$HOME/.openclaw/agents/main/sessions-archive\"\nmkdir -p \"$ARCHIVE_DIR\"\n\n# Archive sessions > 5MB\nfind \"$SESSION_DIR\" -name \"*.jsonl\" -size +5M -exec mv {} \"$ARCHIVE_DIR/\" \\;\n\n# Archive sessions not touched in 7 days\nfind \"$SESSION_DIR\" -name \"*.jsonl\" -mtime +7 -exec mv {} \"$ARCHIVE_DIR/\" \\;\n\n# Delete archives older than 30 days\nfind \"$ARCHIVE_DIR\" -name \"*.jsonl\" -mtime +30 -delete\n```\n\n### b. Daily Backup (03:00)\nGit push for md files + Google Drive upload for databases. See disaster recovery section.\n\n### c. Session Reset (23:00)\nReset group and agent sessions nightly to prevent context snowball.\n\n### d. Usage Guard (every 30 min)\nMonitor subscription utilization and auto-switch to API key at 90% threshold.\n\n**Install all four:**\n```bash\ncrontab -e\n# Add:\n0 2 * * * /path/to/nightly-session-trim.sh\n0 3 * * * /path/to/daily-backup.sh\n0 23 * * * /path/to/reset-whatsapp-sessions.sh\n*/30 * * * * /path/to/claude-usage-guard.sh\n```\n\nThese scripts cost zero tokens and prevent the problems that waste tokens.\n\n---\n\n## Total Impact\n\n| Step | Saves | Effort |\n|------|-------|--------|\n| 1. Heartbeat → Haiku | ~25% | 1 minute (config change) |\n| 2. Compact sessions / control context | ~20% | 10 minutes (prompt + cron) |\n| 3. Simple crons → bash | ~15% | 1-2 hours (per script) |\n| 4. Cron jobs → Sonnet | ~10% | 5 minutes (per job) |\n| 5. Isolate large outputs | ~10% | 10 minutes (prompt rules) |\n| 6. Reduce cron frequency | ~8% | 5 minutes |\n| 7. Workspace cleanup | ~7% | 30 minutes |\n| 8. Cache retention | ~3% | 1 minute (config change) |\n| 9. Coordinate agents | ~2% | Agreement |\n| 10. Automate maintenance crons | ~5% | 1-2 hours (scripts) |\n| **Combined** | **~80-90%** | **One afternoon** |\n\n---\n\n*Compatible with OpenClaw 2026.2+*\n\nArchive v1.0.1: 3 files, 5345 bytes\n\nFiles: GUIDE.md (8794b), SKILL.md (1648b), _meta.json (141b)\n\nFile v1.0.1:SKILL.md\n\n---\nname: token-efficiency-guide\nversion: 1.0.0\ndescription: \"Cut your OpenClaw token consumption by 80-90% with 10 proven steps. Covers heartbeat model selection, session compaction, cron-to-bash conversion, model routing, workspace cleanup, cache retention, and automated maintenance scripts. Works with Claude Max subscriptions and shared accounts.\"\n---\n\n# Token Efficiency Guide\n\nReduce your OpenClaw token consumption by 80-90% in one afternoon.\n\n## What's Inside\n\nThe full guide (`GUIDE.md`) covers 10 actionable steps ordered by impact:\n\n| Step | Saves | Effort |\n|------|-------|--------|\n| 1. Heartbeat → Haiku | ~25% | 1 minute |\n| 2. Session compaction | ~20% | 10 minutes |\n| 3. Simple crons → bash | ~15% | 1-2 hours |\n| 4. Cron jobs → Sonnet | ~10% | 5 minutes |\n| 5. Isolate large outputs | ~10% | 10 minutes |\n| 6. Reduce cron frequency | ~8% | 5 minutes |\n| 7. Workspace file cleanup | ~7% | 30 minutes |\n| 8. Enable cache retention | ~3% | 1 minute |\n| 9. Coordinate multi-agent usage | ~2% | Agreement |\n| 10. Automated maintenance crons | ~5% | 1-2 hours |\n\n## Usage\n\nRead `GUIDE.md` for detailed instructions with copy-paste config snippets, bash scripts, and step-by-step workspace cleanup procedures.\n\n## Who This Is For\n\n- OpenClaw users on Claude Max subscriptions hitting weekly limits\n- Multiple agents sharing one subscription account\n- Anyone whose token budget disappears faster than expected\n\n## Sources\n\nBased on field experience running 13+ daily cron jobs, community research (GitHub Discussions, Reddit r/ClaudeAI, Apiyi analysis), and Anthropic's own recommendations on prompt caching and model selection.\n\nFile v1.0.1:_meta.json\n\n{\n  \"ownerId\": \"kn7623hrcwt6rg73a67xw3wyx580asdw\",\n  \"slug\": \"token-efficiency-guide\",\n  \"version\": \"1.0.1\",\n  \"publishedAt\": 1771629194198\n}\n\nFile v1.0.1:GUIDE.md\n\n# How to Reduce Your Token Consumption by 80-90% Instantly\n\n**For:** Anyone running OpenClaw on a Claude Max subscription\n**Goal:** Go from burning through your weekly limit in 2 days to making it last all week\n\n---\n\n## How Claude Max Limits Work\n\n- **5-hour rolling window:** Burns as you use it, resets gradually\n- **7-day rolling window:** If this hits 100%, you're stuck for days\n- **Multiple agents on one account share the same pool**\n\n**Where your tokens actually go:**\nMost users discover that 80%+ of their token budget is consumed by heartbeats on expensive models, bloated context windows, and cron jobs running on Opus. Fix these and you keep 80-90% of your budget for actual work.\n\n---\n\n## 1. Set Heartbeat Model to Haiku (~25% of total budget saved)\n\nHeartbeats fire every few minutes just to check if anything needs attention. They almost never need intelligence. Running them on Opus is like hiring a surgeon to take your temperature.\n\n**In your OpenClaw config (`openclaw.json`):**\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"heartbeat\": {\n        \"model\": \"anthropic/claude-haiku-4-5\"\n      }\n    }\n  }\n}\n```\n\n---\n\n## 2. Compact Sessions and Control Context Growth (~20% of total budget saved)\n\nContext accumulation is the single biggest token drain. Every message re-sends the full conversation history. A 50-message session means 200K+ tokens of cached context on every single interaction — even for a simple \"yes.\"\n\n**What to do:**\n- Use `/compact` during long sessions to summarize and shrink context\n- Configure automatic session resets nightly (cron job or bash script)\n- After completing a big task, reset the session before starting the next one\n\n**In AGENTS.md or your system prompt, add:**\n```\nAfter completing major tasks, proactively suggest a session reset to save tokens.\n```\n\n---\n\n## 3. Convert Simple Cron Jobs to Bash Scripts (~15% of total budget saved)\n\nIf a cron job does pure logic (check a value, compare thresholds, send a notification), it doesn't need an LLM. Write a bash script and run it via system crontab.\n\n**How to identify candidates:** If the job doesn't need to *understand* or *generate* text, it can be bash.\n\n**Example:** A usage monitor that reads a JSON file, checks if a value exceeds a threshold, and sends a notification. That's an `if` statement, not intelligence.\n\n```bash\ncrontab -e\n# Add: */30 * * * * /path/to/your-script.sh\n```\n\n---\n\n## 4. Set Remaining Cron Jobs to Sonnet (~10% of total budget saved)\n\nCron jobs run unattended. Most don't need Opus. Each cron job on Opus uses ~5x the tokens it would on Sonnet.\n\n**For each cron job**, add a `model` field to the payload:\n```json\n{\n  \"payload\": {\n    \"kind\": \"agentTurn\",\n    \"model\": \"sonnet\",\n    \"message\": \"...\"\n  }\n}\n```\n\n**Rule of thumb:**\n- Simple monitoring, summaries, reports → **Sonnet**\n- Complex analysis, multi-step reasoning, code generation → **Opus**\n\n---\n\n## 5. Isolate Large Output Operations (~10% of total budget saved)\n\nRunning commands that produce huge outputs (directory listings, full configs, log dumps) in the main session permanently bloats it. All that output stays in session history and gets re-sent with every future message.\n\n**What to do:**\n- Run diagnostic/exploration commands in a sub-agent or separate session\n- Always pipe output through `head -n 20`, `grep`, or `wc -l` instead of dumping full results\n- Never run `find /`, `config.schema`, or full log exports in the main session\n\n**In AGENTS.md, add:**\n```\nWhen running shell commands, always limit output. Use head, grep, tail, or wc -l. \nNever dump large outputs into the main session.\n```\n\n---\n\n## 6. Reduce Cron Frequency (~8% of total budget saved)\n\nDoes this really need to run every 30 minutes? Every day?\n\n| Instead of | Try | Savings |\n|-----------|-----|---------|\n| Every 30 min | Every 2 hours | 75% of that job |\n| Daily | Every other day | 50% of that job |\n| Daily | Weekly (for non-urgent) | 85% of that job |\n\n---\n\n## 7. Clean Up Workspace Files (~7% of total budget saved)\n\nEvery file listed under workspace injection gets sent with **EVERY SINGLE MESSAGE**. If these files total 20KB, that's ~5,000 tokens burned per interaction — before anyone says a word.\n\n### Step-by-step:\n\n**A. Measure current size:**\n```bash\ncd ~/.openclaw/workspace\ntotal=0\nfor f in SOUL.md AGENTS.md TOOLS.md USER.md IDENTITY.md MEMORY.md HEARTBEAT.md; do\n  if [ -f \"$f\" ]; then\n    size=$(wc -c < \"$f\")\n    echo \"$size bytes  $f\"\n    total=$((total + size))\n  fi\ndone\necho \"---\"\necho \"$total bytes TOTAL\"\n```\n\n**B. Target: under 15KB total (ideally under 10KB)**\n\n**C. For each file over 3KB:**\n\n1. Open the file\n2. Separate *identity* (needed every message) from *reference* (looked up occasionally)\n3. Move reference content to `bank/reference/FILENAME-details.md`\n4. Replace in original with a pointer:\n   ```\n   Full details: see bank/reference/FILENAME-details.md\n   ```\n\n**D. Common bloat:**\n\n| File | Typical bloat | Fix |\n|------|--------------|-----|\n| USER.md | Full biography, family tree | Keep: name, language, timezone, preferences. Move rest to `bank/reference/` |\n| TOOLS.md | Detailed instructions per tool | Keep: 1-line per tool. Move examples to `bank/reference/` |\n| AGENTS.md | Long workflow descriptions | Keep: core rules. Move procedures to `bank/reference/` |\n| MEMORY.md | Growing list of everything | Keep: index with pointers. Actual memories in `memory/` directory |\n| SOUL.md | Personality essays | Keep under 2KB. Personality doesn't need paragraphs |\n\n**E. Verify:**\n```bash\ncat SOUL.md AGENTS.md TOOLS.md USER.md IDENTITY.md MEMORY.md HEARTBEAT.md 2>/dev/null | wc -c\n# Should be under 15000\n```\n\n---\n\n## 8. Enable Cache Retention (~3% of total budget saved)\n\nAnthropic's prompt cache expires after 5 minutes of inactivity. Every \"cold start\" pays full price for the entire system prompt again. If you use your agent sporadically, this adds up fast.\n\n**In your config:**\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"models\": {\n        \"anthropic/claude-opus-4-6\": {\n          \"params\": {\n            \"cacheRetention\": \"long\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nThis tells OpenClaw to keep the prompt cache alive longer, reducing cold-start costs.\n\n---\n\n## 9. Coordinate Usage Between Agents (~2% of total budget saved)\n\nIf multiple agents share one subscription, avoid simultaneous heavy usage. The 5-hour window drains twice as fast with two active agents.\n\nAgree on time blocks. One agent does heavy work in the morning, the other in the afternoon.\n\n---\n\n## 10. Automate Maintenance with System Cron (~5% of total budget saved)\n\nDon't rely on the LLM to keep itself clean. Set up bash scripts on system crontab for recurring maintenance. These run without any token cost.\n\n**Recommended nightly cron scripts:**\n\n### a. Session Trimmer (02:00)\nArchives session files larger than 5MB or older than 7 days. Prevents context bloat from accumulating silently.\n\n```bash\n#!/bin/bash\n# nightly-session-trim.sh\nSESSION_DIR=\"$HOME/.openclaw/agents/main/sessions\"\nARCHIVE_DIR=\"$HOME/.openclaw/agents/main/sessions-archive\"\nmkdir -p \"$ARCHIVE_DIR\"\n\n# Archive sessions > 5MB\nfind \"$SESSION_DIR\" -name \"*.jsonl\" -size +5M -exec mv {} \"$ARCHIVE_DIR/\" \\;\n\n# Archive sessions not touched in 7 days\nfind \"$SESSION_DIR\" -name \"*.jsonl\" -mtime +7 -exec mv {} \"$ARCHIVE_DIR/\" \\;\n\n# Delete archives older than 30 days\nfind \"$ARCHIVE_DIR\" -name \"*.jsonl\" -mtime +30 -delete\n```\n\n### b. Daily Backup (03:00)\nGit push for md files + Google Drive upload for databases. See disaster recovery section.\n\n### c. Session Reset (23:00)\nReset group and agent sessions nightly to prevent context snowball.\n\n### d. Usage Guard (every 30 min)\nMonitor subscription utilization and auto-switch to API key at 90% threshold.\n\n**Install all four:**\n```bash\ncrontab -e\n# Add:\n0 2 * * * /path/to/nightly-session-trim.sh\n0 3 * * * /path/to/daily-backup.sh\n0 23 * * * /path/to/reset-whatsapp-sessions.sh\n*/30 * * * * /path/to/claude-usage-guard.sh\n```\n\nThese scripts cost zero tokens and prevent the problems that waste tokens.\n\n---\n\n## Total Impact\n\n| Step | Saves | Effort |\n|------|-------|--------|\n| 1. Heartbeat → Haiku | ~25% | 1 minute (config change) |\n| 2. Compact sessions / control context | ~20% | 10 minutes (prompt + cron) |\n| 3. Simple crons → bash | ~15% | 1-2 hours (per script) |\n| 4. Cron jobs → Sonnet | ~10% | 5 minutes (per job) |\n| 5. Isolate large outputs | ~10% | 10 minutes (prompt rules) |\n| 6. Reduce cron frequency | ~8% | 5 minutes |\n| 7. Workspace cleanup | ~7% | 30 minutes |\n| 8. Cache retention | ~3% | 1 minute (config change) |\n| 9. Coordinate agents | ~2% | Agreement |\n| 10. Automate maintenance crons | ~5% | 1-2 hours (scripts) |\n| **Combined** | **~80-90%** | **One afternoon** |\n\n---\n\n*Compatible with OpenClaw 2026.2+*\n\nArchive v1.0.0: 3 files, 5344 bytes\n\nFiles: GUIDE.md (8794b), SKILL.md (1648b), _meta.json (141b)\n\nFile v1.0.0:SKILL.md\n\n---\nname: token-efficiency-guide\nversion: 1.0.0\ndescription: \"Cut your OpenClaw token consumption by 80-90% with 10 proven steps. Covers heartbeat model selection, session compaction, cron-to-bash conversion, model routing, workspace cleanup, cache retention, and automated maintenance scripts. Works with Claude Max subscriptions and shared accounts.\"\n---\n\n# Token Efficiency Guide\n\nReduce your OpenClaw token consumption by 80-90% in one afternoon.\n\n## What's Inside\n\nThe full guide (`GUIDE.md`) covers 10 actionable steps ordered by impact:\n\n| Step | Saves | Effort |\n|------|-------|--------|\n| 1. Heartbeat → Haiku | ~25% | 1 minute |\n| 2. Session compaction | ~20% | 10 minutes |\n| 3. Simple crons → bash | ~15% | 1-2 hours |\n| 4. Cron jobs → Sonnet | ~10% | 5 minutes |\n| 5. Isolate large outputs | ~10% | 10 minutes |\n| 6. Reduce cron frequency | ~8% | 5 minutes |\n| 7. Workspace file cleanup | ~7% | 30 minutes |\n| 8. Enable cache retention | ~3% | 1 minute |\n| 9. Coordinate multi-agent usage | ~2% | Agreement |\n| 10. Automated maintenance crons | ~5% | 1-2 hours |\n\n## Usage\n\nRead `GUIDE.md` for detailed instructions with copy-paste config snippets, bash scripts, and step-by-step workspace cleanup procedures.\n\n## Who This Is For\n\n- OpenClaw users on Claude Max subscriptions hitting weekly limits\n- Multiple agents sharing one subscription account\n- Anyone whose token budget disappears faster than expected\n\n## Sources\n\nBased on field experience running 13+ daily cron jobs, community research (GitHub Discussions, Reddit r/ClaudeAI, Apiyi analysis), and Anthropic's own recommendations on prompt caching and model selection.\n\nFile v1.0.0:_meta.json\n\n{\n  \"ownerId\": \"kn7623hrcwt6rg73a67xw3wyx580asdw\",\n  \"slug\": \"token-efficiency-guide\",\n  \"version\": \"1.0.0\",\n  \"publishedAt\": 1771602105228\n}\n\nFile v1.0.0:GUIDE.md\n\n# How to Reduce Your Token Consumption by 80-90% Instantly\n\n**For:** Anyone running OpenClaw on a Claude Max subscription\n**Goal:** Go from burning through your weekly limit in 2 days to making it last all week\n\n---\n\n## How Claude Max Limits Work\n\n- **5-hour rolling window:** Burns as you use it, resets gradually\n- **7-day rolling window:** If this hits 100%, you're stuck for days\n- **Multiple agents on one account share the same pool**\n\n**Where your tokens actually go:**\nMost users discover that 80%+ of their token budget is consumed by heartbeats on expensive models, bloated context windows, and cron jobs running on Opus. Fix these and you keep 80-90% of your budget for actual work.\n\n---\n\n## 1. Set Heartbeat Model to Haiku (~25% of total budget saved)\n\nHeartbeats fire every few minutes just to check if anything needs attention. They almost never need intelligence. Running them on Opus is like hiring a surgeon to take your temperature.\n\n**In your OpenClaw config (`openclaw.json`):**\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"heartbeat\": {\n        \"model\": \"anthropic/claude-haiku-4-5\"\n      }\n    }\n  }\n}\n```\n\n---\n\n## 2. Compact Sessions and Control Context Growth (~20% of total budget saved)\n\nContext accumulation is the single biggest token drain. Every message re-sends the full conversation history. A 50-message session means 200K+ tokens of cached context on every single interaction — even for a simple \"yes.\"\n\n**What to do:**\n- Use `/compact` during long sessions to summarize and shrink context\n- Configure automatic session resets nightly (cron job or bash script)\n- After completing a big task, reset the session before starting the next one\n\n**In AGENTS.md or your system prompt, add:**\n```\nAfter completing major tasks, proactively suggest a session reset to save tokens.\n```\n\n---\n\n## 3. Convert Simple Cron Jobs to Bash Scripts (~15% of total budget saved)\n\nIf a cron job does pure logic (check a value, compare thresholds, send a notification), it doesn't need an LLM. Write a bash script and run it via system crontab.\n\n**How to identify candidates:** If the job doesn't need to *understand* or *generate* text, it can be bash.\n\n**Example:** A usage monitor that reads a JSON file, checks if a value exceeds a threshold, and sends a notification. That's an `if` statement, not intelligence.\n\n```bash\ncrontab -e\n# Add: */30 * * * * /path/to/your-script.sh\n```\n\n---\n\n## 4. Set Remaining Cron Jobs to Sonnet (~10% of total budget saved)\n\nCron jobs run unattended. Most don't need Opus. Each cron job on Opus uses ~5x the tokens it would on Sonnet.\n\n**For each cron job**, add a `model` field to the payload:\n```json\n{\n  \"payload\": {\n    \"kind\": \"agentTurn\",\n    \"model\": \"sonnet\",\n    \"message\": \"...\"\n  }\n}\n```\n\n**Rule of thumb:**\n- Simple monitoring, summaries, reports → **Sonnet**\n- Complex analysis, multi-step reasoning, code generation → **Opus**\n\n---\n\n## 5. Isolate Large Output Operations (~10% of total budget saved)\n\nRunning commands that produce huge outputs (directory listings, full configs, log dumps) in the main session permanently bloats it. All that output stays in session history and gets re-sent with every future message.\n\n**What to do:**\n- Run diagnostic/exploration commands in a sub-agent or separate session\n- Always pipe output through `head -n 20`, `grep`, or `wc -l` instead of dumping full results\n- Never run `find /`, `config.schema`, or full log exports in the main session\n\n**In AGENTS.md, add:**\n```\nWhen running shell commands, always limit output. Use head, grep, tail, or wc -l. \nNever dump large outputs into the main session.\n```\n\n---\n\n## 6. Reduce Cron Frequency (~8% of total budget saved)\n\nDoes this really need to run every 30 minutes? Every day?\n\n| Instead of | Try | Savings |\n|-----------|-----|---------|\n| Every 30 min | Every 2 hours | 75% of that job |\n| Daily | Every other day | 50% of that job |\n| Daily | Weekly (for non-urgent) | 85% of that job |\n\n---\n\n## 7. Clean Up Workspace Files (~7% of total budget saved)\n\nEvery file listed under workspace injection gets sent with **EVERY SINGLE MESSAGE**. If these files total 20KB, that's ~5,000 tokens burned per interaction — before anyone says a word.\n\n### Step-by-step:\n\n**A. Measure current size:**\n```bash\ncd ~/.openclaw/workspace\ntotal=0\nfor f in SOUL.md AGENTS.md TOOLS.md USER.md IDENTITY.md MEMORY.md HEARTBEAT.md; do\n  if [ -f \"$f\" ]; then\n    size=$(wc -c < \"$f\")\n    echo \"$size bytes  $f\"\n    total=$((total + size))\n  fi\ndone\necho \"---\"\necho \"$total bytes TOTAL\"\n```\n\n**B. Target: under 15KB total (ideally under 10KB)**\n\n**C. For each file over 3KB:**\n\n1. Open the file\n2. Separate *identity* (needed every message) from *reference* (looked up occasionally)\n3. Move reference content to `bank/reference/FILENAME-details.md`\n4. Replace in original with a pointer:\n   ```\n   Full details: see bank/reference/FILENAME-details.md\n   ```\n\n**D. Common bloat:**\n\n| File | Typical bloat | Fix |\n|------|--------------|-----|\n| USER.md | Full biography, family tree | Keep: name, language, timezone, preferences. Move rest to `bank/reference/` |\n| TOOLS.md | Detailed instructions per tool | Keep: 1-line per tool. Move examples to `bank/reference/` |\n| AGENTS.md | Long workflow descriptions | Keep: core rules. Move procedures to `bank/reference/` |\n| MEMORY.md | Growing list of everything | Keep: index with pointers. Actual memories in `memory/` directory |\n| SOUL.md | Personality essays | Keep under 2KB. Personality doesn't need paragraphs |\n\n**E. Verify:**\n```bash\ncat SOUL.md AGENTS.md TOOLS.md USER.md IDENTITY.md MEMORY.md HEARTBEAT.md 2>/dev/null | wc -c\n# Should be under 15000\n```\n\n---\n\n## 8. Enable Cache Retention (~3% of total budget saved)\n\nAnthropic's prompt cache expires after 5 minutes of inactivity. Every \"cold start\" pays full price for the entire system prompt again. If you use your agent sporadically, this adds up fast.\n\n**In your config:**\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"models\": {\n        \"anthropic/claude-opus-4-6\": {\n          \"params\": {\n            \"cacheRetention\": \"long\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nThis tells OpenClaw to keep the prompt cache alive longer, reducing cold-start costs.\n\n---\n\n## 9. Coordinate Usage Between Agents (~2% of total budget saved)\n\nIf multiple agents share one subscription, avoid simultaneous heavy usage. The 5-hour window drains twice as fast with two active agents.\n\nAgree on time blocks. One agent does heavy work in the morning, the other in the afternoon.\n\n---\n\n## 10. Automate Maintenance with System Cron (~5% of total budget saved)\n\nDon't rely on the LLM to keep itself clean. Set up bash scripts on system crontab for recurring maintenance. These run without any token cost.\n\n**Recommended nightly cron scripts:**\n\n### a. Session Trimmer (02:00)\nArchives session files larger than 5MB or older than 7 days. Prevents context bloat from accumulating silently.\n\n```bash\n#!/bin/bash\n# nightly-session-trim.sh\nSESSION_DIR=\"$HOME/.openclaw/agents/main/sessions\"\nARCHIVE_DIR=\"$HOME/.openclaw/agents/main/sessions-archive\"\nmkdir -p \"$ARCHIVE_DIR\"\n\n# Archive sessions > 5MB\nfind \"$SESSION_DIR\" -name \"*.jsonl\" -size +5M -exec mv {} \"$ARCHIVE_DIR/\" \\;\n\n# Archive sessions not touched in 7 days\nfind \"$SESSION_DIR\" -name \"*.jsonl\" -mtime +7 -exec mv {} \"$ARCHIVE_DIR/\" \\;\n\n# Delete archives older than 30 days\nfind \"$ARCHIVE_DIR\" -name \"*.jsonl\" -mtime +30 -delete\n```\n\n### b. Daily Backup (03:00)\nGit push for md files + Google Drive upload for databases. See disaster recovery section.\n\n### c. Session Reset (23:00)\nReset group and agent sessions nightly to prevent context snowball.\n\n### d. Usage Guard (every 30 min)\nMonitor subscription utilization and auto-switch to API key at 90% threshold.\n\n**Install all four:**\n```bash\ncrontab -e\n# Add:\n0 2 * * * /path/to/nightly-session-trim.sh\n0 3 * * * /path/to/daily-backup.sh\n0 23 * * * /path/to/reset-whatsapp-sessions.sh\n*/30 * * * * /path/to/claude-usage-guard.sh\n```\n\nThese scripts cost zero tokens and prevent the problems that waste tokens.\n\n---\n\n## Total Impact\n\n| Step | Saves | Effort |\n|------|-------|--------|\n| 1. Heartbeat → Haiku | ~25% | 1 minute (config change) |\n| 2. Compact sessions / control context | ~20% | 10 minutes (prompt + cron) |\n| 3. Simple crons → bash | ~15% | 1-2 hours (per script) |\n| 4. Cron jobs → Sonnet | ~10% | 5 minutes (per job) |\n| 5. Isolate large outputs | ~10% | 10 minutes (prompt rules) |\n| 6. Reduce cron frequency | ~8% | 5 minutes |\n| 7. Workspace cleanup | ~7% | 30 minutes |\n| 8. Cache retention | ~3% | 1 minute (config change) |\n| 9. Coordinate agents | ~2% | Agreement |\n| 10. Automate maintenance crons | ~5% | 1-2 hours (scripts) |\n| **Combined** | **~80-90%** | **One afternoon** |\n\n---\n\n*Compatible with OpenClaw 2026.2+*","readmeExcerpt":"Skill: TinkerClaw Token Efficiency Guide Owner: globalcaos Summary: Reference material, not an executable tool: one document (GUIDE.md) with ten concrete steps for cutting OpenClaw token consumption on a Claude subscription — heartbeat model, session compaction, cron model and frequency, bash-ified crons, workspace file size, cache retention. Read it when asked why token usage is high or how to lower it. Tags: latest","codeSnippets":[],"executableExamples":[{"language":"text","snippet":"skills/token-efficiency-guide/GUIDE.md"},{"language":"json","snippet":"{\n  \"agents\": {\n    \"defaults\": {\n      \"heartbeat\": {\n        \"model\": \"anthropic/claude-haiku-4-5\"\n      }\n    }\n  }\n}"},{"language":"text","snippet":"After completing major tasks, proactively suggest a session reset to save tokens."},{"language":"bash","snippet":"crontab -e\n# Add: */30 * * * * /path/to/your-script.sh"},{"language":"json","snippet":"{\n  \"payload\": {\n    \"kind\": \"agentTurn\",\n    \"model\": \"sonnet\",\n    \"message\": \"...\"\n  }\n}"},{"language":"text","snippet":"When running shell commands, always limit output. Use head, grep, tail, or wc -l.\nNever dump large outputs into the main session."}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: token-efficiency-guide\nversion: 1.2.0\ndescription: \"Reference material, not an executable tool: one document (GUIDE.md) with ten concrete steps for cutting OpenClaw token consumption on a Claude subscription — heartbeat model, session compaction, cron model and frequency, bash-ified crons, workspace file size, cache retention. Read it when asked why token usage is high or how to lower it.\"\n---\n\n# Token Efficiency Guide\n\n## What this is\n\nA single markdown document, `GUIDE.md`. There is no script, no CLI and no other\nfile in this directory — nothing here executes. It is written for an operator\nrunning OpenClaw against a Claude subscription who is exhausting the weekly\nlimit, and it lists ten changes with the config snippets or shell commands the\noperator applies by hand.\n\nThe ten steps, in the order the guide gives them:\n\n1. Set the heartbeat model to Haiku (`agents.defaults.heartbeat.model` in `openclaw.json`).\n2. Compact sessions and control context growth (`/compact`, a manual reset after big tasks).\n3. Rewrite cron jobs that are pure logic as bash scripts on the system crontab.\n4. Set the remaining cron jobs to Sonnet via a `model` field in the job payload.\n5. Keep large command output out of the main session (sub-agents; `head`/`grep`/`wc -l`).\n6. Lower cron frequency, with a small table of interval swaps.\n7. Shrink the workspace files that are injected into every message, with a\n   `wc -c` measuring snippet and a target of under 15 KB total.\n8. Enable `cacheRetention: \"long\"` in the model params.\n9. Coordinate time blocks when several agents share one subscription.\n10. Do housekeeping in bash instead of the LLM, with one session-archiver script\n    that is a dry run unless given `--apply`.\n\nEach step carries a percentage saving and the closing table totals them to\n\"~80-90%\". Those figures are the author's own estimates — the document shows no\nmeasurement or methodology behind them, so treat them as ordering hints (step 1\nmatters more than step 9), not as numbers to quote. The guide states it is\ncompatible with OpenClaw 2026.2+.\n\n## When to use / when not to\n\nUse it when:\n\n- The operator asks why token or subscription usage is high, or how to bring it down.\n- A weekly or 5-hour limit is being hit and the causes have to be enumerated.\n- Deciding which model a heartbeat or a cron job should run on.\n- Auditing the size of the workspace files that ship with every message.\n- A cron job is being written and the question is whether it needs an LLM at all.\n\nDo not use it for:\n\n- Measuring current usage. It contains no telemetry, no counters and no reporting.\n  It cannot tell anyone what is being spent right now.\n- Applying anything automatically. Every change in it is manual.\n- Provider pricing, rate-limit APIs, or billing questions — none are covered.\n- Anything outside OpenClaw's own config, sessions, crons and workspace files.\n\n## Entry points\n\nThere is one:\n\n```\nskills/token-efficiency-guide/GUIDE.md\n```\n\nRead it. That is the whole inter"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7623hrcwt6rg73a67xw3wyx580asdw\",\n  \"slug\": \"token-efficiency-guide\",\n  \"version\": \"1.2.0\",\n  \"publishedAt\": 1789646412162\n}"},{"path":"GUIDE.md","content":"> One of dozens of skills and plugins in **[TinkerClaw](https://github.com/globalcaos/tinkerclaw)** — a self-improving OpenClaw fork that's been running 24/7 for months.\n\n# Token Efficiency Guide\n\nBurning your weekly Claude Max limit in two days?\n\nIt's not that you use too much AI — it's that you spend it in the wrong places. Heartbeats on Opus. Context that balloons every turn. Crons that never needed a genius.\n\nMove the cheap work onto cheap models and you reclaim 80–90% of your budget for the work that actually matters. This is the exact playbook that keeps a 24/7 OpenClaw fork alive on a single account — Haiku heartbeats, session compaction, bash-ified crons — with the math behind each move.\n\n**Part of [TinkerClaw](https://github.com/globalcaos/tinkerclaw)** — real-time token tracking, self-improving crons, persistent cognitive memory. This is one piece of that stack; the repo has dozens more.\n\n👉 **https://github.com/globalcaos/tinkerclaw**\n\n_Clone it. Fork it. Break it. Make it yours._\n\n---\n\n# How to Reduce Your Token Consumption by 80-90% Instantly\n\n**For:** Anyone running OpenClaw on a Claude Max subscription\n**Goal:** Go from burning through your weekly limit in 2 days to making it last all week\n\n---\n\n## How Claude Max Limits Work\n\n- **5-hour rolling window:** Burns as you use it, resets gradually\n- **7-day rolling window:** If this hits 100%, you're stuck for days\n- **Multiple agents on one account share the same pool**\n\n**Where your tokens actually go:**\nMost users discover that 80%+ of their token budget is consumed by heartbeats on expensive models, bloated context windows, and cron jobs running on Opus. Fix these and you keep 80-90% of your budget for actual work.\n\n---\n\n## 1. Set Heartbeat Model to Haiku (~25% of total budget saved)\n\nHeartbeats fire every few minutes just to check if anything needs attention. They almost never need intelligence. Running them on Opus is like hiring a surgeon to take your temperature.\n\n**In your OpenClaw config (`openclaw.json`):**\n\n```json\n{\n  \"agents\": {\n    \"defaults\": {\n      \"heartbeat\": {\n        \"model\": \"anthropic/claude-haiku-4-5\"\n      }\n    }\n  }\n}\n```\n\n---\n\n## 2. Compact Sessions and Control Context Growth (~20% of total budget saved)\n\nContext accumulation is the single biggest token drain. Every message re-sends the full conversation history. A 50-message session means 200K+ tokens of cached context on every single interaction — even for a simple \"yes.\"\n\n**What to do:**\n\n- Use `/compact` during long sessions to summarize and shrink context\n- After completing a big task, reset the session yourself (`/new`) before starting the next one\n\n**In AGENTS.md or your system prompt, add:**\n\n```\nAfter completing major tasks, proactively suggest a session reset to save tokens.\n```\n\n---\n\n## 3. Convert Simple Cron Jobs to Bash Scripts (~15% of total budget saved)\n\nIf a cron job does pure logic (check a value, compare thresholds, send a notification), it doesn't need an LLM. Write a bash script and run i"},{"path":"skill-card.md","content":"## Description:\n\nA documentation-only agent skill that guides OpenClaw operators through manual configuration, session, cron, and workspace changes for reducing Claude subscription token consumption.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[globalcaos](https://clawhub.ai/user/globalcaos)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and OpenClaw operators use this skill as a reference when diagnosing high Claude subscription usage and choosing manual changes to model selection, cron scheduling, session management, cache retention, and workspace file size.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Manual configuration changes can affect model selection, operating cost, and answer quality.\n\nMitigation: Review openclaw.json and AGENTS.md edits before applying them, and keep changes scoped to the documented settings.\n\nRisk: Manual crontab entries can schedule recurring local work.\n\nMitigation: Inspect each crontab command, frequency, and model choice before enabling it.\n\nRisk: The session archiver moves old session files when run with --apply.\n\nMitigation: Run it without --apply first, review the listed files, and confirm the archive location before scheduling or applying it.\n\n## Reference(s):\n\n- [GUIDE.md](artifact/GUIDE.md)\n- [ClawHub skill page](https://clawhub.ai/globalcaos/skills/token-efficiency-guide)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown guidance with inline JSON and bash code blocks]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Documentation-only; no runtime tool calls, network access, writes, or credential access by the skill itself.]\n\n## Skill Version(s):\n\n1.2.0 (source: frontmatter and server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment."}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Reference material, not an executable tool: one document (GUIDE.md) with ten concrete steps for cutting OpenClaw token consumption on a Claude subscription — heartbeat model, session compaction, cron model and frequency, bash-ified crons, workspace file size, cache retention. Read it when asked why token usage is high or how to lower it. Skill: TinkerClaw Token Efficiency Guide Owner: globalcaos Summary: Reference material, not an executable tool: one document (GUIDE.md) with ten concrete steps for cutting OpenClaw token consumption on a Claude subscription — heartbeat model, session compaction, cron model and frequency, bash-ified crons, workspace file size, cache retention. Read it when asked why token usage is high or how to lower it. Tags: latest","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1677,"uniquenessScore":46,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T11:16:56.196Z","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-10-10T11:16:56.196Z","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-10T13:30:15.130Z","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"}]}}}