Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计提醒

session-inspector会话检查员

Agent Skill

session-inspector 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,704

周安装

71

GitHub Stars

81

下载量

568
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:session-inspector(会话检查员)
来源仓库:https://github.com/dagster-io/erk
仓库路径:skills/session-inspector
安装命令:
npx skills add https://github.com/dagster-io/erk --skill session-inspector
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dagster-io/erk --skill session-inspector

简介

session-inspector 用于查找、检索和筛选相关信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词、任务场景或来源线索快速定位候选结果时使用。
  • 可结合来源仓库、安装命令和原始 README 继续核验具体用法。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Session Inspector

Overview

Session Inspector provides comprehensive tools for inspecting Claude Code session logs stored in ~/.claude/projects/. The skill enables:

  • Discovering and listing sessions for any project/worktree
  • Preprocessing sessions to readable XML format
  • Analyzing context window consumption
  • Extracting plans from sessions
  • Creating plan PRs from session content
  • Debugging agent subprocess execution
  • Understanding the two-stage extraction pipeline

When to Use

Invoke this skill when users:

  • Ask what sessions exist for a project or worktree
  • Want to find a specific session by ID or content
  • Need to analyze context window consumption
  • Ask about tool call patterns or frequencies
  • Need to debug agent subprocess failures
  • Want to extract plans from sessions
  • Ask about session history or previous conversations
  • Need to understand session preprocessing or extraction

Quick Reference: CLI Commands

All commands invoked via erk exec <command>:

CommandPurpose
list-sessionsList sessions with metadata for current worktree
preprocess-sessionConvert JSONL to compressed XML
extract-latest-planExtract most recent plan from session
create-pr-from-sessionCreate plan PR from session plan
extract-session-from-issueExtract session content from GitHub issue

Slash Commands

CommandPurpose
/erk:sessions-listDisplay formatted session list table
/local:analyze-contextAnalyze context window usage across sessions

Core Capabilities

1. List Sessions

erk exec list-sessions [--limit N] [--min-size BYTES]

Options:

  • --limit: Maximum sessions to return (default: 10)
  • --min-size: Minimum file size in bytes to filter tiny sessions (default: 0)

Output includes:

  • Branch context (current_branch, trunk_branch, is_on_trunk)
  • Current session ID from SESSION_CONTEXT env var
  • Sessions array with: session_id, mtime_display, mtime_relative, size_bytes, summary, is_current
  • Project directory path and filtered count

2. Preprocess Session to XML

erk exec preprocess-session <log-path> [OPTIONS]

Options:

  • --session-id: Filter entries to specific session ID
  • --include-agents/--no-include-agents: Include agent logs (default: True)
  • --no-filtering: Disable filtering optimizations
  • --stdout: Output to stdout instead of temp file

Optimizations applied:

  • Empty/warmup session filtering
  • Documentation deduplication (hash markers)
  • Tool parameter truncation (>200 chars)
  • Tool result pruning (first 30 lines, preserves errors)
  • Log discovery operation filtering

3. Extract Plan from Session

erk exec extract-latest-plan [--session-id SESSION_ID]

Extracts most recent plan from session. Uses session-scoped lookup via slug field, falls back to mtime-based lookup if no session-specific plan found.

4. Create Plan PR from Session

erk exec create-pr-from-session [--session-id SESSION_ID]

Extracts plan and creates plan PR with session content. Returns JSON with issue_number and issue_url.

5. Render Session for GitHub

erk exec render-session-content --session-file <path> [--session-label LABEL] [--extraction-hints HINTS]

Renders session XML as GitHub comment blocks with automatic chunking for large content.

6. Extract Session from GitHub Issue

erk exec extract-session-from-issue <issue-number> [--output PATH] [--session-id ID]

Extracts and combines chunked session content from GitHub issue comments.

Directory Structure

~/.claude/projects/
├── -Users-foo-code-myapp/           ← Encoded project path
│   ├── abc123-def456.jsonl          ← Main session log
│   ├── xyz789-ghi012.jsonl          ← Another session
│   ├── agent-17cfd3f4.jsonl         ← Agent subprocess log
│   └── agent-2a3b4c5d.jsonl         ← Another agent log

Path encoding: Prepend -, replace / and . with -

Example: /Users/foo/code/myapp-Users-foo-code-myapp

Session ID

Session IDs are passed explicitly to CLI commands via --session-id options. The typical flow:

  1. Hook receives session context via stdin JSON from Claude Code
  2. Hook outputs 📌 session: <id> reminder to conversation
  3. Agent extracts session ID from reminder text
  4. Agent passes session ID as explicit CLI parameter

Example:

erk exec list-sessions --session-id abc123-def456

Two-Stage Extraction Pipeline

The extraction system uses a two-stage pipeline:

Stage 1: Mechanical Reduction (Deterministic)

  • Drop file-history-snapshot entries
  • Strip usage metadata
  • Remove empty text blocks
  • Compact whitespace (3+ newlines → 1)
  • Deduplicate assistant messages with tool_use
  • Output: Compressed XML

Stage 2: Haiku Distillation (Optional, Semantic)

  • Remove noise (log discovery, warmup content)
  • Deduplicate semantically similar blocks
  • Prune verbose outputs
  • Preserves errors, stack traces, warnings
  • Output: Semantically refined XML

Session Selection Logic

The auto_select_sessions() function uses intelligent rules:

  • On trunk: Use current session only
  • Current session trivial (<1KB) + substantial sessions exist: Auto-select substantial
  • Current session substantial (>=1KB): Use it alone
  • No substantial sessions: Return current even if trivial

Scratch Storage

Session-scoped files stored in .erk/scratch/sessions/<session-id>/:

from erk_shared.scratch import get_scratch_dir, write_scratch_file

scratch_dir = get_scratch_dir(session_id)
file_path = write_scratch_file(content, session_id=session_id, suffix=".xml")

Common Tasks

Find What Happened in a Session

  1. List sessions: erk exec list-sessions
  2. Find by summary or time
  3. Preprocess: erk exec preprocess-session <file> --stdout | head -500

Debug Context Blowout

  1. Run /local:analyze-context
  2. Check token breakdown by category
  3. Look for duplicate reads or large tool results

Extract Plan for Implementation

erk exec extract-latest-plan --session-id <id>

Create Issue from Session Plan

erk exec create-pr-from-session --session-id <id>

Find Agent Subprocess Logs

# Compute project dir using Claude Code's path encoding (replace / and . with -)
PROJECT_DIR="$HOME/.claude/projects/$(pwd | sed 's|/|-|g; s|\.|-|g')"
ls -lt "$PROJECT_DIR"/agent-*.jsonl | head -10

Check for Errors in Agent

cat agent-<id>.jsonl | jq 'select(.message.is_error == true)'

Resources

references/

  • tools.md - Complete CLI commands and jq analysis recipes
  • format.md - JSONL format specification and entry types
  • extraction.md - erk_shared extraction module API reference

Load references when users need detailed command syntax, format documentation, or programmatic access to extraction capabilities.

Code Dependencies

This skill documents capabilities that primarily live in:

  • CLI commands: packages/erk-cli/src/erk_cli/commands/
  • Shared library: packages/erk-shared/src/erk_shared/extraction/
  • GitHub metadata: packages/erk-shared/src/erk_shared/github/metadata.py
  • Scratch storage: packages/erk-shared/src/erk_shared/scratch/

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38%
按下载量换算216

Claude

28.78%
按下载量换算163

Cursor

18.87%
按下载量换算107

Gemini CLI

8.81%
按下载量换算50

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/dagster-io/erk --skill session-inspector 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills