Size: 2.0 KB Modified: 20/05/2026 3:08 AM
$srcDir = "g:\My Drive\Misc\The Chat Files\Extracted The Chat Parts"
$outputDir = "g:\My Drive\Misc\The Chat Files\Handoffs"
if (-not (Test-Path $outputDir)) { New-Item -ItemType Directory -Path $outputDir -Force | Out-Null }

# Additional handoffs to extract:
# Part 2.txt ~6240: Part 1+2 summary for Part 3
# Part 5.txt ~37: Part 4 summary for Part 5
# Part 5.txt ~4267: Part 5 summary for Part 6
# Part 6.txt ~: Part 6 summary for Part 7
# Part 7.txt ~5111: Part 7 summary for Part 8
# Part 9.txt ~7175: Part 9 summary for Part 10
# Part 10.txt ~5830: Part 10 summary for Part 11
# Part 13.txt ~411: Part 13 summary for Part 14

$additional = @(
    @{src="The Chat Part 2.txt"; start=6240; out="Handoff - Part 1 2 Summary.md"},
    @{src="The Chat Part 5.txt"; start=37; out="Handoff - Part 4 Summary.md"},
    @{src="The Chat Part 5.txt"; start=4267; out="Handoff - Part 5 Summary.md"},
    @{src="The Chat Part 7.txt"; start=5111; out="Handoff - Part 7 Summary.md"},
    @{src="The Chat Part 9.txt"; start=7175; out="Handoff - Part 9 Summary.md"},
    @{src="The Chat Part 10.txt"; start=5834; out="Handoff - Part 10 Summary.md"},
    @{src="The Chat Part 13.txt"; start=411; out="Handoff - Part 13 Summary.md"}
)

foreach ($h in $additional) {
    $lines = Get-Content (Join-Path $srcDir $h.src) -Encoding UTF8
    $startIdx = $h.start - 1
    $endIdx = $lines.Count - 1
    for ($i = $startIdx; $i -lt $lines.Count; $i++) {
        $line = $lines[$i]
        if ($i -gt $startIdx -and ($line -match '^\[(human|assistant)' -or $line -match '^-{10,}')) {
            $endIdx = $i - 1
            break
        }
    }
    Write-Output "$($h.src) : line $($h.start) to $($endIdx + 1)"
    $content = $lines[$startIdx..$endIdx] -join "`n"
    $content = $content.TrimEnd()
    $outPath = Join-Path $outputDir $h.out
    Set-Content -Path $outPath -Value $content -Encoding UTF8
}

Write-Output "Done extracting additional handoffs."
Get-ChildItem $outputDir | Select-Object Name, Length | Sort-Object Name | Format-Table -AutoSize
Offline