From 421bff8f7397a379922d76945ceb08dc97e55251 Mon Sep 17 00:00:00 2001 From: Pierre Martin Date: Mon, 23 Mar 2026 21:21:31 +0100 Subject: [PATCH] fix: read 200 tail lines to find preview through progress noise Claude Code emits many progress lines during work, burying the last assistant text. 5 lines was not enough to reach it. Co-Authored-By: Claude Opus 4.6 (1M context) --- session.go | 2 +- state.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/session.go b/session.go index 4dd81cc..197a861 100644 --- a/session.go +++ b/session.go @@ -188,7 +188,7 @@ func FindSessionForProcess(claudeDir string, proc Process) (string, []JSONLMessa }) newest := topLevel[0] - messages, err := TailReadJSONL(newest, 5) + messages, err := TailReadJSONL(newest, 200) if err != nil { return "", nil, err } diff --git a/state.go b/state.go index 5cf1035..2fc520e 100644 --- a/state.go +++ b/state.go @@ -63,8 +63,8 @@ func DetectState(messages []JSONLMessage, now time.Time) SessionState { return Unknown } -// ExtractPreview finds the last assistant text content and returns the first -// 5 lines, truncated to 300 characters. +// ExtractPreview finds the last assistant text content and returns +// the first 5 lines, truncated to 300 characters. func ExtractPreview(messages []JSONLMessage) string { for i := len(messages) - 1; i >= 0; i-- { msg := messages[i]