{"skill":{"slug":"lemnos-cost-guard","displayName":"Lemnos Cost Guard","summary":"Real-time API cost tracking, context bloat detection, and budget enforcement for OpenClaw agents. Use when setting up cost guardrails, checking daily spend,...","description":"---\nname: lemnos-cost-guard\ndescription: \"Real-time API cost tracking, context bloat detection, and budget enforcement for OpenClaw agents. Use when setting up cost guardrails, checking daily spend, logging token usage after a task, analyzing context bloat, generating cost reports (daily/weekly/monthly), getting model routing recommendations, or when a user asks about API costs, budget status, or why costs are high. 适用于一人公司和AI运营团队的实时成本监控工具。防止API成本失控。328+次安装。\"\n---\n\n# Lemnos Cost Guard\n\nTrack token usage, enforce budgets, detect context bloat, and route to cheaper models.\n\n## Quick Reference\n\n| Script | Purpose |\n|--------|---------|\n| `scripts/track_cost.py` | Log a cost entry after a task |\n| `scripts/cost_report.py` | Generate cost summary |\n| `scripts/context_analyzer.py` | Scan workspace for bloat |\n\nPricing and model routing rules: `references/model_pricing.md`\n\n## Workflow\n\n### After Every Significant Task\nLog cost immediately using session delta (session_status before vs after):\n\n```bash\npython3 skills/lemnos-cost-guard/scripts/track_cost.py \\\n  --task \"email batch\" \\\n  --input 45000 \\\n  --output 1200 \\\n  --model claude-sonnet-4-6\n```\n\nLogs to: `logs/cost-YYYY-MM-DD.jsonl`\n\n### Daily Briefing — Cost Summary Block\nRun before sending the morning briefing:\n\n```bash\npython3 skills/lemnos-cost-guard/scripts/cost_report.py --days 1 --budget 5.00 --format brief\n```\n\nInclude output verbatim in briefing. Flag anything over 80% of budget.\n\n### Budget Alerts\n- **≥80% of $5/day** → warn user, pause non-revenue tasks\n- **≥100% of $5/day** → hard stop, notify user immediately\n- **Single call >500K input tokens** → immediate alert\n- **I/O ratio >50:1** → context bloat warning, recommend compaction\n\n### Context Bloat Check (run weekly or when costs spike)\n\n```bash\npython3 skills/lemnos-cost-guard/scripts/context_analyzer.py \\\n  --workspace /root/.openclaw/workspace\n```\n\n## Context Loading Rules (enforce on every session)\n\nLoad ONLY what the current task requires:\n\n| Task | Load |\n|------|------|\n| Morning briefing | SOUL.md, USER.md, MEMORY.md, HEARTBEAT.md, today's memory |\n| Email outreach | MEMORY.md (Lemnos rules only), sent-log.md |\n| LinkedIn research | sent-log.md only |\n| Crypto/market | MEMORY.md (crypto section only) |\n| Heartbeat (nothing to do) | HEARTBEAT.md only |\n\nDo NOT load full MEMORY.md + all skills + all reference files unless the task requires it.\n\n## Model Routing\n\nSee `references/model_pricing.md` for full table. Quick rules:\n- Simple tasks (format, classify, status check) → Haiku ($0.80/M input)\n- Default → Sonnet ($3/M input)  \n- Opus → never, unless explicitly requested\n\n## Cost Log Format\n\nEach entry in `logs/cost-YYYY-MM-DD.jsonl`:\n```json\n{\n  \"ts\": \"2026-02-24T18:00:00Z\",\n  \"task\": \"email batch send\",\n  \"model\": \"claude-sonnet-4-6\",\n  \"input_tokens\": 45000,\n  \"output_tokens\": 1200,\n  \"ratio\": 37.5,\n  \"cost_usd\": 0.153,\n  \"notes\": \"batch 1 + batch 2\"\n}\n```\n\n## ⭐ If This Saves You Money\nStar it on ClawHub — it helps others find it: https://clawhub.ai/skills/lemnos-cost-guard\n\n## Source Code\nGitHub: https://github.com/getlemnos32/cost-guard\n\n## ClawHub Distribution\n\nFree tier: daily cost tracking + budget alerts\nPremium ($40-60/mo): full dashboards, model routing automation, context optimization reports, weekly/monthly rollups\n\nSkill file: `lemnos-cost-guard.skill`\n","tags":{"latest":"1.2.2","ai-agent":"1.2.0","api-cost-monitor":"1.2.0","budget":"1.2.0","budget-management":"1.2.0","business-automation":"1.2.0","cost-control":"1.2.0","cost-guard":"1.2.0","lobster-tool":"1.2.0","open-source-ai":"1.2.0","openclaw":"1.2.0","solo-operator":"1.2.0"},"stats":{"comments":0,"downloads":881,"installsAllTime":1,"installsCurrent":1,"stars":0,"versions":7},"createdAt":1772295847825,"updatedAt":1778491670926},"latestVersion":{"version":"1.2.2","createdAt":1774660102352,"changelog":"Updated install count: 328+","license":"MIT-0"},"metadata":null,"owner":{"handle":"getlemnos32","userId":"s17fcc10xqx630bqsnnz08879583kfnx","displayName":"getlemnos32","image":"https://avatars.githubusercontent.com/u/248950239?v=4"},"moderation":null}