Install
Install with PiG
pig install npm:@bismawy/pi-decision-eyeInstall with Pi
pi install npm:@bismawy/pi-decision-eyePackages 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.
{
"image": "https://raw.githubusercontent.com/bismawy/pi-decision-eye/main/assets/banner.webp",
"extensions": [
"./extensions/index.ts"
]
}README
Written by the package's publisher, shown as published in version 0.1.1 (README.md). PiG does not review it.
Decision Eye
Multi-provider decision guard. Three-stage protection. Built for Pi.
pi-decision-eye runs three stages of checks on coding-agent turns. Stage 1 blocks destructive shell commands and leaked secrets offline. Stage 2 checks tool_result outcomes before letting the agent claim a fix is done. Stage 3 evaluates risky code diffs through a fast decision model API and tracks spend only for providers you actually use.
Install
pi install npm:@bismawy/pi-decision-eye
For local development:
pi -e ./extensions/index.ts
Quick start
- Run
/decisionin Pi and open Providers. - Pick any provider from the list and paste its API key.
- Cloud providers need only an API key.
- Cloudflare Workers AI discovers your Account ID from the API token automatically.
- The first connected provider becomes your primary model. The second becomes your fallback.
- Optional: switch Guard presets in
/decision guard(BALANCED,STRICT,LIGHT, orOFF).
Three-stage guard
Stage 1 runs locally in under 1 ms with zero token cost. It inspects both bash and powershell tool calls:
- Unwraps nested shells (
bash -c,sh -c,pwsh -Command,eval) and prefixes (sudo,env). - Blocks root or home directory wipes (
rm -rf /,xargs rm -rf,find / -delete,Remove-Item -Recurse C:\), disk formatters (mkfs,dd,Format-Volume,Clear-Disk), and remote pipe execution (curl | bash,irm | iex). - Blocks force-pushes to
mainormaster(including implicit pushes when.git/HEADpoints tomain, while allowing--force-with-lease),git reset --hard, andgit clean -fd. - Blocks
DROP DATABASE/SCHEMA/TABLE,TRUNCATE TABLE, andDELETE FROMwithout aWHEREclause. - Scans newly added lines in
writeandeditcalls for API keys, private keys, and database URIs with passwords. Placeholder strings and low-entropy tokens pass through without false positives.
Stage 2 tracks edited code files and tool_result exits during a turn:
- Marks the turn verified only when a test, typecheck, lint, or build command exits without error.
- Invalidates verification if another code file is edited afterward.
- Ignores prose-only edits such as Markdown files.
- Nudges the agent if its final message claims completion while unverified code edits remain, while ignoring negated statements ("not done yet", "belum selesai").
Stage 3 calls a decision model on write and edit diffs when the change meets risk triggers:
- Triggers on large diffs, risky patterns (empty
catch,eval,child_process, SQL interpolation,dangerouslySetInnerHTML,TODO/FIXME), or security/infra files (Dockerfile,.github/workflows,auth,security). - Asks three yes/no questions in one API call:
has_slop,has_unfinished_work, andhas_safety_defect. - Blocks only when both probability and confidence exceed the active preset threshold, returning the exact failing dimension.
- Trips a session circuit breaker on 401/403 (auth) or 429 (cooldown) and fails over to your fallback provider.
Supported providers
All 14 built-in providers map onto three wire dialects (systemone, gemini-decisions, and openai-decisions).
| Provider | Dialect | Default model | Auth |
|---|---|---|---|
| Liquid AI | systemone | d1.2 | LIQUID_API_KEY or /decision providers |
| Perplexity | systemone | pplx-decider-latest | PERPLEXITY_API_KEY |
| Inception Labs | systemone | mercury-decide | INCEPTION_API_KEY |
| Baseten | systemone | baseten-decision-1 | BASETEN_API_KEY |
| Nace AI | systemone | nace-decision-1 | NACE_API_KEY |
| TypeSafe (Jev) | systemone | jev-1 | JEV_API_KEY or TYPESAFE_API_KEY |
| OpenRouter | systemone | liquid/d1.2 | OPENROUTER_API_KEY |
| Opper AI | systemone | opper-decision-1 | OPPER_API_KEY |
| Google Gemini | gemini-decisions | gemini-decision-1 | GEMINI_API_KEY |
| OpenAI | openai-decisions | gpt-6-luna | OPENAI_API_KEY |
| Cloudflare Workers AI | cloudflare-clef | clef-flash | CLOUDFLARE_API_TOKEN |
| Upstage | systemone | solar-decision-1 | UPSTAGE_API_KEY |
| Ollama (Local) | systemone | decision-local | Local endpoint, no key required |
| Custom Endpoint | systemone | custom-decision | Base URL + optional API key |
Commands
| Command | Action |
|---|---|
/decision | Open the main menu (Guard, Providers, Models, Usage) |
/decision guard | Choose preset (BALANCED, STRICT, LIGHT, OFF) and toggle stages |
/decision providers | Connect, test, or disconnect any of the 14 providers |
/decision models | Set primary and fallback provider/model pairs |
/decision usage | View requests, tokens, and estimated cost for active providers (Today, 7d, 30d, All), with trash-backed reset and undo |
Mention /eye or @eye anywhere in a prompt to attach the reviewed-turn contract and align the write gate to your request.
Configuration and storage
All state lives under ~/.pi/agent/pi-decision-eye/ (set PI_DECISION_EYE_HOME to override the base home directory):
config.json: preset, stage toggles, primary/fallback references, and custom base URLs.auth.json: provider API keys and auto-discovered Cloudflare account IDs (mode0600).usage.json: per-day, per-provider, per-model request and token counters. Reset moves the file intotrash/so you can undo it immediately.
Icons default to Nerd Font (\uf21b). Set PI_DECISION_EYE_ICON=nerd|emoji|none to choose a tier explicitly, or set NERD_FONT=0 / PI_NERD_FONT=0 to fall back to emoji (👀 Eye: ● BALANCED (mercury-decide)). none keeps the status cell plain ASCII.
Development
npm test
npm run render-check
npm run typecheck
License
MIT