Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Bug report
description: Report a reproducible Sync2 failure using synthetic or redacted data.
description: Report a reproducible Codex Sync failure using synthetic or redacted data.
title: "[Bug]: "
labels: [bug]
body:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Security vulnerability
url: https://github.com/ToussaintKnight/codex-sync2/security/advisories/new
url: https://github.com/ToussaintKnight/codex-sync/security/advisories/new
about: Report vulnerabilities or possible private-data exposure confidentially.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Feature request
description: Propose a scoped improvement to Sync2.
description: Propose a scoped improvement to Codex Sync.
title: "[Feature]: "
labels: [enhancement]
body:
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ dist/
tmp/
*.log

# Local Sync2 and Codex state — never commit
.sync2/
# Local Codex Sync and Codex state — never commit
.codex-sync/
.codex/
Sync2Vault/
CodexSyncVault/
vault/
conversations/
heads/
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All notable changes are documented here.

## Unreleased

- Complete the breaking identity migration to **Codex Sync**: `$codex-sync` for the Skill, `codexsync` for the CLI, `.codex-sync/` for state, and matching scheduler/service identifiers. Mixed-version fleet writes are unsupported during this upgrade.
- Rewrite the README motivation around the real cross-device continuity gap between local Codex projects and trusted computers.
- Fix project synchronization so selecting a project also selects its non-archived Codex tasks instead of producing a project with `No tasks` on the target device.
- Add project discovery, per-device portable project catalogs, target-side folder acceptance, Codex desktop registration, and explicit path-mapping commands.
- Make Windows/macOS project path mapping separator-aware and path-boundary-aware.
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

## 未发布

- 完成到 **Codex Sync** 的破坏性标识迁移:Skill 使用 `$codex-sync`,CLI 使用 `codexsync`,状态目录使用 `.codex-sync/`,调度器与服务标识同步更新。升级期间不支持新旧版本设备同时写入。
- 围绕本地 Codex 项目在可信设备之间的真实连续工作缺口,重写 README 项目动机。
- 修复项目同步:选择项目时会一并选择其非归档 Codex 任务,避免目标设备只出现项目却显示 `No tasks`。
- 新增项目发现、每设备可移植项目目录、目标端文件夹接收、Codex 桌面注册与显式路径映射命令。
- Windows/macOS 项目路径映射现在可识别不同分隔符,并严格检查路径边界。
Expand Down
54 changes: 33 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,72 @@

**English** | [简体中文](README.zh-CN.md)

Codex task history lives on one machine. **Codex Sync2 gives multi-device Codex users a recoverable synchronization layer for selected tasks and personal skills—without copying credentials, live databases, or unfinished turns.**
**Continue the same local Codex project on your trusted computers—without copying credentials, live databases, or unfinished turns.**

Built for developers who move between Windows and macOS and need the same trusted Codex context on every device.
Codex Sync is a local-first continuity layer for developers who move between Windows and macOS and want their selected projects, task histories, and personal skills to travel safely with them.

> The product and Codex Skill are **Codex Sync** / `$codex-sync`. The shell CLI is `codexsync`—not `sync`—to avoid colliding with operating-system utilities. Local protocol state lives under `.codex-sync/`.

```text
$ sync2 conversation select current
$ codexsync conversation select current
Selected: Example task

$ sync2 sync
$ codexsync sync
conversationsPushed: 1 conversationConflicts: 0

$ sync2 doctor
$ codexsync doctor
ok: true
```

## Why Sync2 exists
## Why Codex Sync exists

Local Codex work is rooted in the computer where it runs: a task records its transcript and working directory, while a local project connects to folders on that machine. That is a useful safety boundary, but signing into the same account on another trusted computer does not by itself recreate the same local workspace and task history.

Imagine a normal day. You start a project on an office workstation in the morning. In the afternoon, you open a MacBook beside a river or at the beach and want to continue. After dinner, while the family settles into a long TV episode, you open a Windows laptop on the couch—and expect the morning's Codex project, tasks, and context to be there. Your Git repository may already have the code, but the local Codex continuity can still be stranded on another device.

Copying `~/.codex` is unsafe: it mixes credentials, device identity, live SQLite state, caches, and partially written turns. Generic file synchronization does not understand which Codex events form a complete conversation.
**That continuity gap—not generic backup—is why Codex Sync exists.**

Sync2 adds that missing semantic layer:
Blindly copying `~/.codex` is not the answer: it mixes credentials, device identity, live SQLite state, caches, and partially written turns. Generic file synchronization also cannot tell which Codex events form a complete, recoverable conversation.

Codex Sync adds that missing semantic layer:

- select only the tasks worth carrying between devices;
- publish only complete JSONL and stable, closed turns;
- keep independent device heads and promote a canonical history only when they are byte-prefix compatible;
- quarantine incomplete or divergent history instead of inventing a merge;
- synchronize personal skill collections with three-way hashes and preserved conflict copies;
- update local Codex indexes without copying another device's database.
- update local Codex indexes without copying another device's database;
- discover Codex Projects, select their tasks as a group, and map project roots across Windows and macOS.

## Quick start

Requirements: Node.js 22+, Codex initialized once on each device, and a trusted shared folder or checked-out private Git vault.

> **Upgrading an existing fleet to v0.3:** pause vault transport and stop the scheduler installed by the earlier release on every device first. Back up the shared vault and each device's local state, then rebootstrap all devices as one coordinated upgrade. The Skill, state directory, and scheduler identities changed; pre-v0.3 and v0.3 writers must never share a live vault.

Install as a Codex skill:

```sh
git clone <repository-url> codex-sync2
mkdir -p "$HOME/.codex/skills/sync2"
cp -R codex-sync2/. "$HOME/.codex/skills/sync2/"
git clone https://github.com/ToussaintKnight/codex-sync.git
npm install --global ./codex-sync
mkdir -p "$HOME/.codex/skills/codex-sync"
cp -R codex-sync/. "$HOME/.codex/skills/codex-sync/"
```

Initialize one device:

```sh
node "$HOME/.codex/skills/sync2/scripts/sync2.mjs" init \
--vault "$HOME/Sync2Vault" \
codexsync init \
--vault "$HOME/CodexSyncVault" \
--transport folder \
--device mac-main
```

Then invoke `$sync2 current` inside the Codex task you want to preserve. Run `$sync2 doctor` before enabling automatic scheduling.
Then invoke `$codex-sync current` inside the Codex task you want to preserve. Run `$codex-sync doctor` before enabling automatic scheduling.

Windows and macOS cold-start commands are in the [deployment guide](references/deployment.md).

> **Security note:** the operational vault stores selected conversation text and user skill source in plaintext. Sync2 never copies credentials or complete Codex databases. Use only storage and peers you trust; see [Security and privacy](SECURITY.md).
> **Security note:** the operational vault stores selected conversation text and user skill source in plaintext. Codex Sync never copies credentials or complete Codex databases. Use only storage and peers you trust; see [Security and privacy](SECURITY.md).

## How it works

Expand All @@ -70,7 +81,7 @@ flowchart LR
K --> I["Import JSONL + update local indexes"]
```

Syncthing or private Git transports bytes. Sync2 decides which bytes are a safe Codex conversation. Read the [architecture](docs/architecture.md) and [protocol](references/protocol.md) for the invariants.
Syncthing or private Git transports bytes. Codex Sync decides which bytes are a safe Codex conversation. Read the [architecture](docs/architecture.md) and [protocol](references/protocol.md) for the invariants.

## Evidence that it works

Expand All @@ -89,7 +100,7 @@ Included:
- explicitly selected rollout JSONL;
- portable task metadata;
- user-defined skill files;
- device selection events and health reports.
- device selection events and health reports;
- per-device project catalogs and explicit source-to-local path mappings.

Excluded:
Expand All @@ -104,8 +115,9 @@ Excluded:

- Conversation attachments are not copied.
- Independently continuing the same task while devices are disconnected creates an explicit conflict requiring a human choice.
- Sync2 does not encrypt the vault itself.
- Older Sync2 clients do not understand maintenance mode; disable their schedulers before a fleet upgrade.
- Codex Sync does not encrypt the vault itself.
- Older clients do not understand maintenance mode; disable their schedulers before a fleet upgrade.
- Windows and macOS are supported today. iPhone and Android continuity is future scope and depends on compatible Codex storage and execution surfaces.
- Codex storage formats may evolve; run `doctor` and the test suite after Codex upgrades.

## Documentation
Expand All @@ -121,7 +133,7 @@ Excluded:

## Project status

Sync2 is an early, tested engineering project. The current release is intended for users comfortable inspecting local files, backups, and synchronization health. Safety and recoverability take priority over automatic conflict resolution.
Codex Sync is an early, tested engineering project. The current release is intended for users comfortable inspecting local files, backups, and synchronization health. Safety and recoverability take priority over automatic conflict resolution.

## License

Expand Down
56 changes: 34 additions & 22 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,73 @@
# Codex Sync2
# Codex Sync

[English](README.md) | **简体中文**

Codex 的任务历史通常只保存在当前电脑。**Codex Sync2 为跨 Windows 与 macOS 使用 Codex 的开发者提供可恢复的选定任务与个人 Skill 同步层,同时避免复制凭据、运行中的数据库或尚未完成的回合。**
**在自己信任的不同电脑上继续同一个本地 Codex 项目,同时不复制凭据、运行中的数据库或尚未完成的回合。**

它适合需要在多台设备上继续使用同一份可信 Codex 上下文的开发者。
Codex Sync 是一个本地优先的连续工作层,面向需要在 Windows 与 macOS 之间切换,并希望安全携带已选择项目、任务历史和个人 Skill 的开发者。

> 产品与 Codex Skill 的正式名称是 **Codex Sync** / `$codex-sync`。Shell CLI 使用 `codexsync`,而不是容易与操作系统工具冲突的 `sync`;本地协议状态存放在 `.codex-sync/`。

```text
$ sync2 conversation select current
$ codexsync conversation select current
Selected: Example task

