| 105 | // which is exactly the `parent_tool_use_id` the classifier keys threads on. |
| 106 | // Without that, a delegated search would score as "the agent moved on". |
| 107 | const parseLines = (file, parentToolUseId) => readFileSync(file, 'utf8').split('\n') |
| 108 | .filter(Boolean) |
| 109 | .map((l) => { try { return JSON.parse(l); } catch { return null; } }) |
| 110 | .filter(Boolean) |
| 111 | .map((ev) => (parentToolUseId ? { ...ev, parent_tool_use_id: parentToolUseId } : ev)); |
| 112 | |
| 113 | const events = parseLines(join(projDir, sessionId + '.jsonl')); |
| 114 | if (existsSync(subDir)) { |