Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

plugins: add xerj-knowledge document-search plugin for Claude Cowork and Code (#2817)

xerj-orgc9c4b420f257
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index e93433ad0..40c004a7e 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -13,6 +13,13 @@
"description": "XERJ MCP server: cited search over your code, docs, specs and logs, plus Corpus Hub packs.",
"category": "search",
"homepage": "https://xerj.org/for-agents"
+ },
+ {
+ "name": "xerj-knowledge",
+ "source": "./plugins/xerj-knowledge",
+ "description": "Local document search for Claude Cowork and Claude Code: your folders, notes, PDFs, Office files and mail exports, answered with the file and page. Files stay on your machine.",
+ "category": "productivity",
+ "homepage": "https://xerj.org/for-agents"
}
]
}
diff --git a/.gitignore b/.gitignore
index 1fd87044a..51d14f5d3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -212,3 +212,8 @@ scripts/seo/evidence/
# nix build output link (flake.nix)
/result
+
+# Re-include: Claude plugin skills and slash commands are markdown by format
+# (plugins/<name>/skills/<skill>/SKILL.md, plugins/<name>/commands/*.md).
+!plugins/*/skills/**/*.md
+!plugins/*/commands/*.md
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f3cdae6b0..02f100256 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
+- A second Claude plugin in the xerj marketplace, `xerj-knowledge`, for
+ document search rather than code: a skill and `/xerj-knowledge:index` and
+ `/xerj-knowledge:find` commands that search local folders, notes, PDFs,
+ Office files and mail exports and cite the file and page. Same `xerj mcp`
+ server; the existing `xerj` plugin is unchanged. Untested in Claude Cowork
+ so far. (#2646)
- A Nix flake: `nix run github:xerj-org/xerj` builds and runs `xerj` from
source, `nix build` produces it, and `nix develop` opens a shell with the
Rust toolchain. The package builds the engine and embeds the Console assets
diff --git a/plugins/xerj-knowledge/.claude-plugin/plugin.json b/plugins/xerj-knowledge/.claude-plugin/plugin.json
new file mode 100644
index 000000000..b39856bd1
--- /dev/null
+++ b/plugins/xerj-knowledge/.claude-plugin/plugin.json
@@ -0,0 +1,13 @@
+{
+ "name": "xerj-knowledge",
+ "description": "Local knowledge search for Claude Cowork and Claude Code: search your own folders, notes, mail exports, PDFs and spreadsheets with XERJ, and cite the file and page. Files stay on your machine.",
+ "author": {
+ "name": "xerj-org",
+ "email": "[email protected]",
+ "url": "https://xerj.org"
+ },
+ "homepage": "https://xerj.org/for-agents",
+ "repository": "https://github.com/xerj-org/xerj",
+ "license": "Apache-2.0",
+ "keywords": ["knowledge-search", "documents", "pdf", "email", "local-first", "mcp", "cowork"]
+}
diff --git a/plugins/xerj-knowledge/.mcp.json b/plugins/xerj-knowledge/.mcp.json
new file mode 100644
index 000000000..744b0938c
--- /dev/null
+++ b/plugins/xerj-knowledge/.mcp.json
@@ -0,0 +1,11 @@
+{
+ "mcpServers": {
+ "xerj": {
+ "command": "xerj",
+ "args": ["mcp"],
+ "env": {
+ "XERJ_URL": "${XERJ_URL:-http://localhost:9200}"
+ }
+ }
+ }
+}
diff --git a/plugins/xerj-knowledge/README.md b/plugins/xerj-knowledge/README.md
new file mode 100644
index 000000000..6930b5477
--- /dev/null
+++ b/plugins/xerj-knowledge/README.md
@@ -0,0 +1,51 @@
+# XERJ Knowledge: local document search for Claude Cowork and Claude Code
+
+Ask Claude about your own files and get answers that say which file, and which
+page, each fact came from. XERJ indexes a folder on your computer: PDFs, Word,
+PowerPoint and Excel files, EPUB books, notes, and mail or mbox exports. **Your
+files stay on your machine.** Nothing is uploaded; the index is local too.
+
+This plugin is for documents. For code search use the `xerj` plugin from the same
+marketplace. Both use the same `xerj mcp` server and can be installed together.
+
+## Install
+
+1. Install the `xerj` program (one time): https://xerj.org/docs/install
+2. Start it, and leave it running:
+
+ ```bash
+ xerj --insecure --data-dir ~/xerj-data
+ ```
+
+3. Add the plugin:
+
+ ```bash
+ claude plugin marketplace add xerj-org/xerj
+ claude plugin install xerj-knowledge@xerj
+ ```
+
+## Use
+
+- `/xerj-knowledge:index ~/Documents/Contracts contracts` indexes a folder under
+ the name `contracts`. Run it again any time to pick up changed files.
+- `/xerj-knowledge:find when does the office lease renew?` searches and answers
+ with citations.
+- Or just ask in plain words ("find the invoice from Acme in my mail export");
+ the included skill tells Claude when to search your documents.
+
+## What is stored, and how to remove it
+
+The index lives in the data folder you started XERJ with (`~/xerj-data` above).
+To remove one folder's index: `xerj autoindex remove --prefix <name>` shows what
+would be deleted, and adding `--yes` deletes it. To remove
+everything, stop XERJ and delete that data folder.
+
+## Status
+
+- **Untested in Claude Cowork.** Cowork uses the same plugin format as Claude
+ Code, and this plugin uses only the same `xerj mcp` server as the `xerj`
+ plugin plus a skill and two commands, but nobody has run it in Cowork yet.
+ Reports are welcome in https://github.com/xerj-org/xerj/issues.
+- `XERJ_URL` defaults to `http://localhost:9200`. For a node with auth on, set
+ `XERJ_AUTH` (for example `ApiKey <key>`); on a local node the key is read from
+ `<data-dir>/admin.key`, so you can leave it unset.
diff --git a/plugins/xerj-knowledge/commands/find.md b/plugins/xerj-knowledge/commands/find.md
new file mode 100644
index 000000000..19bde62f8
--- /dev/null
+++ b/plugins/xerj-knowledge/commands/find.md
@@ -0,0 +1,15 @@
+---
+description: Search your indexed local documents and answer with the file and page each fact came from
+argument-hint: <question>
+---
+
+Answer this from the user's indexed local documents: $ARGUMENTS
+
+1. Search with the `xerj_search` MCP tool (or `xerj search --prefix <prefix>
+ "<plain words>"`), using the words the documents would use. If you know the
+ prefix the folder was indexed under, pass it. Try two or three phrasings if the
+ first one misses.
+2. Answer only from what the hits say. Cite each fact with the file path and the
+ page, slide, sheet or message the hit names.
+3. If nothing relevant is found, say so and say which prefix was searched. Do not
+ answer from memory.
diff --git a/plugins/xerj-knowledge/commands/index.md b/plugins/xerj-knowledge/commands/index.md
new file mode 100644
index 000000000..8e03342ab
--- /dev/null
+++ b/plugins/xerj-knowledge/commands/index.md
@@ -0,0 +1,22 @@
+---
+description: Index a local folder of documents (PDF, Word, PowerPoint, Excel, EPUB, notes, mail) so it can be searched with citations
+argument-hint: <folder> [prefix]
+---
+
+Index the folder `$1` with XERJ so its documents can be searched.
+
+1. Choose the prefix: use `$2` if it was given, otherwise a short lowercase name
+ derived from the folder name (letters, digits and dashes only).
+2. Run `xerj autoindex "$1" --prefix <prefix>` and wait for it to finish. Re-runs
+ are incremental, so this is also how to pick up changed files later.
+ If it stops with exit code 4 and prints a JSON list of plans, the full
+ folder would not fit the node's disk. Show the user the plans and ask which
+ one to use before re-running with `--yes` (the recommended plan) or
+ `--plan <name>`. Never pass `--drop-indexed` without asking: it confirms
+ deleting already-indexed data.
+3. Report how many files were indexed and any files that were skipped and why,
+ as printed by the command. Tell the user the prefix to search with:
+ `/xerj-knowledge:find <question>`.
+
+If `xerj` is not installed or no node is running, do not try to work around it:
+show the install and start steps from the plugin README.
diff --git a/plugins/xerj-knowledge/skills/xerj-knowledge/SKILL.md b/plugins/xerj-knowledge/skills/xerj-knowledge/SKILL.md
new file mode 100644
index 000000000..c9a2622b7
--- /dev/null
+++ b/plugins/xerj-knowledge/skills/xerj-knowledge/SKILL.md
@@ -0,0 +1,44 @@
+---
+name: xerj-knowledge
+description: Search the user's own local documents (folders, notes, PDFs, Word, PowerPoint, Excel, EPUB, mail and mbox exports) with XERJ and answer with the file and page each fact came from. Use when the user asks to find something in their files, notes, mail or spreadsheets.
+---
+
+# Search local documents with XERJ
+
+XERJ indexes a folder on this machine and returns ranked passages with their
+source. Nothing is uploaded: the index and the files stay local.
+
+## When to use it
+
+- "Find the contract that mentions the renewal date", "what did we decide about
+ the budget in the March notes", "which spreadsheet has the Q3 numbers".
+- Any question whose answer is in the user's own documents rather than on the web
+ or in a code base.
+
+## How
+
+1. If the folder is not indexed yet, index it once (it is incremental on
+ re-runs, so running it again only picks up changed files):
+ `xerj autoindex "<folder>" --prefix <name>`
+ Pick a short `<name>` per folder (for example `notes`, `mail`, `finance`) and
+ reuse it.
+2. Search with the MCP tool `xerj_search` (a plain-string query is fine), or on
+ the command line: `xerj search --prefix <name> "<plain words>"`.
+ The ranking matches words, not meaning, so use the words the document would
+ use: names, titles, figures, phrases.
+3. Open the passage's source before relying on it when the answer matters.
+
+## Citing
+
+- Every claim in the answer names its source as it was printed: the file path,
+ plus the page (PDF), slide (PPTX), sheet (XLSX) or message (mail) when the hit
+ carries one.
+- If nothing relevant comes back, say so and say what was searched (folder and
+ prefix). Do not fill the gap from memory.
+
+## Limits
+
+- XERJ needs the `xerj` binary on PATH and a running local node for these
+ tools. If the tool is missing or the node is down, tell the user how to start
+ it (see the plugin README) instead of guessing an answer.
+- Scanned PDFs without a text layer have no text to search.