-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Problem
The findConversationFile function in internal/cli/show.go (lines 357-409) performs a linear scan across all project directories every time a conversation ID is looked up.
Evidence
func findConversationFile(id string) (string, error) {
// Search in all projects
projects, err := history.ListProjects(cfg.ProjectsDir)
// ...
for _, project := range projects { // O(P) projects
entries, err := os.ReadDir(project.Dir) // O(F) files per project
for _, entry := range entries { // Linear string matching
// ...
}
}
}This function is called by ch show <id>, ch resume <id>, and ch agents <id>.
Impact
With many projects and conversations, every lookup scans potentially thousands of directory entries. For users with extensive Claude Code history, this could become noticeably slow.
Suggested Fix
Several options to consider:
- Start with current project first - Most lookups are for recent conversations in the current project
- Cache the session ID → file mapping - Build index once, reuse
- Use the existing SQLite DB - The sync feature already has SQLite; could add an index there
- Lazy/incremental approach - Cache discovered mappings as they're found
Files: internal/cli/show.go:357-409
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels