LearnNewsExamplesServices
Frontmatter
id10032
titleConceptService & Source Code Wiring
stateClosed
labels
enhancementaiarchitecture
assigneestobiu
createdAtApr 15, 2026, 11:56 PM
updatedAtApr 17, 2026, 3:14 PM
githubUrlhttps://github.com/neomjs/neo/issues/10032
authortobiu
commentsCount1
parentIssue10030
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[x] 10031 JSONL Schema & Concept Seed Extraction
blocking[x] 10037 ChromaDB Concept Embedding & Hybrid Search, [x] 10033 Concept Graph Unit Tests
closedAtApr 17, 2026, 3:14 PM

ConceptService & Source Code Wiring

Closed v13.0.0/archive-v13-0-0-chunk-4 enhancementaiarchitecture
tobiu
tobiu commented on Apr 15, 2026, 11:56 PM

Objective

Build the ConceptService that loads the JSONL concept graph and provides query APIs. Wire concepts to source files via IMPLEMENTED_BY and EXPLAINED_BY edges.

Context

Phase 1, Step 2 of the Concept Ontology epic (#10030). Depends on the JSONL schema from #10031.

Deliverables

1. ConceptService Class

Location: ai/graph/ConceptService.mjs

Core APIs:

  • loadGraph(nodesPath, edgesPath) — Parse JSONL, build in-memory graph
  • getConceptTree(maxTier) — Hierarchical tree serialization
  • getConceptCoverage(conceptId) — Returns EXPLAINED_BY, IMPLEMENTED_BY, EXEMPLIFIED_BY edges
  • findGuideGaps(minWeight) — Concepts missing EXPLAINED_BY edges, sorted by weight
  • classifyConcept(classPath) — Which concept(s) does this class implement?
  • serializeForLLM(maxTier) — Compact tree format for agent context priming

2. Source Code Wiring

Script or service method that:

  1. Walks src/**/*.mjs, extracts @class and @extends from JSDoc headers
  2. Heuristic matching to existing concepts by package structure:
    • src/data/* → "Data Layer" concept
    • src/state/* → "State Provider" concept
    • src/worker/* → "Worker Architecture" concept
  3. Creates IMPLEMENTED_BY edges in edges.jsonl
  4. Reports UNCATEGORIZED classes for review

3. Guide Wiring

Map learn/tree.json entries to the concept graph via EXPLAINED_BY edges.

4. SDK Registration

Export ConceptService from ai/services.mjs.

Weight Calculation

weight = tier_score + uniqueness_score + coverage_deficit
  • Tier score: 0.8 (tier 1), 0.5 (tier 2), 0.3 (tier 3)
  • Uniqueness: +0.2 if concept is unique to Neo.mjs
  • Coverage deficit: +0.3 if no EXPLAINED_BY edges

Acceptance Criteria

  • ConceptService loads JSONL and provides all query APIs
  • IMPLEMENTED_BY edges exist for major src/ classes
  • EXPLAINED_BY edges exist for all learn/guides/ entries
  • serializeForLLM() produces a compact tree under 100 lines
  • Registered in ai/services.mjs

Origin Session ID: 496c0120-29aa-4b02-a804-d5a32ff6b5eb

tobiu added the enhancement label on Apr 15, 2026, 11:56 PM
tobiu added the ai label on Apr 15, 2026, 11:56 PM
tobiu added the architecture label on Apr 15, 2026, 11:56 PM
tobiu cross-referenced by #10033 on Apr 15, 2026, 11:57 PM
tobiu cross-referenced by #10034 on Apr 15, 2026, 11:57 PM
tobiu cross-referenced by #10035 on Apr 15, 2026, 11:57 PM
tobiu cross-referenced by #10036 on Apr 15, 2026, 11:58 PM
tobiu added parent issue #10030 on Apr 15, 2026, 11:58 PM
tobiu marked this issue as being blocked by #10031 on Apr 15, 2026, 11:58 PM
tobiu marked this issue as blocking #10033 on Apr 15, 2026, 11:58 PM
tobiu marked this issue as blocking #10034 on Apr 15, 2026, 11:58 PM
tobiu
tobiu Apr 16, 2026, 12:11 AM

Input from Claude Opus 4.6 (Antigravity):

Enhancement: Hybrid ChromaDB Integration

During planning, we identified that concept nodes (with their title + description) are ideal candidates for ChromaDB embedding as type: 'concept' documents. This enables:

  1. queryDocuments({query: "how does reactivity work?", type: "concept"}) → ranked concept nodes by vector similarity
  2. queryDocuments({query: "Neo.core.EffectManager", type: "concept"}) → automated IMPLEMENTED_BY wiring discovery
  3. Cross-type semantic comparison: concept descriptions vs guide chunks → automated EXPLAINED_BY validation

Concept descriptions are short (1-3 sentences) — no semantic dilution risk. The three representations become complementary:

  • JSONL → structure (hierarchy, typed edges)
  • ChromaDB → similarity (semantic search, discovery)
  • SQLite Native Graph (Phase 3) → traversal (BFS, frontier routing)

Architectural note: ConceptService should live in the SDK (ai/services.mjs), not as a new MCP server. Uses KB_ChromaManager directly through SDK imports. This aligns with the wider strategy of moving business logic into the SDK and keeping MCP servers as thin transport layers.

tobiu cross-referenced by #10037 on Apr 16, 2026, 12:12 AM
tobiu marked this issue as blocking #10037 on Apr 16, 2026, 12:12 AM
tobiu cross-referenced by PR #10047 on Apr 17, 2026, 9:27 AM
tobiu assigned to @tobiu on Apr 17, 2026, 10:25 AM
tobiu referenced in commit 8cd0229 - "feat: implement ConceptService for deterministic ontology graph traversal (#10032) on Apr 17, 2026, 3:08 PM
tobiu cross-referenced by PR #10048 on Apr 17, 2026, 3:08 PM
tobiu referenced in commit 84cac1b - "feat: implement ConceptService for deterministic ontology graph traversal (#10032) (#10048) on Apr 17, 2026, 3:14 PM
tobiu closed this issue on Apr 17, 2026, 3:14 PM
tobiu cross-referenced by PR #10052 on Apr 17, 2026, 4:30 PM
tobiu cross-referenced by PR #10078 on Apr 19, 2026, 10:28 AM
tobiu cross-referenced by #10080 on Apr 19, 2026, 11:16 AM
tobiu cross-referenced by PR #10084 on Apr 19, 2026, 12:20 PM
tobiu cross-referenced by #10030 on Apr 19, 2026, 12:33 PM