engineering
Codex Cross-Session: Moving an AI Coding Session Between Macs
A repo-backed session migration tool that keeps Codex handoffs explicit, non-secret, and fail-closed.
- #codex
- #cli
- #tooling
- #macos
The problem
AI coding sessions are valuable because they accumulate context: the repo state, the current branch, recent decisions, and the thread of work in progress. Losing that context when moving between machines turns a simple handoff into a reconstruction exercise.
My actual pain point was simple: I use two machines. Sometimes the real work is active on Machine A, but I am back home on Machine B and want to keep moving without rebuilding the whole Codex session from memory.
Codex Cross-Session is my small answer to that problem. It is a macOS-only CLI for moving one selected Codex session between Macs by exporting non-secret session state into a repo-owned .codex-session/ bundle, transporting it through git, and restoring it on the destination machine.
The product boundary
The scope is intentionally narrow:
- One explicit session id per run.
- Single-user workflow.
- macOS only for the first version.
- Repo-backed transport through
.codex-session/sessions/<session-id>/. - Compatibility checks that refuse unsafe restores instead of trying to be clever.
That boundary matters. Session migration is not just file copying; it is a trust problem. If the destination repo, branch, commit, or expected Codex layout does not line up, the import path should stop and tell the operator what is wrong.
How the workflow works
The operator loop is deliberately boring:
codex-session export <session-id>
git add .codex-session
git commit -m "Export Codex session"
git push
Then on the second Mac:
git pull
codex-session import <session-id>
codex resume <session-id>
The exported bundle lives with the repo that gives the session meaning. That keeps transport auditable and avoids a hidden global sync layer.
The important part is not only that files move. The useful part is that the work resumes with the right repository context, compatibility checks, and enough session state for Codex to continue from the same thread of work.
Engineering choices
The implementation is split around clear ownership:
src/cli/owns the user-facing command surface.src/session/discovers Codex home and session artifacts.src/bundle/owns manifest, inventory, and bundle schema logic.src/export/andsrc/import/own the two operational flows.src/git/keeps git-aware workflow helpers separate from migration logic.
The important design choice is that restore compatibility is a first-class behavior, not a warning printed after mutation. A migration tool should fail closed before it touches local state.
Current state
The project now has public-facing documentation, usage notes, limitations, security notes, and MIT licensing. It exposes a codex-session binary in package metadata, but it is still in public-preparation mode rather than fully published package mode.
That distinction is useful. It keeps the README honest: the tool is real and documented, while npm-style distribution remains a separate release step.
What I like about this project
This is the kind of tool that earns its keep by removing one repeated tax from serious AI-assisted development. It does not try to become a cloud sync product. It makes the handoff explicit, versioned, reviewable, and tied to the repository where the work actually happens.
Related posts
Continue with articles that overlap in category or shared tags.
engineering
RequestLab: A Local-First macOS API Workbench
A native SwiftUI API client built around readable workspace files, testable core logic, and practical release packaging.
Read related postai
A Safe Hermes Agent Workflow: Evidence, Approval Gates, Verification
An evidence-led Hermes Agent workflow for delegated engineering work: narrow scope, durable context, verification, and explicit approval gates.
Read related postengineering
Meili UI: A Local-First Admin Surface for Meilisearch
A case study in turning repeated search-index maintenance into a focused internal operator tool without overbuilding the deployment boundary.
Read related post