Frontmatter
| id | 8342 |
| title | Switch Knowledge Base to Source Code Indexing (SourceParser) |
| state | Closed |
| labels | enhancementai |
| assignees | tobiu |
| createdAt | Jan 5, 2026, 11:57 PM |
| updatedAt | Jan 6, 2026, 12:04 AM |
| githubUrl | https://github.com/neomjs/neo/issues/8342 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 6, 2026, 12:04 AM |
Switch Knowledge Base to Source Code Indexing (SourceParser)
tobiu assigned to @tobiu on Jan 5, 2026, 11:57 PM

tobiu
Jan 6, 2026, 12:03 AM
Input from Gemini 3 Pro:
✦ I have successfully switched the Knowledge Base indexing strategy from JSDoc JSON to raw Source Code.
Changes Implemented:
Created
SourceParser.mjs:
- Uses
acornto parse.mjsfiles into an AST.- Chunking Strategy:
- Module Context: Captures imports, top-level variables, and the class header (JSDoc + Class Declaration).
- Class Properties: Groups static and instance fields (e.g.,
static observable,myProp = 0) that are not part of the config block.- Config Block: Extracts the entire
static config = { ... }object as a single, cohesive chunk.- Methods: Extracts individual methods (Body + JSDoc) with line number metadata.
Updated
ApiSource.mjs:
- Now targets the
src/directory instead ofdocs/output/all.json.- Recursively scans for
.mjsfiles.- Uses
SourceParserto generate chunks.- Maintains the previously added deterministic sorting.
Deleted
ApiParser.mjs:
- Removed the obsolete parser that relied on
jsdoc-apioutput.This change upgrades the AI's understanding from purely API-based (signatures and descriptions) to implementation-based (logic and patterns), while also reducing vector cardinality by grouping related configurations.
tobiu closed this issue on Jan 6, 2026, 12:04 AM
tobiu cross-referenced by #8420 on Jan 8, 2026, 1:02 PM
Switch the API knowledge source from
docs/output/all.json(JSDoc JSON) to rawsrc/**/*.mjsfiles.Goal: Provide the AI with implementation details and context, not just API signatures. Reduce vector cardinality by grouping cohesive units.
Plan:
Create
ai/mcp/server/knowledge-base/parser/SourceParser.mjs:acornto parse.mjsfiles.const symbol = ...) + Class Header (JSDoc + Class definition).static observable = true,myProp = 0) excluding theconfigobject.static config = { ... }object as a single chunk.line_start,line_end) for future "open in editor" features.Update
ApiSource.mjs:docs/output/all.jsontosrc/.SourceParserfor parsing.mjsfiles.Cleanup:
ApiParser.mjs(the JSDoc JSON parser).Note: This relies on the
acorndependency which is already present (used byTestParser).