feat: harden recap cleaning and skip redundant agent recaps#6
Open
jms830 wants to merge 1 commit into
Open
Conversation
Two small, default-on recap-quality improvements:
- cleanRecap(): normalize wrappers models sometimes add around the recap
line - one leading list/enumeration marker (dash, "1.", "2)"), a
"Recap:"/"Title:"/"Summary:" label prefix, surrounding quotes/backticks,
and collapsed internal whitespace. Bare leading digits ("3 files
changed") are preserved; only enumeration markers are stripped.
- agent_end: skip the agent recap when the last assistant reply is empty
(nothing to summarize) or identical to the one already recapped
(agent_end can re-fire). Avoids burning a model call for the same line.
Tracked per session and cleared on session_shutdown. Goal derivation is
unaffected.
index.js is regenerated from index.ts via tsc; the diff therefore also
re-syncs a bench-CSV-validation section that had drifted from index.ts on
main.
jms830
pushed a commit
to jms830/pi-recap
that referenced
this pull request
Jun 26, 2026
# Conflicts: # index.js # index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two small, default-on recap-quality improvements, both inspired by patterns in the minimal
Dovyski/pi-recapextension, adapted to this codebase.1. Harden
cleanRecap()(subagent/recap.ts)Models occasionally wrap the recap line in junk. The existing cleaner strips code fences and takes the first non-empty line; this adds normalization for the common wrappers:
-,*,1.,2))Recap:/Title:/Summary:label prefixBare leading digits (e.g.
3 files changed) are preserved — only1./2)-style enumeration markers are stripped. The 100-char cap is unchanged. Verified with a 14-case table including the digit-preservation edge case.2. Skip redundant agent recaps (
index.ts,agent_end)agent_endcan re-fire, and a turn can end with no new natural-language reply. Re-summarizing identical (or empty) assistant text just burns another model call for the same status line. This adds a per-session guard keyed on the last assistant reply text; the recap call is skipped when the key is empty or unchanged from the last successfully-recapped turn. State is cleared onsession_shutdown. Goal derivation is unaffected.Notes
index.jsis regenerated fromindex.tsviatsc; the diff therefore also re-syncs a bench-CSV-validation section that had drifted fromindex.tsonmain.tsc --noEmitis clean.