agentleFS
flonatflonat/flonat-research/skills/sync-permissions/SKILL.md

sync-permissions

Skill150 starsChanged 12 days agoMITView on GitHub

Reconcile the current project's Claude and Codex permission surfaces with the canonical global policy. Use when project permissions are missing, stale, or inconsistent after setup or migration. Not for syncing skills, hooks, or agents; use $sync-ai-infra.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. About 0 are common, 14 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After adding new permissions to ~/.claude/settings.json

    line 18
  2. Distinctive:

    When starting work in a project that hasn't been updated in a while

    line 19
  3. Distinctive:

    After creating a new skill and wanting it available everywhere

    line 20
  4. Distinctive:

    When the user says "sync permissions", "update rules", "update my permissions"

    line 21
  5. Distinctive:

    Never removes existing project permissions (additive only)

    line 32
  6. Very specific:

    Never modifies ~/.claude/settings.json (reads it, never writes)

    line 33
  7. Very specific:

    Never touches model, hooks, or other global settings keys

    line 34
  8. Distinctive:

    Read these two files:

    line 42
  9. Distinctive:

    If the local file doesn't exist, create it with global permissions (same as the SessionStart hook).

    line 46
  10. Distinctive:

    Start with all existing local permissions (preserve everything)

    line 51
  11. Distinctive:

    Add any global permissions not already present in local

    line 52
  12. Distinctive:

    If there are new permissions to add:

    line 63
  13. Distinctive:

    Read the full local settings file (preserve any non-permissions keys)

    line 64
  14. Very specific:

    Write back to .claude/settings.local.json

    line 66
  15. Distinctive:

    If no new permissions, skip the write.

    line 68
  16. Very specific:

    Check that <skills-root>/ exists and has content:

    line 72
  17. Distinctive:

    If missing or empty, warn: "Skills directory missing — run the documented managed-copy installer or deployment command"

    line 73
  18. Distinctive:

    If present, report file count

    line 74
  19. Distinctive:

    If missing or empty, warn: "Agents directory missing — run the documented managed-copy installer or deployment command"

    line 79

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Update Rules Skill

Sync global permissions, skills, and agents into the current project without losing project-specific settings.

Purpose

The SessionStart hook only copies permissions when .claude/settings.local.json doesn't exist yet. After that, new global permissions never propagate to existing projects. This skill fills that gap — run it anytime to pull in new permissions additively.

When to Use

  • After adding new permissions to ~/.claude/settings.json
  • When starting work in a project that hasn't been updated in a while
  • After creating a new skill and wanting it available everywhere
  • When the user says "sync permissions", "update rules", "update my permissions"

What It Does

  1. Merge permissions — adds global permissions into project-local, keeping any project-specific ones
  2. Verify skills directory — ensures <skills-root>/ exists and has content
  3. Verify agents directory — ensures ~/.claude/agents/ exists and has content
  4. Report changes — shows exactly what was added

What It Does NOT Do

  • Never removes existing project permissions (additive only)
  • Never modifies ~/.claude/settings.json (reads it, never writes)
  • Never touches model, hooks, or other global settings keys

Workflow

Step 1: Read Both Permission Files

Read these two files:

  • Global: ~/.claude/settings.json → extract permissions.allow array
  • Local: .claude/settings.local.json → extract permissions.allow array

If the local file doesn't exist, create it with global permissions (same as the SessionStart hook).

Step 2: Compute the Union

Merge the two permission arrays:

  • Start with all existing local permissions (preserve everything)
  • Add any global permissions not already present in local
  • Sort the final array for readability

The merge logic:

new_permissions = local_permissions ∪ global_permissions
added = new_permissions - local_permissions

Step 3: Write the Merged Result

If there are new permissions to add:

  1. Read the full local settings file (preserve any non-permissions keys)
  2. Replace permissions.allow with the merged array
  3. Write back to .claude/settings.local.json

If no new permissions, skip the write.

Step 4: Verify Skills Directory

Check that <skills-root>/ exists and has content:

  • If missing or empty, warn: "Skills directory missing — run the documented managed-copy installer or deployment command"
  • If present, report file count

Step 5: Verify Agents Directory

Check that ~/.claude/agents/ exists and has content:

  • If missing or empty, warn: "Agents directory missing — run the documented managed-copy installer or deployment command"
  • If present, report file count

Step 6: Report

Output a summary:

Permissions sync complete:
- Global permissions: [N]
- Local permissions (before): [N]
- New permissions added: [N] — [list them]
- Local permissions (after): [N]
- Skills directory: ✓ [N] files / ✗ missing
- Agents directory: ✓ [N] files / ✗ missing

If nothing changed:

Everything up to date. No new permissions to add. Skills OK. Agents OK.

Example

Running sync-permissions after adding web fetch and Skill(literature) to ~/.claude/settings.json:

Permissions sync complete:
- Global permissions: 25
- Local permissions (before): 64
- New permissions added: 2 — web fetch, Skill(literature)
- Local permissions (after): 66
- Skills directory: ✓ 496 files
- Agents directory: ✓ 16 files

Safety

  • Additive only — the skill can only add permissions, never remove them
  • No global writes — global settings are read-only
  • Directory check — verifies skills/agents directories exist and have content
  • Idempotent — safe to run multiple times; re-running with no changes produces no writes

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.