← 返回 Skills 市场
imgolye

Agent Usage Tracker

作者 imgolye · GitHub ↗ · v0.1.0
cross-platform ✓ 安全检测通过
352
总下载
0
收藏
3
当前安装
1
版本数
在 OpenClaw 中安装
/install agent-usage-tracker
功能描述
Track AI agent token usage, model costs, and budget thresholds with a TypeScript and SQLite workflow. Use when the user wants to instrument agent runs, calcu...
使用说明 (SKILL.md)

Agent Usage Tracker

Use this skill when you need local token accounting for AI agents.

What it provides

  • Real-time token usage persistence in SQLite
  • Cost calculation based on per-model pricing
  • Budget thresholds with persisted warning and blocking states
  • Usage statistics grouped by time window, session, or model

Files to use

  • src/UsageTracker.ts: ingestion, storage, and reporting
  • src/CostCalculator.ts: pricing catalog and cost math
  • src/BudgetManager.ts: budget policy evaluation
  • examples/basic-usage.ts: end-to-end usage example
  • tests/: reference behavior for tracking, budgeting, and aggregation

Recommended workflow

  1. Instantiate UsageTracker with a SQLite path or :memory: for tests.
  2. Register model pricing with CostCalculator.
  3. Record each agent interaction with prompt tokens, completion tokens, session id, and timestamp.
  4. Save reusable budgets with BudgetManager.setBudget, then call evaluateBudget before or after new work to warn or stop when a limit is exceeded.
  5. Use UsageTracker.getUsageSummary or getTimeSeries for reporting.

Integration notes

  • Store token counts at the moment the provider returns usage metadata.
  • Keep model ids normalized. Pricing lookup is exact by model id.
  • Use metadata for provider-specific fields such as request id or tool name.
  • For sliding-window budgets, query usage by startTime and endTime before dispatching new work.

Output expectations

This skill ships as a local Node.js package with tests and examples. Extend CostCalculator if your provider pricing changes.

安全使用建议
This appears to be a straightforward local usage-tracking library. If you plan to install or run it: (1) review and run the tests locally (the repo includes Vitest tests and examples); (2) note it writes a SQLite DB file (default 'usage-tracker.db') — avoid pointing it at directories containing sensitive data or credentials; (3) metadata fields are stored as JSON, so avoid sending sensitive PII into the metadata; (4) the dependency better-sqlite3 is a native module and may require build tools on your machine — inspect package.json and run npm install in a controlled environment; and (5) if you want remote reporting, verify and add explicit networking code rather than assuming the package will do it. Overall the package is coherent with its stated purpose.
功能分析
Type: OpenClaw Skill Name: agent-usage-tracker Version: 0.1.0 The agent-usage-tracker skill is a legitimate utility for monitoring AI token consumption and costs using a local SQLite database. The implementation follows secure coding practices, specifically using prepared statements in 'UsageTracker.ts' and 'BudgetManager.ts' to prevent SQL injection, and lacks any indicators of data exfiltration, unauthorized network access, or malicious prompt-injection instructions.
能力评估
Purpose & Capability
Name/description align with the code: CostCalculator, UsageTracker, and BudgetManager implement local token accounting, cost math, and budget enforcement. The dependency (better-sqlite3) is appropriate for the stated SQLite persistence.
Instruction Scope
SKILL.md instructions stay within scope: they explain instantiation, recording provider-returned usage metadata, budget evaluation, and reporting. No instructions ask the agent to read unrelated files, env vars, or send data to external endpoints.
Install Mechanism
There is no install spec (instruction-only), but the repository includes package.json and TypeScript sources which expect an npm build (better-sqlite3 native dependency). This is not malicious but means the user/host must run npm install/build locally to use the code.
Credentials
The skill declares no required env vars, no credentials, and the code does not access environment variables or external services. It only writes/reads a local SQLite database (default path 'usage-tracker.db' unless overridden).
Persistence & Privilege
The skill does not request permanent platform presence (always is false) and does not modify other skills or system-wide configurations. It persists its own data to a local SQLite file as expected for this functionality.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-usage-tracker
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-usage-tracker 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Initial release
元数据
Slug agent-usage-tracker
版本 0.1.0
许可证
累计安装 3
当前安装数 3
历史版本数 1
常见问题

Agent Usage Tracker 是什么?

Track AI agent token usage, model costs, and budget thresholds with a TypeScript and SQLite workflow. Use when the user wants to instrument agent runs, calcu... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 352 次。

如何安装 Agent Usage Tracker?

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

Agent Usage Tracker 是免费的吗?

是的,Agent Usage Tracker 完全免费(开源免费),可自由下载、安装和使用。

Agent Usage Tracker 支持哪些平台?

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

谁开发了 Agent Usage Tracker?

由 imgolye(@imgolye)开发并维护,当前版本 v0.1.0。

💬 留言讨论