LearnNewsExamplesServices
Frontmatter
id9439
titleTreeStore: Apply "Anchor & Echo" JSDoc strategy for AI discoverability
stateClosed
labels
documentationenhancementai
assigneestobiu
createdAtMar 11, 2026, 11:52 AM
updatedAtMar 11, 2026, 11:54 AM
githubUrlhttps://github.com/neomjs/neo/issues/9439
authortobiu
commentsCount1
parentIssue9404
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 11, 2026, 11:54 AM

TreeStore: Apply "Anchor & Echo" JSDoc strategy for AI discoverability

Closed v12.1.0 documentationenhancementai
tobiu
tobiu commented on Mar 11, 2026, 11:52 AM

Background

The AI Knowledge Base parses and chunks source files (like TreeStore.mjs) by methods and properties. While the class-level documentation provided excellent context about the "Projection Architecture" and "Structural Layer", isolated method chunks (like expand() or collapse()) often lacked this semantic weight. This "Implied Context" anti-pattern leads to poor discoverability during vector searches.

Solution: Anchor & Echo Strategy

To balance human readability with AI discoverability, we are applying the "Anchor & Echo" strategy to TreeStore.mjs:

  1. The Anchor: The class-level docblock and major overrides (splice, filter) establish high-value architectural vocabulary (e.g., "Structural Layer", "Projection Layer").
  2. The Echo: Smaller fields and helper methods deliberately reuse this specific vocabulary instead of generic terms.

Changes Implemented

  • Private Maps (#allRecordsMap, #childrenMap): Now explicitly defined as the foundation and hierarchy of the Structural Layer.
  • collapse() & expand(): Clarified that they mathematically move nodes between the Structural Layer and the Projection Layer.
  • Collection Helpers (collectAllDescendants, collectVisibleDescendants): Updated to state they traverse the Structural Layer to build the Projection Layer or perform deep cleanup.
  • updateSiblingStats(): Anchored its purpose to operations within the Structural Layer.

These targeted JSDoc enhancements ensure that every chunk of TreeStore.mjs carries sufficient semantic weight for accurate and context-aware retrieval from the ChromaDB knowledge base.

tobiu assigned to @tobiu on Mar 11, 2026, 11:52 AM
tobiu added the documentation label on Mar 11, 2026, 11:52 AM
tobiu added the enhancement label on Mar 11, 2026, 11:52 AM
tobiu added the ai label on Mar 11, 2026, 11:52 AM
tobiu added parent issue #9404 on Mar 11, 2026, 11:53 AM
tobiu referenced in commit d0dbcc5 - "docs(data): apply Anchor & Echo JSDoc strategy to TreeStore (#9439)" on Mar 11, 2026, 11:53 AM
tobiu
tobiu Mar 11, 2026, 11:54 AM

Implemented the Anchor & Echo JSDoc strategy for TreeStore. Changes committed and pushed in d0dbcc500.

tobiu closed this issue on Mar 11, 2026, 11:54 AM