agentsclimarketplace

Export session transcript

Skill tkstang/skills/skills/export-session-transcript

Use when the user asks to export, save, or download the current coding-agent conversation as a Markdown file (e.g. "export this session transcript", "save the conversation as markdown"). Locates the live transcript via an announced session marker, drops tool calls and hidden injected payloads, and writes a sanitized branch-named Markdown file (default ~/Downloads).From its SKILL.md

Install
npx -y skills add tkstang/skills --skill export-session-transcript

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

9.1 KB, as published. Nobody here has run it

export-session-transcript

Exports the current conversation (yours — Claude Code, Codex, or Cursor) to a sanitized Markdown transcript, named after the current git branch, written by default to ~/Downloads. Tool calls, tool results, system/developer instructions, environment/AGENTS.md/skill payloads, subagent notifications, automatic-control wake envelopes (which carry lease ids and pinned peer-session identity), and the session marker line are all excluded — only visible user/assistant messages survive. Automatic-control entries are dropped on their structural tag rather than by matching their payload text, so a change to that payload's shape cannot reopen the leak.

One exception: ask-user exchanges. Each runtime puts questions to the operator through a tool call (AskUserQuestion on Claude Code, request_user_input on Codex, AskQuestion on Cursor). Those are visible conversation — the question you were asked and any answer the runtime recorded — so they are exported rather than filtered with ordinary tool traffic. What "recorded" covers differs: Claude Code records the answer; Codex records it but cannot distinguish an operator choice from an autoResolutionMs timeout; Cursor records only the question, and the export says the selected option is unrecorded.


When to Use

Trigger phraseWhat to run
export this session transcriptthe marker workflow below
save the conversation as markdown / save this chatthe marker workflow below
download our conversation / export-session-transcriptthe marker workflow below
export all my sessions in this projectadd --all
export session <id>add --session <id>

When NOT to Use

  • When the user wants a peer runtime's session, not your own — that is session-observer, which is read-only and tracks offsets.
  • When the user wants findings saved to memory/vault (use stoa-capture).

Workflow (default: export the current session)

The hard problem is identifying which transcript is this live conversation. Solve it with a unique session marker that you write into the transcript and then grep for.

Step 1: Generate and announce a marker

Generate a unique random-hex marker and announce it to the user in your reply so it is recorded in the transcript. For example:

EXPORT_SESSION_MARKER=a3f9c1e0d2b4

Use a fresh random value each time (e.g. 12 hex chars). Announcing it is what makes it land in the transcript store on the next flush.

Step 2: Invoke the CLI with your runtime and the marker

node <skill-dir>/scripts/export-session-transcript.mjs \
  --runtime <self> --match a3f9c1e0d2b4

where <self> is the runtime you are running as (claude-code, codex, or cursor), and <skill-dir> is skills/export-session-transcript in this repo or the installed path on the user's machine. If you cannot determine your own runtime, omit --runtime (it defaults to auto, using an env hint then best-effort auto-detect).

The CLI greps the cwd's candidate transcripts for the marker and exports the exact one. If the marker has not been flushed to disk yet, it falls back to the newest-for-cwd transcript and prints a warning — re-run with --session <id> if the fallback picked the wrong session.

Step 3: Report the output path

The CLI prints the written path. By default it is ~/Downloads/<branch>.md (with / in the branch name replaced by -). Tell the user where the file was written.


Modes and flags

FlagDefaultDescription
--runtime <r>autoclaude-code|codex|cursor|auto. auto uses an env hint (SESSION_OBSERVER_SELF-style) then best-effort auto-detect.
--match <marker>—Grep cwd candidates for this marker (selects the current session).
--session <id>—Export a specific session id (bypasses --match).
--allfalseExport every session for the cwd — one file each.
--cwd <path>process.cwd()Project dir to match transcripts against.
--out <path>—Output file or directory (also accepted positionally).
--help—Usage.

Selection-mode precedence: the selection modes are mutually exclusive, with precedence --all > --session > --match > default (current session). The highest-precedence flag present wins and the lower ones are ignored — e.g. --match is ignored when --all is set, and --session is ignored when --all is set. With no selection flag, the CLI exports the current session (single candidate auto-selected; multiple candidates exit 3 as ambiguous).

Output path resolution

InputOutput
default~/Downloads/<branch>.md (/ → -)
--out DIR / positional dir<DIR>/<branch>.md
--out FILE (file path)<FILE> verbatim
not a git repo / detached HEAD<cwd-basename>-<UTCstamp>.md
--all (+ optional DIR)<branch>-<sessionId>.md per session

Per-provider transcript store locations

RuntimeStore root
Claude Code~/.claude/projects/<encoded-cwd>/<session-id>.jsonl
Codex~/.codex/sessions/<YYYY>/<MM>/<DD>/session-<id>.jsonl
Cursor~/.cursor/projects/<encoded-project>/agent-transcripts/<session-id>/<session-id>.jsonl

See references/transcript-formats.md for record shapes and cwd-encoding details.


Exit code handling

Exit codeMeaningWhat to do
0SuccessReport the written path.
1Hard errorSurface the error message; nothing was written.
2No candidatesNo transcript found for this cwd/runtime. Suggest --cwd <path> or confirm the runtime ran in this project.
3AmbiguousMultiple candidates and no --match/--session. Re-run with a --match <marker> or --session <id> from the listed candidates.

Success Criteria

  • SKILL.md exists, frontmatter valid, version 1.0.0.
  • The agent announces a random-hex marker before invoking the CLI.
  • Output contains only visible user/assistant messages — no tool calls/results, system/developer text, environment/AGENTS.md/skill payloads, subagent notifications, or the marker line.
  • Default output is ~/Downloads/<branch>.md; --out and --all honored.
  • Exit codes 0 / 1 / 2 / 3 produced as documented.
  • No third-party dependencies; no network calls; no writes to transcripts.

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.