Skip to content

feat: TTY-aware output density — dense piped output, --pretty/--dense overrides (PGC-102)#16

Merged
jackschultz merged 1 commit into
mainfrom
density
Jun 10, 2026
Merged

feat: TTY-aware output density — dense piped output, --pretty/--dense overrides (PGC-102)#16
jackschultz merged 1 commit into
mainfrom
density

Conversation

@jackschultz

Copy link
Copy Markdown
Owner

Token-efficiency pillar of the agent wedge: humans at a TTY keep decorated tables; piped/captured output auto-densifies — same information, fewer tokens.

  • Density::resolve: --pretty > --dense > stdout.is_terminal(). Flags mutually exclusive; --json untouched.
  • Surfaces: context, capabilities, inspect table (incl. dependents/dependencies), dba triage, sql result tables.
  • Dense = strip decoration (box rules, padding, emoji, blank separators, empty sections), keep every label and datum. Parity asserted by new tests/density_integration.rs (which also pins the pretty path — otherwise CI never exercises it, since test stdout is piped).
  • Measured reduction (bytes): context 37%, triage 35%, inspect table 31%, sql tables 25%, capabilities 18%. Numbers in the ticket.
  • SKILL.md notes the auto-densify behavior.

760 tests green. Review: orchestrator spot-check (risk-gate skip — formatting-only, --json untouched, parity-tested; diff size inflated by rustfmt reflow).

- Built: Density {Pretty,Dense} on the Output layer, resolved once in main from
  stdout.is_terminal() + --pretty/--dense overrides (mutually exclusive, beat
  detection; --json untrumped). Dense renderers for the priority surfaces —
  context, capabilities, dba triage, inspect table (incl. dependents/
  dependencies + sql result tables) — strip box rules, column padding, status
  emoji, blank-line separators, and empty (none) sections. Same labels, same
  information, fewer tokens. SKILL.md notes the auto-densify-when-piped behavior.
- Validation: cargo fmt --check (clean), cargo clippy (lib/bin clean), full
  suite 760 green (748 baseline + 7 density integration + 5 unit). Live: piped
  => dense, TTY (script(1)) => pretty, overrides + --json verified by hand.
- Token reduction (bytes, pretty vs dense, real data): context 37%, dba triage
  35%, inspect table 31%, sql 20-row table 25%, capabilities 18%. Zero info loss.
- Notes: describe.rs diff is large because rustfmt reflowed format! calls when
  branches split; only logic change is density branching. Fixed a self-inflicted
  bug mid-implementation — the partition-size caveat was initially emitted only
  on the pretty path; consolidated stats labels so both forms carry every line.
@jackschultz jackschultz merged commit 805c663 into main Jun 10, 2026
0 of 2 checks passed
@jackschultz jackschultz deleted the density branch June 10, 2026 23:04
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