{"slug": "preserving-context-when-moving-from-chatgpt-to-codex-cli", "title": "Preserving Context When Moving from ChatGPT to Codex CLI", "summary": "A developer built chatgpt2codex, a CLI tool that imports shared ChatGPT conversations into local Codex CLI sessions. The tool preserves context from ChatGPT discussions, allowing developers to resume work in Codex CLI without manually copying content. It writes session files and indexes threads in Codex's local SQLite database for seamless integration.", "body_md": "A lot of useful technical work starts as a conversation.\n\nMaybe you are exploring an architecture decision in ChatGPT. Maybe you are debugging an idea before touching the codebase. Maybe you are asking broad questions first, then moving into a local development workflow once the direction is clear.\n\nThat handoff is often awkward.\n\nThe context starts in ChatGPT, but the implementation happens somewhere else: a terminal, an editor, a local agent, or a repo-specific workflow.\n\nFor me, that \"somewhere else\" is often Codex CLI.\n\nSo I built a small bridge:\n\n```\nnpx chatgpt2codex https://chatgpt.com/share/<id>\n```\n\n`chatgpt2codex`\n\nimports a shared ChatGPT conversation into a local Codex CLI session attached to your current project directory.\n\nGitHub: [https://github.com/vv-bogdanov/chatgpt2codex](https://github.com/vv-bogdanov/chatgpt2codex)\n\nnpm: [https://www.npmjs.com/package/chatgpt2codex](https://www.npmjs.com/package/chatgpt2codex)\n\nChatGPT share links are useful for handing context to another person, but they are not directly useful to local tooling.\n\nIf I have a long conversation that contains design notes, constraints, tradeoffs, and implementation ideas, I do not want to manually copy pieces of it into a new Codex thread.\n\nI want the local coding agent to resume from the conversation as if it had been part of the local workflow from the beginning.\n\nThat is what this tool tries to do.\n\nGiven a public ChatGPT share URL, `chatgpt2codex`\n\n:\n\nBy default, it attaches the imported session to the current directory:\n\n```\nnpx chatgpt2codex https://chatgpt.com/share/<id>\n```\n\nYou can target another project directory with:\n\n```\nnpx chatgpt2codex https://chatgpt.com/share/<id> -C /path/to/project\n```\n\nAnd you can preview the import without writing anything:\n\n```\nnpx chatgpt2codex https://chatgpt.com/share/<id> --dry-run\n```\n\nThe tool is intentionally conservative.\n\nIf a Codex session already exists for the target project directory, it exits with an error instead of overwriting anything:\n\n```\nA Codex session already exists for /path/to/project.\nUse --force to replace it.\n```\n\nIf you do want to replace the existing imported session, use:\n\n```\nnpx chatgpt2codex https://chatgpt.com/share/<id> --force\n```\n\nThere are also options for overriding the imported title and Codex home directory:\n\n```\nnpx chatgpt2codex https://chatgpt.com/share/<id> \\\n  --name \"Architecture discussion\" \\\n  --codex-home ~/.codex\n```\n\nThe first version wrote a Codex session file, but that was not always enough for Codex to pick it up in the resume flow.\n\nModern Codex builds use both rollout JSONL files and local SQLite metadata. So the current release writes the session file and also indexes the thread in Codex's local `state_5.sqlite`\n\ndatabase when that database exists.\n\nIt also uses Codex-visible session metadata, so the imported conversation appears as a normal CLI-originated thread rather than being filtered out.\n\nThat was the main lesson: for local agent tools, \"write the file\" is often only half the integration. The rest is making sure the surrounding state agrees with it.\n\nChatGPT share pages and Codex local session files are not official public import APIs.\n\nBecause of that, I kept the implementation small and pragmatic, with tests around the parts most likely to break:\n\n`--force`\n\nThe tool requires Node.js 22.13.0 or newer because Codex's local SQLite index is important for the current workflow.\n\nThis is not a big framework or a new platform.\n\nIt is just a small CLI tool that closes a specific gap:\n\n``` php\nChatGPT conversation -> shared URL -> local Codex session\n```\n\nThat is enough to make the handoff from exploration to implementation feel much smoother.\n\nIf you use Codex CLI and sometimes start your thinking in ChatGPT, I would love to hear whether this fits your workflow.", "url": "https://wpnews.pro/news/preserving-context-when-moving-from-chatgpt-to-codex-cli", "canonical_source": "https://dev.to/vvbogdanov/preserving-context-when-moving-from-chatgpt-to-codex-cli-bpl", "published_at": "2026-06-30 07:48:26+00:00", "updated_at": "2026-06-30 07:48:40.995658+00:00", "lang": "en", "topics": ["developer-tools", "large-language-models", "ai-tools"], "entities": ["ChatGPT", "Codex CLI", "chatgpt2codex", "Node.js", "GitHub", "npm"], "alternates": {"html": "https://wpnews.pro/news/preserving-context-when-moving-from-chatgpt-to-codex-cli", "markdown": "https://wpnews.pro/news/preserving-context-when-moving-from-chatgpt-to-codex-cli.md", "text": "https://wpnews.pro/news/preserving-context-when-moving-from-chatgpt-to-codex-cli.txt", "jsonld": "https://wpnews.pro/news/preserving-context-when-moving-from-chatgpt-to-codex-cli.jsonld"}}