$ sync2 sync
$ codexsync sync
conversationsPushed: 1 conversationConflicts: 0

$ sync2 doctor
$ codexsync doctor
ok: true
```

## 为什么需要 Sync2
## 为什么需要 Codex Sync

本地 Codex 工作扎根于实际运行它的电脑:任务会记录对话和工作目录,本地项目则连接到这台机器上的文件夹。这是一条有价值的安全边界,但即使在另一台可信电脑上登录同一个账号,也不会自动重建完全相同的本地工作区与任务历史。

想象普通的一天:早晨你在办公室工作站新建一个项目;下午带着 MacBook 到河边或海边,想接着做;晚饭后,全家在沙发上看一集很长的电视剧,你又打开另一台 Windows 笔记本,希望继续早晨那条 Codex 任务。代码也许已经通过 Git 到了新设备,但本地 Codex 项目、任务和上下文仍可能留在另一台电脑上。

直接复制 `~/.codex` 并不安全:其中混合了凭据、设备身份、正在写入的 SQLite 状态、缓存和未完成回合。普通文件同步工具也不知道哪些 Codex 事件才能构成完整会话。
**Codex Sync 正是为这个“连续工作缺口”而生,而不只是为了普通备份。**

Sync2 补上了这一层语义安全能力:
直接复制 `~/.codex` 并不是答案:其中混合了凭据、设备身份、正在写入的 SQLite 状态、缓存和未完成回合。普通文件同步工具也无法判断哪些 Codex 事件才能构成完整、可恢复的会话。

Codex Sync 补上了这一层语义安全能力:

- 只选择真正需要跨设备保留的任务;
- 只发布完整 JSONL 和稳定、已关闭的回合;
- 为每台设备保留独立 head,仅在历史满足字节前缀关系时提升 canonical;
- 隔离不完整或分叉历史,而不是虚构合并结果;
- 通过三方哈希同步个人 Skill,并保留冲突副本;
- 更新本地 Codex 索引,而不是复制其他设备的数据库
- 更新本地 Codex 索引,而不是复制其他设备的数据库
- 发现 Codex Projects、按项目批量选择任务,并映射 Windows 与 macOS 的不同项目路径。

## 快速开始

要求:Node.js 22+、每台设备至少启动过一次 Codex,以及一个可信共享文件夹或已检出的私有 Git vault。

> **将现有设备集升级到 v0.3:**先在每台设备上暂停 vault 传输,并停止旧版本安装的调度器。备份共享 vault 与每台设备的本地状态,再把所有设备作为一次受控升级重新 bootstrap。Skill、状态目录和调度器标识都已变化;绝不能让 v0.3 之前的客户端与 v0.3 客户端同时写入在线 vault。

安装为 Codex Skill:

```sh
git clone <repository-url> codex-sync2
mkdir -p "$HOME/.codex/skills/sync2"
cp -R codex-sync2/. "$HOME/.codex/skills/sync2/"
git clone https://github.com/ToussaintKnight/codex-sync.git
npm install --global ./codex-sync
mkdir -p "$HOME/.codex/skills/codex-sync"
cp -R codex-sync/. "$HOME/.codex/skills/codex-sync/"
```

初始化一台设备:

```sh
node "$HOME/.codex/skills/sync2/scripts/sync2.mjs" init \
--vault "$HOME/Sync2Vault" \
codexsync init \
--vault "$HOME/CodexSyncVault" \
--transport folder \
--device mac-main
```

随后在需要保留的 Codex 任务中调用 `$sync2 current`。启用自动调度前先运行 `$sync2 doctor`。
随后在需要保留的 Codex 任务中调用 `$codex-sync current`。启用自动调度前先运行 `$codex-sync doctor`。

Windows 与 macOS 的冷启动命令见[部署指南](references/deployment.md)。

> **安全提示:**实际运行的 vault 会以明文保存已选择的会话文本与用户 Skill 源码。Sync2 不会复制凭据或完整 Codex 数据库。请只使用你信任的存储与对等设备;详见[安全与隐私](SECURITY.zh-CN.md)。
> **安全提示:**实际运行的 vault 会以明文保存已选择的会话文本与用户 Skill 源码。Codex Sync 不会复制凭据或完整 Codex 数据库。请只使用你信任的存储与对等设备;详见[安全与隐私](SECURITY.zh-CN.md)。

## 工作原理

Expand All @@ -70,7 +81,7 @@ flowchart LR
K --> I["导入 JSONL 并更新本地索引"]
```

