Dailin521/codex-provider-sync

Synchronize Codex session provider metadata across rollout files and SQLite state.

What it solves

When switching AI providers in Codex, old chat sessions often remain linked to the previous provider, making them unavailable or inconsistent. This tool aligns the provider information in both the session files and the SQLite chat index to match the current configuration, allowing users to restore access to their chat history after a provider change.

How it works

The tool reads the current provider from config.toml and updates the provider metadata in session files and the SQLite database. It uses two primary update strategies:

  • In-place replacement: If the provider name's byte length is identical, it overwrites the bytes directly to maintain file identity and size.
  • Streaming replacement: If lengths differ, it updates the first line (metadata) and streams the remaining content to a temporary file before atomically replacing the original.

It provides multiple interfaces for this process, including a Windows desktop app (Electron), a local Web UI, and a CLI.

Who it’s for

Users of Codex who frequently switch between different AI providers or accounts and want to maintain access to their historical chat sessions.

Highlights

  • Multi-interface support: Available as a desktop application, Web UI, and a command-line interface.

  • Automatic Backups: Automatically creates backups before modifying data, with support for restoration and cleanup.

  • Coded for Efficiency: Uses optimized I/O strategies to avoid scanning full chat bodies when updating metadata.

  • Session Management: Includes tools to browse sessions by project, diagnose issues, and perform targeted repairs.

Related

  • Project
  • Project