Small Python tool that compiles one allowlist config file into:
- Claude
settings.jsonpermission blocks - Codex
prefix_rule(...)rules - Cursor CLI
permissionsblocks
Rules are line-based:
## Group name
allow shell "git status"
ask shell "git push"
deny shell "rm -rf"
allow web_fetch "docs.python.org"
- Group headers start with
## - Comments start with
# - Rule format:
<allow|deny|ask> <shell|web_fetch> <value...> askmaps to prompt behavior (prompt/askdepending on target)
Run from any directory:
python3 agent_rules_sync.py update \
--config ./example_rules.confCheck mode prints diffs and exits with code 1 when files are out of date:
python3 agent_rules_sync.py check ...The script only rewrites generated blocks between markers:
- Claude JSON lists:
--- BEGIN GENERATED: <marker> ---/--- END GENERATED: <marker> --- - Codex rules file:
# BEGIN GENERATED: <marker>/# END GENERATED: <marker> - Cursor JSON lists: synthetic shell marker tokens
Default marker name is agent_rules_sync. Change it with --marker-name.
mkdir -p demo/.claude demo/.codex/rules demo/.cursor
cp example_rules.conf demo/agent_rules.conf
python3 agent_rules_sync.py update \
--config demo/agent_rules.confISC