pi-semguard

Runs `semguard check` when a pi run settles, and has the agent fix the violations it introduced.

Packages

Package details

extension

Install pi-semguard from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-semguard
Package
pi-semguard
Version
0.4.0
Published
Dec 4, 2026
Downloads
610/mo · 610/wk
Author
leostera
License
MIT
Types
extension
Size
23.8 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-semguard

A pi extension that keeps an agent inside a project's semguard rules.

When a run starts, pi-semguard records the violations semguard check already reports. When the run is about to settle, it checks again, and if the run introduced a violation of a rule that denies, it hands the agent those violations, with each rule's summary and help, and asks it to continue. It does so at most three times per run, then tells the person.

A violation is the same violation when it breaks the same rule about the same things (every binding but File and Line), so moving code doesn't count as introducing one; a second one about the same things does. Warnings are only passed along with errors, never on their own.

Projects without an semguard.toml or an .semguard directory, here or above, are left alone. If semguard check can't run when a run starts, the run isn't checked; if it could then and can't at the end, the agent is told what broke.

/semguard runs the check and shows the result.

With semguard server (RFD0002), the check when a run starts also has the server watch the project, so the check when it settles is usually answered with a report the server computed while the agent worked.

Install

cargo install --path crates/semguard   # puts `semguard` on PATH
pi install ./packages/pi-semguard

pi-semguard runs the semguard on PATH, else the one cargo install put in ~/.cargo/bin (a pi started from an app may not have it on PATH). SEMGUARD_BIN points it at another.

Develop

npm install
npm run check   # tsc
npm test        # node --test