← Catalog

@techs/pi-decision

Tool guardrail for pi with Jev, OpenAI and OpenRouter Decisions providers

Extension

Install

Install with PiG

pig install npm:@techs/pi-decision

Install with Pi

pi install npm:@techs/pi-decision
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.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

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

@techs/pi-decision

English | 简体中文

A Pi tool_call guardrail extension with Jev, OpenAI Decisions and OpenRouter judgment providers; Jev remains the default. 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; select PI_DECISION_PROVIDER=jev|openai|openrouter. 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.

The OpenAI integration requires version 0.2.1 or newer. After pnpm install && pnpm run build:

export PI_DECISION_PROVIDER=openai
export OPENAI_API_KEY=your_openai_key
pi -e ./packages/pi-decision

OpenAI uses the native Decisions API. Jev's calibrated thresholds do not transfer to OpenAI; start in shadow and evaluate the new provider.

Environment variableDefaultPurpose
PI_DECISION_PROVIDERjevSelect jev or openai independently of the main model
OPENAI_API_KEYNoneRequired when provider is openai
PI_DECISION_OPENAI_BASE_URLhttps://api.openai.com/v1Versioned Decisions API root
PI_DECISION_OPENAI_MODELgpt-6-lunaDecisions model
PI_DECISION_OPENAI_TIMEOUT_MS8000Request and response-body timeout
AI_GATEWAY_API_KEYNoneVercel AI Gateway key; takes priority over JEV_API_KEY
JEV_API_KEYNoneFallback key; required for the direct backend
PI_DECISION_JEV_BACKENDvercelvercel for Gateway; direct for api.typesafe.ai
PI_DECISION_ENFORCEMENTshadowshadow observes; enforce applies judgments (experimental)
PI_DECISION_TOOLSAll toolsComma-separated exact tool names, such as bash,write
PI_DECISION_ON_FAILUREallowStance when a judgment request fails: allow, ask, or deny
PI_DECISION_OUTBOUNDredactMask recognizable secret patterns; raw sends unchanged input
PI_DECISION_RISKSNoneJSON custom risk dimensions, like dsh guardrail.customRisks
PI_DECISION_AUDITonSet to off to disable audit records
PI_DECISION_AUDIT_PATHXDG state pathAudit JSONL path

OpenRouter Decisions

Set PI_DECISION_PROVIDER=openrouter, OPENROUTER_API_KEY, and an explicit PI_DECISION_OPENROUTER_MODEL such as baseten/elephant-1 (paid; check current catalog pricing). Optional PI_DECISION_OPENROUTER_BASE_URL defaults to https://openrouter.ai/api/alpha; PI_DECISION_OPENROUTER_TIMEOUT_MS defaults to 8000. No Jev or OpenAI key is read in this mode. For registry installation, use version 0.2.1 or newer; build first when loading from this checkout. See the adapter guide and free-model verification.