ce-session-inventory

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Session inventory

会话清单

Agent-facing primitive. Discover session files and emit session metadata as JSONL across Claude Code, Codex, and Cursor.
This skill exists so that agents researching session history do not need to know the layout of session stores on disk or the JSONL shapes of each platform. The scripts under
scripts/
own that knowledge.
面向Agent的基础工具。跨Claude Code、Codex和Cursor发现会话文件,并以JSONL格式输出会话元数据。
本技能的存在是为了让研究会话历史的Agent无需了解磁盘上会话存储的布局或各平台的JSONL格式。
scripts/
目录下的脚本负责处理这些细节。

Arguments

参数

Space-separated positional args:
  1. <repo>
    — repo folder name (e.g.,
    my-project
    ). Used for directory matching in Claude Code and Cursor, and as the CWD filter for Codex sessions.
  2. <days>
    — scan window in days (e.g.,
    7
    ). Session files older than this are skipped.
  3. <platform>
    (optional) — one of
    claude
    ,
    codex
    ,
    cursor
    . Omit to search all three.
空格分隔的位置参数:
  1. <repo>
    — 仓库文件夹名称(例如:
    my-project
    )。用于在Claude Code和Cursor中匹配目录,并作为Codex会话的CWD筛选条件。
  2. <days>
    — 扫描窗口的天数(例如:
    7
    )。早于此时间的会话文件将被跳过。
  3. <platform>
    (可选) — 可选值为
    claude
    codex
    cursor
    。省略则搜索全部三个平台。

Execution

执行

Run the discovery-plus-metadata pipeline from the skill's own
scripts/
directory:
bash
bash scripts/discover-sessions.sh <repo> <days> [--platform <platform>] \
  | tr '\n' '\0' \
  | xargs -0 python3 scripts/extract-metadata.py --cwd-filter <repo>
Return the raw stdout verbatim — one JSON object per session, then a final
_meta
line. Callers parse the JSONL directly, so do not paraphrase, reformat, or summarize.
If discovery finds no files, the pipeline still emits a clean
_meta
line (
files_processed: 0
). Return that as-is.
从技能自身的
scripts/
目录运行“发现+元数据”流水线:
bash
bash scripts/discover-sessions.sh <repo> <days> [--platform <platform>] \
  | tr '\n' '\0' \
  | xargs -0 python3 scripts/extract-metadata.py --cwd-filter <repo>
原样返回原始标准输出——每个会话对应一个JSON对象,最后是一行
_meta
。调用方直接解析JSONL,因此请勿改写、重新格式化或总结内容。
如果未发现任何文件,流水线仍会输出一行格式规范的
_meta
files_processed: 0
)。请原样返回该内容。

Output format

输出格式

Each session line is a JSON object. Common fields across platforms:
  • platform
    claude
    ,
    codex
    , or
    cursor
  • file
    — absolute path to the session JSONL
  • size
    — file size in bytes
  • ts
    — session start timestamp (ISO 8601)
  • session
    — session identifier
Platform-specific fields:
  • Claude Code adds
    branch
    (git branch) and
    last_ts
    (last message timestamp).
  • Codex adds
    cwd
    (working directory),
    source
    ,
    cli_version
    ,
    model
    ,
    last_ts
    .
  • Cursor has no in-file timestamps or metadata —
    ts
    is derived from file mtime and
    session
    from the containing directory name.
The final
_meta
line has
files_processed
,
parse_errors
, and optionally
filtered_by_cwd
(count of Codex sessions dropped by the CWD filter).
每个会话行都是一个JSON对象。各平台通用字段:
  • platform
    claude
    codex
    cursor
  • file
    — 会话JSONL文件的绝对路径
  • size
    — 文件大小(字节)
  • ts
    — 会话开始时间戳(ISO 8601格式)
  • session
    — 会话标识符
平台特定字段:
  • Claude Code 添加
    branch
    (Git分支)和
    last_ts
    (最后一条消息的时间戳)。
  • Codex 添加
    cwd
    (工作目录)、
    source
    cli_version
    model
    last_ts
  • Cursor 无文件内时间戳或元数据——
    ts
    由文件修改时间推导而来,
    session
    由所在目录名称生成。
最后一行
_meta
包含
files_processed
parse_errors
,以及可选的
filtered_by_cwd
(被CWD筛选条件过滤掉的Codex会话数量)。

Error handling

错误处理

If the discovery script errors (e.g., unreadable home directory, permission failure), let the error surface to the caller. Do not substitute git log, file listings, or other sources — this skill's contract is session metadata, nothing else.
If
_meta
reports
parse_errors > 0
, return the JSONL as-is. The caller decides how to handle partial data.
如果发现脚本出错(例如:无法读取主目录、权限不足),请将错误直接返回给调用方。请勿用Git日志、文件列表或其他来源替代——本技能的约定是仅返回会话元数据,不提供其他内容。
如果
_meta
显示
parse_errors > 0
,请原样返回JSONL。由调用方决定如何处理部分数据。