cocode.dk EN FA

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
  1. 0.96agent-linters/README.md
  2. 0.81agent-linters/bin/lintp
  3. 0.58agent-linters/llms.txt
  4. Threshold 0.5: files below it are listed as rejected. The accepted files go to the answer model.
  5. 0.22agent-linters/shell/linters.fish
  6. 0.14agent-linters/website/index.html
  7. 0.09agent-linters/install.sh
  8. 0.03message-test-plugin/CONTRIBUTING.md

Biome checks .css and .scss files. It is listed in the linter table in agent-linters/README.md.

An illustration, not a recorded run. The paths come from the repo's test fixture; the scores are made up to show the shape of the result.

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-engineRuns 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 modelOnly 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_rag Python package, standard library only, which runs inside the zjm-rag container: lockers, files, find, ask, doctor and help.
  • The zjm command runs the same operations from a shell, plus zjm doctor and zjm help. --json prints the result as one JSON object. Command-line spec
  • zjm serve, a JSON API on 127.0.0.1:8765 for apps in any language: GET /health, and POST /<operation>, such as /find and /ask. It needs an egress switch on in your config. HTTP spec
  • zjm mcp, an MCP server over stdio for agents, with one tool per operation, such as zjm_file_add, zjm_find, zjm_ask and zjm_help. Agents call zjm_help first. MCP and install spec

What it does

  • A locker is a named index. file_add copies 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.
  • find splits 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 egress setting allows it. In a project set up with the skill, that setting is send.
  • 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

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.

  1. 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.
  2. Create zjm-project.json there, and change locker and folders to your own. Use a locker name no other project uses; zjm locker-list shows the names in use. Leave send at false for 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}
  3. Add .zvec-grep/ to .gitignore, on its own line. Expected: a folder an earlier search tool left in the project stays out of git.
  4. Commit zjm-project.json and .gitignore. Expected: git lists both as committed.
  5. 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 .gitignore matches 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 if send is on.
  6. 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. With send set to false, 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.
  7. Optional, for answers with citations: set "send": true in zjm-project.json, then run export OPENROUTER_API_KEY=your-key-here with 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
cocode.dk