Recipes
Lift one, adjust the globs, python3 .cogpin/cogpin.py validate, commit. Each ships in
the repo under examples/.
Python
Section titled “Python”schema = 1[repo]default_branch = "main"code = ["src/**/*.py", "*.py"]tests = ["tests/**/*.py", "**/test_*.py", "**/*_test.py"]docs = ["**/*.md", "docs/**"]
[meta]base_pinned = truebypass_env = "COGPIN_BYPASS"
[[check]] # if on main, branch first (agent layer)id = "branch-first"kind = "fact"severity = "block"layer = "agent"primitive = "forbid_commit_on_branch"branch = ["main", "master"]
[[check]] # delete the failing test → blockedid = "no-test-delete"kind = "fact"severity = "block"primitive = "forbid_delete"scope = "tests"unless_paired_add = true
[[check]] # strip an assertion → blockedid = "keep-asserts"kind = "fact"severity = "block"primitive = "forbid_removal"pattern = '\bassert\b|\bself\.assert'scope = "tests"
[[check]] # the teeth: the real suite, base-pinned (change layer)id = "tests-pass"kind = "fact"severity = "block"layer = "change"primitive = "run"cmd = "python3 -m pytest -q"See the full file (with secret-scan, debugger guard, skip-marker warn, docs-currency) →
examples/python/cogpin.toml.
Node / TypeScript
Section titled “Node / TypeScript”A focused test (it.only), a committed debugger;, a deleted test, a stripped await,
plus a full team / PR-review layer — CODEOWNERS-lite (require_approval_from), a
supply-chain gate on new dependencies (pattern_requires_approval), fresh-human-approval
depth (approval_policy), and require_checks_green — and the real
npm run lint && npm test as the change-layer teeth →
examples/node-ts/cogpin.toml.
A real Rust workspace
Section titled “A real Rust workspace”A faithful port of an 890-line bespoke Definition-of-Done gate (the pixtuoid project) into
22 declarative checks — prod-println! guard, settings-write guard, two-lens-review marker,
docs/ledger coupling, the diff-side guards, real-time self_protect, and an advisory
substance judge →
examples/pixtuoid/cogpin.toml.
The advisory library
Section titled “The advisory library”The eight semantic-weakening classes a fact can’t prove — assertion-loosening, fake
implementation, regex relaxing, guard removal, silent fallback, tautological test, scope
drift, comment rot — as judge prompts a CI step pipes to a model (continue-on-error).
Compose them with the blocking facts above →
examples/advisory/cogpin.toml.
Promoting warn → block
Section titled “Promoting warn → block”A new rule that gates real code should start at severity = "warn", ride a few PRs to
confirm zero false positives, then move to block. A fact is presence-ungameable from
day one; the soak is only to tune scopes and exemptions against your repo’s real diffs.