Create Prompt Log Artifact
Create a local HTML prompt log from Codex's JSONL task record. Include only direct user messages; exclude assistant replies, tool calls and outputs, reasoning, system/developer instructions, injected environment context, and connector metadata.
Operating contract
- Problem: Codex task records mix direct user prompts with assistant content, tool traffic, and app-composed context that should not appear in a prompt-only artifact.
- Use when: the user asks to view, export, collect, review, or share only their prompts from one resolvable Codex task or session file.
- Do not use when: the user wants a full transcript, the task cannot be resolved, or the result would need publication or upload without separate authorization.
- Produce: a private local HTML file that preserves extracted prompt text verbatim and reports the prompt count.
Generate the artifact
Run:
python3 "$CODEX_HOME/skills/create-prompt-log-artifact/scripts/create_prompt_log.py"
If CODEX_HOME is unset, use:
python3 "$HOME/.codex/skills/create-prompt-log-artifact/scripts/create_prompt_log.py"
The script reads CODEX_THREAD_ID, locates the matching task JSONL under the Codex session directories, and writes:
<current-working-directory>/outputs/prompt-log-<task-id-prefix>.html
To target another task or output path:
python3 scripts/create_prompt_log.py --thread-id <task-id> --output <path.html>
Use --session-file <path.jsonl> when the user provides an explicit log file.
Safety and source-of-truth rules
- Extract only records where
.type == "event_msg" and .payload.type == "user_message".
- Do not fall back to
response_item records with role == "user"; those may contain app-injected instructions and environment context.
- Treat
.payload.message as a post-composition field, not guaranteed raw textbox input. The app may prepend browser comments or <in-app-browser-context source="ambient-ui-state"> and append page-evidence notices inside the same user_message.
- Remove only the known app-generated browser wrappers. Preserve
Comment: values from # Browser comments: blocks and the text following ## My request for Codex:; exclude browser metadata, ambient context, and page-evidence notices.
- Do not generically strip XML-like tags or Markdown headings because the user may have entered them directly.
- Preserve prompt text verbatim. Do not summarize, rewrite, redact, or silently omit non-empty user messages.
- Treat the artifact as private by default. Do not deploy, upload, publish, message, or open it unless the user explicitly asks.
- Warn that secrets entered in prompts remain visible in the artifact.
- If no task ID or explicit session file is available, stop and ask for the task ID or JSONL path.
Report completion
Link the generated HTML file and report the prompt count. Mention that the file is local and contains raw user-entered text.
1---2name: create-prompt-log-artifact3description: Create a concise, self-contained HTML artifact containing only the prompts the user directly entered in one Codex task. Use when the user asks to view, export, collect, review, or share their prompts from the current or a specified Codex task/session, especially requests for a prompt log, prompt history, or user-input-only artifact.4---56# Create Prompt Log Artifact78Create a local HTML prompt log from Codex's JSONL task record. Include only direct user messages; exclude assistant replies, tool calls and outputs, reasoning, system/developer instructions, injected environment context, and connector metadata.910## Operating contract1112- **Problem:** Codex task records mix direct user prompts with assistant content, tool traffic, and app-composed context that should not appear in a prompt-only artifact.13- **Use when:** the user asks to view, export, collect, review, or share only their prompts from one resolvable Codex task or session file.14- **Do not use when:** the user wants a full transcript, the task cannot be resolved, or the result would need publication or upload without separate authorization.15- **Produce:** a private local HTML file that preserves extracted prompt text verbatim and reports the prompt count.1617## Generate the artifact1819Run:2021```bash22python3 "$CODEX_HOME/skills/create-prompt-log-artifact/scripts/create_prompt_log.py"23```2425If `CODEX_HOME` is unset, use:2627```bash28python3 "$HOME/.codex/skills/create-prompt-log-artifact/scripts/create_prompt_log.py"29```3031The script reads `CODEX_THREAD_ID`, locates the matching task JSONL under the Codex session directories, and writes:3233```text34<current-working-directory>/outputs/prompt-log-<task-id-prefix>.html35```3637To target another task or output path:3839```bash40python3 scripts/create_prompt_log.py --thread-id <task-id> --output <path.html>41```4243Use `--session-file <path.jsonl>` when the user provides an explicit log file.4445## Safety and source-of-truth rules4647- Extract only records where `.type == "event_msg"` and `.payload.type == "user_message"`.48- Do not fall back to `response_item` records with `role == "user"`; those may contain app-injected instructions and environment context.49- Treat `.payload.message` as a post-composition field, not guaranteed raw textbox input. The app may prepend browser comments or `<in-app-browser-context source="ambient-ui-state">` and append page-evidence notices inside the same `user_message`.50- Remove only the known app-generated browser wrappers. Preserve `Comment:` values from `# Browser comments:` blocks and the text following `## My request for Codex:`; exclude browser metadata, ambient context, and page-evidence notices.51- Do not generically strip XML-like tags or Markdown headings because the user may have entered them directly.52- Preserve prompt text verbatim. Do not summarize, rewrite, redact, or silently omit non-empty user messages.53- Treat the artifact as private by default. Do not deploy, upload, publish, message, or open it unless the user explicitly asks.54- Warn that secrets entered in prompts remain visible in the artifact.55- If no task ID or explicit session file is available, stop and ask for the task ID or JSONL path.5657## Report completion5859Link the generated HTML file and report the prompt count. Mention that the file is local and contains raw user-entered text.