Agent Skillsrcarmo/piclaw › token-chart

token-chart

GitHub

生成过去7天Token使用量图表,支持按日、提供商+模型及成本分组统计。可从数据库或会话文件读取数据,输出SVG图表并通过IPC推送至Web UI时间线展示。

skel/.pi/skills/token-chart/SKILL.md rcarmo/piclaw

Trigger Scenarios

需要查看Token使用情况 生成使用量统计图表 分析模型调用成本

Install

npx skills add rcarmo/piclaw --skill token-chart -g -y
More Options

Non-standard path

npx skills add https://github.com/rcarmo/piclaw/tree/main/skel/.pi/skills/token-chart -g -y

Use without installing

npx skills use rcarmo/piclaw@token-chart

指定 Agent (Claude Code)

npx skills add rcarmo/piclaw --skill token-chart -a claude-code -g -y

安装 repo 全部 skill

npx skills add rcarmo/piclaw --all -g -y

预览 repo 内 skill

npx skills add rcarmo/piclaw --list

SKILL.md

Frontmatter
{
    "name": "token-chart",
    "description": "Generate a 7-day token usage chart (all chats) and post it to the web UI timeline.",
    "distribution": "public"
}

Token chart

Generate token-usage charts from the database or from session files.

Modes

  • default — daily stacked token-usage bars across the last N days
  • provider-model — stacked usage grouped by provider + model for attribution by model family
  • provider-model-cost — estimated cost grouped by provider + model using the pricing reference bundled with the script

Examples

Default chart:

bun /workspace/.pi/skills/token-chart/token-chart.ts

Provider + model chart:

bun /workspace/.pi/skills/token-chart/token-chart.ts --mode provider-model

Estimated provider + model cost chart:

bun /workspace/.pi/skills/token-chart/token-chart.ts --mode provider-model-cost

Post to the web chat via IPC:

bun /workspace/.pi/skills/token-chart/token-chart.ts --ipc

Post via IPC and allow a Pushover nudge:

bun /workspace/.pi/skills/token-chart/token-chart.ts --ipc --nudge

Data sources

  • default source: token_usage rows in ${PICLAW_STORE}/messages.db
  • --source sessions: read usage from session files under ${PICLAW_DATA}/sessions instead of SQLite
  • --sessions-dir <dir>: override the session-file location explicitly

Use --source sessions when DB-backed token usage is unavailable or when you want to inspect raw session-file history directly.

Output behaviour

  • --ipc writes an IPC message JSON file and, if needed, an SVG media file so piclaw posts the chart to the web timeline.
  • without --ipc, the script writes markdown to stdout with an embedded SVG data URL plus summary text.
  • --output-svg <path> writes the SVG to a file in either mode.

Notes

  • Numbers are formatted with compact K / M labels.
  • Use this on demand unless you intentionally wire it into a scheduled task.

Version History

  • 5fa0ce5 Current 2026-07-25 10:26

Same Skill Collection

runtime/skills/builtin/reload/SKILL.md
runtime/skills/builtin/remote-peer/SKILL.md
runtime/skills/builtin/schedule/SKILL.md
runtime/skills/builtin/script-discovery-annotation/SKILL.md
runtime/skills/builtin/send-message/SKILL.md
runtime/skills/integrations/playwright/SKILL.md
runtime/skills/operator/graphite-power-chart/SKILL.md
runtime/skills/operator/token-chart/SKILL.md
skel/.pi/skills/adaptive-cards-authoring/SKILL.md
skel/.pi/skills/bootstrap-container/SKILL.md
skel/.pi/skills/debug/SKILL.md
skel/.pi/skills/export-timeline-pdf/SKILL.md
skel/.pi/skills/extension-design/SKILL.md
skel/.pi/skills/extension-troubleshoot/SKILL.md
skel/.pi/skills/feature-refinement-flow/SKILL.md
skel/.pi/skills/feed-digest/SKILL.md
skel/.pi/skills/graph-design/SKILL.md
skel/.pi/skills/graphite-power-chart/SKILL.md
skel/.pi/skills/kanban-management/SKILL.md
skel/.pi/skills/mcp-adapter/SKILL.md
skel/.pi/skills/playwright/SKILL.md
skel/.pi/skills/reload/SKILL.md
skel/.pi/skills/remote-peer/SKILL.md
skel/.pi/skills/schedule/SKILL.md
skel/.pi/skills/script-discovery-annotation/SKILL.md
skel/.pi/skills/send-message/SKILL.md
skel/.pi/skills/setup/SKILL.md
skel/.pi/skills/situate-daily-notes/SKILL.md
skel/.pi/skills/technical-docs/SKILL.md
skel/.pi/skills/timeline-cleanup/SKILL.md
skel/.pi/skills/twitter-summary/SKILL.md
skel/.pi/skills/web-search-summary/SKILL.md
skel/.pi/skills/web-search/SKILL.md

Metadata

Files
0
Version
ae927fb
Hash
0fe2ce5f
Indexed
2026-07-25 10:26

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 00:33
浙ICP备14020137号-1 $방문자$