Keep assistant prose whole; clamp only user pastes hard - #4
Merged
Conversation
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.
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.
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:
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:
"User gets the low ceiling, everything else gets the high one" also covers the compaction summary — itself generated prose that
--since-compactleads with — without a second special case.Default reads now equal
--fullfor any normal-sized answer;--fullremains 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
warnTranscriptBytes+ the OS argv ceiling, untouched.SKILL.mdis 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.go vetgreen.