---
id: 12165
title: Use canonical dummyEmbeddingFunction in defrag; drop github-workflow copy
state: CLOSED
labels:
  - enhancement
  - ai
  - refactoring
assignees:
  - neo-opus-ada
createdAt: '2026-05-29T10:15:43Z'
updatedAt: '2026-05-29T11:32:33Z'
githubUrl: 'https://github.com/neomjs/neo/issues/12165'
author: neo-opus-ada
commentsCount: 1
parentIssue: 12101
subIssues: []
subIssuesCompleted: 0
subIssuesTotal: 0
blockedBy: []
blocking: []
closedAt: '2026-05-29T11:32:33Z'
---
# Use canonical dummyEmbeddingFunction in defrag; drop github-workflow copy

## Context

After PR #12164 (Epic #12101 Stage 1) merged and the orchestrator was rebooted (2026-05-29), operator review surfaced that the ChromaDB "dummy embedding function" — used to bypass server-side embedding generation when Neo provides embeddings directly — is defined in **multiple divergent places** instead of a single Tier-1 source. The unified Chroma topology (Memory Core + Knowledge Base share one instance) makes the EF realm-wide: it belongs once at Tier-1.

## The Problem

Four divergent / misplaced definitions of the same dummy EF:

1. **Tier-1** `ai/config.template.mjs:612` — `dummyEmbeddingFunction` (`name: 'dummy_embedding_function'`, verbose anti-legacy structure: `name` / `getConfig` / `constructor.buildFromConfig`).
2. **Knowledge Base** `ai/mcp/server/knowledge-base/config.template.mjs:114` — re-declares its own copy.
3. **defrag** `ai/scripts/maintenance/defragChromaDB.mjs:378-383` — hardcodes a *third* variant with `name: 'dummy'`. That literal `'dummy'` is what chromadb 3.x maps to the (non-existent) `@chroma-core/dummy` package, producing the `Collection schema deserialization … @chroma-core/dummy is not installed` warning seen during `chroma defrag (knowledge-base)`.
4. **GitHub Workflow** `ai/mcp/server/github-workflow/config.template.mjs:84` — includes `dummyEmbeddingFunction` but **never imports chromadb** (V-B-A 2026-05-29: `grep -c chromadb` = 0). Dead config.

## The Architectural Reality

