Skip to content

Configuration

CodeNavi reads two files. .env (next to docker-compose.yml in your install directory) holds everything the container needs at boot, paths, ports, the auth token, GPU overrides, provider keys. data/settings.json holds runtime settings, index exclusions, scanner policy, crawler limits, most of them also editable on the web UI Settings screen. LLM and embedding providers have their own page: Providers.

Set these in .env (read by docker-compose). For runtime settings, copy data/settings.json.example to data/settings.json as a starting point, it documents the supported settings with _comment_* keys (LLM provider/key settings live in .env, see Providers).

Which settings.json is live:17 the server reads /app/data/settings.json inside the container. With setup.sh (Linux) that is data/settings.json in your install directory: edit it there. With setup.ps1 (Windows) it is in the codenavi-data Docker volume, and the copy in the package directory is not read. Keys that the web UI shows can be changed there. For any other key, this command works on every install (it adds the key, or replaces its value):

docker exec codenavi python -c "import json,pathlib; p=pathlib.Path('/app/data/settings.json'); d=json.loads(p.read_text()) if p.exists() else {}; d['THROTTLE_MAX_REQUESTS']=400; p.write_text(json.dumps(d, indent=2))"
docker restart codenavi

The value is Python: 400, 'text', True or False. Use podman in place of docker on a podman install. Boot-bound keys (INCLUDE_EXTENSIONS, EXCLUDE_DIRS, MAX_FILE_SIZE, …) additionally need a container restart + reindex; scanner keys hot-reload. If you edit after the server started, the next reindex prints a CONFIG WARNING naming exactly this.16

Environment variables (.env)

Installs made with 1.3.75 or older: an update replaces the image, not your compose file. Your compose file does not pass on CODENAVI_VRAM_BUDGET_GIB, RERANK_BATCH_SIZE, CODENAVI_GRAPH_CROSS_LANGUAGE, CODENAVI_WIKI_FREE_EMBEDDER or the CODENAVI_REINDEX_* variables, so in .env they have no effect. To use one, add a line such as CODENAVI_VRAM_BUDGET_GIB: "${CODENAVI_VRAM_BUDGET_GIB:-}" under environment: in that file.

Core

