rtk-ai/rtk

Custom TOML filters (global or trusted project-local) are never applied by the hook

Open

#2 179 ouverte le 31 mai 2026

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)Rust (2 914 forks)batch import
area:configbughelp wantedpriority:high

Métriques du dépôt

Stars
 (48 085 stars)
Métriques de merge PR
 (Merge moyen 8j 17h) (49 PRs mergées en 30 j)

Description

rtk v0.37.2, macOS (Apple Silicon, homebrew)

Custom TOML filters — defined in the global filters.toml or a rtk trust'd project-local .rtk/filters.toml — parse and pass rtk verify, but are never applied by the Claude Code hook. Only compiled-in/bundled filters get rewritten.

Repro

Add a custom filter (global or trusted project-local):

[filters.zzprobe]
description = "probe"
match_command = '^zzprobe\b'
max_lines = 5
$ rtk trust            # registers .rtk/filters.toml (confirmed in `rtk trust --list`)
$ rtk verify --filter zzprobe     # found, parses (No inline tests)
$ rtk rewrite 'zzprobe --foo'      # -> EMPTY (no rewrite)
$ rtk rewrite 'liquibase update'   # -> "rtk liquibase update"  (bundled filter works)
$ rtk rewrite 'df -h'              # -> "rtk df -h"             (works)

RTK_NO_TOML is unset. A real custom filter (match_command='iconv.*UTF-16' + a replace rule) likewise never fires on iconv ... commands, while it's trivially correct when applied manually.

Also (related, may be by-design)

rtk discover scans the CC transcript (the raw pre-hook command string) and lists e.g. grep -n as "missed -> rtk grep (existing)". But the hook already rewrites those at exec time, so discover's "missed M tokens" / "adoption %" double-counts already-captured savings (verified: raw cat/grep increment the rtk read/rtk grep counters 1:1). Consider netting out hook-captured commands using history.db so "missed" reflects only genuinely-unhandled commands.

Expected

Trusted/global custom filters should be applied by the hook like bundled ones (or rtk pipe -f <customname> should accept custom filter names — it currently rejects anything not built-in). Without this, user-defined filters are non-functional for their primary purpose.

Guide contributeur