Pactrail: an open-source harness that treats AI code edits as reviewable transactions

Pactrail is an open-source harness written in Rust that stops an AI model from directly editing a codebase. Its core idea combines a Git commit with a database transaction: when given a task, the model first works within a bounded contract and a model-budgeted context, then passes through typed tools and policy checks, then produces its proposed change inside an .

That candidate must pass a step before it becomes an immutable record containing the diff, supporting evidence (a receipt), and an execution trace. A human then chooses to run '/apply' to accept the change or '/discard' to reject it.

The creator tested many coding models — local GGUF models, hosted APIs, small models that barely handle tools, and stronger models that still occasionally edit the wrong file — and concluded that the real risk isn't the model itself but the surrounding system that grants it access to the filesystem, tools, processes, memory, and credentials. A capable model wrapped in a careless system can still cause serious damage.

Key points

  • Pactrail is an open-source harness written in Rust.
  • Flow: task → bounded contract → model-budgeted context → typed tools/policy checks → → immutable diff+receipt+trace → apply or discard.
  • The AI cannot edit code directly; a s and decides via '/apply' or '/discard'.
  • The creator argues the harness's safety matters more than the model's raw capability.
  • The design borrows concepts from both Git commits and database transactions.
Read original