refreshHost() reduces each changed path to its top folder via topFolderOf()
(remote-hosts.js:84-87) and builds toScan from folders
(remote-index.js:92,114-119). The worker then re-enumerates every .jsonl in
that folder (workers/scan-projects.js:20-25), and readSessionFile() reads
each one whole — fs.readFileSync then split('\n') then JSON.parse per line
(read-session-file.js:167-169,193), with no offset and no incremental path.
Consequence: a 22 MB transcript that gains one line causes that whole file, plus
every other transcript in the same project folder, to be re-read and re-parsed.
For a host with live sessions writing continuously, this is paid every cycle.
It runs in a worker, so the UI does not freeze — the cost is CPU and memory, not
responsiveness.
Scope: make the scan unit the file, or make the parse incremental from the last
known offset. Either changes the cost from proportional-to-folder to
proportional-to-change.
refreshHost()reduces each changed path to its top folder viatopFolderOf()(
remote-hosts.js:84-87) and buildstoScanfrom folders(
remote-index.js:92,114-119). The worker then re-enumerates every.jsonlinthat folder (
workers/scan-projects.js:20-25), andreadSessionFile()readseach one whole —
fs.readFileSyncthensplit('\n')thenJSON.parseper line(
read-session-file.js:167-169,193), with no offset and no incremental path.Consequence: a 22 MB transcript that gains one line causes that whole file, plus
every other transcript in the same project folder, to be re-read and re-parsed.
For a host with live sessions writing continuously, this is paid every cycle.
It runs in a worker, so the UI does not freeze — the cost is CPU and memory, not
responsiveness.
Scope: make the scan unit the file, or make the parse incremental from the last
known offset. Either changes the cost from proportional-to-folder to
proportional-to-change.