# AgentReplay — instructions for AI agents # Purpose: upload a local Codex / Claude Code session JSONL to this site and # hand the user a human-readable replay link. # 中文说明混排在下方,指令以英文为准。 You are probably an AI coding agent whose user said something like "把我们这次对话上传到 https://sessionviewer.cc 给我一个查看链接". Follow the 4 steps below exactly. All commands are for macOS / Linux shells. -------------------------------------------------------------------- ## Step 1 — Locate the session JSONL file Codex CLI stores sessions at: ~/.codex/sessions/YYYY/MM/DD/rollout--.jsonl Newest session (if you ARE the current conversation, this is likely you): ls -t ~/.codex/sessions/*/*/*/*.jsonl | head -1 Find an older conversation by content keyword: grep -rl "SOME_KEYWORD" ~/.codex/sessions/ --include='*.jsonl' | head -5 Claude Code stores sessions at: ~/.claude/projects//.jsonl where is the project's working directory path with '/' and other separators replaced by '-'. Newest session across all projects: ls -t ~/.claude/projects/*/*.jsonl | head -5 Newest for one project: cd into it conceptually — slug for /Users/me/dev/myapp is -Users-me-dev-myapp: ls -t ~/.claude/projects/-Users-me-dev-myapp/*.jsonl | head -1 If several files look plausible, ASK THE USER which conversation they mean (show them each file's date + first user message). -------------------------------------------------------------------- ## Step 2 — (Recommended) slim the file This strips telemetry, encrypted reasoning blobs and inline base64 images. It usually cuts size 50–90% and removes nothing the viewer renders. Safe no-op for Claude Code files — run it on both formats. python3 - "$FILE" /tmp/session-slim.jsonl <<'PYEOF' import json, sys src, dst = sys.argv[1], sys.argv[2] with open(src) as f, open(dst, "w") as out: for line in f: line = line.strip() if not line: continue try: o = json.loads(line) except Exception: continue t = o.get("type"); p = o.get("payload") or {} if t == "event_msg" and p.get("type") == "token_count": continue if t == "response_item" and p.get("type") == "reasoning": p.pop("encrypted_content", None) if t == "event_msg" and p.get("type") == "image_generation_end": p.pop("result", None) out.write(json.dumps(o, ensure_ascii=False) + "\n") PYEOF -------------------------------------------------------------------- ## Step 3 — Upload (gzip it, POST the bytes) gzip -c /tmp/session-slim.jsonl | \ curl -sS -X POST 'https://sessionviewer.cc/api/upload' \ -H 'content-type: application/gzip' --data-binary @- Limits: gzipped body <= 4 MB (~20–40 MB of raw JSONL). On HTTP 413, make sure you ran Step 2; if it is still too large, tell the user the session is too big to share and stop. Success response (JSON): { "ok": true, "id": "", "url": "https://sessionviewer.cc/s/", <- the viewing link "deleteCmd": "curl -X DELETE ...", <- run this to delete the record "rawBytes": 123456 } -------------------------------------------------------------------- ## Step 4 — Report back to the user 1. Give the user the "url" — that is the viewing link (查看链接). 2. Also give them "deleteCmd" and say: 链接是随机地址、不会被列出,但拿到 链接的任何人都能看;想删除时在终端跑这条命令即可。 3. IMPORTANT / 安全提醒: if the session may contain secrets (API keys, tokens, passwords in command output), warn the user BEFORE uploading and let them decide. That's all. Do not crawl other pages of this site; everything you need is in this file.