[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71KJ3C80V4QPA2C82162B3H":3,"skill-same:01M71KJ3C80V4QPA2C82162B3H":205},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":6,"ownerHtmlUrl":49,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":50,"install":51,"resources":64},"01M71KJ3C80V4QPA2C82162B3H","session-metrics",null,"Tally Claude Code session token usage and cost estimates from the raw JSONL conversation log. Trigger when the user asks about session cost, token usage, API spend, cache hit rate, input\u002Foutput tokens, or wants a breakdown of how much a Claude Code session has cost. Also trigger for \"how much have we spent\", \"show me token usage\", \"session summary\", \"cost so far\", or any request to analyse or display per-turn metrics from the current or a past session.\nDo NOT auto-dispatch compare mode (--compare \u002F --compare-prep \u002F --compare-run \u002F --count-tokens-only) from natural-language phrases. The skill body uses $ARGUMENTS[0] as the dispatch key — if the first positional argument is not literally \"compare\", \"compare-prep\", \"compare-run\", or \"count-tokens\", route to the default single-session report.","developAgent\u002Fbmad-start","developAgent","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F264530239?v=4","01M71J8X6CY24V5ZZHFGETRMSW","01M71J8X739FS28DGQAAY7V4QR",1,"MIT","https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"metrics","session metrics","session","route","code","when","display","mode","natural-language","jsonl","argument","me","show me","conversation","show","default","log","only","auto","api","2026-11-10 10:12:30",false,"---\nname: session-metrics\nmodel: sonnet\ndescription: >\n  Tally Claude Code session token usage and cost estimates from the raw JSONL\n  conversation log. Trigger when the user asks about session cost, token usage,\n  API spend, cache hit rate, input\u002Foutput tokens, or wants a breakdown of how\n  much a Claude Code session has cost. Also trigger for \"how much have we spent\",\n  \"show me token usage\", \"session summary\", \"cost so far\", or any request to\n  analyse or display per-turn metrics from the current or a past session.\n\n  Do NOT auto-dispatch compare mode (--compare \u002F --compare-prep \u002F --compare-run\n  \u002F --count-tokens-only) from natural-language phrases. The skill body uses\n  $ARGUMENTS[0] as the dispatch key — if the first positional argument is not\n  literally \"compare\", \"compare-prep\", \"compare-run\", or \"count-tokens\", route\n  to the default single-session report.\n---\n\n# Session Metrics\n\nRuns `scripts\u002Fsession-metrics.py` against the Claude Code JSONL log to produce\na timeline-ordered cost summary with per-turn and cumulative totals.\n\n## Dispatch — how to route this invocation\n\n**First positional argument received:** `$ARGUMENTS[0]`\n**Full argument string:** `$ARGUMENTS`\n\nRead `$ARGUMENTS[0]` above and match it by **literal equality** against the\ntable below. Claude Code already tokenized the arguments shell-style, so no\nparsing is required — just compare strings.\n\n| `$ARGUMENTS[0]`     | Route                                     | Then read |\n|---------------------|-------------------------------------------|-----------|\n| `all-projects`      | Instance-wide dashboard aggregating every project under `~\u002F.claude\u002Fprojects` | `## Instance dashboard (all projects)` below |\n| `compare`           | Two-session compare on JSONLs that already exist | `## Model comparison` below, then [`references\u002Fmodel-compare.md`](references\u002Fmodel-compare.md) before running |\n| `compare-run`       | Fully automated capture: spawns two `claude -p` sessions, feeds the suite, then runs `--compare` | `## Model comparison` below, then [`references\u002Fmodel-compare.md`](references\u002Fmodel-compare.md) \"Workflow A — automated\" |\n| `compare-prep`      | Print manual capture protocol + 10-prompt suite (fallback when headless is unavailable) | `## Model comparison` below |\n| `count-tokens`      | API-key-only tokenizer check              | `## Model comparison` below |\n| `export`            | Natural-language export shortcut — scan full arg string to determine session vs project scope | `## Export shortcuts` below |\n| `project`           | All sessions for the current project — timeline + per-session subtotals + grand total | `## Quick usage` below (`--project-cost`); also scan remaining args for `--output` format flags |\n| `project-cost`      | Alias for `project`                       | `## Quick usage` below (`--project-cost`); also scan remaining args for `--output` format flags |\n| *(empty, or any other value)* | Default single-session report   | `## Quick usage` below |\n\nThis is the single gate that keeps compare mode off the natural-language\npath. **Do not infer the route from the user's chat history; only use the\nliteral value of `$ARGUMENTS[0]` above.**\n\nWhen the skill auto-triggers from a natural-language question (\"how much did\nthis session cost?\", \"show me token usage\"), there are no positional\narguments — `$ARGUMENTS[0]` is empty — and you always route to the default.\nPhrases like \"compare 4.6 vs 4.7 cost\" arriving as natural language do NOT\nproduce `$ARGUMENTS[0] = compare` and must not route into compare mode;\nanswer them by running the default report on the current session and\nsuggesting `\u002Fsession-metrics compare-prep` if the user wants a real\nbenchmark.\n\n## Pre-flight context\n\n- skill-dir: ${CLAUDE_SKILL_DIR}\n- session-id: ${CLAUDE_SESSION_ID}\n\n## Export shortcuts\n\nReached when `$ARGUMENTS[0]` is `export`. Scan the **full argument string** (not just `$ARGUMENTS[0]`) to determine scope and formats. Apply these checks **in order** (first match wins):\n\n1. Full arg string contains `all-projects` → `--all-projects --output \u003Cformats>`\n2. Full arg string contains `project` (and not already caught above) → `--project-cost --output \u003Cformats>`\n3. Otherwise → current session `--session ${CLAUDE_SESSION_ID} --output \u003Cformats>`\n\nInfer format flags from the argument string: `html` → `html`, `csv` → `csv`, `md` or `markdown` → `md`. Always add `json` alongside any requested format per the post-export audit convention (see `## Optional post-export audit` below).\n\n**Examples:**\n\n| Full argument string | Command |\n|---|---|\n| `export session` | `--session ${CLAUDE_SESSION_ID} --output json` |\n| `export session to html` | `--session ${CLAUDE_SESSION_ID} --output html json` |\n| `export session metrics to html` | `--session ${CLAUDE_SESSION_ID} --output html json` |\n| `export to html` | `--session ${CLAUDE_SESSION_ID} --output html json` |\n| `export project` | `--project-cost --output json` |\n| `export project to html` | `--project-cost --output html json` |\n| `export project sessions` | `--project-cost --output json` |\n| `export project sessions to html` | `--project-cost --output html json` |\n| `export entire project's session metrics to html` | `--project-cost --output html json` |\n| `export project metrics to html csv` | `--project-cost --output html csv json` |\n| `export all-projects` | `--all-projects --output json` |\n| `export all-projects to html` | `--all-projects --output html json` |\n\n`project` and `project-cost` as the first arg also pick up `--output` flags from remaining args the same way (e.g. `\u002Fsession-metrics project metrics export to html` → `--project-cost --output html json`).\n\n## Quick usage\n\n```bash\n# Current session (pinned to session ID — no heuristic)\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --session ${CLAUDE_SESSION_ID}\n\n# Specific session ID\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --session \u003Cuuid>\n\n# Specific project slug (use = when slug starts with \"-\")\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --slug=-home-user-projects-myapp\n# Or via env var (always safe):\nCLAUDE_PROJECT_SLUG=\"-home-user-projects-myapp\" uv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py\n\n# List available sessions for this project\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --list\n\n# All sessions — timeline + per-session subtotals + grand project total\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --project-cost\n\n# Export to exports\u002Fsession-metrics\u002F (one or more formats)\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --output json\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --output json csv md html\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --project-cost --output html\n```\n\n> `${CLAUDE_SKILL_DIR}` is expanded by Claude Code to the skill's install directory (plugin cache, project-local copy, or bundled template — whichever applies). When running the script manually from a shell, substitute the actual path.\n\n## Export formats\n\n`--output` accepts one or more of: `json` `csv` `md` `html`\n\nText is always printed to stdout. Exports go to `exports\u002Fsession-metrics\u002F` in the\nproject root, named `session_\u003Cid8>_\u003CYYYYMMDD_HHMMSS>.\u003Cext>` (single) or\n`project_\u003CYYYYMMDD_HHMMSS>.\u003Cext>` (project mode).\n\n| Format | Contents |\n|--------|----------|\n| `json` | Full structured report with all turns, subtotals, model rates |\n| `csv`  | One row per turn: session_id, index, timestamp, model, tokens, cost |\n| `md`   | Summary table + per-session Markdown tables |\n| `html` | Dark-theme report with summary cards + insights + chart. 2-page split by default (`\u003Cstem>_dashboard.html` + `\u003Cstem>_detail.html`); pass `--single-page` for one file. |\n\n### HTML-specific flags\n\n| Flag | Purpose |\n|------|---------|\n| `--single-page`              | Emit one self-contained HTML instead of the dashboard+detail split. |\n| `--chart-lib {highcharts,uplot,chartjs,none}` | Choose the chart renderer. Default `highcharts` (richest visualization, vendored, SHA-256-verified, non-commercial license). `uplot` and `chartjs` are MIT-licensed alternatives. `none` emits a detail page with no JS dependency. See [`scripts\u002Fvendor\u002Fcharts\u002FREADME.md`](scripts\u002Fvendor\u002Fcharts\u002FREADME.md) for per-library license terms. |\n| `--peak-hours H-H`           | Translucent band on the hour-of-day chart (e.g. `5-11`). Community-reported, not an Anthropic SLA. |\n| `--peak-tz \u003CIANA>`           | Timezone the peak hours are defined in (default `America\u002FLos_Angeles`). |\n\n### Other useful flags\n\n| Flag | Purpose |\n|------|---------|\n| `--tz \u003CIANA>`                | IANA timezone for time-of-day bucketing **and timeline\u002Fexport timestamps**. Defaults to the system local tz (auto-detected via `TZ` env var or the OS setting). |\n| `--utc-offset \u003CH>`           | Fixed UTC offset, DST-naive. Use `--tz` for DST-aware. |\n| `--no-cache`                 | Skip `~\u002F.cache\u002Fsession-metrics\u002Fparse\u002F` and always re-parse from scratch. |\n| `--no-self-cost`             | Suppress the self-cost meta-metric (stderr `[self-cost]` line, HTML KPI card, and JSON `self_cost` key). |\n| `--redact-user-prompts`      | Replace freeform `prompt_text` \u002F `prompt_snippet` \u002F `assistant_text` \u002F `assistant_snippet` with `[redacted]` on every turn of single-session and project **JSON** exports, plus compare HTML. Tool inputs, slash-command names, and structured cost \u002F token fields stay visible. HTML \u002F MD \u002F CSV \u002F text are NOT redacted. |\n| `--export-share-safe`        | One-flag pre-share gesture (v1.36.0+): implies `--redact-user-prompts` and `--no-self-cost`, and chmods every written export file to `0600` (`rw-------`). For full prompt redaction, pair with `--output json`. |\n| `--no-include-subagents`     | Skip spawned subagent JSONL files. Subagents are included by default; use this for faster runs when subagent detail is not needed. |\n| `--cache-break-threshold \u003CN>` | Turns whose `input + cache_creation` exceed N are flagged as **cache-break events** (default 100 000). Matches Anthropic's `session-report` convention. |\n| `--no-subagent-attribution`  | Disable Phase-B subagent → parent-prompt token attribution. Default behaviour rolls every subagent's tokens up onto the user prompt that spawned the chain (additional `attributed_subagent_*` fields, no double-counting). |\n| `--sort-prompts-by {total,self}` | How to rank top prompts in HTML\u002FMD output. `total` (default) = parent + attributed subagent cost, surfaces cheap-prompt-spawning-expensive-subagent turns. `self` = parent only (pre-Phase-B order). CSV\u002FJSON keep `self` ordering for stability regardless of this flag. |\n\n> **Invocation note for the AI.** Don't pass `--tz` or `--utc-offset` unless the user explicitly asks for a specific timezone. The script auto-detects the user's system tz and renders all human-facing timestamps (timeline, session headers, generated-at banner, block anchors) in that tz. JSON\u002FCSV raw `timestamp` fields stay UTC ISO-8601 as a machine-readable audit trail. Don't pass `--include-subagents` — subagents are included by default. Only pass `--no-include-subagents` if the user explicitly asks for a faster\u002Fleaner run without subagent detail.\n\n## Output columns\n\n| Column    | Meaning                                      |\n|-----------|----------------------------------------------|\n| `#`       | Deduplicated turn index                      |\n| `Time`    | Timestamp of the turn in the user's local timezone (auto-detected; override with `--tz` \u002F `--utc-offset`). Header shows the active tz label. Raw `timestamp` fields in JSON\u002FCSV exports remain UTC ISO-8601 (`...Z`) for machine-readability. |\n| `Input`   | Net new input tokens (uncached portion only — cache reads\u002Fwrites are shown separately) |\n| `Output`  | Output tokens generated (includes thinking + tool_use block tokens) |\n| `CacheRd` | Tokens served from prompt cache (cheap)      |\n| `CacheWr` | Tokens written to prompt cache (one-time). `1h` \u002F `mix` badge marks turns that used the 1-hour TTL tier; CSV\u002FJSON expose `cache_write_5m_tokens` and `cache_write_1h_tokens` as dedicated columns. |\n| `Content` | Per-turn content-block distribution. Letter encoding `T` thinking, `u` tool_use, `x` text, `r` tool_result, `i` image (zero counts omitted). Renders only when at least one turn carries any content block. CSV\u002FJSON expose `thinking_blocks` \u002F `tool_use_blocks` \u002F `text_blocks` \u002F `tool_result_blocks` \u002F `image_blocks` as dedicated per-turn columns. |\n| `Total`   | Sum of the four billable token buckets       |\n| `Cost $`  | Estimated USD for this turn                  |\n\nDeep-dive on exact column semantics, JSON keys, and detection rules:\n[`references\u002Fjsonl-schema.md`](references\u002Fjsonl-schema.md).\n\n### Per-turn drill-down (HTML only)\n\nIn the Detail page and single-page variants, every Timeline row is\nclickable (keyboard: Enter \u002F Space) and opens a right-side **drawer**\nshowing the user's actual prompt, any slash command, the tools that were\ncalled (with one-line input previews), the content-block mix, the\nper-turn cost\u002Ftoken breakdown, and the assistant's reply. Prompt and\nassistant text are truncated to ~240 characters with a **Show full\nprompt** \u002F **Show full response** toggle that reveals the full text (up\nto a 2 KB cap on assistant text). Close with the × button, Esc, or a\nbackdrop click — focus returns to the originating row. Below the\nTimeline, a collapsible **Prompts** section lists the top-20\nmost-expensive prompts; each row opens the same drawer. The Dashboard\nvariant has no Timeline, so it's unaffected.\n\nFooter shows session totals + **cache savings** vs a hypothetical no-cache\nrun. Conditional dashboard cards appear when their feature was used in the\nsession: **Cache TTL mix** (when any 1h-tier cache writes happened),\n**Extended thinking engagement** (when any turn carried a `thinking` block),\n**Tool calls** (top-3 tool names), **Session resumes** (timeline divider at\neach `claude -c` resume point, detected from `\u002Fexit` + synthetic-turn\nfingerprint — lower-bound count), and the **Usage Insights** panel\n(prose-style pattern characterisations inspired by Anthropic's `\u002Fusage`\ncommand, auto-hide below threshold, exposed in JSON under `usage_insights`\nand in Markdown under `## Usage Insights`).\n\n### Cross-cutting sections (v1.6.0 — inspired by Anthropic's session-report)\n\nThree additional sections auto-hide when empty and render at every scope\n(single session \u002F `--project-cost` \u002F `--all-projects`). All three feed the\nsame `by_skill`, `by_subagent_type`, and `cache_breaks` keys in the JSON\nexport.\n\n- **Cache breaks** — single turns whose `input + cache_creation` exceeds\n  the threshold (configurable via `--cache-break-threshold`, default\n  100 000). Each row names **which turn** lost the cache; the HTML version\n  is expandable and shows ±2 user-prompt context around the event.\n  Complements the overall cache-hit % with actionable \"here is where it\n  blew up\" detail.\n- **Skills & slash commands** — one row per named skill or `\u002Fslash`\n  command, columns: invocations, turns attributed, input \u002F output \u002F cache\n  tokens, % cached, cost, % of total. Attribution model: a slash-prefixed\n  user prompt sets the \"current skill\" for that prompt and its follow-up\n  turns; a Skill-tool invocation overrides attribution for its own turn.\n  Slash-prefixed keys (e.g. `\u002Fsession-metrics`) are de-slashed so they\n  merge with Skill-tool invocations of the same name.\n- **Subagent types** — one row per resolved `subagent_type` (from\n  `Agent` \u002F `Task` tool_use `input.subagent_type`). Shows spawn count\n  always; token\u002Fcost columns populate from subagent JSONLs (default behaviour —\n  pass `--no-include-subagents` to skip).\n\n**UUID-based dedup** runs at project and instance scope to prevent\nresumed-session replays from double-counting. Session scope keeps the\nexisting `message.id` streaming-split dedup.\n\n### Subagent → parent-prompt attribution (v1.7.0 — Phase B)\n\nSubagent token usage is included by default and rolls up onto the **user prompt** that originally triggered the chain:\n\n- Three new turn-record fields populate on the spawning prompt's row —\n  `attributed_subagent_tokens`, `attributed_subagent_cost`,\n  `attributed_subagent_count`. They are **purely additive**:\n  `cost_usd` \u002F `total_tokens` on every turn (parent and subagent) are\n  unchanged, so existing aggregators and the session total are\n  untouched. Display layers read both columns separately.\n- **Nested chains** (subagent A → subagent B) attribute B's tokens onto\n  the **root** user prompt, not onto A. Implemented via an iterative\n  resolve over `(tool_use.id, agentId)` linkage extracted from the\n  parent's `toolUseResult.agentId` fields, with a cycle guard.\n- **HTML prompts table** sorts by `cost_usd + attributed_subagent_cost`\n  by default (configurable via `--sort-prompts-by`). A new \"Subagents\n  +$\" column is auto-shown when at least one top-20 row has attributed\n  cost. The prompt snippet gains a \"+N subagents\" badge.\n- **CSV per-turn export** always includes the three attribution columns\n  (zero on rows without spawn activity) — column count stays stable.\n- **JSON report** exposes top-level `subagent_attribution_summary`\n  with `attributed_turns`, `orphan_subagent_turns`,\n  `nested_levels_seen`, `cycles_detected`. Useful for sanity checks\n  when pointing at unfamiliar history.\n\nDisable subagent loading entirely with `--no-include-subagents` (fastest, no subagent token detail).\nDisable only the attribution rollup while still loading subagents with `--no-subagent-attribution` (compare against pre-Phase-B reports).\n\n## Instance dashboard (all projects)\n\nReached when `$ARGUMENTS[0]` is `all-projects`, or when the user asks\nfor the **total cost across every project** (\"how much have I spent on\nClaude Code overall?\", \"what's my total spend across all projects?\",\n\"which project is costing me the most?\").\n\nAggregates every project under `~\u002F.claude\u002Fprojects\u002F` (or\n`CLAUDE_PROJECTS_DIR`, or the `--projects-dir` override) into a single\ndashboard with instance-wide totals, a daily cost timeline, and a\nper-project breakdown table sorted by cost descending. Each project row\nhyperlinks to a pre-rendered per-project HTML drilldown that carries\nthe full session\u002Fturn detail (same report as `--project-cost \u003Cslug>`).\n\n```bash\n# Instance-wide dashboard — HTML + MD + CSV + JSON\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --all-projects --output html md csv json\n\n# Fast path — no per-project drilldown HTMLs (rows render as plain text)\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --all-projects --no-project-drilldown --output html\n\n# Multi-instance: point at a non-default Claude Code install\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --all-projects --projects-dir \u002Fopt\u002Fclaude-work\u002Fprojects\n```\n\n### Output layout\n\nExports write to a dated subfolder so successive runs don't overwrite\neach other and the whole bundle stays portable (zip it, move it, serve\nit as static files — relative drilldown links keep working):\n\n```\nexports\u002Fsession-metrics\u002Finstance\u002FYYYY-MM-DD-HHMMSS\u002F\n  index.html    # entry point — instance dashboard\n  index.md\n  index.csv     # one row per session, with a project_slug column\n  index.json    # full instance report (no per-turn records — only per-session summaries)\n  projects\u002F\n    \u003Cslug-1>.html   # full per-project HTML, same as --project-cost \u003Cslug-1>\n    \u003Cslug-2>.html\n    ...\n```\n\n`--no-project-drilldown` skips the `projects\u002F` folder entirely and\nrenders `index.html` with project rows as plain text (no hyperlinks) —\nuseful for CI or quick-glance runs. Per-turn data is always suppressed\nat the instance scope; users drill down by clicking into a project HTML.\n\n### Multi-instance Claude Code setups\n\nThree layered overrides pick the projects directory (highest precedence first):\n\n1. `--projects-dir \u003Cpath>` CLI flag\n2. `CLAUDE_PROJECTS_DIR` environment variable\n3. Default `~\u002F.claude\u002Fprojects`\n\nThe resolved projects directory is rendered into the HTML header byline\nso output from multiple instances is self-documenting when viewed\nside-by-side.\n\n### Cache-dir and export-dir overrides (v1.41.0)\n\nTwo parallel override knobs for the parse-cache and export directories.\nSame precedence shape as `--projects-dir`:\n\n| Resource | CLI flag | Env var | Default |\n|----------|----------|---------|---------|\n| Parse cache | `--cache-dir` | `CLAUDE_SESSION_METRICS_CACHE_DIR` | `~\u002F.cache\u002Fsession-metrics\u002Fparse` |\n| Exports | `--export-dir` | `CLAUDE_SESSION_METRICS_EXPORT_DIR` | `\u003Ccwd>\u002Fexports\u002Fsession-metrics` |\n\nUseful when:\n- running in CI \u002F sandboxes where `~\u002F.cache` isn't writable\n- juggling multiple Claude Code installs and you want each to keep its own cache\n- redirecting reports to a shared \u002F mounted directory without `cd`-ing first\n\n```bash\n# Redirect both via env vars\nCLAUDE_SESSION_METRICS_CACHE_DIR=\u002Ftmp\u002Fsm-cache \\\nCLAUDE_SESSION_METRICS_EXPORT_DIR=\u002Ftmp\u002Fsm-out \\\n  uv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --output html json\n\n# Or via CLI flags (highest precedence — beats env)\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py \\\n  --cache-dir \u002Ftmp\u002Fsm-cache --export-dir \u002Ftmp\u002Fsm-out --output html json\n```\n\n## Model comparison\n\nReached only when `$ARGUMENTS[0]` is `compare`, `compare-run`,\n`compare-prep`, or `count-tokens` (see the Dispatch section at the top\nof this file).\n\n**Default pair is `claude-opus-4-6[1m]` vs `claude-opus-4-7[1m]`** —\nthe 1M-context tier, because that matches Claude Code's shipping Opus\nrouting. Users opt into the 200k-context variants by passing the\nunsuffixed IDs explicitly. Mixed-tier pairs are accepted and surface\nthe existing `context-tier-mismatch` advisory on the report.\n\n| Mode | Use when |\n|------|----------|\n| `compare-run` *(preferred)* | User wants the report with no manual capture. Orchestrator spawns two `claude -p` sessions via subscription auth, feeds the canonical suite, then runs `--compare`. Zero API key. |\n| `compare`                   | Two session JSONLs already exist (either from a prior `compare-run`, or from manual `\u002Fmodel` + paste). Input is a path \u002F UUID \u002F `last-\u003Cfamily>` \u002F `all-\u003Cfamily>` token. |\n| `compare-prep`              | Print the manual capture protocol. Only suggest when `claude -p` is unavailable (e.g. CI container without the CLI). |\n| `count-tokens`              | API-key tokenizer smoke test. NOT a subscription path; do not suggest to users comparing two subscription sessions. |\n\n**Output formats for compare mode.** Compare mode supports `--output text md json csv html`. The HTML report is always single-page (a compact scored per-prompt table); `--single-page` and `--chart-lib` are ignored when `--compare` is active.\n\n**`compare-run` auto-extras.** When `compare-run` is invoked with\n`--output \u003Cfmt>`, it emits the compare report *and* five companion\nfiles in `exports\u002Fsession-metrics\u002F`: a per-session dashboard + detail\n(HTML) and raw JSON for each side, plus a Markdown analysis scaffold\n(`compare_\u003Ca8>_vs_\u003Cb8>_\u003Cts>_analysis.md`) with headline ratios,\nper-prompt table, cost decomposition, and a bolded decision-framework\nverdict. Prose sections carry `{{TODO}}` placeholders so a follow-up\nchat can fill them in. Pass `--no-compare-run-extras` to skip the\ncompanions and emit only the compare report. Without `--output`,\nnothing writes to disk (text-only stdout path preserved).\n\n**Custom prompts.** Users can add their own prompts to the comparison suite with\n`--compare-add-prompt \"text\"` — no file format knowledge required. The prompt is\nsaved to `~\u002F.session-metrics\u002Fprompts\u002F` and runs automatically on every subsequent\n`--compare-run`. Use `--compare-list-prompts` to preview the active suite and call\ncount before spending on inference. Use `--compare-remove-prompt \u003Cname>` to remove.\nFull guide: [`references\u002Fcustom-prompts.md`](references\u002Fcustom-prompts.md).\n\n**Prompt steering.** `--compare-run-prompt-steering \u003Cvariant>` wraps every\nprompt in the suite with a steering instruction before feeding it to\n`claude -p`. The four built-in variants are `concise`,\n`think-step-by-step`, `ultrathink`, and `no-tools`. The wrapper is\napplied symmetrically to both sides so the A\u002FB stays clean — what shifts\nis the model's behaviour under the same instruction, surfaced as token \u002F\ncost \u002F thinking \u002F tool-call deltas. Use\n`--compare-run-prompt-steering-position {prefix,append,both}` (default\n`prefix`) to control where the steering text lands relative to the body.\nIFEval pass rates may differ from the unsteered baseline by design —\npredicate breakage (e.g. \"be concise\" violating the 50-word stacked\nconstraint) is the *measurement*, not a regression. For multi-variant\nsweeps with auto-rendered comparison articles + cross-variant summary,\nuse the `benchmark-effort-prompt` skill instead.\n\n**Before proposing any compare-mode command, read\n[`references\u002Fmodel-compare.md`](references\u002Fmodel-compare.md).** That\ndoc has the full flag table, four workflow recipes, 4-way Opus combo\nmatrix, IFEval predicates, advisory semantics, and troubleshooting.\nThe eager content in this file deliberately stays minimal so\nsingle-session reports don't pay for compare-mode context they don't\nuse.\n\n## Optional post-export audit\n\nWhen any `--output` format is specified (`html`, `csv`, `md`, or `json`),\nalways include `json` in the script invocation if it is not already present.\nFor example, if the user asked for `--output html`, run the script with\n`--output html json`. This ensures the JSON export is always written and the\naudit suggestion can always be shown.\n\nAfter all `[export] FMT → path` lines are printed and the optional\n`[self-cost]` line lands, append an audit suggestion based on the export scope.\nDetermine scope from the JSON filename printed by the `[export] JSON` line:\n\n- `session_*.json` → session scope\n- `project_*.json` → project scope\n- `instance\u002F*\u002Findex.json` → instance scope\n\n**Session scope:**\n> Want a token-usage audit of this session?\n>   `\u002Faudit-session-metrics quick   \u003Cjson-path>`   (Haiku — ~10× cheaper than Sonnet)\n>   `\u002Faudit-session-metrics detailed \u003Cjson-path>`  (Haiku, also reads CLAUDE.md + settings)\n\n**Project scope:**\n> Want a per-session cost and cache health audit of this project?\n>   `\u002Faudit-session-metrics quick   \u003Cjson-path>`   (Haiku — surfaces top expensive sessions, cache outliers)\n>   `\u002Faudit-session-metrics detailed \u003Cjson-path>`  (Haiku, also drills into top session turn patterns)\n\n**Instance scope:**\n> Want a cross-project cost breakdown audit?\n>   `\u002Faudit-session-metrics quick   \u003Cjson-path>`   (Haiku — per-project cost shares and cache health)\n\nSubstitute `\u003Cjson-path>` with the actual path printed by the\n`[export] JSON` line.\n\n**Do not invoke `audit-session-metrics` programmatically from this\nturn.** Its frontmatter pins `model: haiku` and the model override\nonly takes effect when the audit skill is the entry point of its own\nturn — invoking via the Skill tool inside a session-metrics turn\nkeeps the parent's Sonnet model and erases the cost win. The user\nruns the slash command at their own discretion.\n\n## Self-cost meta-metric\n\nsession-metrics tracks its own running cost in the current session.\nAfter the `[export]` lines a `[self-cost]` stderr summary prints the\nprior turns' tokens \u002F dollars (the *current* run is not yet written\nto the JSONL when the script reads it). The HTML dashboard surfaces\nthe same number as a \"Skill self-cost\" KPI card. The JSON export\ncarries it as the top-level `self_cost` key.\n\nPass `--no-self-cost` to suppress all three surfaces — useful for\nclean test snapshots or for users who find the meta-metric noisy.\n\n## Reference files\n\n- [`references\u002Fpricing.md`](references\u002Fpricing.md) — Per-model token prices used\n  for cost calculation. Read when the user asks about pricing or you need to\n  add a new model.\n- [`references\u002Fjsonl-schema.md`](references\u002Fjsonl-schema.md) — JSONL entry\n  structure + full output-column semantics, cache-TTL split rationale, content-\n  block distribution, resume detection. Read when debugging missing data,\n  extending the script, or interpreting any non-obvious column\u002Fkey.\n- [`references\u002Fmodel-compare.md`](references\u002Fmodel-compare.md) — `--compare`\n  workflow, prompt-suite catalogue, IFEval predicates, interpretation guide.\n  Read when `$ARGUMENTS[0]` routes into compare mode.\n- [`references\u002Fcustom-prompts.md`](references\u002Fcustom-prompts.md) — Step-by-step\n  guide for adding, removing, and previewing custom prompts for `--compare-run`.\n  Read when the user asks how to add their own prompts or customise the suite.\n- [`references\u002Fplatform-notes.md`](references\u002Fplatform-notes.md) — Windows\n  `tzdata` caveat for IANA `--tz` names, the `--strict-tz` escape hatch,\n  and timezone-contract summary. Read when the user reports a timezone\n  warning, asks about Windows support, or wants CI-safe tz handling.\n\n## How session detection works\n\n1. Derives the project slug from `cwd`: replaces `\u002F` → `-`, strips leading `-`.\n2. Scans `~\u002F.claude\u002Fprojects\u002F\u003Cslug>\u002F` for `*.jsonl` files (excludes `subagents\u002F`).\n3. Picks the most recently modified file as the current session.\n4. Override with `--session \u003Cuuid>` or `--slug \u003Cslug>` when needed.\n\n## Deduplication\n\nEach API response is written to the JSONL multiple times (streaming, tool\ncompletion, final). The script deduplicates on `message.id` — keeping only the\n**last** occurrence so token counts reflect the final settled value.\n","# Session Metrics\n\nRuns `scripts\u002Fsession-metrics.py` against the Claude Code JSONL log to produce\na timeline-ordered cost summary with per-turn and cumulative totals.\n\n## Dispatch — how to route this invocation\n\n**First positional argument received:** `$ARGUMENTS[0]`\n**Full argument string:** `$ARGUMENTS`\n\nRead `$ARGUMENTS[0]` above and match it by **literal equality** against the\ntable below. Claude Code already tokenized the arguments shell-style, so no\nparsing is required — just compare strings.\n\n| `$ARGUMENTS[0]`     | Route                                     | Then read |\n|---------------------|-------------------------------------------|-----------|\n| `all-projects`      | Instance-wide dashboard aggregating every project under `~\u002F.claude\u002Fprojects` | `## Instance dashboard (all projects)` below |\n| `compare`           | Two-session compare on JSONLs that already exist | `## Model comparison` below, then [`references\u002Fmodel-compare.md`](references\u002Fmodel-compare.md) before running |\n| `compare-run`       | Fully automated capture: spawns two `claude -p` sessions, feeds the suite, then runs `--compare` | `## Model comparison` below, then [`references\u002Fmodel-compare.md`](references\u002Fmodel-compare.md) \"Workflow A — automated\" |\n| `compare-prep`      | Print manual capture protocol + 10-prompt suite (fallback when headless is unavailable) | `## Model comparison` below |\n| `count-tokens`      | API-key-only tokenizer check              | `## Model comparison` below |\n| `export`            | Natural-language export shortcut — scan full arg string to determine session vs project scope | `## Export shortcuts` below |\n| `project`           | All sessions for the current project — timeline + per-session subtotals + grand total | `## Quick usage` below (`--project-cost`); also scan remaining args for `--output` format flags |\n| `project-cost`      | Alias for `project`                       | `## Quick usage` below (`--project-cost`); also scan remaining args for `--output` format flags |\n| *(empty, or any other value)* | Default single-session report   | `## Quick usage` below |\n\nThis is the single gate that keeps compare mode off the natural-language\npath. **Do not infer the route from the user's chat history; only use the\nliteral value of `$ARGUMENTS[0]` above.**\n\nWhen the skill auto-triggers from a natural-language question (\"how much did\nthis session cost?\", \"show me token usage\"), there are no positional\narguments — `$ARGUMENTS[0]` is empty — and you always route to the default.\nPhrases like \"compare 4.6 vs 4.7 cost\" arriving as natural language do NOT\nproduce `$ARGUMENTS[0] = compare` and must not route into compare mode;\nanswer them by running the default report on the current session and\nsuggesting `\u002Fsession-metrics compare-prep` if the user wants a real\nbenchmark.\n\n## Pre-flight context\n\n- skill-dir: ${CLAUDE_SKILL_DIR}\n- session-id: ${CLAUDE_SESSION_ID}\n\n## Export shortcuts\n\nReached when `$ARGUMENTS[0]` is `export`. Scan the **full argument string** (not just `$ARGUMENTS[0]`) to determine scope and formats. Apply these checks **in order** (first match wins):\n\n1. Full arg string contains `all-projects` → `--all-projects --output \u003Cformats>`\n2. Full arg string contains `project` (and not already caught above) → `--project-cost --output \u003Cformats>`\n3. Otherwise → current session `--session ${CLAUDE_SESSION_ID} --output \u003Cformats>`\n\nInfer format flags from the argument string: `html` → `html`, `csv` → `csv`, `md` or `markdown` → `md`. Always add `json` alongside any requested format per the post-export audit convention (see `## Optional post-export audit` below).\n\n**Examples:**\n\n| Full argument string | Command |\n|---|---|\n| `export session` | `--session ${CLAUDE_SESSION_ID} --output json` |\n| `export session to html` | `--session ${CLAUDE_SESSION_ID} --output html json` |\n| `export session metrics to html` | `--session ${CLAUDE_SESSION_ID} --output html json` |\n| `export to html` | `--session ${CLAUDE_SESSION_ID} --output html json` |\n| `export project` | `--project-cost --output json` |\n| `export project to html` | `--project-cost --output html json` |\n| `export project sessions` | `--project-cost --output json` |\n| `export project sessions to html` | `--project-cost --output html json` |\n| `export entire project's session metrics to html` | `--project-cost --output html json` |\n| `export project metrics to html csv` | `--project-cost --output html csv json` |\n| `export all-projects` | `--all-projects --output json` |\n| `export all-projects to html` | `--all-projects --output html json` |\n\n`project` and `project-cost` as the first arg also pick up `--output` flags from remaining args the same way (e.g. `\u002Fsession-metrics project metrics export to html` → `--project-cost --output html json`).\n\n## Quick usage\n\n```bash\n# Current session (pinned to session ID — no heuristic)\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --session ${CLAUDE_SESSION_ID}\n\n# Specific session ID\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --session \u003Cuuid>\n\n# Specific project slug (use = when slug starts with \"-\")\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --slug=-home-user-projects-myapp\n# Or via env var (always safe):\nCLAUDE_PROJECT_SLUG=\"-home-user-projects-myapp\" uv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py\n\n# List available sessions for this project\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --list\n\n# All sessions — timeline + per-session subtotals + grand project total\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --project-cost\n\n# Export to exports\u002Fsession-metrics\u002F (one or more formats)\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --output json\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --output json csv md html\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --project-cost --output html\n```\n\n> `${CLAUDE_SKILL_DIR}` is expanded by Claude Code to the skill's install directory (plugin cache, project-local copy, or bundled template — whichever applies). When running the script manually from a shell, substitute the actual path.\n\n## Export formats\n\n`--output` accepts one or more of: `json` `csv` `md` `html`\n\nText is always printed to stdout. Exports go to `exports\u002Fsession-metrics\u002F` in the\nproject root, named `session_\u003Cid8>_\u003CYYYYMMDD_HHMMSS>.\u003Cext>` (single) or\n`project_\u003CYYYYMMDD_HHMMSS>.\u003Cext>` (project mode).\n\n| Format | Contents |\n|--------|----------|\n| `json` | Full structured report with all turns, subtotals, model rates |\n| `csv`  | One row per turn: session_id, index, timestamp, model, tokens, cost |\n| `md`   | Summary table + per-session Markdown tables |\n| `html` | Dark-theme report with summary cards + insights + chart. 2-page split by default (`\u003Cstem>_dashboard.html` + `\u003Cstem>_detail.html`); pass `--single-page` for one file. |\n\n### HTML-specific flags\n\n| Flag | Purpose |\n|------|---------|\n| `--single-page`              | Emit one self-contained HTML instead of the dashboard+detail split. |\n| `--chart-lib {highcharts,uplot,chartjs,none}` | Choose the chart renderer. Default `highcharts` (richest visualization, vendored, SHA-256-verified, non-commercial license). `uplot` and `chartjs` are MIT-licensed alternatives. `none` emits a detail page with no JS dependency. See [`scripts\u002Fvendor\u002Fcharts\u002FREADME.md`](scripts\u002Fvendor\u002Fcharts\u002FREADME.md) for per-library license terms. |\n| `--peak-hours H-H`           | Translucent band on the hour-of-day chart (e.g. `5-11`). Community-reported, not an Anthropic SLA. |\n| `--peak-tz \u003CIANA>`           | Timezone the peak hours are defined in (default `America\u002FLos_Angeles`). |\n\n### Other useful flags\n\n| Flag | Purpose |\n|------|---------|\n| `--tz \u003CIANA>`                | IANA timezone for time-of-day bucketing **and timeline\u002Fexport timestamps**. Defaults to the system local tz (auto-detected via `TZ` env var or the OS setting). |\n| `--utc-offset \u003CH>`           | Fixed UTC offset, DST-naive. Use `--tz` for DST-aware. |\n| `--no-cache`                 | Skip `~\u002F.cache\u002Fsession-metrics\u002Fparse\u002F` and always re-parse from scratch. |\n| `--no-self-cost`             | Suppress the self-cost meta-metric (stderr `[self-cost]` line, HTML KPI card, and JSON `self_cost` key). |\n| `--redact-user-prompts`      | Replace freeform `prompt_text` \u002F `prompt_snippet` \u002F `assistant_text` \u002F `assistant_snippet` with `[redacted]` on every turn of single-session and project **JSON** exports, plus compare HTML. Tool inputs, slash-command names, and structured cost \u002F token fields stay visible. HTML \u002F MD \u002F CSV \u002F text are NOT redacted. |\n| `--export-share-safe`        | One-flag pre-share gesture (v1.36.0+): implies `--redact-user-prompts` and `--no-self-cost`, and chmods every written export file to `0600` (`rw-------`). For full prompt redaction, pair with `--output json`. |\n| `--no-include-subagents`     | Skip spawned subagent JSONL files. Subagents are included by default; use this for faster runs when subagent detail is not needed. |\n| `--cache-break-threshold \u003CN>` | Turns whose `input + cache_creation` exceed N are flagged as **cache-break events** (default 100 000). Matches Anthropic's `session-report` convention. |\n| `--no-subagent-attribution`  | Disable Phase-B subagent → parent-prompt token attribution. Default behaviour rolls every subagent's tokens up onto the user prompt that spawned the chain (additional `attributed_subagent_*` fields, no double-counting). |\n| `--sort-prompts-by {total,self}` | How to rank top prompts in HTML\u002FMD output. `total` (default) = parent + attributed subagent cost, surfaces cheap-prompt-spawning-expensive-subagent turns. `self` = parent only (pre-Phase-B order). CSV\u002FJSON keep `self` ordering for stability regardless of this flag. |\n\n> **Invocation note for the AI.** Don't pass `--tz` or `--utc-offset` unless the user explicitly asks for a specific timezone. The script auto-detects the user's system tz and renders all human-facing timestamps (timeline, session headers, generated-at banner, block anchors) in that tz. JSON\u002FCSV raw `timestamp` fields stay UTC ISO-8601 as a machine-readable audit trail. Don't pass `--include-subagents` — subagents are included by default. Only pass `--no-include-subagents` if the user explicitly asks for a faster\u002Fleaner run without subagent detail.\n\n## Output columns\n\n| Column    | Meaning                                      |\n|-----------|----------------------------------------------|\n| `#`       | Deduplicated turn index                      |\n| `Time`    | Timestamp of the turn in the user's local timezone (auto-detected; override with `--tz` \u002F `--utc-offset`). Header shows the active tz label. Raw `timestamp` fields in JSON\u002FCSV exports remain UTC ISO-8601 (`...Z`) for machine-readability. |\n| `Input`   | Net new input tokens (uncached portion only — cache reads\u002Fwrites are shown separately) |\n| `Output`  | Output tokens generated (includes thinking + tool_use block tokens) |\n| `CacheRd` | Tokens served from prompt cache (cheap)      |\n| `CacheWr` | Tokens written to prompt cache (one-time). `1h` \u002F `mix` badge marks turns that used the 1-hour TTL tier; CSV\u002FJSON expose `cache_write_5m_tokens` and `cache_write_1h_tokens` as dedicated columns. |\n| `Content` | Per-turn content-block distribution. Letter encoding `T` thinking, `u` tool_use, `x` text, `r` tool_result, `i` image (zero counts omitted). Renders only when at least one turn carries any content block. CSV\u002FJSON expose `thinking_blocks` \u002F `tool_use_blocks` \u002F `text_blocks` \u002F `tool_result_blocks` \u002F `image_blocks` as dedicated per-turn columns. |\n| `Total`   | Sum of the four billable token buckets       |\n| `Cost $`  | Estimated USD for this turn                  |\n\nDeep-dive on exact column semantics, JSON keys, and detection rules:\n[`references\u002Fjsonl-schema.md`](references\u002Fjsonl-schema.md).\n\n### Per-turn drill-down (HTML only)\n\nIn the Detail page and single-page variants, every Timeline row is\nclickable (keyboard: Enter \u002F Space) and opens a right-side **drawer**\nshowing the user's actual prompt, any slash command, the tools that were\ncalled (with one-line input previews), the content-block mix, the\nper-turn cost\u002Ftoken breakdown, and the assistant's reply. Prompt and\nassistant text are truncated to ~240 characters with a **Show full\nprompt** \u002F **Show full response** toggle that reveals the full text (up\nto a 2 KB cap on assistant text). Close with the × button, Esc, or a\nbackdrop click — focus returns to the originating row. Below the\nTimeline, a collapsible **Prompts** section lists the top-20\nmost-expensive prompts; each row opens the same drawer. The Dashboard\nvariant has no Timeline, so it's unaffected.\n\nFooter shows session totals + **cache savings** vs a hypothetical no-cache\nrun. Conditional dashboard cards appear when their feature was used in the\nsession: **Cache TTL mix** (when any 1h-tier cache writes happened),\n**Extended thinking engagement** (when any turn carried a `thinking` block),\n**Tool calls** (top-3 tool names), **Session resumes** (timeline divider at\neach `claude -c` resume point, detected from `\u002Fexit` + synthetic-turn\nfingerprint — lower-bound count), and the **Usage Insights** panel\n(prose-style pattern characterisations inspired by Anthropic's `\u002Fusage`\ncommand, auto-hide below threshold, exposed in JSON under `usage_insights`\nand in Markdown under `## Usage Insights`).\n\n### Cross-cutting sections (v1.6.0 — inspired by Anthropic's session-report)\n\nThree additional sections auto-hide when empty and render at every scope\n(single session \u002F `--project-cost` \u002F `--all-projects`). All three feed the\nsame `by_skill`, `by_subagent_type`, and `cache_breaks` keys in the JSON\nexport.\n\n- **Cache breaks** — single turns whose `input + cache_creation` exceeds\n  the threshold (configurable via `--cache-break-threshold`, default\n  100 000). Each row names **which turn** lost the cache; the HTML version\n  is expandable and shows ±2 user-prompt context around the event.\n  Complements the overall cache-hit % with actionable \"here is where it\n  blew up\" detail.\n- **Skills & slash commands** — one row per named skill or `\u002Fslash`\n  command, columns: invocations, turns attributed, input \u002F output \u002F cache\n  tokens, % cached, cost, % of total. Attribution model: a slash-prefixed\n  user prompt sets the \"current skill\" for that prompt and its follow-up\n  turns; a Skill-tool invocation overrides attribution for its own turn.\n  Slash-prefixed keys (e.g. `\u002Fsession-metrics`) are de-slashed so they\n  merge with Skill-tool invocations of the same name.\n- **Subagent types** — one row per resolved `subagent_type` (from\n  `Agent` \u002F `Task` tool_use `input.subagent_type`). Shows spawn count\n  always; token\u002Fcost columns populate from subagent JSONLs (default behaviour —\n  pass `--no-include-subagents` to skip).\n\n**UUID-based dedup** runs at project and instance scope to prevent\nresumed-session replays from double-counting. Session scope keeps the\nexisting `message.id` streaming-split dedup.\n\n### Subagent → parent-prompt attribution (v1.7.0 — Phase B)\n\nSubagent token usage is included by default and rolls up onto the **user prompt** that originally triggered the chain:\n\n- Three new turn-record fields populate on the spawning prompt's row —\n  `attributed_subagent_tokens`, `attributed_subagent_cost`,\n  `attributed_subagent_count`. They are **purely additive**:\n  `cost_usd` \u002F `total_tokens` on every turn (parent and subagent) are\n  unchanged, so existing aggregators and the session total are\n  untouched. Display layers read both columns separately.\n- **Nested chains** (subagent A → subagent B) attribute B's tokens onto\n  the **root** user prompt, not onto A. Implemented via an iterative\n  resolve over `(tool_use.id, agentId)` linkage extracted from the\n  parent's `toolUseResult.agentId` fields, with a cycle guard.\n- **HTML prompts table** sorts by `cost_usd + attributed_subagent_cost`\n  by default (configurable via `--sort-prompts-by`). A new \"Subagents\n  +$\" column is auto-shown when at least one top-20 row has attributed\n  cost. The prompt snippet gains a \"+N subagents\" badge.\n- **CSV per-turn export** always includes the three attribution columns\n  (zero on rows without spawn activity) — column count stays stable.\n- **JSON report** exposes top-level `subagent_attribution_summary`\n  with `attributed_turns`, `orphan_subagent_turns`,\n  `nested_levels_seen`, `cycles_detected`. Useful for sanity checks\n  when pointing at unfamiliar history.\n\nDisable subagent loading entirely with `--no-include-subagents` (fastest, no subagent token detail).\nDisable only the attribution rollup while still loading subagents with `--no-subagent-attribution` (compare against pre-Phase-B reports).\n\n## Instance dashboard (all projects)\n\nReached when `$ARGUMENTS[0]` is `all-projects`, or when the user asks\nfor the **total cost across every project** (\"how much have I spent on\nClaude Code overall?\", \"what's my total spend across all projects?\",\n\"which project is costing me the most?\").\n\nAggregates every project under `~\u002F.claude\u002Fprojects\u002F` (or\n`CLAUDE_PROJECTS_DIR`, or the `--projects-dir` override) into a single\ndashboard with instance-wide totals, a daily cost timeline, and a\nper-project breakdown table sorted by cost descending. Each project row\nhyperlinks to a pre-rendered per-project HTML drilldown that carries\nthe full session\u002Fturn detail (same report as `--project-cost \u003Cslug>`).\n\n```bash\n# Instance-wide dashboard — HTML + MD + CSV + JSON\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --all-projects --output html md csv json\n\n# Fast path — no per-project drilldown HTMLs (rows render as plain text)\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --all-projects --no-project-drilldown --output html\n\n# Multi-instance: point at a non-default Claude Code install\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --all-projects --projects-dir \u002Fopt\u002Fclaude-work\u002Fprojects\n```\n\n### Output layout\n\nExports write to a dated subfolder so successive runs don't overwrite\neach other and the whole bundle stays portable (zip it, move it, serve\nit as static files — relative drilldown links keep working):\n\n```\nexports\u002Fsession-metrics\u002Finstance\u002FYYYY-MM-DD-HHMMSS\u002F\n  index.html    # entry point — instance dashboard\n  index.md\n  index.csv     # one row per session, with a project_slug column\n  index.json    # full instance report (no per-turn records — only per-session summaries)\n  projects\u002F\n    \u003Cslug-1>.html   # full per-project HTML, same as --project-cost \u003Cslug-1>\n    \u003Cslug-2>.html\n    ...\n```\n\n`--no-project-drilldown` skips the `projects\u002F` folder entirely and\nrenders `index.html` with project rows as plain text (no hyperlinks) —\nuseful for CI or quick-glance runs. Per-turn data is always suppressed\nat the instance scope; users drill down by clicking into a project HTML.\n\n### Multi-instance Claude Code setups\n\nThree layered overrides pick the projects directory (highest precedence first):\n\n1. `--projects-dir \u003Cpath>` CLI flag\n2. `CLAUDE_PROJECTS_DIR` environment variable\n3. Default `~\u002F.claude\u002Fprojects`\n\nThe resolved projects directory is rendered into the HTML header byline\nso output from multiple instances is self-documenting when viewed\nside-by-side.\n\n### Cache-dir and export-dir overrides (v1.41.0)\n\nTwo parallel override knobs for the parse-cache and export directories.\nSame precedence shape as `--projects-dir`:\n\n| Resource | CLI flag | Env var | Default |\n|----------|----------|---------|---------|\n| Parse cache | `--cache-dir` | `CLAUDE_SESSION_METRICS_CACHE_DIR` | `~\u002F.cache\u002Fsession-metrics\u002Fparse` |\n| Exports | `--export-dir` | `CLAUDE_SESSION_METRICS_EXPORT_DIR` | `\u003Ccwd>\u002Fexports\u002Fsession-metrics` |\n\nUseful when:\n- running in CI \u002F sandboxes where `~\u002F.cache` isn't writable\n- juggling multiple Claude Code installs and you want each to keep its own cache\n- redirecting reports to a shared \u002F mounted directory without `cd`-ing first\n\n```bash\n# Redirect both via env vars\nCLAUDE_SESSION_METRICS_CACHE_DIR=\u002Ftmp\u002Fsm-cache \\\nCLAUDE_SESSION_METRICS_EXPORT_DIR=\u002Ftmp\u002Fsm-out \\\n  uv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py --output html json\n\n# Or via CLI flags (highest precedence — beats env)\nuv run python ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fsession-metrics.py \\\n  --cache-dir \u002Ftmp\u002Fsm-cache --export-dir \u002Ftmp\u002Fsm-out --output html json\n```\n\n## Model comparison\n\nReached only when `$ARGUMENTS[0]` is `compare`, `compare-run`,\n`compare-prep`, or `count-tokens` (see the Dispatch section at the top\nof this file).\n\n**Default pair is `claude-opus-4-6[1m]` vs `claude-opus-4-7[1m]`** —\nthe 1M-context tier, because that matches Claude Code's shipping Opus\nrouting. Users opt into the 200k-context variants by passing the\nunsuffixed IDs explicitly. Mixed-tier pairs are accepted and surface\nthe existing `context-tier-mismatch` advisory on the report.\n\n| Mode | Use when |\n|------|----------|\n| `compare-run` *(preferred)* | User wants the report with no manual capture. Orchestrator spawns two `claude -p` sessions via subscription auth, feeds the canonical suite, then runs `--compare`. Zero API key. |\n| `compare`                   | Two session JSONLs already exist (either from a prior `compare-run`, or from manual `\u002Fmodel` + paste). Input is a path \u002F UUID \u002F `last-\u003Cfamily>` \u002F `all-\u003Cfamily>` token. |\n| `compare-prep`              | Print the manual capture protocol. Only suggest when `claude -p` is unavailable (e.g. CI container without the CLI). |\n| `count-tokens`              | API-key tokenizer smoke test. NOT a subscription path; do not suggest to users comparing two subscription sessions. |\n\n**Output formats for compare mode.** Compare mode supports `--output text md json csv html`. The HTML report is always single-page (a compact scored per-prompt table); `--single-page` and `--chart-lib` are ignored when `--compare` is active.\n\n**`compare-run` auto-extras.** When `compare-run` is invoked with\n`--output \u003Cfmt>`, it emits the compare report *and* five companion\nfiles in `exports\u002Fsession-metrics\u002F`: a per-session dashboard + detail\n(HTML) and raw JSON for each side, plus a Markdown analysis scaffold\n(`compare_\u003Ca8>_vs_\u003Cb8>_\u003Cts>_analysis.md`) with headline ratios,\nper-prompt table, cost decomposition, and a bolded decision-framework\nverdict. Prose sections carry `{{TODO}}` placeholders so a follow-up\nchat can fill them in. Pass `--no-compare-run-extras` to skip the\ncompanions and emit only the compare report. Without `--output`,\nnothing writes to disk (text-only stdout path preserved).\n\n**Custom prompts.** Users can add their own prompts to the comparison suite with\n`--compare-add-prompt \"text\"` — no file format knowledge required. The prompt is\nsaved to `~\u002F.session-metrics\u002Fprompts\u002F` and runs automatically on every subsequent\n`--compare-run`. Use `--compare-list-prompts` to preview the active suite and call\ncount before spending on inference. Use `--compare-remove-prompt \u003Cname>` to remove.\nFull guide: [`references\u002Fcustom-prompts.md`](references\u002Fcustom-prompts.md).\n\n**Prompt steering.** `--compare-run-prompt-steering \u003Cvariant>` wraps every\nprompt in the suite with a steering instruction before feeding it to\n`claude -p`. The four built-in variants are `concise`,\n`think-step-by-step`, `ultrathink`, and `no-tools`. The wrapper is\napplied symmetrically to both sides so the A\u002FB stays clean — what shifts\nis the model's behaviour under the same instruction, surfaced as token \u002F\ncost \u002F thinking \u002F tool-call deltas. Use\n`--compare-run-prompt-steering-position {prefix,append,both}` (default\n`prefix`) to control where the steering text lands relative to the body.\nIFEval pass rates may differ from the unsteered baseline by design —\npredicate breakage (e.g. \"be concise\" violating the 50-word stacked\nconstraint) is the *measurement*, not a regression. For multi-variant\nsweeps with auto-rendered comparison articles + cross-variant summary,\nuse the `benchmark-effort-prompt` skill instead.\n\n**Before proposing any compare-mode command, read\n[`references\u002Fmodel-compare.md`](references\u002Fmodel-compare.md).** That\ndoc has the full flag table, four workflow recipes, 4-way Opus combo\nmatrix, IFEval predicates, advisory semantics, and troubleshooting.\nThe eager content in this file deliberately stays minimal so\nsingle-session reports don't pay for compare-mode context they don't\nuse.\n\n## Optional post-export audit\n\nWhen any `--output` format is specified (`html`, `csv`, `md`, or `json`),\nalways include `json` in the script invocation if it is not already present.\nFor example, if the user asked for `--output html`, run the script with\n`--output html json`. This ensures the JSON export is always written and the\naudit suggestion can always be shown.\n\nAfter all `[export] FMT → path` lines are printed and the optional\n`[self-cost]` line lands, append an audit suggestion based on the export scope.\nDetermine scope from the JSON filename printed by the `[export] JSON` line:\n\n- `session_*.json` → session scope\n- `project_*.json` → project scope\n- `instance\u002F*\u002Findex.json` → instance scope\n\n**Session scope:**\n> Want a token-usage audit of this session?\n>   `\u002Faudit-session-metrics quick   \u003Cjson-path>`   (Haiku — ~10× cheaper than Sonnet)\n>   `\u002Faudit-session-metrics detailed \u003Cjson-path>`  (Haiku, also reads CLAUDE.md + settings)\n\n**Project scope:**\n> Want a per-session cost and cache health audit of this project?\n>   `\u002Faudit-session-metrics quick   \u003Cjson-path>`   (Haiku — surfaces top expensive sessions, cache outliers)\n>   `\u002Faudit-session-metrics detailed \u003Cjson-path>`  (Haiku, also drills into top session turn patterns)\n\n**Instance scope:**\n> Want a cross-project cost breakdown audit?\n>   `\u002Faudit-session-metrics quick   \u003Cjson-path>`   (Haiku — per-project cost shares and cache health)\n\nSubstitute `\u003Cjson-path>` with the actual path printed by the\n`[export] JSON` line.\n\n**Do not invoke `audit-session-metrics` programmatically from this\nturn.** Its frontmatter pins `model: haiku` and the model override\nonly takes effect when the audit skill is the entry point of its own\nturn — invoking via the Skill tool inside a session-metrics turn\nkeeps the parent's Sonnet model and erases the cost win. The user\nruns the slash command at their own discretion.\n\n## Self-cost meta-metric\n\nsession-metrics tracks its own running cost in the current session.\nAfter the `[export]` lines a `[self-cost]` stderr summary prints the\nprior turns' tokens \u002F dollars (the *current* run is not yet written\nto the JSONL when the script reads it). The HTML dashboard surfaces\nthe same number as a \"Skill self-cost\" KPI card. The JSON export\ncarries it as the top-level `self_cost` key.\n\nPass `--no-self-cost` to suppress all three surfaces — useful for\nclean test snapshots or for users who find the meta-metric noisy.\n\n## Reference files\n\n- [`references\u002Fpricing.md`](references\u002Fpricing.md) — Per-model token prices used\n  for cost calculation. Read when the user asks about pricing or you need to\n  add a new model.\n- [`references\u002Fjsonl-schema.md`](references\u002Fjsonl-schema.md) — JSONL entry\n  structure + full output-column semantics, cache-TTL split rationale, content-\n  block distribution, resume detection. Read when debugging missing data,\n  extending the script, or interpreting any non-obvious column\u002Fkey.\n- [`references\u002Fmodel-compare.md`](references\u002Fmodel-compare.md) — `--compare`\n  workflow, prompt-suite catalogue, IFEval predicates, interpretation guide.\n  Read when `$ARGUMENTS[0]` routes into compare mode.\n- [`references\u002Fcustom-prompts.md`](references\u002Fcustom-prompts.md) — Step-by-step\n  guide for adding, removing, and previewing custom prompts for `--compare-run`.\n  Read when the user asks how to add their own prompts or customise the suite.\n- [`references\u002Fplatform-notes.md`](references\u002Fplatform-notes.md) — Windows\n  `tzdata` caveat for IANA `--tz` names, the `--strict-tz` escape hatch,\n  and timezone-contract summary. Read when the user reports a timezone\n  warning, asks about Windows support, or wants CI-safe tz handling.\n\n## How session detection works\n\n1. Derives the project slug from `cwd`: replaces `\u002F` → `-`, strips leading `-`.\n2. Scans `~\u002F.claude\u002Fprojects\u002F\u003Cslug>\u002F` for `*.jsonl` files (excludes `subagents\u002F`).\n3. Picks the most recently modified file as the current session.\n4. Override with `--session \u003Cuuid>` or `--slug \u003Cslug>` when needed.\n\n## Deduplication\n\nEach API response is written to the JSONL multiple times (streaming, tool\ncompletion, final). The script deduplicates on `message.id` — keeping only the\n**last** occurrence so token counts reflect the final settled value.\n",{"name":5,"model":43,"description":7},"sonnet","main","1907bbe850fb749efa8b499b8da7ebb78a663519",".claude\u002Fskills\u002Fsession-metrics",0,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start","https:\u002F\u002Fgithub.com\u002FdevelopAgent","2026-07-19 05:19:22",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add developAgent\u002Fbmad-start --skill session-metrics",{"tool":57,"command":58},"bunx","bunx skills add developAgent\u002Fbmad-start --skill session-metrics",{"tool":60,"command":61},"pnpm","pnpm dlx skills add developAgent\u002Fbmad-start --skill session-metrics","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002FSKILL.md",true,[65,71,75,79,83,87,91,95,99,103,107,111,115,119,123,127,131,137,141,145,149,153,157,161,165,169,173,177,181,185,189,193,197,201],{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},"CHANGELOG.md","REFERENCE","参考文档",87143,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002FCHANGELOG.md",{"path":72,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002Fcustom-prompts.md",6078,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fcustom-prompts.md",{"path":76,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Fjsonl-schema.md",29488,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fjsonl-schema.md",{"path":80,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":81,"sourceHtmlUrl":82},"references\u002Fmodel-compare.md",31746,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fmodel-compare.md",{"path":84,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":85,"sourceHtmlUrl":86},"references\u002Fmodel-compare\u002Fprompts\u002F01_claudemd_summarise.md",2704,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fmodel-compare\u002Fprompts\u002F01_claudemd_summarise.md",{"path":88,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":89,"sourceHtmlUrl":90},"references\u002Fmodel-compare\u002Fprompts\u002F02_english_prose.md",1323,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fmodel-compare\u002Fprompts\u002F02_english_prose.md",{"path":92,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":93,"sourceHtmlUrl":94},"references\u002Fmodel-compare\u002Fprompts\u002F03_code_review.md",1956,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fmodel-compare\u002Fprompts\u002F03_code_review.md",{"path":96,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":97,"sourceHtmlUrl":98},"references\u002Fmodel-compare\u002Fprompts\u002F04_stack_trace_debug.md",1708,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fmodel-compare\u002Fprompts\u002F04_stack_trace_debug.md",{"path":100,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":101,"sourceHtmlUrl":102},"references\u002Fmodel-compare\u002Fprompts\u002F05_tool_heavy_task.md",1057,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fmodel-compare\u002Fprompts\u002F05_tool_heavy_task.md",{"path":104,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":105,"sourceHtmlUrl":106},"references\u002Fmodel-compare\u002Fprompts\u002F06_cjk_prose.md",1529,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fmodel-compare\u002Fprompts\u002F06_cjk_prose.md",{"path":108,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":109,"sourceHtmlUrl":110},"references\u002Fmodel-compare\u002Fprompts\u002F07_json_reshape.md",1927,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fmodel-compare\u002Fprompts\u002F07_json_reshape.md",{"path":112,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":113,"sourceHtmlUrl":114},"references\u002Fmodel-compare\u002Fprompts\u002F08_csv_transform.md",1391,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fmodel-compare\u002Fprompts\u002F08_csv_transform.md",{"path":116,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":117,"sourceHtmlUrl":118},"references\u002Fmodel-compare\u002Fprompts\u002F09_typescript_refactor.md",1315,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fmodel-compare\u002Fprompts\u002F09_typescript_refactor.md",{"path":120,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":121,"sourceHtmlUrl":122},"references\u002Fmodel-compare\u002Fprompts\u002F10_instruction_stress.md",1013,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fmodel-compare\u002Fprompts\u002F10_instruction_stress.md",{"path":124,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":125,"sourceHtmlUrl":126},"references\u002Fplatform-notes.md",3894,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fplatform-notes.md",{"path":128,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":129,"sourceHtmlUrl":130},"references\u002Fpricing.md",8461,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Freferences\u002Fpricing.md",{"path":132,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":135,"sourceHtmlUrl":136},"scripts\u002F_analytics.py","SCRIPT","脚本",22133,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_analytics.py",{"path":138,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":139,"sourceHtmlUrl":140},"scripts\u002F_charts.py",30280,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_charts.py",{"path":142,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":143,"sourceHtmlUrl":144},"scripts\u002F_cli.py",54168,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_cli.py",{"path":146,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":147,"sourceHtmlUrl":148},"scripts\u002F_constants.py",784,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_constants.py",{"path":150,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":151,"sourceHtmlUrl":152},"scripts\u002F_data.py",67231,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_data.py",{"path":154,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":155,"sourceHtmlUrl":156},"scripts\u002F_dispatch.py",55061,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_dispatch.py",{"path":158,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":159,"sourceHtmlUrl":160},"scripts\u002F_dt.py",566,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_dt.py",{"path":162,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":163,"sourceHtmlUrl":164},"scripts\u002F_html_sections.py",190867,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_html_sections.py",{"path":166,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":167,"sourceHtmlUrl":168},"scripts\u002F_invariants.py",7072,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_invariants.py",{"path":170,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":171,"sourceHtmlUrl":172},"scripts\u002F_json_export.py",4257,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_json_export.py",{"path":174,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":175,"sourceHtmlUrl":176},"scripts\u002F_md_render.py",42585,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_md_render.py",{"path":178,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":179,"sourceHtmlUrl":180},"scripts\u002F_report.py",52787,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_report.py",{"path":182,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":183,"sourceHtmlUrl":184},"scripts\u002F_time_of_day.py",4958,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_time_of_day.py",{"path":186,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":187,"sourceHtmlUrl":188},"scripts\u002F_turn_parser.py",37672,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_turn_parser.py",{"path":190,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":191,"sourceHtmlUrl":192},"scripts\u002F_tz.py",6256,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_tz.py",{"path":194,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":195,"sourceHtmlUrl":196},"scripts\u002F_user_prompt.py",2419,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002F_user_prompt.py",{"path":198,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":199,"sourceHtmlUrl":200},"scripts\u002Fsession_metrics_compare.py",212024,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002Fsession_metrics_compare.py",{"path":202,"resourceType":133,"resourceTypeDesc":134,"sizeBytes":203,"sourceHtmlUrl":204},"scripts\u002Fsession-metrics.py",33426,"https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsession-metrics\u002Fscripts\u002Fsession-metrics.py",[206,214,221,228,235,242],{"skillNo":207,"name":208,"nameZh":6,"description":209,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":210,"categories":211,"keywords":212,"publishedAt":213},"01M72ZN1RJ28HE3TG8CK5VMDZ0","writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":215,"name":216,"nameZh":6,"description":217,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":218,"categories":219,"keywords":220,"publishedAt":213},"01M72ZMZG4KQAFDEHG6KABQW8R","to-prd","Turn the current conversation into a PRD and publish it to the project issue tracker — no interview, just synthesis of what you've already discussed.","https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002Fskills\u002Fto-prd\u002FSKILL.md",[],[],{"skillNo":222,"name":223,"nameZh":6,"description":224,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":225,"categories":226,"keywords":227,"publishedAt":213},"01M72ZMWB9ZNA0Y5KGAHTW89E8","steve-jobs-perspective","史蒂夫·乔布斯(Steve Jobs)的思维框架与表达方式。基于Isaacson授权传记、Stanford演讲、\nLost Interview、D Conference系列、Make Something Wonderful、30+一手来源的深度调研，\n提炼6个核心心智模型、8条决策启发式和完整的表达DNA。\n用途：作为思维顾问，用乔布斯的视角分析产品、审视决策、提供反馈。\n当用户提到「用乔布斯的视角」「乔布斯会怎么看」「Jobs模式」「steve jobs perspective」时使用。\n即使用户只是说「帮我用乔布斯的角度想想」「如果乔布斯会怎么做」「切换到乔布斯」也应触发。","https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002Fskills\u002Fsteve-jobs-perspective\u002FSKILL.md",[],[],{"skillNo":229,"name":230,"nameZh":6,"description":231,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":232,"categories":233,"keywords":234,"publishedAt":213},"01M72ZMS3ZRQY9PCRPRVWY040M","pinme","Use this skill when the user mentions \"pinme\", or needs to upload files, store to IPFS, create\u002Fpublish\u002Fdeploy websites or full-stack services (including frontend pages, backend APIs, database storage, email sending, etc.), or any feature requiring backend database\u002Fserver support.","https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002Fskills\u002Fpinme\u002FSKILL.md",[],[],{"skillNo":236,"name":237,"nameZh":6,"description":238,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":239,"categories":240,"keywords":241,"publishedAt":213},"01M72ZMPJHQ8NHC9WSH41DKV1F","pinme-share","Use this skill when the user wants to share, publish, or upload a static result through PinMe, especially by generating a static HTML share page for a PinMe project link, deployed full-stack app, Codex conversation summary, report, file, demo, or any 分享\u002F发布\u002F上传分享页 request that should end with `pinme upload`.","https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002Fskills\u002Fpinme-share\u002FSKILL.md",[],[],{"skillNo":243,"name":244,"nameZh":6,"description":245,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":246,"categories":247,"keywords":248,"publishedAt":213},"01M72ZMM4QBVWMAW0YYM7H0Y6P","pinme-llm","Use this skill when a PinMe project (Worker TypeScript) needs to call OpenRouter-backed LLM APIs, including models, chat\u002Fcompletions, streaming, or OpenRouter web search. Guides AI to generate correct Worker TS code.","https:\u002F\u002Fgithub.com\u002FdevelopAgent\u002Fbmad-start\u002Fblob\u002Fmain\u002Fskills\u002Fpinme-llm\u002FSKILL.md",[],[]]