- Unified Chroma (#11111 chroma-client primitives) — MC + KB share one Chroma instance; the dummy EF is a realm-wide constant, not a per-server concern.
- The canonical Tier-1 EF round-trips intact through the new reactive config (verified 2026-05-29: `name`, `generate`, `getConfig`, and the special own `constructor.buildFromConfig` all survive as callable functions).
- KB's `ChromaManager` reads `aiConfig.dummyEmbeddingFunction`; the defrag ignores config and hardcodes its own.

## The Fix

1. Keep the single canonical `dummyEmbeddingFunction` leaf in **Tier-1** `ai/config.template.mjs` (+ regenerated `config.mjs`).
2. **KB**: remove the duplicate definition; reference Tier-1's (`default: AiConfig.dummyEmbeddingFunction` snapshot now; becomes chain-inherited once the parent-chain realm-inheritance sub lands).
3. **defrag** `defragChromaDB.mjs`: import + use `AiConfig.dummyEmbeddingFunction` instead of the hardcoded `name: 'dummy'` object. The verbose canonical EF is expected to also clear the chromadb-3.x deserialization warning.
4. **GH-workflow**: delete `dummyEmbeddingFunction` (no chroma usage).

## Contract Ledger

| Target Surface | Source of Authority | Proposed Behavior | Fallback | Docs | Evidence |
|---|---|---|---|---|---|
| `AiConfig.dummyEmbeddingFunction` (Tier-1 config key) | `ai/config.template.mjs:612` | Single canonical definition; realm-wide | n/a (concrete default) | leaf JSDoc | Round-trip verified 2026-05-29 |
| KB `dummyEmbeddingFunction` | `knowledge-base/config.template.mjs:114` | Removed; references Tier-1 | inherits Tier-1 | — | Duplicate confirmed |
| defrag `dummyEf` | `defragChromaDB.mjs:378` | Removed; uses `AiConfig.dummyEmbeddingFunction` | — | — | Hardcoded `name:'dummy'` confirmed |
| GH-workflow `dummyEmbeddingFunction` | `github-workflow/config.template.mjs:84` | Removed (no chroma) | n/a | — | `grep -c chromadb` = 0 |

## Acceptance Criteria

- [ ] `dummyEmbeddingFunction` defined exactly once (Tier-1); no independent object-literal definitions in server configs.
- [ ] KB config references Tier-1's EF (no independent literal).
- [ ] `defragChromaDB.mjs` uses `AiConfig.dummyEmbeddingFunction`; no hardcoded `name: 'dummy'`.
- [ ] GH-workflow config no longer contains `dummyEmbeddingFunction`.
- [ ] Verify whether the canonical EF clears the chromadb-3.x defrag warning; if residual, defer to the defrag warning-suppression follow-up tracked on #12102.

## Out of Scope

- The Provider parent-chain wiring itself (the parent-chain realm-inheritance sub) — this ticket consolidates the *definition*; the chain makes KB *inherit* it rather than snapshot.
- chromadb-3.x warning *suppression* via `createSilentExecutor` in the defrag (tracked on #12102) — only relevant if the canonical EF doesn't already clear it.

## Related

- Epic #12101; PR #12164 (merged Stage 1); #11111 (Chroma-client primitives — adjacent; #11111 deliberately did NOT share `ensureDummyEmbedding` at the wrapper layer, so this config-level SSOT is a distinct concern).

Origin Session ID: b124b83a-2cca-4a2b-a711-64868439ba1e
Retrieval Hint: "dummyEmbeddingFunction single source of truth Tier-1 defrag chromadb"

## Timeline

- 2026-05-29T10:15:45Z @neo-opus-ada added the `enhancement` label
- 2026-05-29T10:15:45Z @neo-opus-ada added the `ai` label
- 2026-05-29T10:15:45Z @neo-opus-ada added the `refactoring` label
- 2026-05-29T10:17:05Z @neo-opus-ada added parent issue #12101
- 2026-05-29T10:23:26Z @neo-opus-ada cross-referenced by #12168
- 2026-05-29T10:43:45Z @neo-opus-ada assigned to @neo-opus-ada
- 2026-05-29T10:55:15Z @neo-opus-ada cross-referenced by PR #12169
- 2026-05-29T11:11:15Z @neo-opus-ada referenced in commit `e1dbf00` - "refactor(ai): defer KB dummyEmbeddingFunction dedup to chain-inheritance #12166 (#12165)

Reverts the KB default:AiConfig.dummyEmbeddingFunction snapshot introduced in the prior commit. That is the child-provider-re-assigns-parent anti-pattern Epic #12101 exists to eliminate (KB already carries auth/backup/chroma default:AiConfig.x snapshots from #12164; ALL are removed in #12166 via chain-inheritance — KB omits the leaves + inherits via getParent() — not re-introduced here). #12165 keeps only the chain-INDEPENDENT parts: defrag consumer point-of-use read + github-workflow dead-config drop.

Co-authored-by: neo-opus-ada <neo-opus-ada@neomjs.com>"
- 2026-05-29T11:13:00Z @neo-opus-ada changed title from **dummyEmbeddingFunction: Tier-1 single source of truth** to **Use canonical dummyEmbeddingFunction in defrag; drop github-workflow copy**
### @neo-opus-ada - 2026-05-29T11:13:24Z

**Input from Claude Opus 4.8 (Claude Code 1M):**

> ❋ ## Scope correction (operator architectural review, 2026-05-29)
> 
> This ticket is **narrowed** to the two chain-independent dummy-EF cleanups, delivered by PR #12169:
> 1. `defragChromaDB.mjs` uses the canonical Tier-1 `AiConfig.dummyEmbeddingFunction` (a maintenance-script consumer read).
> 2. `github-workflow/config.template.mjs` drops its unused copy (no chroma).
> 
> **KB's `dummyEmbeddingFunction` consolidation is removed from this ticket → #12166.** Reason: doing it here required `dummyEmbeddingFunction: {default: AiConfig.dummyEmbeddingFunction}` — the **child-provider-re-assigns-parent anti-pattern** (`default: AiConfig.x`) that Epic #12101 exists to eliminate. KB already carries that pattern for `auth.*` / `backupPath` / `engines.chroma.*` (from #12164); **all** of them — `dummyEmbeddingFunction` included — are removed in **#12166** via chain-inheritance (KB *omits* the leaves and inherits via `getParent()`), never re-assigned via a snapshot.
> 
> The body's original "KB references Tier-1" prescription is **superseded** by this correction.

- 2026-05-29T11:32:33Z @tobiu referenced in commit `1d08070` - "refactor(ai): defrag uses canonical dummyEmbeddingFunction; drop github-workflow copy (#12165) (#12169)

* refactor(ai): consolidate dummyEmbeddingFunction to Tier-1 SSOT (#12165)

KB references Tier-1 AiConfig.dummyEmbeddingFunction; defragChromaDB uses it (was a hardcoded name:'dummy' that triggered the chromadb-3.x @chroma-core/dummy warning); github-workflow drops it (never imports chroma). Net -27 LOC.

Co-authored-by: neo-opus-ada <neo-opus-ada@neomjs.com>

* refactor(ai): defer KB dummyEmbeddingFunction dedup to chain-inheritance #12166 (#12165)

Reverts the KB default:AiConfig.dummyEmbeddingFunction snapshot introduced in the prior commit. That is the child-provider-re-assigns-parent anti-pattern Epic #12101 exists to eliminate (KB already carries auth/backup/chroma default:AiConfig.x snapshots from #12164; ALL are removed in #12166 via chain-inheritance — KB omits the leaves + inherits via getParent() — not re-introduced here). #12165 keeps only the chain-INDEPENDENT parts: defrag consumer point-of-use read + github-workflow dead-config drop.

Co-authored-by: neo-opus-ada <neo-opus-ada@neomjs.com>

---------

Co-authored-by: tobiu <tobiasuhlig78@gmail.com>"
- 2026-05-29T11:32:33Z @tobiu closed this issue

