From 20227ebb5d5f4a5661728ec8d8f57fce61430414 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 23 Sep 2026 16:08:01 -0400 Subject: [PATCH] fix(plugin): recent-context cap counts text, and an empty transcript is not a failure (#4364) The trailing newline became a space before the 600-char cut, so the cap kept 599 characters of text; and under pipefail a grep that matched no reply made the helper exit 1. Trim before cutting; return 0 explicitly. Co-Authored-By: Claude Opus 5.5 --- plugin/.claude-plugin/plugin.json | 2 +- plugin/hooks/scribe_defs.sh | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/.claude-plugin/plugin.json b/plugin/.claude-plugin/plugin.json index a1620ce..5ec389c 100644 --- a/plugin/.claude-plugin/plugin.json +++ b/plugin/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "scribe", "description": "Scribe for Claude Code: connects the scribe MCP server, adds the hooks that deliver live project state and relevant records at the right moment, ships the shared client-neutral Scribe skills (using-scribe, writing-plans, reporting-back, systematic-debugging, verification, brainstorming, reusing-code, shape-accounting), and syncs your saved Scribe Processes as skills (/scribe:sync).", - "version": "2026.09.23.2007", + "version": "2026.09.23.2008", "author": { "name": "Bryan Van Deusen" }, diff --git a/plugin/hooks/scribe_defs.sh b/plugin/hooks/scribe_defs.sh index 661d58a..675cfab 100644 --- a/plugin/hooks/scribe_defs.sh +++ b/plugin/hooks/scribe_defs.sh @@ -151,7 +151,10 @@ scribe_recent_context() { ' 2>/dev/null \ | scribe_json_unescape \ | tr '\n\t' ' ' \ - | awk '{ n = length($0); print (n > 600 ? substr($0, n - 599) : $0) }' + | awk '{ sub(/[ ]+$/, ""); n = length($0); if (n) print (n > 600 ? substr($0, n - 599) : $0) }' + # A transcript with no reply yet is an answer ("nothing"), not a failure — + # under pipefail the grep that matched nothing would otherwise be the status. + return 0 } # $1 flat text, $2 exact path → the decoded scalar, or "" if absent.