Polaris for Codex

Codex connects to Polaris over stdio MCP. Run polaris setup and it writes the MCP config and updates AGENTS.md to nudge Codex toward polaris.search.

How it works with Codex

Codex supports MCP servers over stdio. When polaris setup runs, it:

  1. Writes .mcp.json — configures the stdio transport so Codex can spawn Polaris.
  2. Updates AGENTS.md — adds an instruction telling Codex to use polaris.search for documentation questions instead of grepping.

AGENTS.md is the standard way to give Codex project-specific instructions. Polaris writes a section that explains what the search tool does and when to use it — so Codex knows to call it without you having to prompt manually.

Setup

curl -fsSL https://raw.githubusercontent.com/girard-g/polaris/main/install.sh | bash
polaris setup            # writes .mcp.json + AGENTS.md
polaris index ./docs     # index your markdown
polaris serve            # start the MCP server

Full install guide →

Background reindexing

Like Cursor, Codex doesn't support PostToolUse hooks. Run polaris watch in a separate terminal to keep your index fresh as files change. Modified markdown files are reindexed in ~500ms.

Token savings

Codex burns through tokens fast when it reads raw files for context. Polaris cuts that by returning only the relevant sections from your docs: 10–40× fewer tokens per documentation query. The search uses hybrid BM25 + vector retrieval with RRF fusion and heading-aware boosting.

See live savings data →