Skip to content

Feature request: lossless-only mode + honest account of silent failures truncation causes in agent contexts #1313

Open

Description

@ChrisEdwards

Feature Request: no_truncation = true config flag

RTK's internal architecture already distinguishes between lossless summarization (whitespace stripping, ANSI removal, deduplication, reformatting) and lossy truncation (hard result caps that silently drop data). That distinction is encoded in FilterResult.truncated, FormatMode, and FilterLevel — but it's never surfaced to users.

Request: expose a single config flag that disables all lossy truncation while keeping lossless compression:

[safety]
no_truncation = true

When set, RTK would only apply operations that preserve all facts: strip ANSI codes, collapse blank lines, reformat JSON, deduplicate repeated log lines. It would never hard-cap result counts or truncate line content.


Why this matters: real failure scenarios

These aren't hypothetical. Every one of these can happen silently today with default config.

1. Incomplete git commits (git status capped at 15 modified + 10 untracked)

An AI agent reviews git status output to decide which files to stage. RTK shows 15 modified files — but 20 were actually modified. The agent stages and commits the 15 it can see. The remaining 5 files — potentially including a config change, migration file, or security fix — are silently left out of the commit. No error. No warning. The commit goes out broken.

2. Missed security vulnerabilities in grep results (200 total, 25/file hard cap)

An agent is tasked with finding all usages of a deprecated/vulnerable API pattern across the codebase. grep returns what looks like a complete result set, but RTK has silently capped it at 200 total and 25 per file. The agent updates every match it sees, declares the job done, and ships — with the remaining instances of the vulnerable pattern still in production code.

3. Approved diffs with hidden changes (diff capped at 10 changes/file, hunks at 100 lines)

An agent performs a pre-commit review of a diff. RTK shows 10 changes per file. There are actually 25. The agent approves the diff having never seen the other 15 changes — which might include a logic error, a hardcoded credential, or a broken test. The ... +15 more marker is easy to miss or ignore.

4. Missing breaking change notices in git log (commit body truncated to 3 lines)

An agent analyzes commit history to understand a change before cherry-picking or reverting it. The commit body contains a BREAKING CHANGE: notice, a required migration step, or a known caveat — but it's on line 4 or later. RTK drops it. The agent proceeds without the context it needed, causing a broken deployment or missed migration.

5. Incomplete API schema inference from curl (30 lines, 200 chars/line)

An agent calls an API endpoint to understand its response structure and generate client code. The response has 50 fields. RTK shows 30. The agent generates a model/interface that handles those 30 fields — missing pagination metadata, error shapes, or required fields. The generated code silently fails at runtime on responses that include the truncated fields.

6. Wrong validation logic from truncated JSON (arrays after 5 items, objects after 20 keys)

An agent reads a JSON config or schema file containing an enum of valid values: ["admin", "editor", "viewer", "moderator", "guest", "readonly", "api", "webhook", "service", "auditor", "superuser", "owner"]. RTK shows [admin, editor, viewer, moderator, guest, ... +7 more]. The agent generates validation code that only accepts the 5 visible values and rejects the other 7 as invalid. Users with those roles start getting access denied errors.

7. Silent grep misses in multi-file refactors (25/file cap)

An agent is renaming a function across a large codebase. A heavily-used file has 40 call sites. RTK shows 25. The agent updates the 25 it can see and considers the rename complete. The other 15 call sites in that file still reference the old name. The codebase no longer compiles.


Common thread

In every case: RTK provides no indication that results are incomplete when it would matter most. The ... (N more) messages are easy to treat as cosmetic. An agent has no way to know it's working with a partial picture.

Lossless summarization — stripping noise, collapsing whitespace, reformatting — is genuinely valuable in agent contexts. Hard result caps are not. The fix is to let users opt into lossless-only mode.

Suggested implementation

# ~/.config/rtk/config.toml  (or platform equivalent)
[safety]
no_truncation = true   # disable all lossy caps; lossless compression still applies

