Repository navigation
Simplified rtk curl Filter - #1310
Conversation
|
I am working on documentation for this. Apologies. |
|
Hello @JBF1991 RTK rewrite commands transparently, it catch cmd by hooks and then rewrite with rtk. Some implementation use context because hook not available, but in reality, for RTK to be efficient, it should rewrite transparently. For me this fix is not the correct approach since it require LLM to be aware of RTK and add flag. You may want to check https://github.com/rtk-ai/rtk/blob/master/CONTRIBUTING.md#design-philosophy this part of contributing guide. Thanks for the contribution ! If any questions or want to discuss i'm reachable here or on Discord |
d73823b to
c391f4a
Compare
rtk curl Filter
c391f4a to
71baf2b
Compare
|
I have updated to using the tee/hint form from other areas of the project as well as re-updated the docs. |
|
Hey @JBF1991 Sorry for response time, lot of work beside, here is some issues found to be addressed before merging: P0: Data loss when tee is unavailable
P1: Magic number 500 decoupled from
|
|
Hello, rectifying review, for MIN_TEE_SIZE do not reuse from tee you can just define your constant locally it will be better for this purpose; thanks for pointing this out |
|
Added MAX_RESPONSE_SIZE comment. |
Simplified `rtk curl` Filter
Simplified `rtk curl` Filter
Summary
Refactored
rtk curlto use a simple, predictable truncation strategy with tee hints instead of JSON schema conversion. This eliminates edge cases, reduces code complexity by ~36%, and delivers consistent 73-99% token savings across all response types greater than 500 bytes.Test plan
I tested against various local and remote endpoints with responses >500 bytess, <500 bytes and both successful and error responses.
cargo fmt --all && cargo clippy --all-targets && cargo testrtk <command>output inspectedSavings
Tiny JSON — passed through (< 500 bytes)
$ rtk curl -s https://httpbin.org/ip { "origin": "75.143.98.179" }Large API response — truncated + tee hint