Skip to content

feat: harden recap cleaning and skip redundant agent recaps#6

Open
jms830 wants to merge 1 commit into
Fornace:mainfrom
jms830:feat/recap-quality
Open

feat: harden recap cleaning and skip redundant agent recaps#6
jms830 wants to merge 1 commit into
Fornace:mainfrom
jms830:feat/recap-quality

Conversation

@jms830

@jms830 jms830 commented Jun 17, 2026

Copy link
Copy Markdown

What

Two small, default-on recap-quality improvements, both inspired by patterns in the minimal Dovyski/pi-recap extension, 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:

  • one leading list/enumeration marker (- , * , 1., 2))
  • a Recap: / Title: / Summary: label prefix
  • surrounding quotes/backticks
  • collapsed internal whitespace

Bare leading digits (e.g. 3 files changed) are preserved — only 1./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_end can 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 on session_shutdown. Goal derivation is unaffected.

Notes

  • Both changes are default-on and behavior-preserving for the normal path.
  • 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.
  • tsc --noEmit is clean.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant