Receber por email
← Voltar para o catálogo

usage

Show usage cost summary — session, today, last 30 days. OpenClaw-compatible format. Works from CLI or messaging. Triggers on /usage, /agent:usage, "cuanto gasté", "agent usage", "cost".

61estrelas
Atualizado há 3 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add crisandrews/ClawCode

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/usage/svg)](https://www.skillteca.com.br/skills/usage)

Skills relacionadas

Ver todas de Desenvolvimento →

Alerta por categoria

Receba novas skills de Desenvolvimento toda segunda

1 email curto, só com as skills novas de Desenvolvimento. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

/usage — Cost Summary

Show usage costs in the OpenClaw-compatible format. Works from CLI or messaging channels.

Output format (matches OpenClaw exactly)

💸 Usage cost
Session <cost> · <tokens> tokens
Today <cost>
Last 30d <cost>

Subcommands

  • /usage — show the cost summary (default)
  • /usage tokens — compact token display
  • /usage full — verbose token + cost
  • /usage cost — same as default

Steps

  1. Detect surface (CLI vs messaging channel).
  1. Try to read session cost data from Claude Code's session store:

``bash ls ~/.claude/projects//\.jsonl 2>/dev/null | head -3 ``

NOTE: Claude Code stores session data in ~/.claude/projects/<slug>/*.jsonl. The plugin cannot reliably read these because:

  • The session slug depends on the current cwd
  • The format is internal to Claude Code
  • Token counts per session are not always available to skills
  1. Fall back to estimate from memory/dreams:
  2. Call agent_status MCP tool → get file/chunk counts
  3. Bash: du -sh memory/ | awk '{print $1}' → memory dir size
  4. Bash: wc -l memory/.dreams/events.jsonl 2>/dev/null | awk '{print $1}' → event count
  1. Build the response in OpenClaw format:

When cost data is available

💸 Usage cost
Session $0.42 · 125k tokens
Today $1.23
Last 30d $34.56

When cost data is NOT available (most likely case)

💸 Usage cost
Session n/a (run native /cost or /usage in CLI for tokens)
Today n/a
Last 30d n/a

📊 Agent resources
Memory: <size>, <N> files, <M> chunks
Dreams: <events> events, <unique> unique memories
  1. Format per surface:
  2. CLI: standard markdown
  3. WhatsApp: single bold
  4. Telegram: bold
  1. Reply tool if on messaging channel.

Important

  • Claude Code does not expose session cost data to plugin skills directly.
  • The honest answer is "n/a — use native /cost on CLI for real token/cost data".
  • Agent resources (memory, dreams, files) ARE available and we can show them.
  • This matches OpenClaw's /usage cost format but with the Claude Code limitation documented.
  • This is the agent-aware equivalent of OpenClaw's /usage.
Compartilhar X LinkedIn