shipwithjev

Catalog / Tools & apps

0483GitHub

jgrep

Like grep, but the pattern is a description: it filters piped output as well as files and prints a probability per line.

keltokhy/jgrepREADME ↗
# jgrep

grep, but the pattern is a description.

```console
$ tail -f app.log | jgrep "a user is getting frustrated"
user 12: this is the third time checkout has failed, I am done with this app
user 77: WHY does it log me out every five minutes??

$ jgrep -o "announces or releases a new AI model" titles.txt | sort -rn | head -3
0.980	PrismML Launches Bonsai 2 27B, Its Most Capable Model Yet
0.970	Alibaba Releases Qwen3.8-Omni-Flash
0.940	Google announces new experimental "CC" AI agent for families
```

Each line becomes one yes/no question to [Jev](https://docs.typesafe.ai), TypeSafe's decision
model. Jev does not generate text. It returns a probability in about 200 ms for about a
thousandth of a cent, which is fast and cheap enough to sit in a pipe. jgrep reads lines as
they arrive, judges them concurrently and prints matches in input order, so it works on
`tail -f` as well as on files.

Measured on 994 Hacker News titles: 4.6 seconds and $0.012 for one description, and the same
time for three descriptions at once.

## Install

```bash
uv tool install jev-grep        # the command it installs is jgrep
uv tool upgrade jev-grep        # upgrade an existing installation
```

For Go and C function parsing, install the optional syntax parsers: `uv tool install 'jev-grep[code]'`.
Python function parsing and unified diffs work with the base package.

jgrep needs a key for one of two APIs, or for a gateway of your own (below). With keys for
several, it uses TypeSafe's.

| API | Key | Get one |
|---|---|---|
| TypeSafe | `TYPESAFE_API_KEY` | [console.typesafe.ai](https://console.typesafe.ai/settings/keys) |
| OpenRouter | `OPENROUTER_API_KEY` | [openrouter.ai/keys](https://openrouter.ai/keys) |

Set the environment variable, or put the key in `~/.config/jev/typesafe.key` or
`~

Also filed under Tools & apps