Export Current Thread
Export the observable work from the current Codex thread to a persistent UTF-8
.txt file. Keep the default file readable: preserve the conversation and mark
confirmed file reads where they occurred, without copying other tool activity
or tool results into it.
This skill is intentionally explicit-only because even a recovery transcript can
contain private text, local paths, and project information.
Procedure
- Run the bundled script:
python "$env:USERPROFILE\.codex\skills\export-current-thread\scripts\export_current_thread.py" --json
- If
python is unavailable but py exists, run:
py "$env:USERPROFILE\.codex\skills\export-current-thread\scripts\export_current_thread.py" --json
Read the script result. It includes ok, export_kind, output_path,
thread_id, rollout_path, event counts, byte and character counts, and a
deterministic token estimate. Do not read the generated file unless the
user's request also requires analyzing it.
Tell the user that the recovery transcript is ready, link the file, and mention
the optional full journal only after successful creation:
Готово: стенограмма текущей ветки сохранена здесь:
[filename.txt](C:\absolute\path\filename.txt)
В ней сохранён разговор, а чтение файлов отмечено в соответствующих местах.
Если понадобится полный журнал команд и результатов инструментов, могу отдельно
сделать технический экспорт.
Do not ask the user to choose a variant before creating the recovery transcript.
Do not create a second file automatically.
Recovery Transcript
The default export must:
- preserve user, assistant, and subagent messages in chronological order;
- preserve context-compaction markers;
- replace confirmed file-content reads with one short
FILE READ or FILES READ marker at their chronological position between messages;
- collapse repeated chunk reads of the same path within one interval between
messages, but show the path again if it is read in a later interval;
- omit every other tool call and every tool result, including commands, Call
IDs, hashes, statuses, line ranges, and source-record metadata;
- keep the verified thread ID and source rollout path so a later full technical
export can be created while that rollout still exists.
A file-read marker means that a supported operation accessed that file's
content and returned without a detected failure. It does not certify that every
line was read. Do not infer file reads from a path mention, directory listing,
write, patch, hash, or other non-content operation.
Full Technical Export
Create a full technical export only after the user explicitly asks for the
full journal of commands and tool results:
python "$env:USERPROFILE\.codex\skills\export-current-thread\scripts\export_current_thread.py" --full --json
The full export preserves supported invocation and textual result bodies. It
is an explicit follow-up artifact, not an automatic fallback for a long or
complex thread.
--extract-call <CALL_ID> remains available for a Call ID already known from a
full technical export or another verified source. Check pair_complete and
missing_parts, then delete temporary fragments with --cleanup.
Shared Behavior
- Use
CODEX_THREAD_ID as the current-thread source.
- Read only
$CODEX_HOME/sessions or %USERPROFILE%\.codex\sessions, plus archived_sessions only when a requested thread is archived.
- Never edit, rewrite, normalize, or move original
rollout-*.jsonl files.
- Save the
.txt in the first active workspace root from the thread context.
- If no active workspace root is available, save the
.txt on the user's Desktop.
- Use supported
response_item records as the canonical source for messages,
confirmed file reads, and full technical activity. Use only explicitly
allowed non-duplicating event_msg metadata.
- Exclude system/developer messages, known Codex-injected user-content blocks,
hidden reasoning, token telemetry, unknown internal record types, and
explicitly typed binary content through deterministic code rules.
- Do not use a model to summarize, clean, reformat, select relevant fragments, redact heuristically, or deduplicate by textual similarity.
- Remove only structurally proven duplicate messages. In the recovery
transcript, additionally collapse repeated paths only inside one uninterrupted
file-reading interval between messages.
- Preserve large textual tool results only in the explicit full export or a
requested single-call extraction. Replace known binary content with
available type, size, MIME, path, URL, or identifier metadata.
- Write UTF-8 without BOM.
Failure Handling
- If the current thread id is unavailable, do not guess. Tell the user that Codex did not expose
CODEX_THREAD_ID and ask them to rerun from an active Codex thread or provide a thread id.
- If the rollout file cannot be found or verified, explain that the current thread log could not be matched.
- If the export succeeds, do not paste the transcript into chat; only link the generated file.
1---2name: export-current-thread3description: Use this skill only when the user explicitly invokes $export-current-thread or directly asks to export or save the current Codex thread, conversation, chat, or session as a local txt file. Create a readable recovery transcript by default and offer a separate full command-and-result export only after the transcript is ready. Do not invoke implicitly for ordinary logging, summaries, handoffs, or unrelated file exports.4---56# Export Current Thread78Export the observable work from the current Codex thread to a persistent UTF-89`.txt` file. Keep the default file readable: preserve the conversation and mark10confirmed file reads where they occurred, without copying other tool activity11or tool results into it.1213This skill is intentionally explicit-only because even a recovery transcript can14contain private text, local paths, and project information.1516## Procedure17181. Run the bundled script:1920```powershell21python "$env:USERPROFILE\.codex\skills\export-current-thread\scripts\export_current_thread.py" --json22```23242. If `python` is unavailable but `py` exists, run:2526```powershell27py "$env:USERPROFILE\.codex\skills\export-current-thread\scripts\export_current_thread.py" --json28```29303. Read the script result. It includes `ok`, `export_kind`, `output_path`,31 `thread_id`, `rollout_path`, event counts, byte and character counts, and a32 deterministic token estimate. Do not read the generated file unless the33 user's request also requires analyzing it.34354. Tell the user that the recovery transcript is ready, link the file, and mention36 the optional full journal only after successful creation:3738```markdown39Готово: стенограмма текущей ветки сохранена здесь:40[filename.txt](C:\absolute\path\filename.txt)4142В ней сохранён разговор, а чтение файлов отмечено в соответствующих местах.43Если понадобится полный журнал команд и результатов инструментов, могу отдельно44сделать технический экспорт.45```4647Do not ask the user to choose a variant before creating the recovery transcript.48Do not create a second file automatically.4950## Recovery Transcript5152The default export must:5354- preserve user, assistant, and subagent messages in chronological order;55- preserve context-compaction markers;56- replace confirmed file-content reads with one short `FILE READ` or `FILES57 READ` marker at their chronological position between messages;58- collapse repeated chunk reads of the same path within one interval between59 messages, but show the path again if it is read in a later interval;60- omit every other tool call and every tool result, including commands, Call61 IDs, hashes, statuses, line ranges, and source-record metadata;62- keep the verified thread ID and source rollout path so a later full technical63 export can be created while that rollout still exists.6465A file-read marker means that a supported operation accessed that file's66content and returned without a detected failure. It does not certify that every67line was read. Do not infer file reads from a path mention, directory listing,68write, patch, hash, or other non-content operation.6970## Full Technical Export7172Create a full technical export only after the user explicitly asks for the73full journal of commands and tool results:7475```powershell76python "$env:USERPROFILE\.codex\skills\export-current-thread\scripts\export_current_thread.py" --full --json77```7879The full export preserves supported invocation and textual result bodies. It80is an explicit follow-up artifact, not an automatic fallback for a long or81complex thread.8283`--extract-call <CALL_ID>` remains available for a Call ID already known from a84full technical export or another verified source. Check `pair_complete` and85`missing_parts`, then delete temporary fragments with `--cleanup`.8687## Shared Behavior8889- Use `CODEX_THREAD_ID` as the current-thread source.90- Read only `$CODEX_HOME/sessions` or `%USERPROFILE%\.codex\sessions`, plus `archived_sessions` only when a requested thread is archived.91- Never edit, rewrite, normalize, or move original `rollout-*.jsonl` files.92- Save the `.txt` in the first active workspace root from the thread context.93- If no active workspace root is available, save the `.txt` on the user's Desktop.94- Use supported `response_item` records as the canonical source for messages,95 confirmed file reads, and full technical activity. Use only explicitly96 allowed non-duplicating `event_msg` metadata.97- Exclude system/developer messages, known Codex-injected user-content blocks,98 hidden reasoning, token telemetry, unknown internal record types, and99 explicitly typed binary content through deterministic code rules.100- Do not use a model to summarize, clean, reformat, select relevant fragments, redact heuristically, or deduplicate by textual similarity.101- Remove only structurally proven duplicate messages. In the recovery102 transcript, additionally collapse repeated paths only inside one uninterrupted103 file-reading interval between messages.104- Preserve large textual tool results only in the explicit full export or a105 requested single-call extraction. Replace known binary content with106 available type, size, MIME, path, URL, or identifier metadata.107- Write UTF-8 without BOM.108109## Failure Handling110111- If the current thread id is unavailable, do not guess. Tell the user that Codex did not expose `CODEX_THREAD_ID` and ask them to rerun from an active Codex thread or provide a thread id.112- If the rollout file cannot be found or verified, explain that the current thread log could not be matched.113- If the export succeeds, do not paste the transcript into chat; only link the generated file.