@techs/pi-decision

Jev-backed tool guardrail for pi

Packages

Package details

extension

Install @techs/pi-decision from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@techs/pi-decision
Package
@techs/pi-decision
Version
0.2.0
Published
Sep 29, 2026
Downloads
333/mo · 9/wk
Author
yourtion
License
MIT
Types
extension
Size
52.8 KB
Dependencies
2 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

@techs/pi-decision

English | 简体中文

A Pi tool_call guardrail extension using Jev as its current judgment provider. Before each tool call, it assesses six risk dimensions: destructive, secretExposure, privacyExposure, externalSideEffect, privilegeEscalation, and scopeViolation. You can disable or customize built-in dimensions and add your own. The risk policy comes from the provider-neutral core, but this Pi extension currently creates the Jev provider directly; using another judgment model requires a new adapter and Pi integration. The agent's main model still generates responses, and Pi's own permission rules continue to apply.

export AI_GATEWAY_API_KEY=your_gateway_key
pi install npm:@techs/pi-decision

The default shadow mode observes asynchronously without blocking tools. Configure credentials for Pi's main model separately. Judgments are written to $XDG_STATE_HOME/dsh-decision/pi-audit.jsonl, or ~/.local/state/dsh-decision/pi-audit.jsonl when XDG state is unset.

Environment variable Default Purpose
AI_GATEWAY_API_KEY None Vercel AI Gateway key; takes priority over JEV_API_KEY
JEV_API_KEY None Fallback key; required for the direct backend
PI_DECISION_JEV_BACKEND vercel vercel for Gateway; direct for api.typesafe.ai
PI_DECISION_ENFORCEMENT shadow shadow observes; enforce applies judgments (experimental)
PI_DECISION_TOOLS All tools Comma-separated exact tool names, such as bash,write
PI_DECISION_ON_FAILURE allow Stance when a judgment request fails: allow, ask, or deny
PI_DECISION_OUTBOUND redact Mask recognizable secret patterns; raw sends unchanged input
PI_DECISION_RISKS None JSON custom risk dimensions, like dsh guardrail.customRisks
PI_DECISION_AUDIT on Set to off to disable audit records
PI_DECISION_AUDIT_PATH XDG state path Audit JSONL path