Add rule syncing to dual-tool agent configuration#163
Add rule syncing to dual-tool agent configuration#163Miyamura80 wants to merge 2 commits intomainfrom
Conversation
Extends the agent configuration sync system to handle path-scoped rules. Rules are mirrored from .claude/rules/ (source of truth) to .agents/rules/ via symlinks, with the sync direction inverted from skills since Claude is the only tool that auto-discovers rules. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review Summary by QodoAdd rule syncing to dual-tool agent configuration
WalkthroughsDescription• Adds rule syncing to agent configuration system via symlinks • Mirrors .claude/rules/ to .agents/rules/ with inverted direction • Updates rule documentation with globs: frontmatter guidance • Adds new-agent-rule skill for creating path-scoped rules Diagramflowchart LR
A[".claude/rules/<name>.md"] -->|source of truth| B["sync_rule_symlinks()"]
B -->|creates symlinks| C[".agents/rules/<name>.md"]
D["manage-agent-config skill"] -->|updated docs| E["Rule creation guidance"]
F["new-agent-rule skill"] -->|new| G["Rule writing guide"]
File Changes1. scripts/sync_agent_config.py
|
Code Review by Qodo
1. codex-claude-sync.md uses hyphen
|
There was a problem hiding this comment.
3 issues found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="scripts/sync_agent_config.py">
<violation number="1" location="scripts/sync_agent_config.py:228">
P2: Missing safety check for empty source directory. If `.claude/rules/` doesn't exist (sparse checkout) the script creates it empty, then the pruning loop deletes all existing symlinks in `.agents/rules/`. Add a guard analogous to `sync_skill_symlinks`' `if not shared_existed and not wanted: return changes`.</violation>
<violation number="2" location="scripts/sync_agent_config.py:247">
P2: Missing error handling for `symlink_to` call. The existing `_materialize_symlink` helper catches `OSError`/`NotImplementedError` and provides a helpful Windows-specific message. Wrap this call consistently to avoid an unhelpful traceback on systems where symlink creation fails.</violation>
</file>
<file name=".agents/skills/manage-agent-config/SKILL.md">
<violation number="1" location=".agents/skills/manage-agent-config/SKILL.md:3">
P2: Description exceeds the ≤250 character limit for shared skills (257 chars). Consider abbreviating, e.g., collapsing the path list or shortening the trailing clause.</violation>
</file>
Partial review: This PR has more than 50 files, so cubic reviewed the highest-priority files first. During the trial, paid plans get a higher file limit.
You can try an ultrareview to bypass the file limit, comment @cubic-dev-ai ultrareview. Learn more.
Fix all with cubic.
| @@ -0,0 +1 @@ | |||
| ../../.claude/rules/codex-claude-sync.md No newline at end of file | |||
There was a problem hiding this comment.
1. codex-claude-sync.md uses hyphen 📘 Rule violation ✧ Quality
A new rule file is introduced with a hyphenated filename (codex-claude-sync.md), which is not snake_case. This violates the repository naming convention and can break tooling that expects snake_case basenames.
Agent Prompt
## Issue description
A newly added rule file uses a hyphenated filename (`codex-claude-sync.md`), violating the snake_case naming requirement.
## Issue Context
Rule syncing mirrors `.claude/rules/<name>.md` into `.agents/rules/<name>.md`, so renaming should keep both sides consistent and update any references.
## Fix Focus Areas
- .agents/rules/codex-claude-sync.md[1-1]
- .claude/rules/codex-claude-sync.md[1-6]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
Invalid. The filename codex-claude-sync.md follows the cross-repo convention established in Edison-OS and all template repos. Renaming would break sync script assumptions and git history across repositories.
| --- | ||
| name: manage-agent-config | ||
| description: Use whenever creating, editing, renaming, or deleting any file under .claude/skills/, .claude/agents/, .agents/skills/, or .codex/agents/. Teaches the dual-tool Claude/Codex layout and reminds to run `make sync-agent-config`. | ||
| description: Use whenever creating, editing, renaming, or deleting any file under .claude/skills/, .claude/agents/, .claude/rules/, .agents/skills/, .agents/rules/, or .codex/agents/. Teaches the dual-tool Claude/Codex layout and reminds to run 'make sync-agent-config'. |
There was a problem hiding this comment.
2. Single quotes in description 📘 Rule violation ✧ Quality
The updated YAML frontmatter description uses single quotes around make sync-agent-config. This violates the requirement to use double quotes for string literals in modified files.
Agent Prompt
## Issue description
A modified YAML frontmatter line uses single quotes around `make sync-agent-config`, violating the double-quote-only rule for string literals.
## Issue Context
This is in the `description:` field of the SKILL frontmatter.
## Fix Focus Areas
- .agents/skills/manage-agent-config/SKILL.md[3-3]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
Addressed. The description has been rewritten to stay within the 250-char limit, which also resolves the quoting concern.
…or handling - Shorten manage-agent-config description to <=250 chars - Add sparse-checkout safety guard to sync_rule_symlinks() - Add OSError/NotImplementedError handling to sync_rule_symlinks() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
sync_rule_symlinks()toscripts/sync_agent_config.py-- mirrors.claude/rules/to.agents/rules/via symlinks.claude/rules/codex-claude-sync.mdfrontmatter frompaths:toglobs:and documents rule sync directionmanage-agent-configskill decision treenew-agent-ruleskill for creating path-scoped rulesTest plan
make sync-agent-configand verify.agents/rules/codex-claude-sync.mdsymlink existsmake sync-agent-config --checkand verify it exits 0 (no drift)🤖 Generated with Claude Code
Summary by cubic
Adds rule syncing to the dual-tool agent config.
.claude/rules/*.mdare now mirrored to.agents/rules/via symlinks, useglobs:, and the sync adds safety checks and clearer errors.New Features
.claude/rules/to.agents/rules/via symlinks;.claude/rules/is the source of truth..agents/rules/.globs:; updatesmanage-agent-configand adds thenew-agent-ruleskill.Migration
globs:(notpaths:) in rule frontmatter..claude/rules/only; do not edit.agents/rules/..agents/rules/that clash with.claude/rules/.make sync-agent-config(ormake sync-agent-config --checkto verify no drift).Written for commit 8cfe07d. Summary will update on new commits.