:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
# Stamphog merge-gate policy, the shipped default.
#
# The engine ships this file and merges a repository's default-branch `.stamphog/policy.yml` onto
# it (`merge_policy` in policy.py): mappings merge key by key, a list a repository declares
# replaces this one, and an `extend_<list>` key appends to it. A repository with no policy.yml
# reviews under this file as-is. Keep pattern scalars single-quoted so regex backslashes survive
# YAML parsing. Thresholds match stamphog's backtested defaults; patterns are generic (no
# repo-specific paths).
version: 1
deny:
auth:
description: 'Authentication and authorization surfaces.'
rationale: 'Auth/authz changes need human review. Path patterns hard-deny; the title words surface as scrutiny flags rather than hard denials, since they match too broadly in titles and non-auth paths.'
match:
any:
- 'auth'
- 'login'
- 'signup'
- 'oauth'
- 'saml'
- 'sso'
- 'oidc'
- 'credential'
- 'password'
- '2fa'
- 'mfa'
- 'authentication'
- 'authenticate'
- 'authorize'
- 'authorization'
- 'two[_-]?factor'
titles:
- 'authenticated'
- 'authorized'
paths:
- 'session_auth'
- 'session_token'
- 'auth/session'
- 'auth/token'
- 'permission'
crypto_secrets:
description: 'Cryptography, secrets, and key material.'
rationale: 'key/secret/cert/signing words are too broad for titles (key matches keyboard, hotkey, storage key), so they are path-only with compound patterns.'
match:
any:
- 'crypto'
- 'encrypt'
- 'decrypt'
- 'vault'
paths:
- 'secret'
- 'api[_-]?key'
- 'secret[_-]?key'
- 'private[_-]?key'
- 'signing[_-]?key'
- 'certificate'
- '\.env'
- '\.pem'
migrations:
description: 'Database and schema migrations.'
rationale: 'Schema and data migrations always need human review.'
match:
paths:
- 'migrations/'
- 'schema_change'
infra_cicd:
description: 'Infrastructure, CI, and deployment artifacts.'
rationale: 'CI, deploy, and infra config changes need human review. Deploy literals stay narrow (bin/deploy, deploy.sh) to avoid matching app-level routing/deploy-timing code.'
match:
any:
- 'terraform'
- 'kubernetes'
- 'helm'
paths:
- 'k8s'
- 'dockerfile'
- 'docker-compose'
- '\.github/workflows'
- 'iam'
- 'cloudflare'
- 'cdn'
- 'waf'
- '(?:^|/)bin/deploy'
- 'deploy\.sh'
billing:
description: 'Payments and billing.'
rationale: 'Payment and plan logic needs human review.'
match:
any:
- 'billing'
- 'payment'
- 'stripe'
- 'invoice'
- 'pricing'
public_api:
description: 'Public API contracts and schemas.'
rationale: 'Changes to the published API surface need human review.'
match:
any:
- 'openapi'
- 'api_schema'
- 'swagger'
- 'public_api'
deps_toolchain:
description: 'Dependency lockfiles and toolchain/build files.'
rationale: 'Lockfile and toolchain changes can pull in third-party code or change the build/runtime, so they need human review. Manifests without a lockfile change are guarded by the reviewer prompt instead.'
# NOTE: partially code-sourced. The lockfile-name path patterns are derived in the loader from
# the engine's dependency-ecosystem table (re.escape over every ecosystem's lockfiles) and
# spliced in ahead of the literals below — do not copy them here.
match:
paths:
- 'requirements[-\w]*\.(txt|in)'
- 'Makefile'
- 'Dockerfile'
- '\.tool-versions'
- '\.nvmrc'
stamphog_policy:
description: "Stamphog's own policy files, engine, and gate inputs."
rationale: 'The merge gate cannot be trusted to approve edits to its own policy or engine, so every change to them routes to a human. Ownership files (CODEOWNERS) are gate inputs: an edit changes which team the reviewer treats as owning future PRs.'
match:
paths:
- '\.stamphog/'
- 'AGENT_APPROVALS\.md'
- 'pr-approval-agent/'
# Kept next to the location-agnostic pattern above. The engine that
# validates this file ships in the server image, so a deploy that still
# runs the previous engine needs this exact literal.
- 'tools/pr-approval-agent/'
- 'CODEOWNERS'
allow:
path_patterns:
- 'docs/'
- 'README'
- 'CHANGELOG'
- 'LICENSE'
- 'CONTRIBUTING'
- '.gitignore'
- '.editorconfig'
- 'generated/'
- '__snapshots__/'
extensions_only:
- '.cfg'
- '.csv'
- '.gif'
- '.ico'
- '.ini'
- '.jpeg'
- '.jpg'
- '.json'
- '.lock'
- '.md'
- '.mdx'
- '.png'
- '.rst'
- '.snap'
- '.svg'
- '.toml'
- '.txt'
- '.webp'
- '.yaml'
- '.yml'
size_gate:
max_lines: 1200
max_files: 50
tiers:
t1_subclasses:
T1a-trivial:
max_lines: 20
max_files: 3
breadth: 'single-area'
T1b-small:
max_lines: 100
max_files: 5
breadth: 'not-cross-cutting'
T1c-medium:
max_lines: 300
max_files: 15
breadth: 'not-cross-cutting'
overrides:
'size_gate.max_files':
ceiling: 75
'size_gate.max_lines':
ceiling: 1500
# Author-familiarity signal — judgment layer only, never a gate. Non-delegable (absent from
# `overrides`). STRONG = blame overlap >= min_blame_overlap_pct; MODERATE = both of its keys satisfied;
# else NONE. Thresholds are stamphog's backtested defaults.
familiarity:
strong:
min_blame_overlap_pct: 70
moderate:
min_prior_prs: 5
max_days_since_touch: 180
# Ownership sources feeding the reviewer's team context — advisory only, never a gate. hogli-resolver
# is the engine's only registered format (it walks distributed owners.yaml / product.yaml files); the
# server ships the resolver package into the sandbox alongside the engine, and a repo carrying no
# ownership files simply resolves to "no ownership-source match".
ownership:
sources:
- path: .
format: hogli-resolver