{
  "description": "agent-sync — ADVISORY lease guard and run lifecycle. The PreToolUse guard covers exactly the mutation surfaces a Claude Code matcher can name: Edit, Write, MultiEdit, NotebookEdit, a Bash `git commit` (parsed for compound/`-C`/env forms, and checked with what the same command stages: `git add X && git commit`, `git commit -a`), and Bash writes by redirect, `tee`, `sed -i`, `cp` and `mv` (parsed by scripts/bash_writes.py in every session and checked in the repository that owns each target; `$VAR` targets are skipped). It is NOT a sandbox: a language-runtime write (Python write_text), `perl -i` or `awk` is OUTSIDE the boundary and is not enforced — see the capability matrix in guard.sh. Real enforcement needs a trusted mutation API, an isolated worktree, or OS controls with resource locks, not a shell parser. The Bash group carries NO `if` filter on purpose: guard.sh does its own narrowing — to a payload carrying a write shape, then to one carrying `commit`. A group-level `if` is not a key Claude Code knows (it is ignored and, from 2.1.270, reported as unknown), and a handler-level one would skip the `git -C`, env-prefixed and compound forms the parser covers. The lifecycle hooks exit 0 immediately when the session's project has no .claude/agent-sync.json and the session holds no lease in another repository; renew and SessionEnd also act in each other repository this session took a lease in (AS-07); the guard is decided by the repository that OWNS the write (the git toplevel of the edited file, or the repository a commit targets) and exits 0 when that repository has no config, so installing the plugin globally changes nothing in repositories that do not use it.",
  "hooks": {
    "SessionStart": [
      {
        "matcher": "startup|resume|clear",
        "hooks": [
          {
            "type": "command",
            "shell": "bash",
            "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh\"",
            "timeout": 20
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Edit|Write|MultiEdit|NotebookEdit",
        "hooks": [
          {
            "type": "command",
            "shell": "bash",
            "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/guard.sh\"",
            "timeout": 20
          }
        ]
      },
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "shell": "bash",
            "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/guard.sh\"",
            "timeout": 20
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "shell": "bash",
            "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/renew.sh\"",
            "timeout": 15,
            "async": true
          }
        ]
      }
    ],
    "SessionEnd": [
      {
        "hooks": [
          {
            "type": "command",
            "shell": "bash",
            "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/session-end.sh\"",
            "timeout": 3
          }
        ]
      }
    ]
  }
}
