---
number: 9882
title: >-
  fix(ai): Implement targeted daemon auto-start specific environment variables
  (#9881)
author: tobiu
state: MERGED
createdAt: '2026-04-11T10:24:15Z'
updatedAt: '2026-04-11T10:32:51Z'
closedAt: '2026-04-11T10:32:50Z'
mergedAt: '2026-04-11T10:32:50Z'
head: agent/9881-disable-daemon-autostart
base: dev
url: 'https://github.com/neomjs/neo/pull/9882'
---
Resolves #9881

## Context & Execution Summary
This Pull Request resolves the build pipeline error `Error: spawn chroma ENOENT` seen during CI data-sync runs. 

The original failure occurred because `ai/services.mjs` was inadvertently triggering the `initAsync` lifecycle on MCP lifecycle managers when the SDK was required by the `labels.mjs` build script, trying to unconditionally spawn the `chroma` and inference binaries in headless CLI environments.

## Architecture Alignment & Changes
- **Targeted Daemon Configurations**: Introduced completely scoped, targeted environment variables to override auto-start mechanics:
  - `NEO_KB_AUTO_START_DATABASE` (Knowledge Base)
  - `NEO_MEM_AUTO_START_DATABASE` (Memory Core)
  - `NEO_MEM_AUTO_START_INFERENCE` (Memory Core)
- **Lifecycle Pre-Flight**: Updated `DatabaseLifecycleService`, `ChromaLifecycleService`, and `InferenceLifecycleService` to gate binary execution behind these configurable flags.
- **SDK Overrides**: Explicitly clamped these flags to `false` in `ai/services.mjs`, ensuring SDK importers stay 100% headless unless explicitly overwritten.

## Definition of Done
- Validation Confirmed: `node ./buildScripts/docs/index/labels.mjs` executes natively without ENOENT daemon errors.


## Comments

### `@tobiu` commented on 2026-04-11T10:31:54Z

**Input from Antigravity (Gemini 3.1 Pro):**

> ✦ # PR Review Summary
> 
> **Status:** Approved
> 
> The targeted daemon flags correctly isolate lifecycle commands. The build script was verified to run headlessly without ENOENT.
> 
> ---
> 
> ### 📊 Evaluation Metrics
> *   **`[ARCH_ALIGNMENT]`**: 100 - Perfectly aligns with the `process.env` override mechanic without hard-coding dependency requirements across the swarm servers.
> *   **`[CONTENT_COMPLETENESS]`**: 100 - Fat Ticket PR description provides full context. Config files mirror template variables cleanly.
> *   **`[EXECUTION_QUALITY]`**: 90 - Build scripts no longer attempt to spawn `chroma` dynamically based on SDK service logic.
> *   **`[PRODUCTIVITY]`**: 100 - Successfully prevents daemon spawning on generic Github Action runners.
> *   **`[IMPACT]`**: 70 - Highly important for unblocking CI/CD deployment pipelines, though structurally straightforward.
> *   **`[COMPLEXITY]`**: 10 - Isolated mapping changes to configuration constants and specific `if` gates.
> *   **`[EFFORT_PROFILE]`**: Quick Win - High ROI for pipeline stability.
> 
> ---
> 
> ### 🕸️ Context & Graph Linking
> *   **Target Epic / Issue ID:** Resolves #9881
> *   **Related Graph Nodes:** Pipeline, Daemon Lifecycles, GitHub Actions.
> 
> ---
> 
> ### 🧠 Graph Ingestion Notes
> 
> *   **`[KB_GAP]`**: None observed.
> *   **`[TOOLING_GAP]`**: N/A
> *   **`[RETROSPECTIVE]`**: Excellent architectural hygiene ensuring SDK components strictly behave "headlessly" by default unless explicitly configured otherwise via environment flags. This prevents CLI scripts from incurring the weight of local binaries.
> 
> ---
> 
> ### 📋 Required Actions
> 
> To proceed with merging, please address the following:
> 
> - [x] Proceed with Squash Merge.
> 
> This PR is approved.

---

