lemnos-cost-guard

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.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "lemnos-cost-guard" with this command: npx skills add getlemnos32/lemnos-cost-guard

Lemnos Cost Guard

Track token usage, enforce budgets, detect context bloat, and route to cheaper models.

Quick Reference

ScriptPurpose
scripts/track_cost.pyLog a cost entry after a task
scripts/cost_report.pyGenerate cost summary
scripts/context_analyzer.pyScan workspace for bloat

Pricing and model routing rules: references/model_pricing.md

Workflow

After Every Significant Task

Log cost immediately using session delta (session_status before vs after):

python3 skills/lemnos-cost-guard/scripts/track_cost.py \
  --task "email batch" \
  --input 45000 \
  --output 1200 \
  --model claude-sonnet-4-6

Logs to: logs/cost-YYYY-MM-DD.jsonl

Daily Briefing — Cost Summary Block

Run before sending the morning briefing:

python3 skills/lemnos-cost-guard/scripts/cost_report.py --days 1 --budget 5.00 --format brief

Include output verbatim in briefing. Flag anything over 80% of budget.

Budget Alerts

  • ≥80% of $5/day → warn Nick, pause non-revenue tasks
  • ≥100% of $5/day → hard stop, notify Nick immediately
  • Single call >500K input tokens → immediate alert
  • I/O ratio >50:1 → context bloat warning, recommend compaction

Context Bloat Check (run weekly or when costs spike)

python3 skills/lemnos-cost-guard/scripts/context_analyzer.py \
  --workspace /root/.openclaw/workspace

Context Loading Rules (enforce on every session)

Load ONLY what the current task requires:

TaskLoad
Morning briefingSOUL.md, USER.md, MEMORY.md, HEARTBEAT.md, today's memory
Email outreachMEMORY.md (Lemnos rules only), sent-log.md
LinkedIn researchsent-log.md only
Crypto/marketMEMORY.md (crypto section only)
Heartbeat (nothing to do)HEARTBEAT.md only

Do NOT load full MEMORY.md + all skills + all reference files unless the task requires it.

Model Routing

See references/model_pricing.md for full table. Quick rules:

  • Simple tasks (format, classify, status check) → Haiku ($0.80/M input)
  • Default → Sonnet ($3/M input)
  • Opus → never, unless explicitly requested

Cost Log Format

Each entry in logs/cost-YYYY-MM-DD.jsonl:

{
  "ts": "2026-02-24T18:00:00Z",
  "task": "email batch send",
  "model": "claude-sonnet-4-6",
  "input_tokens": 45000,
  "output_tokens": 1200,
  "ratio": 37.5,
  "cost_usd": 0.153,
  "notes": "batch 1 + batch 2"
}

ClawHub Distribution

Free tier: daily cost tracking + budget alerts Premium ($40-60/mo): full dashboards, model routing automation, context optimization reports, weekly/monthly rollups

Skill file: lemnos-cost-guard.skill

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

Agent Guardian

Agent体验守护系统。解决AI助手常见体验问题:长时间无响应、任务卡死、中英文混用、状态不透明。包含看门狗监控、智能状态汇报、即时状态查询、语言一致性过滤、消息队列追踪。适用于所有渠道(QQ/微信/Telegram/飞书/Discord等)。当用户抱怨"等太久没回复"、"回复中英文混着"、"不知道在干什么"时使...

Registry SourceRecently Updated
Automation

Proactive Agent V2

Transform AI agents from task-followers into proactive partners that anticipate needs and continuously improve. Now with WAL Protocol, Working Buffer, Autono...

Registry SourceRecently Updated
Automation

Palaia

Local, crash-safe persistent memory for OpenClaw agents. Replaces built-in memory-core with semantic search, projects, and scope-based access control. After...

Registry SourceRecently Updated
1381
iret77