Add sync-agents script for cross-tool AI agent configuration#5
Conversation
…ENTS.md AGENTS.md is the single source of truth for AI agent instructions. This script generates CLAUDE.md (for Claude Code) and .cursor/rules/*.mdc (for Cursor) so directory-scoped instructions work across all three tools. The pre-commit hook runs it automatically when any AGENTS.md file is staged. Made-with: Cursor
- Sync .agents/skills/ to .claude/skills/ so skills work across Codex, Cursor, and Claude Code from a single source directory. - Make sync-agents skip work when generated files are already up to date. - Add --git-add flag to stage generated files, keeping all sync logic self-contained. Simplify the pre-commit hook to a one-liner. - Add skeleton skill for custom container view controllers. Made-with: Cursor
Cursor added native support for nested AGENTS.md files in subdirectories, so the script no longer needs to generate .cursor/rules/*.mdc files. The sync-agents script now only handles CLAUDE.md and .claude/skills/. Made-with: Cursor
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41ef94b811
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…nvention - Use exact full-line match (grep -qxF) for the CLAUDE.md cleanup marker instead of substring matching, preventing accidental deletion of hand- written files that happen to contain the phrase. - Stage only files that actually changed instead of globbing all CLAUDE.md files in the repo, avoiding accidental commit contamination. - Add convention to AGENTS.md: shell scripts should stay short (~20 lines), use Ruby for longer scripts. Made-with: Cursor
- Trim directory trees to show only directories and key files, remove individual source file listings that go stale as files are added. - Move module-specific context into nested AGENTS.md files for BroadwayCore, BroadwayUI, and BroadwayCatalog. - Replace tree-drawing characters with plain text across the codebase. Made-with: Cursor
Made-with: Cursor
…skills Rewrite the bash script in Ruby for readability and portability (per the project convention for scripts > 20 lines). All existing behavior is preserved: incremental sync, marker-based cleanup, and --git-add. New commands: - --install <github-url> [name]: clone a skill from GitHub into .agents/skills/ and record it in .agents/external-skills.json - --update: re-fetch all external skills from their pinned refs Install the SwiftUI Pro skill from twostraws/swiftui-agent-skill as the first external skill. Made-with: Cursor
- Rename --install to --add (adds a new skill from a GitHub URL) - New --install fetches all external skills from the manifest, skipping any already present (idempotent, like npm ci) - --update force re-fetches all external skills to latest - Gitignore external skills in .agents/skills/ via a generated .gitignore managed from the manifest; gitignore all of .claude/skills/ - Run ./sync-agents --install in ./ide so skills are fetched on setup Made-with: Cursor
Generated CLAUDE.md and .claude/skills/ are now fully gitignored and recreated by ./sync-agents (run automatically by ./ide). Update AGENTS.md to document all sync-agents commands. Made-with: Cursor
--add now resolves HEAD to a commit SHA and writes that to the manifest instead of "main". --update clones the default branch, compares the new SHA to the pinned one, and only re-fetches if it changed. --install fetches the exact pinned SHA. Use git-fetch instead of git-clone to support both branch names and commit SHAs. Made-with: Cursor
Document all sync-agents commands in the script header. Rewrite the README to explain the full setup flow, pre-commit hooks, and how to manage external AI agent skills. Made-with: Cursor
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2500b51e46
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Document the two patterns: non-lazy single child containers (add child in init, view in viewDidLoad, layout in viewWillLayoutSubviews) and lazy single child containers (setup in viewIsAppearing). Made-with: Cursor
Address Codex review: use clone_default_branch (fetches HEAD) instead of hardcoding "main" in --add/--update, and include dotfiles in dirs_equal? via FNM_DOTMATCH so .claude/skills/ stays in sync. Made-with: Cursor
Summary
Adds a
sync-agentsscript (Ruby) that keeps AI agent configuration in sync across Cursor, Codex, and Claude Code from a single source of truth (AGENTS.mdfiles and.agents/skills/).What it does:
CLAUDE.mdfrom eachAGENTS.md(Cursor and Codex readAGENTS.mdnatively)..agents/skills/to.claude/skills/for Claude Code..agents/external-skills.json.Commands:
./sync-agents— generate CLAUDE.md files and sync skills./sync-agents --add <url> [name]— add an external skill from GitHub, pinned to the current commit./sync-agents --install— fetch all external skills from the manifest (skips if present)./sync-agents --update— re-fetch all external skills at latest commit./sync-agents --git-add— sync + stage changed files (used by pre-commit hook)Other changes:
AGENTS.mdandREADME.md; move module-specific details into nestedAGENTS.mdfiles for BroadwayCore, BroadwayUI, and BroadwayCatalog.Plans/directory.CLAUDE.md,.claude/skills/, external skills) are gitignored../ideruns./sync-agents --installto populate them on setup../sync-agents --git-addand SwiftFormat automatically.Test plan
./ide— verify CLAUDE.md files and skills are generated./sync-agentswith no changes — verify silent no-opAGENTS.md, run./sync-agents— verify corresponding CLAUDE.md updatesAGENTS.md, run./sync-agents— verify CLAUDE.md createdAGENTS.md, run./sync-agents— verify stale CLAUDE.md cleaned up./sync-agents --install— verify external skills fetched from manifest./sync-agents --installagain — verify it skips already-present skills./sync-agents --update— verify skills re-fetched and SHA updated./sync-agents --updateagain — verify no-op when already at latestAGENTS.md— verify pre-commit hook stages generated files