How this skill is triggered — by the user, by Claude, or both
Slash command
/envoy:costsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Show where tokens go — which skills, phases, models, and branches consume the most. Reads Claude Code's native JSONL session files with phase inference for unlabeled turns. No dollar estimates — just token counts and percentages.
Show where tokens go — which skills, phases, models, and branches consume the most. Reads Claude Code's native JSONL session files with phase inference for unlabeled turns. No dollar estimates — just token counts and percentages.
Announce at start: "I'm using envoy:costs to generate a token usage report."
const { findProjectDir, getRecentUsage, formatReport, aggregateTeamReports, discoverAllProjects } = require('../../lib/cost-reporter');
const projectDir = findProjectDir(process.cwd());
If projectDir is null, report: "No Claude Code session data found for this project."
Default (last 7 days):
const data = getRecentUsage(projectDir);
console.log(formatReport(data));
With arguments:
| Argument | Effect |
|---|---|
--days N | Look back N days (default: 7) |
--branch <name> | Filter to a specific branch |
--session | Show current session only |
--all | Aggregate across all projects |
--team | Aggregate team reports from docs/costs/reports/ |
// Cross-project
const data = getAllProjectsUsage({ days: 30 });
console.log(formatReport(data));
// Team view
const teamData = aggregateTeamReports('docs/costs/reports/', { days: 30 });
console.log(formatReport(teamData));
For --session, use the current session ID:
const { getSessionUsage } = require('../../lib/cost-reporter');
const usage = getSessionUsage(projectDir, process.env.CLAUDE_SESSION_ID);
Output is compact plain-text with bar charts. Sections include:
--all flag--team flagAll sorted by token count descending.
If the user asks for optimization suggestions, analyze the data:
Libraries used:
lib/cost-reporter.js — Reads Claude Code session JSONL, aggregates usage with phase inferenceData source: ~/.claude/projects/<project-id>/<session>.jsonl (Claude Code native format)
Team data: docs/costs/reports/*.json (committed by session-end hook)
npx claudepluginhub rutgerdijk/envoy --plugin envoy-bundle-copilot-adapterGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.