Export a Codex session JSONL from ~/.codex/sessions into a clean Markdown transcript in ~/Documents/Exports. Use when the user wants to export, save, or conv...
数据分析
Clean Codex Archives
试用Safely inspect and remove locally archived Codex conversation data on Windows, macOS, and Linux, including archived rollout JSONL files, archived session row...
它能做什么
Safely inspect and remove locally archived Codex conversation data on Windows, macOS, and Linux, including archived rollout JSONL files, archived session row...
技能文档
Clean Codex Archives
Use the bundled scripts/clean_codex_archives.py script as the cross-platform entry point. It uses only Python's standard library and preserves active sessions.
Safety contract
- Resolve the Codex data root from an explicit
--codex-homeargument, then theCODEX_HOMEenvironment variable, then the current user's.codexdirectory. - Treat
state_5.sqliteas the source of truth. Only rows withthreads.archived = 1are eligible for deletion. - Preserve all unarchived threads, their logs, and their session-index entries.
- Run without
--applyfirst. Use--applyonly after the user explicitly authorizes deletion. - Delete associated logs and goals before deleting archived thread rows, because the archived IDs are needed to select related records safely.
- Delete related
thread_dynamic_toolsandthread_spawn_edgesrows when those tables are present. - Remove only
archived_sessions/*.jsonlfiles. Do not delete the archive directory itself or unrelated files. - Rewrite
session_index.jsonlonly after database cleanup, retaining entries whose IDs still exist instate_5.sqliteand rejecting malformed JSON instead of silently dropping it. - If a database is locked, ask the user to close Codex or otherwise stop the process holding the database, then retry.
Workflow
- Run a dry run and inspect the counts for archive files, archived threads, related logs, goals, and stale index entries.
- If the user confirms deletion, rerun with
--apply. - Use
--vacuumonly when the user also wants SQLite files compacted; it may require exclusive database access and is not needed for logical deletion. - Verify that archived-thread count is zero, archive-file count is zero, remaining index IDs all exist in the state database, and SQLite
quick_checkreportsokfor modified databases.
Commands
# Inventory only; no changes. Use python3 on Unix-like systems.
python3 ./scripts/clean_codex_archives.py
# Apply the explicitly authorized cleanup.
python3 ./scripts/clean_codex_archives.py --apply
# Use a specific Codex data root.
python3 ./scripts/clean_codex_archives.py --codex-home "$HOME/.codex" --apply
# Optional physical compaction after deletion.
python3 ./scripts/clean_codex_archives.py --apply --vacuum
On Windows, use python instead of python3.
相关技能
Export a Codex CLI or Codex Desktop (App) session to Markdown, HTML, or Obsidian notes. Use when the user asks to export, save, share, or review a past chat, session, or transcript. Supports --brief, --redact, --since/--until, --grep, --append (incremental), --interactive (message picker), --sessions (merge), --watch (auto-incremental), and --list. Works with both Codex CLI and Codex Desktop app sessions.
Use when a Codex thread or local session is slow because prior turns contain heavy image, screenshot, or base64 payloads. Helps locate the session JSONL, bac...
Use this skill when the user wants to inspect, search, export, verify, clean up, delete, restore, or purge local Codex sessions stored under a Codex root suc...
安全诊断、备份并修复项目存在但历史聊天仍然不显示的问题
Autonomous Codex run-to-completion workflow for low quota/cota situations. Use when the user asks for an uninterrupted agent run, says "nao me peca confirmac...