Skip to content

Synchronizers Map not persisted - rescans on every restart #254

@Retengart

Description

@Retengart

Problem

this.synchronizers Map in Context class is in-memory only. After MCP server restart, synchronizers are recreated from scratch.

Current Behavior

// handlers.ts:320-330
const synchronizer = this.synchronizers.get(collectionName);
if (!synchronizer) {
    // Recreate synchronizer - loses previous file hash state
    const newSynchronizer = new FileSynchronizer(codebasePath, this.ignorePatterns);
    await newSynchronizer.initialize();
}

initialize() regenerates all file hashes.

Impact

First background sync after restart scans entire codebase to rebuild file hash map, even though merkle files exist on disk.

Expected Behavior

FileSynchronizer already persists to ~/.context/merkle/<hash>.json. The synchronizers Map should be reconstructed from these files on startup.

Location

  • packages/mcp/src/handlers.ts:320-330
  • packages/core/src/sync/synchronizer.ts:217-221 - initialize() loads from disk but Map not restored

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions