You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FindCopilotCLI() is called twice per invocation on the hot path - once by IsCopilotInstalled() and again inside Launch() - causing a redundant blocking npm config get prefix subprocess call on Windows whenever npm_config_prefix env var is absent (adds ~300-500ms startup latency). Fix: cache the result in a package-level variable with sync.Once, or return the found path from IsCopilotInstalled() so Launch() can reuse it.
assets.ListSkills() is called multiple times on every interactive startup with no caching: once in newRootCmd() via SkillCount(), and again in printBanner() - each call walks the embedded FS and parses YAML frontmatter for all ~30 skills from scratch. Same pattern applies to ListAgents(). Fix: cache the result with sync.Once at the package level since the embedded FS is immutable at runtime.
GetSkill(name) always calls ListSkills() to do a linear O(n) scan across all skills, causing full embedded-FS traversal and YAML parsing for every single-skill lookup. Fix: build a map[string]*SkillInfo once in a sync.Once initializer and use it for O(1) lookups.
The checkpoint index.json is read from disk independently by every checkpoint operation (Get, ListByType, Delete, KeepLatest, GetProjectFiles, SaveWithOptions), with no in-process cache. Each SaveWithOptions call reads the full index, appends one entry, and rewrites the entire file - making checkpoint saves O(n) in the number of checkpoints. Fix: add a session-lifetime in-memory cache for the index, invalidated on write.
performance check
FindCopilotCLI()is called twice per invocation on the hot path - once byIsCopilotInstalled()and again insideLaunch()- causing a redundant blockingnpm config get prefixsubprocess call on Windows whenevernpm_config_prefixenv var is absent (adds ~300-500ms startup latency). Fix: cache the result in a package-level variable withsync.Once, or return the found path fromIsCopilotInstalled()soLaunch()can reuse it.assets.ListSkills()is called multiple times on every interactive startup with no caching: once innewRootCmd()viaSkillCount(), and again inprintBanner()- each call walks the embedded FS and parses YAML frontmatter for all ~30 skills from scratch. Same pattern applies toListAgents(). Fix: cache the result withsync.Onceat the package level since the embedded FS is immutable at runtime.GetSkill(name)always callsListSkills()to do a linear O(n) scan across all skills, causing full embedded-FS traversal and YAML parsing for every single-skill lookup. Fix: build amap[string]*SkillInfoonce in async.Onceinitializer and use it for O(1) lookups.index.jsonis read from disk independently by every checkpoint operation (Get,ListByType,Delete,KeepLatest,GetProjectFiles,SaveWithOptions), with no in-process cache. EachSaveWithOptionscall reads the full index, appends one entry, and rewrites the entire file - making checkpoint saves O(n) in the number of checkpoints. Fix: add a session-lifetime in-memory cache for the index, invalidated on write.Automated analysis - 4 finding(s)