Skip to content
FunCoding

coding-agent-sessions

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.

Star
71,230
Last commit
Dec 1, 2026

packages/shared-skills/skills/coding-agent-sessions/SKILL.md

View on GitHub

Coding Agent Sessions

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).

Start narrow

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.

What each call costs

CallReadsUse it for
sources.list()nothingsource ids and aliases
sessions.list / sessions.search with sourcethe newest 2,000 transcripts of each selected source, parsed wholefinding sessions
the same without sourceevery store on the machineonly 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 tailreading what happened
transcript.read({ session })the scan of the selected sources to find the id, then the slicewhen you only have an id
sessions.getthe scan, plus every event of the matched transcriptsthe 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.

Find, then read

  1. Expand fuzzy recall into lanes. When the user remembers a task vaguely ("that OpenCode bug", "the dashboard PR"), derive 3-6 short queries: product or tool names, repo and package names, exact error text, issue/PR/session ids, English and Korean phrasing, and verbs such as 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).
  2. Narrow before widening. Add 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.
  3. Read the hit. 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.
  4. Verify against the raw file. Results are normalized; the row's 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.

Rows

FieldMeaning
platformSource 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, pathSession id (or a stable file-derived id) and the raw transcript or index file
cwd, created_at, updated_at, provider, modelWhen recoverable
first_user_message, last_user_messagePrompt previews (300 characters; for subagents: task description + delegated prompt)
usageToken and cost clues the store keeps
parent_id, agent, subagent_countDelegation: the parent session, the subagent label, how many children this session spawned
linksomo-harness rows only: the native session the thread drove ({ platform, id, path })
detail_hintA ready sessions get command for this row
match_reasonsSearch only: { query, platform, field, snippet } per hit

Sources

SourceRead
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-openagentreferences/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.

Troubleshooting

ProblemFix
unknown_sourceCall cas.sources.list() for the ids and aliases.
A store lives somewhere elsePass its folder in root (CODEX_HOME, OPENCODE_HOME and OMO_HARNESS_STATE are read too).
A harness child's own transcriptThe omo-harness row's links names it; sessions.get on that id with that source.
Search finds nothing in a long sessionPrompts are searched, assistant text is not: read a slice with transcript.read and grep the raw path.
Dates miss sessionsTimes compare as UTC instants; a row without a parseable created_at is never dropped by a date filter.

Similar Skills

rea-analysis-optimization

MOmorluto/rea485k7,690 new stars in the last 7 days

codebase-design

MAmattpocock/skills336k4,217 new stars in the last 7 days

Featured

diagnosing-bugs

Diagnose hard bugs and performance regressions by building a feedback loop with tests or scripts.

MAmattpocock/skills336k4,217 new stars in the last 7 days

setup-ts-deep-modules

MAmattpocock/skills336k4,217 new stars in the last 7 days

code-review

MAmattpocock/skills336k4,217 new stars in the last 7 days

implement

MAmattpocock/skills336k4,217 new stars in the last 7 days