rtk is a command-line proxy that filters and compresses output from development commands before it reaches an LLM's context. It is used with coding agents to reduce the tokens consumed by commands such as Git operations. The catalogue includes skills, commands, agents, and instructions for using rtk in agent workflows.
Borrowing it
Nothing to install: this file belongs to rtk-ai/rtk. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/rtk-ai/rtk/develop/.claude/commands/rtk-test-before-merge.mdgit clone --depth 1 https://github.com/rtk-ai/rtkWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/rtk-ai/rtk/rtk-test-before-merge)<a href="https://agentmods.dev/commands/rtk-ai/rtk/rtk-test-before-merge"><img src="https://agentmods.dev/badge/commands/rtk-ai/rtk/rtk-test-before-merge/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/rtk-ai/rtk/rtk-test-before-merge"><img src="https://agentmods.dev/badge/commands/rtk-ai/rtk/rtk-test-before-merge.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.00177 |
| Opus 5 | $0.00000 | $0.00088 |
| Sonnet 5 | $0.00000 | $0.00035 |
| Haiku 4.5 | $0.00000 | $0.00018 |
Grade A, and why
rtk-test-before-merge scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Force the agent to write or extend a test for every behaviour change.
Test before merge
For every code change that affects observable behaviour:
- Identify the existing test that covers the area. If none, propose creating it (note the gap in the response).
- Write the failing test FIRST in a separate commit named
test: <what>— verify it fails on main, passes on the branch. - The implementation commit comes second.
- If the change is purely refactoring, run the existing tests and report the count + duration; do not add new tests just to satisfy this rule when there is no behaviour change.
Skip is allowed only when:
- Tweaking a doc string, comment, log message
- Renaming a private symbol
- A pre-existing TODO points at "test added in #issue-N"
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today First seen · 20 lines · 0 tokens per session scan A ccedc3b1c64b
rtk-test-before-merge is a command published in the GitHub repository rtk-ai/rtk (79,342 stars, last pushed today), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 177 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-08.
Other commands, from other repositories
worktree
Create a git worktree for isolated feature/fix work.
watch-ci
Spawn a background Haiku-backed subagent to watch CI for the current branch (or specified target). Provider-agnostic — the subagent inspects project signals to identify the CI system (GitHub Actions, GitLab CI, CircleCI, etc.) and picks the right CLI. Returns immediately; reports back when CI reaches a terminal state.
undo-commit
Soft-undo the last commit. Restores its changes as staged, leaves working tree intact. Refuses if HEAD is already pushed to a tracked remote.
changelog
View recent CHANGELOG entries.
session-report
Capture what changed this session and why, scoped to the current branch. Read by ship verbs when synthesizing the commit message; deleted after a successful commit.
pr
Open a pull request from the current branch with a generated title and summary.