skills/cli-agents/codex-cli-invoke-persist/SKILL.md
Create and resume Codex CLI sessions with a persistent session-name-to-thread_id mapping plus last-used model stored in a workspace-scoped JSON file under system temp. Invoke only when the user explicitly names `$codex-cli-invoke-persist` or otherwise clearly requests this exact skill. Use it for deterministic, session-persistent Codex automation across turns and processes.
npx skillsauth add igamenovoer/magic-context codex-cli-invoke-persistInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Invoke this skill explicitly by name ($codex-cli-invoke-persist) because it may execute the codex CLI.
Do not invoke it implicitly from a generic request for Codex help.
Users may provide Codex wrappers with any name. They are often named codex-<something>, but they do not need to be.
.sh, .bat, .cmd, or a normal binary on PATH, pass it via --codex-cmd "<wrapper command...>" or CODEX_CMD.--codex-cmd, add --codex-shell posix|powershell, and usually pass profile/setup code via --codex-shell-init. Optionally override the launcher with --codex-shell-cmd.codex exec / codex exec resume flags used here, especially --json, -o/--output-last-message, --model, and the resume selector.resume-stream) so stdout emits a steady JSONL heartbeat from codex exec resume --json.--deadline-seconds to the helper.resume-json uses Codex JSONL internally, but the helper emits one final JSON object on stdout instead of forwarding the heartbeat stream.The skill itself is triggered by name, but once invoked, pick a stage based on user intent:
Creation (create-session)
session name (the user may call it a "session alias").md: --role-definition-md /abs/path/to/role.md
Codex CLI has no --append-system-prompt, so the helper prepends the file contents to the initial user prompt.--model ... (stored as last_model for later resumes)--codex-cmd "..." / CODEX_CMD--codex-shell posix|powershell, usually with --codex-shell-init "..." / CODEX_SHELL_INIT, and optionally with --codex-shell-cmd "..." / CODEX_SHELL_CMD--deadline-seconds ... only when the user explicitly requested a time limit--config, --enable, --disable, --image, --full-auto, --dangerously-bypass-approvals-and-sandbox, --skip-git-repo-check.md (if provided).bad.<pid> and .tmp.<pid>)Invocation (resolve, resume-json, resume-stream)
prompt plus thread_id/session_id or session namesession name via the workspace mapping JSON unless a direct thread_id is providedcodex exec resume <thread_id> --json--model from stored last_model when not explicitly providedlast_model after a successful call--role-definition-md by prepending the file contents to the resumed prompt for that call--deadline-seconds only when the user explicitly requested a time limitListing (list-sessions)
workspace dir or explicit mapping fileDeletion (delete-session, delete-all-sessions)
thread_id/session_id or session name, or explicit "all sessions"workspace dir or explicit mapping filecodexManagement file (session mapping JSON): <system-tmp>/agent-sessions/<workspace-basename>-<md5(abs-workspace-dir)>/codex-cli-alias-mapping.json (override with --mapping-file).
references/creation.md.references/invocation.md.references/listing.md.references/deletion.md.session name.thread_id or session_id, always use it as the resume target.thread_id or session name in this conversation. If none exists, ask which session to use.last_model per session name.--model, use the stored last_model for that session name when present.--model, use it for this call and persist it as the new default for next time.codex exec resume supports fewer flags than codex exec, so this helper intentionally persists only last_model, not broader exec-only options.--append-system-prompt, so role definitions are prepended to the prompt text rather than attached as a separate system-prompt layer.resume-json is helper-generated JSON, not raw Codex CLI JSON, because the CLI itself exposes JSONL event streams via --json.--codex-shell, the helper will treat it like a direct executable and it will likely fail.references/creation.mdreferences/invocation.mdreferences/listing.mdreferences/deletion.mdscripts/invoke_persist.py (create-session, resolve, list-sessions, delete-session, delete-all-sessions, resume-json, resume-stream)data-ai
Create readable Mermaid diagrams inside Markdown files. Use for flowcharts and sequence diagrams that must render cleanly in common Markdown renderers (e.g., GitHub) without horizontal scrolling. Covers fenced mermaid blocks, init/theme styling, label wrapping with <br/>, and sequenceDiagram layout rules (short IDs, wrapped labels, don’t break identifiers).
development
Manual invocation only; use only when the user explicitly requests `make-program-tutorial` by exact name, OR when the user asks to use a skill to create an SDK/API/library tutorial. Create a clear, reproducible, step-by-step tutorial for a specific API/SDK/library (or a set of functions/classes), with runnable examples, expected outputs, and basic troubleshooting.
testing
Use when the user wants to create a self-hosted, offline-installable Conda channel (mirror) containing a specific subset of packages using Pixi.
tools
Guides the agent to setup a new or existing Pixi environment for compiling C++ and CUDA code. It ensures the correct compilers, toolkits, and CMake configurations are in place for a robust user-space build.