Summarize the newest conversations first: the summary queue runs in directory-listing order
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
- Domain
- cli
Research direction
Start in src/sync.ts and find where syncConversations builds filesToSummarize before slicing it to summaryLimit. The change should sort the queued files by archived file mtime, newest first, before selecting the first 10 entries. Verify the behavior by running the sync against files with different modification times and confirming that recent conversations are summarized before older ones.
Written by the indexing model from the issue text.
Description
Goal
Recent conversations should get summaries first. A summary helps most on the sessions you're likely to search for next: this week's work, not last summer's. Today a large backlog is summarized in directory-listing order, so the newest sessions are usually the last to get one.
What happens now (1.6.0)
syncConversations (src/sync.ts) builds filesToSummarize as it walks the source directory. For each source it summarizes the first summaryLimit entries (default 10) and leaves the rest for later syncs:
const summaryLimit = options.summaryLimit ?? 10;
const toSummarize = filesToSummarize.slice(0, summaryLimit);
So the queue's order is the walk order:
- Claude Code: project directories alphabetically (
-Users-me-A…before-Users-me-Z…), then files in each one infindJsonlFilesorder. One busy project late in the alphabet waits behind every earlier project's backlog. - Codex:
~/.codex/sessions/YYYY/MM/DD/, so oldest first. With a backlog, the session you finished an hour ago is the last one summarized.
With a big archive this matters. Mine has about 4,700 transcripts and fewer than 60 summaries. At 10 per source per sync, the backlog takes hundreds of syncs to clear, and newer sessions keep joining the end of the queue.
Proposal
Sort the queue newest first by the archived file's mtime before slicing. Sync already sets the archive copy's mtime to the source's, so mtime tracks the session's last activity:
const summaryMtime = (f) => { try { return fs.statSync(f.path).mtimeMs; } catch { return 0; } };
filesToSummarize.sort((a, b) => summaryMtime(b) - summaryMtime(a));
const toSummarize = filesToSummarize.slice(0, summaryLimit);
That's what I'm running locally, patched into dist/sync.js. The extra stat calls cost little next to a summarizer call, and the sort only covers files already queued. A session that's still live keeps moving to the front, but that already happens through copyIfNewer, and a summary that's out of date at the next sync is no worse than having none.
If newest-first shouldn't be the default for everyone, an env var such as EPISODIC_MEMORY_SUMMARY_ORDER=newest|oldest|walk would work too. I don't see a use for walk order, though.
Related
- #188: the backlog turning into a nonstop summarizer loop. With newest first, the sessions that matter get summarized early even while the backlog keeps the loop busy.
- #129: wasted summary quota on sidechain sessions.
- #204: backfill stalling on one long conversation.
A related source of backlog: a review tool that drives Codex non-interactively (roborev, in my case) leaves one short rollout per review. That's 3,120 of my 3,545 Codex rollouts. They're worth keeping in the index, but they don't need summaries. I'm getting around it by writing the empty -summary.txt sentinel beside them, which relies on internal sentinel behaviour. A supported way to keep a session indexed without summarizing it would be a separate issue, and I'm happy to file it if that's useful.
- 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 ·
-
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 ·
-
Sync reads every changed transcript whole in hasConversationContent (1.6 GB for a 507 MB file)Possibly taken @gezerui888 claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
obra/episodic-memory#194 · 2 comments ·
-
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