<!-- Markdown copy of https://jevhub.io/jev-cursor (Jev in Cursor: the hook that guards your shell · Jev Hub). The HTML page is the original. -->

[ Guide ]

# Jev in Cursor: the hook that guards your shell

Jev in Cursor: add a beforeShellExecution hook with failClosed so Jev checks each shell command. What is documented, and what is not. Checked 25 October 2026.

Published 25 October 2026By Jev Hub

[Back to Learn](https://jevhub.io/learn)

[ TLDR ]

- Jev cannot be the model behind Cursor, but OpenRouter's cookbook shows a hook that sends each shell command to Jev before it runs.
- The hook goes in .cursor/hooks.json as a beforeShellExecution entry, and failClosed must be true, because Cursor otherwise allows a command when the hook crashes or times out.
- TypeSafe's skill page names Claude Code and Codex, not Cursor, so check whether Cursor appears when the installer asks you to choose an agent.

## Jev in Cursor, at a glance

|  | What to do | Where it is documented |
| --- | --- | --- |
| Approve shell commands with Jev | A beforeShellExecution hook in .cursor/hooks.json, with version 1, a timeout of 15 and failClosed true | OpenRouter's coding-agent cookbook |
| What the hook answers | Always allow or ask, never deny | OpenRouter's coding-agent cookbook |
| When it runs | Before every shell command, not only the ones that would prompt | OpenRouter's coding-agent cookbook |
| What Jev checks | Only whether the command is reversible and contained to the project: Cursor sends no task text | OpenRouter's coding-agent cookbook |
| The TypeSafe skill | Install with npx skills add typesafe-ai/skills --skill typesafe-ai and see whether Cursor is offered; TypeSafe's page names Claude Code and Codex | TypeSafe's agent-skill page |
| Key | OPENROUTER_API_KEY in the environment Cursor runs in | OpenRouter's coding-agent cookbook |

Settings are from OpenRouter's cookbook and TypeSafe's agent-skill page, read on 25 October 2026. Check the linked pages for current details.

## Can Jev work with Cursor?

Yes, beside it. TypeSafe's documentation lists Cursor among tools whose language model Jev cannot replace, because Jev returns typed decisions and writes no code. The documented use is as a judge: a hook that checks each shell command before Cursor runs it.

- [Jev in Claude Code: what you can build](https://jevhub.io/jev-claude-code)
- [Jev in Codex: set it up and trust the hook](https://jevhub.io/jev-codex)

## How do I set up the Jev hook in Cursor?

OpenRouter's cookbook gives Cursor its own script, which always answers `allow` or `ask`, never deny. Save it anywhere in the project, then register it in `.cursor/hooks.json` with `"version": 1` and a `beforeShellExecution` entry that runs `bun ./path/to/jev-permission-hook.ts` with a timeout of 15. You can add a `matcher` regular expression to limit which commands it sees.

Set `"failClosed": true`. The cookbook calls this important: without it Cursor allows a command whenever the hook crashes or times out, which defeats the point of a check. You also need Bun installed and `OPENROUTER_API_KEY` set in the environment Cursor runs in.

## How is the Cursor hook different from the others?

Three differences, all from the cookbook. The Cursor hook runs before every shell command, not only the ones that would have asked for permission. Cursor sends no task text, so Jev asks only whether the command is reversible and stays inside the project, and a command is approved only at a score of 0.9 or more. Because there is one question instead of two, the fixed risk list does more of the work: recursive deletes, force pushes, `sudo`, publishing, deploy commands and credential paths always go to the normal prompt before Jev is called.

To test it, pipe some text that is not JSON into the script. It should print `{"permission":"ask"}`. Then run a test command in Cursor.

## Can I use the TypeSafe skill in Cursor?

TypeSafe's agent-skill page names Claude Code and Codex, and says the skill works with other agents that use the `skills` installer, which asks you to choose your agent. It does not say Cursor is on that list. Run the installer and see whether Cursor is offered. If it is not, you can copy the `skills/typesafe-ai` folder from the repository into your agent's skills directory by hand, which the page also describes.

Cursor · install the skill, if Cursor is offered

```
npx skills add typesafe-ai/skills --skill typesafe-ai
```

A third-party guide by Flavio Copes covers Jev with Claude Code, Codex and Cursor. We did not check its Cursor steps against TypeSafe's own pages, so test them before you rely on them.

## What can I build with Cursor and Jev?

Published ideas, with the numbers their authors report. They are the authors' own and not independently checked:

- **Guard every shell command.** The hook above costs about $0.0000168 for a request of roughly 400 input tokens according to OpenRouter's cookbook, and only commands that pass the fixed list are billed.
- **Gate an agent's tool calls.** Vercel's example asks Jev "should the agent take another step?" and continues at a probability of 0.8 or more. The same shape works for "does this tool call match the plan?".
- **Route requests by intent.** TypeSafe's intent-routing pattern sends each request to a fixed set of destinations with a confidence measure, which suits a Cursor project that has several tools or models behind one entry point.

- [Intent routing: send each request to the right place](https://jevhub.io/intent-routing)

## What goes wrong in Cursor?

The snags the cookbook lists:

- **A crash lets commands through.** That happens when `failClosed` is missing or false. Set it to true.
- **Jev only sees the command.** It cannot tell that a command reads a secret unless the path or text shows it, so the fixed list is the real safety boundary.
- **Scores shift a little between identical requests.** Start at 0.9, and lower toward 0.8 only if safe commands keep prompting.
- **Approvals are one-time.** They do not create saved rules.

## Common questions

Not as the model behind Cursor, because Jev returns structured decisions, not code. OpenRouter's cookbook shows a hook that lets Jev check each shell command before Cursor runs it.

In .cursor/hooks.json, as a beforeShellExecution entry with version 1, a timeout of 15 and failClosed set to true.

Because otherwise Cursor allows a command when the hook crashes or times out. With failClosed true, a failure leaves the normal behaviour in place instead of letting commands through.

No. Cursor sends no task text, so Jev checks only whether the command is reversible and stays inside the project.

TypeSafe's agent-skill page names Claude Code and Codex and says other agents work through the skills installer. It does not name Cursor, so check whether the installer offers it.

OpenRouter's cookbook measured about $0.0000168 for one request of roughly 400 input tokens, or about $0.017 per 1,000 checks, and only commands that pass the fixed risk list are billed.

## Sources

Written by Jev Hub from the sources below and checked against them on 25 October 2026. Where a figure is a company's own claim, the article says so.

- [OpenRouter cookbook: auto-approve coding-agent permission prompts with Jev (read 25 October 2026)](https://openrouter.ai/docs/cookbook/coding-agents/auto-approve-permission-prompts-with-jev)
- [TypeSafe docs: the TypeSafe agent skill (read 25 October 2026)](https://docs.typesafe.ai/agent-skill)
- [GitHub: typesafe-ai/skills (MIT licence, read 25 October 2026)](https://github.com/typesafe-ai/skills)
- [TypeSafe docs: Jev with coding agents (read 25 October 2026)](https://docs.typesafe.ai/introduction/coding-agents)
- [Vercel changelog: AI Gateway supports TypeSafe clients and an HTTP API for Jev (21 September 2026)](https://vercel.com/changelog/ai-gateway-now-supports-typesafe-clients-and-an-http-api-for-jev)
- [TypeSafe docs: intent routing pattern (read 25 October 2026)](https://docs.typesafe.ai/patterns/intent-routing)
- [Flavio Copes: How to use Jev with Claude Code, Codex and Cursor (8 October 2026, a third-party guide)](https://flaviocopes.com/jev-coding-agents/)

## Related content

- [Jev on OpenRouter](https://jevhub.io/jev-openrouter)
- [Confidence routing](https://jevhub.io/confidence-routing)
- [Intent routing](https://jevhub.io/intent-routing)
