Frontmatter
| title | refactor: Decompose DreamService into modular services (#10013) |
| author | tobiu |
| state | Merged |
| createdAt | Apr 15, 2026, 1:55 PM |
| updatedAt | Apr 15, 2026, 2:07 PM |
| closedAt | Apr 15, 2026, 2:07 PM |
| mergedAt | Apr 15, 2026, 2:07 PM |
| branches | dev ← agent/10013-dream-service-decomposition |
| url | https://github.com/neomjs/neo/pull/10027 |
Merged

tobiu
commented on Apr 15, 2026, 1:58 PM
Input from Gemini 3.1 Pro (Antigravity):
✦ # PR Review Summary
Status: Approved
Excellent work decoupling the monolithic
DreamService! The transition from a 1,400-line class down to specialized, encapsulatedNeo.core.Basecomponents (IssueIngestor,GoldenPathSynthesizer, etc.) establishes a much cleaner architectural runway for future enhancements. Bringing these inside the centralizedai/services.mjsSDK guarantees robust dependency and validation flow. Great execution.
📊 Evaluation Metrics
[ARCH_ALIGNMENT]: 95 - Strongly aligned. Migrates logic out of global daemon space into formalNeo.core.Basesub-services mapped behind the SDK.[CONTENT_COMPLETENESS]: 90 - "Fat Ticket" methodology executed successfully with proper structural breakdown logic. JSDoc remains intact across the new files.[EXECUTION_QUALITY]: 100 - Zero test regressions in the Playwright suite. Resolved all double-backtick string interpolation issues resulting from the refactor.[PRODUCTIVITY]: 100 - Successfully pruned ~830 lines fromDreamService, accomplishing the primary goal of the decomposition sprint.[IMPACT]: 85 - Significant framework architecture cleanup. Eliminates scaling bottlenecks for inner-loop daemons.[COMPLEXITY]: 75 - High mechanical complexity during split phase, but resulting output drastically lowers overall cognitive load for future readers.[EFFORT_PROFILE]: Heavy Lift - Involved substantial codebase dissection and fixing complex AST escaping issues to preserve deterministic behavior.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #10013
- Related Graph Nodes:
DreamService,IssueIngestor,GoldenPathSynthesizer,Native Edge Graph
🧠 Graph Ingestion Notes
[KB_GAP]: N/A[TOOLING_GAP]: N/A[RETROSPECTIVE]: Refactoring out major monolithic dependencies incrementally (from ~1,400 to ~570 lines) without blocking execution provides a mathematically stable checkpoint. Centralizing into an SDK (ai/services.mjs) is vastly superior to directly importing internal MCP classes (ai/mcp/server/...) because it maintains rigorous validation boundaries.
📋 Required Actions
To proceed with merging, please address the following:
- Provide follow-up system enhancement tickets structurally linked to this Epic to outline how the remaining 370 lines of
DreamServicecan be pruned into a pure ~200 line execution controller.Once that is verified, this is clear to merge!
Architectural Refactoring: DreamService Decomposition
Resolves #10013
Problem Statement: The
DreamService.mjshad grown into a monolithic ~1,400-line class, creating architectural debt, complex testing boundaries, and coupling across discrete service domains (e.g., node ingestion, AST parsing, markdown synthesis).Implemented Solution:
IssueIngestor.mjs,GoldenPathSynthesizer.mjs,GapInferenceEngine.mjs, andGraphMaintenanceService.mjsinto discrete, fully encapsulated modular classes inheriting fromNeo.core.Base.ai/services.mjsto natively exportMemory_StorageRouterandMemory_TextEmbeddingService. All inner-loop daemons and synthesized services have been migrated to target the single-point SDK wrapper instead of fragile relative MCP imports (../../services.mjs).DreamService.mjswas pruned down to ~570 lines, focusing heavily on execution flow delegation rather than raw implementation.Verification:
DreamService.spec.mjsandDreamServiceGoldenPath.spec.mjsexecute successfully with 100% test passage.Follow-Up Actionability: This PR establishes the primary foundation. The codebase size was successfully reduced by ~60%, paving the way for follow-up tickets to target the eventual ~200-line "Pure Controller" topology state.