Auto-archive Codex CLI sessions to Fresh Jots Fresh Jots published a one-prompt setup that wires an OpenAI Codex CLI SessionEnd hook, configured in ~/.codex/hooks.json, to auto-archive every Codex session to a Fresh Jots account as an append-only note in an ai_sessions folder, hashed on arrival and folded into a daily Bitcoin anchor. The setup requires a Codex CLI build with the hooks system, which shipped in Codex CLI v0.114, plus a Fresh Jots account and an mn_ API token; the free tier includes a 14-day Dev trial token. Each archived session note is trusted-timestamped via RFC 3161 and uploaded append-only, so the transcript cannot be edited or overwritten after it lands. · 21 min read One prompt: paste this into Codex CLI and your sessions auto-archive to Fresh Jots When you bill a client for AI-assisted work, "trust me, I did this" is a weak position in a dispute. The strong position is a timestamped, tamper-evident record of every session — captured automatically, so you never have to remember to save it. This is the OpenAI Codex CLI version of our Claude Code auto-archive https://freshjots.com/blog/one-prompt-archive-claude-code-sessions-to-fresh-jots setup. You paste one prompt into Codex, answer a couple of questions, and from then on every Codex session is written to a local backup and pushed to your Fresh Jots account as a new note in an ai sessions folder — hashed on arrival, independently trusted-timestamped, and folded into that day's Bitcoin anchor. And the record isn't just tamper-evident — it's tamper-proof: each session note is uploaded append-only, so from the moment it lands, its contents can't be edited or overwritten, only appended to. The RFC 3161 timestamp proves when the transcript existed; append-only means there's nothing to quietly rewrite after. Months later you can hand over the proof and the other side checks it themselves — no account, and no need to trust you or us. 1. What you need 1. What you need - - - Codex CLI installed and working. The prompt wires a hook into Codex's own SessionEnd event, so a recent build with the hooks system is required hooks shipped in Codex CLI v0.114 . - A Fresh Jots account. Free to start, no card. The ai sessions folder is created for you. - An API token mn … . Sign up and pick the "Plain notes" onboarding mode for a 14-day Dev trial token, or create one under Settings → API tokens. The prompt walks you through getting and wiring it. 2. Why Codex specifically? 2. Why Codex specifically? This automation uses Codex's own SessionEnd hook configured in ~/.codex/hooks.json and reads the session transcript Codex hands the hook, so the prompt on this page is Codex-only. Fresh Jots itself isn't — on any other assistant you get the same "every session saved as a note" result over MCP https://freshjots.com/blog/fresh-jots-over-mcp nothing to install or with a couple of REST API calls. This page is just the hands-off, Codex-native version. On Claude Code? Use the Claude Code prompt https://freshjots.com/blog/one-prompt-archive-claude-code-sessions-to-fresh-jots instead. 3. About your token 3. About your token The prompt is careful with your mn … token: it checks whether one is already exported without ever printing the value, verifies it with a single API call, and — only if needed — appends export FRESHJOTS TOKEN="…" to your shell profile after showing you the diff. It never writes the token into the current project and never echoes it back into the chat. From there on, the hook reads it from the environment. 4. The prompt 4. The prompt Paste the block below into a Codex CLI session and let it drive. It's idempotent — run it again later and each step detects existing state and no-ops. Byte-perfect copy. When rendered blog text is copied, a straight quote can turn into a curly one, or a line break can be lost — either of which breaks the JSON and bash inside this prompt. If your paste misbehaves, grab the canonical source instead: download the prompt as a .txt file https://freshjots.com/downloads/codex-auto-archive-prompt — same content, no rendering pipeline in between. Two spots in the prompt are marked text VERIFY — Codex's hooks-config shape and its transcript format vary a little by version. Because you're pasting this into Codex, it can read your real ~/.codex config and session files and adjust itself; the script also falls back to archiving the raw transcript if its structured render doesn't fit, so nothing is ever dropped. I want you to set up Fresh Jots auto-archiving for my OpenAI Codex CLI sessions, end to end. Walk me through it conversationally; ask me only what you genuinely can't figure out yourself. Be safe: show diffs before writing any file in my home directory, and never write my API token to any file in the current project or echo it back to me after I paste it. You are Codex CLI, so you can inspect your own configuration and session files directly — use that. Two things in this prompt depend on your exact version and I've marked them "VERIFY": your hooks config schema and your transcript file format. Confirm both against your real ~/.codex before you finalise, and adjust the script if they differ. Everything else the Fresh Jots API calls is fixed and correct as written. End state we're aiming for: - One hook SessionEnd wired in ~/.codex/hooks.json, invoking ~/.codex/hooks/freshjots-codex-sessions.sh. - That script full content in step 3 below reads each session's transcript Codex hands the hook a transcript path on stdin , stashes it locally at ~/.codex/freshjots-stash/codex-cli-YYYY-MM-DD-session-HH-MM-SS.txt, trusted-timestamps the exact bytes with an RFC 3161 authority best-effort, via openssl , then POSTs it to Fresh Jots as a new note inside an "ai sessions" folder a transcript over ~2.8 MB is split into ordered "part i of n" notes so it always posts in full, never dropped on a size limit . Each note starts with a two-line header Codex CLI session: