← Catalog

@artale/pi-governed

An agent that proves what it did: enforced safety gate -> independently verified receipt -> human-gated release.

ExtensionSkill

Install

Install with PiG

pig install npm:@artale/pi-governed

Install with Pi

pi install npm:@artale/pi-governed
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "commands": [
    "governed"
  ],
  "extensions": [
    "./extensions"
  ],
  "changelogPath": "./docs/CHANGELOG.md"
}

README

Written by the package's publisher, shown as published in version 0.3.0 (README.md). PiG does not review it.

@artale/pi-governed

An agent that proves what it did.

Most agents do work you can't audit. This one leaves a receipt.

Install

pi install npm:@artale/pi-governed

What you get

Three guarantees, enforced in code - not promised in a prompt.

  1. The gate. Every tool call is classified against a risk policy before it runs. Irreversible or shared-state actions - deploy, publish, push, secrets, destructive commands - are blocked, not warned about. A human has to sign off on the specific pattern first - in the moment, through a permission dialog, or from the command line when there is no UI.
  2. The receipt. Built from a journal the extension writes. The model has no way to write into that journal, so it cannot inflate the receipt.
  3. The human gate. Nothing ships without sign-off. There is no autonomous release path in this code, by design.

The gate is real

The gate is a tool_call handler. It runs before the tool does, and it can refuse:

$ pi -e extensions/governed.ts -p "run 'npm publish'"
`npm publish` did not run. The command was intercepted by a governed gate
requiring human sign-off.

The block message tells the user exactly how to unblock it. The agent is instructed not to work around a block - and cannot, because the tool never runs.

The human is asked, not notified

In an interactive session the gate asks the human directly, inside the same tool call, with a permission dialog:

Governed gate (irreversible or shared state)
  > Allow once: npm publish
    Allow for this session: npm publish
    Deny

"Allow once" lets that one call through. "Allow for this session" remembers the pattern. "Deny" refuses it, and remembers the refusal too, so a retry is refused without reopening the dialog.

The gate fails closed at every exit. No dialog-capable UI means the action is blocked and you are told how to sign off from the command line. A dismissed or timed-out dialog is a refusal. A dialog that throws is a refusal. Silence is not consent, and an exception is not consent.

What gets recorded and shown is the REDACTED command. The classifier sees the real command; an inline credential never reaches the journal, the receipt, the allowlist or the dialog.

An approval reaches exactly what it was given

An approval is the whole trust boundary. If an approval of one thing also approves another thing, the gate is a formality.

approvalcovers
a typed pattern (/governed-allow npm publish)a command only when EVERY segment of it is covered. So npm publish --dry-run is covered, and npm publish; rm -rf build is not.
a session approval from the dialogONE command, matched character for character. It does not stretch to another command, and it does not stretch to another credential that masks to the same shape.

A refusal is deliberately the mirror image. An approval has to cover every segment before it fires, because a broader approval hands out more than the human agreed to. A refusal fires as soon as ONE segment matches, because a narrower refusal lets the refused command through by hiding it behind an unrelated one. So refusing rm -rf build blocks rm -rf build AND echo hi && rm -rf build.

The receipt is observed, not reported

The "Verified" line only counts commands this extension ran. If the agent ran the tests itself in a shell, that is recorded under Not verified, not Verified. This is the difference between an audit and a press release.

Commands

commandwhat it does
/governedstart a governed run (gate -> work -> verify -> receipt)
/governed-allow <pattern>human sign-off: allow a pattern of human-class actions
/governed-deny <pattern>refuse a pattern, even if it was allowed before
/governed-verify <command>run a command, capture its real exit code, record it
/governed-verify <command> --isolatedsame, but against a throwaway copy of the tree
/governed-receipt [idea]emit the receipt built from what was observed
/governed-statusgate state: what is allowed, denied, observed, verified
/governed-resetclear the journal and the allowlist

The receipt

## Governed Receipt
- Idea: fix flaky auth test
- Safety gate: 2 safe, 3 guarded, 1 human-gated (1 blocked by the gate)
- Changed: auth.test.ts
- Verified: `npm test` -> PASS (exit 0, 812ms, in place)
- Not verified: - npm test
- Deploy decision: awaiting human sign-off
- Residual risks: none known

Every line is derived from an observation. The Not verified line is computed by subtraction, so it cannot be quietly omitted.

Why this exists

Agents got fast. Auditable, they did not. This is the smallest thing that makes an agent's work provable.

The idea underneath it: replay-safety and gate-safety are the same question. An action that is safe to repeat blindly after a crash is safe to run without a gate. One classification does both jobs. See docs/DESIGN-durable.md.

Tests

The package is its own proof. npm test runs 30 assertions over the policy, the journal, the receipt projection and the extension wiring - including that a human-class tool call is actually blocked - plus a load test of the extension under pi.

node --test test/governed.test.ts test/extension.test.ts

Scope

Golden path only. No MCP. No web. No 128-package suite. One job: make the agent's work provable.

License

MIT