Skip to content

jonashaag/agent-rules-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

agent-rules-sync

Small Python tool that compiles one allowlist config file into:

  • Claude settings.json permission blocks
  • Codex prefix_rule(...) rules
  • Cursor CLI permissions blocks

Source Config Format

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...>
  • ask maps to prompt behavior (prompt/ask depending on target)

Usage

Run from any directory:

python3 agent_rules_sync.py update \
  --config ./example_rules.conf

Check mode prints diffs and exits with code 1 when files are out of date:

python3 agent_rules_sync.py check ...

Marker Behavior

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.

Example Quick Start

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.conf

License

ISC

About

Single config to control coding agent allow lists

Resources

License

Stars

Watchers

Forks

Contributors

Languages