Skip to content

Use Claude history index for faster session loading #46

Description

@gadflysu

Problem

Claude loading performance now has a different baseline than the original #4 measurement. #4 measured pre-#8 serial full transcript parsing (LoadClaude at ~1.05s for 103 JSONL files / 81.8 MB). Current aps already has:

  • client-level concurrent loading in main.loadSessions
  • Claude per-file worker pool
  • persistent MetaCache keyed by transcript mtime + size

That means the next optimization should be measured against the current cold-cache and warm-cache behavior, not the original #4 baseline.

Opportunity

Claude Code's ~/.claude/history.jsonl is a lightweight prompt history index containing sessionId, project, timestamp, display, and pastedContents. Similar tools use it as a fast index before reading per-session transcript JSONL.

aps could use history.jsonl to quickly build lightweight Claude session candidates, then scan ~/.claude/projects/*/*.jsonl to mark transcript-backed sessions as resumable and enrich metadata only when needed.

Desired direction

  • Establish a new current baseline for Claude loading after Parallelize LoadClaude with worker pool and MetaCache #8:
    • cold cache: empty/invalid MetaCache
    • warm cache: valid MetaCache
    • list mode and interactive startup if materially different
  • Prototype or plan a history-index-assisted loading path:
    • read ~/.claude/history.jsonl once to group by sessionId
    • derive lightweight title, latest timestamp, project path, and prompt count
    • scan transcript JSONL files to determine which sessions are actually resumable
    • avoid duplicate rows when both history and transcript data exist
    • keep transcript JSONL as the authoritative source for resumability and full metadata
  • Measure whether this improves first-result or total-load latency compared with current LoadClaude.

Non-goals

Acceptance criteria

  • A fresh benchmark or debug-log measurement documents the current baseline after Parallelize LoadClaude with worker pool and MetaCache #8.
  • Tests cover history/transcript deduplication and preserve existing transcript-backed LoadClaude behavior.
  • Resumable sessions continue to launch via transcript-backed sessionId only.
  • History-only sessions are either excluded or explicitly marked non-resumable by shared data model, with no accidental claude --resume launch path.
  • The issue body or plan file records whether the history-index-assisted path improves cold cache, warm cache, first-result latency, or none of the above.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformancePerformance improvement or optimization

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions