Sync permissions

From flonat/flonat-research · View interactive version

Sync permissions is an AI agent skill from the GitHub repository flonat/flonat-research. 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.

How to use this skill

Skill file

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

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


Workflow

Step 1: Read Both Permission Files

Read these two files:

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:

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:

Step 5: Verify Agents Directory

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

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

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.