Sync reads every changed transcript whole in hasConversationContent (1.6 GB for a 507 MB file)

Open Beginner friendly
#194 2 comments 0 reactions 0 assignees View on GitHub

@gezerui888 is already working on this.

Since Nov 25, 2026.

  • #215 by @gezerui888 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
performance

Research direction

Start in src/sync.ts around hasConversationContent(), then compare the streaming approach in parseConversation() and the chunk reads in shouldSkipConversation(). Check the behavior on a large transcript; done means the function still detects message content while reading incrementally rather than loading and splitting the whole file.

Written by the indexing model from the issue text.

Description

sync calls hasConversationContent() on each transcript before copying it. The function reads the whole file with fs.readFileSync(filePath, 'utf-8') and then splits it with content.split('\n'), only to find the first line with a message (src/sync.ts, around line 60 on main).

Long Claude Code sessions produce large transcripts. On a 507 MB transcript (56,014 lines), those two calls alone peaked at 1,610,649,104 bytes of memory footprint in Node (/usr/bin/time -l). A full episodic-memory sync on the same machine reached 4.2 GB within 13 seconds, during the copy phase and before the embedding model loaded. Active transcripts change between syncs, so this happens again on every sync.

For comparison, parseConversation() on the same file streams it with readline and peaked at about 199 MB.

Suggested fix: read the file the way the parser does and return at the first line with message content, for example fs.createReadStream with readline and an early return, or the fixed-size chunk reads that shouldSkipConversation() already uses. It would then hold one line at a time instead of the whole file and its split copy.

Environment: episodic-memory 1.6.0 (the same code is on main as of 2026-10-29), Node 26.12.1, macOS on Apple Silicon. Three transcripts on this machine are over 500 MB.

Dominant language
TypeScript
Stars
511
Forks
154
Avg merge
14d 20h
Merged PRs (30d)
6

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from obra/episodic-memory

All issues in obra/episodic-memory

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.