claudekit-codex-sync 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +45 -0
- package/README.md +131 -0
- package/bin/ck-codex-sync +12 -0
- package/bin/ck-codex-sync.js +9 -0
- package/docs/code-standards.md +62 -0
- package/docs/codebase-summary.md +83 -0
- package/docs/codex-vs-claude-agents.md +74 -0
- package/docs/installation-guide.md +64 -0
- package/docs/project-overview-pdr.md +44 -0
- package/docs/project-roadmap.md +51 -0
- package/docs/system-architecture.md +106 -0
- package/package.json +16 -0
- package/plans/260222-2051-claudekit-codex-community-sync/phase-01-productization.md +36 -0
- package/plans/260222-2051-claudekit-codex-community-sync/phase-02-core-refactor.md +32 -0
- package/plans/260222-2051-claudekit-codex-community-sync/phase-03-agent-transpiler.md +33 -0
- package/plans/260222-2051-claudekit-codex-community-sync/phase-04-parity-harness.md +43 -0
- package/plans/260222-2051-claudekit-codex-community-sync/phase-05-distribution-npm.md +35 -0
- package/plans/260222-2051-claudekit-codex-community-sync/phase-06-git-clone-docs.md +28 -0
- package/plans/260222-2051-claudekit-codex-community-sync/phase-07-qa-release.md +35 -0
- package/plans/260222-2051-claudekit-codex-community-sync/plan.md +99 -0
- package/plans/260223-0951-refactor-and-upgrade/phase-01-project-structure.md +79 -0
- package/plans/260223-0951-refactor-and-upgrade/phase-02-extract-templates.md +36 -0
- package/plans/260223-0951-refactor-and-upgrade/phase-03-modularize-python.md +107 -0
- package/plans/260223-0951-refactor-and-upgrade/phase-04-live-source-detection.md +76 -0
- package/plans/260223-0951-refactor-and-upgrade/phase-05-agent-toml-config.md +88 -0
- package/plans/260223-0951-refactor-and-upgrade/phase-06-backup-registry.md +58 -0
- package/plans/260223-0951-refactor-and-upgrade/phase-07-tests-docs-push.md +54 -0
- package/plans/260223-0951-refactor-and-upgrade/plan.md +72 -0
- package/reports/brainstorm-260222-2051-claudekit-codex-community-sync.md +113 -0
- package/scripts/bootstrap-claudekit-skill-scripts.sh +150 -0
- package/scripts/claudekit-sync-all.py +1150 -0
- package/scripts/export-claudekit-prompts.sh +221 -0
- package/scripts/normalize-claudekit-for-codex.sh +261 -0
- package/src/claudekit_codex_sync/__init__.py +0 -0
- package/src/claudekit_codex_sync/asset_sync_dir.py +125 -0
- package/src/claudekit_codex_sync/asset_sync_zip.py +140 -0
- package/src/claudekit_codex_sync/bridge_generator.py +33 -0
- package/src/claudekit_codex_sync/cli.py +199 -0
- package/src/claudekit_codex_sync/config_enforcer.py +140 -0
- package/src/claudekit_codex_sync/constants.py +104 -0
- package/src/claudekit_codex_sync/dep_bootstrapper.py +73 -0
- package/src/claudekit_codex_sync/path_normalizer.py +248 -0
- package/src/claudekit_codex_sync/prompt_exporter.py +89 -0
- package/src/claudekit_codex_sync/runtime_verifier.py +32 -0
- package/src/claudekit_codex_sync/source_resolver.py +78 -0
- package/src/claudekit_codex_sync/sync_registry.py +77 -0
- package/src/claudekit_codex_sync/utils.py +130 -0
- package/templates/agents-md.md +45 -0
- package/templates/bridge-docs-init.sh +25 -0
- package/templates/bridge-project-status.sh +49 -0
- package/templates/bridge-resolve-command.py +52 -0
- package/templates/bridge-skill.md +63 -0
- package/templates/command-map.md +44 -0
- package/tests/__init__.py +1 -0
- package/tests/test_config_enforcer.py +44 -0
- package/tests/test_path_normalizer.py +61 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Codex working profile for this workspace, adapted from ClaudeKit rules and workflows.
|
|
4
|
+
|
|
5
|
+
## Operating Principles
|
|
6
|
+
|
|
7
|
+
- Follow `YAGNI`, `KISS`, `DRY`.
|
|
8
|
+
- Prefer direct, maintainable solutions over speculative abstraction.
|
|
9
|
+
- Do not claim completion without evidence (tests, checks, or concrete validation).
|
|
10
|
+
- Never use fake implementations just to make tests/build pass.
|
|
11
|
+
|
|
12
|
+
## Default Workflow
|
|
13
|
+
|
|
14
|
+
1. Read context first: `README.md` and relevant docs under `./docs/`.
|
|
15
|
+
2. For non-trivial work, create/update a plan in `./plans/` before coding.
|
|
16
|
+
3. Implement in existing files unless new files are clearly needed.
|
|
17
|
+
4. Validate with project compile/lint/test commands.
|
|
18
|
+
5. Run code-review mindset before finalizing (bugs, regressions, missing tests first).
|
|
19
|
+
6. Update docs when behavior, architecture, contracts, or operations change.
|
|
20
|
+
|
|
21
|
+
## Quality Gates
|
|
22
|
+
|
|
23
|
+
- Handle edge cases and error paths explicitly.
|
|
24
|
+
- Keep security and performance implications visible in design decisions.
|
|
25
|
+
- Keep code readable and intention-revealing; add comments only when needed for non-obvious logic.
|
|
26
|
+
|
|
27
|
+
## Documentation Rules
|
|
28
|
+
|
|
29
|
+
- `./docs` is the source of truth for project docs.
|
|
30
|
+
- Keep docs synchronized with code and implementation decisions.
|
|
31
|
+
- When summarizing/reporting, be concise and list unresolved questions at the end.
|
|
32
|
+
|
|
33
|
+
## Skill Usage
|
|
34
|
+
|
|
35
|
+
- Activate relevant skills intentionally per task.
|
|
36
|
+
- For legacy ClaudeKit command intents (`/ck-help`, `/coding-level`, `/ask`, `/docs/*`, `/journal`, `/watzup`), use `$claudekit-command-bridge`.
|
|
37
|
+
|
|
38
|
+
## Reference Material (Imported from ClaudeKit)
|
|
39
|
+
|
|
40
|
+
- `~/.codex/claudekit/CLAUDE.md`
|
|
41
|
+
- `~/.codex/claudekit/rules/development-rules.md`
|
|
42
|
+
- `~/.codex/claudekit/rules/primary-workflow.md`
|
|
43
|
+
- `~/.codex/claudekit/rules/orchestration-protocol.md`
|
|
44
|
+
- `~/.codex/claudekit/rules/documentation-management.md`
|
|
45
|
+
- `~/.codex/claudekit/rules/team-coordination-rules.md`
|
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# claudekit-codex-sync
|
|
2
|
+
|
|
3
|
+
Sync [ClaudeKit](https://github.com/anthropics/claudekit) skills, agents, prompts, and configuration to [Codex CLI](https://developers.openai.com/codex).
|
|
4
|
+
|
|
5
|
+
## Problem
|
|
6
|
+
|
|
7
|
+
ClaudeKit stores agent definitions (`.md` with YAML frontmatter), skills, prompts, and config under `~/.claude/`. Codex CLI uses a different layout under `~/.codex/` with `.toml` agents, GPT model names, and TOML-based config. Manually migrating is tedious and error-prone.
|
|
8
|
+
|
|
9
|
+
## What It Does
|
|
10
|
+
|
|
11
|
+
| Step | Action |
|
|
12
|
+
|---|---|
|
|
13
|
+
| **Source resolve** | Detects `~/.claude/` (live) or ClaudeKit export zip |
|
|
14
|
+
| **Asset sync** | Copies agents, commands, rules, scripts → `~/.codex/claudekit/` |
|
|
15
|
+
| **Skill sync** | Copies 54+ skills → `~/.codex/skills/` |
|
|
16
|
+
| **Path normalize** | Rewrites `.claude` → `.codex` in all synced files |
|
|
17
|
+
| **Agent convert** | `.md` (YAML frontmatter) → `.toml` with model mapping |
|
|
18
|
+
| **Model mapping** | `opus → gpt-5.3-codex`, `haiku → gpt-5.3-codex-spark` |
|
|
19
|
+
| **Config enforce** | Sets `multi_agent`, `child_agents_md`, registers `[agents.*]` |
|
|
20
|
+
| **Prompt export** | Generates Codex-compatible prompt files |
|
|
21
|
+
| **Dep bootstrap** | Installs Python/Node deps for skills requiring them |
|
|
22
|
+
| **Runtime verify** | Health-checks the synced environment |
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Clone and install globally
|
|
28
|
+
git clone https://github.com/vinhawk-66/claudekit-codex-sync.git
|
|
29
|
+
cd claudekit-codex-sync
|
|
30
|
+
npm install -g .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Sync from live ~/.claude/ directory
|
|
37
|
+
ck-codex-sync --source-mode live
|
|
38
|
+
|
|
39
|
+
# Sync from exported zip
|
|
40
|
+
ck-codex-sync --zip claudekit-export.zip
|
|
41
|
+
|
|
42
|
+
# Preview without changes
|
|
43
|
+
ck-codex-sync --source-mode live --dry-run
|
|
44
|
+
|
|
45
|
+
# Include MCP skills
|
|
46
|
+
ck-codex-sync --source-mode live --include-mcp
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## CLI Options
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
--source-mode live|zip|auto Source selection (default: auto)
|
|
53
|
+
--source-dir PATH Custom source directory
|
|
54
|
+
--zip PATH Specific zip file
|
|
55
|
+
--codex-home PATH Codex home (default: ~/.codex)
|
|
56
|
+
--include-mcp Include MCP skills
|
|
57
|
+
--include-hooks Include hooks
|
|
58
|
+
--skip-bootstrap Skip dependency installation
|
|
59
|
+
--skip-verify Skip runtime verification
|
|
60
|
+
--skip-agent-toml Skip agent TOML normalization
|
|
61
|
+
--respect-edits Backup user-edited files
|
|
62
|
+
--dry-run Preview mode
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Agent Model Mapping
|
|
66
|
+
|
|
67
|
+
Per [official Codex docs](https://developers.openai.com/codex/multi-agent), each agent role can override `model`, `model_reasoning_effort`, and `sandbox_mode`:
|
|
68
|
+
|
|
69
|
+
| Claude Model | Codex Model | Reasoning | Used By |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| `opus` | `gpt-5.3-codex` | xhigh | planner, code_simplifier |
|
|
72
|
+
| `sonnet` | `gpt-5.3-codex` | high | debugger, fullstack_developer |
|
|
73
|
+
| `haiku` | `gpt-5.3-codex-spark` | medium | researcher, tester, docs_manager |
|
|
74
|
+
|
|
75
|
+
Read-only agents (brainstormer, code_reviewer, researcher, project_manager, journal_writer) get `sandbox_mode = "read-only"`.
|
|
76
|
+
|
|
77
|
+
## Related Tools
|
|
78
|
+
|
|
79
|
+
- **[ccs](https://www.npmjs.com/package/@kaitranntt/ccs)** (`@kaitranntt/ccs`) — Claude Code Profile & Model Switcher. Allows running Claude Code with different model backends including Codex models via CLIProxy. Example: `ccs codex` launches Claude Code using Codex as the backend model.
|
|
80
|
+
- **[Codex CLI](https://github.com/openai/codex)** (`@openai/codex`) — OpenAI's coding agent CLI.
|
|
81
|
+
|
|
82
|
+
## Project Structure
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
├── bin/ck-codex-sync.js # npm CLI entry point
|
|
86
|
+
├── src/claudekit_codex_sync/ # Python modules (13 files, ~1500 LOC)
|
|
87
|
+
│ ├── cli.py # Main orchestrator
|
|
88
|
+
│ ├── source_resolver.py # Source detection (live/zip/auto)
|
|
89
|
+
│ ├── asset_sync_dir.py # Directory-based sync
|
|
90
|
+
│ ├── asset_sync_zip.py # Zip-based sync
|
|
91
|
+
│ ├── path_normalizer.py # Path rewriting + agent .md→.toml
|
|
92
|
+
│ ├── config_enforcer.py # Config, multi-agent, agent registration
|
|
93
|
+
│ ├── prompt_exporter.py # Prompt file generation
|
|
94
|
+
│ ├── bridge_generator.py # Bridge skill for Codex
|
|
95
|
+
│ ├── dep_bootstrapper.py # Dependency installation
|
|
96
|
+
│ ├── runtime_verifier.py # Health checks
|
|
97
|
+
│ ├── sync_registry.py # Backup/registry (SHA-256)
|
|
98
|
+
│ ├── constants.py # Replacements, model maps
|
|
99
|
+
│ └── utils.py # Shared utilities
|
|
100
|
+
├── templates/ # Template files for generated content
|
|
101
|
+
├── tests/ # pytest suite
|
|
102
|
+
├── scripts/ # Legacy standalone scripts
|
|
103
|
+
└── docs/ # Documentation
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Run tests
|
|
110
|
+
PYTHONPATH=src python3 -m pytest tests/ -v
|
|
111
|
+
|
|
112
|
+
# Lint
|
|
113
|
+
python3 -m py_compile src/claudekit_codex_sync/*.py
|
|
114
|
+
|
|
115
|
+
# Run sync locally
|
|
116
|
+
PYTHONPATH=src python3 -m claudekit_codex_sync.cli --source-mode live --dry-run
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Documentation
|
|
120
|
+
|
|
121
|
+
- [System Architecture](./docs/system-architecture.md)
|
|
122
|
+
- [Code Standards](./docs/code-standards.md)
|
|
123
|
+
- [Codebase Summary](./docs/codebase-summary.md)
|
|
124
|
+
- [Project Roadmap](./docs/project-roadmap.md)
|
|
125
|
+
- [Installation Guide](./docs/installation-guide.md)
|
|
126
|
+
- [Codex vs Claude Agents](./docs/codex-vs-claude-agents.md)
|
|
127
|
+
- [Project Overview (PDR)](./docs/project-overview-pdr.md)
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
MIT
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
# Add src to path
|
|
6
|
+
src_dir = Path(__file__).parent.parent / "src"
|
|
7
|
+
sys.path.insert(0, str(src_dir))
|
|
8
|
+
|
|
9
|
+
from claudekit_codex_sync.cli import main
|
|
10
|
+
|
|
11
|
+
if __name__ == "__main__":
|
|
12
|
+
sys.exit(main())
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { execSync } = require('child_process');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const script = path.join(__dirname, 'ck-codex-sync');
|
|
5
|
+
try {
|
|
6
|
+
execSync(`python3 "${script}" ${process.argv.slice(2).join(' ')}`, { stdio: 'inherit' });
|
|
7
|
+
} catch (e) {
|
|
8
|
+
process.exit(e.status || 1);
|
|
9
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Code Standards
|
|
2
|
+
|
|
3
|
+
## Language & Runtime
|
|
4
|
+
|
|
5
|
+
- **Python 3.12+** — Core sync logic
|
|
6
|
+
- **Node.js** — CLI wrapper only (`bin/ck-codex-sync.js`)
|
|
7
|
+
- No external Python dependencies in core (stdlib only: `pathlib`, `re`, `shutil`, `json`, `zipfile`, `argparse`, `hashlib`)
|
|
8
|
+
|
|
9
|
+
## File Organization
|
|
10
|
+
|
|
11
|
+
- **Kebab-case** for filenames: `asset-sync-dir.py` (Python uses snake_case for modules, so `asset_sync_dir.py`)
|
|
12
|
+
- **Max 200 LOC** per module — enforced; largest is `path_normalizer.py` at 248 (due to agent conversion addition, refactor candidate)
|
|
13
|
+
- **One concern per module** — each `.py` file handles exactly one phase of the sync pipeline
|
|
14
|
+
- Constants separated into `constants.py`; utilities into `utils.py`
|
|
15
|
+
|
|
16
|
+
## Naming Conventions
|
|
17
|
+
|
|
18
|
+
| Element | Convention | Example |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| Modules | `snake_case` | `config_enforcer.py` |
|
|
21
|
+
| Functions | `snake_case` | `enforce_multi_agent_flag()` |
|
|
22
|
+
| Constants | `UPPER_SNAKE_CASE` | `CLAUDE_TO_CODEX_MODELS` |
|
|
23
|
+
| Classes | `PascalCase` (none yet) | — |
|
|
24
|
+
| Template files | `kebab-case` | `bridge-skill.md` |
|
|
25
|
+
|
|
26
|
+
## Function Signatures
|
|
27
|
+
|
|
28
|
+
All public functions follow the pattern:
|
|
29
|
+
```python
|
|
30
|
+
def function_name(*, codex_home: Path, dry_run: bool) -> int:
|
|
31
|
+
"""One-line docstring."""
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- Keyword-only args (`*` marker) for clarity
|
|
35
|
+
- `dry_run` flag on all write operations
|
|
36
|
+
- Return `int` (count of changed files) or `bool` (whether changes made)
|
|
37
|
+
- `Dict[str, Any]` for stats output
|
|
38
|
+
|
|
39
|
+
## Error Handling
|
|
40
|
+
|
|
41
|
+
- Custom `SyncError` exception for user-facing errors
|
|
42
|
+
- `eprint()` for stderr output
|
|
43
|
+
- CLI catches `SyncError` → exits with code 2
|
|
44
|
+
- No silent failures — all operations log what they change
|
|
45
|
+
|
|
46
|
+
## Testing
|
|
47
|
+
|
|
48
|
+
- Framework: **pytest**
|
|
49
|
+
- Location: `tests/`
|
|
50
|
+
- Naming: `test_<module>.py`
|
|
51
|
+
- Run: `PYTHONPATH=src python3 -m pytest tests/ -v`
|
|
52
|
+
- Current coverage: `config_enforcer` (4 tests), `path_normalizer` (7 tests)
|
|
53
|
+
|
|
54
|
+
## Path Conventions
|
|
55
|
+
|
|
56
|
+
All paths use `Path` objects (not strings). Environment-based paths use `${CODEX_HOME:-$HOME/.codex}` pattern.
|
|
57
|
+
|
|
58
|
+
## Git Conventions
|
|
59
|
+
|
|
60
|
+
- Conventional commits: `feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`
|
|
61
|
+
- No AI references in commit messages
|
|
62
|
+
- `.gitignore`: `__pycache__/`, `*.pyc`, `node_modules/`, `.pytest_cache/`
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Codebase Summary
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
**claudekit-codex-sync** bridges ClaudeKit (`~/.claude/`) to Codex CLI (`~/.codex/`) by syncing skills, agents, prompts, and configuration. Written primarily in Python with a Node.js CLI wrapper.
|
|
6
|
+
|
|
7
|
+
## Stats
|
|
8
|
+
|
|
9
|
+
| Component | Files | LOC | Purpose |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| `src/claudekit_codex_sync/` | 13 | ~1500 | Core Python modules |
|
|
12
|
+
| `templates/` | 5 | ~280 | Generated file templates |
|
|
13
|
+
| `tests/` | 2 | ~106 | pytest-based test suite |
|
|
14
|
+
| `scripts/` | 4 | ~1780 | Legacy standalone scripts |
|
|
15
|
+
| `bin/` | 2 | ~20 | npm CLI entry point |
|
|
16
|
+
|
|
17
|
+
## Module Map
|
|
18
|
+
|
|
19
|
+
### Core Orchestration
|
|
20
|
+
|
|
21
|
+
- **`cli.py`** (199 LOC) — Main entry point. Parses args, coordinates all sync phases, outputs JSON summary. Supports `live` (directory) and `zip` source modes.
|
|
22
|
+
|
|
23
|
+
### Source Resolution
|
|
24
|
+
|
|
25
|
+
- **`source_resolver.py`** (78 LOC) — Detects ClaudeKit source: `~/.claude/` for live mode, finds latest zip for zip mode. Validates source has required structure.
|
|
26
|
+
|
|
27
|
+
### Asset Sync
|
|
28
|
+
|
|
29
|
+
- **`asset_sync_dir.py`** (125 LOC) — Copies assets and skills from a live `~/.claude/` directory to `~/.codex/`. Handles `ASSET_DIRS` (agents, commands, rules, scripts) and `ASSET_FILES`.
|
|
30
|
+
- **`asset_sync_zip.py`** (140 LOC) — Same as above but from a ClaudeKit export zip file.
|
|
31
|
+
|
|
32
|
+
### Path Normalization
|
|
33
|
+
|
|
34
|
+
- **`path_normalizer.py`** (248 LOC) — Rewrites `.claude` → `.codex` paths in all synced files. Also converts ClaudeKit agent `.md` files (with YAML frontmatter) to Codex `.toml` format with correct model mapping.
|
|
35
|
+
- **`constants.py`** (104 LOC) — All replacement patterns (`SKILL_MD_REPLACEMENTS`, `AGENT_TOML_REPLACEMENTS`, `CLAUDE_SYNTAX_ADAPTATIONS`), model mapping tables, and read-only role sets.
|
|
36
|
+
|
|
37
|
+
### Configuration
|
|
38
|
+
|
|
39
|
+
- **`config_enforcer.py`** (140 LOC) — Ensures `config.toml` has correct structure, enforces `multi_agent` + `child_agents_md` feature flags, auto-registers `[agents.*]` sections from TOML files.
|
|
40
|
+
|
|
41
|
+
### Prompt & Bridge
|
|
42
|
+
|
|
43
|
+
- **`prompt_exporter.py`** (89 LOC) — Exports ClaudeKit prompts to Codex-compatible format.
|
|
44
|
+
- **`bridge_generator.py`** (33 LOC) — Creates a bridge skill in `~/.codex/skills/claudekit-command-bridge/`.
|
|
45
|
+
|
|
46
|
+
### Support
|
|
47
|
+
|
|
48
|
+
- **`dep_bootstrapper.py`** (73 LOC) — Installs Python/Node dependencies for skills that require them.
|
|
49
|
+
- **`runtime_verifier.py`** (32 LOC) — Verifies synced environment health (codex help, copywriting, prompt count, skill count).
|
|
50
|
+
- **`sync_registry.py`** (77 LOC) — SHA-256 checksum registry for tracking synced files and detecting user edits.
|
|
51
|
+
- **`utils.py`** (130 LOC) — Shared utilities: `apply_replacements()`, `load_template()`, `write_text_if_changed()`, `SyncError`.
|
|
52
|
+
|
|
53
|
+
## Data Flow
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Source (~/.claude/ or zip)
|
|
57
|
+
↓
|
|
58
|
+
source_resolver.py → detect source type
|
|
59
|
+
↓
|
|
60
|
+
asset_sync_dir/zip.py → copy agents, skills, commands
|
|
61
|
+
↓
|
|
62
|
+
path_normalizer.py → rewrite paths + convert .md→.toml agents
|
|
63
|
+
↓
|
|
64
|
+
config_enforcer.py → update config.toml + register agents
|
|
65
|
+
↓
|
|
66
|
+
prompt_exporter.py → generate prompt files
|
|
67
|
+
↓
|
|
68
|
+
dep_bootstrapper.py → install skill dependencies
|
|
69
|
+
↓
|
|
70
|
+
runtime_verifier.py → health check
|
|
71
|
+
↓
|
|
72
|
+
Output: ~/.codex/ fully configured for Codex CLI
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Test Coverage
|
|
76
|
+
|
|
77
|
+
| File | Tests | Coverage |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| `config_enforcer.py` | 4 | Feature flag enforcement |
|
|
80
|
+
| `path_normalizer.py` | 7 | Path replacement patterns |
|
|
81
|
+
| **Total** | **11** | Core functionality |
|
|
82
|
+
|
|
83
|
+
Untested modules (need coverage): `cli.py`, `asset_sync_dir.py`, `asset_sync_zip.py`, `source_resolver.py`, `prompt_exporter.py`, `dep_bootstrapper.py`, `runtime_verifier.py`, `sync_registry.py`, `bridge_generator.py`, `utils.py`.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Codex vs Claude Agents
|
|
2
|
+
|
|
3
|
+
This document outlines the differences between Claude Code agents and Codex agents, and what is lost or preserved during sync.
|
|
4
|
+
|
|
5
|
+
## Key Differences
|
|
6
|
+
|
|
7
|
+
| Feature | Claude Code | Codex CLI |
|
|
8
|
+
|---------|-------------|-----------|
|
|
9
|
+
| **Agent Definition** | TOML files with `[[agents]]` sections | TOML files with `[[agents]]` sections |
|
|
10
|
+
| **Model Selection** | `model` frontmatter field | No per-agent model selection |
|
|
11
|
+
| **Tool Restrictions** | `tools` frontmatter field | No tool restrictions (all tools available) |
|
|
12
|
+
| **Memory** | `memory` frontmatter field | `developer_instructions` text only |
|
|
13
|
+
| **Delegation** | `Task()` tool for explicit delegation | Auto-spawn via `multi_agent = true` |
|
|
14
|
+
|
|
15
|
+
## What Transfers
|
|
16
|
+
|
|
17
|
+
The following are preserved during ClaudeKit -> Codex sync:
|
|
18
|
+
|
|
19
|
+
- **Agent name and description** - Basic identity
|
|
20
|
+
- **Developer instructions** - Core behavior guidance
|
|
21
|
+
- **Sandbox mode settings** - Security constraints
|
|
22
|
+
- **Agent file structure** - Organized in `~/.codex/agents/`
|
|
23
|
+
|
|
24
|
+
## What's Lost
|
|
25
|
+
|
|
26
|
+
The following Claude-specific features are stripped or adapted:
|
|
27
|
+
|
|
28
|
+
1. **Explicit Task() delegation syntax**
|
|
29
|
+
- Claude: `Task(subagent_type="researcher", ...)`
|
|
30
|
+
- Codex: Auto-spawn based on context
|
|
31
|
+
|
|
32
|
+
2. **Tool restrictions**
|
|
33
|
+
- Claude: `tools = ["Read", "Grep", "Edit"]` limits available tools
|
|
34
|
+
- Codex: All tools available to all agents
|
|
35
|
+
|
|
36
|
+
3. **Model selection**
|
|
37
|
+
- Claude: `model = "haiku"` for cost/performance tuning
|
|
38
|
+
- Codex: Single model for all operations
|
|
39
|
+
|
|
40
|
+
4. **Memory configuration**
|
|
41
|
+
- Claude: `memory` section with context management
|
|
42
|
+
- Codex: Instructions embedded in developer text
|
|
43
|
+
|
|
44
|
+
## Path Normalization
|
|
45
|
+
|
|
46
|
+
Agent TOMLs are automatically normalized during sync:
|
|
47
|
+
|
|
48
|
+
```diff
|
|
49
|
+
- $HOME/.claude/skills/
|
|
50
|
+
+ ${CODEX_HOME:-$HOME/.codex}/skills/
|
|
51
|
+
|
|
52
|
+
- ~/.claude/
|
|
53
|
+
+ ~/.codex/
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Multi-Agent Configuration
|
|
57
|
+
|
|
58
|
+
After sync, enable multi-agent mode:
|
|
59
|
+
|
|
60
|
+
```toml
|
|
61
|
+
[features]
|
|
62
|
+
multi_agent = true
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This allows Codex to auto-spawn sub-agents based on task context, similar to Claude's `Task()` delegation but without explicit syntax.
|
|
66
|
+
|
|
67
|
+
## Recommendation
|
|
68
|
+
|
|
69
|
+
For maximum compatibility:
|
|
70
|
+
|
|
71
|
+
1. Write agent instructions assuming all tools are available
|
|
72
|
+
2. Use natural language for delegation intent (e.g., "use the researcher agent")
|
|
73
|
+
3. Keep agent instructions under 2000 tokens
|
|
74
|
+
4. Test agents after sync to verify behavior
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Installation Guide
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
- Python 3.9+
|
|
6
|
+
- Node.js 18+ (for npm installation)
|
|
7
|
+
- Codex CLI installed
|
|
8
|
+
|
|
9
|
+
## Install from Source
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
cd /home/vinhawk/claudekit-codex-sync
|
|
13
|
+
npm install -g .
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Verify Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
ck-codex-sync --help
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Basic Sync (from zip)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
ck-codex-sync
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Live Source Mode (from ~/.claude/)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
ck-codex-sync --source-mode live
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Include MCP Skills
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
ck-codex-sync --include-mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Dry Run
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
ck-codex-sync --dry-run
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Configuration
|
|
49
|
+
|
|
50
|
+
The tool automatically configures:
|
|
51
|
+
|
|
52
|
+
- `~/.codex/config.toml` - Codex configuration
|
|
53
|
+
- `~/.codex/agents/` - Agent definitions
|
|
54
|
+
- `~/.codex/skills/` - Skill definitions
|
|
55
|
+
- `~/.codex/prompts/` - Custom prompts
|
|
56
|
+
|
|
57
|
+
## Post-Install Verification
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Check multi-agent is enabled
|
|
61
|
+
codex features list | grep multi_agent
|
|
62
|
+
|
|
63
|
+
# Should show: multi_agent experimental true
|
|
64
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Project Overview — PDR
|
|
2
|
+
|
|
3
|
+
## Product
|
|
4
|
+
|
|
5
|
+
**claudekit-codex-sync** — CLI tool that syncs ClaudeKit configuration to OpenAI Codex CLI.
|
|
6
|
+
|
|
7
|
+
## Problem Statement
|
|
8
|
+
|
|
9
|
+
ClaudeKit users who also use Codex CLI face duplicate setup: re-configuring agents, skills, prompts, and paths. The two platforms use incompatible formats (ClaudeKit: Markdown agents with YAML frontmatter, Claude model names; Codex: TOML agents, GPT model names).
|
|
10
|
+
|
|
11
|
+
## Solution
|
|
12
|
+
|
|
13
|
+
A single-command sync tool that:
|
|
14
|
+
1. Copies all assets from `~/.claude/` → `~/.codex/`
|
|
15
|
+
2. Rewrites paths (`.claude` → `.codex`)
|
|
16
|
+
3. Converts agent definitions (`.md` → `.toml`)
|
|
17
|
+
4. Maps model names (`opus` → `gpt-5.3-codex`, `haiku` → `gpt-5.3-codex-spark`)
|
|
18
|
+
5. Configures multi-agent features and registers agent roles
|
|
19
|
+
|
|
20
|
+
## Target Users
|
|
21
|
+
|
|
22
|
+
ClaudeKit power-users who also use or are migrating to Codex CLI.
|
|
23
|
+
|
|
24
|
+
## Key Metrics
|
|
25
|
+
|
|
26
|
+
- Zero manual configuration needed after sync
|
|
27
|
+
- All synced agents load correctly in Codex
|
|
28
|
+
- No `.claude` path references remain in synced files
|
|
29
|
+
- 14+ agent roles with correct model assignments
|
|
30
|
+
|
|
31
|
+
## Status
|
|
32
|
+
|
|
33
|
+
**v0.1.0** — Functional. All core features implemented:
|
|
34
|
+
- [x] Live directory sync
|
|
35
|
+
- [x] Zip archive sync
|
|
36
|
+
- [x] Path normalization (37+ files per sync)
|
|
37
|
+
- [x] Agent .md → .toml conversion with model mapping
|
|
38
|
+
- [x] Multi-agent config (multi_agent + child_agents_md)
|
|
39
|
+
- [x] Agent registration (14 roles)
|
|
40
|
+
- [x] Prompt export (20+ prompts)
|
|
41
|
+
- [x] Dependency bootstrap
|
|
42
|
+
- [x] Runtime verification
|
|
43
|
+
- [ ] Full test coverage (11/~40 target tests)
|
|
44
|
+
- [ ] Idempotent re-sync (partial — registry exists but not fully wired)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Project Roadmap
|
|
2
|
+
|
|
3
|
+
## v0.1.0 — Initial Release ✅
|
|
4
|
+
|
|
5
|
+
**Status:** Complete
|
|
6
|
+
|
|
7
|
+
- [x] Project structure (modular Python, npm wrapper)
|
|
8
|
+
- [x] Dual source support (live directory + zip archive)
|
|
9
|
+
- [x] Path normalization (`.claude` → `.codex`)
|
|
10
|
+
- [x] Asset sync (agents, commands, rules, scripts)
|
|
11
|
+
- [x] Skill sync (54+ skills)
|
|
12
|
+
- [x] Agent .md → .toml conversion
|
|
13
|
+
- [x] Claude → Codex model mapping
|
|
14
|
+
- [x] Multi-agent config enforcement
|
|
15
|
+
- [x] Agent registration in config.toml
|
|
16
|
+
- [x] Prompt export
|
|
17
|
+
- [x] Dependency bootstrap
|
|
18
|
+
- [x] Runtime verification
|
|
19
|
+
- [x] Basic test suite (11 tests)
|
|
20
|
+
- [x] Documentation (README, architecture, code standards)
|
|
21
|
+
|
|
22
|
+
## v0.2.0 — Quality & Coverage
|
|
23
|
+
|
|
24
|
+
**Status:** Planned
|
|
25
|
+
|
|
26
|
+
- [ ] Full test coverage for all 13 modules
|
|
27
|
+
- [ ] Integration tests (end-to-end sync flow)
|
|
28
|
+
- [ ] Idempotent re-sync (skip unchanged files)
|
|
29
|
+
- [ ] `--respect-edits` fully wired (detect user modifications via SHA-256)
|
|
30
|
+
- [ ] Proper error messages for common failures
|
|
31
|
+
- [ ] `path_normalizer.py` refactor (currently 248 LOC, split conversion out)
|
|
32
|
+
|
|
33
|
+
## v0.3.0 — Distribution
|
|
34
|
+
|
|
35
|
+
**Status:** Planned
|
|
36
|
+
|
|
37
|
+
- [ ] PyPI package (alongside npm)
|
|
38
|
+
- [ ] CI/CD pipeline (GitHub Actions)
|
|
39
|
+
- [ ] Versioned releases with changelog
|
|
40
|
+
- [ ] Community contribution guide
|
|
41
|
+
- [ ] Cross-platform testing (Linux, macOS, WSL)
|
|
42
|
+
|
|
43
|
+
## v0.4.0 — Advanced Features
|
|
44
|
+
|
|
45
|
+
**Status:** Future
|
|
46
|
+
|
|
47
|
+
- [ ] Incremental sync (only changed files)
|
|
48
|
+
- [ ] Watch mode (auto-sync on file changes)
|
|
49
|
+
- [ ] Custom model mapping config (user-defined model overrides)
|
|
50
|
+
- [ ] MCP server migration support
|
|
51
|
+
- [ ] Bi-directional sync (Codex → ClaudeKit)
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# System Architecture
|
|
2
|
+
|
|
3
|
+
## High-Level Design
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
┌─────────────────────┐ ┌──────────────────────────┐
|
|
7
|
+
│ ClaudeKit Source │ │ Codex CLI Target │
|
|
8
|
+
│ ~/.claude/ │───▶│ ~/.codex/ │
|
|
9
|
+
│ agents/*.md │ │ agents/*.toml │
|
|
10
|
+
│ skills/*/SKILL.md │ │ skills/*/SKILL.md │
|
|
11
|
+
│ commands/ │ │ claudekit/commands/ │
|
|
12
|
+
│ rules/ │ │ claudekit/rules/ │
|
|
13
|
+
│ scripts/ │ │ claudekit/scripts/ │
|
|
14
|
+
│ prompts/ │ │ prompts/ │
|
|
15
|
+
└─────────────────────┘ │ config.toml │
|
|
16
|
+
│ AGENTS.md │
|
|
17
|
+
└──────────────────────────┘
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Component Architecture
|
|
21
|
+
|
|
22
|
+
### Pipeline Pattern
|
|
23
|
+
|
|
24
|
+
The sync follows a sequential pipeline with 8 stages:
|
|
25
|
+
|
|
26
|
+
1. **Source Resolution** (`source_resolver.py`) — Determine input type (live dir or zip)
|
|
27
|
+
2. **Asset Sync** (`asset_sync_dir.py` / `asset_sync_zip.py`) — Copy files with dedup
|
|
28
|
+
3. **Path Normalization** (`path_normalizer.py`) — Text replacement across all files
|
|
29
|
+
4. **Agent Conversion** (`path_normalizer.py`) — `.md` → `.toml` with model mapping
|
|
30
|
+
5. **Config Enforcement** (`config_enforcer.py`) — TOML config + agent registration
|
|
31
|
+
6. **Prompt Export** (`prompt_exporter.py`) — Generate Codex prompt files
|
|
32
|
+
7. **Dependency Bootstrap** (`dep_bootstrapper.py`) — Install Python/Node deps
|
|
33
|
+
8. **Runtime Verification** (`runtime_verifier.py`) — Health check
|
|
34
|
+
|
|
35
|
+
### Source Modes
|
|
36
|
+
|
|
37
|
+
| Mode | Input | Detection |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| `live` | `~/.claude/` directory | `--source-mode live` |
|
|
40
|
+
| `zip` | ClaudeKit export `.zip` | Scans cwd for zips |
|
|
41
|
+
| `auto` | Either | Prefers live if `--source-dir` set |
|
|
42
|
+
|
|
43
|
+
### Agent Conversion Pipeline
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
ClaudeKit .md (YAML frontmatter)
|
|
47
|
+
│ name: planner
|
|
48
|
+
│ model: opus
|
|
49
|
+
│ tools: Glob, Grep, Read, ...
|
|
50
|
+
│ ---
|
|
51
|
+
│ You are an expert planner...
|
|
52
|
+
▼
|
|
53
|
+
convert_agents_md_to_toml()
|
|
54
|
+
│ Parse YAML frontmatter
|
|
55
|
+
│ Map model: opus → gpt-5.3-codex
|
|
56
|
+
│ Set effort: xhigh
|
|
57
|
+
│ Set sandbox: workspace-write/read-only
|
|
58
|
+
▼
|
|
59
|
+
Codex .toml
|
|
60
|
+
│ model = "gpt-5.3-codex"
|
|
61
|
+
│ model_reasoning_effort = "xhigh"
|
|
62
|
+
│ sandbox_mode = "workspace-write"
|
|
63
|
+
│ developer_instructions = """..."""
|
|
64
|
+
▼
|
|
65
|
+
config.toml [agents.planner]
|
|
66
|
+
│ description = "..."
|
|
67
|
+
│ config_file = "agents/planner.toml"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Config.toml Structure
|
|
71
|
+
|
|
72
|
+
```toml
|
|
73
|
+
# Global settings
|
|
74
|
+
model = "gpt-5.3-codex"
|
|
75
|
+
model_reasoning_effort = "xhigh"
|
|
76
|
+
|
|
77
|
+
[features]
|
|
78
|
+
multi_agent = true
|
|
79
|
+
child_agents_md = true
|
|
80
|
+
|
|
81
|
+
[agents.planner]
|
|
82
|
+
description = "Expert planner for architecture and design"
|
|
83
|
+
config_file = "agents/planner.toml"
|
|
84
|
+
|
|
85
|
+
[agents.researcher]
|
|
86
|
+
description = "Technology researcher with read-only access"
|
|
87
|
+
config_file = "agents/researcher.toml"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Technology Stack
|
|
91
|
+
|
|
92
|
+
| Layer | Technology |
|
|
93
|
+
|---|---|
|
|
94
|
+
| CLI wrapper | Node.js (`bin/ck-codex-sync.js`) |
|
|
95
|
+
| Core logic | Python 3.12+ |
|
|
96
|
+
| Config format | TOML |
|
|
97
|
+
| Package manager | npm (distribution), pip (skill deps) |
|
|
98
|
+
| Testing | pytest |
|
|
99
|
+
| Target platform | OpenAI Codex CLI v0.105+ |
|
|
100
|
+
|
|
101
|
+
## Key Design Decisions
|
|
102
|
+
|
|
103
|
+
1. **Python core with Node wrapper** — Python for text processing strength; Node wrapper for `npm install -g` distribution via npm ecosystem.
|
|
104
|
+
2. **Text replacement strategy** — Uses ordered replacement tuples (not regex) for predictable, deterministic path rewriting. More specific patterns listed first to prevent partial matches.
|
|
105
|
+
3. **Model mapping at sync time** — Converts Claude model names to Codex equivalents during sync rather than at runtime, so Codex reads native model names.
|
|
106
|
+
4. **Dual source support** — Both live directory and zip modes allow CI/CD sync from exports and local dev sync from live Claude install.
|