← Back to Skills Marketplace
imgolye

Agent Usage Tracker

by imgolye · GitHub ↗ · v0.1.0
cross-platform ✓ Security Clean
352
Downloads
0
Stars
3
Active Installs
1
Versions
Install in OpenClaw
/install agent-usage-tracker
Description
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...
README (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.

Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install agent-usage-tracker
  3. After installation, invoke the skill by name or use /agent-usage-tracker
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.1.0
Initial release
Metadata
Slug agent-usage-tracker
Version 0.1.0
License
All-time Installs 3
Active Installs 3
Total Versions 1
Frequently Asked Questions

What is 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... It is an AI Agent Skill for Claude Code / OpenClaw, with 352 downloads so far.

How do I install Agent Usage Tracker?

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

Is Agent Usage Tracker free?

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

Which platforms does Agent Usage Tracker support?

Agent Usage Tracker is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Agent Usage Tracker?

It is built and maintained by imgolye (@imgolye); the current version is v0.1.0.

💬 Comments