跳到主要内容
知仓学习社ZHICANG

session-viewer

Render Codex, Claude Code, OpenClaw, or Pi session JSONL transcripts as a searchable, shareable single-file HTML viewer.

执行命令改身份文件读文件写文件联网严重 0 · 高危 3openclaw/agent-skills

它会碰到什么

扫了多少16 个文本文件,125 KB
它会碰到什么执行命令改身份文件读文件写文件联网
命中总数23 处
命中统计严重 0 · 高 3 · 中 16 · 低 4
逐条看命中(3 条严重或高危)
  • scripts/session-viewer.test.ts:2exec-spawn
    import { execFile } from "node:child_process";
  • scripts/session-viewer.test.ts:201identity-write
    "MEMORY.md:89-97|note=[checked prior transcript-import context]",
  • scripts/session-viewer.ts:1exec-spawn
    import { spawn } from "node:child_process";

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Session Viewer

Use when asked to view, export, inspect, or share a Codex, Claude Code, OpenClaw, or Pi session transcript in a browser.

Commands

When the session path is not known and the agent-transcript skill is available, use it first to find the likely JSONL session:

.agents/skills/agent-transcript/scripts/agent-transcript find \
  --query "$USER_GOAL_OR_TITLE $BRANCH_OR_URL" \
  --cwd "$PWD" \
  --since-days 14

Pick the highest-confidence file result, then render it with session-viewer.

From a repo that has this skill:

node skills/session-viewer/scripts/session-viewer.ts <session.jsonl> --out /tmp/session.html --open

Useful modes:

node skills/session-viewer/scripts/session-viewer.ts <session.jsonl> --out session.html
node skills/session-viewer/scripts/session-viewer.ts <session.jsonl> --raw --out session.html
node skills/session-viewer/scripts/session-viewer.ts --blank --out viewer.html --open

In a downstream repo that syncs shared skills under .agents/skills, replace

skills/session-viewer with .agents/skills/session-viewer.

Defaults:

  • detects codex, claude, or pi-openclaw
  • embeds normalized session data into one HTML file
  • keeps tool input/output text in the DOM so browser search can find it
  • reads the complete session file, preserving full history in both export modes
  • --raw embeds the original JSONL and lets the browser parse it
  • --blank creates a reusable file-picker viewer

For an explicitly partial export, use --max-read-bytes N with a positive integer byte limit (for example, --max-read-bytes 8388608 for 8 MiB). Oversized files retain the head and tail, with a visible omission warning in the CLI and exported viewer. Truncated boundary records may be omitted; --raw embeds only the retained JSONL. Files at or below the limit remain complete. Short reads are retried; an unexpected end of file fails the export instead of reporting a complete read.

This opt-in read limit applies only to CLI file exports. The browser's file picker continues to load complete files.

Where Sessions Live

Codex:

find "${CODEX_HOME:-$HOME/.codex}/sessions" -name 'rollout-*.jsonl' -type f | sort
ls -t "${CODEX_HOME:-$HOME/.codex}"/sessions/*/*/*/rollout-*.jsonl | head

OpenClaw/Pi:

AGENT_ID="<agentId>"
SESSION_DIR="${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/agents/$AGENT_ID/sessions"
ls -t "$SESSION_DIR"/*.jsonl | head
find "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/agents" -path '*/sessions/*.jsonl' -type f | sort

Use sessions.json in the same directory to map session keys to session ids.

Claude Code:

find "$HOME/.claude/projects" -name '*.jsonl' -type f | sort
ls -t "$HOME/.claude/projects"/**/*.jsonl | head

Some Claude installs also keep exported JSON/JSONL under project-specific cache folders; prefer the newest JSONL with the target repo path in its parent folder.

Development

Scripts are native Node TypeScript. Keep them erasable:

  • ok: types, interfaces, unions, satisfies
  • avoid: enums, namespaces, decorators, parameter properties
  • no tsconfig path aliases; use relative imports

Importer ownership:

  • scripts/importers/codex.ts: Codex rollout JSONL
  • scripts/importers/claude.ts: Claude Code JSONL
  • scripts/importers/pi-openclaw.ts: Pi/OpenClaw session JSONL

Validate:

npm ci --ignore-scripts
npm run typecheck
node --test skills/session-viewer/scripts/session-viewer.test.ts
scripts/validate-skills

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。

它属于哪个仓库

星标★ 1,087
本站分层T1
该仓技能数8
原文件路径skills/session-viewer/SKILL.md

同一个仓库里的其他技能

看这个仓库的全部 8 个技能