# GATE 3 PRE-ANSWERED — DO NOT ASK AGAIN

Spec folder: `.opencode/specs/system-spec-kit/026-graph-and-context-optimization/014-local-embeddings-setup-a/022-local-llm-legacy-remediation`
Choice: A) Use existing spec folder
Reason: This IS the active remediation packet. Its plan.md authorizes the file edits below. All allowed-write-paths in the batch prompt are explicitly owned by this packet's scope.

PROCEED DIRECTLY. Never emit the A/B/C/D/E spec-folder question. Never bail on Gate 3. The packet question is permanently answered for this codex session.

Also: this run is non-interactive; --approval-policy=never is set. Do NOT ask the user any clarifying questions. If you genuinely cannot resolve a detail, fall back to the safest interpretation that matches the post-014 ship state (auto-cascade Voyage -> OpenAI -> llama-cpp -> hf-local).

---

# Batch 2 — Old model-name defaults purge (post-021 deep-review)

CANONICAL POST-014 DEFAULTS (treat as ground truth):
- Memory MCP (hf-local): `onnx-community/embeddinggemma-300m-ONNX`, dtype=q8, dims=768
- CocoIndex (sentence-transformers): `google/embeddinggemma-300m`, dtype=bf16, dims=768
- Voyage (when VOYAGE_API_KEY set): `voyage-4`, dims=1024 (current factory default)
- OpenAI (when OPENAI_API_KEY set): `text-embedding-3-small`, dims=1536 (current factory default)
- Cascade: Voyage -> OpenAI -> llama-cpp (when GGUF installed) -> hf-local

PER USER CLARIFICATION:
- Q2=yes: Voyage cascade-as-primary-when-key-set is INTENTIONAL. Don't remove Voyage cascade descriptions. Only remove unsupported marketing claims like "recommended (8% better than OpenAI)" and "best quality" in default-claim contexts.

ALLOWED WRITE PATHS (touch ONLY these files):
- `.opencode/skills/system-spec-kit/shared/embeddings.ts` (DEFAULT_MODEL_NAME constant, line ~868)
- `.opencode/skills/system-spec-kit/shared/README.md` (HF env default + provider tree comment)
- `.opencode/skills/system-spec-kit/mcp_server/ENV_REFERENCE.md` (line ~445 voyage-4 precedence wording + provider table)
- `.opencode/skills/system-spec-kit/references/memory/embedding_resilience.md` (1024-dim cache key + Voyage primary diagram)
- `.opencode/skills/system-spec-kit/README.md` (lines 146, 361, 691, 699, 720)
- `.opencode/skills/system-spec-kit/feature_catalog/19--feature-flag-reference/05-5-embedding-and-api.md`
- `.opencode/skills/system-spec-kit/references/config/environment_variables.md`
- `.opencode/skills/system-spec-kit/mcp_server/README.md` (lines 46, 52)
- `.opencode/skills/system-spec-kit/mcp_server/INSTALL_GUIDE.md` (lines 113, 116)
- `.opencode/skills/mcp-coco-index/README.md` (lines 76, 77, 160, 276)
- `.opencode/skills/mcp-coco-index/INSTALL_GUIDE.md` (lines 101, 437, 619, 620, 843, plus 354, 409, 429 NOTE templates)
- `.opencode/skills/mcp-coco-index/SKILL.md` (line 271 voyage-code-3 (primary))
- `.opencode/skills/mcp-coco-index/references/settings_reference.md` (lines 43, 47, 127)
- `.opencode/skills/mcp-coco-index/assets/config_templates.md` (lines 75, 140, 160)
- `.opencode/install_guides/README.md` (lines 489, 634, 643, 671, 675, 678, 1257, 1261, 1289, 1434, 1344)
- `.mcp.json` (line ~22 voyage 8% better note)
- `.codex/config.toml` (line ~25 voyage 8% better note — KEEP cascade line ~22 intact)
- `.claude/mcp.json` (line ~21 voyage 8% better note — KEEP cascade line ~18 intact)
- `.gemini/settings.json` (line ~38 voyage 8% better note — KEEP cascade line ~35 intact)
- `opencode.json` (line ~31 voyage 8% better note — KEEP cascade line ~28 intact)
- Root `README.md` (lines 139, 517, 828, 1257, 1261, 1289, 1434)

