Repository navigation
Description
What
The PreToolUse hook writes every Bash command it sees into hook_decisions.raw_cmd, verbatim. Neither documented knob stops it:
[hooks] exclude_commandsgates rewriting, not recording. An excluded command still gets a row, withdecision = 'defer'.[tracking] enabledis parsed, defaults totrue, is written intoconfig.tomlbyrtk config --create, and — as far as I can find — is never read anywhere in the source. The onlyTrackingConfigfield consulted isdatabase_path(src/core/tracking.rs,get_db_path). Setting it tofalsechanges nothing.
log_hook_decision → Tracker::new() → record_hook_decision inserts unconditionally; no config is consulted on that path.
Measured, two Windows machines, rtk 0.49.0
Machine A ([tracking] enabled = false, exclude_commands = ["sqlcmd","psql"], config confirmed read back by rtk config):
hook_decisions 111 -> 112 after one excluded command
row: decision=defer | raw_cmd = sqlcmd -Q "select 1 -- LABSPROBE1"
Machine B, independently, before seeing A's result: exclude_commands set for sqlcmd, bare and compound invocations both recorded in full, decision='defer'; then [tracking] enabled = false and a third command still recorded, 97 → 99 → 100. Across all of it the commands table stayed frozen at 17 rows while hook_decisions grew, which is the clue that pointed at the two tables being governed differently.
A note on method, because the obvious check is worthless here: rtk hook check '<cmd>' prints No rewrite for: <cmd> for an excluded command and for a command rtk has no filter for. It answers "will this be rewritten", never "will this be recorded". Both of us had to query the database with a marker string to get a real answer.
Why this one is worth more than a doc note
The other two things I filed this week (#4143, #4144) are the tool reporting a state it did not reach. This is a control surface that does not control the thing its name names, and it fails in the direction that looks safe: a privacy-minded user sets exclude_commands, sees No rewrite for: …, and reasonably concludes the command is not captured. It is captured, in full, in a local SQLite database that on Windows carries no owner-only hardening (set_owner_only is #[cfg(not(unix))] {}).
For most users this is uninteresting — command text, not output, and their editor's own transcripts hold more. For anyone whose command lines carry sensitive arguments, the difference between "I turned it off" and "there was no off switch" is the whole question.
Suggested resolution, your call
- Gate
hook_decisionsonexclude_commands— what the name implies. An excluded command produces no row, or a row withraw_cmdredacted to the bare program name (which is alldiscoverneeds for coverage stats). - Make
[tracking] enabled = falseactually disable writes, or remove the field so it stops reading as an off switch. - If neither, document it plainly: say that the only way to stop capture is to not install the hook, and drop
enabledfrom the generated config so nobody sets it expecting an effect.
Happy to send a PR for (1) or (2) — say which shape you want and whether a redacted row or no row is preferable for discover's ground truth.
Activity
rtk-wshm-sync-bot commentedon Sep 20, 2026
🔍 Automated Triage
bughighSummary
exclude_commands only gates rewriting (not hook_decisions recording) and tracking.enabled is never read, so raw command text (incl. sensitive args) is always captured with no way to opt out short of not installing the hook.
📁 Relevant files
src/core/tracking.rsSuggested Actions
Triaged automatically by wshm · This is an automated analysis, not a human review.