Metadata-Version: 2.5
Name: indexed-sh
Version: 0.1.0
Summary: CLI and MCP server for semantic document search with AI agent integration
Project-URL: Homepage, https://indexed.sh
Project-URL: Repository, https://github.com/LennardZuendorf/indexed
Project-URL: Issue Tracker, https://github.com/LennardZuendorf/indexed/issues
Author-email: Lennard Zündorf <lennard@zuendorf.me>
License: See LICENSE file
License-File: LICENSE
Keywords: ai,cli,faiss,mcp,rag,semantic-search
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Requires-Python: <3.15,>=3.11.5
Requires-Dist: art>=6.5
Requires-Dist: atlassian-python-api>=4.0.7
Requires-Dist: bs4>=0.0.2
Requires-Dist: docling-core[chunking]>=2.91.0
Requires-Dist: docling>=2.129.0
Requires-Dist: faiss-cpu>=1.15.1
Requires-Dist: fastmcp<4,>=3.4.10
Requires-Dist: httpx>=0.28.1
Requires-Dist: langchain-text-splitters>=1.1.2
Requires-Dist: llama-index-core<0.15,>=0.14.25
Requires-Dist: llama-index-embeddings-huggingface<0.15,>=0.8.0
Requires-Dist: loguru>=0.7.3
Requires-Dist: mcp<2,>=1.30.0
Requires-Dist: onnxruntime>=1.28.0
Requires-Dist: orjson>=3.11.9
Requires-Dist: pathspec>=1.1.1
Requires-Dist: pydantic>=2.13.4
Requires-Dist: python-dotenv>=1.2.2
Requires-Dist: requests>=2.34.2
Requires-Dist: rich>=15.0.0
Requires-Dist: sentence-transformers>=5.7.0
Requires-Dist: tomlkit>=0.15.1
Requires-Dist: tree-sitter-c>=0.24.2
Requires-Dist: tree-sitter-cpp>=0.23.4
Requires-Dist: tree-sitter-go>=0.25.0
Requires-Dist: tree-sitter-java>=0.23.5
Requires-Dist: tree-sitter-javascript>=0.25.0
Requires-Dist: tree-sitter-python>=0.25.0
Requires-Dist: tree-sitter-rust>=0.24.2
Requires-Dist: tree-sitter-typescript>=0.23.2
Requires-Dist: tree-sitter>=0.26.0
Requires-Dist: typer>=0.26.8
Requires-Dist: xxhash>=4.0.0
Description-Content-Type: text/markdown

<div align="center">

<img src="./docs/img/logo.png" alt="Indexed Logo" width="500"/>

### One local knowledge base per project. Code, docs, issues, wikis — one MCP, zero cloud.

