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.
Why use this skill?
Optimize OpenClaw agent performance and control API spending with Lemnos Cost Guard. Get real-time budget alerts, context bloat detection, and automated model routing.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/getlemnos32/lemnos-cost-guardWhat This Skill Does
The Lemnos Cost Guard is an essential utility for OpenClaw agents, providing granular control over API usage, budget management, and contextual efficiency. As agentic workflows scale, token consumption can quickly spiral; this skill acts as a financial firewall by monitoring real-time expenditure, enforcing strict daily budget thresholds, and providing automated alerts for excessive consumption. Beyond simple accounting, it features a context analyzer that identifies 'bloat'—situations where unnecessary data is loaded into the model context, inflating costs and slowing performance. By enforcing the provided model routing logic, the skill ensures that simple tasks are handled by cost-effective models like Haiku, reserving higher-tier models for complex reasoning. It maintains a persistent log in JSONL format, allowing for detailed audit trails and historical cost analysis.
Installation
To integrate Lemnos Cost Guard into your OpenClaw agent, execute the following command in your terminal:
clawhub install openclaw/skills/skills/getlemnos32/lemnos-cost-guard
Ensure that your environment has the necessary write permissions to the /logs directory, as the skill generates daily tracking files that are vital for reporting and budget monitoring.
Use Cases
- Budget Enforcement: Automatically pause non-revenue tasks or halt execution if daily spend exceeds user-defined limits (e.g., 100% of $5/day).
- Context Optimization: Run the
context_analyzer.pyscript to audit your workspace and prune irrelevant files that unnecessarily increase token overhead. - Cost Reporting: Generate clear, readable summaries of daily, weekly, or monthly usage for stakeholders.
- Model Routing: Utilize the routing rules to ensure the agent selects the most economical model for the task at hand.
- Post-Task Audit: Log token usage immediately after completing complex workflows to maintain a precise record of cost-per-task.
Example Prompts
- "Check our current daily spend and let me know if we are on track for our $5 budget goal today."
- "I noticed a spike in costs yesterday. Can you run the context analyzer on the workspace to see if we are loading too much data into our memory?"
- "Please generate a cost report for this week and recommend which tasks we should move to Haiku to save money."
Tips & Limitations
- Proactive Monitoring: Always run the cost report before your morning briefing to stay ahead of your budget limit. Do not ignore the 80% warning threshold.
- Context Discipline: Strict adherence to the 'Context Loading Rules' is the best way to keep your bill low. Avoid loading the full MEMORY.md if only specific segments are needed.
- Limitations: This skill relies on accurate input from the user or the agent execution loop; ensure that the
track_cost.pyscript is called immediately after significant tasks to maintain data integrity. It cannot prevent costs incurred by other agents or processes outside of the OpenClaw environment.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-getlemnos32-lemnos-cost-guard": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-write, file-read, code-execution