{
  "schemaVersion": "1.0",
  "item": {
    "slug": "token-usage-optimizer",
    "name": "Token Usage Optimizer",
    "source": "tencent",
    "type": "skill",
    "category": "效率提升",
    "sourceUrl": "https://clawhub.ai/rusel95/token-usage-optimizer",
    "canonicalUrl": "https://clawhub.ai/rusel95/token-usage-optimizer",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/token-usage-optimizer",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=token-usage-optimizer",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "references/api-endpoint.md",
      "references/plans.md",
      "references/token-extraction.md",
      "scripts/auto-refresh-cron.sh"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "slug": "token-usage-optimizer",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-01T13:01:21.665Z",
      "expiresAt": "2026-05-08T13:01:21.665Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=token-usage-optimizer",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=token-usage-optimizer",
        "contentDisposition": "attachment; filename=\"token-usage-optimizer-1.0.5.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "token-usage-optimizer"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/token-usage-optimizer"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/token-usage-optimizer",
    "agentPageUrl": "https://openagent3.xyz/skills/token-usage-optimizer/agent",
    "manifestUrl": "https://openagent3.xyz/skills/token-usage-optimizer/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/token-usage-optimizer/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Token Usage Optimizer",
        "body": "Version: 1.0.5\n\nGet the most out of your Claude Code subscription by monitoring usage in real-time and optimizing your daily burn rate."
      },
      {
        "title": "Why Use This?",
        "body": "You're paying $20-200/month for Claude Code. Are you:\n\n✅ Using it to its full potential?\n❌ Hitting limits too early?\n❌ Leaving quota unused at reset?\n\nThis skill tracks your 5-hour session and 7-day weekly quotas, calculates your daily burn rate, and tells you if you should use more or throttle back."
      },
      {
        "title": "Features",
        "body": "📊 Burn Rate Tracking — Are you under/over/on-pace for optimal usage?\n⚡ Smart Alerts — One-time warnings when SESSION > 50% (no spam)\n🎯 Plan-Aware — Auto-detects Pro ($20), Max 100 ($100), Max 200 ($200)\n💾 Ultra-Lightweight — 10-minute cache, minimal API calls\n📅 Daily Reports — Evening summary: SESSION, WEEKLY, burn rate\n🔄 Token Health Check — Hourly check + alert if manual refresh needed (~once per week)"
      },
      {
        "title": "1. Setup",
        "body": "Run the setup wizard to configure your OAuth tokens:\n\ncd {baseDir}\n./scripts/setup.sh\n\nYou'll need:\n\nAccess Token (sk-ant-oat01-...)\nRefresh Token (sk-ant-ort01-...)\n\nSee references/token-extraction.md for how to get these."
      },
      {
        "title": "2. Check Usage",
        "body": "./scripts/check-usage.sh\n\nOutput:\n\nSESSION=22.0\nWEEKLY=49.0\nBURN_RATE=OK\nCACHED_AT=1771583780"
      },
      {
        "title": "3. Human-Readable Report",
        "body": "./scripts/report.sh\n\nOutput:\n\n📊 Claude Code Daily Check:\n\n⏱️  SESSION (5h): 22%\n📅 WEEKLY (7d): 49%\n\n⚪ На темпі — оптимальне використання"
      },
      {
        "title": "Burn Rate Interpretation",
        "body": "🟢 UNDER — You're under-using your subscription. Use more to get your money's worth!\n⚪ OK — On pace. Optimal usage for your plan.\n🔴 OVER — Over-burning. You'll hit limits before reset."
      },
      {
        "title": "Daily Budget by Plan",
        "body": "PlanMonthlyWeekly BudgetDaily BudgetPro$20~14%~2%Max 100$100~14%~2%Max 200$200~14%~2%\n\n(7-day window resets weekly, so ~14% per day = 100% per week)"
      },
      {
        "title": "Integration with Heartbeat",
        "body": "Add to your HEARTBEAT.md:\n\n### Evening Check (18:00-20:00)\n- Claude Code usage: `/path/to/token-usage-optimizer/scripts/report.sh`"
      },
      {
        "title": "Alert Thresholds",
        "body": "SESSION > 50% → 🟡 One-time warning (won't repeat until next reset)\nWEEKLY > 80% → 🟡 One-time warning\n\nAlerts use state tracking (/tmp/claude-usage-alert-state) to avoid spam."
      },
      {
        "title": "Cache",
        "body": "Default: /tmp/claude-usage.cache with 10-minute TTL.\n\nOverride:\n\nCACHE_FILE=/custom/path CACHE_TTL=300 ./scripts/check-usage.sh"
      },
      {
        "title": "Files",
        "body": "scripts/setup.sh — Initial token configuration\nscripts/check-usage.sh — Core usage checker (cached, burn rate calc)\nscripts/report.sh — Human-readable daily report\nreferences/api-endpoint.md — Anthropic OAuth API docs\nreferences/token-extraction.md — How to get OAuth tokens\nreferences/plans.md — Claude Code subscription tiers"
      },
      {
        "title": "API Endpoint",
        "body": "GET https://api.anthropic.com/api/oauth/usage\nAuthorization: Bearer <access-token>\nanthropic-beta: oauth-2025-04-20\n\nResponse:\n\n{\n  \"five_hour\": {\n    \"utilization\": 22.0,\n    \"resets_at\": \"2026-02-20T14:00:00.364238+00:00\"\n  },\n  \"seven_day\": {\n    \"utilization\": 49.0,\n    \"resets_at\": \"2026-02-24T10:00:01.364256+00:00\"\n  }\n}"
      },
      {
        "title": "Requirements",
        "body": "curl — API requests\ndate — Timestamp parsing\ngrep, cut, printf — Text parsing\n\nNo external dependencies (jq, etc.)."
      },
      {
        "title": "Privacy",
        "body": "Tokens are stored in {baseDir}/.tokens (gitignored).\n\nNever share your access/refresh tokens."
      },
      {
        "title": "Token Health Check (Recommended)",
        "body": "OAuth tokens work for ~1 week, then need manual refresh. Set up 30-minute health check for better reliability:\n\n# Add cron job to check token health every 30 minutes\nopenclaw cron add \\\n  --name \"claude-token-refresh\" \\\n  --every 30m \\\n  --announce \\\n  --message \"Запусти {baseDir}/scripts/auto-refresh-cron.sh\"\n\nWhat it does:\n\n✅ Token valid → silent (no spam)\n🔴 Token expired → one-time alert with manual refresh instructions\n\nManual refresh (once per week, 30 seconds):\n\nclaude auth login\n# Browser opens → sign in to claude.ai → done!\n\nTokens auto-sync to {baseDir}/.tokens after successful login."
      },
      {
        "title": "Troubleshooting",
        "body": "\"No token configured\"\n→ Run ./scripts/setup.sh\n\n\"Token expired\" / \"API request failed\"\n→ OAuth tokens expire after ~1 week\n→ Manual refresh: claude auth login (browser opens → sign in → done)\n→ Set up hourly health check to get alerts before expiry (see above)\n\nBurn rate shows empty\n→ API response missing resets_at — try again in a few minutes\n\nAuto-refresh failed\n→ OAuth refresh endpoint may have changed\n→ Manual refresh: claude auth login → copy new tokens → run ./scripts/setup.sh"
      },
      {
        "title": "v1.0.5 (2026-02-22)",
        "body": "🐛 Bugfix: Fixed token extraction in auto-refresh-cron.sh (removed quotes handling)\n⚡ Performance: Reduced cron interval from 1h to 30m for more reliable token refresh\n📝 Improved reliability of OAuth token sync with ~/.claude/.credentials.json"
      },
      {
        "title": "v1.0.4 (2026-02-21)",
        "body": "🔄 Replaced automatic refresh with health check + manual refresh workflow\n📚 Updated documentation with manual refresh instructions\n⏰ Health check alerts when manual refresh needed (~once per week)"
      },
      {
        "title": "v1.0.3 (2026-02-20)",
        "body": "⏱️ Fixed auto-refresh interval (hourly instead of 5h)\n📊 Improved burn rate calculation accuracy"
      },
      {
        "title": "Contributing",
        "body": "Found a bug or have a feature request?\n→ Open an issue on ClawHub: https://clawhub.ai/friday/token-usage-optimizer"
      },
      {
        "title": "License",
        "body": "MIT"
      }
    ],
    "body": "Token Usage Optimizer\n\nVersion: 1.0.5\n\nGet the most out of your Claude Code subscription by monitoring usage in real-time and optimizing your daily burn rate.\n\nWhy Use This?\n\nYou're paying $20-200/month for Claude Code. Are you:\n\n✅ Using it to its full potential?\n❌ Hitting limits too early?\n❌ Leaving quota unused at reset?\n\nThis skill tracks your 5-hour session and 7-day weekly quotas, calculates your daily burn rate, and tells you if you should use more or throttle back.\n\nFeatures\n📊 Burn Rate Tracking — Are you under/over/on-pace for optimal usage?\n⚡ Smart Alerts — One-time warnings when SESSION > 50% (no spam)\n🎯 Plan-Aware — Auto-detects Pro ($20), Max 100 ($100), Max 200 ($200)\n💾 Ultra-Lightweight — 10-minute cache, minimal API calls\n📅 Daily Reports — Evening summary: SESSION, WEEKLY, burn rate\n🔄 Token Health Check — Hourly check + alert if manual refresh needed (~once per week)\nQuick Start\n1. Setup\n\nRun the setup wizard to configure your OAuth tokens:\n\ncd {baseDir}\n./scripts/setup.sh\n\n\nYou'll need:\n\nAccess Token (sk-ant-oat01-...)\nRefresh Token (sk-ant-ort01-...)\n\nSee references/token-extraction.md for how to get these.\n\n2. Check Usage\n./scripts/check-usage.sh\n\n\nOutput:\n\nSESSION=22.0\nWEEKLY=49.0\nBURN_RATE=OK\nCACHED_AT=1771583780\n\n3. Human-Readable Report\n./scripts/report.sh\n\n\nOutput:\n\n📊 Claude Code Daily Check:\n\n⏱️  SESSION (5h): 22%\n📅 WEEKLY (7d): 49%\n\n⚪ На темпі — оптимальне використання\n\nBurn Rate Interpretation\n🟢 UNDER — You're under-using your subscription. Use more to get your money's worth!\n⚪ OK — On pace. Optimal usage for your plan.\n🔴 OVER — Over-burning. You'll hit limits before reset.\nDaily Budget by Plan\nPlan\tMonthly\tWeekly Budget\tDaily Budget\nPro\t$20\t~14%\t~2%\nMax 100\t$100\t~14%\t~2%\nMax 200\t$200\t~14%\t~2%\n\n(7-day window resets weekly, so ~14% per day = 100% per week)\n\nIntegration with Heartbeat\n\nAdd to your HEARTBEAT.md:\n\n### Evening Check (18:00-20:00)\n- Claude Code usage: `/path/to/token-usage-optimizer/scripts/report.sh`\n\nAlert Thresholds\nSESSION > 50% → 🟡 One-time warning (won't repeat until next reset)\nWEEKLY > 80% → 🟡 One-time warning\n\nAlerts use state tracking (/tmp/claude-usage-alert-state) to avoid spam.\n\nCache\n\nDefault: /tmp/claude-usage.cache with 10-minute TTL.\n\nOverride:\n\nCACHE_FILE=/custom/path CACHE_TTL=300 ./scripts/check-usage.sh\n\nFiles\nscripts/setup.sh — Initial token configuration\nscripts/check-usage.sh — Core usage checker (cached, burn rate calc)\nscripts/report.sh — Human-readable daily report\nreferences/api-endpoint.md — Anthropic OAuth API docs\nreferences/token-extraction.md — How to get OAuth tokens\nreferences/plans.md — Claude Code subscription tiers\nAPI Endpoint\nGET https://api.anthropic.com/api/oauth/usage\nAuthorization: Bearer <access-token>\nanthropic-beta: oauth-2025-04-20\n\n\nResponse:\n\n{\n  \"five_hour\": {\n    \"utilization\": 22.0,\n    \"resets_at\": \"2026-02-20T14:00:00.364238+00:00\"\n  },\n  \"seven_day\": {\n    \"utilization\": 49.0,\n    \"resets_at\": \"2026-02-24T10:00:01.364256+00:00\"\n  }\n}\n\nRequirements\ncurl — API requests\ndate — Timestamp parsing\ngrep, cut, printf — Text parsing\n\nNo external dependencies (jq, etc.).\n\nPrivacy\n\nTokens are stored in {baseDir}/.tokens (gitignored).\n\nNever share your access/refresh tokens.\n\nToken Health Check (Recommended)\n\nOAuth tokens work for ~1 week, then need manual refresh. Set up 30-minute health check for better reliability:\n\n# Add cron job to check token health every 30 minutes\nopenclaw cron add \\\n  --name \"claude-token-refresh\" \\\n  --every 30m \\\n  --announce \\\n  --message \"Запусти {baseDir}/scripts/auto-refresh-cron.sh\"\n\n\nWhat it does:\n\n✅ Token valid → silent (no spam)\n🔴 Token expired → one-time alert with manual refresh instructions\n\nManual refresh (once per week, 30 seconds):\n\nclaude auth login\n# Browser opens → sign in to claude.ai → done!\n\n\nTokens auto-sync to {baseDir}/.tokens after successful login.\n\nTroubleshooting\n\n\"No token configured\" → Run ./scripts/setup.sh\n\n\"Token expired\" / \"API request failed\" → OAuth tokens expire after ~1 week → Manual refresh: claude auth login (browser opens → sign in → done) → Set up hourly health check to get alerts before expiry (see above)\n\nBurn rate shows empty → API response missing resets_at — try again in a few minutes\n\nAuto-refresh failed → OAuth refresh endpoint may have changed → Manual refresh: claude auth login → copy new tokens → run ./scripts/setup.sh\n\nChangelog\nv1.0.5 (2026-02-22)\n🐛 Bugfix: Fixed token extraction in auto-refresh-cron.sh (removed quotes handling)\n⚡ Performance: Reduced cron interval from 1h to 30m for more reliable token refresh\n📝 Improved reliability of OAuth token sync with ~/.claude/.credentials.json\nv1.0.4 (2026-02-21)\n🔄 Replaced automatic refresh with health check + manual refresh workflow\n📚 Updated documentation with manual refresh instructions\n⏰ Health check alerts when manual refresh needed (~once per week)\nv1.0.3 (2026-02-20)\n⏱️ Fixed auto-refresh interval (hourly instead of 5h)\n📊 Improved burn rate calculation accuracy\nContributing\n\nFound a bug or have a feature request? → Open an issue on ClawHub: https://clawhub.ai/friday/token-usage-optimizer\n\nLicense\n\nMIT"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/rusel95/token-usage-optimizer",
    "publisherUrl": "https://clawhub.ai/rusel95/token-usage-optimizer",
    "owner": "rusel95",
    "version": "1.0.5",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/token-usage-optimizer",
    "downloadUrl": "https://openagent3.xyz/downloads/token-usage-optimizer",
    "agentUrl": "https://openagent3.xyz/skills/token-usage-optimizer/agent",
    "manifestUrl": "https://openagent3.xyz/skills/token-usage-optimizer/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/token-usage-optimizer/agent.md"
  }
}