Find the file that holds the answer
zjm-rag is RAG (retrieval-augmented generation, answers drawn from documents you hand over) over local files. zjm-engine searches an index of your folders, Jev judges which files actually contain the answer, and an LLM answers from those files alone, citing their paths.
The zjm command (with --json output), a local HTTP API (zjm serve) and an MCP server for agents (zjm mcp) work today. One line installs them, in a Docker container on your computer.
>>> zjm ask "which linter checks CSS files" -l linters
- 0.96
agent-linters/README.md - 0.81
agent-linters/bin/lintp - 0.58
agent-linters/llms.txt - Threshold 0.5: files below it are listed as rejected. The accepted files go to the answer model.
- 0.22
agent-linters/shell/linters.fish - 0.14
agent-linters/website/index.html - 0.09
agent-linters/install.sh - 0.03
message-test-plugin/CONTRIBUTING.md
Biome checks .css and .scss files. It is listed in the linter table in agent-linters/README.md.
Three steps, each one narrower
Search casts a wide net, and, with sending on (send in a project, egress.rank for direct use), a judge sorts the catch. Only the files that pass reach the answer model. It reads each one whole when the file is small, or the parts that matched when it is large.
Up to 40 hits, at most 8 files (16 if translated)
zjm-engine finds
A hybrid search, keyword and semantic, over a local zjm-engine index of your folders. find takes up to 40 hits and keeps the first 8 different files, in zjm-engine's order. If the question is also translated (direct use, with egress.translate on and languages set), the translations can add up to 8 more files. For each file it keeps every matched section, with overlapping lines merged, not a short preview. --limit sets both numbers.
Up to 8 files, or 16 if translated, each with a probability
Jev judges
Runs only when sending is on: send in a project, egress.rank for direct use. One request to Jev, the OpenRouter Decisions API, asks the same question of every file: does this one hold what the answer needs? Jev judges each file from its path and up to 12,000 characters of its matched text, and returns a probability. Files at 0.5 or above are accepted. The rest are listed as rejected, so none disappears without a trace.
Every accepted file, up to 200,000 characters
The LLM answers
Runs only when sending is on: send in a project, egress.answer for direct use. ask sends the accepted files to the answer model, by default deepseek/deepseek-v4-flash on OpenRouter, with one instruction: answer from these files only, cite the path and lines, and say so if they do not hold the answer. Small files go whole. Larger files go as their matched parts, until the 200,000-character budget runs out. When no file passes, no model is called.
What leaves your machine
Search runs on your computer. Nothing goes to OpenRouter unless a switch allows it. For a project set up with the skill, that switch is "send": true in its zjm-project.json. For direct use (the CLI, library, HTTP API and MCP server), it is egress in your config, {"rank": ..., "answer": ...}, off by default. Index only folders you would be fine sending to OpenRouter.
| zjm-engine | Runs on your computer, against an index of a copy of your folders. Nothing leaves. |
|---|---|
| Jev (ranking) | Only when send is true in a project, or egress.rank is true for direct use. Gets the question, and each candidate file's path and up to 12,000 characters of its matched text. Sent to OpenRouter. |
| Answer model | Only when send is true in a project, or egress.answer is true for direct use. Gets the question and the accepted files, up to 200,000 characters in all. Sent to OpenRouter, which is asked not to keep the prompt. |
A project never sends questions for translation. Direct use does, only when egress.translate is true.
What exists today
Four ways to call it
- The
zjm_ragPython package, standard library only, which runs inside the zjm-rag container: lockers, files,find,ask,doctorandhelp. - The
zjmcommand runs the same operations from a shell, pluszjm doctorandzjm help.--jsonprints the result as one JSON object. Command-line spec zjm serve, a JSON API on127.0.0.1:8765for apps in any language:GET /health, andPOST /<operation>, such as/findand/ask. It needs anegressswitch on in your config. HTTP speczjm mcp, an MCP server over stdio for agents, with one tool per operation, such aszjm_file_add,zjm_find,zjm_askandzjm_help. Agents callzjm_helpfirst. MCP and install spec
What it does
- A locker is a named index.
file_addcopies files or folders into it and indexes the copy, so your originals stay where they are. - Each locker is encrypted with a key your app supplies (age), or it is plain, if you ask for that. zjm never stores a key.
findsplits files at a threshold into accepted and rejected, and sorts them by score, zjm-engine rank, modified time or path.- Nothing is read until its folder is listed in the config, and nothing is sent until the config's
egresssetting allows it. In a project set up with the skill, that setting issend. - The tests use fakes and never call zjm-engine, Jev or an LLM.
Install zjm, then set up a project
zjm runs in a Docker container on your computer. One installer builds the container, adds the zjm command and installs a Claude Code skill. The skill builds and searches a project's index for you.
What you need
docker, installed and running. The installer builds zjm's container with it.python3, version 3.10 or newer.git. The project script uses it to find the project's top folder and the files git can see.OPENROUTER_API_KEYin your terminal, only if you turn on sending for a project (step 7 below).
Install
Run the installer
curl -fsSL https://raw.githubusercontent.com/cocodedk/zjm-rag/main/install.sh | sh
The installer checks for docker and python3, builds the zjm-rag:latest image, and puts zjm in ~/.local/bin. If no config exists, it creates one with all outside calls turned off. Last, it installs the skill into ~/.claude/skills/zjm-rag, replacing any older copy. It prints steps 1/4 to 4/4.
If it warns that ~/.local/bin is not on your PATH, add export PATH="$HOME/.local/bin:$PATH" to your shell profile and open a new terminal. Then run zjm doctor. It checks the install and exits with status 1 when a check fails.
Set up a project
A locker is the private, searchable index of one project. The settings live in one file, zjm-project.json, at the project's top folder. Commit it so every session uses the same settings. Index documents and memory folders, not code: a code tree makes the index fail and every search come back empty.
The commands below use ~/.claude/skills/zjm-rag/scripts/zjm-project. If you set CLAUDE_CONFIG_DIR, use that folder instead of ~/.claude.
- Open a terminal in the project's top folder: the folder that holds
.git, or the folder you work in if the project does not use git. - Create
zjm-project.jsonthere, and changelockerandfoldersto your own. Use alockername no other project uses;zjm locker-listshows the names in use. Leavesendatfalsefor now. Expected: the file sits in the top folder.{"locker": "myproj", "folders": ["docs", "memory"], "exclude": ["*.pdf", "drafts/"], "send": false, "llm": "deepseek/deepseek-v4-flash", "multilingual": false} - Add
.zvec-grep/to.gitignore, on its own line. Expected: a folder an earlier search tool left in the project stays out of git. - Commit
zjm-project.jsonand.gitignore. Expected: git lists both as committed. - Build the index with
~/.claude/skills/zjm-rag/scripts/zjm-project reindex. Expected: zjm reports what it added, and the prompt returns. Text files are copied with home-folder paths redacted, so/home/<user>/becomes~/. A file that git ignores and does not track is not copied; a tracked file is copied even if.gitignorematches it. Files whose names match zjm's built-in secret-file patterns (.env*,*.pem,*.key,id_rsa*and the rest of the list) are left out. The contents of documents are not scanned for secrets, so a key pasted into an ordinary document is indexed, and sent to OpenRouter ifsendis on. - Search with a full question:
~/.claude/skills/zjm-rag/scripts/zjm-project find "who approves a change before it runs?"Expected: a list of file paths. Withsendset tofalse, the scores show as-and nothing is ranked. Open each file before you rely on it. A score measures relevance, not truth. No hit does not prove the text is missing, so try other wordings. - Optional, for answers with citations: set
"send": trueinzjm-project.json, then runexport OPENROUTER_API_KEY=your-key-herewith your own key. Expected:~/.claude/skills/zjm-rag/scripts/zjm-project ask "who approves a change before it runs?"prints an answer that names its files. Risk: the text of matching files leaves your computer and goes to OpenRouter. Each search and each answer is a paid call. Keep the key out of git.
After every change to an indexed folder, run reindex again before you search. If find or ask prints STALE:, a folder changed since the last reindex. Reindex, then search again.
Use it directly
The Python package, the zjm commands, the HTTP API and the MCP server are described in the README.
zjm doctor # checks zjm-engine, age, the API key, config, lockers zjm locker-list # names of the lockers in the store
zjm serve # needs an egress switch on in the config; serves 127.0.0.1:8765 until stopped
claude mcp add zjm -- zjm mcp # agents call zjm_help first