npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

codex-provider-sync

v0.4.1

Published

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

Readme

codex-provider-sync

Keep Codex history visible after switching Providers

CI Release License

中文 · 日本語 · 한국어 · Web UI guide

What it is

codex-provider-sync is a local metadata-consistency tool for Codex. After changing the root model_provider, older sessions may still be on disk while rollout files, the SQLite thread index, or project metadata still points to the previous Provider. Codex can then hide those sessions from its list, project view, or /resume.

The primary interface is a browser-based Web UI running on localhost. It reuses the same Node.js core service as the CLI and does not reimplement synchronization in the browser.

The tool does not sign you in, manage auth.json, switch accounts, or modify message bodies.

Quick start: Web UI

Requires Node.js 16 or newer.

From the repository:

npm install
npm run web:build
npm run web:start

Or install the CLI globally:

npm install -g git+https://github.com/Dailin521/codex-provider-sync.git
codex-provider web

The default address is:

http://127.0.0.1:8791

Options:

codex-provider web --no-open   # do not open a browser automatically
codex-provider web --port 8792 # use another localhost port

The server binds only to 127.0.0.1. Each process gets a random API session token, validates the request Origin, and serializes write operations (sync, switch, restore, and prune).

Web UI features

Overview

  • Current root Provider and model.
  • Rollout distribution under sessions and archived_sessions.
  • SQLite threads distribution.
  • Rollout/SQLite alignment status.
  • Project visibility diagnostics: CWD matches, ranks, and the first-page 50-session limit.
  • Warnings for locked rollouts, encrypted_content, SQLite repairs, malformed databases, and WSL UNC safety boundaries.

Chat history

The Chat History page reads rollout JSONL files read-only and never changes local data.

  • Browse sessions and open user/agent messages.
  • Search titles, project paths, Providers, and message text.
  • Filter by Provider, project, and active/archived state.
  • Server-side pagination, 50 sessions per page by default.
  • Session details show the most recent 200 readable messages.
  • Safe, restricted Markdown rendering with code-block support.
  • Raw JSONL, tokens, tool-call arguments, and encrypted_content are not returned to the browser.

Sync and switch

  • Sync metadata only: use the current root Provider without changing config.toml.
  • Switch Provider and sync: update the root model_provider, then synchronize history.
  • Model policy: follow the Provider section, keep the current root model, or set a custom model.
  • An explicit confirmation dialog reminds you to close Codex CLI, Codex App, and app-server first.

Backups and restore

  • Create a metadata v2 backup before every sync or switch.
  • Keep the newest five managed backups by default.
  • Restore config.toml, SQLite, and rollout metadata independently.
  • Show source and target when SQLite Homes differ.
  • Require an extra confirmation for SQLite Home relocation and prevent unsafe config/database combinations.

CLI for automation and WSL

The CLI and Web UI call the same src/service.js core logic.

codex-provider status
codex-provider sync
codex-provider sync --keep 5
codex-provider sync --provider openai
codex-provider switch apigather
codex-provider switch apigather --model "MiniMax-M3"
codex-provider switch apigather --keep-root-model
codex-provider prune-backups --keep 5
codex-provider restore C:\Users\you\.codex\backups_state\provider-sync\20260319T042708906Z
codex-provider watch
codex-provider watch --once

All main commands accept --codex-home <PATH> and --sqlite-home <PATH>. For a Windows Codex Home with app-server and SQLite in WSL, run the CLI inside WSL:

codex-provider status --codex-home /mnt/c/Users/you/.codex --sqlite-home /home/you/.codex/sqlite
codex-provider sync --codex-home /mnt/c/Users/you/.codex --sqlite-home /home/you/.codex/sqlite

The v0.4 Windows release also includes an experimental one-shot automation package for scripts and AI agents. Its write operations are dry-run by default and require an explicit plan, digest, and --apply before changing data. See the automation quickstart and the protocol design.

Storage and SQLite resolution

SQLite Home precedence is:

  1. CLI or GUI override.
  2. Root-level sqlite_home in config.toml.
  3. CODEX_SQLITE_HOME.
  4. <Codex Home>/sqlite.

Only the default layout may check the legacy <Codex Home>/state_5.sqlite. An explicit, configured, or environment-provided SQLite Home never falls back to another database.

Safety and limitations

Before each sync or switch, a backup is created under:

~/.codex/backups_state/provider-sync/<timestamp>
  • Messages, titles, authentication, auth.json, and updated_at are not modified.
  • The tool repairs metadata only within the selected Codex Home; it does not copy sessions between devices.
  • If SQLite is locked, close Codex CLI, Codex App, and app-server and retry.
  • Locked live rollout files are skipped and can be synchronized after the active session ends.
  • Sessions containing encrypted_content may become visible but still fail to continue or compact across Providers/accounts.
  • Windows processes cannot safely operate on SQLite through \\wsl.localhost\... or \\wsl$\...; use the corresponding Linux path inside WSL.

Desktop GUI status

The Desktop GUI is deprecated and is no longer the recommended or primary interface. Existing Windows/macOS builds remain available for compatibility, but new features—especially Chat History—are implemented in the Web UI first.

Legacy GUI references:

Documentation

Development and tests

git clone https://github.com/Dailin521/codex-provider-sync.git
cd codex-provider-sync
npm install
npm run web:build
npm test
git diff --check

License

MIT