Sync reads every changed transcript whole in hasConversationContent (1.6 GB for a 507 MB file)
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from obra/episodic-memory
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
obra/episodic-memory#219 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
obra/episodic-memory#218 ·
-
Sync reads the whole exchanges table once per archived file: no index on exchanges.archive_pathOpen
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
obra/episodic-memory#216 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
obra/episodic-memory#195 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
obra/episodic-memory#191 ·
All issues in obra/episodic-memory
Similar issues
-
bug data-types
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/clickhouse-js#1293 ·
Maintainers usually reply within 1 day
-
area: middleware enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
agent/quality testing
Difficulty 1/5 Under an hour Newbie friendliness 95/100
Maintainers usually reply within 1 day
-
GitHub registry install via `gh` credentials rewrites `\u0000`–`\u001f` escapes in source files to `^@`–`^_`Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
juspay/agent-distro#203 ·
Maintainers usually reply within 1 day