cost-track
Auto-capture per-session token usage from the Claude Code session jsonl and persist to the cost-tracking namespace
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Auto-capture per-session token usage from the Claude Code session jsonl and persist to the cost-tracking namespace
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Ruflo is a multi-agent orchestration platform for AI coding agents (Claude Code, Cursor, Codex, Copilot, Gemini, Amp, +12 more). Use this skill when the user wants to (1) install/init ruflo in a project, (2) run multi-agent swarms with hierarchical coordination, (3) use ruflo's 314+ MCP tools for memory, routing, hooks, sub-agents, or workflows, (4) check ruflo status/version/doctor health, or (5) discover which of ruflo's 30+ plugins fits their task.
Show AGNTCY/SLIM/CASA integration status — whether upstream AGNTCY packages are installed, which transport (local vs SLIM) is active, and whether CASA enforcement is enabled. Use when the user asks "is AGNTCY configured?", "show SLIM/CASA status", or "is AGNTCY/IOC integration active?".
Create a new Architecture Decision Record with sequential numbering and AgentDB registration
Build or rebuild the ADR index + dependency graph by running scripts/import.mjs (handles v3-style and plugin-style ADR formats; one Bash call vs hundreds of MCP round-trips)
7-section repo readiness report from `metaharness genome <path>`. Returns repo_type / agent_topology / risk_score / mcp_surface / test_confidence / publish_readiness. Pure-read; degrades gracefully (ADR-150).
Diagnose Ruflo health, then report system, MCP server, and active-agent status without changing the installation
| name | cost-track |
| description | Auto-capture per-session token usage from the Claude Code session jsonl and persist to the cost-tracking namespace |
| argument-hint | |
| allowed-tools | Bash mcp__plugin_ruflo-core_ruflo__memory_store |
Reads the active Claude Code session jsonl (~/.claude/projects/<encoded-cwd>/<session>.jsonl), tallies assistant-message usage per model, computes USD cost using REFERENCE.md pricing, and writes a structured record to the cost-tracking AgentDB namespace. This is the producer that gives cost-report and cost-optimize real data to consume.
/loop 30m).Run the tracker from the project root:
node plugins/ruflo-cost-tracker/scripts/track.mjs
The script auto-discovers the session jsonl from the current working directory. To pin a specific session: TRACK_SESSION=/path/to/session.jsonl. To dry-run (no memory write): TRACK_DRY_RUN=1.
Inspect the markdown summary — total cost, per-model and per-tier breakdowns, and the persisted memory key.
Verify persistence — mcp__plugin_ruflo-core_ruflo__memory_search --query "session-" --namespace cost-tracking should list the new record. cost-report step 1 reads from this namespace.
cost-tracking namespace)Key: session-<sessionId>. Value (JSON):
{
"sessionId": "1dba3b8c-...",
"cwd": "/Users/cohen/Projects/ruflo",
"startedAt": "2026-05-04T...",
"endedAt": "2026-05-05T...",
"messageCount": 234,
"byModel": {
"claude-opus-4-7": {
"tier": "opus",
"input_tokens": 12345,
"output_tokens": 6789,
"cache_creation_input_tokens": 800000,
"cache_read_input_tokens": 2000000,
"messages": 50,
"cost_usd": 1.23
}
},
"byTier": { "haiku": 0.0, "sonnet": 0.45, "opus": 1.23, "unknown": 0 },
"total_cost_usd": 1.68,
"capturedAt": "2026-05-05T..."
}
The script's PRICING constant mirrors REFERENCE.md "Model pricing (USD per 1M tokens)". Update both together when prices change. Cache-write tokens are billed at cache_write rate; cache-read tokens at cache_read (per Anthropic billing docs).
| Env | Default | Purpose |
|---|---|---|
TRACK_CWD | process.cwd() | Override which project's sessions to scan |
TRACK_SESSION | most-recent jsonl | Pin a specific session file |
TRACK_OUT | unset | Also write the JSON summary to this path |
TRACK_DRY_RUN=1 | unset | Skip the memory store call |
TRACK_QUIET=1 | unset | Suppress markdown output |
TRACK_NAMESPACE | cost-tracking | Override target namespace |
cost-report (consumer) — reads records produced by this skillcost-budget-check (consumer; landing in P2) — reads totals to evaluate alerts