Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Default reranker: voyage:rerank-3-lite for brains that never set search.reranker.model
time-attack574a7b6575a5
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 67a5d4c72f..477d40c7f9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,18 @@ credits are retained; no result has been reassigned to another provider. Originaidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [Unreleased]++**Search reranking costs 60% less: the default reranker is now Voyage `rerank-3-lite`, for brains that never set `search.reranker.model`.** In gbrain-evals #148 (v0.10.93), `rerank-3-lite` reranked the same 50 candidates × 1,400 tokens for $0.60 per 1,000 LongMemEval queries instead of $1.51 with `rerank-2.5`, and retrieval quality stayed within run-to-run noise (strict recall@10 298 vs 299 of 300 questions, recall@5 289 vs 288, reranker latency about the same). Voyage now lists `rerank-3` / `rerank-3-lite` as its current, generally available models and `rerank-2.5` as an older one. A brain that set `search.reranker.model` keeps its model, including brains created on v0.46.3–v0.47.10, where `gbrain init` wrote `voyage:rerank-2.5` explicitly. To go back to the previous default: `gbrain config set search.reranker.model voyage:rerank-2.5`.++### Itemized changes++- **Default** (`src/core/ai/defaults.ts`, `src/core/ai/recipes/voyage.ts`): `DEFAULT_RERANKER_MODEL` and the Voyage recipe's reranker `default_model` are `rerank-3-lite`. Candidate count and the per-document token cap are unchanged. The recipe no longer calls the rerank-3 pair a preview, and its price note is re-verified against Voyage's pricing page.+- **Estimates**: the tokenmax switch notice and the mode bundle's cost note now say about $0.0006 per query.+- **Disclosure**: a one-time behavior-change notice on upgrade names the change and the rollback command.+- **Test** (`test/reranker-default-explicit-config.test.ts`): runs a brain's config through mode resolution to the reranker request on the wire. A brain with no `search.reranker.model` sends `rerank-3-lite` (50 documents in tokenmax), and a brain that set `voyage:rerank-2.5` or `voyage:rerank-3` sends its own model.+- Docs: search modes, embedding providers, retrieval architecture, install guides and README name the new default and the rollback.+## [0.60.223.0] - 2026-10-14**On Linux, a managed sync no longer stalls for six minutes after a gbrain process on the same machine is killed (#6650).** When a `gbrain sync` client was killed, its consumer heartbeat row still read as live for up to 30 s (and as the elected owner for up to 60 s). So the next sync didn't hand its catch-up to the running `gbrain serve`: it ran its own consumer next to the serve. When the write owner was killed mid-catch-up, the requests it had claimed stayed claimed until their publication lease ran out, about 365 s with the default ceiling. Now a process proves from `/proc` that a same-machine owner is dead (its pid is gone, or now belongs to a process that started later) and stops waiting for it. In the new convergence harness (seed 6650) the worst stall after an owner kill went from 356 s and 362 s to 0 s with no injected latency, and from 364 s to 30 s at 50 ms; the catch-up after a serve kill went from 385 s to 29 s. Where `/proc` is unavailable (macOS) the time-based rules are unchanged.diff --git a/INSTALL_FOR_AGENTS.md b/INSTALL_FOR_AGENTS.mdindex 620c27a7f1..d03ea602aa 100644--- a/INSTALL_FOR_AGENTS.md+++ b/INSTALL_FOR_AGENTS.md@@ -79,7 +79,7 @@ GBrain is keyless. Explain these boundaries before enabling a capability; see[memory boundaries](docs/guides/memory-boundaries.md#where-text-goes).Skip API-key setup for the initial keyless memory path. If the user enables semantic retrieval or paid enrichment, configure the selected provider explicitly. GBrain defaults to the Voyage embedding + reranker stack-(`voyage:voyage-4` @ 1024d + `voyage:rerank-2.5` — one key covers both); OpenAI is the+(`voyage:voyage-4` @ 1024d + `voyage:rerank-3-lite` — one key covers both); OpenAI is themain alternative, chosen at init via `--embedding-model <provider:model>`.**Need to switch an existing brain's embedding or reranker model?** Followthe explicit-consent playbook at `skills/migrations/v0.46.3.0.md`. Preview thediff --git a/README.md b/README.mdindex c96405fd19..62c76b5762 100644--- a/README.md+++ b/README.md@@ -370,7 +370,7 @@ Data flowing into the brain. Each integration is a recipe — markdown + setup h- **Gmail + Calendar + Contacts (native)**: the google source kind syncs threads, events, and contacts through your own OAuth client and runs the open-loop engine on top (`gbrain waiting`). Setup: [`docs/guides/google-connect.md`](docs/guides/google-connect.md); recipes: [`recipes/email-to-brain.md`](recipes/email-to-brain.md), [`recipes/calendar-to-brain.md`](recipes/calendar-to-brain.md).- **Email + calendar (webhooks)**: webhook handlers that route to brain signals. [`docs/integrations/meeting-webhooks.md`](docs/integrations/meeting-webhooks.md).- **Embedding providers**: Voyage (new-install default: `voyage-4` @ 1024d), OpenAI, OpenRouter, Google Gemini, Azure OpenAI, MiniMax, Alibaba DashScope, Zhipu, Ollama (local), llama.cpp llama-server (local), LM Studio, Together, and LiteLLM proxy. Pricing matrix + decision tree in [`docs/integrations/embedding-providers.md`](docs/integrations/embedding-providers.md). Existing vectors are never converted by changing the default; use the explicitly approved [embedding migration](docs/guides/embedding-migration.md).-- **Rerankers**: Voyage `rerank-2.5` hosted (the default; reranking is on in `balanced` and `tokenmax` modes, same `VOYAGE_API_KEY` as embeddings; the preview `rerank-3` / `rerank-3-lite` are selectable with `gbrain config set search.reranker.model voyage:rerank-3`), plus the `llama-server-reranker` recipe for fully-local cross-encoder rerank via llama.cpp running Qwen3-Reranker against the same `gateway.rerank()` seam. Setup walkthrough in [`docs/ai-providers/llama-server-reranker.md`](docs/ai-providers/llama-server-reranker.md).+- **Rerankers**: Voyage `rerank-3-lite` hosted (the default unless `search.reranker.model` is set; on in `balanced` and `tokenmax`, same `VOYAGE_API_KEY` as embeddings; `gbrain config set search.reranker.model voyage:rerank-2.5` restores the previous default), plus the `llama-server-reranker` recipe for fully-local cross-encoder rerank via llama.cpp running Qwen3-Reranker against the same `gateway.rerank()` seam. Setup walkthrough in [`docs/ai-providers/llama-server-reranker.md`](docs/ai-providers/llama-server-reranker.md).- **Credential vault + gateway**: `gbrain creds` manages OAuth and API credentials in a local vault ([`recipes/credential-gateway.md`](recipes/credential-gateway.md)); agent-side vault-aware secret distribution: [`docs/integrations/credential-gateway.md`](docs/integrations/credential-gateway.md).- **MCP clients**: every major MCP client is supported. [`docs/mcp/`](docs/mcp/) per-client setup.- **Memorable (procedural memory)**: optional, off by default. Your brain remembers *what* happened; Memorable makes your agent remember *how* — finished sessions become replayable procedures stored on your machine (in a standalone local store, or inside your brain database if you opt in), recalled when a similar task comes back. See the section below, and [`docs/memorable-agents.md`](docs/memorable-agents.md) for the agent-facing detail.diff --git a/docs/INSTALL.md b/docs/INSTALL.mdindex d3f73deb42..e9b421cd37 100644--- a/docs/INSTALL.md+++ b/docs/INSTALL.md@@ -95,7 +95,7 @@ For shared / large / multi-machine deployments (a team or company brain with mulOptional provider setup: API keys live in `~/.gbrain/config.json` (file plane) or env vars (`VOYAGE_API_KEY`, `OPENAI_API_KEY`, `OPENROUTER_API_KEY`, `ANTHROPIC_API_KEY`). Set them only after choosing the capability and approving its text disclosure and cost. Vendor API keys (and `database_url`/`database_path`) are file-plane routed, so `gbrain config set <KEY> <value>` writes where the pipeline reads it:```bash-export VOYAGE_API_KEY=pa-... # default embedding (voyage-4) + reranker (rerank-2.5) — one key+export VOYAGE_API_KEY=pa-... # default embedding (voyage-4) + reranker (rerank-3-lite) — one keyexport OPENAI_API_KEY=sk-... # alternative embeddings; also powers automatic fact extraction + chat modelsexport ANTHROPIC_API_KEY=sk-ant-... # automatic fact extraction + chat models; also improves search via query expansion```diff --git a/docs/ai-providers/llama-server-reranker.md b/docs/ai-providers/llama-server-reranker.mdindex 75742801b7..9774504e45 100644--- a/docs/ai-providers/llama-server-reranker.md+++ b/docs/ai-providers/llama-server-reranker.md@@ -20,7 +20,7 @@ This recipe is the path override + recipe shape. Any provider whoserequest/response wire matches llama.cpp can use it by just pointingat a different base URL. A provider whose request differs only in thetop-N key declares it via the recipe's `top_param` — that's how the-hosted Voyage reranker recipe (`voyage:rerank-2.5`, the new-install+hosted Voyage reranker recipe (`voyage:rerank-3-lite`, the new-installdefault, `top_k`) works. On the response side the gateway parser acceptsboth known array keys (`results[]` for llama.cpp, `data[]` forVoyage's REST — the shared item shape is `{index, relevance_score}`);diff --git a/docs/architecture/RETRIEVAL.md b/docs/architecture/RETRIEVAL.mdindex 15336e2560..16809e387e 100644--- a/docs/architecture/RETRIEVAL.md+++ b/docs/architecture/RETRIEVAL.md@@ -62,7 +62,7 @@ Heuristic link-type inference (`attended`, `works_at`, `invested_in`, `founded`,## Cross-encoder reranker: 60% top-1 reshuffle-The reranker is on for the `balanced` and `tokenmax` mode bundles, off for `conservative`. The mode-bundle default is Voyage `rerank-2.5` (`DEFAULT_RERANKER_MODEL`, same `VOYAGE_API_KEY` as the embedding default); a brain with no `search.reranker.model` row reranks with it. Without the key, search fails open in RRF order: the gateway skips the HTTP call (`RerankError('no_key')`), writes ONE audit row per process, prints nothing, and stamps `reranker_skipped (no_key)` on the search meta — `gbrain search --explain` shows it, `gbrain search modes` prints a `Reranker:` readiness line, and `gbrain doctor`'s `reranker_health` names the fix (`export VOYAGE_API_KEY=…` or `gbrain config set search.reranker.enabled false`). Keyed installs without a Voyage key get reranking explicitly disabled at init. The retained query-cache key includes `reranker_model`; persisted result reuse is disabled until every response dependency can be verified. On a real-corpus benchmark across 20 queries, the cross-encoder reshuffled **60% of top-1 results** after the hybrid + RRF + graph stack (historical measurement on the retired hosted reranker, not Voyage; original identifiers are preserved at Git revision `6040075c6cb95be5881cc2e1b76ef7d71f4e5d29`, retained on 2026-09-23). The Voyage default's paired LongMemEval numbers live in [`docs/eval-bench.md`](../eval-bench.md#public-benchmarks-longmemeval).+The reranker is on for the `balanced` and `tokenmax` mode bundles, off for `conservative`. The mode-bundle default is Voyage `rerank-3-lite` (`DEFAULT_RERANKER_MODEL`, same `VOYAGE_API_KEY` as the embedding default); a brain with no `search.reranker.model` row reranks with it, and a brain with one keeps its own model. It replaced `rerank-2.5` after gbrain-evals #148 (v0.10.93) measured 60% lower rerank cost at 50 candidates × 1,400 tokens with quality within noise; `gbrain config set search.reranker.model voyage:rerank-2.5` switches a brain back. Without the key, search fails open in RRF order: the gateway skips the HTTP call (`RerankError('no_key')`), writes ONE audit row per process, prints nothing, and stamps `reranker_skipped (no_key)` on the search meta — `gbrain search --explain` shows it, `gbrain search modes` prints a `Reranker:` readiness line, and `gbrain doctor`'s `reranker_health` names the fix (`export VOYAGE_API_KEY=…` or `gbrain config set search.reranker.enabled false`). Keyed installs without a Voyage key get reranking explicitly disabled at init. The retained query-cache key includes `reranker_model`; persisted result reuse is disabled until every response dependency can be verified. On a real-corpus benchmark across 20 queries, the cross-encoder reshuffled **60% of top-1 results** after the hybrid + RRF + graph stack (historical measurement on the retired hosted reranker, not Voyage; original identifiers are preserved at Git revision `6040075c6cb95be5881cc2e1b76ef7d71f4e5d29`, retained on 2026-09-23). The Voyage default's paired LongMemEval numbers live in [`docs/eval-bench.md`](../eval-bench.md#public-benchmarks-longmemeval).The mechanical reason: hybrid ranking is locally optimal per strategy but globally suboptimal. A cross-encoder reranker reads the query + each candidate document jointly, with full attention. It catches the cases where the vector + keyword + graph signals all agreed on a document that's semantically related but topically wrong.diff --git a/docs/architecture/key-files/core-ai-continued.md b/docs/architecture/key-files/core-ai-continued.mdindex f7a5f18298..6ebbfde437 100644--- a/docs/architecture/key-files/core-ai-continued.md+++ b/docs/architecture/key-files/core-ai-continued.md@@ -20,7 +20,7 @@ Provider adapters, recipes and the Voyage width plumbing.- `src/core/ai/recipes/openrouter.ts` — OpenRouter openai-compatible recipe: single key, many providers via `openrouter:<provider>/<model>` strings. `base_url_default: 'https://openrouter.ai/api/v1'`. Embedding touchpoint: default model `openai/text-embedding-3-small`; per-model `model_dims` carries verified native widths (text-embedding-3-small 1536, text-embedding-3-large 3072, qwen/qwen3-embedding-8b 4096, bge-m3 + baai/bge-m3 1024) with `default_dims: 0` so an UNLISTED proxied id has NO silent default — it errors until the user supplies explicit dims (`--embedding-dimensions` / `embedding_dimensions`), which `trust_custom_dims: true` accepts (gemini-embedding-2-preview is deliberately unlisted — width unverified). Matryoshka `dims_options: [512, 768, 1024, 1536]` still governs the default model's shrink steps; `max_batch_tokens: 300_000` = OpenAI's aggregate-per-request token cap (NOT per-input). Chat touchpoint declares 8 curated entry points (gpt-5.2, gpt-5.2-chat, gpt-5.5, claude-haiku-4.5, claude-sonnet-4.6, claude-opus-4.7, gemini-3-flash-preview, deepseek-chat) but openai-compat tier accepts any model ID; deliberately no `max_context_tokens` because OR's catalog spans 128K to 1M+. `supports_subagent_loop: false` is enforced by `classifyCapabilities()` in `src/core/ai/capabilities.ts` (verdict `unusable:no_subagent_loop` — `enforceSubagentCapable()` in `src/core/model-config.ts` consumes the verdict: tool-less/unknown models fall back to `TIER_DEFAULTS.subagent` with a warn; tool-capable providers without prompt caching run with a once-per-model cost warn); the legacy Anthropic-direct path additionally gates on `isAnthropicProvider()` in `src/core/model-config.ts` when `agent.use_gateway_loop` is off. Declares `resolveDefaultHeaders(env)` returning OR's three attribution headers: `HTTP-Referer` (required for OR app-attribution), `X-OpenRouter-Title` (preferred), `X-Title` (back-compat alias); defaults to `https://gbrain.ai` / `gbrain`; forks override via `OPENROUTER_REFERER` / `OPENROUTER_TITLE` env vars. OpenRouter reports upstream rate limits and some outages as an `error` object inside an HTTP 200 body; `rewriteOpenRouterErrorEnvelopeStatus` (composed into `openrouterCompatFetch`) gives a 200 `application/json` body with an integer `error.code` of 429 or 5xx that status, keeping an existing `Retry-After` and promoting a finite non-negative `error.metadata.retry_after`/`retryAfter` when absent, so the AI SDK's status-keyed retry and gbrain's classification see it; success, 4xx, unparseable and SSE responses pass through untouched. Smoke-tested by `test/ai/recipe-openrouter.test.ts` (incl. the shape guard: every model in the chat list matches `^[a-z0-9-]+\/[a-z0-9._-]+$`).-- `src/core/ai/recipes/voyage.ts` — Voyage AI openai-compatible recipe, home of the new-install default stack. Embedding touchpoint declares `default_model: 'voyage-4'` + `default_dims: 1024` — the canonical pick for every "choose a model for the user" surface (`models[0]` stays `voyage-4-large` in quality order; the new-install default is `voyage-4` for price/quality balance and the shared v4 embedding space — see `NEW_INSTALL_DEFAULT_EMBEDDING_MODEL` in `ai/defaults.ts`). Reranker touchpoint (the mode-bundle default via `DEFAULT_RERANKER_MODEL`, same `VOYAGE_API_KEY` as embeddings) allowlists `rerank-2.5` ($0.05/M) + `rerank-2.5-lite` ($0.02/M) and Voyage's preview `rerank-3` ($0.05/M) + `rerank-3-lite` ($0.02/M) (2.5 pair verified 2026-08-15, rerank-3 pair 2026-09-06); `default_model` stays `rerank-2.5` deliberately — the array is the opt-in surface for every enforcement point (`gateway.rerank()`'s `tp.models.includes` guard, `gbrain models doctor`'s `reranker_config` probe, `rerankerReadiness`), and flipping the default would migrate every install that resolves it instead of an explicit config row. All four share one wire: `path: '/rerank'`, `top_param: 'top_k'` (responses accept `{data: [{index, relevance_score}]}` or the compatible `results` array), 5MB byte-proxy payload cap. Declares `chars_per_token=1` + `safety_factor=0.5` so the gateway pre-splits Voyage batches at a 60K-character budget (50% of 120K-token cap with the dense-tokenizer ratio), since tiktoken-grounded budgeting undercounts Voyage's actual token usage. Declares `multimodal_models: ['voyage-multimodal-3']` so the gateway rejects text-only Voyage models pointed at the multimodal endpoint with a clear `AIConfigError` instead of waiting for Voyage's HTTP 400. The hosted flexible-dim models that accept `output_dimension` live in `VOYAGE_OUTPUT_DIMENSION_MODELS` in `src/core/ai/dims.ts` (v4 trio, `voyage-code-4`, `voyage-3-large`, `voyage-3.5`, `voyage-3.5-lite`, `voyage-code-3`; valid widths 256/512/1024/2048); `voyage-4-nano` is the open-weight variant fixed at 1024-dim that does NOT accept the parameter (negative assertion in `test/ai/gateway.test.ts`: `dimsProviderOptions` returns `undefined` for `voyage-4-nano`). `voyage-code-3` is the recommended embedding model for gstack per-worktree code brains (Topology 3 in `docs/architecture/topologies.md`; `voyage-code-4` is the flexible-dim hosted code model, $0.12/M); discoverability surfaces: decision-tree branch in `docs/integrations/embedding-providers.md`, Topology 3 "Recommended embedding model" subsection, runtime nudge from `gbrain reindex-code` against non-code-tuned models. Recipe shape pinned by `test/ai/voyage-code-3-recipe.test.ts`.+- `src/core/ai/recipes/voyage.ts` — Voyage AI openai-compatible recipe, home of the new-install default stack. Embedding touchpoint declares `default_model: 'voyage-4'` + `default_dims: 1024` — the canonical pick for every "choose a model for the user" surface (`models[0]` stays `voyage-4-large` in quality order; the new-install default is `voyage-4` for price/quality balance and the shared v4 embedding space — see `NEW_INSTALL_DEFAULT_EMBEDDING_MODEL` in `ai/defaults.ts`). Reranker touchpoint (the mode-bundle default via `DEFAULT_RERANKER_MODEL`, same `VOYAGE_API_KEY` as embeddings) allowlists Voyage's current `rerank-3` ($0.05/M) + `rerank-3-lite` ($0.02/M) and the older `rerank-2.5` ($0.05/M) + `rerank-2.5-lite` ($0.02/M) (prices verified 2026-10-14); `default_model` is `rerank-3-lite`, matching `DEFAULT_RERANKER_MODEL` (gbrain-evals #148: 60% cheaper than `rerank-2.5` at 50 × 1,400, quality within noise). The array is the opt-in surface for every enforcement point (`gateway.rerank()`'s `tp.models.includes` guard, `gbrain models doctor`'s `reranker_config` probe, `rerankerReadiness`); a brain with an explicit `search.reranker.model` row keeps that model when the default moves. All four share one wire: `path: '/rerank'`, `top_param: 'top_k'` (responses accept `{data: [{index, relevance_score}]}` or the compatible `results` array), 5MB byte-proxy payload cap. Declares `chars_per_token=1` + `safety_factor=0.5` so the gateway pre-splits Voyage batches at a 60K-character budget (50% of 120K-token cap with the dense-tokenizer ratio), since tiktoken-grounded budgeting undercounts Voyage's actual token usage. Declares `multimodal_models: ['voyage-multimodal-3']` so the gateway rejects text-only Voyage models pointed at the multimodal endpoint with a clear `AIConfigError` instead of waiting for Voyage's HTTP 400. The hosted flexible-dim models that accept `output_dimension` live in `VOYAGE_OUTPUT_DIMENSION_MODELS` in `src/core/ai/dims.ts` (v4 trio, `voyage-code-4`, `voyage-3-large`, `voyage-3.5`, `voyage-3.5-lite`, `voyage-code-3`; valid widths 256/512/1024/2048); `voyage-4-nano` is the open-weight variant fixed at 1024-dim that does NOT accept the parameter (negative assertion in `test/ai/gateway.test.ts`: `dimsProviderOptions` returns `undefined` for `voyage-4-nano`). `voyage-code-3` is the recommended embedding model for gstack per-worktree code brains (Topology 3 in `docs/architecture/topologies.md`; `voyage-code-4` is the flexible-dim hosted code model, $0.12/M); discoverability surfaces: decision-tree branch in `docs/integrations/embedding-providers.md`, Topology 3 "Recommended embedding model" subsection, runtime nudge from `gbrain reindex-code` against non-code-tuned models. Recipe shape pinned by `test/ai/voyage-code-3-recipe.test.ts`.- `src/core/ai/voyage-gateway.ts` — Voyage width plumbing for `voyageCompatFetch` (#6061). `applyVoyageOutputDimension(body, input, dims)` always sets root `output_dimension` and adds `providerOptions.voyage.outputDimension` only when the request URL's hostname is exactly `ai-gateway.vercel.sh` (the Vercel AI Gateway reads only that; Voyage's own API answers 400 on `providerOptions`; look-alike hosts, suffixes and path mentions never match). `embeddingDimMismatchError(...)` builds the dim-mismatch `AIConfigError`: with a non-default `provider_base_urls.<provider>` it names that host as the likely cause (a proxy dropping the width), says nothing was written and points at fixing the proxy plus `gbrain doctor --only embedding_provider --probe --json` before a migration; the default route keeps the `gbrain migrate --embedding-model … --embedding-dimensions …` hint. Pinned in `test/ai/gateway.test.ts` (Voyage shim describe).diff --git a/docs/architecture/key-files/core-ai.md b/docs/architecture/key-files/core-ai.mdindex eef7dffaa6..94e80f48f5 100644--- a/docs/architecture/key-files/core-ai.md+++ b/docs/architecture/key-files/core-ai.md@@ -10,7 +10,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL- `src/core/ai/chat-usage.ts` + `src/core/ops/usage.ts` — durable per-call chat usage accounting. `gateway.chat()` calls `recordChatUsage` at its SUCCESS boundary (production provider path AND test-transport path) with the answering model + token usage; the record lands in the `chat_usage_log` table (migration v140) via an injected sink (`setChatUsageSink` — no engine import here, so the gateway imports this leaf statically without deepening a cycle). Phase attribution is best-effort via AsyncLocalStorage (`withChatPhase`): the minion worker AND the cycle's inline drain (`inline-drain.ts`) both wrap handler execution in `job:<name>`, a cycle phase that meters its own spend wraps itself in `phase:<name>` (dream synthesize does), and direct callers record phase NULL. The innermost wrap wins, which is the point — a child drained INSIDE a wrapped phase must carry its own `job:` tag or the phase tag absorbs every child's spend and the ledger double-counts (one ledger per surface: `minion_jobs` stays the child-spend authority, the phase row is the orchestrator's own calls). Pricing resolves through `CANONICAL_PRICING` (`estimateChatCostUsd`, cache_read/cache_write at provider cache rates when the table carries them); unknown models record `cost_usd = NULL`, never a fake 0. Accounting is strictly fail-open + fire-and-forget: a sink error must never break a chat call. `withChatCallMeter` counts successful calls on a `ChatCallMeter` (phase containment's `{ calls }`); a meter that declares `cost_usd` (the nightly probe's) also prices each call with the budget tracker's resolver (`priceFor` with the meter's `pricing_overrides`; a table row uses the same cache-aware `estimateChatCostUsd` value the record carries), counts an unpriced call in `unpriced_calls` instead of as 0, and is priced even when no sink is registered. The `get_usage` op (admin scope, NOT read — `chat_usage_log` has no source dimension, so a source-restricted/federated token must not see brain-wide spend telemetry) returns per-model/per-phase aggregates only, plus an explicit `coverage` block stating what the ledger does NOT capture (subagent raw-SDK path, embeddings, pre-sink/pre-v140 calls, failed calls); `budget-tracker.ts` remains the pessimistic in-flight spend gate — this table is the after-the-fact ledger.- `src/core/ai/date-grounding.ts` — the time vocabulary every extraction prompt shares: observation time (when text was written or said), event/validity time (`facts.valid_from`), recording time (`created_at`). `resolveObservationDate` (filename / `date` / `published` / created keys via `computeEffectiveDate`; never `event_date`, row timestamps or now), `observationDateFrom` (turn/message timestamps), `observationDateRule` (static system-prompt rule: rewrite relative dates as absolute dates or bounds resolved against the observation date, never leaving the phrase beside its date; unknown → keep as written), `observationDateLine` (user-message date or `unknown`), `parseExtractedEventDate` (YYYY-MM-DD, 1900..now+1y), `resolveValidFrom` (extracted > caller > observation > now), `hasUnresolvedRelativeDate` (judge-free eval check). Fact extraction, dream synthesis, extract_atoms and propose_takes add the rule by default (`extraction.date_grounding` unset or true; `false` turns all off; held-out verdict and per-consumer checks in `docs/eval/decisions/p2-e2-heldout/`); the life chronicle judge adds it only when the setting is explicitly `true` (`isConsumerDateGroundingOn(engine, consumer)`). Page-body facts default to the page's observation date regardless. Pinned by `test/ai/date-grounding.test.ts`, `test/facts/extract-date-grounding.test.ts`, `test/facts/backstop-page-date.test.ts`.-- `src/core/ai/defaults.ts` — leaf module for canonical embedding and reranker defaults, without a gateway import. Voyage `voyage:voyage-4` at 1024 dimensions is the new-install embedding default; `voyage:rerank-2.5` is the runtime/mode-bundle reranker default. `renderCanonicalMigrationCommands` supplies an explicit-target cost preview and an OpenAI keep-width alternative where supported. These constants do not establish the identity of vectors in an existing database and must never authorize automatic provider conversion. Init preserves explicit choices, writes no reranker row when the Voyage key is available, disables reranking for keyed installs without that key, and preserves keyless setup.+- `src/core/ai/defaults.ts` — leaf module for canonical embedding and reranker defaults, without a gateway import. Voyage `voyage:voyage-4` at 1024 dimensions is the new-install embedding default; `voyage:rerank-3-lite` is the runtime/mode-bundle reranker default (it applies only to brains with no `search.reranker.model` row). `renderCanonicalMigrationCommands` supplies an explicit-target cost preview and an OpenAI keep-width alternative where supported. These constants do not establish the identity of vectors in an existing database and must never authorize automatic provider conversion. Init preserves explicit choices, writes no reranker row when the Voyage key is available, disables reranking for keyed installs without that key, and preserves keyless setup.- `src/core/ai/dims.ts` — per-provider `providerOptions` resolver for embed-time dimension passthrough; the single source of truth for "which provider needs which knob to produce `vector(N)`". Exports `dimsProviderOptions(implementation, modelId, dims)` (called by `embed()` in `gateway.ts`), `VOYAGE_OUTPUT_DIMENSION_MODELS` (private const — the 7 hosted Voyage models that accept `output_dimension`: `voyage-4-large`, `voyage-4`, `voyage-4-lite`, `voyage-3-large`, `voyage-3.5`, `voyage-3.5-lite`, `voyage-code-3` — nano deliberately excluded), `VOYAGE_VALID_OUTPUT_DIMS = [256, 512, 1024, 2048] as const`, `supportsVoyageOutputDimension(modelId)`, `isValidVoyageOutputDim(dims)`. Voyage path uses the SDK-supported `dimensions` field (`{ openaiCompatible: { dimensions: N } }`), NOT Voyage's `output_dimension` wire-key — the `voyageCompatFetch` shim in `gateway.ts:541` translates `dimensions → output_dimension` before the HTTP body is built (the AI SDK's openai-compatible adapter doesn't recognize the wire-key, so sending it from here would be silently dropped and Voyage would return its default 1024-dim). Runtime guard: when a Voyage flexible-dim model is configured with `dims` outside `VOYAGE_VALID_OUTPUT_DIMS`, throws `AIConfigError` with a paste-ready `gbrain config set embedding_dimensions <256|512|1024|2048>` hint at the embed boundary (most common trigger: `embedding_model: voyage:voyage-4-large` without `embedding_dimensions`, retaining an incompatible 1536-dimensional setting from another provider). Every lookup in this module folds through the private `modelMatchKey` (trim + lowercase) so cased hub-form ids (`Qwen/Qwen3-Embedding-4B`) match the all-lowercase tables — the folded key is a MATCH key only, never sent to a provider (wire model ids are case-sensitive; error messages keep the original id so they stay paste-ready); the Qwen3-Embedding native-width table lives at module scope alongside the other dim tables. Consequence, deliberate: a cased Voyage/Perplexity config matches and fails loudly at init when its `dims` is invalid, rather than skipping validation and silently producing wrong-width vectors.diff --git a/docs/guides/embedding-migration.md b/docs/guides/embedding-migration.mdindex f426692974..27a17925b7 100644--- a/docs/guides/embedding-migration.md+++ b/docs/guides/embedding-migration.md@@ -29,7 +29,7 @@ llama-server, and other bring-your-own-model providers).## Recommended targets- **`voyage:voyage-4 --dim 1024`** (the default for new installs). One- `VOYAGE_API_KEY` covers embedding, the `rerank-2.5` reranker, and the+ `VOYAGE_API_KEY` covers embedding, the `rerank-3-lite` reranker, and themultimodal model; the voyage-4 family shares one embedding space, so youcan later point the query model at `voyage-4-large` or `voyage-4-lite`without reindexing. Note: **1280 is not a valid Voyage width** (valid:@@ -389,7 +389,7 @@ disables reranking, `--reranker keep` leaves it, `--reranker<provider:model>` picks explicitly (validated before anything runs). When thetarget provider has no reranker (OpenAI), the run prints an ACTION line withthe exact commands instead of silently enabling a third provider:-`gbrain config set search.reranker.model voyage:rerank-2.5` (needs+`gbrain config set search.reranker.model voyage:rerank-3-lite` (needs`VOYAGE_API_KEY`) or `gbrain config set search.reranker.enabled false`. Afailed reranker probe keeps the previous config and is reported as`switch_failed` — never silent, never fatal to the migration.diff --git a/docs/guides/search-modes.md b/docs/guides/search-modes.mdindex 3f3df16c08..1d0cf83852 100644--- a/docs/guides/search-modes.md+++ b/docs/guides/search-modes.md@@ -38,7 +38,7 @@ and maintenance commands remain available.| `keyword_arm_confidence_floor` | `null` (off) | `null` (off) | `null` (off) || `metadata_boost_gate` | `lexical` | `lexical` | `lexical` || `searchLimit` default | 10 | 25 | 50 |-| `reranker` (cross-encoder) | off | `voyage:rerank-2.5` | `voyage:rerank-2.5` |+| `reranker` (cross-encoder) | off | `voyage:rerank-3-lite` | `voyage:rerank-3-lite` || `autocut` (rerank-cliff cut) | off | off | off || `reranker_gate` | off | off | off |@@ -247,7 +247,7 @@ gbrain search diagnose "<query>" --target <slug>`gbrain search modes` also answers the question the knob table cannot: isthe resolved reranker actually going to run? Below the attribution table it-prints one runtime line — `Reranker: voyage:rerank-2.5 (enabled) —+prints one runtime line — `Reranker: voyage:rerank-3-lite (enabled) —VOYAGE_API_KEY present`, `Reranker: off (resolved) — …`, or `Reranker:<model> (enabled but NOT running) — <paste-ready fix>` — and each bundle rowcarries `reranker=… topNIn=… autocut=…`. `--json` exposes the same verdict@@ -259,6 +259,13 @@ brain's reranker is actually running"* — *"turn reranking off for now"* —your agent runs `gbrain search modes` / `gbrain doctor`, then either exports`VOYAGE_API_KEY` or runs `gbrain config set search.reranker.enabled false`.+The default reranker is Voyage `rerank-3-lite`. It replaced `rerank-2.5`+after gbrain-evals #148 (v0.10.93) measured 60% lower rerank cost at 50+candidates × 1,400 tokens with quality within noise. It applies only to+brains that never set `search.reranker.model`; a brain with an explicit+model keeps it. To go back to the previous default, run+`gbrain config set search.reranker.model voyage:rerank-2.5`.+TypeSafe's Jev can be the reranker instead of Voyage (`gbrain decide enablererank` sets it and `gbrain decide disable rerank` restores your previousreranker; setup in [TypeSafe (Jev)](../ai-providers/typesafe.md)). The samediff --git a/docs/guides/system-one.md b/docs/guides/system-one.mdindex f9e802a9d4..0350735838 100644--- a/docs/guides/system-one.md+++ b/docs/guides/system-one.md@@ -531,7 +531,7 @@ what: [TypeSafe data handling](../ai-providers/typesafe.md#what-never-leaves-theSystem One (decide): provider typesafe:jev-1.13.0; key: TYPESAFE_API_KEYegress: private=deny; consent query=allow candidates=allow facts=deny conversation=deny; deny_sources: none; fallback: nonebudget: $0.0002 of $1.00 today (remote $0.0000, cap 50%); not covered: S1 on: reranker spend controls (BudgetKind rerank); llm: providers: chat spend controls (BudgetKind chat)-reranker: voyage:rerank-2.5 (enabled, mode balanced); Jev called: no+reranker: voyage:rerank-3-lite (enabled, mode balanced); Jev called: norerank ready for on ~$0.5377/1k queries (estimate)evidence on threshold 0.300 (override) ~$0.3873/1k queries (estimate) 24h: 12 decisions, 0.0% errorsdiff --git a/docs/integrations/embedding-providers.md b/docs/integrations/embedding-providers.mdindex c5fe7e1182..97004af01f 100644--- a/docs/integrations/embedding-providers.md+++ b/docs/integrations/embedding-providers.md@@ -23,7 +23,7 @@ The resolved provider + dimensions get persisted to `~/.gbrain/config.json` atom| Provider | env vars | default dims | cost ($/1M tokens) | local? | multimodal? ||---|---|---|---|---|---|-| `voyage` (**default** — `voyage-4` @ 1024d; `rerank-2.5` reranker on the same key) | `VOYAGE_API_KEY` | 1024 | 0.06 (`voyage-4`) | no | yes (`voyage-multimodal-3`) |+| `voyage` (**default** — `voyage-4` @ 1024d; `rerank-3-lite` reranker on the same key) | `VOYAGE_API_KEY` | 1024 | 0.06 (`voyage-4`) | no | yes (`voyage-multimodal-3`) || `openai` | `OPENAI_API_KEY` | 1536 | 0.13 | no | no || `openrouter` | `OPENROUTER_API_KEY` | per-model (1536 for the default `openai/text-embedding-3-small`; unlisted ids require explicit dims) | 0.02 | no | model-dependent || `google` | `GOOGLE_GENERATIVE_AI_API_KEY` | 768 | 0.025 | no | no |@@ -68,7 +68,7 @@ The doctor distinguishes two repair paths:- **Cost-sensitive, English-only**: Ollama (free, local) or Voyage (paid, best quality per dollar).- **Quality-first**: Voyage `voyage-4-large` (1024-2048 dims, ~3-4× more dense tokens than OpenAI tiktoken).- **Code-heavy brain (gstack per-worktree, source repos)**: Voyage `voyage-code-3` (1024 default; supports 256/512/1024/2048), or `voyage-code-4` (hosted, flexible dims, $0.12/M). Tuned on programming languages. Voyage publishes head-to-head numbers showing it outperforms their general flagships on code retrieval ([voyageai.com/blog](https://voyageai.com/blog)). For gstack's per-worktree pglite-backed code brain, this is the right default — see Topology 3 in `docs/architecture/topologies.md`.-- **Reranking pair**: Voyage `rerank-2.5` ($0.05/M; `rerank-2.5-lite` at $0.02/M for cost-sensitive setups) is the mode-bundle default and rides the same `VOYAGE_API_KEY` as embeddings. Voyage's preview `rerank-3` / `rerank-3-lite` pair is also allowlisted — opt in with `gbrain config set search.reranker.model voyage:rerank-3` (the default stays on `rerank-2.5` so upgrades never move you); without the key search fails open in fusion order and `gbrain search modes` says so.+- **Reranking pair**: Voyage `rerank-3-lite` ($0.02/M) is the mode-bundle default and rides the same `VOYAGE_API_KEY` as embeddings; `rerank-3` ($0.05/M) and the older `rerank-2.5` / `rerank-2.5-lite` are also allowlisted. A brain that set `search.reranker.model` keeps its own model; `gbrain config set search.reranker.model voyage:rerank-2.5` restores the previous default. Without the key search fails open in fusion order and `gbrain search modes` says so.- **Local reranking (no API spend)**: `llama-server-reranker` recipe — point gbrain at your own `llama-server --reranking` instance running Qwen3-Reranker. Same `gateway.rerank()` seam, $0 per call. Walkthrough in [`docs/ai-providers/llama-server-reranker.md`](../ai-providers/llama-server-reranker.md).- **One key for many hosted models**: OpenRouter. Set `OPENROUTER_API_KEY` and use `openrouter:<provider>/<model>` for chat against GPT-5.2, Claude 4.x, Gemini 3, DeepSeek, and dozens more without juggling per-provider keys. Embedding catalog includes OpenAI, Google, Qwen, BGE-M3.- **Enterprise compliance**: Azure OpenAI (data residency + private endpoints) or self-hosted via llama-server / Ollama.@@ -86,22 +86,24 @@ Optional `OPENAI_BASE_URL` — point the native OpenAI provider at an OpenAI-com### Voyage AI-**The default provider** — new installs get `voyage-4` @ 1024d ($0.06/M) plus the `rerank-2.5` reranker on the same key. Best-in-class quality on the Voyage 4 family (Jan 2026 release). Set `VOYAGE_API_KEY`. Models: `voyage-4-large`, `voyage-4`, `voyage-4-lite`, `voyage-4-nano`, `voyage-code-4` (code-tuned, hosted, flexible dims, $0.12/M), `voyage-3.5`, `voyage-code-3`, `voyage-finance-2`, `voyage-law-2`, `voyage-multimodal-3` (text + image).+**The default provider** — new installs get `voyage-4` @ 1024d ($0.06/M) plus the `rerank-3-lite` reranker on the same key. Best-in-class quality on the Voyage 4 family (Jan 2026 release). Set `VOYAGE_API_KEY`. Models: `voyage-4-large`, `voyage-4`, `voyage-4-lite`, `voyage-4-nano`, `voyage-code-4` (code-tuned, hosted, flexible dims, $0.12/M), `voyage-3.5`, `voyage-code-3`, `voyage-finance-2`, `voyage-law-2`, `voyage-multimodal-3` (text + image).Voyage 4 family shares an embedding space across all variants, so you can index with `voyage-4` and later point the query model at `voyage-4-large` or `voyage-4-lite` without reindexing. Dims: 256, 512, 1024, 2048. **2048 exceeds pgvector's HNSW cap of 2000** — those brains fall back to exact vector scans (still correct, just slower).Routed through the Vercel AI Gateway (`provider_base_urls.voyage` = `https://ai-gateway.vercel.sh/v1`), the embedding request also carries the width as `providerOptions.voyage.outputDimension`, which the gateway reads instead of Voyage's root `output_dimension`; that field is sent only when the hostname is exactly `ai-gateway.vercel.sh`, because Voyage's own API rejects it with HTTP 400. If a proxy returns a different width than `embedding_dimensions`, the embed fails before anything is written and the error names the proxy as the likely cause; fix the proxy's width parameter before considering a migration.-Voyage also serves four hosted rerankers at `POST /v1/rerank` — `rerank-2.5` ($0.05/M) and `rerank-2.5-lite` ($0.02/M), plus the preview `rerank-3` ($0.05/M) and `rerank-3-lite` ($0.02/M) (2.5 pair verified 2026-08-15, rerank-3 pair 2026-09-06). All four share one request/response wire, so switching is a config change and nothing else.+Voyage also serves four hosted rerankers at `POST /v1/rerank` — its current `rerank-3` ($0.05/M) and `rerank-3-lite` ($0.02/M), plus the older `rerank-2.5` ($0.05/M) and `rerank-2.5-lite` ($0.02/M) (prices verified 2026-10-14). All four share one request/response wire, so switching is a config change and nothing else.-`rerank-2.5` is the mode-bundle reranker default, so no config row is needed for it (an explicit `search.reranker.model` equal to it is exactly what `gbrain doctor`'s `search_mode` check calls redundant). Moving to the preview generation is one command:+`rerank-3-lite` is the mode-bundle reranker default, so no config row is needed for it (an explicit `search.reranker.model` equal to it is exactly what `gbrain doctor`'s `search_mode` check calls redundant). It replaced `rerank-2.5` as the default after gbrain-evals #148 (v0.10.93) measured 60% lower rerank cost at 50 candidates × 1,400 tokens with quality within noise. The new default reaches only brains that never set `search.reranker.model`; a brain with an explicit model keeps it.++To go back to the previous default, or to move to `rerank-3`, set the model explicitly:```bash-gbrain config set search.reranker.model voyage:rerank-3-gbrain models doctor # green `reranker_config voyage:rerank-3` is the whole test+gbrain config set search.reranker.model voyage:rerank-2.5 # roll back to the previous default+gbrain models doctor # green `reranker_config voyage:rerank-2.5` is the whole test```-**Say to your agent:** *"switch my reranker to voyage rerank-3"* — *"check my model config"* (your agent runs `gbrain config set search.reranker.model voyage:rerank-3` then `gbrain models doctor`).+**Say to your agent:** *"switch my reranker back to voyage rerank-2.5"* — *"check my model config"* (your agent runs `gbrain config set search.reranker.model voyage:rerank-2.5` then `gbrain models doctor`).**For brains that index source code** (gstack's per-worktree pglite-backed code brain — see Topology 3 in `docs/architecture/topologies.md`), prefer `voyage-code-3` over `voyage-4-large`. Voyage tunes it on programming languages and publishes head-to-head numbers vs their general flagships on code retrieval. Configure at install time:diff --git a/docs/tutorials/personal-brain.md b/docs/tutorials/personal-brain.mdindex eddc0b0ce3..8ddf23f653 100644--- a/docs/tutorials/personal-brain.md+++ b/docs/tutorials/personal-brain.md@@ -108,7 +108,7 @@ In the AlphaClaw UI (Providers tab):- **OpenAI API Key.** Required for embeddings if you use the OpenAI provider.- **Anthropic API Key.** Required for Claude (the main model the agent talks through).- **Perplexity API Key.** Optional, for web search.-- **Voyage API Key.** Recommended. GBrain ships with Voyage as the default embedder + reranker (`voyage-4` + `rerank-2.5`) — one key covers both, at about half OpenAI's embedding price.+- **Voyage API Key.** Recommended. GBrain ships with Voyage as the default embedder + reranker (`voyage-4` + `rerank-3-lite`) — one key covers both, at about half OpenAI's embedding price.You can use the same keys across multiple agents.diff --git a/llms-full.txt b/llms-full.txtindex 76e8e927c0..65d42c3310 100644--- a/llms-full.txt+++ b/llms-full.txt@@ -2637,7 +2637,7 @@ GBrain is keyless. Explain these boundaries before enabling a capability; see[memory boundaries](docs/guides/memory-boundaries.md#where-text-goes).Skip API-key setup for the initial keyless memory path. If the user enables semantic retrieval or paid enrichment, configure the selected provider explicitly. GBrain defaults to the Voyage embedding + reranker stack-(`voyage:voyage-4` @ 1024d + `voyage:rerank-2.5` — one key covers both); OpenAI is the+(`voyage:voyage-4` @ 1024d + `voyage:rerank-3-lite` — one key covers both); OpenAI is themain alternative, chosen at init via `--embedding-model <provider:model>`.**Need to switch an existing brain's embedding or reranker model?** Followthe explicit-consent playbook at `skills/migrations/v0.46.3.0.md`. Preview the@@ -5125,7 +5125,7 @@ Data flowing into the brain. Each integration is a recipe — markdown + setup h- **Gmail + Calendar + Contacts (native)**: the google source kind syncs threads, events, and contacts through your own OAuth client and runs the open-loop engine on top (`gbrain waiting`). Setup: [`docs/guides/google-connect.md`](docs/guides/google-connect.md); recipes: [`recipes/email-to-brain.md`](recipes/email-to-brain.md), [`recipes/calendar-to-brain.md`](recipes/calendar-to-brain.md).- **Email + calendar (webhooks)**: webhook handlers that route to brain signals. [`docs/integrations/meeting-webhooks.md`](docs/integrations/meeting-webhooks.md).- **Embedding providers**: Voyage (new-install default: `voyage-4` @ 1024d), OpenAI, OpenRouter, Google Gemini, Azure OpenAI, MiniMax, Alibaba DashScope, Zhipu, Ollama (local), llama.cpp llama-server (local), LM Studio, Together, and LiteLLM proxy. Pricing matrix + decision tree in [`docs/integrations/embedding-providers.md`](docs/integrations/embedding-providers.md). Existing vectors are never converted by changing the default; use the explicitly approved [embedding migration](docs/guides/embedding-migration.md).-- **Rerankers**: Voyage `rerank-2.5` hosted (the default; reranking is on in `balanced` and `tokenmax` modes, same `VOYAGE_API_KEY` as embeddings; the preview `rerank-3` / `rerank-3-lite` are selectable with `gbrain config set search.reranker.model voyage:rerank-3`), plus the `llama-server-reranker` recipe for fully-local cross-encoder rerank via llama.cpp running Qwen3-Reranker against the same `gateway.rerank()` seam. Setup walkthrough in [`docs/ai-providers/llama-server-reranker.md`](docs/ai-providers/llama-server-reranker.md).+- **Rerankers**: Voyage `rerank-3-lite` hosted (the default unless `search.reranker.model` is set; on in `balanced` and `tokenmax`, same `VOYAGE_API_KEY` as embeddings; `gbrain config set search.reranker.model voyage:rerank-2.5` restores the previous default), plus the `llama-server-reranker` recipe for fully-local cross-encoder rerank via llama.cpp running Qwen3-Reranker against the same `gateway.rerank()` seam. Setup walkthrough in [`docs/ai-providers/llama-server-reranker.md`](docs/ai-providers/llama-server-reranker.md).- **Credential vault + gateway**: `gbrain creds` manages OAuth and API credentials in a local vault ([`recipes/credential-gateway.md`](recipes/credential-gateway.md)); agent-side vault-aware secret distribution: [`docs/integrations/credential-gateway.md`](docs/integrations/credential-gateway.md).- **MCP clients**: every major MCP client is supported. [`docs/mcp/`](docs/mcp/) per-client setup.- **Memorable (procedural memory)**: optional, off by default. Your brain remembers *what* happened; Memorable makes your agent remember *how* — finished sessions become replayable procedures stored on your machine (in a standalone local store, or inside your brain database if you opt in), recalled when a similar task comes back. See the section below, and [`docs/memorable-agents.md`](docs/memorable-agents.md) for the agent-facing detail.diff --git a/src/commands/doctor/checks/search-eval.ts b/src/commands/doctor/checks/search-eval.tsindex 147e0f97e2..7c282e6fca 100644--- a/src/commands/doctor/checks/search-eval.ts+++ b/src/commands/doctor/checks/search-eval.ts@@ -42,10 +42,11 @@ export async function checkSearchMode(engine: BrainEngine): Promise<Check> {return { name: 'search_mode', status: 'ok', message: context };}- // v0.48.2: installs from v0.46.3–v0.47.10 carry an explicit- // `search.reranker.model voyage:rerank-2.5` row init wrote before the- // bundle default caught up. It is now redundant, but `--reset` would also- // wipe every OTHER tuned search.* knob — name the exact key instead.+ // An explicit `search.reranker.model` equal to the bundle default is+ // redundant, but `--reset` would also wipe every OTHER tuned search.*+ // knob — name the exact key instead. (Installs from v0.46.3–v0.47.10+ // carry an init-written `voyage:rerank-2.5` row; since the default moved+ // to rerank-3-lite that row is a real pin and keeps them on rerank-2.5.)const redundant: string[] = [];if (resetReranker !== undefined) {const explicitModel = await engine.getConfig('search.reranker.model');diff --git a/src/commands/providers.ts b/src/commands/providers.tsindex 8ed5cc384e..4837da1d73 100644--- a/src/commands/providers.ts+++ b/src/commands/providers.ts@@ -474,7 +474,7 @@ function pickRecommended(options: ProviderOption[], env: Record<string, boolean>const embOpts = options.filter(o => o.touchpoint === 'embedding');if (env.VOYAGE_API_KEY) {const voyage = embOpts.find(o => o.id.startsWith('voyage:'));- if (voyage) return { id: voyage.id, reason: 'VOYAGE_API_KEY set — the default: voyage-4 at 1024 dims; the same key powers the rerank-2.5 reranker and the multimodal model.' };+ if (voyage) return { id: voyage.id, reason: 'VOYAGE_API_KEY set — the default: voyage-4 at 1024 dims; the same key powers the rerank-3-lite reranker and the multimodal model.' };}if (env.OPENAI_API_KEY) {const openai = embOpts.find(o => o.id.startsWith('openai:'));diff --git a/src/core/ai/defaults.ts b/src/core/ai/defaults.tsindex 24dea7a005..2b65666637 100644--- a/src/core/ai/defaults.ts+++ b/src/core/ai/defaults.ts@@ -16,7 +16,7 @@ export const DEFAULT_EMBEDDING_MODEL = 'voyage:voyage-4';export const DEFAULT_EMBEDDING_DIMENSIONS = 1024;export const NEW_INSTALL_DEFAULT_EMBEDDING_MODEL = DEFAULT_EMBEDDING_MODEL;export const NEW_INSTALL_DEFAULT_EMBEDDING_DIMENSIONS = DEFAULT_EMBEDDING_DIMENSIONS;-export const DEFAULT_RERANKER_MODEL = 'voyage:rerank-2.5';+export const DEFAULT_RERANKER_MODEL = 'voyage:rerank-3-lite';export const NEW_INSTALL_DEFAULT_RERANKER_MODEL = DEFAULT_RERANKER_MODEL;export function renderCanonicalMigrationCommands(opts: { colDims?: number | null } = {}): {diff --git a/src/core/ai/gateway.ts b/src/core/ai/gateway.tsindex 32cb27905f..fecd2bda5d 100644--- a/src/core/ai/gateway.ts+++ b/src/core/ai/gateway.ts@@ -133,7 +133,7 @@ const DEFAULT_CHAT_MODEL = 'anthropic:claude-sonnet-4-6';// v0.35.0.0+: reranker runtime fallback. Used only when search.reranker.enabled// is set AND no explicit reranker_model is configured. #3657 seam: the value is// `DEFAULT_RERANKER_MODEL` imported from ./defaults.ts (ONE constant, shared with-// the mode bundles) — `voyage:rerank-2.5` since v0.48.2.+// the mode bundles) — `voyage:rerank-3-lite` (was `voyage:rerank-2.5` from v0.48.2).let _config: AIGatewayConfig | null = null;/** #5137: provider auth errors echo keys; scrub every key in effect before the text leaves the gateway. */diff --git a/src/core/ai/recipes/voyage.ts b/src/core/ai/recipes/voyage.tsindex 811a80368a..52d0706f75 100644--- a/src/core/ai/recipes/voyage.ts+++ b/src/core/ai/recipes/voyage.ts@@ -71,20 +71,24 @@ export const voyage: Recipe = {multimodal_models: ['voyage-multimodal-3'],},reranker: {- // #4938: rerank-3 / rerank-3-lite are Voyage's preview generation on the- // same /rerank wire (path + top_param unchanged). default_model stays- // rerank-2.5 so an upgrade never moves an install; opt in with- // `gbrain config set search.reranker.model voyage:rerank-3`.+ // rerank-3 / rerank-3-lite are Voyage's current generation (generally+ // available; Voyage lists the 2.5 pair as older models, docs verified+ // 2026-10-14) on the same /rerank wire (path + top_param unchanged).+ // rerank-3-lite is the default since gbrain-evals #148 (v0.10.93): 60%+ // cheaper than rerank-2.5 at 50 candidates x 1,400 tokens, quality+ // within noise. A brain with an explicit `search.reranker.model` keeps+ // it; roll back with `gbrain config set search.reranker.model voyage:rerank-2.5`.models: ['rerank-2.5', 'rerank-2.5-lite', 'rerank-3', 'rerank-3-lite'],- default_model: 'rerank-2.5',+ default_model: 'rerank-3-lite',path: '/rerank',top_param: 'top_k',- // https://docs.voyageai.com/docs/pricing (2.5 pair verified 2026-08-15,- // rerank-3 pair 2026-09-06): rerank-2.5 / rerank-3 $0.05/M,- // rerank-2.5-lite / rerank-3-lite $0.02/M. Per-model billing math goes- // through src/core/embedding-pricing.ts; this scalar is a display hint.- cost_per_1m_tokens_usd: 0.05,- price_last_verified: '2026-09-06',+ // https://docs.voyageai.com/docs/pricing (verified 2026-10-14):+ // rerank-2.5 / rerank-3 $0.05/M, rerank-2.5-lite / rerank-3-lite+ // $0.02/M. Per-model billing math goes through+ // src/core/embedding-pricing.ts; this scalar is a display hint for the+ // default model.+ cost_per_1m_tokens_usd: 0.02,+ price_last_verified: '2026-10-14',max_payload_bytes: 5_000_000,},},diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.tsindex facb321968..1d5adf3658 100644--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@ -561,6 +561,8 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText }// #6650 L0 (convergence harness fixes). `since` is a placeholder equal to the branch's VERSION until the merge-slot stamp.{ since: '0.60.223.0', text: 'On Linux, a `gbrain sync` started after another gbrain process on the same machine was killed no longer treats the dead process\'s heartbeat as a live write owner. Before, it refused to hand its catch-up to the running `gbrain serve` for up to 30 s and ran its own consumer next to it; now it hands the catch-up to the serve (or runs its own consumer when no serve is running). A waiter-only consumer deferring to the dead process promotes on its next check instead of after 60 s. A heartbeat row from another host or container, or from an older gbrain, keeps the time-only rule, as does every row where `/proc` is unavailable.' },{ since: '0.60.223.0', text: 'On Linux, when the process holding write claims on this host is killed, another consumer on the same machine now reclaims those claims within about 5 s instead of waiting out their lease (up to `persistence.publication_ceiling_ms` plus about 65 s, so about 365 s by default). Only claims with no recovery record and no publication started are taken, the same guard an expired claim has. An owner that is alive, however slow, or on another host or container keeps its full lease.' },+ // GBRA-96 (default reranker). `since` is a placeholder equal to the branch's VERSION until the merge-slot stamp.+ { since: '0.60.223.0', text: 'The default search reranker is now Voyage `rerank-3-lite` instead of `rerank-2.5`, for brains that never set `search.reranker.model` (a brain that set one keeps it). In gbrain-evals #148 (v0.10.93) it cut rerank cost 60% at the same 50 candidates × 1,400 tokens, with retrieval quality within noise. To go back: `gbrain config set search.reranker.model voyage:rerank-2.5`.' },];/** The newest disclosed change's release: the notice id moves only when a release adds rows. */diff --git a/src/core/search/mode-switch-ux.ts b/src/core/search/mode-switch-ux.tsindex 2b0b0f757b..8798843162 100644--- a/src/core/search/mode-switch-ux.ts+++ b/src/core/search/mode-switch-ux.ts@@ -124,11 +124,11 @@ export function summarizeTransition(kind: 'tokenmax_opt_in',reindex_required: true,reindex_command: 'gbrain reindex --markdown',- cost_estimate_per_query_cents: 0.03, // ~$0.0003 per typical search+ cost_estimate_per_query_cents: 0.06, // ~$0.0006: rerank-3-lite at 50 candidates (gbrain-evals #148)callout_lines: [`Switched to tokenmax. Per-chunk Haiku synopsis enabled.`,`Backfill cost (one-time): ~$1-5 per 10K pages via Anthropic Haiku.`,- `Per-query overhead: ~$0.0003 (reranker + slightly larger payload).`,+ `Per-query overhead: ~$0.0006 (reranker + slightly larger payload).`,`Run \`gbrain reindex --markdown\` to backfill existing pages.`,],};diff --git a/src/core/search/mode.ts b/src/core/search/mode.tsindex fc1909247d..dbc8de50f8 100644--- a/src/core/search/mode.ts+++ b/src/core/search/mode.ts@@ -32,7 +32,8 @@ import { pickDecideConfig } from '../ai/decide/config.ts';import { getRecipe } from '../ai/recipes/index.ts';// #3657 seam: the runtime/mode-bundle reranker default has ONE code home// (ai/defaults.ts — a leaf module, no SDK loads). The three bundles below-// resolve through DEFAULT_RERANKER_MODEL (voyage:rerank-2.5 since v0.48.2).+// resolve through DEFAULT_RERANKER_MODEL (voyage:rerank-3-lite; was+// voyage:rerank-2.5 from v0.48.2).import { DEFAULT_RERANKER_MODEL } from '../ai/defaults.ts';import { normalizeExpansionVariantBudget } from './fusion-lists.ts';import { DEFAULT_RELATIONAL_RERANK_PIN, normalizeRelationalRerankPin } from './relational-rerank-pin.ts';@@ -155,11 +156,11 @@ export interface ModeBundle {searchLimit: number;/*** v0.35.0.0+ — cross-encoder reranker. Off for conservative, on for- * balanced/tokenmax. Model: `DEFAULT_RERANKER_MODEL` (voyage:rerank-2.5),+ * balanced/tokenmax. Model: `DEFAULT_RERANKER_MODEL` (voyage:rerank-3-lite),* overridable via `search.reranker.model`. Slots between dedup and token-budget* enforcement in hybrid.ts; fail-open on any RerankError (audit-logged).- * Cost anchor: ~$0.0003/query at tokenmax topNIn=30 × ~400 tokens/chunk- * (rounding error vs Opus, meaningful vs Haiku).+ * Cost anchor: ~$0.0006/query at tokenmax topNIn=50 with rerank-3-lite+ * (gbrain-evals #148; rounding error vs Opus, meaningful vs Haiku).*/reranker_enabled: boolean;@@ -608,7 +609,8 @@ export const MODE_BUNDLES: Readonly<Record<SearchMode, Readonly<ModeBundle>>> =// tokenmax is the high-cost-tolerant tier that already pays for LLM// expansion + 50-result payloads. Reranker is the natural capstone:// better ordering of a large candidate set is where rerankers earn- // their fee. ~$0.0003/query at this shape; rounding error vs the+ // their fee. ~$0.0006/query at this shape with rerank-3-lite (gbrain-evals+ // #148: $0.60 per 1k LongMemEval queries); rounding error vs the// tier's $700/mo @ Opus pairing per CLAUDE.md cost matrix.reranker_enabled: true,reranker_model: DEFAULT_RERANKER_MODEL,diff --git a/test/ai/reranker-readiness.test.ts b/test/ai/reranker-readiness.test.tsindex 7ed92cbdd8..6dc68e1000 100644--- a/test/ai/reranker-readiness.test.ts+++ b/test/ai/reranker-readiness.test.ts@@ -26,7 +26,7 @@ describe('rerankerReadiness — default voyage model', () => {test('key present → ready, no fix', () => {const r = rerankerReadiness(DEFAULT_RERANKER_MODEL, { VOYAGE_API_KEY: 'pa-test' });expect(r.provider).toBe('voyage');- expect(r.modelId).toBe('rerank-2.5');+ expect(r.modelId).toBe('rerank-3-lite');expect(r.recipeKnown).toBe(true);expect(r.hasTouchpoint).toBe(true);expect(r.modelListed).toBe(true);diff --git a/test/ai/typesafe-reranker.test.ts b/test/ai/typesafe-reranker.test.tsindex 4ead73a3f6..1bbba9b5c9 100644--- a/test/ai/typesafe-reranker.test.ts+++ b/test/ai/typesafe-reranker.test.ts@@ -63,7 +63,7 @@ describe('System One reranker (S1)', () => {expect(recipe.touchpoints.decide?.default_model).toBe('jev-1.13.0');expect(recipe.touchpoints.embedding).toBeUndefined();expect(recipe.touchpoints.chat).toBeUndefined();- expect(DEFAULT_RERANKER_MODEL).toBe('voyage:rerank-2.5');+ expect(DEFAULT_RERANKER_MODEL).toBe('voyage:rerank-3-lite');expect(rerankerReadiness(MODEL, {}).ready).toBe(false);expect(rerankerReadiness(MODEL, { TYPESAFE_API_KEY: 'sk-test' }).ready).toBe(true);expect(rerankerReadiness(MODEL, { JEV_TYPESAFE_API_KEY: 'sk-test' }).ready).toBe(true);diff --git a/test/ai/voyage-reranker-recipe.test.ts b/test/ai/voyage-reranker-recipe.test.tsindex 5ef7f700a9..1d5e9d3de1 100644--- a/test/ai/voyage-reranker-recipe.test.ts+++ b/test/ai/voyage-reranker-recipe.test.ts@@ -28,11 +28,11 @@ import {} from '../../src/core/ai/defaults.ts';describe('voyage reranker touchpoint (v0.46.3)', () => {- test('declares rerank-2.5 as the default reranker at /rerank with top_k', () => {+ test('declares rerank-3-lite as the default reranker at /rerank with top_k', () => {const tp = voyage.touchpoints.reranker;expect(tp).toBeDefined();expect(tp!.models).toEqual(['rerank-2.5', 'rerank-2.5-lite', 'rerank-3', 'rerank-3-lite']);- expect(tp!.default_model).toBe('rerank-2.5');+ expect(tp!.default_model).toBe('rerank-3-lite');expect(tp!.path).toBe('/rerank');expect(tp!.top_param).toBe('top_k');expect(tp!.max_payload_bytes).toBeGreaterThan(0);@@ -44,7 +44,7 @@ describe('voyage reranker touchpoint (v0.46.3)', () => {});test('registry resolves the same recipe object', () => {- expect(getRecipe('voyage')?.touchpoints.reranker?.default_model).toBe('rerank-2.5');+ expect(getRecipe('voyage')?.touchpoints.reranker?.default_model).toBe('rerank-3-lite');});});@@ -65,11 +65,9 @@ describe('voyage rerank-3 allowlist (#4938)', () => {expect(models).toContain('rerank-3-lite');});- test('adding rerank-3 does NOT move the default off rerank-2.5', () => {- // Flipping default_model would silently migrate every install that- // resolves the recipe default instead of an explicit config row.- expect(voyage.touchpoints.reranker!.default_model).toBe('rerank-2.5');- expect(NEW_INSTALL_DEFAULT_RERANKER_MODEL).toBe('voyage:rerank-2.5');+ test('rerank-3-lite is the default (gbrain-evals #148); the recipe and the constant agree', () => {+ expect(voyage.touchpoints.reranker!.default_model).toBe('rerank-3-lite');+ expect(NEW_INSTALL_DEFAULT_RERANKER_MODEL).toBe('voyage:rerank-3-lite');});test('the 2.5 pair is retained, not replaced', () => {@@ -102,7 +100,7 @@ describe('voyage canonical embedding model (v0.46.3)', () => {test('new-install default constants point at voyage', () => {expect(NEW_INSTALL_DEFAULT_EMBEDDING_MODEL).toBe('voyage:voyage-4');- expect(NEW_INSTALL_DEFAULT_RERANKER_MODEL).toBe('voyage:rerank-2.5');+ expect(NEW_INSTALL_DEFAULT_RERANKER_MODEL).toBe('voyage:rerank-3-lite');});});diff --git a/test/balanced-reranker-default.test.ts b/test/balanced-reranker-default.test.tsindex 92d6f04560..5e7953ca03 100644--- a/test/balanced-reranker-default.test.ts+++ b/test/balanced-reranker-default.test.ts@@ -22,7 +22,7 @@ describe('Mode bundle defaults (D6)', () => {test('balanced reranker model is the voyage default (v0.48.2 flip)', () => {expect(MODE_BUNDLES.balanced.reranker_model).toBe(DEFAULT_RERANKER_MODEL);- expect(MODE_BUNDLES.balanced.reranker_model).toBe('voyage:rerank-2.5');+ expect(MODE_BUNDLES.balanced.reranker_model).toBe('voyage:rerank-3-lite');});test('conservative reranker stays off (cheap tier)', () => {diff --git a/test/doctor.test.ts b/test/doctor.test.tsindex 4792125e62..4eb06efdb4 100644--- a/test/doctor.test.ts+++ b/test/doctor.test.ts@@ -183,7 +183,7 @@ describe('doctor command', () => {});for (let i = 0; i < 3; i++) {logRerankFailure({- model: 'voyage:rerank-2.5', // the resolved default — rows for other models are filtered out+ model: 'voyage:rerank-3-lite', // the resolved default — rows for other models are filtered outreason: 'unknown',query_hash: `unknown${i}`,doc_count: 30,@@ -220,7 +220,7 @@ describe('doctor command', () => {env: { OPENAI_API_KEY: 'sk-test', VOYAGE_API_KEY: 'pa-test-voyage' },});logRerankFailure({- model: 'voyage:rerank-2.5', // rows are filtered to the resolved model+ model: 'voyage:rerank-3-lite', // rows are filtered to the resolved modelreason: 'budget',query_hash: 'budget01',doc_count: 30,@@ -259,7 +259,7 @@ describe('doctor command', () => {const reasons = ['empty_result_set', 'malformed_shape', 'empty_result_set'] as const;reasons.forEach((reason, i) => {logRerankFailure({- model: 'voyage:rerank-2.5', // the resolved default — rows for other models are filtered out+ model: 'voyage:rerank-3-lite', // the resolved default — rows for other models are filtered outreason,query_hash: `passthru${i}`,doc_count: 12,@@ -295,7 +295,7 @@ describe('doctor command', () => {});for (const [i, reason] of (['empty_result_set', 'malformed_shape'] as const).entries()) {logRerankFailure({- model: 'voyage:rerank-2.5', // the resolved default — rows for other models are filtered out+ model: 'voyage:rerank-3-lite', // the resolved default — rows for other models are filtered outreason,query_hash: `passthru-low${i}`,doc_count: 12,diff --git a/test/eval-longmemeval-call-plan.test.ts b/test/eval-longmemeval-call-plan.test.tsindex 1f78300b36..8a62df09a9 100644--- a/test/eval-longmemeval-call-plan.test.ts+++ b/test/eval-longmemeval-call-plan.test.ts@@ -170,7 +170,7 @@ describe('eval longmemeval --call-plan', () => {expect(p.rows.expansion).toMatchObject({ model: 'anthropic:claude-haiku-4-5-20251001', max_out_tokens: '64000' });expect(p.rows.synopsis!.max_out_tokens).toBe('200');expect(p.rows.trajectory_extract!.max_out_tokens).toBe('2000');- expect(p.rows.rerank).toMatchObject({ model: 'voyage:rerank-2.5', calls: String(QUESTIONS.length), max_out_tokens: '0' });+ expect(p.rows.rerank).toMatchObject({ model: 'voyage:rerank-3-lite', calls: String(QUESTIONS.length), max_out_tokens: '0' });expect(p.text.endsWith(`GSTACK_EVAL_CALLS v1 end: lines=${p.parsed.rows.length}\n`)).toBe(true);expect(p.err).toContain('no provider was called');}, 60_000);diff --git a/test/fresh-install-pglite.serial.test.ts b/test/fresh-install-pglite.serial.test.tsindex 2e6d836428..4c40f590f3 100644--- a/test/fresh-install-pglite.serial.test.ts+++ b/test/fresh-install-pglite.serial.test.ts@@ -144,13 +144,13 @@ describe('E2E: fresh gbrain init --pglite → import → embed works end-to-end'const colDim = await readContentChunksEmbeddingDim(engine);expect(colDim.exists).toBe(true);expect(colDim.dims).toBe(NEW_INSTALL_DEFAULT_EMBEDDING_DIMENSIONS);- // v0.48.2: the mode-bundle default IS voyage:rerank-2.5 — a Voyage-keyed+ // v0.48.2: the mode-bundle default IS voyage:rerank-3-lite — a Voyage-keyed// init writes NO explicit row; the RESOLVED reranker is the default.expect(await engine.getConfig('search.reranker.model')).toBeNull();{const { loadSearchModeConfig, resolveSearchMode } = await import('../src/core/search/mode.ts');const knobs = resolveSearchMode(await loadSearchModeConfig(engine));- expect(knobs.reranker_model).toBe('voyage:rerank-2.5');+ expect(knobs.reranker_model).toBe('voyage:rerank-3-lite');// (reranker_enabled follows the picked mode — non-TTY init may auto-select a// reranker-off bundle; the point here is that no explicit row was written)expect(await engine.getConfig('search.reranker.enabled')).toBeNull();@@ -295,13 +295,13 @@ describe('E2E: fresh gbrain init --pglite → import → embed works end-to-end'const engine = new PGLiteEngine();await engine.connect({ database_path: cfg.database_path, engine: 'pglite' });try {- // v0.48.2: the mode-bundle default IS voyage:rerank-2.5 — a Voyage-keyed+ // v0.48.2: the mode-bundle default IS voyage:rerank-3-lite — a Voyage-keyed// init writes NO explicit row; the RESOLVED reranker is the default.expect(await engine.getConfig('search.reranker.model')).toBeNull();{const { loadSearchModeConfig, resolveSearchMode } = await import('../src/core/search/mode.ts');const knobs = resolveSearchMode(await loadSearchModeConfig(engine));- expect(knobs.reranker_model).toBe('voyage:rerank-2.5');+ expect(knobs.reranker_model).toBe('voyage:rerank-3-lite');// (reranker_enabled follows the picked mode — non-TTY init may auto-select a// reranker-off bundle; the point here is that no explicit row was written)expect(await engine.getConfig('search.reranker.enabled')).toBeNull();diff --git a/test/migrate-embeddings-hardening.serial.test.ts b/test/migrate-embeddings-hardening.serial.test.tsindex 9bfc2af83f..83ed33ce34 100644--- a/test/migrate-embeddings-hardening.serial.test.ts+++ b/test/migrate-embeddings-hardening.serial.test.ts@@ -387,7 +387,7 @@ describe('reranker companion (D8)', () => {const plan = await resolveRerankerPlan(engine, 'fixture-provider:embedding-v1', 'voyage:voyage-4', undefined);expect(plan.exposed).not.toBeNull();expect(plan.exposed!.model).toBe(OUTGOING_RERANKER);- expect(plan.action).toEqual({ kind: 'switch', to: 'voyage:rerank-2.5' });+ expect(plan.action).toEqual({ kind: 'switch', to: 'voyage:rerank-3-lite' });} finally {await engine.unsetConfig('search.reranker.model');}@@ -404,7 +404,7 @@ describe('reranker companion (D8)', () => {const plan = await resolveRerankerPlan(engine, 'fixture-provider:embedding-v1', 'openai:text-embedding-3-small', undefined);expect(plan.exposed).not.toBeNull();expect(plan.action.kind).toBe('none');- expect((plan.action as { suggestion: string | null }).suggestion).toBe('voyage:rerank-2.5');+ expect((plan.action as { suggestion: string | null }).suggestion).toBe('voyage:rerank-3-lite');} finally {await engine.unsetConfig('search.reranker.model');}diff --git a/test/reranker-default-explicit-config.test.ts b/test/reranker-default-explicit-config.test.tsnew file mode 100644index 0000000000..975d04ec8d--- /dev/null+++ b/test/reranker-default-explicit-config.test.ts@@ -0,0 +1,87 @@+/**+ * The shipped reranker default is voyage:rerank-3-lite (gbrain-evals #148,+ * v0.10.93). It reaches only brains that never set `search.reranker.model`;+ * a brain with an explicit model keeps it. Each case runs a real PGLite+ * brain's config through loadSearchModeConfig → resolveSearchMode →+ * applyReranker → gateway.rerank and checks the model on the wire.+ */+import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';+import { PGLiteEngine } from '../src/core/pglite-engine.ts';+import { loadSearchModeConfig, resolveSearchMode } from '../src/core/search/mode.ts';+import { applyReranker } from '../src/core/search/rerank.ts';+import { DEFAULT_RERANKER_MODEL } from '../src/core/ai/defaults.ts';+import { configureGateway, resetGateway, __setRerankTransportForTests } from '../src/core/ai/gateway.ts';+import type { SearchResult } from '../src/core/types.ts';++let engine: PGLiteEngine;++beforeAll(async () => {+ engine = new PGLiteEngine();+ await engine.connect({});+ await engine.initSchema();+});++afterAll(async () => {+ await engine.disconnect();+});++beforeEach(async () => {+ await engine.executeRaw(`DELETE FROM config WHERE key LIKE 'search.%'`);+ configureGateway({ env: { VOYAGE_API_KEY: 'pa-test-zerokey' } });+});++afterEach(() => {+ __setRerankTransportForTests(null);+ resetGateway();+});++const candidates: SearchResult[] = Array.from({ length: 60 }, (_, i) => ({+ slug: `notes/n${i}`, title: `n${i}`, score: 1 - i / 100, chunk_text: `chunk ${i}`,+ type: 'note', source_id: 'default', chunk_index: 0, chunk_id: i + 1,+}) as unknown as SearchResult);++async function wireRequest(): Promise<{ model: string; documents: number }> {+ const knobs = resolveSearchMode(await loadSearchModeConfig(engine));+ let body: { model: string; documents: string[] } | null = null;+ __setRerankTransportForTests(async (_url, init) => {+ body = JSON.parse(init.body as string);+ return new Response(JSON.stringify({ results: [{ index: 0, relevance_score: 1 }] }), {+ status: 200, headers: { 'content-type': 'application/json' },+ });+ });+ await applyReranker('q', candidates, {+ enabled: knobs.reranker_enabled,+ topNIn: knobs.reranker_top_n_in,+ topNOut: knobs.reranker_top_n_out,+ model: knobs.reranker_model,+ });+ expect(body).not.toBeNull();+ return { model: body!.model, documents: body!.documents.length };+}++describe('reranker default vs an explicit search.reranker.model', () => {+ test('the shipped default is voyage:rerank-3-lite', () => {+ expect(DEFAULT_RERANKER_MODEL).toBe('voyage:rerank-3-lite');+ });++ test('a tokenmax brain that never set search.reranker.model sends rerank-3-lite, 50 candidates', async () => {+ await engine.setConfig('search.mode', 'tokenmax');+ expect(await wireRequest()).toEqual({ model: 'rerank-3-lite', documents: 50 });+ });++ test('a brain with no search config at all (balanced fallback) sends rerank-3-lite', async () => {+ expect((await wireRequest()).model).toBe('rerank-3-lite');+ });++ test('a brain that set search.reranker.model voyage:rerank-2.5 keeps rerank-2.5', async () => {+ await engine.setConfig('search.mode', 'tokenmax');+ await engine.setConfig('search.reranker.model', 'voyage:rerank-2.5');+ expect(await wireRequest()).toEqual({ model: 'rerank-2.5', documents: 50 });+ });++ test('any other explicit model is kept too', async () => {+ await engine.setConfig('search.mode', 'balanced');+ await engine.setConfig('search.reranker.model', 'voyage:rerank-3');+ expect((await wireRequest()).model).toBe('rerank-3');+ });+});diff --git a/test/reranker-default-seam.test.ts b/test/reranker-default-seam.test.tsindex 98b31e7559..59d8a5cc9a 100644--- a/test/reranker-default-seam.test.ts+++ b/test/reranker-default-seam.test.ts@@ -16,7 +16,7 @@ describe('DEFAULT_RERANKER_MODEL seam (#3657, flipped v0.48.2)', () => {test('the default IS the recommended new-install reranker (voyage)', () => {expect(DEFAULT_RERANKER_MODEL).toBe(NEW_INSTALL_DEFAULT_RERANKER_MODEL);- expect(DEFAULT_RERANKER_MODEL).toBe('voyage:rerank-2.5');+ expect(DEFAULT_RERANKER_MODEL).toBe('voyage:rerank-3-lite');});test('gateway imports DEFAULT_RERANKER_MODEL from defaults.ts — no local alias, no literal', () => {diff --git a/test/search/knobs-hash-reranker.test.ts b/test/search/knobs-hash-reranker.test.tsindex 50cc6a3af7..a923ff5392 100644--- a/test/search/knobs-hash-reranker.test.ts+++ b/test/search/knobs-hash-reranker.test.ts@@ -285,7 +285,7 @@ describe('v=12 hard-exclude participation (#2825)', () => {describe('v0.48.2 reranker default flip re-keys the cache (rrm= is folded unconditionally)', () => {test('per mode: hash(DEFAULT voyage) !== hash(synthetic model) even with the reranker OFF', () => {- expect(DEFAULT_RERANKER_MODEL).toBe('voyage:rerank-2.5');+ expect(DEFAULT_RERANKER_MODEL).toBe('voyage:rerank-3-lite');for (const mode of ['conservative', 'balanced', 'tokenmax'] as const) {const base = { ...baseKnobs(), reranker_enabled: MODE_BUNDLES[mode].reranker_enabled };const withDefault = knobsHash({ ...base, reranker_model: DEFAULT_RERANKER_MODEL });