{"id":"session-deep-dive","name":"session-deep-dive","summary":"高信号セッションの詳細な定性分析。v2テンプレートでサブエージェントを生成し、パターンを合成し、既知の発見と比較します。","body":"# Session Deep Dive (Tier 2)\n\nQualitative analysis of high-signal sessions identified by `/session-scan`.\nSpawns subagents with pre-computed metrics context for focused analysis.\n\n## Requirements\n\nRequires **ccrider MCP**. If not available:\n\n> ccrider MCP is required. See: <https://github.com/neilberkman/ccrider>\n\n## Usage\n\n```\n/session-deep-dive ffa155ee-ed8a-492c-8797-878fcbec4d9e\n/session-deep-dive --last                    # Most recent Tier 2 eligible\n/session-deep-dive --from-scan               # All Tier 2 eligible from last scan\n/session-deep-dive --from-scan --compare .claude/UPDATED_PLUGIN_REPORT_160_SESSIONS.md\n```\n\n## Pipeline\n\n### Step 1: Resolve Target Sessions\n\nFrom `$ARGUMENTS`:\n\n- **Session ID**: Single session to analyze\n- **`--last`**: Most recent Tier 2 eligible session from metrics.jsonl\n- **`--from-scan`**: All sessions where `tier2_eligible: true` AND\n  `tier2_completed: false` in `.claude/session-metrics/metrics.jsonl`\n- **`--compare REPORT.md`**: Previous report to compare against\n  (default: most recent `.claude/session-analysis/insights-*.md`)\n\nIf no metrics.jsonl exists, tell the user:\n\n> No metrics found. Run `/session-scan` first to discover and score sessions.\n\n### Step 2: Load Pre-computed Metrics\n\nFor each target session, read its entry from `metrics.jsonl`.\nFormat the metrics as a context block for subagent prompts:\n\n```\n## Pre-computed Metrics (from /session-scan)\n\n- Friction: 0.42 (retry_loops: 1, user_corrections: 3, approach_changes: 2)\n- Fingerprint: bug-fix (confidence: 0.85)\n- Plugin opportunity: 0.65 (could use: investigate, quick)\n- Tool profile: Read 28.7%, Edit 15.2%, Bash 19.3%, Tidewave 22.8%\n- Duration: 78 minutes, 19 user messages, 171 tool calls\n```\n\nDetermine `PROJECT_ROOT` from current working directory.\n\n### Step 3: Fetch Transcripts — One Subagent Per Session\n\n**CRITICAL: One ccrider call = one subagent.** Full transcripts are\n5-30KB each. Even 3 per worker floods the worker's context.\n\nFor EACH session, spawn a **haiku** subagent:\n\n```\nTask(subagent_type=\"general-purpose\", model=\"haiku\", mode=\"bypassPermissions\", prompt=\"\"\"\nFetch one session transcript and save it.\n\n1. mcp__ccrider__get_session_messages(session_id: \"{SESSION_ID}\")\n   If > 200 messages: use last_n: 200\n\n2. Write transcript to {PROJECT_ROOT}/.claude/session-analysis/{SHORT_ID}-transcript.md\n   Format:\n   # Session: {SHORT_ID}\n   Project: {PROJECT}\n   Date: {DATE}\n   Messages: {COUNT}\n\n   ## Messages\n   ### User (seq N)\n   {content}\n   ### Assistant (seq N)\n   {content}\n\n3. Report: \"Wrote {SHORT_ID}-transcript.md ({N} messages)\"\n\"\"\")\n```\n\n**Spawn ALL fetch subagents in parallel.** Wait for all to complete.\n\n### Step 4: Analyze Sessions\n\nRead the analysis template — inline it into subagent prompts:\n\n```\nGlob: **/session-deep-dive/references/analysis-template-v2.md\n```\n\n**ALWAYS use subagents** — never analyze in main context.\n\n- **1-6 sessions**: Spawn **sonnet** subagents (one per session)\n- **7+ sessions**: Spawn **haiku** subagents for speed\n\nEach analysis subagent prompt:\n\n> Read the session transcript at {transcript_path}.\n> Apply the analysis template below to analyze this session.\n> The pre-computed metrics below give you quantitative context —\n> validate them and add qualitative depth.\n>\n> {metrics_context_block}\n>\n> {analysis_template_content}\n>\n> Write your report (under 200 lines) to {report_path}.\n\nReports go to `.claude/session-analysis/{short_id}-report.md`.\n\n### Step 5: Compress (if 3+ sessions)\n\nIf 3+ sessions analyzed, spawn context-supervisor (haiku) to compress:\n\n> Read all report files in `.claude/session-analysis/*-report.md`.\n> Write a consolidated summary to `.claude/session-analysis/summaries/consolidated.md`.\n> Preserve: friction patterns, plugin opportunities, evidence strength tags.\n> Remove: per-file details, generic observations, repeated context.\n\n### Step 6: Synthesize\n\nRead the synthesis template:\n\n```\nGlob: **/session-deep-dive/references/synthesis-template.md\n```\n\nRead the `--compare` report (or latest insights file).\nRead `MEMORY.md` for known findings.\n\nIf 3+ sessions: read `summaries/consolidated.md` (NOT individual reports).\nIf 1-2 sessions: read individual reports directly.\n\nProduce synthesis comparing:\n\n- New findings vs known patterns from MEMORY.md\n- Confirmed patterns (seen before, still present)\n- New patterns (not in previous reports)\n- Resolved patterns (previously noted, no new occurrences)\n\n### Step 7: Update Ledger\n\nUse Python to safely update `metrics.jsonl` — never manually\nread/modify/rewrite in the LLM context:\n\n```bash\npython3 -c \"\nimport json\nids = {SESSION_IDS_SET}  # e.g., {'ffa155ee-...', '90a74843-...'}\nlines = open('{PROJECT_ROOT}/.claude/session-metrics/metrics.jsonl').readlines()\nwith open('{PROJECT_ROOT}/.claude/session-metrics/metrics.jsonl', 'w') as f:\n    for line in lines:\n        entry = json.loads(line)\n        if entry.get('session_id') in ids:\n            entry['tier2_completed'] = True\n        f.write(json.dumps(entry) + '\\n')\n\"\n```\n\n### Step 8: Write Output\n\nWrite synthesis to `.claude/session-analysis/insights-{date}.md`\n\nPresent key findings directly in conversation. Tell user:\n\n> Full report: `.claude/session-analysis/insights-{date}.md`\n> Per-session reports: `.claude/session-analysis/{id}-report.md`\n\n## Output Files\n\n| File | Purpose |\n|------|---------|\n| `.claude/session-analysis/{id}-transcript.md` | Raw transcript |\n| `.claude/session-analysis/{id}-report.md` | Per-session analysis |\n| `.claude/session-analysis/summaries/consolidated.md` | Compressed reports |\n| `.claude/session-analysis/insights-{date}.md` | Cross-session synthesis |\n\n## Iron Laws\n\n1. **ONE ccrider call = ONE subagent** — never batch multiple fetches\n2. **NEVER fetch or analyze in main context** — always subagents\n3. **Absolute paths in subagent prompts** — subagents don't inherit skill context\n4. **Python for jsonl updates** — never manually rewrite in LLM context\n5. **ALWAYS pass pre-computed metrics to analysis subagents** — don't re-derive\n6. **NEVER skip synthesis** — cross-session patterns are the real value\n7. **TAG evidence strength** — every finding must be STRONG/MODERATE/WEAK","author":"@oliver-kriska","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/oliver-kriska/claude-elixir-phoenix/tree/main/.claude/skills/session-deep-dive","license":"MIT","category":"document","lang":"en","tokens":1612,"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/analysis-template-v2.md","size":4181,"sha256":"f3ce79ae1dcfff54d1899bfd1564e1023e3e4186b07e0591c803733e49375e79"},{"path":"references/synthesis-template.md","size":2287,"sha256":"1ed2f5a7c81d8b71410ecb3de7c9aa6797be197097ff79e4428bcc0018405f97"}],"requires":{"mcp":["ccrider"],"tools":[]},"safety":{"flags":[{"code":"injection.disable-permissions","kind":"injection","where":"SKILL.md:63","excerpt":"bypassPermissions","message":"instructs the agent to disable permission checks","severity":"warn"}],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}