Skip to content

feat!: RTK v1.0 — pipelines and LLM proxy - #4550

Merged
aeppling merged 11 commits into
developfrom
feat/v1.0
Oct 13, 2026
Merged

aeppling merged 11 commits into
developfrom
feat/v1.0

Conversation

@aeppling

@aeppling aeppling commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RTK v1.0: pipelines and LLM proxy

RTK has always filtered the output of the commands your agent runs. v1.0 lets you decide what happens to every tool call, and adds an optional proxy that trims what your agent sends to the model.

Nothing changes when you upgrade. If you don't write a pipeline, RTK behaves exactly as it does today: same hook, same rewrites, same filters.

Pipelines

A pipeline.toml file holds rules that act on your agent's tool calls, before or after they run:

  • Deny a command, with a message your agent reads, for example to block git push --force.
  • Route heavy work to a cheaper model: large reads, long logs, a file to generate. Your agent gets the result without the tokens.
  • Compress what comes back, by chaining built-in methods on top of RTK's filters.
  • Judge a call or an output with a small model (for example Laya), and act on its verdict.

Start from a ready-made pipeline in examples/pipelines/, or run rtk pipeline add. rtk pipeline validate, show and status tell you what is active and why. Pipelines can be shared and installed from GitHub.

Works with Claude Code, Cursor, Codex, Gemini CLI, Copilot, OpenCode, Pi, OpenClaw, Hermes and the other supported agents.

Delegation

rtk bulk-read, and tasks you define, hand a read, a summary or a generated file to a cheaper model. The files never enter your agent's context.

LLM proxy (optional)

rtk llm-proxy starts a local daemon between your agent and its provider. It removes what no reader needs, such as colour codes, progress bars and repeated lines, before your agent sends them to the model. It is off unless you start it.

Savings

rtk gain now shows savings per pipeline, and what the proxy saved.

What changes for you

  • rtk proxy <cmd> is now rtk bypass <cmd>. The old name keeps working.
  • rtk gain may show a lower headline percentage on the same history. Very large outputs that used to inflate it are now reported separately. Your data is unchanged.
  • --ultra-compact is removed.
  • The default binary's licence changes. An Apache-2.0-only edition, rtk-oss, is available on every install channel.
  • Re-run rtk init after upgrading so your agent's instructions use the new command names.

Docs

The guide in docs/guide/ covers pipelines, delegation, the proxy and every supported agent.

🤖 Generated with Claude Code

aeppling and others added 7 commits October 13, 2026 19:13
BREAKING CHANGE: `rtk proxy <cmd>` is now `rtk bypass <cmd>` (the old
name stays as an alias), `--ultra-compact` is removed, `rtk gain` excludes
oversized outputs from its headline rate, and the default binary's licence
changes (an Apache-2.0 edition, rtk-oss, ships alongside). See
BREAKING_CHANGES.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

✨ Type feature
🔴 Risk high

Summary

This PR introduces RTK v1.0, adding a configurable pipeline system (pipeline.toml) that can deny, route, compress, or judge tool calls before/after execution, plus an optional local LLM proxy that strips noise from agent-to-model traffic. It also renames rtk proxy to rtk bypass, removes --ultra-compact, changes gain reporting, and splits off an Apache-2.0-only rtk-oss edition.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

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

Comment thread src/cmds/system/read.rs Fixed
Comment thread src/core/pipeline_cmd.rs Fixed
Comment thread src/core/pipeline_cmd.rs Fixed
Comment thread src/hooks/rewrite_cmd.rs Fixed
@aeppling

Copy link
Copy Markdown
Contributor Author

CodeQL "cleartext logging of sensitive information": the 4 alerts are dismissed as false positives

Checked with a canary key against a fake worker, on success, a 401 response and a refused connection, with the decision log on: the key never appears in stdout, stderr, pipeline.log, the tracking database or the config.

release-please releases the root package only, with tags kept as
v<version>. The workspace members (engine, plugin, text) follow it as the
Rust strategy bumps them; proxy/ is listed as an extra file. A per-crate
setup would have published five releases with component tags, which the
installers, Homebrew and winget cannot resolve.

Also: the secret scanner's sk- label names no vendor, and the editions
page uses the same install script URL as the README.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread src/core/pipeline_cmd.rs Fixed
aeppling and others added 2 commits October 13, 2026 20:27
… tasks named after real commands; a blank message keeps a reason

