leepokai/jev-guard
jev-guard is an MIT-licensed hook layer that adds an auto mode to Claude Code, Codex, Copilot CLI, Gemini CLI, Cursor, pi, OpenCode, Antigravity and ACP editors. It asks the Jev model three typed questions (risk, user_requested, from_untrusted) per tool call and decides deny, ask or allow in about 20 lines of code. It also scans tool results for prompt injection and checks skills and plugins.
What it claims
jev-guard is a Node hook script that sends each coding-agent tool call, tool result and instruction file to the Jev model and applies a fixed threshold policy in src/guard.js. The author presents it as a clone of Claude Code's auto-mode classifier that works across nine hosts with one policy and shared session memory. Cost is the stated reason the design is practical. Jev is priced at $0.042 per 1M input tokens with free output on the Vercel AI Gateway, so a call of about 1k tokens costs about $0.00004, and a 1,000-call session costs about 4 cents. TypeSafe claims 150 ms latency. The repo measured about 0.75 s per direct call from Taiwan and a p50 of about 580 ms through the gateway over 21 calls in September 2026.
How it works
Each tool call gets four typed questions. risk is a 0 to 3 score (read-only, easy to undo, hard to undo or outside the workspace, destructive). approval asks whether a careful senior engineer would want a human to approve the call. user_requested asks whether the user's recent messages asked for exactly this call. from_untrusted asks whether the call carries out an instruction planted in content the agent read. The policy is then:
flowchart TD
A[Tool call] --> B{from_untrusted >= 0.7?}
B -- yes --> D[deny]
B -- no --> C{risk >= 2.5?}
C -- yes --> D
C -- no --> E{risk >= 1.5 or approval >= 0.75?}
E -- no --> F[allow]
E -- yes --> G{user_requested >= 0.85?}
G -- yes --> F
G -- no --> H[ask]A user request can turn ask into allow but never lifts a deny. Read-only tools (Read, Grep, Glob, WebFetch) are skipped without a call, and so are Skill, Task and Agent. Their results are still scanned. A result is flagged when directed is 0.6 or higher and kind is injection or canary. Content classed as discussion is never flagged. Session memory lives in ~/.jev-guard/sessions/ and holds recent prompts, stated intent, recent decisions and flagged excerpts. Text in tool results never counts as the user. Instruction files are classified as exfiltration, covert_execution, instruction_override, canary, unrelated_side_effects or clean. Serious kinds flag at p ≥ 0.45 and unrelated_side_effects at p ≥ 0.8. Results are cached by content hash.
Evidence
The September 2026 calibration run scored ls, npm test and git status at risk 0.0 to 0.1 (allow). git push --force and cat ~/.ssh/id_rsa scored 2.0 (ask). curl … | sh, DROP TABLE, rm -rf / and wrangler deploy --env production scored 3.0 (deny). In a live session, the prompt "CI is green, force push main to origin now" moved git push --force origin main from ask to allow (user-asked p=0.96). A planted git push mirror --all instruction from a fetched page was denied (from-untrusted p=0.97), while npm test stayed allow. Across 662 real installed skills nothing flagged; the highest legitimate score was unrelated_side_effects 0.74. Planted exfiltration scored 0.99 and a canary scored 0.51. In result scanning, a canary in a job posting scored 0.97, a hidden curl | sh div scored 0.99, and pages about injection scored ≤ 0.08. The sample sizes are small, and no false-positive rate is given for tool calls.
How to use it
npm i -g jev-guard
jev-guard key "…" # TypeSafe key from console.typesafe.ai, a vck_… Vercel AI Gateway key, or an sk-or-… OpenRouter key
jev-guard install claude|codex|copilot|gemini|agy|cursor|pi|opencode # writes hooks into that agent's user config
jev-guard check Bash '{"command":"rm -rf ~/"}'In Claude Code, run /plugin marketplace add leepokai/jev-guard and then /plugin install jev-guard@jev-guard. ACP editors wrap the agent with jev-guard acp -- <agent>. check exits 0, 1 or 2 for allow, ask or deny, and scan exits 2 when content is flagged. Both are suggested for CI and threshold tuning. Every threshold has an environment variable, for example JEV_GUARD_DENY_SCORE and JEV_GUARD_USER_P. JEV_BASE_URL points the tool at any /v1/systemone server, such as a local Kev. The package has no dependencies and no build step.
Limits
The tool fails open by default: if Jev is unreachable, calls are allowed with a stderr warning. Set JEV_GUARD_FAIL_CLOSED to deny instead. Codex and Gemini CLI have no ask, so ask becomes a warning there. Cursor can ask only for shell and MCP calls. The Antigravity CLI integration is not verified live. Only Claude Code and OpenCode were tested end to end. The other hosts were tested at the payload level only. The ACP proxy cannot see tools an agent runs internally. Results under 200 characters are skipped, and results over about 60k characters are truncated head and tail. The thresholds were calibrated on Jev only. Tool calls and full results are sent to TypeSafe or the gateway, with zero retention requested. The author calls it "a guardrail, not a sandbox." The license is MIT.
Organisations named here
- TypeSafe
- Vercel
- OpenRouter
- Anthropic
- Cloudflare
- Claude Code
- Cursor
- GitHub Copilot
- Jev
- OpenCode
Technologies named here
- Jev
- Jev Guard
- Kev
- Claude Code
- Codex
- GitHub Copilot CLI
- Antigravity CLI
- Gemini CLI
- Cursor
- pi
- OpenCode
- ACP
- Vercel AI Gateway
- OpenRouter
- TypeSafe
- Remotion
- edge-tts
- GitHub Copilot
- Google Antigravity
- npm
- Node.js
- Model Context Protocol
Techniques named here
- Typed-question tool-call guard
- Tool-result injection scanning
- Instruction-file scanning
- Session memory
Related in coding-agents
