Skip to content

Keep assistant prose whole; clamp only user pastes hard - #4

Merged
wilbeibi merged 1 commit into
mainfrom
role-aware-clamp
Jul 22, 2026
Merged

Keep assistant prose whole; clamp only user pastes hard#4
wilbeibi merged 1 commit into
mainfrom
role-aware-clamp

Conversation

@wilbeibi

@wilbeibi wilbeibi commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Problem

The read clamp cut every oversized entry to head 2 KiB + tail 1 KiB. That's the right cut for a user-pasted log or stack trace — the person's own words sit at the edges and the blob sits in the middle. It's exactly the wrong cut for a generated answer, whose tables, numbers, and conclusions sit in the middle.

So a read that pulled another agent's answer into context lost the substance it was fetched for. On a real session:

catchup claude --id <id> --last 1          → 3728 B   (verdict tables elided)
catchup claude --id <id> --last 1 --full   → 4891 B   (the actual answer)

The default was silently dropping the middle 24% of the answer — and the middle was the point.

Change

Key the clamp ceiling on who wrote the entry — the only signal used, no content sniffing:

author ceiling why
user message 4 KiB (unchanged) pasted content; head+tail is the right cut
assistant turn + compaction summary 32 KiB generated prose; render whole

"User gets the low ceiling, everything else gets the high one" also covers the compaction summary — itself generated prose that --since-compact leads with — without a second special case.

Default reads now equal --full for any normal-sized answer; --full remains the escape hatch for a genuine >32 KiB blob.

The one judgment call

32 KiB is a chosen policy threshold, not a derived one, and the comment says so plainly. Above it, an entry is assumed a dumped payload rather than prose, so head+tail becomes the right cut again. It's not tied to a token count or a downstream limit — if fork seeds ever bloat from real usage, that's the evidence to revisit it, not now.

Scope

  • No new flag, no tunable, no user-facing surface — this fixes a wrong default.
  • Applies to both clamp call sites (read path and fork-seed path); the seed's real size guard is still warnTranscriptBytes + the OS argv ceiling, untouched.
  • SKILL.md is not touched, so the drift check is unaffected — this is internal behavior, not a documented verb.

Tests

  • TestClampMax — role → ceiling, including the non-obvious compaction case.
  • TestClampEntries — a mid-sized assistant analysis now renders whole; a >32 KiB assistant blob still clamps; the caller's thread is still not mutated.
  • Full suite + go vet green.

The clamp cut every oversized entry to head 2 KiB + tail 1 KiB — right
for a user-pasted log (own words at the edges, blob in the middle),
exactly wrong for a generated answer whose tables, numbers, and
conclusions sit in the middle. A cross-read into context lost the
substance it was fetched for: on a real session, --last 1 rendered
3728 B against 4891 B of actual answer, the elided middle being the
verdict tables.

Split the clamp ceiling by author, the only signal used: user messages
stay at 4 KiB, while assistant turns and compaction summaries render
whole up to a 32 KiB policy ceiling that still catches a pathological
inline blob. Default reads now match --full for any normal-sized
answer.
@wilbeibi
wilbeibi merged commit b77b2eb into main Jul 22, 2026
1 check passed
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