← Back to Skills Marketplace
shallify

ClawCost

by ShallIfy · GitHub ↗ · v1.0.2
cross-platform ✓ Security Clean
757
Downloads
0
Stars
1
Active Installs
3
Versions
Install in OpenClaw
/install clawcost
Description
Track OpenClaw agent costs. Check daily/weekly spending and model breakdown.
README (SKILL.md)

ClawCost

Run this command:

python3 {baseDir}/scripts/clawcost.py --budget 10

Output

JSON with:

  • balance: {initial, spent, remaining} or null
  • today: cost, budget, pct
  • week: total week cost
  • total: all-time cost, tokens
  • models: breakdown all-time
  • models_today: breakdown for today only
  • daily: cost per day (last 7 days)

Set Balance

User sets INITIAL balance (when they top up):

python3 {baseDir}/scripts/clawcost.py --set-balance 50.00

Remaining auto-calculates: initial - total_spent

How to Present

Tone: Friendly, like a helpful assistant checking expenses. Use emojis sparingly.

Format: Use tree-style (├ └) for clean output:

💰 clawleaks
├ Balance $42.98 / $50 remaining
├ Today   $1.36 / $10 (14%) ✅
├ Week    $7.02
└ Total   $7.02 (15.5M tok)

📈 Sonnet $3.99 (57%) • Haiku $2.06 (29%) • Opus $0.97 (14%)

Rules:

  • Skip $0 models
  • Add brief insight ("Opus only 14%, nice savings 👍")

Alerts (IMPORTANT):

  • If today.pct > 80%: Start with ⚠️ "Warning: Daily budget {pct}% used!"
  • If today.pct > 100%: Start with 🚨 "OVER BUDGET! ${cost} spent"
  • If balance.remaining \x3C 5: Warn "💸 Low balance: ${remaining} left"
  • If balance is null: Suggest "Set initial balance with --set-balance"
  • If budget is fine: End with ✅

Contextual:

  • Quick question → short answer
  • Wants detail → full breakdown + daily
  • Over budget → always show warning first, suggest switching to Haiku
Usage Guidance
This skill appears to do what it says: it runs locally, reads your OpenClaw session logs to compute costs, and stores a small local config file. Before installing, consider: 1) inspect the included script (scripts/clawcost.py) yourself — it's short and readable; 2) be aware it reads session log files in ~/.openclaw/agents/main/sessions/*.jsonl (those files may contain conversation content), so if those logs are sensitive, review access policies or run the tool on a copy; 3) the tool writes ~/.clawcost/config.json to store initial_balance and budget — back up any existing config or check permissions; 4) there's a minor bug with JSON output mode (uses args.user) that can crash the script — run in text mode first or fix the variable; 5) if you want extra assurance, run the script in a sandboxed environment or with a non-privileged user and test with sample session files.
Capability Analysis
Type: OpenClaw Skill Name: clawcost Version: 1.0.2 The skill bundle is benign. The `scripts/clawcost.py` script reads OpenClaw session logs from `~/.openclaw/agents/main/sessions/*.jsonl` and writes configuration to `~/.clawcost/config.json`, both of which are necessary and expected for its stated purpose of tracking agent costs. The script does not perform any network calls, execute arbitrary commands, or access unrelated sensitive files. The `SKILL.md` file contains instructions for the AI agent on how to format output and generate alerts, which is a functional use of prompt injection to guide the agent's behavior for the skill's intended purpose, not for malicious ends.
Capability Assessment
Purpose & Capability
Name/description match the code and instructions: the skill is a Python script that reads OpenClaw session logs (~/.openclaw/agents/main/sessions/*.jsonl) to compute daily/weekly/all-time costs and model breakdowns, and stores settings under ~/.clawcost/config.json. Required binary (python3) is appropriate and no extraneous credentials or unrelated binaries are requested.
Instruction Scope
SKILL.md instructs running the included script and formatting output; the script implements those actions and stays within scope (reads session logs, aggregates cost, writes a local config). Notes: (1) the script reads the user's session files — these can contain conversation content; the script only extracts usage/cost fields but still opens and parses the session files. (2) There is a small bug: when run with --format json the code attempts to use args.user (which does not exist) instead of the local 'user' variable, which will raise an AttributeError; this is an availability/quality issue, not malicious behavior.
Install Mechanism
No install spec is provided (instruction-only with an included Python script). That is low-risk compared to remote downloads. The script is shipped with the skill (scripts/clawcost.py) so nothing will be fetched from external URLs during install.
Credentials
The skill requests no environment variables or credentials. It uses standard user-local paths (HOME via Path.home()) and reads/writes only: ~/.openclaw/agents/main/sessions/*.jsonl (read) and ~/.clawcost/config.json (read/write). These accesses are proportional to a local cost-tracking tool. The script also reads USER env var for display (non-sensitive).
Persistence & Privilege
The skill does not request always:true and does not modify other skills or system-wide settings. It writes only its own config under ~/.clawcost, which is reasonable for storing the initial balance/budget.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install clawcost
  3. After installation, invoke the skill by name or use /clawcost
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.2
Security fix: Use $HOME paths instead of /home/{user}/, removed --user arg, added security docs
v1.0.1
Added README documentation
v1.0.0
Initial release - Track OpenClaw agent costs with budget alerts and balance tracking
Metadata
Slug clawcost
Version 1.0.2
License
All-time Installs 1
Active Installs 1
Total Versions 3
Frequently Asked Questions

What is ClawCost?

Track OpenClaw agent costs. Check daily/weekly spending and model breakdown. It is an AI Agent Skill for Claude Code / OpenClaw, with 757 downloads so far.

How do I install ClawCost?

Run "/install clawcost" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is ClawCost free?

Yes, ClawCost is completely free (open-source). You can download, install and use it at no cost.

Which platforms does ClawCost support?

ClawCost is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created ClawCost?

It is built and maintained by ShallIfy (@shallify); the current version is v1.0.2.

💬 Comments