一键导入
usage-tracking
Real-time and historical token usage capture, analysis, and forecasting skill for agents
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Real-time and historical token usage capture, analysis, and forecasting skill for agents
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Experiment orchestration framework with traffic allocation, statistical analysis, and early stopping detection. Use to test routing changes, model upgrades, and role assignments with Welch's t-test significance testing.
DEPRECATED — This skill is no longer maintained. Prometheus and Grafana infrastructure was never implemented. Use local JSON metrics analysis instead.
Scaffolds new SPEC-compliant agentic-engineers agents with a single call. Generates SKILL.md frontmatter, test scaffolds (TDD RED-phase), __init__.py, scripts/ layout, and DELEGATE/HANDBACK protocol templates. Use when creating any new automation agent, task handler, or operational tool. Validates role, model, effort, naming, and dependency graphs (circular dep detection) before writing files. Supports dry-run mode for planning without side effects.
Routine maintenance for Codex sessions: monitor queue state, close completed sub-agents, resume or escalate active work, and keep agent capacity available.
Automated cross-validation of protocol queue integrity. Scans all DELEGATEs/HANDBACKs, validates schema compliance, detects cycles, checks rate limits, generates compliance report. Enables self-referential protocol improvements.
Consolidates provider-specific AI costs into unified metrics across Anthropic, OpenAI, Google Gemini, GitHub Copilot, and Ollama. Enables apples-to-apples cost comparison and savings analysis.
| name | usage-tracking |
| description | Real-time and historical token usage capture, analysis, and forecasting skill for agents |
| role | All roles (Orchestrator primary) |
| license | Proprietary |
| compatibility | macOS/Linux. Requires Python 3, bash, access to data/metrics/ directory |
| metadata | {"author":"agentic-engineers","version":"1.0","category":"observability","role":"orchestrator","model":"haiku-4-5","effort":"low","runtime":"bash/python3"} |
Agent skill for capturing and analyzing token usage patterns during sessions. Enables intelligent decision-making about task scope, model selection, and break timing based on real-time and historical usage data.
What it does:
# One-liner: get current usage without logging
bash skills/usage-tracking/scripts/capture_token_usage.sh --silent
bash skills/usage-tracking/scripts/usage-tracking.sh analyze
# Full checkpoint: capture snapshot and show trends
bash skills/usage-tracking/scripts/usage-tracking.sh snapshot
# JSON output for parsing in scripts
bash skills/usage-tracking/scripts/usage-tracking.sh analyze --json
# See last few entries
bash skills/usage-tracking/scripts/usage-tracking.sh logs
# Full analysis over time
bash skills/usage-tracking/scripts/usage-tracking.sh analyze
SESSION USAGE:
Current: 65.3%
Trend: RISING
Velocity: +7.2% per hour
Reset in: ~4.8 hours
WEEKLY USAGE:
Current: 42.1%
Trend: RISING
Velocity: +1.1% per hour
STATUS: 🟡 HIGH
Approaching session limit; consider deferring non-critical tasks
{
"session": {
"current": 65.3,
"trend": "rising",
"pct_per_hour": 7.2,
"estimated_reset_in_hours": 4.8
},
"weekly": {
"current": 42.1,
"trend": "rising",
"pct_per_hour": 1.1
}
}
Before delegating to Engineer:
## Usage Budget Assessment
Current state: usage-tracking snapshot shows:
- Session: 65% (rising, 4.8h to reset)
- Weekly: 42% (healthy)
**Decision**: Proceed with Haiku delegation (lower token cost)
Include usage impact in agent response:
## Metrics
- Session usage before: 60%
- Session usage after: 65%
- Tokens consumed: ~2,500 (estimate)
- Model used: Haiku (cost-optimized)
Check if usage consumption was reasonable for task scope:
# Quality Engineer can verify token consumption rate
# If unusually high, flag for review
Location: data/metrics/usage_history.jsonl
Format: JSON Lines (one entry per capture, UTC timestamps)
{"timestamp":"2026-04-25T10:30:00Z","session_usage_pct":65.3,"weekly_usage_pct":42.1,"status":"YELLOW","environment":"development"}
Retention: Permanent (for trend analysis across weeks/months)
Token usage logging and archival:
# Automatic logging when session > 70% or > 85%
bash skills/usage-tracking/scripts/capture_token_usage.sh
Silent mode (no alerts):
bash skills/usage-tracking/scripts/capture_token_usage.sh --silent
# 1. Check usage before committing
bash skills/usage-tracking/scripts/usage-tracking.sh analyze
# Output shows: 45% session, rising trend
# 2. Adjust approach if needed
# (proceed with full implementation, sufficient budget)
# 3. Execute task...
# 4. Report in HANDBACK with usage impact
# 30-minute checkpoint
bash skills/usage-tracking/scripts/usage-tracking.sh snapshot
# Output shows:
# - Session: 72% (YELLOW)
# - ~3 hours to reset
# - Decision: continue with current work, monitor next checkpoint
Automatic background capture for long-running sessions:
# Setup instructions
bash skills/usage-tracking/scripts/usage-tracking.sh cron-setup
# Recommended: every 30 minutes
*/30 * * * * bash /path/to/usage-tracking.sh capture
capture_token_usage.sh to create first entrydata/metrics/ directory is writablels -la data/metrics/chmod 755 data/metrics/statistics module (built-in)python3 --versionPassive capture: Agents call skill at decision points, not hooks
JSON Lines format: Simple, append-only, machine-readable
Local archival: Persistent local records
No API calls: Purely local analysis
usage-budget-manager (orchestration/) — Real-time budget status checkingmetrics-analyzer (operations/) — Daily analysis and recommendationsorchestration/USAGE-BUDGET-MANAGER.md — Budget status determinationorchestration/USAGE-BUDGET-INTEGRATION.md — Orchestrator workflow integrationorchestration/TOKEN-USAGE-TRACKING.md — Detailed guideThis skill participates in the framework's continuous improvement cycle (see skill-improvement-feedback).
When you use usage-tracking during a task, include a skill_feedback entry in your HANDBACK to help improve it over time:
skill_feedback:
- skill_name: usage-tracking
effectiveness_score: 0.85 # required: 0.0–1.0
clarity_score: 0.90 # optional
coverage_gaps:
- "Specific scenario the skill did not address"
improvement_suggestions:
- "Concrete change that would have helped"
usage_context: "One sentence on how you used this skill"
Positive feedback is as valuable as critical feedback. Three or more feedback items for this skill automatically trigger an improvement task.