- `route` at hook.before_tool.edit is E005. The hand-over sent the edit to a
  `generate` task, which rewrote the whole target from a spec and the
  reference alone. A route at `any` no longer hands an Edit to `generate`.
- The hook-path load applies the same reserved-command check as `validate`
  and `pipeline add`, so a `[task.make]` file is dropped there too instead
  of routing a command to `rtk make`, which runs make.
- An empty or blank `message` on a deny or route falls back to the default
  text, so no host ever receives an empty block reason.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ook core is develop's again

decision.rs, rewrite_cmd.rs, hook_check.rs and the OpenCode, Pi, Hermes and
OpenClaw plugins are back to develop. Claude Code's hook consults the
pipeline from its own module (hook_cmd/claude_pipeline.rs, engine only)
before the 0.x flow: deny, route and answer block with their message, a
swap is only offered where develop would rewrite and always asks, and
with no pipeline file the hook is unchanged. `rtk rewrite` no longer
prints anything at exit 2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@pszymkowiak pszymkowiak left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on 2b96061b as a maintainer decision to let v1.0 land, with the open points below to be addressed before the release ships. Full review was run on a built binary with an isolated HOME, plus a local fake upstream for the daemon.

Verified

  • fmt and clippy clean on the workspace, cargo test --all 4886 green, Apache-2.0 edition builds, proxy tests 274 green.
  • 0.x compatibility: 21 commands × rtk rewrite + rtk hook claude with deny rules, develop vs this PR: 0 differences. rtk init -g without a pipeline writes one PreToolUse/Bash entry. rtk proxy alias works, --ultra-compact gone.
  • Release build startup on the hook path 14.6 → 15.7 ms, binary 9.4 → 15.5 MB.
  • Pipelines end to end: the 12 rtk pipeline subcommands, the six built-ins, 20/22 guide TOML blocks and all 7 examples validate (the other 2 are not pipelines), 38 E/W codes emitted as documented, project trust with SHA re-check, rtk:posthook on Bash/Grep/Read, every gain flag, quick-start step by step.
  • Daemon: relay with x-rtk-* stripped and consistent content-length, SSE, CCR 202 KB → 3.2 KB with cache_control kept and rtk_retrieve injected, ICM file 0600, 413 on 70 MB, clean 502 without the upstream URL, 20 concurrent requests, /admin/settings cannot repoint the upstream, rtk gain reads the proxy DB.
  • Since e61317a1: pipeline rules now act on Claude Code only, a swap always asks, a task named after a real command is rejected, the release-please manifest conflict with master is gone.

