Shape the piped output for the program that reads it - #54
Merged
Conversation
`-n` and `read` are what a coding agent sees, and an agent pays per character for things a terminal gets for free. Three changes, all behind the same not-a-tty test the colour seam already uses, so a human at a terminal sees exactly what they saw. Session ids shorten to the shortest prefix that still tells every indexed session apart, floored at 12 and snapped to a uuid group boundary. Git's rule. The floor is not cosmetic: Codex writes uuidv7, whose leading bytes are a timestamp, so sessions recorded near each other share 8-char prefixes. On a 741-session corpus 8 collided 36 times and 12 collided none. `read` accepts any unambiguous prefix, and says how many sessions an ambiguous one matched rather than guessing. Column padding goes. Alignment is for eyes tracking a ragged left edge; a pipe pays a token per run of spaces and gets nothing back. Together with the shorter ids that is 5748 bytes down to 5111 on a 20-result search, and a larger cut in tokens, since random hex and space runs are the two densest things on the line. A piped `read` caps at 12k characters, keeping the opening turns and as many closing ones as fit. A session is read to answer what were we doing and where did we stop; those live at the two ends, so the middle is what a too-long transcript can lose. The elision says what it dropped and names `--full`. Your largest sessions render at 1.3MB, so this is the difference between a usable handoff and a blown context window. Result count stays at 20. The 15-query gold list plateaus at 5 (@5 and @20 both 0.933), but the 247-query held-out set does not: @5 0.785, @10 0.858, @20 0.911. Trimming the tail would have been a change fitted to the small hand-labelled set.
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.
-nandreadare the surface a coding agent sees. An agent pays per character forthings a terminal gets for free, so this splits the two behind the same not-a-terminal
test the colour seam already uses. A human at a terminal sees exactly what they saw.
Shorter session ids
The shortest prefix that still tells every indexed session apart, floored at 12 and
snapped to a uuid group boundary. Git's rule.
The floor is not cosmetic. Codex writes uuidv7, whose leading bytes are a timestamp,
so sessions recorded near each other share their first 8 characters. On a 741-session
corpus, 8 characters collided 36 times and 12 collided none.
readaccepts any unambiguous prefix, and an ambiguous one says how many sessions itmatched instead of guessing.
No column padding
Alignment helps eyes track a ragged left edge. A pipe pays a token per run of spaces
and gets nothing back. With the shorter ids, a 20-result search goes from 5748 to 5111
bytes, and further in tokens, since random hex and space runs are the two densest
things on the line.
A capped
read12k characters when piped: the opening turns, and as many closing turns as fit. A
session gets read to answer two questions, what were we doing and where did we stop,
and both live at the ends. The elision names what it dropped and points at
--full.The largest sessions in my corpus render at 1.3 MB, so this is the difference between
a usable handoff and a blown context window.
The output names the next command
One line:
open one: agsearch read <id>. Whoever reads a pipe is a program, and thenext thing it wants is one of these sessions.
What I did not change
The result count stays at 20. The 15-query gold list plateaus at 5 (@5 and @20 both
0.933), which argued for trimming. The 247-query held-out set says otherwise: @5 0.785,
@10 0.858, @20 0.911. Trimming would have been a change fitted to the small
hand-labelled set.
Groundwork for #46.
13 new tests, 128 total.