Syncthing 或私有 Git 负责传输字节;Sync2 负责判断哪些字节构成安全的 Codex 会话。关键约束见[架构说明](docs/architecture.zh-CN.md)与[协议文档](references/protocol.md)。
Syncthing 或私有 Git 负责传输字节;Codex Sync 负责判断哪些字节构成安全的 Codex 会话。关键约束见[架构说明](docs/architecture.zh-CN.md)与[协议文档](references/protocol.md)。

## 可验证的工程证据

Expand All @@ -89,7 +100,7 @@ GitHub Actions 在 Windows、macOS 和 Linux 的 Node.js 22 环境中运行同
- 明确选择的 rollout JSONL;
- 可移植任务元数据;
- 用户自定义 Skill 文件;
- 设备选择事件与健康报告
- 设备选择事件与健康报告
- 每设备项目目录与显式的源路径到本地路径映射。

排除:
Expand All @@ -104,8 +115,9 @@ GitHub Actions 在 Windows、macOS 和 Linux 的 Node.js 22 环境中运行同

- 不复制会话附件。
- 设备离线期间若在多端独立继续同一任务,会产生需要人工选择的显式冲突。
- Sync2 本身不加密 vault。
- 旧版 Sync2 不理解维护模式;升级整个设备集前必须禁用旧调度器。
- Codex Sync 本身不加密 vault。
- 旧版客户端不理解维护模式;升级整个设备集前必须禁用旧调度器。
- 当前支持 Windows 与 macOS。iPhone 和 Android 连续工作属于未来范围,并依赖兼容的 Codex 存储与执行界面。
- Codex 存储格式可能变化;Codex 升级后应运行 `doctor` 与测试套件。

## 文档
Expand All @@ -121,7 +133,7 @@ GitHub Actions 在 Windows、macOS 和 Linux 的 Node.js 22 环境中运行同

## 项目状态

Sync2 是一个处于早期阶段、但已有完整测试的工程项目。目前版本面向愿意检查本地文件、备份与同步健康状态的用户。安全与可恢复性优先于自动冲突合并。
Codex Sync 是一个处于早期阶段、但已有完整测试的工程项目。目前版本面向愿意检查本地文件、备份与同步健康状态的用户。安全与可恢复性优先于自动冲突合并。

## 许可证

Expand Down
8 changes: 4 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

Use GitHub's private security-advisory flow for vulnerabilities or suspected data exposure. Do not open a public issue containing conversation text, local paths, device identifiers, credentials, or vault contents.

Include the affected Sync2 version, platform, reproduction steps using synthetic data, and the expected security boundary. Remove secrets before attaching logs.
Include the affected Codex Sync version, platform, reproduction steps using synthetic data, and the expected security boundary. Remove secrets before attaching logs.

Before every push or release, run `npm run privacy:scan`. If a credential has already reached Git history or a remote, revoke or rotate it; deleting it in a later commit is not sufficient.

## Data model

Sync2 is a local-first synchronization tool. It reads selected Codex rollout files and user-configured skill roots, then writes sanitized protocol state into a user-controlled vault.
Codex Sync is a local-first synchronization tool. It reads selected Codex rollout files and user-configured skill roots, then writes sanitized protocol state into a user-controlled vault.

The vault may contain plaintext conversation bodies and source code. Sync2 does not encrypt the vault. Use encrypted disks, trusted Syncthing peers, or a private Git repository with appropriate access controls.
The vault may contain plaintext conversation bodies and source code. Codex Sync does not encrypt the vault. Use encrypted disks, trusted Syncthing peers, or a private Git repository with appropriate access controls.

Sync2 must not copy:
Codex Sync must not copy:

- Codex authentication or API credentials;
- complete Codex databases or WAL files;
Expand Down
Loading
Loading