Skip to content

Configuration

Patchwork has three levels of configuration, each overriding the one above it.

Policy Levels

LevelPathWho controls it
System/Library/Patchwork/policy.yml (macOS)System admin (root)
User~/.patchwork/policy.ymlThe developer
Project.patchwork/policy.yml (in project root)The team (via git)

Lower levels cannot weaken higher levels. A project policy can add restrictions but can't remove system-level blocks.

Creating a Policy

bash
# Generate a default policy file
patchwork policy init

# Edit it
patchwork policy edit

Or create ~/.patchwork/policy.yml manually:

yaml
version: 1
mode: fail-closed

rules:
  files:
    deny:
      - "**/.env"
      - "**/.env.*"
      - "**/id_rsa"
      - "**/credentials.json"
    allow:
      - "src/**"
      - "tests/**"

  commands:
    deny:
      - "rm -rf *"
      - "git push --force*"
      - "sudo *"
      - "curl * | bash"
    allow:
      - "npm test"
      - "npm run *"
      - "git *"

  network:
    deny:
      - "*.internal.*"
      - "169.254.*"
    allow:
      - "*"

  mcp_tools:
    deny: []
    allow:
      - "*"

  max_risk: high  # Block critical actions automatically

See the Policy Schema Reference for the full specification.

Relay Configuration

The relay daemon is configured at /Library/Patchwork/relay-config.json (root-owned):

json
{
  "auto_seal": {
    "enabled": true,
    "interval_minutes": 15,
    "min_events_between_seals": 1
  },
  "witness": {
    "enabled": false,
    "endpoints": [],
    "quorum": 1
  }
}

See Seals & Witnesses for how to configure witness endpoints.

Hook Profiles

When running patchwork init, you can choose a security profile:

ProfileWhat it enables
--strict-profileAll layers: hash chain, relay, heartbeat, auto-seal, signing proxy
(default)Hash chain and basic logging only
--policy-mode fail-closedUnknown actions are blocked
--policy-mode fail-openUnknown actions are allowed but logged
--pretool-fail-closedPre-tool hooks block on any error (safest)

Environment Variables

VariablePurpose
PATCHWORK_SYSTEM_POLICY_PATHOverride system policy location
PATCHWORK_HOMEOverride ~/.patchwork data directory
PATCHWORK_LOG_LEVELSet logging verbosity (debug, info, warn, error)

Next Steps

Released under the BUSL-1.1 License.