Skip to content

Avoid quadratic registry reads and duplicate disk scans when opening Skills #1129

Closed

Description

@currentbits

Priority: P1. Performance defect verified at 6c7a6fb on 2026-09-08.

Parent: #1121

Evidence

Opening Skills calls reloadAll: listSkills and listSkillCatalog both scan all user skill directories. listCatalog calls listSkills again. Each managed provider copy calls resolveManagedProvenance -> lookupInstall -> readRegistry, which reads, parses and sanitizes the entire registry. With N managed skills and P provider copies, registry processing grows approximately with P*N², then runs twice. The IPC handler being async does not move its synchronous filesystem work off Electron's main thread.

Disposable fixture, real production functions, three provider copies per skill:

Skills Registry reads per paired load SKILL.md reads Synchronous elapsed
100 600 600 72 ms
300 1,800 1,800 350 ms
600 3,600 3,600 1,160 ms

A separate read-only scan of the local skills directories returned 62 rows and took 39 ms for the paired load without registry provenance lookup. This is a smaller baseline, not evidence of a current 1.16-second user stall. Timings are one-machine diagnostics; operation counts are deterministic.

Smallest useful fix

  • Read and validate the app-owned registry once per inventory scan and reuse that snapshot for all marker lookups. Keep marker/name/catalog provenance validation intact.
  • Derive installed catalog status from the same inventory used by Skills, or coalesce the paired reads. Avoid rescanning every provider for static catalog metadata.
  • Reuse parsed metadata for aliases of the same physical SKILL.md within a scan, preserving symlink and dangling-link behavior.
  • If remaining cold I/O exceeds the interaction budget, move inventory scanning off the main event loop. Benchmark first; a permanent watcher framework is not required.
  • Refresh correctly after add/remove/sync/import and project changes. Avoid an indefinitely stale global cache.

Acceptance

Instrument the same 600-skill fixture: registry reads are O(1) per inventory, not per provider copy; a paired Skills/catalog load does not duplicate a full inventory. Target at least 80% less elapsed time versus the paired baseline on the same machine, with no main-thread task over 50 ms during tab opening. Report actual before/after p50/p95 and event-loop delay instead of claiming a universal speedup. Verify provenance, sync drift, imported plugins, external edits after refresh, symlinks and project read-only rows still work.

Runnable current-behavior evidence in the audit checkout: node docs/issue-drafts/2026-09-08-performance-skills-memory-evidence.cjs (exit 0). It creates/removes synthetic directories and asserts registry/skill read counts; it does not modify live skills.

Sources: inventory, provenance, registry, catalog, tab load.

Separate from #695 provider path correctness and #728 CSS flattening. No app implementation in this audit.

Activity

  1. added
    plan:todo
    plan:doing
    plan:done
    and removed
    plan:todo
    plan:doing
    on Sep 8, 2026
  2. currentbits commented on Sep 8, 2026

    @currentbits
    OwnerAuthor

    Duplicate of #1124 (same draft, created one second later). Keep #1124.

  3. added
    plan:todo
    and removed
    plan:done
    on Sep 8, 2026
  4. added
    plan:done
    and removed
    plan:todo
    on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions