{
  "$schema": "https://raw.githubusercontent.com/gotgenes/pi-packages/main/packages/pi-permission-system/schemas/permissions.schema.json",
  "debugLog": false,
  "permissionReviewLog": true,
  "yoloMode": false,
  "toolInputPreviewMaxLength": 400,
  "toolTextSummaryMaxLength": 120,
  "piInfrastructureReadPaths": [],
  "permission": {
    "*": "allow",

    "path": {
      "*": "allow",

      "*.env": "deny",
      "*.env.*": "deny",
      "*.env.example": "allow",
      "*.env.sample": "allow",
      "*.env.template": "allow",

      "~/.ssh/*": {
        "action": "deny",
        "reason": "SSH keys and configuration are outside the agent's normal scope."
      },
      "~/.aws/*": {
        "action": "deny",
        "reason": "AWS configuration may contain credentials."
      },
      "~/.config/gcloud/*": {
        "action": "deny",
        "reason": "Google Cloud configuration may contain credentials."
      },
      "~/.kube/*": {
        "action": "deny",
        "reason": "Kubernetes configuration may contain cluster credentials."
      },

      "~/.netrc": "deny",
      "~/.npmrc": "deny",
      "~/.pypirc": "deny",
      "~/.git-credentials": "deny",
      "~/.docker/config.json": "deny",

      "*.pem": {
        "action": "deny",
        "reason": "PEM files frequently contain private keys or credentials."
      },
      "*.key": {
        "action": "deny",
        "reason": "Key files should not be accessed automatically."
      },
      "*credentials*.json": {
        "action": "deny",
        "reason": "Credential files should not be exposed to the agent."
      },
      "*service-account*.json": {
        "action": "deny",
        "reason": "Service-account files commonly contain private credentials."
      }
    },

    "read": "allow",
    "find": "allow",
    "grep": "allow",
    "ls": "allow",

    "write": "allow",
    "edit": "allow",

    "external_directory": {
      "*": "ask",

      "~/.cache/*": "allow",
      "~/.npm/_cacache/*": "allow",
      "~/.cargo/registry/*": "allow",
      "~/go/pkg/mod/*": "allow"
    },

    "bash": {
      "*": "allow",

      "pwd": "allow",
      "printf *": "allow",
      "echo *": "allow",
      "which *": "allow",
      "command -v *": "allow",

      "git status": "allow",
      "git status *": "allow",
      "git diff": "allow",
      "git diff *": "allow",
      "git log": "allow",
      "git log *": "allow",
      "git show": "allow",
      "git show *": "allow",
      "git branch": "allow",
      "git branch --show-current": "allow",
      "git rev-parse *": "allow",
      "git ls-files": "allow",
      "git ls-files *": "allow",

      "git add *": "allow",
      "git commit *": "allow",
      "git push *": "ask",
      "git pull *": "allow",
      "git fetch *": "ask",
      "git checkout *": "allow",
      "git switch *": "allow",
      "git restore *": "allow",
      "git rebase *": "allow",
      "git merge *": "allow",

      "git push --force *": {
        "action": "deny",
        "reason": "Force-pushing can overwrite remote history."
      },
      "git push --force-with-lease *": "ask",
      "git reset --hard *": {
        "action": "deny",
        "reason": "A hard reset can irreversibly discard uncommitted work."
      },
      "git clean *": {
        "action": "deny",
        "reason": "Git clean can irreversibly delete untracked files."
      },

      "rm -rf *": {
        "action": "deny",
        "reason": "Recursive forced deletion is disabled in the bootstrap policy."
      },
      "rm -fr *": {
        "action": "deny",
        "reason": "Recursive forced deletion is disabled in the bootstrap policy."
      },
      "sudo *": {
        "action": "deny",
        "reason": "Privileged commands should be run manually."
      },
      "su *": "deny",
      "chmod -R *": "ask",
      "chown *": "deny",
      "mkfs *": "deny",
      "dd *": "deny",
      "shutdown *": "deny",
      "reboot *": "deny",

      "curl *": "allow",
      "wget *": "allow",
      "ssh *": "ask",
      "scp *": "ask",
      "rsync *": "ask",

      "npm publish *": "deny",
      "pnpm publish *": "deny",
      "yarn publish *": "deny",
      "cargo publish *": "deny",
      "twine upload *": "deny",

      "npm install *": "allow",
      "npm i *": "allow",
      "pnpm install *": "allow",
      "pnpm add *": "allow",
      "yarn install *": "allow",
      "yarn add *": "allow",
      "pip install *": "allow",
      "pip3 install *": "allow",
      "uv add *": "allow",
      "cargo add *": "allow"
    },

    "mcp": {
      "*": "ask",
      "mcp_status": "allow",
      "mcp_list": "allow",
      "mcp_search": "allow",
      "mcp_describe": "allow",
      "mcp_connect": "ask"
    },

    "skill": {
      "*": "allow"
    },

    "task": "allow"
  }
}
