feat: TTY-aware output density — dense piped output, --pretty/--dense overrides (PGC-102)#16
Merged
Conversation
- 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.
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.
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;--jsonuntouched.context,capabilities,inspect table(incl. dependents/dependencies),dba triage,sqlresult tables.tests/density_integration.rs(which also pins the pretty path — otherwise CI never exercises it, since test stdout is piped).760 tests green. Review: orchestrator spot-check (risk-gate skip — formatting-only, --json untouched, parity-tested; diff size inflated by rustfmt reflow).