Sync Claude and Codex skills & subagents#157
Conversation
Ports the sync-agent-config setup so shared skills live at `.agents/skills/<name>/SKILL.md` with a `.claude/skills/` symlink, and Claude subagents at `.claude/agents/<name>.md` generate matching `.codex/agents/<name>.toml`. Adds `make sync-agent-config`, a prek hook using `--check` mode for drift detection, and a meta-skill + rule doc explaining the layout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review Summary by QodoImplement dual-tool Claude/Codex skill and subagent sync
WalkthroughsDescription• Implements dual-tool Claude/Codex skill and subagent synchronization • Shared skills at .agents/skills/ auto-discovered by both tools via symlinks • Claude subagents (.claude/agents/*.md) generate Codex TOML configs automatically • Pre-commit hook validates sync state; make sync-agent-config regenerates artifacts • Adds meta-skill and documentation for contributor guidance on shared layout Diagramflowchart LR
shared[".agents/skills/SKILL.md<br/>(shared source)"]
claude_link[".claude/skills/<br/>(symlink)"]
claude_agent[".claude/agents/*.md<br/>(source of truth)"]
codex_agent[".codex/agents/*.toml<br/>(generated)"]
script["sync_agent_config.py<br/>(converter)"]
shared -- "symlink" --> claude_link
claude_agent -- "render_toml()" --> script
script -- "write" --> codex_agent
script -- "create" --> claude_link
File Changes1. scripts/sync_agent_config.py
|
Code Review by Qodo
|
AI writing CI check rejects U+2014. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Bump `requires-python` in PEP 723 metadata from 3.11 to 3.12 so it matches the repo-wide Python 3.12 requirement. - Enforce `isinstance(meta, dict)` after `yaml.safe_load` so malformed frontmatter yields a clear error instead of AttributeError blocking the pre-commit hook. - Wrap `Path.symlink_to` in try/except for OSError/NotImplementedError so environments without symlink privileges (e.g. Windows without Developer Mode) get an actionable message instead of a raw traceback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Ports the dual-tool sync setup from edison-watch#636, adapted for this repo.
.agents/skills/<name>/SKILL.md— Codex auto-discovers them; Claude sees them via symlinks under.claude/skills/..claude/agents/*.md;make sync-agent-configregenerates.codex/agents/*.tomlwith Claude-only frontmatter (tools,model,color) preserved as TOML comments.manage-agent-configmeta-skill +.claude/rules/codex-claude-sync.mddocument the layout and shared-frontmatter rules for future contributors.localhooks block inprek.toml.Nuances relative to edison-watch#636
1. Target name is
sync-agent-config(matches the upstream target after its rename; this repo had no conflict so the choice is consistent with the current upstream name).2. Pre-commit hook uses a content-based
--check, not a porcelain compare.scripts/sync_agent_config.pyalways writes changes but exits non-zero in--checkmode when any were made — same pattern asruff --fix --exit-non-zero-on-fix.make sync-agent-configretains exit-0 semantics for manual invocations.3. Repo-specific adaptations:
[tool.ty.src] exclude = ["scripts/sync_agent_config.py"]since the script relies on PEP 723 inline deps.tomli-wto project dependencies so deptry is satisfied (the script imports it at runtime).localhooks array inprek.tomlrather than a new[[repos]]block, matching this repo's style..gitignoreunchanged.4. CRLF-safe body extraction.
parse_mdusesre.sub(r"^(?:\r?\n)+", "", ...)instead oflstrip("\n")so CRLF files don't leave a leading\r\nin the generated TOML (which would cause--checkto flap between Unix and Windows developers).Test plan
prek install, verify the hook fires on commit.allowed-tools:) →make sync-agent-configerrors with a clear message..claude/agents/foo.md→make sync-agent-configgenerates.codex/agents/foo.toml..md→make sync-agent-configprunes the orphan.toml..toml(simulate drift), commit → hook exits 1 and tells you to re-stage.🤖 Generated with Claude Code