Open before release (security)

  1. Proxy credential lending has no caller check (proxy/src/relayed_auth.rs, forward.rs:331, config.rs:332 default true). Reproduced: after one request with x-api-key: sk-test-1, a request with no credential reaches the upstream carrying sk-test-1. No Host/Origin validation anywhere (Origin: http://evil.example is forwarded). Lending is also path-dependent: applied in forward::relay, not in ccr_forward. Suggest loopback peer check + Host validation + default false.
  2. mode="answer" runs rg -n <pattern> and curl -sL <url> in the hook with model-controlled values and no -- (task_cmd.rs:864,870), and reads file_path without the permission gate (:857). Suggest --, http(s) only, gate the path.
  3. swap_command still interpolates the task name unquoted (task_cmd.rs:891) and validate only checks collision with rtk commands. With the swap now always asking, this is a prompt showing an injected command rather than an auto-allow, but the name should be validated against [A-Za-z0-9_-]+ and quoted.
  4. cargo clippy --manifest-path proxy/Cargo.toml fails under warnings = "deny" (collapsible_match, proxy/src/context_analysis.rs:187, rustc 1.93.1).

Open before release (behaviour)

  • Conditions: input={limit_gt=…}, timeout_gt, run_in_background=true never match on shell/read; input_missing=["limit"] matches even when present (works on search/any). after_tool exit_code validates but is never populated. ansi strips SGR only (private modes, OSC 8, OSC titles, \r, \b survive). redact is inert in this build with only W009. shadow=true on a deny silently disables it with no warning. One validation error drops every deny of that file with no hook-time signal.
  • rtk bulk-read with no task configured exits 127 with "Permission denied" instead of a clear message; rtk pipeline explain --tool Grep < out.txt disagrees with the live hook (format not inferred from stdin); W005 depends on the extends form.
  • rtk llm-proxy status|stats|stop refuse to run when the daemon binary is not beside rtk or on PATH, although they are pure HTTP clients; the lookup misses proxy/target/. CCR floor for Bash/WebFetch is 300 tokens regardless of the rule's tokens_gt (undocumented). cost_usd is 0 for claude-sonnet-4-5.
  • Pi plugin: hooks/pi/rtk.ts returns before the gate for any command starting with rtk , so rtk ls; secretcmd bypasses a pipeline deny. pipeline.log records full commands verbatim in a 0644 file.

Docs

  • Dead links: the five translated READMEs → docs/TROUBLESHOOTING.md; docs/guide/index.md → root ARCHITECTURE.md; proxy/README.md → TECHNICAL.md instead of proxy/CONTRIBUTING.md.
  • Wrong facts: editions.md says no deb/rpm Conflicts (Cargo.toml declares them); agent-coverage.md says Antigravity has no rewriting hook; proxy/configuration.md omits cache_align, normalize, compression (RTK_PROXY_COMPRESSION), icm_db, icm_ttl_secs, upstream_timeout, upstream_retries; quick-start rtk init --global --dry-run -v fails (-v must precede the subcommand); errors.md header example says E003, binary emits E004; E010 documented as an error, W016 observed; make install used as the unsupported-command example while make has a filter; agent counts differ across README (18/19), supported-agents (18, no Kimi), agent-coverage (20), hooks/README (13), TECHNICAL (7); rtk proxy still emitted by git_cmd.rs:974 and ast_grep_cmd.rs:302; the tree is 0.49.0 while docs say v1.0 and master is 0.52.0.

Governance — rtk-engine and rtk-proxy are BUSL-1.1 and the default rtk binary links the engine while Cargo.toml says license = "Apache-2.0"; the rtk-oss edition, install.sh RTK_EDITION=oss and the CI purity check are in place. Recorded here as an explicit team decision.

Related open issues of the same family: #3970, #3634, #4545, #4281, #4282, #4147, #3738, #1875.

Comment thread proxy/src/config.rs
.or(file.compression)
.unwrap_or_else(|| "off".to_string()),
pixel_compress: file.pixel_compress,
relay_borrowing: cli.relay_borrowing.or(file.relay_borrowing).unwrap_or(true),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open before release. relay_borrowing defaults to true and lend_if_missing (forward.rs:331) has no loopback peer check and no Host/Origin validation. Reproduced against a local fake upstream: after one request with x-api-key: sk-test-1, a request carrying no credential at all reached the upstream with sk-test-1 attached; Origin: http://evil.example was forwarded unchanged. A DNS-rebinding page is same-origin with itself, so neither CORS nor the x-rtk-proxy header protects this. relay_borrowing = false does switch it off (verified). Also path-dependent: ccr_forward.rs never lends. Suggest: loopback peer check, Host validation, default false.

Comment thread src/core/task_cmd.rs
Some("search") => {
let pattern = text("input.pattern")?;
let path = text("input.path").unwrap_or_else(|| ".".to_string());
let command = vec!["rg".to_string(), "-n".to_string(), pattern.clone(), path];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open before release. rg -n <pattern> <path> and curl -sL <url> (line 870) run inside the PreToolUse hook with values from the model and no --; a pattern or URL starting with - is parsed as an option, and curl accepts file://. The read branch at 857 reads any file_path with no permission check (no permissions:: reference in this file or in pipeline_config.rs). Only reachable with mode = "answer". Suggest -- before the operands, http(s) only, and the host's path rules on the read.

Comment thread src/core/task_cmd.rs
let resolved = resolve_task(task_name)?;
let question = task_question(&resolved).unwrap_or_else(|| IN_HOOK_QUESTION.to_string());
Some(format!(
"rtk {task_name} --question {} -- sh -c {}",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open before release. task_name is interpolated raw while question and command are single-quoted. validate only checks collision with built-in rtk commands, so [task."a b;…"] is accepted. Since 2b96061b a swap always asks, so this shows the injected text in a prompt instead of auto-allowing it (it did on a3790678). Still worth closing: validate names against [A-Za-z0-9_-]+ and quote here.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants