recover-codex-project-chats
Skill4 starsChanged 5 months agoMITView on GitHub
Diagnose and safely repair Codex Desktop projects that exist but show “No chats/没有聊天”, while conversations may still appear under Recent. Use when users report missing project histories, lost thread-to-project mappings, model-provider changes, archived or invisible threads, moved cwd paths, incomplete ~/.codex restores, state_5.sqlite integrity or index problems, or need comparison against codex_threads_snapshot.csv or a ~/.codex backup.
In this repository16 other files it gives its agents.
- agent-avatar-managerSkill
- agent-team-meshSkill
- claw-memory-managerSkill
- codex-thread-repairSkill
- collective-memorySkill
- copy-my-profileSkill
- hello-envSkill
- init-hooksSkill
- multica-squad-load-balancerSkill
- multica-squad-onboardSkill
- openviking-projectsSkill
- rename-sessionSkill
- session-recoverySkill
- subagent-timeout-configSkill
- token-slimSkill
- workspace-git-setupSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Run scripts/codex_project_recovery.sh diagnose [csv-path] while Codex may remain open.
- Very specific: line 24
Read references/incident-patterns.md and classify the evidence before changing data.
- Distinctive: line 26
Before any mutation, require Codex Desktop to be fully stopped.
- Very specific: line 27
Run SQLite PRAGMA integrity_check on copies first.
- Very specific: line 33
Run scripts/codex_project_recovery.sh verify while Codex is stopped, then restart Codex and check each project in the UI.
- Very specific: line 38
Treat state_5.sqlite plus WAL/SHM, rollout JSONL, .codex-global-state.json, and project metadata as one recovery set.
- Distinctive: line 39
Do not edit a live SQLite database.
- Very specific: line 40
Do not replace all of ~/.codex when a targeted repair is sufficient.
- Distinctive: line 42
Do not change provider metadata merely to make rows visible unless the configured provider is compatible with the original sessions.
- Distinctive: line 43
Keep every pre-repair backup until the user verifies the UI and can open representative chats.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Recover Codex project chats
- Version: 1.0.1
- License: MIT
- Author: Evan Song · github.com/Songhonglei
- Repository: https://github.com/Songhonglei/better-agent-skills/tree/main/skills/recover-codex-project-chats
Restore project visibility without overwriting the only copy of a conversation.
Workflow
- Run
scripts/codex_project_recovery.sh diagnose [csv-path]while Codex may remain open. Save the output. - Read
references/incident-patterns.mdand classify the evidence before changing data. - Back up current
~/.codex, the supplied backup, and Codex-related Application Support directories. Exclude only live Unix sockets. - Before any mutation, require Codex Desktop to be fully stopped. Confirm the app-server, renderer, and service processes are absent.
- Run SQLite
PRAGMA integrity_checkon copies first. Inspect.schema; never invent columns. - Apply only the matching repair:
- Provider mismatch: run
scripts/codex_project_recovery.sh repair-provider <old-provider> <current-provider>after explaining the evidence. Repair only when both names refer to the same compatible backend. - Missing assignments: rebuild
thread-project-assignmentsin.codex-global-state.jsonfrom actual thread IDs and cwd values. Preserve existing assignments. Resolve overlapping roots and temporary directories explicitly; do not rely solely on prefix matching. - Moved paths: create and review an old-cwd to current-project mapping before updating assignments or cwd metadata.
- Missing database rows: merge only from a schema-compatible backup after integrity checks and a trial on copies.
- Provider mismatch: run
- Run
scripts/codex_project_recovery.sh verifywhile Codex is stopped, then restart Codex and check each project in the UI. - Report root cause, backup paths, CSV rows, database rows, rollout files found, per-project visible counts, changed rows/files, and unrecovered thread IDs.
Safety rules
- Treat
state_5.sqliteplus WAL/SHM, rollout JSONL,.codex-global-state.json, and project metadata as one recovery set. - Do not edit a live SQLite database.
- Do not replace all of
~/.codexwhen a targeted repair is sufficient. - Preserve archived state unless the user explicitly requests unarchiving.
- Do not change provider metadata merely to make rows visible unless the configured provider is compatible with the original sessions. Prefer restoring the provider configuration when compatibility is uncertain.
- Keep every pre-repair backup until the user verifies the UI and can open representative chats.
Resources
scripts/codex_project_recovery.sh: read-only diagnosis, guarded provider repair, and verification.references/incident-patterns.md: known failure patterns, schema landmarks, and evidence tests.
Dependencies
- macOS with Codex Desktop or ChatGPT Desktop using the Codex runtime
- Zsh, SQLite 3, jq, ripgrep, rsync, and Perl
- Optional CSV snapshot or
~/.codexbackup for comparison
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