BANNED OPERATIONS (RM-8 Layer 1):
- NO rm, NO rm -rf, NO git rm, NO mv, NO sed -i, NO rmdir, NO find ... -delete
- NO git add, NO git commit, NO git push, NO branch changes
- NO writes to any file not in ALLOWED WRITE PATHS
- DO NOT TOUCH `factory.ts` provider resolution logic
- DO NOT TOUCH `voyage.ts` / `openai.ts` / `llama-cpp.ts` / `hf-local.ts` provider implementations
- DO NOT REMOVE Voyage from cascade descriptions (Q2=yes)
- DO NOT touch the 021-local-llm-legacy-review packet or 022-local-llm-legacy-remediation packet
- If you detect a need to mutate outside scope, RECORD it as "SCOPE_VIOLATION: <path>: <why>" instead of executing

YOUR TASK:
1. For each allowed file:
   a. Read it
   b. Find every occurrence of the SPECIFIC stale model-name defaults below and replace per the rules
   c. Preserve all other content unchanged

REPLACEMENT RULES:

(A) HF / Memory MCP model identifier residue:
   - `nomic-ai/nomic-embed-text-v1.5` -> `onnx-community/embeddinggemma-300m-ONNX`
   - Generic "Nomic" model recommendations -> "EmbeddingGemma 300m"
   - HF dimension `768` is correct — do not change
   - `DEFAULT_MODEL_NAME = 'nomic-ai/nomic-embed-text-v1.5'` in embeddings.ts:868 -> change to `'onnx-community/embeddinggemma-300m-ONNX'`

(B) CocoIndex model identifier residue:
   - `all-MiniLM-L6-v2` (sentence-transformers MiniLM) -> `google/embeddinggemma-300m`
   - "Default: all-MiniLM-L6-v2 (local, no API key needed)" -> "Default: google/embeddinggemma-300m (local sentence-transformers, no API key needed, 768d)"
   - MiniLM `384` dim references -> `768` dim
   - `sentence-transformers/all-MiniLM-L6-v2` -> `google/embeddinggemma-300m`

(C) Marketing / recommendation wording (only in defaults contexts):
   - Drop "(primary)" annotation from `voyage/voyage-code-3 (primary)` in CocoIndex SKILL.md
   - Drop "Recommended" / "recommended (8% better than OpenAI)" / "best quality" wording from notes that frame Voyage as default-recommended
   - In notes that purely describe the cascade order (Voyage -> OpenAI -> llama-cpp -> hf-local), KEEP the cascade — only strip subjective superlatives

(D) Provider precedence claims (must match factory.ts behavior):
   - `Voyage if VOYAGE_API_KEY exists (recommended)` -> `Voyage if VOYAGE_API_KEY is set (cascade priority 1)`
   - `Auto-detection: Voyage if VOYAGE_API_KEY` style -> `Auto-cascade: VOYAGE_API_KEY -> OPENAI_API_KEY -> llama-cpp (GGUF installed) -> hf-local`
   - In env var docs that list precedence, ensure llama-cpp appears between OPENAI and hf-local
   - The ENV_REFERENCE.md auto-cascade description: rewrite around the actual 4-tier cascade (Voyage, OpenAI, llama-cpp, hf-local)

(E) Embedding dimension residue:
   - References to `384` dim as a default or current value (in MiniLM contexts) -> `768`
   - Keep `1024` as Voyage's documented dim
   - Keep `1536` as OpenAI's documented dim
   - Keep `768` as the hf-local + CocoIndex EmbeddingGemma dim

(F) Voyage model version residue:
   - References to `voyage-3.5` as a current default -> `voyage-4` (the actual current factory default)
   - References to `voyage-3` as default -> `voyage-4`
   - Leave `voyage-3.5` / `voyage-3` mentioned in registry tables / historical context (just not as "current default")

PRESERVE (do NOT change):
- The cascade ORDERING (Voyage -> OpenAI -> llama-cpp -> hf-local) — that's correct
- Voyage and OpenAI as supported cloud providers
- `EMBEDDINGS_PROVIDER=auto` as the canonical default selection mechanism
- Any test fixture content (batch 5 territory)
- Any 014/021 packet content
- Any 022 packet content (this packet)

AFTER ALL EDITS, output:

```
BATCH 2 REPORT
File: <path> — <N edits> — <one-line summary>
...
Scope violations: <none | list>
Total edits: <N>
```

Do NOT commit. Do NOT run git. Stop after writing the report.
