local first · agent first · one binary

ctxq — a local knowledge index for AI agents

ask the index, get the line

No more grep loops eating your context. One MCP call, one sourced passage.

Your agent shouldn't dig through folders. ctxq indexes your docs, live inventories and code for it and serves back sourced passages. One binary. Local first.

$ curl -fsSL https://ctxq.dev/install.sh | sh && . "$HOME/.ctxq/env"

Linux x86_64 static musl · SHA-256 verified · no root · ctxq is on your PATH when the line returns

What it indexes

One index for the whole workspace

One SQLite file next to your project. Everything runs on your machine.

01Docs

Markdown, Word, PowerPoint with speaker notes, Excel and PDF. Converted in-process, cut by heading.

02Live inventories

Docker, systemd, listening ports, projects, scripts. One row per chunk: “which port?” gets the row.

03Code graph

Rust, TS/JS, Python, Go, Java, Kotlin, C#. Symbols, callers, callees, impact of a diff.

04Offline first

BM25 is always on. Plug Ollama or any OpenAI-compatible server for hybrid search.

05Secrets stay out

A file holding a key is quarantined: never indexed, never served.

06Always sourced

Every passage comes back with its file and line range.

Agent ready

Paste this into your agent

Claude Code, Codex, Copilot CLI. It installs ctxq, indexes the project and registers the MCP server.

Set up ctxq (https://ctxq.dev) for this project. Follow these steps exactly; do not invent flags or URLs.
Rules: no sudo, do not edit project files yourself, stop and quote the exact error if a step fails.

1. If an MCP server named "ctxq" is already available, call its status tool, report the result, and stop.
2. If you are Codex: your sandbox blocks the ctxq binary, so do not run it. Ask me to run this in a normal terminal from this project's root, then to restart Codex:
   curl -fsSL https://ctxq.dev/install.sh | sh && . "$HOME/.ctxq/env" && ctxq setup
3. Otherwise, if ctxq is not on PATH, install it (checksum-verified, no root):
   curl -fsSL https://ctxq.dev/install.sh | sh
4. From this project's root (never from $HOME), run:
   . "$HOME/.ctxq/env" && ctxq setup
   It indexes the project, registers the "ctxq" MCP server in every agent CLI it finds, and adds AGENTS.md, CLAUDE.md, .mcp.json and .codex/ (expected). Do not start "ctxq mcp" yourself.
5. Run: . "$HOME/.ctxq/env" && ctxq status
   Report the indexed counts and any quarantined files, then tell me to restart this agent and approve the ctxq server if asked.

Codex's sandbox blocks the binary: it hands you the one line to run, then you restart it.

Agent surface

One MCP server, bounded and sourced

searchRanked passages with source lines
inventoryThe exact row: port, container, domain
contextDocs and code together, within a token budget
mapOne line per document
annotateNotes for the next agent
statusFreshness, quarantined files
code_symbolSignature, doc, body
code_callers · code_calleesWho calls it, what it calls
code_pathShortest call chain
code_impactDiff → callers → docs

MRR 0.795 · 71 % hit@1 · 92 % hit@5 on a 100-question private set (hybrid, qwen3-embedding 0.6b). Method, configuration and everything else: README.