Skip to content

Shape the piped output for the program that reads it - #54

Merged
devcodes9 merged 2 commits into
mainfrom
feat/agent-shaped-output
Sep 4, 2026
Merged

Shape the piped output for the program that reads it#54
devcodes9 merged 2 commits into
mainfrom
feat/agent-shaped-output

Conversation

@devcodes9

Copy link
Copy Markdown
Owner

-n and read are the surface a coding agent sees. An agent pays per character for
things 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.

read accepts any unambiguous prefix, and an ambiguous one says how many sessions it
matched 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 read

12k 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 the
next 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.

`-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.
@devcodes9
devcodes9 merged commit 4e74752 into main Sep 4, 2026
6 checks passed
@devcodes9
devcodes9 deleted the feat/agent-shaped-output branch September 4, 2026 18:56
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