Pi Jev Semantic Router
Routes Pi tools, discovers skills, selects models, and makes fast typed decisions on demand.
Per-dimension scores and reasoning
Automatic routing, model selection, compaction, and automatic orchestration are documented as off by default; tool activation is additive, and enable, disable, and runtime toggles are provided, supporting ordinary least-privilege, confirmation, and recovery expectations. The README discloses API-key sources, per-prompt request cost, evaluator state examples, and tool activation effects, but it does not fully describe everything transmitted to TypeSafe, retention, third-party processing, or a privacy policy. Sensitive-data guidance is limited to an environment variable and a plaintext secret-file example, with no file-permission, redaction, rotation, or leak-prevention guidance, so that criterion is thin. The dependency set is small, CI covers Node 20 and 22, and npm publishing uses provenance; wildcard peer dependencies and the absence of supplied lockfile or audit/vulnerability evidence limit dependency-security credit. Toggles and graceful fallbacks are clear, but no transactional reversal is described for tools already activated or subagents already dispatched. Author, repository, license, issue tracker, and security-contact attribution are consistent and comprehensive, justifying full source-attribution credit. Unknown enterprise-registry identity is treated as unverified rather than suspicious.
The README, configuration names, and tests agree on the shared JEV_THRESHOLD, opt-in defaults, exact subcommands, unconfigured skips, and non-throwing failure behavior. Tests explicitly cover concurrent skips and threshold consistency, supporting full self-consistency credit. Node requirements, installation, the sole runtime dependency, and fallback behavior are documented, but wildcard peer versions and the lack of a demonstrated compatibility matrix or detailed offline behavior reduce dependency-availability credit. Tests cover unknown commands, invalid arguments, evaluation-design failures, configuration-origin status, and error severity; the gate also distinguishes pass, rejection, and error exit codes, providing strong failure-message evidence.
The documentation covers interactive coding, skill discovery, tool routing, CI gates, classification, compaction, model selection, and multi-agent workflows across several task types, giving strong audience-and-scenario coverage. Boundaries include thresholds, skip conditions, missing configuration, low confidence, model compatibility, and fallbacks, but the source does not systematically identify high-risk decisions unsuitable for Jev, probability-error risks, or input-size limits, so capability boundaries are not complete. Exact subcommand matching, a shared cutoff, slash-command skipping, concurrency protection, and corresponding tests provide thorough trigger-precision evidence. Pi and Node 20+, environment variables, and secret-file setup are specified, but wildcard peers and absent OS, Pi-version, and network-requirement matrices limit environment-fit credit.
The README is clearly organized by features, installation, setup, modes, commands, tools, development/testing, and licensing. npm and GitHub installation, key configuration, status checking, and development commands are actionable. The jev_* tool names, /jev commands, environment variables, and gate binary aliases remain consistent across documentation, package metadata, and tests. Examples cover JSON tool calls, workflows, subagent gates, pipelines, and commands; the lack of a separate FAQ does not materially reduce their usefulness. Defaults, costs, fallbacks, and some skip conditions are documented, but there is no consolidated limitations section covering privacy, misclassification, or orchestration risks. MIT metadata matches the complete LICENSE, earning full license credit. Version 0.4.0 is declared and CHANGELOG.md is listed for publication, but its contents are absent from the supplied evidence, preventing assessment of history quality. A security email, issue URL, and author are present, while maintenance commitments, response times, governance, and support lifecycle are unspecified.
Typed judgments produce probabilities or choices, status reports expose configuration and usage, and the gate offers explicit exit codes plus JSON output, making results readily usable. Semantic discovery, typed low-overhead decisions, and workflow gates provide clear incremental value over permanently loading every tool or launching full LLM subprocesses. Cost controls are disclosed through opt-in execution, one Jev request per automatic prompt, local fallback shortlists, and request/token counters. However, claims such as “sub-second” and “calibrated,” and the magnitude of context or cost savings, lack benchmarks, measurements, or pricing analysis, so cost-benefit is not fully demonstrated.
Core behavior is traceable to concrete configuration, scripts, and tests: shared thresholds, opt-in defaults, exact command parsing, missing-configuration handling, concurrent skipping, failure reporting, agent RPC, CI, and publishing all have static evidence. The README, package metadata, workflows, and tests corroborate installation and core routing behavior, but automatic model selection, compaction, orchestration generation, gate implementation, and security-sensitive data handling lack corresponding supplied implementation or test evidence, reducing cross-source corroboration. The documentation generally separates configuration facts from behavior descriptions, but strong phrases such as “calibrated,” “safe,” “sub-second,” and “never silently truncates” are not statically substantiated or labeled as expected claims, so fact-versus-inference separation is incomplete.
- Apply restrictive file permissions when using the plaintext secret-file setup; the supplied guidance does not address permissions, rotation, or redaction.
- Prompts, git diffs, files, or piped output sent to Jev may contain source code or sensitive data; review the data boundary before use because retention and third-party processing are not documented.
- Automatic tool activation, model selection, and agent orchestration are opt-in but can incur API cost and external effects once enabled; begin with conservative thresholds and human review.
- Do not use a probabilistic gate as the sole security, deployment, or compliance decision-maker; the supplied material does not independently establish the “calibrated” or “safe” claims.
- Peer dependencies use wildcard ranges, so compatible Pi package combinations should be pinned and verified before upgrades.
What does this agent do, and when should you use it?
pi-jev is a Pi coding agent extension that uses TypeSafe Jev for semantic routing and typed System One decisions. It exposes `jev_find_tools`, `jev_find_skill`, and `jev_evaluate` for activating relevant inactive tools, discovering workspace skills, and returning Choice, Noul, or Score judgments. Its command interface also covers dynamic evaluation, model selection, context compaction, and multi-agent orchestration through `pi-subagents`. The `pi-jev-gate` CLI evaluates a Git diff, file, or standard input against natural-language criteria and emits pass, reject, or error exit codes for subagent and CI/CD gates. It runs inside the Pi environment and requires TypeSafe credentials and network access; automatic routing, model selection, orchestration, and Jev-guided compaction are all opt-in.
When called explicitly or enabled in automatic mode, the extension submits the current prompt to Jev, applies the shared JEV_THRESHOLD of 0.65, and additively activates matching inactive tools while recommending relevant SKILL.md files. jev_find_skill semantically ranks workspace skills, while jev_evaluate accepts a state plus a question schema and returns typed Choice, Noul, or Score judgments. /jev test <prompt> asks the active model to design the question schema before Jev evaluates it; /jev auto-model on considers task signals, attached images, and context size when choosing among available fast, balanced, reasoning, long-context, or vision models. With /jev compact on, it evaluates tool-history entries during /compact, preserves Pi's firstKeptEntryId boundary, and falls back to Pi's built-in summary if necessary. /jev agents <task> builds and asynchronously runs a pi-subagents workflow, while pi-jev-gate reads a Git diff, file, or piped output and exits with 0, 1, or 2 for pass, rejection, or error.
- A Pi developer with many registered tools can use
jev_find_toolsto activate only the inactive capabilities relevant to the current coding task. - A team maintaining several
SKILL.mdworkflows can run/jev skills [query]to discover and rank the best match for a specific assignment. - A workflow author triaging bugs, features, and documentation requests can register
agent: "jev"and branch on a typed Choice result. - A team running subagents or CI/CD can use
pi-jev-gateto assess diffs, files, or test output against natural-language acceptance criteria. - A developer with long Pi sessions can opt into Jev-guided compaction to retain important paths, errors, constraints, and tool results.
- A Pi user who wants task-based model selection or coordinated specialist roles can enable auto-model or the
pi-subagentsorchestration commands.
What are this agent's strengths and limitations?
- Prompt-specific tool routing and skill discovery reduce the need to keep every registered capability in the active prompt context.
- Choice, Noul, and Score provide structured decisions, including a lightweight
agent: "jev"node for workflow branching. pi-jev-gateaccepts Git diffs, files, and standard input and exposes deterministic exit-code semantics for automation.- Automatic routing, model choice, orchestration, and compaction are independently opt-in, with documented safe fallback behavior on several failure paths.
- Routing, tools, skill commands, and automatic mode share one
JEV_THRESHOLD, giving operators a single precision-versus-recall control.
- The documented runtime boundary is the Pi coding agent, and core evaluation depends on the TypeSafe Jev service and an API key.
- Automatic mode adds one Jev request per prompt, creating an additional external-service call and possible cost.
- Multi-agent orchestration requires the separate
pi-subagentsintegration, and automatic dispatch is disabled by default. - Model selection is limited to
ctx.scopedModelsand currently available compatible models; low-confidence prompts may retain the current model. - The supplied material does not specify supported Node.js/npm versions, performance benchmarks, or TypeSafe API pricing.
How do you install or deploy this agent?
In an existing Pi environment, run pi install npm:pi-jev. Alternatively, install from GitHub with pi install git:github.com/TheoOliveira/pi-jev. Set the credential with export TYPESAFE_API_KEY=ts_..., or create ~/.pi/agent/secrets and place the key in ~/.pi/agent/secrets/typesafe_api_key. Start Pi and run /jev status to verify the configuration. The orchestration features additionally require pi-subagents.
How do you use this agent?
Inside Pi, begin with /jev status to inspect the credential source, mode state, and available tool counts, then run /jev enable to enable the Jev tools. Call jev_find_tools with a payload such as {"query":"inspect SQLite database schemas and run queries"}, use /jev skills [query] for skill discovery, or run /jev test <prompt> for a dynamic evaluation. Enable automatic routing with pi --jev-auto, PI_JEV_AUTO=1, or /jev auto on; model selection, compaction, and automatic orchestration use /jev auto-model on, /jev compact on, and /jev auto-agents on. For a gate check, run npx pi-jev-gate -c "All exported functions have TypeScript type annotations" --diff; its default pass threshold is 0.70 and can be changed with -p.
How does this agent compare with similar options?
Compared with Pi's normal compaction, Jev-guided compaction evaluates tool-history entries to retain important paths, errors, constraints, and results; it falls back to Pi's built-in summary when Jev is unavailable, unconfigured, or returns unusable data. For rapid workflow classification, agent: "jev" is positioned as a typed decision node that avoids spawning a heavyweight LLM process, rather than as a full execution subagent.
FAQ
Which credential is required?
TYPESAFE_API_KEY or stored in ~/.pi/agent/secrets/typesafe_api_key.Does it process every prompt immediately after installation?
/jev commands.What happens when Jev is unavailable?
--fail-open is used, in which case it returns 0.How does the gate decide whether to pass?
pi-jev-gate returns 0 when the evaluation probability meets its default 0.70 threshold and 1 when rejected. A custom threshold can be supplied with -p.