Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ alias codex_deep='env EDITOR="zed" command codex --dangerously-bypass-approvals-
| [`fetch-url`](skills/fetch-url/SKILL.md) | 渲染 URL 并输出多格式内容或原始 HTML(Playwright + trafilatura) |
| [`ticktick-cli`](skills/ticktick-cli/SKILL.md) | 通过 CLI 调用滴答清单 Open API 管理任务与项目(API 文档:[Dida365 Open API](https://developer.dida365.com/docs/index.html#/openapi)) |
| [`create-skill`](skills/create-skill/SKILL.md) | 编写/新增本仓库 skills 的规范与最小模板(SKILL.md / scripts / references / assets / token 控制) |
| [`coderabbit-cli`](skills/coderabbit-cli/SKILL.md) | 指导如何使用 CodeRabbit CLI 进行代码审查 |
| [`codex-session-reader`](skills/codex-session-reader/SKILL.md) | 通过 `codex app-server` 读取指定的 Codex session/thread(只读,灵感来自 xurl) |
24 changes: 24 additions & 0 deletions skills/codex-session-reader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# codex-session-reader

一个仅面向 Codex 的只读 session/thread 阅读 skill。

## 作用

这个 skill 用来读取单个 Codex thread。

实现上只支持 Codex,并通过 `codex app-server` 的官方 JSON-RPC 接口交互,不解析 `~/.codex` 下的 rollout JSONL 或 sqlite。当前范围也刻意收窄为只读,不提供 thread 写入、续写、fork 或归档能力;读取区间则通过 `--turns` 的 0-based 切片表达式控制。

## 来历

这个 skill 的问题定义与使用体验明显受到 [Xuanwo/xurl](https://github.com/Xuanwo/xurl) 启发,尤其是“把 agent/thread 读取包装成一个可直接给 Codex 使用的能力”这一点。

但当前实现没有复用 xurl 的 Rust 多 provider 架构,也没有沿用它的本地 session 解析逻辑;这里改为只支持 Codex,并通过 Codex 官方 `app-server` 的 `thread/list`、`thread/read` 等接口读取数据,以尽量降低对底层持久化格式的耦合。

`xurl` 使用 Apache 2.0 许可:
- [Xuanwo/xurl](https://github.com/Xuanwo/xurl)
- [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)

## 文件

- [SKILL.md](SKILL.md):给 agent 的使用说明与命令约定
- [codex_session_reader.py](scripts/codex_session_reader.py):实际 CLI 实现
42 changes: 42 additions & 0 deletions skills/codex-session-reader/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: codex-session-reader
description: 读取 Codex 的单个 session/thread;当已知 thread id 且需要查看或摘要会话内容时使用。
---

只读查看单个 Codex session/thread 的 skill,底层通过 `codex app-server` 官方接口读取。

默认输出全部 turns;如只想看局部,可用 `--turns` 传 0-based、接近 Python 的切片表达式。

## Quick start

```bash
cd skills/codex-session-reader
./scripts/codex_session_reader.py read <thread-id>
```

## 何时使用

- 用户要求查看某个 Codex thread/session。
- 用户给出 thread id,希望读取完整上下文。
- 需要把某个 Codex 会话内容转成可继续摘要或分析的 Markdown。

## 常用命令

```bash
./scripts/codex_session_reader.py read <thread-id> # 读取完整 thread
./scripts/codex_session_reader.py read <thread-id> --preview-only # 只看 preview 和元信息
./scripts/codex_session_reader.py read <thread-id> --turns :5 # 前 5 个 turns
./scripts/codex_session_reader.py read <thread-id> --turns -5: # 后 5 个 turns
./scripts/codex_session_reader.py read <thread-id> --turns 10:-1 # 从第 10 个到倒数第 1 个之前
./scripts/codex_session_reader.py read <thread-id> --turns 13 # 只看第 13 个 turn
./scripts/codex_session_reader.py read <thread-id> --turns 13:15 # 读取第 13 到第 14 个 turns
./scripts/codex_session_reader.py read <thread-id> --format json # 输出 JSON
```

## 输出约定

- 默认输出 `markdown`,适合继续交给 Codex 阅读或摘要。
- 默认输出全部 turns。
- `--format json` 输出 app-server 返回的结构化结果,便于脚本处理。
- 若发生区间裁剪,JSON 会额外包含 `truncated` 字段说明实际输出的是哪一段。
- `--turns` 不支持 step;`1:10:2` 这类表达式会报错。
Loading