跳转到主要内容
此内容尚未提供您的语言版本,正在以英文显示。

Cost Track

技能 已验证 活跃

Auto-capture per-session token usage from the Claude Code session jsonl and persist to the cost-tracking namespace

目的

To provide a transparent and automated way to track the token usage and associated costs of Claude Code sessions for better budget management and reporting.

功能

  • Auto-capture per-session token usage
  • Persist usage to AgentDB
  • Calculate USD cost based on model pricing
  • Support for environment variable overrides
  • Dry-run capability

使用场景

  • Capturing spend after a meaningful chunk of work
  • Persisting final tally at session end
  • Periodically capturing costs during long sessions
  • Providing data for cost reporting and optimization tools

非目标

  • Directly managing LLM provider accounts or billing
  • Real-time alerting for budget overruns (this is a producer for other skills)
  • Providing detailed analysis of *why* tokens were used

工作流

  1. Run the tracker script from the project root
  2. Script auto-discovers session jsonl or uses TRACK_SESSION env var
  3. Calculate cost using defined pricing
  4. Persist structured record to AgentDB cost-tracking namespace
  5. Inspect markdown summary and verify persistence

实践

  • Cost Tracking
  • Session Management

先决条件

  • Claude Code environment
  • Access to session jsonl files
  • AgentDB namespace configured

Code Execution

  • info:ValidationWhile the script's operations are well-defined, explicit input validation using a schema library is not evident for environment variables or session data parsing.
  • info:LoggingThe script provides markdown output for successful runs and can suppress it with `TRACK_QUIET=1`, but detailed audit logging to a specific file is not explicitly mentioned.

安装

请先添加 Marketplace

/plugin marketplace add ruvnet/ruflo
/plugin install ruflo-cost-tracker@ruflo

质量评分

已验证
97 /100
1 day ago 分析

信任信号

最近提交1 day ago
星标50.2k
许可证MIT
状态
查看源代码