← 返回 Skills 市场
getlemnos32

Lemnos Cost Guard

作者 getlemnos32 · GitHub ↗ · v1.2.2 · MIT-0
cross-platform ✓ 安全检测通过
490
总下载
0
收藏
1
当前安装
7
版本数
在 OpenClaw 中安装
/install 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,...
使用说明 (SKILL.md)

Lemnos Cost Guard

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

Quick Reference

Script Purpose
scripts/track_cost.py Log a cost entry after a task
scripts/cost_report.py Generate cost summary
scripts/context_analyzer.py Scan 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 user, pause non-revenue tasks
  • ≥100% of $5/day → hard stop, notify user 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:

Task Load
Morning briefing SOUL.md, USER.md, MEMORY.md, HEARTBEAT.md, today's memory
Email outreach MEMORY.md (Lemnos rules only), sent-log.md
LinkedIn research sent-log.md only
Crypto/market MEMORY.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"
}

⭐ If This Saves You Money

Star it on ClawHub — it helps others find it: https://clawhub.ai/skills/lemnos-cost-guard

Source Code

GitHub: https://github.com/getlemnos32/cost-guard

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

安全使用建议
This skill appears to do what it says: it reads OpenClaw session JSONL files and workspace documents to compute token/cost metrics and detect context bloat, and writes local logs and reports. Before installing or running: 1) Review the shipped Python files yourself (they are small and readable) to confirm behavior. 2) Note the scripts read files like USER.md, IDENTITY.md, and MEMORY.md under /root/.openclaw — these can contain sensitive personal data; ensure you are comfortable with that data being parsed and stored in local cost logs. 3) The skill does not transmit data over the network, but if you plan to share reports or include outputs verbatim in briefings, scrub sensitive content first. 4) Run the scripts in a controlled/local environment with appropriate file permissions (or adjust the SESSION_DIR/LOG_DIR paths) if you want to limit exposure. 5) If you need third-party hosting or dashboard features (premium tier), verify any external services before providing credentials.
功能分析
Type: OpenClaw Skill Name: lemnos-cost-guard Version: 1.2.2 The lemnos-cost-guard skill bundle is designed for monitoring and managing API expenditures within the OpenClaw environment. The scripts (e.g., auto_cost_report.py, task_logger.py, and context_analyzer.py) function by reading local session logs and workspace files to calculate token usage and estimate costs based on hardcoded pricing models. No evidence of data exfiltration, unauthorized network access, or malicious prompt injection was found; the instructions in SKILL.md are strictly focused on budget enforcement and context optimization.
能力评估
Purpose & Capability
The name/description promise (real-time cost tracking, context-bloat detection, budget enforcement) matches the included scripts: session log readers (auto_cost_report.py, task_logger.py), manual logger (track_cost.py), reporters (cost_report.py, task_cost_report.py), and a workspace scanner (context_analyzer.py). Files and model_pricing.md align with model routing/cost math. No unrelated capabilities (cloud provisioning, sending credentials, or network exfiltration) are present.
Instruction Scope
SKILL.md instructs the agent/operator to read OpenClaw session JSONL files and workspace files (e.g., SOUL.md, USER.md, MEMORY.md, IDENTITY.md). That scope is appropriate for detecting context bloat and computing costs, but it does mean the skill will read potentially sensitive local content (identity/memory). The instructions do not direct data to any external endpoint; they only print or write local reports. SKILL.md's advice to 'include output verbatim in briefing' is an operational decision that could leak sensitive content if not reviewed.
Install Mechanism
No install spec — instruction-only with shipped Python scripts. Nothing is downloaded or extracted at install time. Running the scripts writes logs under the skill/workspace and reads existing OpenClaw session files; this is low-risk as long as scripts are executed locally and reviewed beforehand.
Credentials
The skill requests no environment variables or external credentials, which is proportional. It does, however, read files under /root/.openclaw (agent session JSONL files and workspace files such as USER.md, IDENTITY.md, MEMORY.md). That filesystem access is necessary for the stated purpose but exposes sensitive local content to the tool's processing and local logs, so users should be aware and comfortable with those read/write operations.
Persistence & Privilege
always:false (not force-included). The scripts create and write snapshots, logs, and reports in their own skill directories (references/, logs/). They do not modify other skills or global agent configuration. Autonomous invocation is allowed by platform default but not unusual; it increases blast radius only if you plan to grant the skill broad autonomous privileges — this skill itself does not request elevated system privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install lemnos-cost-guard
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /lemnos-cost-guard 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.2
Updated install count: 328+
v1.0.2
Replaced hardcoded user name references with generic 'user' for public distribution
v1.2.1
Added GitHub source link + updated install count to 258+
v1.2.0
Bilingual EN/ZH release — Chinese market keywords added to description, targeting 一人公司 and AI ops teams
v1.1.0
v1.1.0: Promoted auto_cost_report.py as the zero-config primary script (reads OpenClaw session files directly, no manual logging). Added task_logger.py to quickstart. Rewrote SKILL.md with cleaner structure, model routing table, and Lemnos/GitHub links. Updated budget thresholds to match production usage (0/5 split).
v1.0.1
Full release — includes cost tracking scripts, context analyzer, model pricing reference, and auto cost report.
v1.0.0
Initial release — real-time API cost tracking, context bloat detection, and budget enforcement for OpenClaw agents.
元数据
Slug lemnos-cost-guard
版本 1.2.2
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 7
常见问题

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,... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 490 次。

如何安装 Lemnos Cost Guard?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install lemnos-cost-guard」即可一键安装,无需额外配置。

Lemnos Cost Guard 是免费的吗?

是的,Lemnos Cost Guard 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Lemnos Cost Guard 支持哪些平台?

Lemnos Cost Guard 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Lemnos Cost Guard?

由 getlemnos32(@getlemnos32)开发并维护,当前版本 v1.2.2。

💬 留言讨论