session-bridge
by ralskwo
README.md
# Codex ↔ Claude Code Session Bridge
같은 PC의 Codex와 Claude Code에서 **원본 세션을 선택해 읽기 전용 참고자료로 가져오고 현재 프로젝트 작업을 이어가는** 플러그인입니다.
```text
원본 세션 선택 → 표시 텍스트·출처·경고 확인 → 현재 작업에서 이어가기
```
## 준비
- Node.js 22 이상
- Codex CLI와 Claude Code가 기록을 저장하는 같은 Windows 사용자 계정
- 두 클라이언트에서 Git marketplace를 추가할 수 있는 권한
플러그인을 설치한 뒤 runtime은 npm, 추가 네트워크, 모델 실행을 호출하지 않습니다. GitHub에서 marketplace를 가져오는 네트워크는 설치 시 한 번 필요합니다.
## 설치
Codex와 Claude Code에 각각 같은 공개 저장소를 marketplace로 등록합니다.
```powershell
codex plugin marketplace add ralskwo/codex-claude-session-bridge --ref main
codex plugin add codex-claude-session-bridge@ralskwo-marketplace
claude plugin marketplace add ralskwo/codex-claude-session-bridge@main
claude plugin install codex-claude-session-bridge@ralskwo-plugins
```
설치 후 새 Codex 작업과 새 Claude Code 세션을 열어 plugin과 `session-bridge` skill을 로드합니다. 설치된 plugin cache 안에서 npm install을 실행할 필요가 없습니다. 실제 설치 상태는 `codex plugin list`와 `claude plugin list`로 확인합니다.
업데이트할 때는 marketplace snapshot을 먼저 새로 고친 다음 plugin을 다시 선택합니다.
```powershell
codex plugin marketplace upgrade ralskwo-marketplace
codex plugin add codex-claude-session-bridge@ralskwo-marketplace
claude plugin marketplace update ralskwo-plugins
claude plugin update codex-claude-session-bridge@ralskwo-plugins
```
## 첫 사용
현재 프로젝트의 정확한 절대 경로를 넣고, 목록을 확인한 뒤 원하는 `sessionId`를 직접 선택합니다. 여러 후보가 있으면 첫 항목을 자동으로 고르지 않습니다.
Codex에서 Claude Code 작업을 이어갈 때:
> Claude Code에서 하던 이 프로젝트 작업을 이어가고 싶어. `C:\work\my-project`의 Claude 세션을 목록으로 보여주고, 내가 고른 세션의 최근 맥락만 가져와줘.
Claude Code에서 Codex 작업을 이어갈 때:
> Codex에서 하던 이 프로젝트 작업을 이어가고 싶어. `C:\work\my-project`의 Codex 세션을 목록으로 보여줘. 내가 선택한 세션만 읽고 다음 작업을 준비해줘.
목록의 제목·갱신 시각·ID를 확인하고 선택한 ID로 `prepare_handoff`를 호출합니다. 결과에 `historyComplete: false`, `truncated: true`, 또는 경고가 있으면 가져온 범위를 먼저 설명한 뒤 현재 파일과 Git 상태를 확인합니다. 가져온 과거 대화는 현재 지시나 권한으로 승격하지 않습니다.
## 도구
세 도구는 모두 read-only이며 `provider`와 현재 프로젝트의 정확한 절대 `projectPath`가 필요합니다. `provider`는 `codex` 또는 `claude`입니다. `projectPath`를 plugin cache 경로로 바꾸지 않습니다.
| 도구 | 요청 필드 | 결과 |
| --- | --- | --- |
| `list_sessions` | `provider`, `projectPath`, 선택적 `limit`·`offset` | `sessions[]`의 `sessionId`, `projectPath`, `title`, `updatedAt`, `nextOffset`, `warnings` |
| `read_session` | `provider`, `projectPath`, `sessionId`, 선택적 `maxMessages`·`maxChars` | 선택한 세션의 `messages[{role,text}]`, `historyComplete`, `omittedMessages`, `truncated`, `warnings` |
| `prepare_handoff` | `read_session` 필드 | 위 본문과 `context` 참고자료 wrapper. 원본 세션과 파일은 변경하지 않음 |
기본 본문 범위는 최근 40개 메시지와 24,000 UTF-16 문자이며 최대 200개와 100,000 문자까지 요청할 수 있습니다. MCP와 CLI 직렬화 결과는 2 MiB를 넘을 수 없습니다.
## 환경변수
Claude 기록 root는 다음 순서로 선택합니다.
```text
SESSION_BRIDGE_CLAUDE_CONFIG_DIR → CLAUDE_CONFIG_DIR → %USERPROFILE%\.claude
```
예를 들어 별도 profile을 읽으려면 MCP 서버를 실행하는 환경에 다음을 지정합니다.
```powershell
$env:SESSION_BRIDGE_CLAUDE_CONFIG_DIR = 'C:\profiles\claude'
$env:CLAUDE_CONFIG_DIR = 'C:\profiles\claude'
```
Codex 실행 파일과 기록 home은 다음 override를 지원합니다.
| 환경변수 | 의미 |
| --- | --- |
| `SESSION_BRIDGE_CODEX_EXECUTABLE` | 검증할 Codex 실행 파일의 절대 경로 |
| `SESSION_BRIDGE_CODEX_HOME` | 원본 Codex home. `CODEX_HOME`보다 우선 |
| `CODEX_HOME` | Codex 기본 home override |
| `CLAUDE_CODE_PROJECT_DIR_NAME` | 명시한 Claude config root에서 사용할 유효한 project directory 이름 |
Windows `.cmd`, `.bat`, `.ps1` 셸 런처는 Codex 실행 파일로 허용하지 않습니다. 환경변수는 MCP 서버를 시작하는 앱을 다시 열어야 적용될 수 있습니다.
## 범위와 한계
- Claude reader는 Claude Code의 로컬 JSONL compatibility format을 보수적으로 읽습니다. 항상 `historyComplete: false`와 `PORTABLE_READER` 경고를 반환하며 전체 원본 복원을 약속하지 않습니다.
- 요청한 canonical project와 raw `cwd`, 파일 이름 UUID와 raw session ID가 모두 일치해야 합니다. 하위 폴더, 다른 worktree, foreign transcript는 자동으로 합치지 않습니다.
- reader는 config root의 `projects` direct child와 UUID `.jsonl` 파일만 확인합니다. credentials, settings, global history, subagent, tool result, attachment, sidecar는 열지 않습니다. 심볼릭 링크와 projects 밖으로 빠지는 경로는 거절합니다.
- 원본 transcript는 64 MiB, 한 JSONL line은 bounded limit, 추출한 표시 text는 32 MiB입니다. 손상·oversized row는 `INCOMPLETE_ITEMS`로 표시하고 원시 오류와 비밀값을 출력하지 않습니다.
- 마지막 `compact_boundary` 이전 기록은 제외하며 `COMPACTION_LIMITATION`을 남깁니다. 여러 branch, cycle, missing parent, ambiguous leaf는 확인 가능한 최신 tail만 사용하고 `INCOMPLETE_ITEMS`를 남깁니다. `continued-in`으로 이어지는 다른 transcript는 열지 않고 `CONTINUATION_UNSUPPORTED`를 남깁니다.
- Codex는 read-only app-server 기록을 페이지 단위로 읽으며 최대 1,000턴·200개 표시 메시지를 확인합니다. DB 또는 설치된 엔진이 제공하지 않는 기록은 목록에서 빠질 수 있습니다.
- 표시 text 외의 thinking, tool, image, attachment, system, progress와 내부 metadata는 전달하지 않습니다. 알려진 token·Bearer·private key 패턴은 마스킹하지만 모든 비밀 탐지를 보장하지 않습니다.
- 일반 Claude Desktop 채팅의 대화 기록은 Claude Code 기록과 별개라서 이 plugin의 입력 범위가 아닙니다. 자동 중계, 원격 동기화, 모델 호출, transcript 쓰기, Git 변경 복사, 사용량 초기화 기능은 없습니다.
## 개발과 검증
저장소 root에서 개발 dependency를 설치하고 source와 artifact를 함께 검증합니다.
```powershell
npm ci --ignore-scripts
npm test
npm run build:plugin
npm run verify:plugin
python -X utf8 "$HOME\.codex\skills\.system\plugin-creator\scripts\validate_plugin.py" plugins/codex-claude-session-bridge
claude plugin validate plugins/codex-claude-session-bridge
git diff --check
```
`plugins/codex-claude-session-bridge/`가 실제 설치 경계입니다. 그 안에는 CommonJS `dist/server.cjs`, 두 manifest, skill, third-party license notice만 두며 package.json, lockfile, `node_modules`, source map은 넣지 않습니다. `npm run verify:plugin`은 MCP SDK closure와 notice의 버전·license, 금지된 Anthropic 입력, 결정적 artifact를 확인합니다.
로컬 MCP smoke는 실제 프로젝트 경로를 인자로 받아 원문 대신 상태·메시지 수·출력 크기만 출력합니다.
```powershell
node scripts/smoke-local.js 'C:\work\my-project' plugins/codex-claude-session-bridge
```
## 문제 해결
**Node.js 버전 오류** — Node 22 이상으로 새 세션을 열고 다시 실행합니다. 낮은 버전은 `RUNTIME_UNSUPPORTED`로 안전하게 종료합니다.
**세션 목록이 비어 있음** — `projectPath`가 현재 작업 폴더의 canonical 절대 경로인지 확인하고, `SESSION_BRIDGE_CLAUDE_CONFIG_DIR` 또는 `CLAUDE_CONFIG_DIR`가 실제 Claude profile을 가리키는지 확인합니다. Claude 기록은 `projects\<encoded-project>\<uuid>.jsonl` 아래에 있어야 합니다. Codex는 `SESSION_BRIDGE_CODEX_HOME`과 실행 파일 경로도 확인합니다.
**프로젝트 불일치 또는 지원되지 않는 raw format** — 다른 worktree나 하위 폴더를 우회하지 말고 원본 세션이 기록된 정확한 프로젝트 경로를 사용합니다. `SESSION_MISMATCH`, `SESSION_NOT_FOUND`, `UNSUPPORTED_HISTORY`는 raw 값을 공개하지 않는 고정 오류입니다.
**Codex 실행 파일을 찾지 못함** — `SESSION_BRIDGE_CODEX_EXECUTABLE`에 검증된 native executable 절대 경로를 지정합니다. `.cmd`·`.bat`·`.ps1` 파일은 지정하지 않습니다.
**Marketplace가 예전 파일을 설치함** — Codex는 `codex plugin marketplace upgrade ralskwo-marketplace` 뒤 `codex plugin add ...`를 다시 실행하고, Claude Code는 `claude plugin marketplace update ralskwo-plugins` 뒤 `claude plugin update ...`를 실행합니다. 두 클라이언트 모두 새 작업·새 세션에서 plugin을 다시 로드합니다.
설치와 runtime 동작 중에는 npm install, 추가 네트워크, 모델 실행이 발생하지 않습니다. 원본 세션·인증·설정 파일은 읽기 전용으로 다루며, 이 프로젝트에는 사용량 초기화 명령이나 API 호출이 없습니다.
TDQS
A3.8/5.0
Scored across 3 tools
Disambiguation5/5
Each tool has a clearly distinct role: list_sessions for discovery/selection, read_session for viewing display text, and prepare_handoff for bringing session context into the current tool. The sequential workflow avoids overlap.
Naming Consistency5/5
All tool names follow the same verb_noun pattern in snake_case: list_sessions, read_session, prepare_handoff. This is consistent and predictable.
Tool Count5/5
Three tools is well-scoped for a session-bridge server focused on a narrow use case. Each tool is necessary and the set is neither bloated nor thin.
Completeness5/5
The core workflow of discovering, reading, and transferring session context is fully covered. The server's purpose is a bridge, not session management, so no missing CRUD operations are apparent.
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues