# AI use cases for Xerj (xerj-org/xerj)

Repo: [xerj-org/xerj](https://github.com/xerj-org/xerj) | Use cases: 5 | Page: https://dedupedai.com/use-cases/xerj-org-xerj/

XERJ is a local-first search engine and MCP server that indexes code, docs, logs and PDFs so AI agents can search them instead of grepping files.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Let your coding agent search a repo by meaning: https://dedupedai.com/use-cases/xerj-org-xerj/index-codebase-for-agent-search/
- Have an agent learn from similar open-source code first: https://dedupedai.com/use-cases/xerj-org-xerj/reference-coding-from-open-source/
- Search a source tree for secrets and dangerous calls: https://dedupedai.com/use-cases/xerj-org-xerj/audit-tree-for-risky-patterns/
- Search mixed logs with an Elasticsearch-compatible API: https://dedupedai.com/use-cases/xerj-org-xerj/search-logs-with-elasticsearch-api/
- Give an agent memory that survives between sessions: https://dedupedai.com/use-cases/xerj-org-xerj/agent-long-term-memory-per-project/

## How to let your coding agent search a repo by meaning with Xerj

Repo: [xerj-org/xerj](https://github.com/xerj-org/xerj) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Index a project once so an agent pulls exact passages with file:line instead of reading files one by one.

**Who it is for:** A developer using Claude Code or Cursor on a large project who is tired of the agent re-reading files and burning tokens.

**The problem:** Grep returns whole files or many matches, and the agent still has to read them, which costs tokens and time.

**The outcome:** The agent answers questions from ranked passages with file and line references, and you can look up a definition directly.

### Steps

1. `curl -fsSL https://xerj.org/get | sh`
2. `xerj --insecure --data-dir ~/xerj-data &`
3. `xerj init`
4. `xerj autoindex ~/my-project`
5. `xerj search "how do we rotate the WAL segment"`

### Prompt to paste into your agent

```text
Use the XERJ repo (xerj-org/xerj) to index <project path> with xerj autoindex, then answer the question <question> using xerj search and cite the file:line results. Verify that each cited line exists in the file before you answer.
```

### Caveat

The README says the data directory must sit outside any folder you autoindex, because data/ is not in the built-in ignore list.

Risk, credentials: The --insecure start turns off TLS and API-key auth, so keep the node on 127.0.0.1 and do not index into a shared host this way.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/xerj-org-xerj/index-codebase-for-agent-search/

## How to have an agent learn from similar open-source code first with Xerj

Repo: [xerj-org/xerj](https://github.com/xerj-org/xerj) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Index OSS projects close to your task so the agent reuses how others solved it before writing code.

**Who it is for:** A team building on a private, internal or newer library where the coding model has little or no memory of the API.

**The problem:** An agent working from memory retry-loops on APIs it has not memorised, and grep only points to where to look.

**The outcome:** The agent retrieves the mechanism from indexed source and writes code with fewer output tokens and fewer fix loops, as the README's measured case study reports.

### Steps

1. Clone the open-source repos closest to your task into one folder with git clone. (inferred, check the README)
2. `xerj --insecure --data-dir ~/xerj-data &`
3. `xerj autoindex ./oss-references` (inferred, check the README)
4. `xerj search "how is the session token refreshed"` (inferred, check the README)
5. Write your code only after citing the retrieved passages, and check each source license.

### Prompt to paste into your agent

```text
Clone the open-source repos closest to <task> into ./oss-references, index them with xerj autoindex ./oss-references, and retrieve how they solve <task> before writing code. Expected output: the new code plus a list of the file:line passages it used. Verify that the license of each referenced repo is noted.
```

### Caveat

The README says the gain is gated by memorisation and is neutral to harmful on popular public libraries the model already knows.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/xerj-org-xerj/reference-coding-from-open-source/

## How to search a source tree for secrets and dangerous calls with Xerj

Repo: [xerj-org/xerj](https://github.com/xerj-org/xerj) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Index one tree and query it for sink patterns, secrets and risky calls across every file type at once.

**Who it is for:** A security reviewer or developer preparing an audit of a codebase they own or have written permission to test.

**The problem:** Scanning mixed files one by one with grep misses context and is slow across code, configs, logs and PDFs.

**The outcome:** A ranked list of matching passages with file:line that you can triage, with the search run in one indexed pass.

### Steps

1. `xerj --insecure --data-dir ~/xerj-data &`
2. `xerj autoindex ~/target-tree` (inferred, check the README)
3. `xerj search "hardcoded api key"` (inferred, check the README)
4. `xerj search "exec("` (inferred, check the README)
5. Review each hit in context and record which ones are real findings.

### Prompt to paste into your agent

```text
Index <target path> with xerj autoindex and run xerj search for secrets and dangerous-call patterns. Expected output: a table of hits with file:line and a verdict per hit. Verify each hit by opening the cited line before reporting it.
```

### Caveat

The README lists security audits as a use, but it does not describe a built-in pattern library, so you write the queries yourself.

Risk, reverse engineering: Run this only on code you own or have written permission to audit, since the same searches can locate weak points in other people's software.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/xerj-org-xerj/audit-tree-for-risky-patterns/

## How to search mixed logs with an Elasticsearch-compatible API with Xerj

Repo: [xerj-org/xerj](https://github.com/xerj-org/xerj) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Index mixed log and data files into typed indices and query them with any Elasticsearch client.

**Who it is for:** An operator or on-call engineer who needs to analyse incident logs in several formats without building a pipeline.

**The problem:** Mixed log formats need schema work and a pipeline before they can be searched, which slows incident response.

**The outcome:** Logs become queryable indices, and existing Elasticsearch clients and dashboards work against the same endpoint.

### Steps

1. `curl -fsSL https://xerj.org/get | sh`
2. `xerj --insecure --data-dir ~/xerj-data &`
3. `xerj autoindex ~/logs` (inferred, check the README)
4. Query http://localhost:9200 with any Elasticsearch client, for example a standard _search request. (inferred, check the README)
5. Check the indices created with the phase output and confirm record counts.

### Prompt to paste into your agent

```text
Index <log directory> with xerj autoindex and answer <incident question> by querying the Elasticsearch-compatible API on http://localhost:9200. Expected output: the matching records and the index names used. Verify the record count against the indexing summary.
```

### Caveat

The README says the API is Elasticsearch-compatible, but it does not list which specific endpoints or aggregations are supported, so test your queries first.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/xerj-org-xerj/search-logs-with-elasticsearch-api/

## How to give an agent memory that survives between sessions with Xerj

Repo: [xerj-org/xerj](https://github.com/xerj-org/xerj) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Store what an agent learns in a namespace and recall it by meaning in the next session.

**Who it is for:** A developer who restarts agent sessions on one project and wants the agent to keep notes on decisions and gotchas.

**The problem:** Each new agent session starts from zero, so decisions and project quirks have to be re-explained every time.

**The outcome:** The agent stores notes in a memory namespace and recalls relevant ones by meaning at the start of the next session.

### Steps

1. `xerj --insecure --data-dir ~/xerj-data &`
2. Send a POST request to http://localhost:9200/_memory/notes with the note text as the body. (inferred, check the README)
3. Query http://localhost:9200/_memory/notes with a question to recall notes by meaning. (inferred, check the README)
4. Start the next session and ask the agent to recall notes on the project before working.

### Prompt to paste into your agent

```text
Use XERJ's /_memory/notes API on http://localhost:9200 as long-term memory for <project>: store each decision you make, and recall relevant notes at the start of the session. Expected output: a short list of recalled notes with their dates. Verify that the notes returned match the stored text.
```

### Caveat

The README names the /_memory/{namespace} path but does not give the HTTP methods or request bodies, so the request steps above are inferred and should be checked against Xerj.org/docs.

Risk, credentials: The --insecure start makes every caller a superuser who can read and delete every /_memory namespace, so do not store secrets in memory notes.

Dual-use notice: only use this on software, sites and systems you own or are authorized to test.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/xerj-org-xerj/agent-long-term-memory-per-project/
