{
  "schemaVersion": "1.0",
  "item": {
    "slug": "openclaw-cost-governor",
    "name": "Cost Governor - Subagent Budget Control",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/donovanpankratz-del/openclaw-cost-governor",
    "canonicalUrl": "https://clawhub.ai/donovanpankratz-del/openclaw-cost-governor",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/openclaw-cost-governor",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=openclaw-cost-governor",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "bin/cost-summary.js",
      "cost-tracking-template.md",
      "lib/cost-tracker.js"
    ],
    "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",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/openclaw-cost-governor"
    },
    "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/openclaw-cost-governor",
    "agentPageUrl": "https://openagent3.xyz/skills/openclaw-cost-governor/agent",
    "manifestUrl": "https://openagent3.xyz/skills/openclaw-cost-governor/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/openclaw-cost-governor/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": "Cost Governor - Subagent Cost Control",
        "body": "Pre-flight cost checks before spawning subagents. Tracks spend. Gates expensive operations. Prevents surprise $300+ bills."
      },
      {
        "title": "Files Included",
        "body": "SKILL.md — This file (agent instructions)\nREADME.md — Human-readable setup guide\ncost-tracking-template.md — Copy this to notes/cost-tracking.md to get started\nlib/cost-tracker.js — Core estimation and logging library\nbin/cost-summary.js — CLI: daily/monthly spend summary"
      },
      {
        "title": "Problem Solved",
        "body": "You spawn a subagent for \"research passive income ideas\" on Opus. 30 minutes later: $12 gone. This skill estimates cost before execution, requires approval for expensive tasks (>$0.50), and tracks all spend."
      },
      {
        "title": "When to Use",
        "body": "Before spawning any subagent — estimate cost, log it\nDaily spend review — summarize costs vs budget\nPost-task reconciliation — compare estimated vs actual"
      },
      {
        "title": "Core Rules",
        "body": "Every subagent spawn >$0.50 estimated requires explicit user approval\nAll spawns get logged to $WORKSPACE/notes/cost-tracking.md\nEstimates use multipliers from historical data (see Cost Model)\nNo silent expensive operations — always surface cost before execution"
      },
      {
        "title": "Cost Model",
        "body": "Based on historical data from cost-tracking.md:\n\nTask TypeBase EstimateMultiplierEffective EstimateCreative (open-ended)Token estimate7.5xApply to all creative tasksResearch (bounded)Token estimate3xWeb search + synthesisTechnical (structured)Token estimate2xCode, config, structured outputSimple (template)Token estimate1.5xFill-in, short responses\n\nModel cost rates (approximate per 1K tokens):\n\nClaude Opus: ~$0.075 input / $0.375 output\nClaude Sonnet: ~$0.003 input / $0.015 output\nGPT-4: ~$0.03 input / $0.06 output\nGrok 4.1 Fast Reasoning: ~$0.003 input / $0.015 output\nClaude Haiku 4.5: ~$0.0008 input / $0.004 output"
      },
      {
        "title": "Estimation Formula",
        "body": "estimated_cost = (estimated_output_tokens / 1000) * output_rate * task_multiplier\n\nExample:\n\nTask: Creative writing (5000 tokens estimated on Opus)\nCalculation: (5000 / 1000) * $0.375 * 7.5 = $14.06\nAction: Require approval (>$0.50 threshold)"
      },
      {
        "title": "Setup",
        "body": "Create cost tracking file:\n\nmkdir -p ~/.openclaw/workspace/notes\ntouch ~/.openclaw/workspace/notes/cost-tracking.md\n\nAdd header to cost-tracking.md:\n\n# Cost Tracking Log\n\n| Date | Task | Model | Est. | Actual | Ratio | Notes |\n|------|------|-------|------|--------|-------|-------|\n\nSet your daily budget (optional):\n\necho \"DAILY_BUDGET=20.00\" >> ~/.openclaw/workspace/.env"
      },
      {
        "title": "Pre-Flight Check (Before Spawning)",
        "body": "User: \"Research passive income methods\"\nAgent: Checking cost... Estimated $3.50 (Research task, Opus, ~3K tokens * 3x multiplier). Approve?\nUser: Yes\nAgent: [spawns, logs to cost-tracking.md]"
      },
      {
        "title": "Daily Spend Dashboard",
        "body": "Run manually or via cron:\n\n## Daily Spend — 2026-02-21\n| Task | Model | Est. | Actual | Ratio |\n|------|-------|------|--------|-------|\n| PassiveIncomeResearch | Opus | $3.50 | $4.20 | 1.2x |\n| AIHardwareResearch | Sonnet | $0.80 | $0.65 | 0.8x |\n**Total:** $4.30 est / $4.85 actual\n**Budget remaining:** $15.15 / $20.00 daily"
      },
      {
        "title": "Post-Task Reconciliation",
        "body": "After each subagent completes:\n\nCheck actual cost (if available via /status)\nLog to cost-tracking.md\nUpdate multipliers if ratio is consistently off"
      },
      {
        "title": "Triggers",
        "body": "Pre-spawn gate: Before sessions_spawn, estimate and log. If >$0.50, ask user.\nCron (daily, optional): Summarize daily spend, flag overruns.\nPost-task: Log actual cost, update multipliers if data available."
      },
      {
        "title": "Approval Gate Flow",
        "body": "Estimate cost using model + task type + multiplier\nIf estimate ≤ $0.50 → proceed, log silently\nIf estimate > $0.50 → present estimate to user, wait for \"approve\" / \"yes\"\nLog decision (approved/rejected/modified) to tracking file"
      },
      {
        "title": "Budget Alerts",
        "body": "Set a daily budget cap. When spend exceeds it, the agent stops spawning and notifies you.\n\nSetup:\nAdd to your workspace config or mention it in system prompt:\n\n\"Daily API budget: $XX. Stop spawning subagents if estimated total exceeds this.\"\n\nCron-based daily summary (optional):\nAdd to your cron:\n\n# Daily cost summary at 11 PM\n0 23 * * * node ~/.openclaw/workspace/skills/cost-governor/bin/cost-summary.js --daily"
      },
      {
        "title": "Anti-Patterns (What NOT to Do)",
        "body": "❌ Spawning Opus for simple lookups (use Sonnet or Haiku)\n❌ Open-ended creative tasks without cost ceiling (\"write a novel\")\n❌ Multiple subagents when one suffices\n❌ Skipping post-task reconciliation\n❌ Ignoring consistent ratio mismatches (update multipliers!)"
      },
      {
        "title": "Advanced: Custom Multipliers",
        "body": "Edit multipliers in your cost-tracking.md header:\n\n## Multipliers (Updated 2026-02-21)\n- Creative: 10x (our tasks run long)\n- Research: 2.5x (bounded queries)\n\nAgent reads these on each check."
      },
      {
        "title": "Integration with Other Skills",
        "body": "sessions_spawn: Always run cost check before spawning\nAGENTS.md: Log cost in agent entry (\"Last used: $X.XX\")\nCron jobs: Wrap expensive recurring tasks with cost gates"
      },
      {
        "title": "Troubleshooting",
        "body": "Q: Estimates are consistently off\nA: Update multipliers in cost-tracking.md based on actual ratios.\n\nQ: How do I get actual costs?\nA: Use /status after subagent completes, or check provider dashboard."
      },
      {
        "title": "Why This Matters",
        "body": "Real story from r/LocalLLM (Jan 2026):\n\n\"Left my OpenClaw agent running overnight. Spawned 8 research subagents on Opus. Woke up to $340 API bill. This skill would've saved me.\"\n\nDon't be that person.\n\nAuthor: OpenClaw Community\nLicense: MIT\nRequires: OpenClaw with subagent support, notes/ directory"
      }
    ],
    "body": "Cost Governor - Subagent Cost Control\n\nPre-flight cost checks before spawning subagents. Tracks spend. Gates expensive operations. Prevents surprise $300+ bills.\n\nFiles Included\nSKILL.md — This file (agent instructions)\nREADME.md — Human-readable setup guide\ncost-tracking-template.md — Copy this to notes/cost-tracking.md to get started\nlib/cost-tracker.js — Core estimation and logging library\nbin/cost-summary.js — CLI: daily/monthly spend summary\nProblem Solved\n\nYou spawn a subagent for \"research passive income ideas\" on Opus. 30 minutes later: $12 gone. This skill estimates cost before execution, requires approval for expensive tasks (>$0.50), and tracks all spend.\n\nWhen to Use\nBefore spawning any subagent — estimate cost, log it\nDaily spend review — summarize costs vs budget\nPost-task reconciliation — compare estimated vs actual\nCore Rules\nEvery subagent spawn >$0.50 estimated requires explicit user approval\nAll spawns get logged to $WORKSPACE/notes/cost-tracking.md\nEstimates use multipliers from historical data (see Cost Model)\nNo silent expensive operations — always surface cost before execution\nCost Model\n\nBased on historical data from cost-tracking.md:\n\nTask Type\tBase Estimate\tMultiplier\tEffective Estimate\nCreative (open-ended)\tToken estimate\t7.5x\tApply to all creative tasks\nResearch (bounded)\tToken estimate\t3x\tWeb search + synthesis\nTechnical (structured)\tToken estimate\t2x\tCode, config, structured output\nSimple (template)\tToken estimate\t1.5x\tFill-in, short responses\n\nModel cost rates (approximate per 1K tokens):\n\nClaude Opus: ~$0.075 input / $0.375 output\nClaude Sonnet: ~$0.003 input / $0.015 output\nGPT-4: ~$0.03 input / $0.06 output\nGrok 4.1 Fast Reasoning: ~$0.003 input / $0.015 output\nClaude Haiku 4.5: ~$0.0008 input / $0.004 output\nEstimation Formula\nestimated_cost = (estimated_output_tokens / 1000) * output_rate * task_multiplier\n\n\nExample:\n\nTask: Creative writing (5000 tokens estimated on Opus)\nCalculation: (5000 / 1000) * $0.375 * 7.5 = $14.06\nAction: Require approval (>$0.50 threshold)\nSetup\nCreate cost tracking file:\nmkdir -p ~/.openclaw/workspace/notes\ntouch ~/.openclaw/workspace/notes/cost-tracking.md\n\nAdd header to cost-tracking.md:\n# Cost Tracking Log\n\n| Date | Task | Model | Est. | Actual | Ratio | Notes |\n|------|------|-------|------|--------|-------|-------|\n\nSet your daily budget (optional):\necho \"DAILY_BUDGET=20.00\" >> ~/.openclaw/workspace/.env\n\nUsage\nPre-Flight Check (Before Spawning)\nUser: \"Research passive income methods\"\nAgent: Checking cost... Estimated $3.50 (Research task, Opus, ~3K tokens * 3x multiplier). Approve?\nUser: Yes\nAgent: [spawns, logs to cost-tracking.md]\n\nDaily Spend Dashboard\n\nRun manually or via cron:\n\n## Daily Spend — 2026-02-21\n| Task | Model | Est. | Actual | Ratio |\n|------|-------|------|--------|-------|\n| PassiveIncomeResearch | Opus | $3.50 | $4.20 | 1.2x |\n| AIHardwareResearch | Sonnet | $0.80 | $0.65 | 0.8x |\n**Total:** $4.30 est / $4.85 actual\n**Budget remaining:** $15.15 / $20.00 daily\n\nPost-Task Reconciliation\n\nAfter each subagent completes:\n\nCheck actual cost (if available via /status)\nLog to cost-tracking.md\nUpdate multipliers if ratio is consistently off\nTriggers\nPre-spawn gate: Before sessions_spawn, estimate and log. If >$0.50, ask user.\nCron (daily, optional): Summarize daily spend, flag overruns.\nPost-task: Log actual cost, update multipliers if data available.\nApproval Gate Flow\nEstimate cost using model + task type + multiplier\nIf estimate ≤ $0.50 → proceed, log silently\nIf estimate > $0.50 → present estimate to user, wait for \"approve\" / \"yes\"\nLog decision (approved/rejected/modified) to tracking file\nBudget Alerts\n\nSet a daily budget cap. When spend exceeds it, the agent stops spawning and notifies you.\n\nSetup: Add to your workspace config or mention it in system prompt:\n\n\"Daily API budget: $XX. Stop spawning subagents if estimated total exceeds this.\"\n\nCron-based daily summary (optional): Add to your cron:\n\n# Daily cost summary at 11 PM\n0 23 * * * node ~/.openclaw/workspace/skills/cost-governor/bin/cost-summary.js --daily\n\nAnti-Patterns (What NOT to Do)\n❌ Spawning Opus for simple lookups (use Sonnet or Haiku)\n❌ Open-ended creative tasks without cost ceiling (\"write a novel\")\n❌ Multiple subagents when one suffices\n❌ Skipping post-task reconciliation\n❌ Ignoring consistent ratio mismatches (update multipliers!)\nAdvanced: Custom Multipliers\n\nEdit multipliers in your cost-tracking.md header:\n\n## Multipliers (Updated 2026-02-21)\n- Creative: 10x (our tasks run long)\n- Research: 2.5x (bounded queries)\n\n\nAgent reads these on each check.\n\nIntegration with Other Skills\nsessions_spawn: Always run cost check before spawning\nAGENTS.md: Log cost in agent entry (\"Last used: $X.XX\")\nCron jobs: Wrap expensive recurring tasks with cost gates\nTroubleshooting\n\nQ: Estimates are consistently off A: Update multipliers in cost-tracking.md based on actual ratios.\n\nQ: How do I get actual costs? A: Use /status after subagent completes, or check provider dashboard.\n\nWhy This Matters\n\nReal story from r/LocalLLM (Jan 2026):\n\n\"Left my OpenClaw agent running overnight. Spawned 8 research subagents on Opus. Woke up to $340 API bill. This skill would've saved me.\"\n\nDon't be that person.\n\nAuthor: OpenClaw Community\nLicense: MIT\nRequires: OpenClaw with subagent support, notes/ directory"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/donovanpankratz-del/openclaw-cost-governor",
    "publisherUrl": "https://clawhub.ai/donovanpankratz-del/openclaw-cost-governor",
    "owner": "donovanpankratz-del",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/openclaw-cost-governor",
    "downloadUrl": "https://openagent3.xyz/downloads/openclaw-cost-governor",
    "agentUrl": "https://openagent3.xyz/skills/openclaw-cost-governor/agent",
    "manifestUrl": "https://openagent3.xyz/skills/openclaw-cost-governor/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/openclaw-cost-governor/agent.md"
  }
}