Commands that currently have FilterResult.truncated = true paths would skip those paths when this flag is set. The FormatMode / FilterLevel pipeline stages that only reformat (not drop) would continue working normally.

Environment

  • RTK version: 0.36.0
  • OS: macOS 24.6.0
  • Use case: AI coding agent (Claude Code)

Activity

  1. ChrisEdwards commented on Apr 14, 2026

    @ChrisEdwards
    Author

    Correction: most truncations do emit indicators

    After digging into the source more carefully, I need to correct the framing in the original report. Most commands do emit truncation markers:

    Command Indicator emitted
    curl ... (N more lines, X bytes total) — clear
    grep ... +N per file and total — clear
    json [first, ... +N more] / ... +N more keys — inline, easy to skim past
    git status ... +N more at end of each section
    git log body [+N lines omitted] — weak, looks like a note
    git log count NO indicator when capped at default 10 commits
    diff (file path) No truncation at all — this was a misread in my original audit

    So the scenarios I described as "silent" are mostly not silent — the ... +N more marker is there.

    The actual problem is different and arguably worse: the indicators exist, but they don't stop anything. An AI agent reads output, synthesizes it, and proceeds. Seeing ... +47 more grep results doesn't cause the agent to refuse to act — it notes it and moves on, potentially treating what it saw as sufficient. The truncation marker is informational, not a hard stop.

    The git log commit count cap (default 10, no indicator) is the one genuinely silent case.

    The feature request still stands — a no_truncation = true mode that removes hard caps entirely is cleaner than relying on agents to correctly handle overflow markers. But the failure mode is agents proceeding on partial data with awareness they couldn't act on, not agents being completely unaware data was dropped.

    Sorry for the overstatement in the original report.

  2. RKelln commented on Apr 16, 2026

    @RKelln

    Hi @ChrisEdwards — I've implemented the no_truncation flag you described here. It's running in my fork at RKelln/rtk on the feature/no-truncation branch (5 commits on top of v0.36.0).

    What it does:

    [limits]
    no_truncation = true
    • When enabled, all lossy truncation is bypassed: TOML filter stages 6-7 (head/tail, max_lines), git status file caps, grep per-file caps, cargo build/test/clippy error caps, lint issue caps, passthrough char limits
    • Lossless operations are unaffected: ANSI stripping, dedup, regex substitution, line-width formatting
    • Startup warning when the flag is active and custom limits are also set (since they'd be ignored)
    • 12 new tests covering the flag, all 1459 tests passing

    Guarded truncation sites:

    Handler What's guarded
    TOML filter pipeline stages 6 (head/tail_lines) and 7 (max_lines)
    git status status_max_files, status_max_untracked
    grep grep_max_per_file
    cargo build/install error cap (was hard-coded to 15)
    cargo test failure cap (was 10) + line truncation (was 200 chars)
    cargo clippy error block cap (was 10), rule cap (was 15), location cap (was 3), line truncation (was 160 chars)
    ruff / golangci / lint passthrough_max_chars
    parser passthrough truncate_passthrough()

    I placed the flag in [limits] rather than a new [safety] section since that's where all the caps it controls already live.

    I'd appreciate any feedback before submitting this upstream as a PR. In particular:

    1. Does the scope match what you had in mind?
    2. Any truncation sites I missed that bit you in practice?
    3. Is no_truncation the right flag name, or would you prefer something like lossless_only?

    Happy to iterate based on your real-world experience with agent workflows.

  3. ChrisEdwards commented on Apr 16, 2026

    @ChrisEdwards
    Author

    So, the motivation for this feature was the revelation that rtk not only filters out noise, it also truncates the signal. This config flag turns off truncation of the signal. Those are two very different things. In a test run, noise is all the passing test details, blank lines and other stuff. The signal is the test failures, and possibly the aggregate of numbers of tests passed, etc. No one is going to complain if you remove all that noise, but if there are 3 failing tests, the expectation is that you will see all three failing tests. Truncating that is unexpected, and rtk does it (albeit mabye not for tests, but for other things). This flag would turn that off, but keep the token-saving noise reduction.

    So the heuristic is, If this filters noise, compresses the signal (aggregation/dedup), but does not lose the signal, its allowed when this flag is on. Anything that removes signal (even if it adds a note that its removed) is disallowed when this flag is on. The agent should not have to call again to get the full signal when this flag is on.

    I hope this helps.

    I was surprised to learn that rtk truncated the actual signal. I never expected that. I guess it makes sense from a token persepective, but then if the agent needs to make ANOTHER call to get the rest of the signal, it actually uses MORE tokens...defeating the purpose. Since rtk already does this, I think having a feature flag to turn that off makes total sense.

  4. ChrisEdwards commented on Apr 17, 2026

    @ChrisEdwards
    Author

    It looks like what you implemented in your branch is what I asked for. Thank you. It looks well thought-out too.

  5. yadue commented on Apr 17, 2026

    @yadue

    @RKelln I believe that cli flag would be useful too (i.e., for stateless pipelines).

  6. added
    effort-medium
    enhancement
    filter-quality
    on Apr 17, 2026
  7. pszymkowiak commented on Apr 17, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟠 Priority high
    🎯 Confidence 92%

    Summary

    Request for a no_truncation = true config flag to disable lossy hard caps while preserving lossless compression, with detailed failure scenarios showing how silent truncation causes agent errors.


    Triaged automatically by wshm · This is an automated analysis, not a human review.

  8. noctuid commented on Apr 17, 2026

    @noctuid

    It looks like rtk also removes warnings for some commands @RKelln Does your branch address that as well? Should this be thought about completely separately? Removing warnings is still lossy behavior that I'd like to avoid.

  9. RKelln commented on Apr 18, 2026

    @RKelln

    I wasn't aware of the warnings, can you give some examples? Probably would be a separate PR but good to think about how it might be structured with this.

    I have a new patch coming, with --lossless cli flag but discovered a bunch more lossy truncation in testing that needs to be dealt with. Thanks for the extra eyes on this folks.

  10. noctuid commented on Apr 18, 2026

    @noctuid

    I heard other people mention it removing unused variable warnings, and the first showcase on the website shows it removing warnings like that from cargo test.

  11. 1 remaining item

  12. RKelln commented on Apr 23, 2026

    @RKelln

    Community review request: fork is up to date, would love eyes before upstream PR

    The fork (RKelln/rtk · feature/no-truncation) is now fully up to date. Planning to put together a proper upstream PR but would love community feedback first — especially on scope and the longer-term design direction.

    What's in the branch

    --lossless flag + lossless = true config — disables all lossy output caps while keeping lossless operations (ANSI strip, dedup, reformat). Addresses the core request in this issue. The flag works per-invocation (rtk --lossless git status) or persistently via config — which I believe also covers @yadue's stateless pipeline use case.

    Full cap audit — went through every .take(N) site in the codebase (47+ across 20+ files). Every lossy cap is now guarded so --lossless actually means what it says. Non-lossy sites (summarization stats, display truncation, internal pipeline) are annotated so the distinction is auditable. A pre-commit script enforces this going forward.

    Warning suppression (@noctuid) — out of scope for this PR, but agree it's the same class of problem (lossy filtering of signal). Worth a separate issue/PR once this lands.

    Try it

    cargo install --git https://github.com/RKelln/rtk --branch feature/no-truncation

    Longer-term design discussion

    While doing the audit it became clear the magic numbers problem is worth thinking through properly. Wrote up a design proposal in PLAN.md — the short version:

    The hard-coded caps are essentially vibes — and consistently so. They cluster by density intent rather than command: ~3 for tight context (stack traces), ~5 for focused attention (failures), ~10 for pattern recognition (files, rules), ~20 for inventory browsing (env vars, deps).

    A few/some/many/lots vocabulary in code + a user config that's a personal density contract would make this auditable and tunable without magic numbers anywhere:

    [caps]
    few  = 3
    some = 8    # I like more context than default
    many = 15
    lots = 25
    
    [caps.overrides.rspec]
    density = -1    # rspec is verbose, one notch less than whatever rtk chose
    # -- or --
    count = 3       # exactly 3, I know what I want

    Not proposing to land all of that in the first PR — just want to flag the direction so the --lossless implementation doesn't paint us into a corner. Happy to hear whether this resonates or if there's a simpler approach upstream prefers.

    Full design notes (including rtk caps --audit for human calibration of defaults): PLAN.md

  13. shanoaice commented on May 6, 2026

    @shanoaice

    Wonder whether it is possible to tune truncation on a per-command or per-category basis? Sometimes it is just a few commands that needs to be excluded and produces lossless output.

  14. Yohjisakamoto commented on Jul 22, 2026

    @Yohjisakamoto

    Your lossless-mode and silent-failure proposal raises the same measurement question: DeepSWE found Tura cuts coding-agent rounds by 89% and total token cost by 80%, while I/O-only compression has limited end-to-end impact; would you evaluate the methodology? https://turaai.net/docs#benchmark-current-test-set-record

  15. sanchpet commented on Aug 31, 2026

    @sanchpet

    A measured data point for this, from three weeks of agent use with the Bash hook enabled, in case production numbers help the case.

    From rtk's own history.db: 203 of 1573 rtk read calls dropped content. The largest returned 44 tokens out of 387373; a 104 KB Markdown file came back as 2178 of 26108, and the agent went on to work from it. The remaining 1370 reads saved exactly nothing, so the read filter's entire contribution to the "3.3M tokens saved" headline — 2.65M of it, ranked top by Impact — is truncation. The ledger presents the loss as the tool's main achievement.

    What makes this fixable rather than inherent is that the same binary already gets it right elsewhere. grep gave 25 of 100 matches, find 52 of 300, jq 42 of 300 — and each printed the true total, the number withheld, and a tail command recovering the rest from a tee log. read writes no tee log at all, and a bare git log stops at 50 of 469 commits with no marker (#1296, #2204). An explicit -n is honoured exactly, which suggests the caps, not the filters, are the thing to surface.

    So no_truncation would help, but even without it, applying the existing notice-and-tee convention to read and to unbounded git log would remove the silent cases. Reporting rather than requesting: we have removed the hook and now call rtk explicitly for the filters that announce their truncation.

    Assisted-By: Claude [email protected]

  16. Ezechis commented on Sep 4, 2026

    @Ezechis

    Hey — your lossless-mode proposal on #1313 is exactly the kind of thing I've been looking into. Trying to understand how much people actually worry about silent truncation/corruption in these tools versus just living with it. Open to 2-3 quick questions on that?

  17. ChrisEdwards commented on Sep 5, 2026

    @ChrisEdwards
    Author

    I stopped using RTK because of this. It was truncating information that was needed. After the third time I wasted cycles troubleshooting an issue only to discover it was caused by RTK truncating data the agent needed, I uninstalled it.

    I think there is a lot of value in this tool, but there is too much risk in it over-truncating and my agents missing important info. I just can't take that risk anymore.

  18. ChrisEdwards commented on Sep 5, 2026

    @ChrisEdwards
    Author

    This issue is STILL open and under debate after 5 months. There is no debate. You truncate the signal, your tool has failed. And it has. We asked everyone in our company to cease using it months ago.

  19. Ezechis commented on Sep 21, 2026

    @Ezechis

    Really appreciate you laying that out — that's exactly the kind of failure I was trying to understand. Two follow-ups: is silent truncation still happening on the latest version, or was that a version you've since moved off? And separately — if RTK actually guaranteed lossless output (no truncation, ever), would that be enough to bring it back for you or your team, or is trust already too far gone at this point?

  20. ChrisEdwards commented on Sep 22, 2026

    @ChrisEdwards
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:configeffort-mediumenhancementfilter-qualityhelp wantedpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions