---
id: 8425
title: Switch Class Hierarchy to JSON
state: CLOSED
labels:
  - ai
  - refactoring
assignees:
  - tobiu
createdAt: '2026-01-08T13:40:16Z'
updatedAt: '2026-01-08T13:42:49Z'
githubUrl: 'https://github.com/neomjs/neo/issues/8425'
author: tobiu
commentsCount: 1
parentIssue: null
subIssues: []
subIssuesCompleted: 0
subIssuesTotal: 0
blockedBy: []
blocking: []
closedAt: '2026-01-08T13:42:48Z'
---
# Switch Class Hierarchy to JSON

The `docs/output/class-hierarchy.yaml` file is currently used for hierarchy tracking but is less optimal for programmatic consumption by the AI Knowledge Base services than JSON. The file's token efficiency for LLM consumption is outweighed by the need for robust, structured access via `QueryService`.

**Tasks:**
1.  **Modify `buildScripts/docs/jsdocx.mjs`:**
    *   Stop generating `class-hierarchy.yaml`.
    *   Start generating `class-hierarchy.json` containing the same key-value mapping (ClassName -> ParentClassName).
2.  **Modify `ai/mcp/server/knowledge-base/config.mjs`:**
    *   Update `hierarchyPath` to point to `docs/output/class-hierarchy.json`.
3.  **Modify `ai/mcp/server/knowledge-base/services/VectorService.mjs`:**
    *   Remove the logic that generates/writes `dist/ai-class-hierarchy.json`.
    *   (Note: `SourceParser` logic remains to enrich vector metadata).
4.  **Modify `ai/mcp/server/knowledge-base/services/QueryService.mjs`:**
    *   Ensure `getClassHierarchy` reads from the configured `hierarchyPath`.

**Goal:**
Standardize on `class-hierarchy.json` as the single source of truth for class relationships, generated by the robust JSDoc parser.

## Timeline

- 2026-01-08T13:40:17Z @tobiu added the `ai` label
- 2026-01-08T13:40:17Z @tobiu added the `refactoring` label
- 2026-01-08T13:40:34Z @tobiu assigned to @tobiu
- 2026-01-08T13:42:27Z @tobiu referenced in commit `6a62379` - "refactor: Switch Class Hierarchy to JSON (#8425)"
### @tobiu - 2026-01-08T13:42:35Z

**Input from Gemini 3 Pro:**

> ✦ I have refactored the Class Hierarchy system to use a clean JSON artifact generated by the JSDoc pipeline.
> 
> **Changes:**
> 1.  **`buildScripts/docs/jsdocx.mjs`:** Switched from generating `class-hierarchy.yaml` to `class-hierarchy.json`. The format is a simple map: `{"ClassName": "ParentClassName"}`.
> 2.  **`ai/mcp/server/knowledge-base/config.mjs`:** Updated `hierarchyPath` to point to `docs/output/class-hierarchy.json`.
> 3.  **`ai/mcp/server/knowledge-base/services/VectorService.mjs`:** Removed the redundant code that was generating `ai-class-hierarchy.json`.
> 4.  **`ai/mcp/server/knowledge-base/services/QueryService.mjs`:** Updated `getClassHierarchy` to read the new JSON format and logic to handle the simplified key-value structure.
> 
> This removes redundancy and ensures the Knowledge Base relies on the authoritative JSDoc-derived hierarchy.

- 2026-01-08T13:42:49Z @tobiu closed this issue

