Skip to content

fix: dogfood friction — trace truncation, view pipes and indent, content search - #32

Merged
lroolle merged 7 commits into
mainfrom
fix/dogfood-friction-20260802
Aug 3, 2026
Merged

fix: dogfood friction — trace truncation, view pipes and indent, content search#32
lroolle merged 7 commits into
mainfrom
fix/dogfood-friction-20260802

Conversation

@lroolle

@lroolle lroolle commented Aug 3, 2026

Copy link
Copy Markdown
Member

Four flaws hit during real topic-mining across the session store, plus follow-ups from a two-axis (standards/spec) review.

Fixes

  • trace: --full/--turn capped sidechains[].summary at 240 runes; for research sessions the subagent final report IS the value. Top-level sidechain entries now carry the whole (ANSI-stripped) report; step-level refs stay bounded, keyed by agent_id.
  • view: new --color=auto|always|never (auto = stdout is a TTY, stdlib-only detection). Session content is also scrubbed of embedded escapes/control bytes in every mode — piped output greps clean without -a.
  • view: sequential messages no longer nest ever-deeper (linear sessions drifted 400+ columns right); indent now marks only real branch descent.
  • search: new --content streams transcript lines of every candidate session plus its subagent files (grep parity: raw-line match, unbounded line reads so image-carrying lines can't silently drop matches), ranked by hit count, composing with date/provider filters. Truncated result lists say so on stderr.

Verification

  • Fixture research session (3 sidechains, 8.5k-line view): trace summary lengths went [243,243,242][33258,21629,32984]; piped view greps its topic terms with zero escape bytes; max indent 5 spaces; --content finds sessions raw grep finds across 15+ projects.
  • go test ./... green (15 packages); new tests cover the truncation contract, content-scan parity (incl. >10MB lines, agent- prefix parity), and content sanitization.

Known deferrals

  • File-based subagent transcripts parse as extra roots, so view shows sidechains flat after the main chain; correct nesting needs a parser tree change (affects turns/web) — separate issue.
  • --content is a ~15s full-store crawl; an FTS index would make it a query — separate issue.

🤖 Generated with Claude Code

lroolle and others added 7 commits August 2, 2026 22:38
--full and --turn capped sidechains[].summary at 240 runes; for
research sessions the subagent final report is the value, so the
complete bundle was incomplete exactly where it mattered. The
top-level sidechains list now carries the untruncated (ANSI-stripped)
report; step-level entries stay bounded light refs keyed by agent_id.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two terminal-render fixes from the same dogfood report:

- ANSI codes were emitted unconditionally, so piped output read as
  binary to grep (silent false-negatives without -a). New
  --color=auto|always|never; auto follows whether stdout is a TTY
  via os.ModeCharDevice — stdlib only, no isatty dependency.

- Every message nested one level under its parentUuid predecessor,
  so long linear sessions drifted 400+ columns right. Sequential
  messages are siblings; depth now increments only on branch descent
  (main -> sidechain, agent -> other agent).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Search covered names, paths, and summaries only; content questions
fell back to raw grep over the store, losing session identity,
provider abstraction, and date filters. --content streams each
candidate session file plus its subagent files (grep parity: raw-line
match, no parse, any provider format), ranks by hit count, and
composes with --after/--before/-p/--model. A crawl for now — the db
stores stars/tags only; a content index is the follow-up.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review follow-up: --color=never silenced ccx's own ANSI, but tool
results are untrusted terminal input — escapes and control bytes
embedded in session content still leaked, retitling windows and
flipping grep to binary. All content now passes sanitizeContent
(SGR/OSC sequences and stray control bytes dropped, \n and \t kept)
in every color mode.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review follow-ups on the content scan:
- bufio.Reader with unbounded line reads replaces the 10MB Scanner:
  image-carrying transcript lines exceed any fixed budget, and the
  silent early stop was the false-negative class --content exists
  to kill. Unreadable files warn on stderr instead of lying 0.
- Truncated result lists say so on stderr (no silent caps).
- Subagent layout knowledge moves to parser.SubagentFiles (agent-
  prefix parity with what view --show-agents actually renders);
  contentMatches renamed countContentMatches; stable sort.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Keep a Changelog wants one heading per category — the dogfood entries
now share the existing Added/Fixed sections. stripANSI extracted for
the two strip sites in trace. Devlog records the review follow-ups
and the known deferral (file-based sidechains render flat; correct
nesting needs a parser tree change, tracked separately).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lroolle
lroolle merged commit 5b5ed79 into main Aug 3, 2026
2 checks passed
@lroolle
lroolle deleted the fix/dogfood-friction-20260802 branch August 3, 2026 06:55
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