Ir al contenido

Methods

Esta página aún no está disponible en tu idioma.

A method transforms one block of text. Rules chain them with use = [...]; the chain is checked at load so a method never receives a format it cannot handle, and a method marked terminal (toon) is only accepted last.

rtk methods list prints this table.

MethodLossyRecoveryRuns under proxy.requestWhat it does
ansinotool_result (normalize)strip escape sequences
progressyesrtk recall (hook site)tool_result (normalize)keep only the last frame of \r-animated output
dedupnotool_result (normalize)collapse ≥3 identical adjacent lines to [xN]
base64-elideyesnone — value-free blobstool_resultreplace long base64 runs with a size note
capyesrtk recall <hash>no — needs recallover 300 lines: keep head 50 + tail 200; full output stored
toonyesterminal · rtk recall (hook site)no — needs recalluniform array of flat objects → TOON; else minified JSON
minify-jsonyesrtk recall (hook site)no — needs recallcompact re-serialisation
web-mdnotool_resultHTML → markdown
md-slimyesnone — read-noisetool_resultdrop badges, comments, blank runs; keeps link URLs
grep-groupyesrtk recall (hook site)no — needs recallgroup path:line:content matches by file; every match kept
lockfileyesnonetool_resultlockfiles → name@version list
strip-line-numbersyesnone; ships offtool_result (normalize)remove line-number prefixes from file reads
truncateyesrecallno — needs recallstructural line cap (not in any shipped chain)
shapeyesrecallno — needs recallnormalize → classify layout → per-shape render
rleyesrtk recall (hook site)no — needs recallrun-length collapse of adjacent identical lines

Every lossless method is idempotent, so a block reaching both a hook rule and a proxy rule is never damaged; every lossy method marks its output, and the proxy skips blocks already marked. Methods marked “needs recall” are skipped under proxy.request because the daemon cannot store the recall copy — see What the Proxy Compresses.

Implemented in the RTK Proxy only.

MethodLossyRecoveryRuns under proxy.requestWhat it does
cache-alignnocacheplace the cache breakpoint; no-op if the client set one
ccryesrtk_retrievetool_resultcompress a large tool result already in the conversation to a preview and a marker the model can expand — opt-in
retire-pointeryesthe file on disk, rtk_retrievetool_usereplace a file body echoed through a write argument with a pointer to the file — opt-in

Naming it under hook.* leaves the chain without it, so the rule fires as a no-op. validate reports W011, and W012 when that empties the rule completely; rtk pipeline show marks the rule (inert: proxy-only).

Chains — shipped composites, usable anywhere a method is

Section titled “Chains — shipped composites, usable anywhere a method is”
Chain=
termansi progress dedup base64-elide cap
jsonbase64-elide toon
webansi base64-elide web-md toon md-slim
matchesgrep-group
[method.gentle]
chain = ["ansi", "dedup"]
[[hook.after_tool.shell]]
name = "gentle-term"
use = ["gentle"]

Chains are also composed directly in rules — use = ["ansi", "cap"] runs one then the other. Order is yours and is checked.

Custom command filters live where they always have: ~/.config/rtk/filters.toml (macOS ~/Library/Application Support/rtk/filters.toml) and .rtk/filters.toml in a project. Nothing about them changes in v1.0 — same keys, same inline tests, same rtk verify.

schema_version = 1
[filters.mytool]
description = "Output of my internal deploy tool"
match_command = "^mytool\\b"
strip_ansi = true
strip_lines_matching = ["^\\[INFO\\]", "^Downloading "]
max_lines = 200
on_empty = "(no output)"
[[tests.mytool]]
name = "strips info"
input = "[INFO] x\nreal line"
expected = "real line"

Then run rtk trust once. Filter files are trust-gated because they rewrite what your agent sees; an untrusted (or edited-since-trust) file is skipped.

For a command RTK has no filter for, the rtk-rewrite rule rewrites mytool deploy → rtk mytool deploy (it consults every filter’s match_command), and rtk mytool deploy runs the real command and applies your filter. Filters are the rewrite’s business: they are not methods and do not appear in use, and the pipeline file does not define them (E016). The decision log and rtk pipeline explain --last show the rewrite that happened.

A [method.*] composes existing methods; a plugin adds a genuinely new transform — or a new task kind — written in Rust and built into your rtk. It then resolves by name in use = [...] like any built-in.