{"id":"session-trends","name":"session-trends","summary":"セッションの指標全体の傾向を分析しましょう。ウィンドウ付き集計、デルタを計算し、MEMORY.md 結果と比較します。","body":"# Session Trends\n\nAnalyze trends from the metrics ledger. Computes windowed aggregates,\nfingerprint distributions, and compares against MEMORY.md baselines.\n\n## Requirements\n\nRequires `.claude/session-metrics/metrics.jsonl` from `/session-scan`.\n\n## Usage\n\n```\n/session-trends                          # All windows (7d, 30d, all)\n/session-trends --window 30d             # Specific window only\n/session-trends --project enaia          # Filter by project\n/session-trends --compare MEMORY.md      # Compare against memory baseline\n/session-trends --html out.html          # Write HTML report with ASCII bars\n```\n\nFor pure context-window stats (max prompt tokens, ctx %, compaction rate)\nacross raw Claude Code JSONL files, see the `--scan-jsonl` mode of\n`compute-metrics.py` (inspired by badlogic / earendil-works/pi).\n\n## Pipeline\n\n### Step 1: Parse Arguments\n\nExtract from `$ARGUMENTS`:\n\n- **`--window WINDOW`**: Time window — `7d`, `30d`, or `all` (default: show all three)\n- **`--project NAME`**: Filter metrics by project name\n- **`--compare PATH`**: Path to MEMORY.md for baseline comparison\n  (default: auto-detect from `.claude/` project memory)\n\n### Step 2: Read Metrics Ledger\n\nRead `.claude/session-metrics/metrics.jsonl`.\n\nIf empty or missing:\n\n> No metrics found. Run `/session-scan` first.\n\nIf `--project` specified, filter entries by project field.\n\n### Step 3: Compute Trends via Python\n\n```bash\npython3 .claude/skills/session-scan/references/compute-metrics.py \\\n  --trends .claude/session-metrics/metrics.jsonl \\\n  --memory {MEMORY_PATH}\n```\n\nCapture the JSON output.\n\n### Step 4: Display Trend Report\n\nFormat the JSON output as a readable report:\n\n#### Overview\n\n```\nTotal sessions: {N} ({backfilled} backfilled from v1)\nDate range: {earliest} to {latest}\n```\n\n#### Window Comparison\n\n```\n| Metric                  | 7 days | 30 days | All time |\n|-------------------------|--------|---------|----------|\n| Sessions                | 12     | 45      | 165      |\n| Avg friction            | 0.28   | 0.24    | 0.22     |\n| Max friction            | 0.72   | 0.72    | 0.89     |\n| Avg opportunity         | 0.35   | 0.30    | 0.28     |\n| Tier 2 eligible         | 40%    | 33%     | 30%      |\n| Plugin adoption         | 12%    | 10%     | 8%       |\n```\n\n#### Fingerprint Distribution\n\n```\n| Type          | 7d  | 30d | All  |\n|---------------|-----|-----|------|\n| bug-fix       | 4   | 15  | 52   |\n| feature       | 3   | 12  | 48   |\n| exploration   | 2   | 8   | 30   |\n| maintenance   | 1   | 5   | 18   |\n| review        | 1   | 3   | 10   |\n| refactoring   | 1   | 2   | 7    |\n```\n\n#### MEMORY.md Comparison (if --compare)\n\nCompare measured values against MEMORY.md claims:\n\n```\n| MEMORY.md Claim              | Measured    | Match? |\n|------------------------------|-------------|--------|\n| Plugin adoption: 8-12%       | 10.2%       | Yes    |\n| Minimal friction in 40+ of 74| 68% smooth  | Yes    |\n```\n\n### Step 5: Write trends.json\n\nWrite computed trends to `.claude/session-metrics/trends.json`.\n\n### Step 6: Suggest Actions\n\nBased on trends:\n\n- If friction is **increasing**: \"Friction trending up — run `/session-deep-dive --from-scan` to investigate\"\n- If plugin adoption is **growing**: \"Plugin adoption growing — check which commands drive value\"\n- If many Tier 2 eligible: \"{N} sessions need deep analysis\"\n\n## Output Files\n\n| File | Purpose |\n|------|---------|\n| `.claude/session-metrics/trends.json` | Computed trend data |\n\n## Common Queries\n\nSee `references/trend-queries.md` for interpreting specific trend patterns.\n\n## Iron Laws\n\n1. **ALWAYS use Python for computation** — no manual aggregation\n2. **NEVER modify metrics.jsonl** — read-only for trends\n3. **ALWAYS show window comparison** — single numbers lack context\n\n## Acknowledgements\n\nThe HTML report layout (preformatted text + ASCII bar charts via `█`/`░`)\nand per-model + threshold-bucket breakdown (`>=80%`, `>=90%`, `>=100%`,\n`compaction_rate`) were borrowed from\n[badlogic / earendil-works/pi `session-context-stats.mjs`](https://github.com/earendil-works/pi/blob/main/scripts/session-context-stats.mjs).\nOur pipeline's qualitative metrics (friction, fingerprint, plugin\nopportunity, skill effectiveness) are additive on top.","author":"@oliver-kriska","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/oliver-kriska/claude-elixir-phoenix/tree/main/.claude/skills/session-trends","license":"MIT","category":"writing","lang":"en","tokens":1147,"stars":0,"calls30d":2,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[{"path":"references/trend-queries.md","size":4520,"sha256":"4805150c15c57bc0241970613252d75223bae8844c6e15025097d69bdae6e8ab"}],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}