zot/internal/agent/tools
patriceckhart f5719c6be1 perf(read): drop line numbers from model-facing output
The read tool used to prefix every line with '%6d\t' (6-digit
line number + tab), which added ~7 bytes / ~2 tokens per line to
every read. On typical source files that's 15-20% of the read's
token budget, repeated on every subsequent turn as the tool
result stays in context.

The line numbers weren't earning their keep: the model edits via
exact-match text replacement, never line ranges, and the tui has
always been capable of drawing its own gutter. Now it does:

- Tool output is raw file bytes, no prefix.
- A 'start_line' detail is attached to the ToolResult so the tui
  knows where to start counting.
- The tui renders a synthetic gutter over the raw content using
  the existing renderNumberedFile path (new: renderRawFile), so
  on-screen it still looks exactly like cat -n.

The old numbered format is still recognised for legacy transcripts
saved before this commit (looksLikeNumberedFile guard stays).

Measured: sample.ts (388 lines) used to cost 14957 bytes to send,
now costs 12291 bytes (raw file). Saves ~670 tokens per read of a
medium file; the same fraction applies to larger files too.

Tests: TestReadOffsetLimit rewritten to assert raw output +
start_line detail. TUI renderToolText signature grew one int
(startLine) plumbed through renderToolResultContent.
2026-04-19 17:33:05 +02:00
..
bash.go initial commit 2026-04-17 20:36:38 +02:00
edit.go initial commit 2026-04-17 20:36:38 +02:00
read.go perf(read): drop line numbers from model-facing output 2026-04-19 17:33:05 +02:00
sandbox.go initial commit 2026-04-17 20:36:38 +02:00
sandbox_test.go initial commit 2026-04-17 20:36:38 +02:00
tools_test.go perf(read): drop line numbers from model-facing output 2026-04-19 17:33:05 +02:00
write.go initial commit 2026-04-17 20:36:38 +02:00