[![License: Sustainable Use](https://img.shields.io/badge/License-Sustainable%20Use-blue)](#license)
[![Python 3.11–3.14](https://img.shields.io/badge/Python-3.11%E2%80%933.14-3776AB?logo=python&logoColor=white)](#)
[![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-5A45FF)](#mcp-integration)

[![Python Full Test Suite with Coverage](https://github.com/LennardZuendorf/indexed/actions/workflows/python-cov.yml/badge.svg)](https://github.com/LennardZuendorf/indexed/actions/workflows/python-cov.yml) [![Python Build and System Tests](https://github.com/LennardZuendorf/indexed/actions/workflows/python-ci.yml/badge.svg)](https://github.com/LennardZuendorf/indexed/actions/workflows/python-ci.yml) [![Python Performance Benchmarks](https://github.com/LennardZuendorf/indexed/actions/workflows/python-benchmark.yml/badge.svg)](https://github.com/LennardZuendorf/indexed/actions/workflows/python-benchmark.yml) [![codecov](https://codecov.io/gh/LennardZuendorf/indexed/graph/badge.svg?token=6P99FW1Z1A)](https://codecov.io/gh/LennardZuendorf/indexed)

[Quickstart](#quick-start) · [Documentation](https://indexed.sh/docs) · [Blog & Guides](https://indexed.sh/blog)

</div>

---

Local-first semantic search for AI agents. Give Claude Code, Cursor, Codex, and other MCP-compatible agents deep context over your codebase, docs, issues, and wikis — no source read in isolation.

**Key Features:**
- **Privacy-first** — all processing and storage happens locally, no data sent to third parties
- **Semantic search** — understands meaning, not just keywords, using a LlamaIndex-powered engine with optional cross-encoder reranking
- **Multiple sources** — local files (25+ formats), Jira, Confluence, Outline Wiki, and GitHub (issues, PRs, Projects v2)
- **MCP integration** — works with Claude Code, Cursor, Windsurf, Cline, and other MCP-compatible agents
- **LSP integration** — `indexed lsp` serves the same index to any editor: search it from the symbol palette, hover a file to see what the index knows, jump to the definition the index has seen, list the places it has seen a name, and get diagnostics that say only what the index can prove — this file is not in any collection, or the index holds an older version of it (VS Code, Neovim, Zed, Helix)
- **Incremental updates** — keep your index fresh with git-based change tracking

## Quick Start

```bash
# 1. Install indexed globally
uv tool install indexed-sh

# 2. One-time setup: fetch the embedding model
indexed init

# 3. Create a collection from local files
indexed index create files --collection my-project --path ./src

# 4. Search your collection
indexed index search "your query"

# 5. Or take the machine payload (the MCP tools return the same object)
indexed index search "your query" --json
```

**What the first run downloads.** Indexed fetches the embedding model
`sentence-transformers/all-MiniLM-L6-v2` — about 88 MB of weights and tokenizer —
into the HuggingFace cache (`~/.cache/huggingface`, override with `HF_HOME`).
Skipping `indexed init` only moves that download into the first `index create`;
after that every command reads from the cache and works offline
(`HF_HUB_OFFLINE=1`).

On success, `--json` prints one object with a `schema` id, documents grouped, and
a locator per hit. Check the CLI exit code before parsing stdout; escaping errors
can print a non-JSON error panel, and exit 0 can still contain an error body.
This excerpt keeps values from a real collection; the second hit is elided,
which is why `counts.hits` says 2:

```json
{
  "schema": "indexed.search/1",
  "query": "how are failed requests retried",
  "counts": { "documents": 1, "hits": 2 },
  "collections": ["docs-quick"],
  "collection_errors": [],
  "sources": [
    {
      "collection": "docs-quick",
      "source_type": "localFiles",
      "status": "ok",
      "hits": 2
    }
  ],
  "documents": [
    {
      "collection": "docs-quick",
      "source_type": "localFiles",
      "id": "retry.md",
      "path": "/var/lib/srv/hermes/profiles/prism/cache/scratch/docs-retry-min/retry.md",
      "score_kind": "l2_squared",
      "hits": [
        {
          "relevance": 0.6003,
          "score": 0.7995,
          "locator": { "kind": "headings", "headings": ["Retry policy"] },
          "text": "Retry policy\nRequests are retried three times with exponential backoff. A 429 response resets the backoff window instead of failing the call."
        }
      ]
    }
  ]
}
```

Full field list: [`docs/reference/search-output.md`](docs/reference/search-output.md).
Every hit in that payload also carries `ref`, an opaque token for that exact
chunk. `indexed index expand "<ref>" --before 1 --after 1` (or the MCP `expand`
tool) returns the match plus a bounded window of neighbours, and refuses a
reference whose chunk no longer holds the text it was issued for — see
[`docs/reference/expand-output.md`](docs/reference/expand-output.md).

## Why Indexed?

AI agents search your codebase on demand with grep — fast for small repos, but expensive on large ones. Every file read costs tokens. Every broad search burns context window.

Indexed pre-computes a semantic search index over your code, docs, and project tools, then exposes it via MCP. The result: instant, relevant context retrieval without the token overhead.

- **Not just search.** A single index over one source is the easy part — every RAG toolkit does that. The hard, useful part is that no single source has the answer: code doesn't explain *why*, a ticket doesn't show *what shipped*, history doesn't say *if it's still true*. Indexed's direction is one merged knowledge base per project — code, docs, issues, and wikis tied together, not five indexes you query separately. See [`docs/spec/concepts/vision.md`](docs/spec/concepts/vision.md) for where this is headed (structural graph relationships, graph-aware retrieval, optional local-model-driven merging).
- **Not just code.** Index Markdown, PDFs, DOCX, PPTX, images, and 25+ formats via Docling. AST-aware code chunking via tree-sitter.
- **Not just local files.** Native Jira, Confluence, Outline Wiki, and GitHub connectors pull tickets, pages, issues, and PRs into your index.
- **Not cloud-dependent.** Runs entirely on your machine. Local embedding models, FAISS or LlamaIndex-managed vector storage. No API keys required.
- **Not one-shot.** Incremental updates via `indexed index update` keep your index fresh as your sources evolve.

## MCP Integration

Indexed exposes a Model Context Protocol server for AI agent integration.

### Repository scope (MCP roots)

One server can serve several agents at once, so **scope is per request**: the
server asks the client which directories it is working in (MCP *roots*), reads
the committed `indexed.toml` at that repository root, and searches exactly that
selection from the global store. The server's own working directory is never
scope, so two clients in two repositories get two different, correct answers.

A request that cannot be placed fails closed and says why:

| Error `type` | Meaning |
| --- | --- |
| `NoRequestScopeError` | the client advertises no roots, or no root has an `indexed.toml` |
| `AmbiguousRequestScopeError` | the client's roots resolve to more than one `indexed.toml` |
| `CollectionOutsideScopeError` | a collection named in a call is outside that selection |

The remedy is a committed definition — `indexed storage migrate` writes one at
the repository root, or write it yourself:

```toml
version = 1

[collections]
use = ["my-docs"]
```

A client that does not advertise MCP roots cannot use the server; the error
envelope above is what it receives instead of another project's collections.

### Claude Code (CLI, VS Code, JetBrains)

Works across all Claude Code surfaces — CLI, VS Code extension, and JetBrains plugin.
One command registers the MCP server, installs the `index-use` skill and adds a
`PreToolUse` hook that nudges Claude away from Grep/Glob toward semantic search:

```bash
indexed install claude-code             # server + skill + hook
indexed install claude-code --dry-run   # print the plan, write nothing
indexed install claude-code --remove    # undo exactly what it installed
indexed install claude-code --home /data/agent-home  # collections in /data/agent-home/.indexed
```

It writes a *user-scope* server (available in every project) using the absolute
path of the running `indexed` executable, and touches five files:

| Path | What it owns |
| --- | --- |
| `~/.claude.json` | the `mcpServers.indexed` entry |
| `~/.claude/skills/index-use/SKILL.md` | the `index-use` skill |
| `~/.claude/hooks/indexed-suggest-mcp.sh` | the nudge hook script |
| `~/.claude/settings.json` | the `PreToolUse` group that runs that hook |
| `~/.claude/indexed-install.json` | the manifest: what was installed, by which version |

Everything else in those files — other servers, other hooks, `projects`,
credentials — is preserved, and each rewritten file keeps a `.bak` beside it.
Safe to run twice: an existing install is upgraded in place, never duplicated.
`--remove` deletes only the artifacts above (and only ones it recognises as its
own) and prunes the directories it emptied.

The hook is silent unless indexed actually has collections (the collections root
this install points at, or a `.indexed/collections.json` workspace pointer), so it
costs nothing on a machine that does not use indexed. It only *adds context* to
Grep/Glob calls — it never approves, blocks or prompts, so your permission rules
and directory prompts behave exactly as before. Set
`INDEXED_HOOK_LOG=/path/to/log` to trace its firings.

Restart Claude Code, then use `/index-use`.

Manual alternative (registers the server only — no skill, no hook):

```bash
claude mcp add indexed -s user -- indexed mcp run
```

To add it per project instead, create or edit `.mcp.json` in your project root:

```json
{
  "mcpServers": {
    "indexed": {
      "command": "indexed",
      "args": ["mcp", "run"]
    }
  }
}
```

The installed skill documents the `indexed.search/1` result shape; the full
contract is in [docs/reference/search-output.md](docs/reference/search-output.md).

### Codex CLI

One command registers the MCP server, installs the `index-use` skill and adds a
`PreToolUse` hook that nudges Codex away from shell `grep`/`rg` toward semantic
search:

```bash
indexed install codex             # server + skill + hook
indexed install codex --dry-run   # print the plan, write nothing
indexed install codex --remove    # undo exactly what it installed
indexed install codex --home /data/agent-home  # collections in /data/agent-home/.indexed
```

It writes a *user-scope* server (available in every project) using the absolute
path of the running `indexed` executable, into `~/.codex` — or `$CODEX_HOME`
when you set one:

| Path | What it owns |
| --- | --- |
| `~/.codex/config.toml` | the `mcp_servers.indexed` table |
| `~/.codex/skills/index-use/SKILL.md` | the `index-use` skill |
| `~/.codex/hooks.json` | the `PreToolUse` group that runs the nudge hook |
| `~/.codex/indexed/indexed-nudge.sh` | the nudge hook script |
| `~/.codex/indexed-install.json` | the manifest: what was installed, by which version |

`config.toml` is hand-edited TOML, so the installer edits it as *text*: only its
own table block is ever written or deleted, and everything else — comments,
spacing, `projects`, other servers — stays byte for byte. (This is deliberate:
`codex mcp add` re-serialises the whole `[mcp_servers]` region and drops the
comments inside it.) Files the command rewrote keep a `.bak` beside them, and
running it twice upgrades in place rather than duplicating. `--remove` deletes
only the artifacts above, only ones it recognises as its own, and puts the rest
of `config.toml` back exactly as it was.

Codex does not run a hook until it is trusted. Rather than forge that state, the
installer asks Codex for the hash it computed (`codex app-server` → `hooks/list`)
and records it in `config.toml` — the same write Codex's TUI makes when you
approve a hook. If `codex` is not on `PATH`, the install still completes and says
the hook needs a one-time approval.

Codex has no Grep/Glob tool: it searches through the shell. So the installed hook
watches `Bash` (and the platform equivalents), and when the command line looks
like a recursive text search while indexed has collections, it adds a reminder
pointing at `mcp__indexed__search`. It is silent for anything else — non-search
commands, commands already using `indexed`, machines with no collections — and
it never approves, blocks or prompts. Set `INDEXED_HOOK_LOG=/path/to/log` to
trace its firings.

Restart Codex; the `index-use` skill is listed and the nudge hook runs on shell
search commands.

Manual alternative (registers the server only — no skill, no hook):

```bash
codex mcp add indexed -- indexed mcp run
```

The installed skill documents the `indexed.search/1` result shape; the full
contract is in [docs/reference/search-output.md](docs/reference/search-output.md).

### OpenCode

Same four commands, against OpenCode's own config dir (`$OPENCODE_CONFIG_DIR`,
else `$XDG_CONFIG_HOME/opencode`, else `~/.config/opencode`):

```bash
indexed install opencode             # server + skill + context nudge
indexed install opencode --dry-run   # print the plan, write nothing
indexed install opencode --remove    # undo exactly what it installed
indexed install opencode --home /data/agent-home  # collections in /data/agent-home/.indexed
```

| Path | What it owns |
| --- | --- |
| `opencode.json` (or `opencode.jsonc`) | the `mcp.indexed` server entry |
| `skills/index-use/SKILL.md` | the `index-use` skill |
| `plugins/indexed-nudge.js` | the context nudge plugin |
| `indexed-install.json` | the manifest: what was installed, by which version |

The server goes under the flat `mcp.indexed` key. This build normalises that into
`mcp.servers` in memory, and public opencode 1.x only understands the flat form,
so one file serves both. Tested against opencode v2.3.2
(`@opencode/cli@2.3.2`); the plugin API it uses is the 2.x one.

The config is hand-edited JSONC, and OpenCode never rewrites it — no command, not
even loading a server, touches the bytes. So the installer splices *text*: only
the `indexed` member is written or deleted, and comments, key order, indentation
and CRLF endings all survive. `--remove` puts the file back byte for byte, and
prunes the `mcp` block only if this install created it. Each file the command
rewrites has a `.bak` of its previous contents beside it (last write only), and
a second run upgrades in place rather than duplicating.

There is no hook-trust gate on this host: a plugin is a bare `.js` file in
`plugins/`, which OpenCode imports and calls `setup()` on with no prompt, no hash
and no approval marker. So there is nothing to approve after installing, and the
command writes each file exactly once. The plugin registers one
`session.hook("context")` handler and only ever appends a paragraph to the system
prompt — it registers no permission or tool hook, so it cannot allow, deny or
rewrite a tool call. It is silent when indexed has no collections, and every
filesystem read is wrapped, so a broken install cannot break a session. Set
`INDEXED_HOOK_LOG=/path/to/log` to append one JSON line per firing.

Code Mode is on by default in OpenCode, so the skill teaches
`await tools.indexed.search({ query: "..." })` (and
`tools.indexed.search_collection({...})`) inside the `execute` tool, with the
flat `indexed_search` named for `codemode: false` installs. The skill text is
advertised from `skills/index-use/SKILL.md`; the directory name is the skill id.

Restart OpenCode; the `index-use` skill is advertised and the nudge plugin loads
from `plugins/`.

Manual alternative (registers the server only — no skill, no plugin):

```bash
opencode mcp add --global indexed -- indexed mcp run
```

The installed skill documents the `indexed.search/1` result shape; the full
contract is in [docs/reference/search-output.md](docs/reference/search-output.md).

### Cursor / Windsurf / Other Agents

Add to your agent's MCP configuration file:

```json
{
  "mcpServers": {
    "indexed": {
      "command": "indexed",
      "args": ["mcp", "run"]
    }
  }
}
```

### Claude Desktop

Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):

```json
{
  "mcpServers": {
    "indexed": {
      "command": "indexed",
      "args": ["mcp", "run"]
    }
  }
}
```

### Server Mode

```bash
# HTTP server mode
indexed mcp run --transport http --port 8000
```

### Keeping an MCP server fresh

An MCP server is long-lived, so there is no per-collection command to run. Turn the
[`index watch`](#watching-a-collection) watcher on for the server with an opt-in switch
(**off by default** — nothing changes if you don't set it):

```toml
[mcp]
watch_enabled = true
watch_debounce_seconds = 2.0
watch_poll_interval_seconds = 2.0
```

With it on, `indexed-mcp run` plans a watcher for **every `localFiles` collection that exists
at startup**: an edit, new file or deletion shows up in `search` within roughly one poll
(`watch_poll_interval_seconds`), one quiet period (`watch_debounce_seconds`) and the update
pass itself — with no manual `index update` and no server restart. A startup catch-up pass
also indexes edits made while the collection was not watched.

The watched set is fixed at startup: a collection created *while the server is running* is
not watched, and is picked up on the next restart — the set is never re-planned behind you.
Remote collections (Jira, Confluence, Outline, GitHub) are never watched: only local files
have a change signal.

Its cost is one background thread per watched collection, held for the lifetime of the
server. Those threads come from the event loop's default pool, which is capped at
`min(32, CPU count + 4)`: collections past that cap wait without refreshing instead of
starting. A watcher that fails three update passes in a row also stops for that collection —
the server keeps serving the last good index, and only a restart starts it again. Same
caveats as the CLI: the server is a single writer per collection, and a source directory that
disappears keeps the last good index rather than emptying the collection.

## Supported Sources

| Source | Description |
|--------|-------------|
| **Local Files** | `.pdf`, `.docx`, `.pptx`, `.md`, code files, images, and 25+ formats |
| **Jira** | Cloud and Server/Data Center with JQL filtering |
| **Confluence** | Cloud and Server/Data Center with CQL filtering |
| **Outline Wiki** | Cloud or self-hosted, with attachments and OCR |
| **GitHub** | Issues, PR threads, and Projects v2 boards — github.com, GHE, or self-hosted GHES; whole conversation (paginated past 100 comments, explicit truncation past 1000); project single-select and text fields |

## Installation

Requires **Python 3.11–3.14** and **[uv](https://docs.astral.sh/uv/)**. The upper
bound is temporary: `onnxruntime` publishes no `cp315` wheel yet, so a 3.15
interpreter cannot resolve the dependency set.

```bash
uv tool install indexed-sh
```

This installs `indexed` as a global CLI tool from [PyPI](https://pypi.org/project/indexed-sh/).

```bash
indexed --version   # prints the installed version, e.g. 0.0.11
```

Then run the one-time setup, which creates `~/.indexed`, validates your config,
and fetches the default embedding model into the HuggingFace cache:

```bash
indexed init
```

`indexed init` fetches only the files the embedder loads — the safetensors
weights, the tokenizer, and the configs the sentence-transformers modules read —
about 88 MB on a clean cache. It does not fetch the repository's other exports
(ONNX, OpenVINO, TF, the torch `.bin`), so setup stays bounded to the model files
that loading actually reads. It is idempotent.

Skipping it is safe, and it defers nothing beyond that download: the first
`index create` fetches the same ~88 MB at that moment instead. Neither path ever
pulls the whole repository, and after that one download every command reads the
cache and works offline.

<details>
<summary>Alternative: run without installing</summary>

```bash
uvx indexed-sh index search "your query"
```

</details>

<details>
<summary>Alternative: install from source</summary>

```bash
git clone https://github.com/LennardZuendorf/indexed.git
cd indexed
uv sync
uv run indexed --help
```

</details>

## Usage

```bash
# Setup
indexed init                              # one-time model fetch (~88 MB) + data dirs

# Create collections (Jira/Confluence auto-detect Cloud vs Server from --url)
indexed index create files --collection my-project --path ./src
indexed index create jira --collection jira-issues --url https://your-domain.atlassian.net
indexed index create confluence --collection wiki --url https://your-domain.atlassian.net/wiki
indexed index create outline --collection docs
indexed index create github --collection my-repo --repo owner/repo
indexed index create files --collection my-app --path ./src --engine v2

# Search
indexed index search "authentication flow"
indexed index search "bug reports" --collection jira-issues
indexed index search "why was this refactored" --rerank   # v2 collections only
indexed index search "authentication flow" --json        # indexed.search/1 payload
indexed index search "recent work" --changed-since HEAD~5  # v2 files collections
indexed index search "who wrote this" --git-provenance     # v2 files collections only
indexed index search "who wrote these lines" --git-line-blame  # v2 files collections only
indexed index search "what changed lately" --git-rerank    # v2 files collections only
indexed index search "auth" --freshness                    # warn if the index is behind
# A filter a collection cannot honour warns per collection, never silently

# Manage collections
indexed index inspect                    # list all collections
indexed index inspect my-project         # inspect specific collection (+ freshness)
indexed index update my-project          # update a collection
indexed index remove my-project          # delete a collection
indexed index migrate my-project         # migrate to the v2 engine

# Keep a collection fresh while you work (opt-in, foreground)
indexed index watch my-project           # Ctrl-C to stop
indexed index watch my-project --debounce 5 --poll-interval 1

# Configuration
indexed config list                              # resolved configuration
indexed config set core.v1.search.max_docs 20    # set a value

# Share one collection between projects (stable id in ~/.indexed)
indexed storage migrate --dry-run         # report collisions and affected data
indexed storage migrate                   # move this project's collections to the shared store
indexed storage migrate --on-collision adopt  # reuse an identical copy instead of keeping a second
indexed storage migrate --verify hash     # compare file content, not just names and sizes
indexed storage migrate --rollback        # put this project's collections back

# Editor integration (Language Server Protocol, stdio)
indexed lsp                              # point your editor's LSP client here
```

`indexed storage migrate` gives a collection a stable id in the global store and
records that id in a committed **`indexed.toml` at your repository root**, so a
second clone reads the same index instead of rebuilding it. It journals every
step, so an interrupted run resumes where it stopped, and `--rollback` restores
the original local collection. Two collections are judged identical by
`--verify structural` by default — manifest plus file names and sizes, which is
fast but does **not** compare content — so a same-size, different-bytes copy
passes. Use `--verify hash` for a streamed SHA-256 of every file: it refuses on
any mismatch (naming the files), checks the moved bytes before registering them,
and `--on-collision adopt` then never deletes a local copy whose content differs.

Commit that file — it is the repository's scope, and it is the only thing that
travels between clones:

```toml
# indexed.toml — commit this file.
version = 1

[collections]
use = ["indexed-docs", "8b1d2f5e6a7c4b9d0e3f2a1c8d7b6e5f"]
```

Entries are stable ids (what `storage migrate` writes) or collection names (what
you type); both resolve against `~/.indexed/data/`, so nothing is copied into the
repository. With the file in place `indexed search` searches **only** the listed
collections, and `indexed lsp` scopes `workspace/symbol`, hover and diagnostics
the same way; `--collection NAME` still searches outside the list, with one
warning line. Without the file nothing changes: every collection in the store is
in scope.

The file is a **declaration**, not a lock: it says what the repository will
search, and the store says what exists today. So a fresh clone is not deadlocked
by it — on a machine where the store does not hold the listed collections yet,
`indexed index create <source> --collection <name>` builds the one you name,
`indexed index update` refreshes whatever exists, and `indexed index inspect`
lists what the store serves. Each of them prints one line for an entry the store
cannot serve yet, naming the entry and the remedy, so the narrower scope is never
silent. A malformed file or an unsupported `version` is still fatal on every
command: tolerance is about the store's contents, never about a file that cannot
be read. `index search` answers from the entries that resolve and names a dead
one per source in the payload (`sources[].status = "missing"`, with the file and
the remedy); `indexed lsp` and `indexed init` fail loudly instead, because
neither can report a per-entry gap. `index create` never edits the file: a
collection created in a repo with a definition warns that it is outside the scope
until you list it — unless the definition already names it, which is exactly the
bootstrap. Names are what travel: a stable id binds one machine's registry
record, so a definition meant for other clones lists names (`use` accepts both).

The older `./.indexed/collections.json` pointer is deprecated and read-only; it
keeps working with one warning naming `indexed.toml`, and is removed in the next
minor.

For the full CLI reference and configuration guide, see the [documentation](https://indexed.sh/docs).

### Editor setup (LSP)

`indexed lsp` is a stdio server over the **same storage as the CLI**. Start it from the
project root; a workspace `.indexed` store needs `indexed --local lsp`. VS Code has no
built-in hook, so register the command in a generic LSP client extension's `settings.json`:
`{"indexed": {"command": "indexed", "args": ["lsp"]}}`; Neovim 0.11+:
`vim.lsp.start({ name = "indexed", cmd = { "indexed", "lsp" } })`; Zed and Helix take the
same command and args. Diagnostics are `not-in-any-collection` and `index-stale` —
severity Information, source `indexed`. There is no per-keystroke sync
(`textDocumentSync.change: 0`): the server reads the file from disk, by design.
Definition returns at most 5 locations (a whole-file range when the source has no line
span); references at most 50.

### Watching a collection

`indexed index watch <collection>` (or `-c/--collection`) first runs an incremental update
to catch up, then polls the source directory and updates once a burst of edits goes quiet,
so edits, new files and deletions show up in search without a manual `index update`. It
only works for `files` collections (remote sources have no local change signal) — any
other source type is refused with **exit 2** — and it is **opt-in**: nothing starts it
except typing the command, it runs in the foreground, and Ctrl-C is the off switch — no
daemon, no service, no config flag. `--once` runs a single update pass and exits instead
of watching.

While it runs it prints one line per update it applies (`updated collection from N
watched file(s)`) and one line when it picks up again after the source path went away —
at the default log level, so an edit landing is visible without `-v`.

If the watched directory disappears (unmounted drive, renamed folder), the watcher logs
an error and **keeps the last good index** instead of updating against an empty tree; it
resumes when the path returns. Three consecutive failed updates end the command with a
non-zero exit code. If the source path is already missing when the command starts,
it refuses up front with **exit 2** — updating against an unreachable source would
empty the collection. A directory that exists but cannot be read is not caught by
that check: the first update pass fails (`Permission denied`, non-zero exit) and
the last good index is kept.

Tune the cadence with `--debounce` / `--poll-interval` (seconds; both default to 2.0), or
in config:

```toml
[watch]
debounce_seconds = 2.0
poll_interval_seconds = 2.0
```

Serving the same collections to a long-lived MCP server, where a per-collection command has
nowhere to run? The server takes the same watcher behind an opt-in `[mcp]` switch — see
[Keeping an MCP server fresh](#keeping-an-mcp-server-fresh) for the keys, the startup-scope
rule and its cost.

## Roadmap

Indexed today runs parallel semantic indexes per source. The direction is one merged
knowledge graph per project — code, docs, issues, git history, connected codebases, and
accumulated lessons/memory as one structure instead of several. See
[`docs/spec/concepts/vision.md`](docs/spec/concepts/vision.md) and [Knowledge Graph](docs/spec/concepts/knowledge-graph.md) for what's shipped
vs. planned.

## Documentation

- [Search result reference](docs/reference/search-output.md) — the `indexed.search/1` payload that `--json` and the MCP tools return, field by field
- [Expand a hit into context](docs/reference/expand-output.md) — the `indexed.ref/1` token you store, the bounded `indexed.expand/1` window, and the stale-reference contract
- [Full Documentation](https://indexed.sh/docs) — CLI reference, configuration, and guides
- [Blog & Guides](https://indexed.sh/blog) — tutorials and use cases
- [Issue Tracker](https://github.com/LennardZuendorf/indexed/issues) — report bugs or request features

## Contributing

```bash
git clone https://github.com/LennardZuendorf/indexed.git
cd indexed
uv sync --all-groups
uv run pytest -q
```

Performance benchmarks (`tests/benchmarks/`, `tests/system/`) run in CI via
[`pytest-bench-action`](https://github.com/LennardZuendorf/pytest-bench-action)
— see `.github/workflows/python-benchmark.yml`. Run them locally with:

```bash
uv run pytest tests/system tests/benchmarks --benchmark-only
```

Retrieval quality has its own measurement: a pinned corpus and judged query set
with hit-rate@k / MRR, so a ranking change can be compared instead of argued
about. Reproduce the committed baseline and compare against it:

```bash
uv run indexed-eval run --out /tmp/report.json
uv run indexed-eval compare --report /tmp/report.json
```

See [`eval/README.md`](eval/README.md) for provenance, the metric definitions and
the measured baseline.

See [`AGENTS.md`](AGENTS.md) and [`docs/spec/tech.md`](docs/spec/tech.md) for architecture details.

## License

See [LICENSE](./LICENSE) file for details.

## Credits

The Core v1 implementation is based on [documents-vector-search](https://github.com/shnax0210/documents-vector-search) by shnax0210, licensed under MIT and modified extensively.

---

**[indexed.sh](https://indexed.sh)** · Star the repo if you find it useful!