Variable Default Description
CODEBASE_PATH (required) Absolute path to the codebase directory to index (single codebase)
CODEBASE_CONFIG (optional) JSON map of name→path pairs for multi-codebase mode (overrides CODEBASE_PATH). Example: {"myapp":"/var/www/myapp","api":"/var/www/api"}
CODENAVI_PORT 8765 HTTP port for the MCP server + web UI (/ui)
CODENAVI_METRICS_PORT 9091 Prometheus metrics endpoint port
CODENAVI_AUTH_TOKEN (empty) Bearer token for authentication. When set, all MCP requests require Authorization: Bearer <token>. When empty, the server runs without auth.
CODENAVI_STATELESS_HTTP true MCP transport session mode.13 Default true (stateless): every request is independent, no server-side session state, robust for a self-hosted server and immune to "session not found" on restart. Set false for stateful sessions, which lets query logs record the exact calling client (the initialize handshake's clientInfo name/version, e.g. Cursor/1.x) instead of falling back to the HTTP User-Agent. Useful for integration QA where several agents share one server and you need to tell them apart. Do not enable in production unless you accept that a server restart invalidates in-flight client sessions (clients must re-initialize, and some surface an error first). Restart to apply.
HF_TOKEN (empty) Hugging Face token for model downloads (may be needed for gated models)
DOCS_DIR (empty) Absolute path to external documentation directory (PDF/DOCX files). Mounted read-only at /app/external-docs. On a multi-codebase server, use DOCS_DIR/<codebase>/ subfolders so each codebase ingests only its own docs (flat layout is a legacy fallback).
DOCS_ENABLED true Enable/disable doc ingestion.

Tool surface

The full MCP tools/list schema (43 tools with the crawler on) is ~13k tokens, injected once per conversation into the agent's prompt. For token-sensitive clients or short sessions you can advertise a lean core instead8, the rest stay available on demand.

Installs made with 1.3.75 or older: an update replaces the image, not your compose file, and that file does not pass these four variables on, so a value in .env has no effect. Put them in data/settings.json instead (the live one, see above) and restart: that works on every version. On an install made with 1.3.76 or newer, either place works and .env wins. To check: with read-only on, the startup log has a line that starts with CODENAVI_MCP_READ_ONLY: and the agent's tool list has no reindex_incremental.

Variable Default Description
CODENAVI_TOOL_PROFILE focused focused (default since 1.3.73) lists what an agent cannot do with its own grep and file reads: semantic_search, the call graph (find_callers, impact_analysis, diff_impact) and codebase_overview, plus list_codebases, the index-ops tools (reindex_incremental, reindex_status, index_stats), the approval-gated tools and reveal_tools(). CodeNavi's grep/read/browse tools (grep_search, read_file, file_search, list_directory, symbol_search, find_references) stay callable through reveal_tools(call=…) and by name. In our tests on real tickets, agents with their own grep found and fixed code as well without them, and listing them added 23-42% to the cost.24 protected (the same as the older name lean, the default from 1.3.23 to 1.3.72) lists an 11-tool core instead, the search/browse/read loop (semantic_search, file_search, grep_search, symbol_search, list_directory, read_file, codebase_overview, list_codebases) plus the everyday index-ops tools (reindex_incremental, reindex_status, index_stats), and a reveal_tools() meta-tool, a tools/list about 55% smaller; every other tool loads on demand via reveal_tools(). The approval-gated tools the plugin commands call (reindex_full, cancel_reindex; crawl, cancel_crawl with the crawler) are always listed, whatever the core override says, and reveal_tools(call=…) refuses them, so each keeps its own approval prompt (since 1.3.61, CN-913). The other gated tools (backup, restore, reindex_docs, delete_note) are not listed since 1.3.73 (agents never called them, and each listed tool costs about 350 tokens on every request) and reveal_tools(call=…) still refuses them: run backup and restore from the web UI, or list them for one client with X-CodeNavi-Tools, by naming them in CODENAVI_TOOL_PROFILE_CORE, or with full.23 full advertises every tool up front (the pre-1.3.23 default).
CODENAVI_TOOL_PROFILE_CORE (per profile) Comma-separated override of which tools form the core of the focused or protected profile.
CODENAVI_GREP_REDACT true grep_search and rule_evidence search and return text with detected secrets and PII replaced by [REDACTED:rule_id], so a value can be neither read nor guessed through them. A no-match does not prove that a secret value is absent. The first search of a file under a ruleset scans it (about 2 MB of source a second); the result is kept next to the index. false returns raw lines, except private keys: use it only if everyone with the token may see the secrets in the code. Restart to apply.
CODENAVI_MCP_READ_ONLY false true removes every MCP tool that changes server state (reindex, reindex_incremental, reindex_full, cancel_reindex, reindex_docs, save_note, delete_note, submit_feedback, backup, restore; crawl, cancel_crawl with the crawler) from tools/list and refuses it on tools/call, in either profile; reveal_tools cannot bring one back. Search, read, relations, wiki and stats tools stay. Covers the MCP endpoint only: the web UI and the REST API keep their own controls (the bearer token). Searches can still start an automatic reindex when the index is stale; set CODENAVI_AUTO_REINDEX to 0 in data/settings.json as well to stop that.9

Protected mode is CODENAVI_TOOL_PROFILE=protected on the server plus CODENAVI_HOOK_GREP=block in the agent's environment: the agent is given CodeNavi's grep and read tools, and the plugin's grep hook denies a raw grep of the indexed tree in favour of grep_search. read_file and grep_search redact secrets, but the hook does not intercept the agent's own file reads, so protected mode keeps searches on CodeNavi without guaranteeing redaction.

In the focused and protected profiles the hidden tools (grep/read/browse in focused, relations in protected, reindex, feedback/analytics, crawler, chat, backup, docs, notes) aren't gone, call reveal_tools() with no arguments for a grouped catalog, reveal_tools(group="relations") or reveal_tools(names="find_callers,diff_impact") for their descriptions and arguments, and reveal_tools(call="find_callers", args='{"symbol": "login"}') to run one. They stay out of tools/list: since 1.3.71 (CN-1061) a reveal no longer adds them, because the tool list is shared by every client of a stateless server and one agent's reveal grew everyone's list (about 350 tokens per tool, on every request) until restart.

Per-connection narrowing.9 An MCP client, or a reverse proxy in front of the server, can send two HTTP headers that shape that one connection's tool list: X-CodeNavi-Read-Only: true hides the state-changing tools listed under CODENAVI_MCP_READ_ONLY, and X-CodeNavi-Tools: read_file,grep_search lists exactly the tools named (an empty value lists none). Since 1.3.71 that includes tools the lean profile hides, so a client can list find_callers for itself without changing the profile for everyone (CN-1061). Neither header reaches a tool the server removed (CODENAVI_MCP_READ_ONLY). Both apply to tools/list, tools/call and reveal_tools(call=…), and they stack with each other and with the server settings. A header is set by the client, so it is a way for a client to limit itself, or for a proxy you control to limit a route; it does not stop a client that leaves the header out. To enforce read-only for everyone, use CODENAVI_MCP_READ_ONLY.

Header recipes. Each tool in the list costs the agent about 350 tokens on every request (measured with Claude Code, CN-1059), so a client that never runs maintenance can drop those tools:

Client X-CodeNavi-Tools Tools listed
Search-only (sub-agents, read-only helpers) semantic_search,file_search,grep_search,symbol_search,list_directory,read_file 6
CI review bot (connecting-ci.md) diff_impact,impact_analysis,find_callers,semantic_search,read_file 5
Everyday use, no maintenance semantic_search,file_search,grep_search,symbol_search,list_directory,read_file,codebase_overview,list_codebases,reindex_incremental,reindex_status,index_stats,reveal_tools 12

Measured on one Claude Code request: the search-only list adds 5.7k tokens to the context, the 12-tool list 7.3k, and the lean list with all eight approval-gated tools 11.4k (1.3.72; since 1.3.73 four of them are no longer listed). Leave the header off for interactive plugin users: /codenavi:reindex --full, /codenavi:setup and /codenavi:crawl call the approval-gated tools directly.

When to use lean vs full. tools/list is sent once per conversation and sits in the cacheable prompt prefix (~5-min TTL), so its cost is mostly paid when a session starts cold. Whether lean saves real tokens depends on how cold your sessions run:

Usage pattern lean payoff
One long, warm conversation Marginal, caching already serves the schema at ~0.1× after the first turn
Many short / fresh sessions (cold cache) ~6,400 tokens saved per session (−54% of the schema; ~7,300 with the crawler), compounds fast
Multi-agent fan-out (many fresh sub-sessions) Largest win, every spawned session is a fresh cold injection
Clients that don't cache tool definitions Largest win, the full schema is re-sent every turn
Tight context budgets Frees ~6k tokens of the window regardless of cost

Rough scale: one heavy developer (~20 fresh sessions/day) saves on the order of a few million input-token-equivalents/month; a multi-agent fleet that opens many cold short sessions can save 10× that or more. Tradeoff: in lean, a session that needs an advanced tool pays one reveal_tools() round-trip first, so lean is a clean win for search/browse/read work and roughly break-even for tool-heavy sessions.

Rule of thumb: keep full for everyday single-developer use; switch to lean for fleets, CI/automation, multi-agent orchestration, and any non-caching client. It is opt-in: the default costs nothing extra.

Outbound addresses

Variable Default Description
CODENAVI_OUTBOUND_HOSTS (empty) Since 1.3.76. Comma-separated addresses that three settings may point at: OPENAI_BASE_URL (gets the stored API key and code), HOOK_URL, and SCANNER_OLLAMA_URL (gets flagged code before redaction). Everyone with the token can change these settings in the web UI, so an address that you did not choose is refused: when it is saved, and again when it is used. Write a host (api.deepseek.com, meaning https) or a full origin (http://gpu-box.lan:8000). Scheme, host and port must match; the path is free. Restart to apply.

No listing is needed for the defaults (https://api.openai.com; for the scanner your OLLAMA_URL and http://localhost:11434) and for an address that you set in .env itself. A refused webhook is not sent, a refused chat address makes chat say so, and a refused scanner address counts as an unreachable scanner, so the chunk stays flagged.

Updating from 1.3.75 or older: if you set one of these three on the Settings screen or in data/settings.json, list its host once. On a compose file made with 1.3.75 or older, use data/settings.json instead: "CODENAVI_OUTBOUND_HOSTS": "api.deepseek.com". The web UI cannot write this key.

Platform (set by setup.sh)

Variable Default Description
COMPOSE_FILE (not set) Controls compose file merging. GPU: docker-compose.yml:docker-compose.gpu.yml. GPU under podman: add :docker-compose.podman-nvidia.yml (podman ignores the gpu overlay's runtime: nvidia; the extra overlay requests the card as a CDI device, see Podman). CPU: not set (uses base only). Apple Silicon Mac: docker-compose.prod.yml:docker-compose.ports.yml:docker-compose.mac.yml, written by setup.sh on a Mac (Mac server).
TORCH_INDEX (source-build only) The GA image is prebuilt on the universal cu128 / torch 2.7.1 wheel (arch sm_75–sm_120, driver ≥ 570.65), so this has no effect on the shipped image. For a from-source build, setup.sh auto-selects cu128 (Blackwell) or cu124 (older GPUs), or .../whl/cpu for Mac/CPU.
TORCH_PACKAGE (source-build only) See TORCH_INDEX. The GA image ships torch==2.7.1.

GPU autotune overrides (optional)

CodeNavi auto-detects VRAM at startup and picks an encode batch size + reranker device that fit the card6. With the default model (Buric-E0.6B): batch 16 from 7.5 GiB (peak about 3.4 GiB on the densest chunks), batch 4 below (peak about 1.7 GiB); the reranker stays on the GPU, and under 7.5 GiB it steps to the CPU while a reindex is encoding (RERANKER_DEVICE below). With the optional 4B model1112: 8–10 GiB → batch 2 with int8 weights; 11–12 GiB → batch 1; 16 GiB → batch 4; ≥17 GiB → batch 16, and the reranker steps aside during a reindex on cards under 12 GB. Override only if you know what you're doing.

Variable Default Description
CODENAVI_VRAM_BUDGET_GIB (unset) Soft cap.7 Tell CodeNavi to autotune as if the card only had N GiB. Use this when you share the GPU with other workloads (e.g. Ollama, a generative model, training) and want CodeNavi to take less. Example with the default model: CODENAVI_VRAM_BUDGET_GIB=6 selects batch 4 (peak about 1.7 GiB instead of 3.4) and the reranker steps to the CPU while a reindex is encoding. Soft cap only: changes autotune decisions, does not hard-limit PyTorch allocation; concurrent VRAM spikes from the other workload can still cause OOM.
CODENAVI_GPU_DEVICE 0 (AMD) / all-visible (NVIDIA) Multi-GPU hosts: which card CodeNavi uses (index). CodeNavi runs on exactly one GPU; a second instance can take another card by setting a different index in its own .env. Restart to apply.18 On Windows (Docker Desktop) honoured from package 1.3.43 (index as nvidia-smi -L prints it). On podman + NVIDIA the index must exist in the CDI spec: /etc/cdi/nvidia.yaml is a static snapshot, so a card added after it was generated is unusable until you re-run sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml (see docs/podman.md). Docker is unaffected.
ENCODE_BATCH_SIZE (autotuned) Override the autotuned encode batch size. Wins over CODENAVI_VRAM_BUDGET_GIB.
RERANKER_DEVICE (autotuned) Force the reranker onto cuda or cpu. Auto:20 the GPU whenever the embedder is on it; on a small card (under 7.5 GiB with the default model, under 12 GB with the 4B model) it steps to the CPU only while a reindex is encoding, then returns to the GPU on the next query. Larger cards keep it on the GPU through a reindex, so a search during or right after one does not wait for a reranker reload. Wins over CODENAVI_VRAM_BUDGET_GIB. Installs made before 1.3.24 carry a RERANKER_DEVICE=cpu line in .env from the old autotune, delete it to get the faster GPU rerank.
RERANKER_DTYPE fp16 on a GPU The reranker runs in half precision on a GPU, which is about four times faster than fp32 with the same top results. Set fp32 to go back to full precision. On the CPU it always runs in fp32.

Crawler & feature switches

Variable Default Description
CRAWLER_ENABLED false Off by default.2 Set to true to enable the crawler tools, web_chunks indexing, and the Crawler UI screen. Setup, limits and login sessions: Deploy crawler.
CODENAVI_GRAPH_CROSS_LANGUAGE false Call-graph tools (find_callers, impact_analysis, diff_impact, graph_neighborhood, hub metrics) only follow a call edge when caller and callee share a language family (JS/TS are one). Set to true to restore cross-language name matching.19
EMBED_SKIP_DIRS ["public_html", "site", "resources", "templates", "lib", "models", "assets"] Directory names dropped from the embedding text header, not from the index. Each chunk is embedded with a short path-context header (up to 3 directory names); listing a generic wrapper directory here keeps low-signal words like lib or templates out of that header so they don't dilute the vector. Matching is per path segment, case-insensitive. The list replaces the default, so repeat the defaults you still want. To keep a folder out of the index entirely, use EXCLUDE_DIRS instead, see Excluding folders from the index. Restart to apply.
CRAWL_DB_PATH /app/data/crawl_runs.db Path to the crawl run history SQLite database inside the container

The crawler resolves each hostname and refuses private, loopback and cloud-metadata addresses. env=local permits loopback and RFC1918 (that is what local crawling means), but cloud-metadata ranges (169.254.0.0/16, fe80::/10, fd00:ec2::/32) are refused in every env.

The crawler's destructive-action guard needs no configuration: the block floor is compiled into crawler/safety_scanner.py and is always in force. data/crawl_safety.json is optional and only extends or relaxes it, see Crawler safety config. Copy data/crawl_safety.json.example to start one.

Internal (set in docker-compose.yml, not normally changed)

Variable Default Description
CODEBASE_PATH /codebase Mount point inside the container
CODENAVI_HOST 127.0.0.1 Host-side interface Docker publishes the port on, not the in-container bind (that's CODENAVI_BIND, default 0.0.0.01). Set CODENAVI_HOST=0.0.0.0 for LAN/remote access. On a Linux GPU install (host networking) nothing is published: CODENAVI_BIND decides, setup.sh writes 0.0.0.0, and 127.0.0.1 keeps the server local. See Network.
HF_HOME /app/hf-cache Model cache directory
CODENAVI_MODEL_LOCK_FILE /app/data/codenavi_model.lock GPU encoding mutex. The compose file sets it; the older name JINA_LOCK_FILE still works as a fallback
TRANSFORMERS_OFFLINE 1 Skip network after initial model download

Multi-codebase mode

By default, CodeNavi indexes a single codebase from CODEBASE_PATH. To index multiple projects in one instance, use CODEBASE_CONFIG:

# In .env:
CODEBASE_CONFIG={"laravel":"/var/www/laravel","wordpress":"/var/www/wordpress","api":"/var/www/api"}

Each codebase gets its own LanceDB tables (e.g., laravel_code_chunks, wordpress_code_chunks). All MCP tools accept an optional codebase parameter to scope queries:

semantic_search("authentication", codebase="laravel")   # search only Laravel
semantic_search("authentication")                        # search all codebases
reindex(codebase="api")                                  # reindex only the API project
list_codebases()                                         # show all codebases with chunk counts

The /health endpoint shows per-codebase stats when multiple codebases are configured.

Notes: - Codebases are reindexed sequentially (not in parallel) to avoid GPU contention. - Search results include a <codebase> tag so you know which project each result came from. - Existing single-codebase deployments are fully backward compatible, no migration needed.

Runtime settings (data/settings.json)

Settings keys

These keys go in data/settings.json, not in .env: the compose file does not pass them to the container, so a line in .env has no effect. Restart to apply. They work on every install, whatever version made it.

Search output

Key Default Description
MIN_RELEVANCE_SCORE 0.0 Vector-similarity floor, 0 to 1. Raise it for fewer, stricter results. Also on the web UI Settings screen.
MIN_RERANK_SCORE -11.0 Floor for the reranker's score. Also on the web UI Settings screen.
MAX_DISPLAY_CHARS 800 Length of each result's preview.
MAX_DISPLAY_CHARS_TOP 4000 Length of the preview of the top two semantic_search results.
MAX_RESPONSE_CHARS 15000 Hard cap on one tool response. Also on the web UI Settings screen.
WIKI_SEARCH_BLEND true Compiled Docs Wiki pages (title + lead, embedded with the content model at compile time) blended into semantic_search as labeled advisory results that point at wiki_page(slug) and the source docs. Shares the advisory result slots with notes (1 at the default limit, 2 above), shown on top of limit, never in place of a code result. No LLM call at query time. Set to false to keep the wiki browse-only.
CODENAVI_NOTES_ENABLED true Investigation notes:21 save_note/search_notes/list_notes/delete_note plus fresh notes blended into semantic_search as labeled advisory results. Set to false to hide the tools and disable the blended read path entirely.
AUTO_ALIASES false Auto-generated per-codebase query aliases (Tier 3)22. Off by default since 1.3.26: the mechanical generator measured a net loss on large repositories, so it neither runs on full reindex nor applies an existing aliases_{codebase}.json. Hand-curated aliases (aliases.json, aliases_{codebase}_manual.json, the Search screen's alias editor) always apply. Set to true and restart to opt in; AUTO_ALIAS_GEN_SKIP then excludes single codebases.

Index freshness and scope

Key Default Description
CODENAVI_STALENESS_THRESHOLD_SEC 3600 Index age (seconds) past which the always-on freshness envelope recommends a reindex.14 Lower it on a fast-moving repo so the agent reindexes sooner; raise it on a stable/archived codebase so the hint isn't token-costing noise on every query.
CODENAVI_STRONG_STALENESS_SEC 86400 Index age (seconds) past which the reindex recommendation escalates its wording to "likely needed".14
CODENAVI_AUTO_REINDEX 1 When a codebase-scoped search would recommend a reindex and the tree has files newer than the index, the server starts the incremental reindex itself and reports auto_reindex: started in the freshness envelope (CN-902). Normal cooldown/busy/license gates apply. 0 = advise only.
CODENAVI_REINDEX_DUTY_PERCENT 100 Share of reindex time spent encoding, 10 to 100. Below 100, the reindex rests after each batch of 500 chunks so encoding fills only that share: at 25 a batch that takes 10 s is followed by a 30 s rest, and a reindex takes four times as long. For a laptop that runs hot during a large reindex. Searches are not slowed. Restart to apply.25
RESPECT_GITIGNORE true Honour the codebase's own .gitignore and tool ignore files. false indexes ignored files too: to re-include one folder, use INDEX_INCLUDE_OVERRIDES instead (below). Reindex to apply.

Stored-index integrity

Key Default Description
INDEX_INTEGRITY_CHECK_INTERVAL 21600 Seconds between checks of the stored index against the fingerprint recorded at its last reindex (index/integrity_<codebase>.json).4 The result is index_integrity in the authenticated /health body and the codenavi_index_integrity gauge; a mismatch is a warning, never a refusal, run a full reindex to rebuild and re-record. A server upgrade that adds tables to the call-graph sidecar re-records its fingerprint, but only when the file still matched the manifest beforehand; any other change is still reported. The check also runs once after start-up; 0 disables only the timer.

Throttling

Every HTTP request, the MCP transport, the console API and the admin routes alike, passes two sliding windows before the server does any work.3 A request that overflows either answers 429 Too Many Requests with a Retry-After header and a JSON body naming the reason. /health, /.well-known/* and the static console files are never throttled, so the plugin's start-up probe and the statusline keep working while a client is refused. Loopback is not exempt: a coding agent stuck in a loop on the same host is the case this exists for. The web console and an agent on the same host land in separate buckets because the bucket key includes the user-agent. Read once at start; restart to apply.

Key Default Description
THROTTLE_ENABLED true Set to false to switch both windows off.
THROTTLE_MAX_REQUESTS 200 Requests one client (address + user-agent) may make per window before it gets 429. Batches of read_file count one each. Every agent session on one machine shares a bucket, and so does a whole team behind a NAT or a proxy on another host unless that proxy is in THROTTLE_TRUSTED_PROXIES, size the number for the busiest shared client, not for one agent.
THROTTLE_WINDOW_SECONDS 10 Length of the request window.
THROTTLE_AUTH_MAX_FAILURES 20 Distinct rejected bearer tokens one address may present per window. Past it, every request from that address is refused until the window frees, including a correct token. Requests without an Authorization header do not count, and the same wrong token re-sent counts once per window, so a console tab still holding a rotated token cannot lock the host out.
THROTTLE_AUTH_WINDOW_SECONDS 60 Length of the rejected-credential window and of the lockout.
THROTTLE_TRUSTED_PROXIES 127.0.0.0/8,::1 Comma-separated addresses or CIDRs whose X-Forwarded-For is believed. Add a reverse proxy on another host, or on an install with bridge networking the container's gateway, or every client shares the proxy's buckets and its lockout; how to find the address, and when it is safe. Any other peer's X-Forwarded-For is ignored, so a direct client cannot rotate itself out of a lockout.

The /metrics counter codenavi_throttled_requests_total{reason="auth"|"load"} counts refusals; the first refusal per client and reason in a window also leaves a WARNING line in the server log with the client address, never the token.

Chat and event hooks

Key Default Description
LLM_TEMPERATURE (empty) Chat sampling temperature, 0 to 2, every provider (Claude caps at 1). Empty = the provider's own default. Also on the web UI Settings screen.26
HOOK_URL (empty) Webhook URL to POST events to (reindex, crawl, chat, etc.). Also in the web UI. Its host must be in CODENAVI_OUTBOUND_HOSTS. See webhooks.md for the events and payloads.
HOOK_TIMEOUT_SEC 5 Timeout in seconds of one HOOK_URL POST.

Excluding folders from the index

To keep a folder out of the index, asset dumps, generated output, a docs subtree that dilutes search results, add its path to EXCLUDE_DIRS in data/settings.json, then restart and reindex:

{
  "EXCLUDE_DIRS": ["data/pdfs", "data/images", "legacy/generated"]
}
docker compose restart          # EXCLUDE_DIRS is boot-bound
./reindex.sh                    # incremental is enough — see below

Edit the live settings file: see Which settings.json is live at the top of this page.

Setting What it does
EXCLUDE_DIRS Paths never scanned. Merged additively with ~50 built-in defaults (node_modules, vendor, .git, dist, build, cache, …), your list adds to them, it does not replace them.10 A single name (cache) matches a directory of that name at any depth; a path (data/pdfs) matches those segments consecutively at any depth.
EXCLUDE_DIRS_DROP Un-excludes a built-in default, use this if your source really does live in build/ or vendor/.
INDEX_INCLUDE_OVERRIDES Path prefixes indexed no matter what: bypasses both EXCLUDE_DIRS and the .gitignore layer. Use it to re-include one subtree of an otherwise excluded folder.

You may not need any of these, CodeNavi already honours the repository's own .gitignore (and .dockerignore-style tool ignore files) by default, so a folder that is gitignored is already out of the index.10 Set RESPECT_GITIGNORE to false to turn that off.

Multi-codebase servers: an unprefixed entry applies to every codebase, a bare "docs" blacks out docs/ everywhere. Prefix it to scope it: "mycodebase:docs/internal".15 The same syntax works in EXCLUDE_DIRS_DROP and INDEX_INCLUDE_OVERRIDES. A prefix that looks like a codebase name but is not a configured one logs a warning rather than silently matching nothing.

An incremental reindex is enough. It rebuilds the table from a fresh scan, so chunks from newly-excluded files are dropped; --full is only needed when you also change INCLUDE_EXTENSIONS or chunking settings.

Verify it took effect: ask the server's own filter, per file:

docker exec -i codenavi python3 -c "
from pathlib import Path
import config, indexing
for rel in ['data/pdfs/notes.md', 'src/main.py']:
    print(rel, indexing.should_include(Path(config.CODEBASE_ROOT) / rel))"

index_stats also reports the skip ledger, how many files were dropped and why. Note that extension and size rules are checked before EXCLUDE_DIRS, so a PDF in an excluded folder is still counted under "skipped by extension"; it is out of the index either way.

First-time setup can guess for you. codenavi init <path> scans a codebase and writes a starter data/settings.json with EXCLUDE_DIRS pre-seeded: the usual junk (node_modules, vendor, .git, dist, build, target, …) plus any directory holding more than 200 files whose path looks like an asset folder (images, photos, uploads, fonts, icons, static, media, assets/images, public/images). It prints an Auto-excluded: line naming what it added beyond the defaults, review it, then reindex. Two limits worth knowing: the 200-file floor means a small asset folder is not caught (a folder of 26 PDFs is under it), and the command writes a fresh settings file, it refuses to overwrite an existing one without --force, so it is a bootstrap tool, not a way to edit a running install.

Not the same as exclude_paths, that is a search-time filter an agent passes per query. It hides results but the content is still indexed and still competes for ranking. Index-time exclusion is what changes what the index contains.

Other settings

Key settings beyond the defaults in settings.json.example:

Setting Default Description
RERANKER_MODEL ms-marco Cross-encoder reranker (Apache ms-marco), or none to disable.
FEEDBACK_DEMOTION_THRESHOLD -2 Net rating at which a chunk is demoted in search results. Lower = more lenient.
CONCURRENCY {} (4) Per-env max parallel crawl requests, e.g. {"prod": 2}.
REQUEST_DELAY_MS {} (0) Per-env delay before each crawl request, e.g. {"prod": 300}.
CRAWL_MAX_RPS {} (off) Per-env hard requests/second cap (sliding window over the target host), stays under a site's per-IP rate limit. e.g. {"prod": 4}. Short bursts tolerated, sustained load throttled.
CRAWL_MAX_POSTS_PER_MIN {} (off) Per-env cap on form-submission POSTs/minute, stays under a "create endpoint" budget. e.g. {"prod": 8}.
CRAWLER_EXCLUDE_URL_PATTERNS {} Per-env list of regexes; a URL matching one is never fetched. Prunes faceted navigation and pagination from a crawl, e.g. {"prod": ["/search-filter/", "[?&](pag|page)="]}. A regex that fails to compile is skipped.
CRAWLER_LOGIN_URL_PATTERNS (site-specific defaults) Substrings that mark a URL as a login page. A crawl fetch whose final URL contains one, when the original did not, is recorded as a session-expiry redirect instead of a page. Set it for your site, see Crawl behind a login.5
CRAWLER_AUTH_PROBE_PATHS (site-specific defaults) Per-level path (member, admin, affiliate) appended to the env base URL to confirm a cookie session is alive before a crawl.5

Staying under a rate-limited target (e.g. ~5 req/s per IP + 10 posts/min on create): set "CRAWL_MAX_RPS": {"prod": 4} and "CRAWL_MAX_POSTS_PER_MIN": {"prod": 8} (headroom under the limits). The crawler also honours 429 / Retry-After automatically, on a throttle response it sleeps the advertised delay (capped at 60s) and retries instead of hammering. These apply on the next crawl run (the crawler is a fresh subprocess); no server restart needed.


  1. Vendor change reference CN-84. ↩

  2. Vendor change reference CN-174. ↩

  3. Vendor change reference CN-746. ↩

  4. Vendor change reference CN-748. ↩

  5. Vendor change reference CN-690. ↩↩

  6. Vendor change reference CN-233. ↩

  7. Vendor change reference CN-234. ↩

  8. Vendor change reference CN-261. ↩

  9. Vendor change reference CN-1038. ↩↩

  10. Vendor change reference CN-268. ↩↩

  11. Vendor change reference CN-288. ↩

  12. Vendor change reference CN-289. ↩

  13. Vendor change reference CN-349. ↩

  14. Vendor change reference CN-351. ↩↩

  15. Vendor change reference CN-412. ↩

  16. Vendor change reference CN-421. ↩

  17. Vendor change reference CN-423. ↩

  18. Vendor change reference CN-549. ↩

  19. Vendor change reference CN-561. ↩

  20. Vendor change reference CN-584. ↩

  21. Vendor change reference CN-550. ↩

  22. Vendor change reference CN-609. ↩

  23. Vendor change reference CN-1091. ↩

  24. Vendor change reference CN-1095. ↩

  25. Vendor change reference CN-1196. ↩

  26. Vendor change reference CN-537. ↩