Skip to content

Migrate project documentation to NodeSpace collections - #831

Merged
malibio merged 9 commits into
mainfrom
feature/issue-770-migrate-docs-to-nodespace
Jan 27, 2026
Merged

malibio merged 9 commits into
mainfrom
feature/issue-770-migrate-docs-to-nodespace

Conversation

@malibio

@malibio malibio commented Jan 26, 2026

Copy link
Copy Markdown
Collaborator

Closes #770

malibio and others added 8 commits January 26, 2026 15:46
## Summary
- Add lifecycle_status parameter to create_node and update_node MCP tools
- Enhance import-docs.ts with intelligent collection routing and archival support
- Update CLAUDE.md with documentation search section

## Changes

### Rust Backend
- Add lifecycle_status to NodeUpdate struct in models/node.rs
- Add lifecycle_status support in surreal_store.rs update method
- Add lifecycle_status to MCP UpdateNodeParams and MCPCreateNodeParams
- Add lifecycle_status to MCP tool schemas (create_node, update_node)
- Pass through lifecycle_status in node_service.rs update flow
- Fix benchmarks to include lifecycle_status field

### Import Script (scripts/import-docs.ts)
- Add intelligent collection routing (Upper Case, spaces allowed):
  - architecture/decisions/* -> "ADR"
  - */archived/* -> "Archived" (marked for archival)
  - */lessons/* -> "Lessons"
  - troubleshooting/* -> "Troubleshooting"
  - architecture/components/* -> "Components"
  - architecture/business-logic/* -> "Business Logic"
  - architecture/development/* -> "Development:*" (nested)
- Add --dry-run flag for preview mode with collection distribution stats
- Post-import lifecycle_status update for archived documents

### Documentation
- Add Section 9 "Accessing NodeSpace Documentation" to CLAUDE.md
- Document semantic search usage and collection structure
- Document import script usage

## Follow-Up Issues Created
- #829: Documentation Accuracy Audit
- #830: NodeSpace Skill for Claude Code

Closes #770

Co-Authored-By: Claude <[email protected]>
…c import

## Search Results (#821)
- Added `title` field to semantic search result objects
- Previously only `content` was returned, which contains markdown formatting
- The `title` field contains stripped/clean text for display

## Async Import Performance Fix
- Moved collection membership creation into the async spawn
- Previously, `add_to_collection_by_path` ran synchronously AFTER the spawn,
  causing database contention during bulk imports
- Now: collection path is resolved synchronously (for error reporting), but
  the actual membership creation happens in background using store directly
- This restores the original fast async import behavior

## Changes
- `search.rs`: Added `title` to node JSON in search results
- `markdown.rs`: Restructured async flow to include collection handling in spawn

Co-Authored-By: Claude <[email protected]>
- Add title field to TypeScript Node interface to match Rust backend
- Update base-node.svelte to use node.title for @mention results
- Falls back to content.split('\n')[0] for nodes without title
- Fixes markdown headers (e.g., "# NodeManager...") showing in autocomplete

The title field contains markdown-stripped content for clean display,
populated only for root nodes and task nodes (Issue #821).

Co-Authored-By: Claude <[email protected]>
Enhances the import script with two-phase import:

Phase 1: Import all markdown files and build path-to-nodeId mapping
- Imports docs with collection organization
- Tracks file paths to node IDs

Phase 2: Resolve internal markdown links to nodespace:// URIs
- Converts [text](./relative/path.md) to [text](nodespace://uuid)
- Backend automatically creates bidirectional mentions relationships
- Reports unresolved links (pointing to non-imported files)

This enables clickable cross-references between imported docs and
shows backlinks in the "Mentioned by" panel.

Co-Authored-By: Claude <[email protected]>
## Problem
create_node() was calling get_schema_for_type() TWICE per node:
1. Line 1120: To apply schema defaults
2. Line 1144: To add schema version

This caused 2 database queries per node creation, resulting in
5+ second response times for markdown imports.

## Solution
- Fetch schema ONCE and reuse for all operations
- Moved schema version addition into the same block as defaults/validation
- Added timing instrumentation for debugging

## Performance Impact
- Before: 5281ms for simple markdown import with collection
- After: 779ms for same import (6.8x faster)
- Without collection: 266ms (20x faster than before)

## Files Changed
- packages/core/src/services/node_service.rs: Single schema fetch
- packages/core/src/mcp/handlers/markdown.rs: Debug timing logs

Co-Authored-By: Claude <[email protected]>
## Import System
- Add File > Import Folder menu with folder picker dialog
- Create StatusBar component showing import progress and embedding queue
- Add import_directory Tauri command with progress events
- Support auto_collection_routing and exclude_patterns options

## UI Fixes
- Fix status bar overlapping BacklinksPanel (grid minmax fix)
- Fix scroll position starting in middle by keying on nodeId+tabId+paneId
- Add margin-top: auto to BacklinksPanel for proper bottom positioning

## Performance Optimizations
- Fix N+1 query in get_collection_members (5-6x speedup)
- Batch fetch nodes in single query instead of individual fetches
- Add get_nodes_batch to SurrealStore for efficient bulk retrieval

## Collections Sidebar
- Add reactive updates when member_of relationships change
- Listen to RELATIONSHIP_CREATED/DELETED MCP events
- Invalidate collection member caches on membership changes

## Status Bar Features
- Toggle via View menu (Cmd+Shift+B)
- Show embedding queue count (left side)
- Show import progress with percentage (right side)
- Auto-hide success messages after 3 seconds

Closes #770

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Jan 27, 2026

Copy link
Copy Markdown
Collaborator Author

Principal Engineer Code Review

Review Type: Initial Review
PR #831: Migrate project documentation to NodeSpace collections
Branch: feature/issue-770-migrate-docs-to-nodespace


Requirements Check (Issue #770)

Acceptance Criterion Status
Create collection hierarchy in NodeSpace ✅ Implemented - auto-routing creates collections from folder structure
Import current architecture docs (~116 files) into appropriate collections ✅ Implemented - import-docs.ts with dry-run support
Import ADRs into adr collection with date metadata ✅ ADR routing implemented
Import archived docs into archived collection ✅ Archived routing with lifecycle_status support
Import lessons learned into lessons collection ✅ Lessons routing implemented
Verify semantic search finds relevant content 🟡 Not explicitly verified in code, but infrastructure exists
Document import process for future docs ✅ CLAUDE.md Section 9 added
Update CLAUDE.md to reference NodeSpace docs where appropriate ✅ Section 9 documents semantic search usage

Code Review Findings

🟢 Notable Improvements

1. N+1 Query Optimization (Critical Performance Fix)

  • get_collection_members now returns full Vec<Node> instead of Vec<String> IDs
  • Single query with graph traversal eliminates individual node fetches
  • This is a significant 5-6x speedup for collection operations
  • Files: surreal_store.rs:4563-4592, collection_service.rs:582-595

2. Schema Fetch Deduplication

  • create_node() was fetching schema TWICE per node
  • Now fetches ONCE and reuses for defaults, validation, and version
  • Excellent performance improvement for bulk imports
  • File: node_service.rs:1095-1170

3. Bulk Import with Root-Only Notification

  • New bulk_create_hierarchy_root_notify() reduces event storm during imports
  • Only emits domain event for root node, not every child
  • Appropriate for bulk operations
  • File: surreal_store.rs:3412-3522

4. Scroll State Fix

  • ViewerId now includes nodeId: ${nodeId}-${tabId}-${paneId}
  • Correctly resets scroll when navigating between nodes in same tab
  • Good fix with comprehensive test updates
  • File: scroll-state.ts, base-node-viewer.svelte:150

🟡 Suggested Improvements

1. Debug Logging Left in Production Code

  • Files:
    • import.rs:1908-1912: println! statements for debugging
    • import.rs:2032-2079: Multiple println! and stdout().flush() calls
    • import.rs:2322-2340: More debug println! statements
    • collections.ts:92-99: console.log('DEBUG Collections sample:', ...)
  • Recommendation: Replace println! with tracing::debug! and remove console.log debug statements before merge. Debug logging should use the tracing infrastructure consistently.

2. Hardcoded File Write for Debugging

  • File: import.rs:2033-2043
if let Ok(mut f) = std::fs::OpenOptions::new()
    .create(true)
    .append(true)
    .open("/tmp/import-debug.log")
  • Issue: Writes to /tmp/import-debug.log during normal operation
  • Recommendation: Remove this debug file writing before merge.

3. Status Bar Polling Interval

  • File: app-shell.svelte:166-179
  • Polls get_stale_root_count every 5 seconds
  • Consideration: Consider using event-based updates instead of polling if the backend can emit events when embedding queue changes. Otherwise, 5s is reasonable.

4. Collection Tree Building - First Parent Only

  • File: collections.ts:270-281
// Add to first parent only (to avoid showing same collection multiple times)
const firstParentId = parentIds[0];
  • Comment: This is a reasonable simplification, but the comment should note that multi-parent collections won't appear multiple times in the tree. This is a conscious UX decision.

🔵 Nit: Minor Polish

1. Nit: Unused import removal

  • File: collection_service.rs - Check if all imports are used after the API change from Vec<String> to Vec<Node>

2. Nit: Magic numbers

  • File: navigation-sidebar.svelte:592 - max-height: calc(10 * 28px) - Consider extracting to a variable with comment explaining the rationale (10 items before scroll)

3. Nit: Emoji in code comment

  • File: import-docs.ts:528 - 📦 emoji in console output is fine for CLI tools, but be consistent across the codebase

Architecture Assessment

Strengths:

  1. Clean separation between Tauri commands and MCP handlers
  2. Good use of SurrealDB graph traversal for efficient queries
  3. Status bar design integrates well with existing flex layout
  4. Import service follows existing service patterns

No Architectural Concerns:

  • Changes align with existing patterns
  • Performance optimizations are well-justified
  • No unnecessary complexity introduced

Security Check

✅ No security issues identified:

  • No hardcoded secrets
  • File path handling uses standard library functions
  • Import validation checks file existence
  • Collection paths are sanitized through existing patterns

Recommendation: APPROVE with Minor Changes

The PR is a clear net positive with significant performance improvements and solid feature implementation. The only blocking concern is the debug logging that should be cleaned up before merge:

  1. Required before merge: Remove println! debug statements in import.rs and console.log in collections.ts
  2. Required before merge: Remove the /tmp/import-debug.log file writing

All other suggestions are improvements that can be addressed in follow-up work.


Reviewed by Principal Engineer AI

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review complete. Please address the debug logging cleanup (println! statements in import.rs, console.log in collections.ts, and /tmp/import-debug.log file write) before merging. See detailed review comment for full analysis and recommendations.

- Remove println! debug statements from import.rs
- Remove /tmp/import-debug.log file write
- Remove console.log debug statement from collections.ts

Addresses reviewer recommendations from PR #831.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@malibio

malibio commented Jan 27, 2026

Copy link
Copy Markdown
Collaborator Author

Review Feedback Addressed

Changes Made

  • ✅ Removed println! debug statements from import.rs (lines 441-446, 505-514, 566-597, 610-612, 868-891)
  • ✅ Removed /tmp/import-debug.log file write (lines 567-577)
  • ✅ Removed console.log('DEBUG Collections sample:...') from collections.ts (lines 85-93)

Skipped Recommendations (with justification)

  • ⏭️ Status bar polling interval: Current 5s polling is reasonable; event-based updates would be scope creep for this PR
  • ⏭️ Collection tree first-parent comment: Existing comment is clear; additional documentation unnecessary
  • ⏭️ Magic numbers in sidebar: calc(10 * 28px) is readable inline; extracting adds indirection without benefit
  • ⏭️ Emoji in CLI output: Intentional UX choice for CLI tools, consistent with project patterns

Summary

  • ✅ Addressed: 3 recommendations (all required items)
  • ⏭️ Skipped: 4 recommendations (style/optimization nits)
  • 📝 Commits: 1
  • 🧪 Tests: All passing (3470 frontend, 722 Rust)

Re-Review Decision

Decision: NO RE-REVIEW NEEDED

Rationale: All changes are straightforward debug statement removal with no logic changes. Tests pass. The cleanup addresses exactly what was required with minimal code churn.

PR is ready to merge.

@malibio
malibio merged commit 02147a8 into main Jan 27, 2026
@malibio
malibio deleted the feature/issue-770-migrate-docs-to-nodespace branch January 27, 2026 11:00
malibio added a commit that referenced this pull request Feb 4, 2026
* Add lifecycle_status to MCP tools and enhance docs import script (#770)

## Summary
- Add lifecycle_status parameter to create_node and update_node MCP tools
- Enhance import-docs.ts with intelligent collection routing and archival support
- Update CLAUDE.md with documentation search section

## Changes

### Rust Backend
- Add lifecycle_status to NodeUpdate struct in models/node.rs
- Add lifecycle_status support in surreal_store.rs update method
- Add lifecycle_status to MCP UpdateNodeParams and MCPCreateNodeParams
- Add lifecycle_status to MCP tool schemas (create_node, update_node)
- Pass through lifecycle_status in node_service.rs update flow
- Fix benchmarks to include lifecycle_status field

### Import Script (scripts/import-docs.ts)
- Add intelligent collection routing (Upper Case, spaces allowed):
  - architecture/decisions/* -> "ADR"
  - */archived/* -> "Archived" (marked for archival)
  - */lessons/* -> "Lessons"
  - troubleshooting/* -> "Troubleshooting"
  - architecture/components/* -> "Components"
  - architecture/business-logic/* -> "Business Logic"
  - architecture/development/* -> "Development:*" (nested)
- Add --dry-run flag for preview mode with collection distribution stats
- Post-import lifecycle_status update for archived documents

### Documentation
- Add Section 9 "Accessing NodeSpace Documentation" to CLAUDE.md
- Document semantic search usage and collection structure
- Document import script usage

## Follow-Up Issues Created
- #829: Documentation Accuracy Audit
- #830: NodeSpace Skill for Claude Code

Closes #770

Co-Authored-By: Claude <[email protected]>

* fix: Include title field in semantic search results and optimize async import

## Search Results (#821)
- Added `title` field to semantic search result objects
- Previously only `content` was returned, which contains markdown formatting
- The `title` field contains stripped/clean text for display

## Async Import Performance Fix
- Moved collection membership creation into the async spawn
- Previously, `add_to_collection_by_path` ran synchronously AFTER the spawn,
  causing database contention during bulk imports
- Now: collection path is resolved synchronously (for error reporting), but
  the actual membership creation happens in background using store directly
- This restores the original fast async import behavior

## Changes
- `search.rs`: Added `title` to node JSON in search results
- `markdown.rs`: Restructured async flow to include collection handling in spawn

Co-Authored-By: Claude <[email protected]>

* fix: Use title field for @mention autocomplete display

- Add title field to TypeScript Node interface to match Rust backend
- Update base-node.svelte to use node.title for @mention results
- Falls back to content.split('\n')[0] for nodes without title
- Fixes markdown headers (e.g., "# NodeManager...") showing in autocomplete

The title field contains markdown-stripped content for clean display,
populated only for root nodes and task nodes (Issue #821).

Co-Authored-By: Claude <[email protected]>

* feat: Add Phase 2 link resolution to docs import script

Enhances the import script with two-phase import:

Phase 1: Import all markdown files and build path-to-nodeId mapping
- Imports docs with collection organization
- Tracks file paths to node IDs

Phase 2: Resolve internal markdown links to nodespace:// URIs
- Converts [text](./relative/path.md) to [text](nodespace://uuid)
- Backend automatically creates bidirectional mentions relationships
- Reports unresolved links (pointing to non-imported files)

This enables clickable cross-references between imported docs and
shows backlinks in the "Mentioned by" panel.

Co-Authored-By: Claude <[email protected]>

* perf: Fix duplicate schema fetch in create_node (5x speedup)

## Problem
create_node() was calling get_schema_for_type() TWICE per node:
1. Line 1120: To apply schema defaults
2. Line 1144: To add schema version

This caused 2 database queries per node creation, resulting in
5+ second response times for markdown imports.

## Solution
- Fetch schema ONCE and reuse for all operations
- Moved schema version addition into the same block as defaults/validation
- Added timing instrumentation for debugging

## Performance Impact
- Before: 5281ms for simple markdown import with collection
- After: 779ms for same import (6.8x faster)
- Without collection: 266ms (20x faster than before)

## Files Changed
- packages/core/src/services/node_service.rs: Single schema fetch
- packages/core/src/mcp/handlers/markdown.rs: Debug timing logs

Co-Authored-By: Claude <[email protected]>

* feat: Import UI, status bar, scroll fixes, and N+1 query optimization

## Import System
- Add File > Import Folder menu with folder picker dialog
- Create StatusBar component showing import progress and embedding queue
- Add import_directory Tauri command with progress events
- Support auto_collection_routing and exclude_patterns options

## UI Fixes
- Fix status bar overlapping BacklinksPanel (grid minmax fix)
- Fix scroll position starting in middle by keying on nodeId+tabId+paneId
- Add margin-top: auto to BacklinksPanel for proper bottom positioning

## Performance Optimizations
- Fix N+1 query in get_collection_members (5-6x speedup)
- Batch fetch nodes in single query instead of individual fetches
- Add get_nodes_batch to SurrealStore for efficient bulk retrieval

## Collections Sidebar
- Add reactive updates when member_of relationships change
- Listen to RELATIONSHIP_CREATED/DELETED MCP events
- Invalidate collection member caches on membership changes

## Status Bar Features
- Toggle via View menu (Cmd+Shift+B)
- Show embedding queue count (left side)
- Show import progress with percentage (right side)
- Auto-hide success messages after 3 seconds

Closes #770

Co-Authored-By: Claude <[email protected]>

* Address review: Remove debug logging statements

- Remove println! debug statements from import.rs
- Remove /tmp/import-debug.log file write
- Remove console.log debug statement from collections.ts

Addresses reviewer recommendations from PR #831.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 5, 2026
* Add lifecycle_status to MCP tools and enhance docs import script (#770)

## Summary
- Add lifecycle_status parameter to create_node and update_node MCP tools
- Enhance import-docs.ts with intelligent collection routing and archival support
- Update CLAUDE.md with documentation search section

## Changes

### Rust Backend
- Add lifecycle_status to NodeUpdate struct in models/node.rs
- Add lifecycle_status support in surreal_store.rs update method
- Add lifecycle_status to MCP UpdateNodeParams and MCPCreateNodeParams
- Add lifecycle_status to MCP tool schemas (create_node, update_node)
- Pass through lifecycle_status in node_service.rs update flow
- Fix benchmarks to include lifecycle_status field

### Import Script (scripts/import-docs.ts)
- Add intelligent collection routing (Upper Case, spaces allowed):
  - architecture/decisions/* -> "ADR"
  - */archived/* -> "Archived" (marked for archival)
  - */lessons/* -> "Lessons"
  - troubleshooting/* -> "Troubleshooting"
  - architecture/components/* -> "Components"
  - architecture/business-logic/* -> "Business Logic"
  - architecture/development/* -> "Development:*" (nested)
- Add --dry-run flag for preview mode with collection distribution stats
- Post-import lifecycle_status update for archived documents

### Documentation
- Add Section 9 "Accessing NodeSpace Documentation" to CLAUDE.md
- Document semantic search usage and collection structure
- Document import script usage

## Follow-Up Issues Created
- #829: Documentation Accuracy Audit
- #830: NodeSpace Skill for Claude Code

Closes #770

Co-Authored-By: Claude <[email protected]>

* fix: Include title field in semantic search results and optimize async import

## Search Results (#821)
- Added `title` field to semantic search result objects
- Previously only `content` was returned, which contains markdown formatting
- The `title` field contains stripped/clean text for display

## Async Import Performance Fix
- Moved collection membership creation into the async spawn
- Previously, `add_to_collection_by_path` ran synchronously AFTER the spawn,
  causing database contention during bulk imports
- Now: collection path is resolved synchronously (for error reporting), but
  the actual membership creation happens in background using store directly
- This restores the original fast async import behavior

## Changes
- `search.rs`: Added `title` to node JSON in search results
- `markdown.rs`: Restructured async flow to include collection handling in spawn

Co-Authored-By: Claude <[email protected]>

* fix: Use title field for @mention autocomplete display

- Add title field to TypeScript Node interface to match Rust backend
- Update base-node.svelte to use node.title for @mention results
- Falls back to content.split('\n')[0] for nodes without title
- Fixes markdown headers (e.g., "# NodeManager...") showing in autocomplete

The title field contains markdown-stripped content for clean display,
populated only for root nodes and task nodes (Issue #821).

Co-Authored-By: Claude <[email protected]>

* feat: Add Phase 2 link resolution to docs import script

Enhances the import script with two-phase import:

Phase 1: Import all markdown files and build path-to-nodeId mapping
- Imports docs with collection organization
- Tracks file paths to node IDs

Phase 2: Resolve internal markdown links to nodespace:// URIs
- Converts [text](./relative/path.md) to [text](nodespace://uuid)
- Backend automatically creates bidirectional mentions relationships
- Reports unresolved links (pointing to non-imported files)

This enables clickable cross-references between imported docs and
shows backlinks in the "Mentioned by" panel.

Co-Authored-By: Claude <[email protected]>

* perf: Fix duplicate schema fetch in create_node (5x speedup)

## Problem
create_node() was calling get_schema_for_type() TWICE per node:
1. Line 1120: To apply schema defaults
2. Line 1144: To add schema version

This caused 2 database queries per node creation, resulting in
5+ second response times for markdown imports.

## Solution
- Fetch schema ONCE and reuse for all operations
- Moved schema version addition into the same block as defaults/validation
- Added timing instrumentation for debugging

## Performance Impact
- Before: 5281ms for simple markdown import with collection
- After: 779ms for same import (6.8x faster)
- Without collection: 266ms (20x faster than before)

## Files Changed
- packages/core/src/services/node_service.rs: Single schema fetch
- packages/core/src/mcp/handlers/markdown.rs: Debug timing logs

Co-Authored-By: Claude <[email protected]>

* feat: Import UI, status bar, scroll fixes, and N+1 query optimization

## Import System
- Add File > Import Folder menu with folder picker dialog
- Create StatusBar component showing import progress and embedding queue
- Add import_directory Tauri command with progress events
- Support auto_collection_routing and exclude_patterns options

## UI Fixes
- Fix status bar overlapping BacklinksPanel (grid minmax fix)
- Fix scroll position starting in middle by keying on nodeId+tabId+paneId
- Add margin-top: auto to BacklinksPanel for proper bottom positioning

## Performance Optimizations
- Fix N+1 query in get_collection_members (5-6x speedup)
- Batch fetch nodes in single query instead of individual fetches
- Add get_nodes_batch to SurrealStore for efficient bulk retrieval

## Collections Sidebar
- Add reactive updates when member_of relationships change
- Listen to RELATIONSHIP_CREATED/DELETED MCP events
- Invalidate collection member caches on membership changes

## Status Bar Features
- Toggle via View menu (Cmd+Shift+B)
- Show embedding queue count (left side)
- Show import progress with percentage (right side)
- Auto-hide success messages after 3 seconds

Closes #770

Co-Authored-By: Claude <[email protected]>

* Address review: Remove debug logging statements

- Remove println! debug statements from import.rs
- Remove /tmp/import-debug.log file write
- Remove console.log debug statement from collections.ts

Addresses reviewer recommendations from PR #831.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 26, 2026
* Add lifecycle_status to MCP tools and enhance docs import script (#770)

## Summary
- Add lifecycle_status parameter to create_node and update_node MCP tools
- Enhance import-docs.ts with intelligent collection routing and archival support
- Update CLAUDE.md with documentation search section

## Changes

### Rust Backend
- Add lifecycle_status to NodeUpdate struct in models/node.rs
- Add lifecycle_status support in surreal_store.rs update method
- Add lifecycle_status to MCP UpdateNodeParams and MCPCreateNodeParams
- Add lifecycle_status to MCP tool schemas (create_node, update_node)
- Pass through lifecycle_status in node_service.rs update flow
- Fix benchmarks to include lifecycle_status field

### Import Script (scripts/import-docs.ts)
- Add intelligent collection routing (Upper Case, spaces allowed):
  - architecture/decisions/* -> "ADR"
  - */archived/* -> "Archived" (marked for archival)
  - */lessons/* -> "Lessons"
  - troubleshooting/* -> "Troubleshooting"
  - architecture/components/* -> "Components"
  - architecture/business-logic/* -> "Business Logic"
  - architecture/development/* -> "Development:*" (nested)
- Add --dry-run flag for preview mode with collection distribution stats
- Post-import lifecycle_status update for archived documents

### Documentation
- Add Section 9 "Accessing NodeSpace Documentation" to CLAUDE.md
- Document semantic search usage and collection structure
- Document import script usage

## Follow-Up Issues Created
- #829: Documentation Accuracy Audit
- #830: NodeSpace Skill for Claude Code

Closes #770

Co-Authored-By: Claude <[email protected]>

* fix: Include title field in semantic search results and optimize async import

## Search Results (#821)
- Added `title` field to semantic search result objects
- Previously only `content` was returned, which contains markdown formatting
- The `title` field contains stripped/clean text for display

## Async Import Performance Fix
- Moved collection membership creation into the async spawn
- Previously, `add_to_collection_by_path` ran synchronously AFTER the spawn,
  causing database contention during bulk imports
- Now: collection path is resolved synchronously (for error reporting), but
  the actual membership creation happens in background using store directly
- This restores the original fast async import behavior

## Changes
- `search.rs`: Added `title` to node JSON in search results
- `markdown.rs`: Restructured async flow to include collection handling in spawn

Co-Authored-By: Claude <[email protected]>

* fix: Use title field for @mention autocomplete display

- Add title field to TypeScript Node interface to match Rust backend
- Update base-node.svelte to use node.title for @mention results
- Falls back to content.split('\n')[0] for nodes without title
- Fixes markdown headers (e.g., "# NodeManager...") showing in autocomplete

The title field contains markdown-stripped content for clean display,
populated only for root nodes and task nodes (Issue #821).

Co-Authored-By: Claude <[email protected]>

* feat: Add Phase 2 link resolution to docs import script

Enhances the import script with two-phase import:

Phase 1: Import all markdown files and build path-to-nodeId mapping
- Imports docs with collection organization
- Tracks file paths to node IDs

Phase 2: Resolve internal markdown links to nodespace:// URIs
- Converts [text](./relative/path.md) to [text](nodespace://uuid)
- Backend automatically creates bidirectional mentions relationships
- Reports unresolved links (pointing to non-imported files)

This enables clickable cross-references between imported docs and
shows backlinks in the "Mentioned by" panel.

Co-Authored-By: Claude <[email protected]>

* perf: Fix duplicate schema fetch in create_node (5x speedup)

## Problem
create_node() was calling get_schema_for_type() TWICE per node:
1. Line 1120: To apply schema defaults
2. Line 1144: To add schema version

This caused 2 database queries per node creation, resulting in
5+ second response times for markdown imports.

## Solution
- Fetch schema ONCE and reuse for all operations
- Moved schema version addition into the same block as defaults/validation
- Added timing instrumentation for debugging

## Performance Impact
- Before: 5281ms for simple markdown import with collection
- After: 779ms for same import (6.8x faster)
- Without collection: 266ms (20x faster than before)

## Files Changed
- packages/core/src/services/node_service.rs: Single schema fetch
- packages/core/src/mcp/handlers/markdown.rs: Debug timing logs

Co-Authored-By: Claude <[email protected]>

* feat: Import UI, status bar, scroll fixes, and N+1 query optimization

## Import System
- Add File > Import Folder menu with folder picker dialog
- Create StatusBar component showing import progress and embedding queue
- Add import_directory Tauri command with progress events
- Support auto_collection_routing and exclude_patterns options

## UI Fixes
- Fix status bar overlapping BacklinksPanel (grid minmax fix)
- Fix scroll position starting in middle by keying on nodeId+tabId+paneId
- Add margin-top: auto to BacklinksPanel for proper bottom positioning

## Performance Optimizations
- Fix N+1 query in get_collection_members (5-6x speedup)
- Batch fetch nodes in single query instead of individual fetches
- Add get_nodes_batch to SurrealStore for efficient bulk retrieval

## Collections Sidebar
- Add reactive updates when member_of relationships change
- Listen to RELATIONSHIP_CREATED/DELETED MCP events
- Invalidate collection member caches on membership changes

## Status Bar Features
- Toggle via View menu (Cmd+Shift+B)
- Show embedding queue count (left side)
- Show import progress with percentage (right side)
- Auto-hide success messages after 3 seconds

Closes #770

Co-Authored-By: Claude <[email protected]>

* Address review: Remove debug logging statements

- Remove println! debug statements from import.rs
- Remove /tmp/import-debug.log file write
- Remove console.log debug statement from collections.ts

Addresses reviewer recommendations from PR #831.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate project documentation to NodeSpace collections

1 participant