Polaris for Claude Code

The deepest integration. One command wires everything — MCP config, agent instructions, and two hooks that auto-index on every edit and optionally auto-search on every prompt. Zero ongoing maintenance.

How it works

Running polaris setup in your project does three things:

  1. Writes .mcp.json — points Claude Code at the Polaris MCP server binary.
  2. Updates CLAUDE.md — adds a hint telling Claude to prefer polaris.search over grep for documentation questions.
  3. Installs a PostToolUse hook — writes a hook into .claude/settings.json that fires after Write, Edit, or MultiEdit. If the changed file is a .md file under an indexed directory, Polaris reindexes it automatically in ~300 ms.

Live reindexing — unique to Claude Code

The auto-index PostToolUse hook is what makes the Claude Code integration special. When Claude edits a markdown file, Polaris reindexes it in ~300 ms — before the next search call. Your agent always searches current documentation, not a stale snapshot.

Failures are non-fatal: the hook logs to stderr and always exits 0, so a transient hiccup never surfaces as a warning banner in Claude Code or interrupts your session. To opt out, run polaris setup --no-hooks.

Auto-search — ground every prompt

An opt-in UserPromptSubmit hook searches the index on every qualifying prompt and injects the top result as context — before the model starts thinking. Two gates filter noise: prompts must be 5–150 words, and the top result must exceed a score threshold.

Adds about 1 second of latency per qualifying prompt, so it's off by default. Enable it with polaris setup --search-hook.

Token savings

Without Polaris, Claude Code uses grep-and-read to answer documentation questions — scanning files, reading matches, burning through tokens. With Polaris, it calls polaris.search and gets ranked, section-aware chunks. Measured savings: 10–40× fewer tokens per documentation query.

See live savings data → Read the auto-hooks announcement →

Quick start

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

Full install guide →