analyze-session.ps1 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. $ErrorActionPreference = 'SilentlyContinue'
  2. $path = 'C:\Users\Administrator\.claude\projects\E--QMAI\282997c5-b3c4-46ce-9c34-e84e039e78a4.jsonl'
  3. $lines = Get-Content $path
  4. $i = 0
  5. foreach ($l in $lines) {
  6. $i++
  7. try { $o = $l | ConvertFrom-Json } catch { continue }
  8. if ($o.type -eq 'user' -and $o.message.role -eq 'user') {
  9. $c = $o.message.content
  10. if ($c -is [array]) {
  11. foreach ($p in $c) {
  12. if ($p.type -eq 'text' -and $p.text) {
  13. $t = $p.text
  14. if ($t -notmatch '^\[Request interrupted' -and $t -notmatch 'tool_result' -and $t -notmatch 'caveat' -and $t.Length -lt 1500) {
  15. if ($t.Length -gt 250) { $t = $t.Substring(0, 250) + '...' }
  16. Write-Output ("[" + $i + "] " + $t)
  17. Write-Output "----"
  18. }
  19. }
  20. }
  21. }
  22. elseif ($c -is [string]) {
  23. if ($c -notmatch '^\[Request interrupted' -and $c.Length -lt 1500) {
  24. $tt = $c
  25. if ($tt.Length -gt 250) { $tt = $tt.Substring(0, 250) + '...' }
  26. Write-Output ("[" + $i + "] " + $tt)
  27. Write-Output "----"
  28. }
  29. }
  30. }
  31. }