rea-analysis-optimization
MOmorluto/rea485k近 7 天新增 7,690 个 star
Finds, reads, and reconstructs coding-agent sessions across Codex, Claude, OpenCode, OMO/Senpi, agy (Antigravity), omo-harness threads (agy, Claude Agent SDK, Codex app-server, omp, omo children) and 20 other local agent logs, through a typed TypeScript SDK. Use when asked to find or search past sessions, transcripts, or subagent runs, or to recover what an earlier session did.
Find local coding-agent sessions across agent products before answering from memory. The skill is a typed SDK on Bun (scripts/sdk.ts); the same operations run as a command line (scripts/cli.ts) and as an MCP server (bun scripts/cli.ts mcp).
sessions.list, sessions.search and sessions.get scan the stores of the sources they select, so source is what makes them cheap: one source reads one product's store, no source reads every store on the machine. since, until, cwd, model and limit filter what the scan found; they do not shrink the scan. Read a transcript as a slice with transcript.read({ path: row.path }), which opens that one file and nothing else; sessions.get returns every event.
From a js eval cell or a bun script (skillDir is the folder holding this SKILL.md):
const { connect } = await import(`${skillDir}/scripts/sdk.ts`)
const cas = connect()
// 1. Recent work in one product: the cheapest useful call.
const recent = await cas.sessions.list({ source: ["senpi"], since: "7d", limit: 10 })
// 2. Which session did X: two or three query lanes, one or two sources, a time window.
const found = await cas.sessions.search({ source: ["claude", "codex"], query: ["dashboard PR", "대시보드"], since: "30d", limit: 5 })
// 3. Open the hit as a slice of its own file: the newest 8 KiB of whole events, with byte offsets. No scan.
if (found.kind === "ok" && found.results[0]) {
const hit = found.results[0]
const tail = await cas.transcript.read({ path: hit.path, maxBytes: 8192 })
const head = await cas.transcript.read({ path: hit.path, from: "head", maxBytes: 4096 }) // the first prompt and setup
}
The same calls from a shell:
bun scripts/cli.ts sessions list --source senpi --since 7d --limit 10
bun scripts/cli.ts sessions search --source claude --source codex --query "dashboard PR" --since 30d --limit 5
bun scripts/cli.ts transcript read --path <row path> --max-bytes 8192
Every SDK call answers { kind: "ok", ... } or { kind: "error", error: { code, message, next_action } } and never throws for a refusal. Act on next_action. The CLI prints the same JSON and exits non-zero on an error.
| Call | Reads | Use it for |
|---|---|---|
sources.list() | nothing | source ids and aliases |
sessions.list / sessions.search with source | the newest 2,000 transcripts of each selected source, parsed whole | finding sessions |
the same without source | every store on the machine | only when you do not know the product |
transcript.read({ path }) | that one file, at most maxBytes (default 32 KiB, max 1 MiB) from its head or tail | reading what happened |
transcript.read({ session }) | the scan of the selected sources to find the id, then the slice | when you only have an id |
sessions.get | the scan, plus every event of the matched transcripts | the delegation tree, or a full raw event list when a slice is not enough |
Start with one or two sources and widen only when the first batch is empty. Prefer transcript.read slices (tail for how it ended, head for the original ask) over sessions.get events for long sessions.
fix, review, deploy. Pass them together as query: [...]; each result's match_reasons says which lane and which field matched (field: "user_message" means a prompt between the first and last one).source, since/until (YYYY, YYYY-MM, YYYY-MM-DD, today, yesterday, Nd), cwd and model (case-insensitive substrings). Add includeSubagents: true when the work may have been delegated: child sessions are hidden by default, and each main row carries subagent_count.transcript.read returns whole events with their byte offsets. sessions.get({ session: [id] }) returns the full first and last prompt, every event and the subagents array, so opening a main session shows its whole delegation tree.path is the source of truth. Never answer "what happened" from a preview alone.For broad, multi-month questions, split independent searches by keyword, repo/cwd, source and time window, run them in parallel (or in subagent lanes), and merge candidates by platform + id.
| Field | Meaning |
|---|---|
platform | Source id: codex, claude, senpi, oh-my-pi, gajae-code, opencode, agy, omo-harness, openclaw, droid, amp, gemini, kimi, qwen, codebuff, roo-code, kilo-code, cline, kodu, cursor-cli, aider, kilo-cli, hermes, goose, crush, zed, kiro, aside |
id, path | Session id (or a stable file-derived id) and the raw transcript or index file |
cwd, created_at, updated_at, provider, model | When recoverable |
first_user_message, last_user_message | Prompt previews (300 characters; for subagents: task description + delegated prompt) |
usage | Token and cost clues the store keeps |
parent_id, agent, subagent_count | Delegation: the parent session, the subagent label, how many children this session spawned |
links | omo-harness rows only: the native session the thread drove ({ platform, id, path }) |
detail_hint | A ready sessions get command for this row |
match_reasons | Search only: { query, platform, field, snippet } per hit |
| Source | Read |
|---|---|
| Codex (CLI, app-server and exec children) | references/codex.md |
| Claude Code (CLI and Agent SDK children) | references/claude.md |
OMO / Senpi / pi, oh-my-pi (omp), gajae-code (gjc) | references/senpi.md |
| OpenCode / oh-my-openagent | references/opencode.md |
| agy (Antigravity CLI) | references/agy.md |
| omo-harness threads (any harness the omo-harness skill started) | references/omo-harness.md |
| Everything else, or "any session" | references/all-platforms.md |
Aliases: cursor → cursor-cli, factory → droid, roo/roocode → roo-code, kilocode → kilo-code, kilo → kilo-cli, omp/ohmypi → oh-my-pi, gjc/gajae → gajae-code, antigravity → agy, harness → omo-harness, aside-browser → aside. Pass one source per value; a comma-joined value is refused.
| Problem | Fix |
|---|---|
unknown_source | Call cas.sources.list() for the ids and aliases. |
| A store lives somewhere else | Pass its folder in root (CODEX_HOME, OPENCODE_HOME and OMO_HARNESS_STATE are read too). |
| A harness child's own transcript | The omo-harness row's links names it; sessions.get on that id with that source. |
| Search finds nothing in a long session | Prompts are searched, assistant text is not: read a slice with transcript.read and grep the raw path. |
| Dates miss sessions | Times compare as UTC instants; a row without a parseable created_at is never dropped by a date filter. |
MOmorluto/rea485k近 7 天新增 7,690 个 star
MAmattpocock/skills336k近 7 天新增 4,217 个 star
MAmattpocock/skills336k近 7 天新增 4,217 个 star
MAmattpocock/skills336k近 7 天新增 4,217 个 star
MAmattpocock/skills336k近 7 天新增 4,217 个 star