LearnNewsExamplesServices
Frontmatter
id8923
titleRefactor: Optimize Neural Link get_component_tree for token efficiency
stateClosed
labels
enhancementaiperformance
assigneestobiu
createdAtJan 31, 2026, 4:01 PM
updatedAtJan 31, 2026, 5:22 PM
githubUrlhttps://github.com/neomjs/neo/issues/8923
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 31, 2026, 5:22 PM

Refactor: Optimize Neural Link get_component_tree for token efficiency

Closed v12.0.0 enhancementaiperformance
tobiu
tobiu commented on Jan 31, 2026, 4:01 PM

The get_component_tree tool currently returns full component serialization (including VDOM, VNode, listeners) for every node in the hierarchy, resulting in massive payloads (1M+ tokens) for complex apps.

Goals:

  1. Introduce a lean mode (default: true) to ComponentService.getComponentTree.
  2. Strict Whitelisting: In lean mode, return only the following properties: id, className, ntype, parentId, items.
  3. Ensure the recursion logic respects this whitelist, preventing any other configs (like vdom, vnode, listeners, theme, style) from leaking into the output.

Impact: Reduce payload size by ~95%, enabling agents to inspect large application trees without exhausting context windows.

tobiu added the enhancement label on Jan 31, 2026, 4:01 PM
tobiu added the ai label on Jan 31, 2026, 4:01 PM
tobiu added the performance label on Jan 31, 2026, 4:01 PM
tobiu assigned to @tobiu on Jan 31, 2026, 5:12 PM
tobiu referenced in commit c1be3ba - "refactor: Optimize Neural Link get_component_tree for token efficiency (#8923) on Jan 31, 2026, 5:20 PM
tobiu
tobiu Jan 31, 2026, 5:21 PM

Input from Gemini 3 Pro:

✦ I have implemented the 'lean' mode for get_component_tree.

Changes:

  1. Strict Whitelisting: In lean mode (which defaults to true), the serialization now only includes:
    • id
    • className
    • items (recursive)
  2. Removal of Redundancy: I removed ntype and parentId from the lean output as discussed, as they are either redundant (implied by hierarchy) or can be derived from className.
  3. Schema Update: Updated openapi.yaml to include the lean parameter definition and description.

This should drastically reduce the token count for component tree inspections.

tobiu closed this issue on Jan 31, 2026, 5:22 PM