Numbers on this card are self-reported by the author's own rtk. rtk verifies nothing.
rtk pipeline add github:aeppling/rtk-pipeline-laya-delegate
rtk shows this pipeline's rules and asks before anything installs, and pins the install to a commit. A pipeline can rewrite the commands your agent runs, filter and replace what it reads, and send content to any upstream it declares — review the rules and install only what you trust. RTK does not review or endorse shared pipelines; the author is responsible for this repo, and you are responsible for what you install.
- before read — delegate -> bulk-read when file_lines_gt=350, score.need_lte=0.65, whole_file=true
- before read — delegate -> bulk-read when class.kind_in=["write", "data"], recent_calls_matches='^(Bash|Read|Grep|Glob) [^|]( | (Bash|Read|Grep|Glob) [^|] )?$'
- before shell — delegate -> investigate when class.kind_in=["write", "data"], command_matches='^(cd [^;&]+(;|&&))?(ls|cat|head|tail|grep|rg|find|tree|pwd|echo|which|wc|file|stat|du|for|while|awk|nl|xxd|git|sed -n)\b', recent_calls_matches='^(Bash|Read|Grep|Glob) [^|] ( | (Bash|Read|Grep|Glob) [^|]*)?$'
- before shell — rewrite -> rtk
- after read — compress [lockfile] when basename_in=["package-lock.json", "Cargo.lock", "yarn.lock", "pnpm-lock.yaml"]
- after shell — compress [term] when is_rtk_command=false
- after search — compress [matches] when format="matches"
- after web — compress [web]
- proxy tool result — compress [ansi, progress, dedup]
No recorded activity yet — run some sessions with this pipeline active, then re-run rtk pipeline share.
#
#
#
#
#
#
schema_version = 1
[pipeline]
name = "laya-delegate"
extends = ["rtk:posthook", "rtk:delegate-reads"]
[upstream.judge]
provider = "laya"
model = "laya"
base_url = "http://127.0.0.1:41733/v1/systemone"
api_key_env = "RTK_LAYA_TOKEN"
timeout_secs = 60
[upstream.haiku]
provider = "anthropic"
model = "claude-haiku-5-5"
timeout_secs = 90
[classifier.need]
upstream = "judge"
question = "score"
instructions = "How much of this file's exact text does the agent need for its next step?"
rubric = ["none: a short summary is enough", "a few exact lines", "most of the file verbatim"]
input_chars = 2000
[classifier.kind]
upstream = "judge"
question = "choice"
instructions = "What kind of work is this coding task?"
input_chars = 2000
min_confidence = 0.0
[classifier.kind.labels]
bug = "find and fix a bug by reading source code closely"
setup = "understand or repair a build, configuration, dependency or environment"
write = "write new code, a script or a port"
data = "analyse data or files and report results"
[task.investigate]
kind = "digest"
upstream = "haiku"
temperature = 0
context = true
[task.bulk-read]
kind = "summarize"
upstream = "haiku"
temperature = 0
context = true
instructions = "You read a file for a coding agent that will NOT see it, only your reply. First answer what the agent needs for its current step, in a few terse lines, with exact identifiers. Then map the file: one line on what it is; every class, function and method with its exact signature, in file order. Then quote verbatim, grouped under the name of the function that contains them, the lines whose exact text the agent would most need for its step (non-obvious arithmetic, constants, conditions, error handling, config values). Never give line numbers. Never paraphrase code you quote. No advice, no headings. End with exactly: (Exact text: grep -n a quoted line, then Read that file with offset and limit, at most 350 lines.)"
[override.shunt-large-read]
enabled = false
[[hook.before_tool.read]]
name = "answer-big-reads"
when = { file_lines_gt = 350, whole_file = true, "score.need_lte" = 0.65 }
action = "route"
task = "bulk-read"
mode = "answer"
[[directive]]
name = "explore-in-subagent"
text = """
When RTK asks you to hand an investigation to the Explore sub-agent, call it on the haiku model (Agent tool: subagent_type "Explore", model "haiku") with one precise question built from the task, ask it for file paths, line numbers and the exact lines you will need, and work from its report instead of repeating its searches.
"""
[[hook.before_tool.shell]]
name = "delegate-investigation"
when = { command_matches = "^(cd [^;&]+(;|&&) *)?(ls|cat|head|tail|grep|rg|find|tree|pwd|echo|which|wc|file|stat|du|for|while|awk|nl|xxd|git|sed -n)\\b", recent_calls_matches = "^(Bash|Read|Grep|Glob) [^|]*( \\| (Bash|Read|Grep|Glob) [^|]*)?$", "class.kind_in" = ["write", "data"] }
action = "route"
task = "investigate"
mode = "suggest"
message = "Do not run this search or open these files yourself: hand the investigation to the Explore sub-agent (Agent tool: subagent_type \"Explore\", model \"haiku\") with one precise question, and ask it for file paths, line numbers and the exact lines you will need. Then work from its report."
[[hook.before_tool.read]]
name = "delegate-investigation-read"
when = { recent_calls_matches = "^(Bash|Read|Grep|Glob) [^|]*( \\| (Bash|Read|Grep|Glob) [^|]*)?$", "class.kind_in" = ["write", "data"] }
action = "route"
task = "bulk-read"
mode = "suggest"
message = "Do not run this search or open these files yourself: hand the investigation to the Explore sub-agent (Agent tool: subagent_type \"Explore\", model \"haiku\") with one precise question, and ask it for file paths, line numbers and the exact lines you will need. Then work from its report."
Measured by rtk v1.0.1 on 2026-10-19.
Install this pipeline: rtk pipeline add <url-of-this-card>