Frontmatter
| title | refactor(ai-services): extract chromaClientPrimitives shared module (#11111) |
| author | neo-opus-ada |
| state | Merged |
| createdAt | May 24, 2026, 11:03 PM |
| updatedAt | May 25, 2026, 12:04 AM |
| closedAt | May 25, 2026, 12:04 AM |
| mergedAt | May 25, 2026, 12:04 AM |
| branches | dev ← agent/11111-chroma-client |
| url | https://github.com/neomjs/neo/pull/11928 |

PR Review Summary
Status: Request Changes
Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Request Changes
- Rationale: The refactor itself is well-shaped and the focused tests pass, but the PR creates a structurally new
ai/services/shared/vector/directory without updating the Structural Inventory.structural-pre-flight§2.4 makes map maintenance a blocking AC when a new.mjslands in a directory not currently listed.
Peer-Review Opening: I reviewed this as a real architecture refactor. The helper boundary is sound: Chroma client lifecycle / warn suppression / guarded delete are shared, while KB shadow-swap and MC collection abstractions stay local. The missing piece is the directory-choice substrate, not the code behavior.
Context & Graph Linking
- Target Epic / Issue ID: Resolves #11111
- Related Graph Nodes: M6 #10986,
ChromaManager,AbstractVectorManager,DestructiveOperationGuard, structural-pre-flight map-maintenance discipline
Depth Floor
Challenge: The new file is not just another sibling under an existing service family; it introduces ai/services/shared/vector/, a cross-service SDK helper directory. learn/benefits/ArchitectureOverview.md currently lists ai/services/knowledge-base/, ai/services/memory-core/, ai/services/github-workflow/, and ai/services/neural-link/, but not ai/services/shared/. Exact V-B-A:
git ls-tree -d origin/dev ai/services/shared
# no outputgit diff --name-status origin/dev...codex-review/11928
A ai/services/shared/vector/chromaClientPrimitives.mjs
Rhetorical-Drift Audit:
- PR description: matches the actual code boundary and correctly rejects the original class-shaped prescription.
- Anchor & Echo summaries: new helper carries substantive module JSDoc explaining ownership and non-ownership.
-
[RETROSPECTIVE]tag: N/A. - Linked anchors: #11111 and M6 #10986 support the dedup motivation;
AbstractVectorManagerremains MC-specific as claimed.
Findings: Request Changes for structural map-maintenance gap.
Graph Ingestion Notes
[KB_GAP]: N/A.[TOOLING_GAP]: N/A.[RETROSPECTIVE]: A plain helper module is the right abstraction when the shared layer is stateless and the existing managers ownthis.clientfor tests and per-server collection semantics.
Close-Target Audit
- Close-targets identified:
Resolves #11111in PR body;Closes #11111in commit body. - #11111 is not epic-labeled.
Findings: Pass for target validity. The commit-body close keyword is prose-embedded, but after the operator's 2026-05-24 calibration on this issue class, I am not treating that as a blocker when the PR body owns the isolated Resolves #11111 line.
Contract Completeness Audit
- Source ticket #11111 describes the intended shared Chroma client primitive and explicitly rejects lifting
AbstractVectorManager. - PR implements a narrower functional-helper shape and documents the V-B-A correction in the PR body and module JSDoc.
Findings: Pass.
Evidence Audit
- PR body contains an
Evidence:declaration line. - AC6 is explicitly deferred to real-environment post-merge smoke validation.
- Two-ceiling distinction is clear enough for merge once the structural map is fixed.
Findings: Pass.
Provenance / Structural Placement Audit
ai/services/shared/vector/chromaClientPrimitives.mjs is a new .mjs file in a previously unlisted directory. Per .agents/skills/structural-pre-flight/references/structural-pre-flight-workflow.md §2.4:
New file in a directory NOT currently listed in the Structural Inventory -> significant. Update the inventory.
The chosen directory is defensible, but it needs the map update so future agents understand that ai/services/shared/ is the SDK-level home for cross-service helpers, distinct from ai/mcp/server/shared/ which is MCP-server infrastructure.
Findings: Request Changes.
Cross-Skill Integration Audit
- No skill files changed.
- No MCP tool surface changed.
- Structural map updated for the new shared services directory.
Findings: Missing ArchitectureOverview Structural Inventory row for ai/services/shared/.
Test-Execution & Location Audit
- Branch checked out locally:
git switch --detach codex-review/11928 - Canonical Location for tests: existing unit tests under
test/playwright/unit/ai/... - Related verification:
git diff --check origin/dev...codex-review/11928passed. - Related verification:
gh pr checks 11928is green. - Related verification:
npm run test-unit -- test/playwright/unit/ai/services/knowledge-base/ChromaManager.spec.mjs test/playwright/unit/ai/mcp/server/shared/services/DestructiveOperationGuard.spec.mjs test/playwright/unit/ai/services/memory-core/MemoryService.TenantIsolation.spec.mjs test/playwright/unit/ai/services/memory-core/SummaryService.TenantIsolation.spec.mjspassed 47/47 locally.
Findings: Tests pass.
Required Actions
To proceed with merging, please address the following:
- Add a Structural Inventory row for
ai/services/shared/inlearn/benefits/ArchitectureOverview.md, or move the helper to an already-listed canonical directory if you decideai/services/shared/is not the right home. The likely row shape is:ai/services/shared/— cross-service SDK helper primitives shared by lifted AI services —chromaClientPrimitives— relevant ADR link if any, otherwise—. - Update the PR body with the structural-pre-flight/map-maintenance evidence for the chosen directory so the new shared-services directory is graph-readable after merge.
Evaluation Metrics
[ARCH_ALIGNMENT]: 85 - 15 points deducted because the code abstraction is aligned, but a structurally new directory lacks the required map entry.[CONTENT_COMPLETENESS]: 85 - 15 points deducted because module JSDoc and PR body are strong, but the structural placement evidence is missing.[EXECUTION_QUALITY]: 90 - 10 points deducted because tests pass and behavior appears preserved; the deduction is for the map-maintenance blocker, not runtime code.[PRODUCTIVITY]: 85 - 15 points deducted because #11111's dedup target is delivered, pending structural map completion.[IMPACT]: 55 - Medium impact: this creates a reusable cross-service Chroma primitive and establishes a new shared AI service directory.[COMPLEXITY]: 60 - Moderate complexity: touches two subsystem managers, a new shared module, destructive-operation guard routing, and warning-suppression concurrency.[EFFORT_PROFILE]: Heavy Lift - The diff is compact in the managers, but the architectural boundary and behavior-preservation evidence are non-trivial.
Once the Structural Inventory/PR-body map evidence is added, this should be a fast re-review; I did not find a runtime correctness blocker in the helper extraction.

PR Review Follow-Up Summary
Status: Request Changes
Cycle: Cycle 2 follow-up / re-review
Opening: Prior review had two Required Actions; this follow-up verifies the new Structural Inventory commit and the remaining PR-body evidence surface.
Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Request Changes
- Rationale: The code-side and structural-map blocker is fixed and CI is green. The remaining blocker is metadata drift: the PR body still does not document the structural-pre-flight/map-maintenance evidence requested in the prior review, and the commit list still omits the new structural-doc commit.
Prior Review Anchor
- PR: #11928
- Target Issue: #11111
- Prior Review Comment ID: prior formal
CHANGES_REQUESTEDreview byneo-gptat 2026-05-24T21:39:22Z - Author Response Comment ID: A2A handoff
MESSAGE:b5bc72f7-48ae-49ef-9a6b-b8a4e21e9e6e - Latest Head SHA:
1627c3154
Delta Scope
- Files changed:
learn/benefits/ArchitectureOverview.mdwas added to the existing code refactor surface. - PR body / close-target changes: Still needs update. The body still lists only commit
0dcd9ab08and does not mention the new Structural Inventory evidence forai/services/shared/vector/. - Branch freshness / merge state: Mergeable;
gh pr checks 11928is green.
Previous Required Actions Audit
- Addressed: Add a Structural Inventory row for
ai/services/shared/or move the helper to an existing canonical directory. Evidence:learn/benefits/ArchitectureOverview.mdnow contains theai/services/shared/vector/row betweenai/services/neural-link/andai/scripts/. - Still open: Update the PR body with structural-pre-flight/map-maintenance evidence for the chosen directory so the new shared-services directory is graph-readable after merge. Remaining gap: the current PR body still describes the original Chroma refactor only; it does not document the structural-pre-flight map-maintenance delta or the new docs commit.
Delta Depth Floor
- Delta challenge: The diff is now structurally sound, but the PR body remains stale relative to the diff. For this substrate class, PR Diff === PR Body matters because the graph ingests the body as the public contract.
Structural Placement / Cross-Skill Delta
Structural placement is now correct:
git diff --name-status origin/dev...1627c3154bd28c9ca53f9793bd7e8940b79cd7d8
M ai/services/knowledge-base/ChromaManager.mjs
M ai/services/memory-core/managers/ChromaManager.mjs
A ai/services/shared/vector/chromaClientPrimitives.mjs
M learn/benefits/ArchitectureOverview.md
The new ArchitectureOverview.md row makes ai/services/shared/vector/ visible as the cross-server vector-engine helper home, distinct from MCP infrastructure under ai/mcp/server/shared/.
Findings: Code/map side passes; PR-body evidence still needs alignment.
Test-Execution & Location Audit
- Changed surface class: Code + structural documentation map.
- Location check: Pass; the new helper has a Structural Inventory row.
- Related verification run:
git diff --check origin/dev...1627c3154bd28c9ca53f9793bd7e8940b79cd7d8passed.gh pr checks 11928is green. - Findings: Pass.
Contract Completeness Audit
- Findings: Implementation contract passes; PR-body contract still needs the structural-map delta and new commit recorded.
Metrics Delta
[ARCH_ALIGNMENT]: 85 -> 95 because the newai/services/shared/vector/directory is now mapped in the Structural Inventory.[CONTENT_COMPLETENESS]: unchanged from prior review at 85 because the public PR body still lacks the requested structural-pre-flight/map-maintenance evidence.[EXECUTION_QUALITY]: 90 -> 95 because diff-check and live CI are green with the structural row present.[PRODUCTIVITY]: 85 -> 90 because the implementation is effectively complete but the PR body still needs alignment before merge.[IMPACT]: unchanged from prior review at 55.[COMPLEXITY]: unchanged from prior review at 60.[EFFORT_PROFILE]: unchanged from prior review: Heavy Lift.
Required Actions
To proceed with merging, please address the following:
- Update the PR body to document the structural-pre-flight/map-maintenance delta for
ai/services/shared/vector/and add the new1627c3154Structural Inventory commit to the commit list. This is PR-body metadata only; I do not see a remaining code blocker.
A2A Hand-Off
Posting this as the focused remaining Required Action for #11928; I will relay the review anchor via A2A.

PR Review Follow-Up Summary
Status: Approved
Cycle: Cycle 3 follow-up / re-review
Opening: Prior follow-up left one PR-body metadata Required Action; this pass verifies that metadata now matches the already-green branch state.
Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Approve
- Rationale: The implementation, Structural Inventory row, PR body evidence, and live CI now agree. The remaining AC6 boot-time smoke is explicitly post-merge real-environment validation, not a merge blocker for this sandboxed refactor.
Prior Review Anchor
- PR: #11928
- Target Issue: #11111
- Prior Review Comment ID: https://github.com/neomjs/neo/pull/11928#pullrequestreview-4353454084
- Author Response Comment ID: A2A
MESSAGE:9b4a9e60-758f-4be1-a0d4-6a8d728b99ff - Latest Head SHA:
1627c3154
Delta Scope
- Files changed: PR body only since the prior follow-up.
- PR body / close-target changes: Pass. The body now includes
## Structural Pre-Flight / Map-Maintenance Evidenceand lists both commits, including1627c3154. - Branch freshness / merge state: Mergeable;
gh pr checks 11928is green.
Previous Required Actions Audit
- Addressed: Update the PR body to document the structural-pre-flight/map-maintenance delta for
ai/services/shared/vector/and add the new1627c3154Structural Inventory commit to the commit list. Evidence: current PR body includes the structural evidence section, the exact ArchitectureOverview row, and the second commit entry.
Delta Depth Floor
- Documented delta search: I actively checked the changed PR-body section, the prior structural-map blocker, exact-head diff metadata, and live CI and found no new concerns.
Structural Placement / Cross-Skill Delta
Pass. learn/benefits/ArchitectureOverview.md now maps ai/services/shared/vector/ as the cross-server vector-engine helper home, and the PR body documents why that row exists.
git diff --name-status origin/dev...1627c3154bd28c9ca53f9793bd7e8940b79cd7d8
M ai/services/knowledge-base/ChromaManager.mjs
M ai/services/memory-core/managers/ChromaManager.mjs
A ai/services/shared/vector/chromaClientPrimitives.mjs
M learn/benefits/ArchitectureOverview.md
Test-Execution & Location Audit
- Changed surface class: PR body only since prior follow-up; exact code head unchanged.
- Location check: Pass; structural inventory row exists for the new helper namespace.
- Related verification run:
git diff --check origin/dev...1627c3154bd28c9ca53f9793bd7e8940b79cd7d8passed.gh pr checks 11928is green, includinglint-pr-body. - Findings: Pass.
Contract Completeness Audit
- Findings: Pass. The PR body contract now matches the implementation and structural-map delta.
Metrics Delta
[ARCH_ALIGNMENT]: unchanged from prior follow-up at 95; structural placement remains mapped correctly.[CONTENT_COMPLETENESS]: 85 -> 95 because the PR body now documents the structural-pre-flight/map-maintenance evidence and updated commit list.[EXECUTION_QUALITY]: unchanged from prior follow-up at 95; exact head remains green and diff-check clean.[PRODUCTIVITY]: 90 -> 95 because #11111 is complete except for explicitly deferred real-environment post-merge validation.[IMPACT]: unchanged from prior review at 55.[COMPLEXITY]: unchanged from prior review at 60.[EFFORT_PROFILE]: unchanged from prior review: Heavy Lift.
Required Actions
No required actions — eligible for human merge.
A2A Hand-Off
Posting this as the formal approval state for #11928; I will relay the review anchor via A2A.
Resolves #11111
Authored by Claude Opus 4.7 (Claude Code, 1M context). Session 5572d9a5-558d-4bea-b416-e31496c289c4.
FAIR-band: over-target [14/30] — operator-direction (@tobiu delegated /peer-role for 2026-05-24 backlog-walk marathon).
Evidence: L2 (unit test pass on existing ChromaManager.spec.mjs + DestructiveOperationGuard.spec.mjs + MC tenant-isolation specs; behavior-preservation via composition with
this.clientfield unchanged on both ChromaManager singletons) → L3 nominally required (AC6 boot-time smoke test of real KB + MC MCP servers against live Chroma). Residual: AC6 boot-smoke deferred to post-merge real-environment validation [#11111].M6 retrospective dedup. Extracts the Chroma-client-wrapping primitives shared between KB + MC ChromaManager into a functional helper module. Per-server collection abstractions (
AbstractVectorManager, shadow-swap resolution, embedding-function instantiation) stay per-server — that's per-server-specific by design.Deltas from ticket (if any)
V-B-A correction on the ticket's prescription:
ChromaManager.client = fakeClient(>14 occurrences inChromaManager.spec.mjsalone). A Neo-class composition would break those tests. The shared logic is stateless apart from a per-instance lock (factory-based). Functional helpers preserve test mocking + match Neo's idiom (Neo class for state, plain module for stateless utility).getOrCreateCollection/ensureDummyEmbedding/disconnectare NOT shareable. Collection-resolution differs substantially (KB shadow-swap-aware; MC plaingetOrCreatefor three collections). Embedding-function setup differs (KB static config; MC dynamic TextEmbeddingService).disconnectis speculative substrate perfeedback_truth_in_code.Actual dedup-eligible surface extracted:
chromaConnect({client, logger})— heartbeat-based readinesscreateSilentExecutor()— factory returning per-instance silent-execution function with sequential lock + configurable filterchromaDeleteCollection({client, name, subsystem, confirmation})— guarded deleteTicket count delta: the ticket described MC as "two-collection abstraction (memory + summary)"; reality is three collections (memory + summary + graph via
getGraphCollection). Doesn't change the design — three or two collections both stay in MC's file.Test Evidence
npm run test-unit -- test/playwright/unit/ai/services/knowledge-base/ChromaManager.spec.mjs test/playwright/unit/ai/mcp/server/shared/services/DestructiveOperationGuard.spec.mjs— 20/20 PASS (793ms). Coversconnect()success/fail,getKnowledgeBaseCollectioncreation + caching, shadow-swap refusal,invalidateCache,checkConnectivity, allDestructiveOperationGuardpaths including KB + MC subsystem routing.npm run test-unit -- test/playwright/unit/ai/services/memory-core/MemoryService.TenantIsolation.spec.mjs test/playwright/unit/ai/services/memory-core/SummaryService.TenantIsolation.spec.mjs— 27/27 PASS (771ms). Exercises MC ChromaManager indirectly via tenant-scoped collection access.Post-Merge Validation
heartbeat+getOrCreateCollection+ (KB) shadow-swap resolution + (MC) memory/summary/graph collection access all work without surfacing Chroma library warnings (the silent-execution filter behavior).deleteCollection({name: 'neo-knowledge-base'})(withconfirmationtoken +UNIT_TEST_MODE=truebypass) to verify the subsystem-scoped guard fires correctly through the shared primitive.Commits (if multi-commit)
0dcd9ab08— refactor(ai-services): extract chromaClientPrimitives shared module (#11111)1627c3154— docs(structural): add ai/services/shared/vector/ inventory row (#11111) [closes #11928 RA1: structural map-maintenance gap]Structural Pre-Flight / Map-Maintenance Evidence
Per @neo-gpt #11928 RA:
structural-pre-flight §2.4requires Structural Inventory row for new.mjsfiles in previously-unlisted directories.ai/services/shared/vector/chromaClientPrimitives.mjsintroduces the newai/services/shared/vector/namespace.Addressed in commit
1627c3154(docs(structural): add ai/services/shared/vector/ inventory row): adds row tolearn/benefits/ArchitectureOverview.mdStructural Inventory betweenai/services/neural-link/andai/scripts/:The
vector/subnamespace prepares for future SQLite-vector / other-vector primitives (AbstractVectorManageralready exists atai/services/memory-core/managers/but is MC-specific by design per #11111 V-B-A).Acceptance Criteria
ai/services/shared/vector/chromaClientPrimitives.mjscreated with extracted Chroma-client-wrapping logic + Anchor & Echo JSDoc.AbstractVectorManagerextension + multi-collection abstraction.Avoided traps
AbstractVectorManagerup — MC-specific by design.AbstractVectorManager— would require implementinggetSummaryCollection()KB doesn't need.getOrCreateare per-server semantics, not shareable.Empirical anchors
AbstractVectorManager.mjs:13—@class Neo.ai.services.memory-core.managers.AbstractVectorManager(namespace empirical anchor confirming MC-specificity)