22 Commits

Author SHA1 Message Date
Nicolas Le Cam d2e906a0fe fix(gain): honour suppress_hook_warning, and pin the env/config composition
`rtk gain` printed its own missing-hook line from a bare `status()` match,
outside `maybe_warn`, so neither `hooks.suppress_hook_warning` nor
`RTK_SUPPRESS_HOOK_WARNING` reached it — on the report the no-hook audience
reads most. Gate that arm on the same helper; the outdated-hook prompt stays
visible, as it does everywhere else.

The new unit tests exercise the parser alone, so folding env and config
together with `||` — which drops the falsy force-off — left the whole suite
green. Drive the composition through the binary instead, and give the env
table the `=0` row that overrides the config flag.

The suite pins `XDG_CONFIG_HOME`/`XDG_DATA_HOME` to the temporary home and
seeds the config in both the XDG and the macOS location, so the loader cannot
resolve past it: `dirs::config_dir` is `~/.config` on Linux but
`~/Library/Application Support` on macOS, and a runner that exports either
`XDG_*` reached the developer's own config before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 02:16:12 +02:00
Matt Van Horn 4e53f760fe fix: scope suppress_hook_warning to missing hooks and parse the env override
Parse RTK_SUPPRESS_HOOK_WARNING as a truthy/falsy override that falls
back to config when unset or unrecognised, keep the HookStatus::Ok fast
path free of config loading, and suppress only the missing-hook warning
so the outdated-hook upgrade prompt stays visible.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNmJZVV9u6pBhcwVhwkPp6
2026-09-16 07:46:02 -07:00
Matt Van Horn 0e7a41eb52 feat(config): add suppress_hook_warning option
Add hooks.suppress_hook_warning config option and RTK_SUPPRESS_HOOK_WARNING
env var to disable "No hook installed" and "Hook outdated" warnings.

Users running rtk via CLAUDE.md instructions instead of hooks, or with
tools like OpenCode, get these warnings on every command. The warnings
waste tokens and confuse AI agents since rtk is working correctly.

RTK_SUPPRESS_HOOK_WARNING=1 suppresses; any other value forces the warning
on; unset falls back to the config file. Both default to false so existing
behavior is unchanged. The env parse follows the repo's
as_deref() == Ok("1") convention.

The suppression check runs before status() so the suppressed path does not
pay for the hook probe.

Documented in configuration.md (the hooks block and the env var table) and
README.md.

Fixes #682

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
2026-09-16 07:27:24 -07:00
Adrien Eppling 7c10f7791c fix(benchmark): ignore the recall hints when counting find entries
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNqtCagEUryc1fgw62APkm
2026-09-08 16:53:02 +02:00
Adrien Eppling feb8aeb644 revert(recall): drop tee_on_success, recovery stays failure and truncation driven
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNqtCagEUryc1fgw62APkm
2026-09-08 14:12:27 +02:00
Adrien Eppling 8969fa49c5 feat(recall): tee_on_success restores legacy always behavior, accurate migration notices
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MNqtCagEUryc1fgw62APkm
2026-09-08 14:12:25 +02:00
Adrien Eppling a53373191d feat(recall): content-addressed recall store with selectable [retriever] mode
sqlite (default) queried by 'rtk recall'; tee (legacy files) and disabled modes retained.
2026-09-08 14:12:15 +02:00
Adrien Eppling 9bc4323916 Merge origin/develop into clean/awareness-file
Resolved: awareness constants vs Pi/OMP rework, InitContext destructures,
bun/deno CLI additions, write_if_changed split.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DVD4ZD5wiSjSsNpKCK6h7q
2026-09-07 11:06:29 +02:00
patrick a8bb67a853 fix(rewrite): stop rewriting sudo commands (pass them through)
The env-prefix stripper treated `sudo` like `env` / `VAR=val` and rewrote
`sudo docker ps` into `sudo rtk docker ps`. That breaks at runtime: `rtk`
lives in ~/.local/bin, which is not on sudo's secure_path, so the rewritten
command fails with "rtk: command not found" under root (reported in #146).
And where rtk *is* on secure_path, `sudo rtk` would run the whole rtk binary
as root — an unnecessary-privilege footgun.

Drop `sudo` from the env-prefix regex so sudo commands pass through
untouched. The permission verdict path is unaffected (it never used this
regex and already matches sudo commands as-is, e.g. `sudo:*` rules). env /
VAR= prefixes and transparent builtins (noglob, command, …) still rewrite
normally.

Verified: `sudo docker ps` / `sudo -u root docker ps` / `sudo noglob git
status` are no longer rewritten; `env FOO=bar docker ps`, `FOO=bar docker
ps`, `noglob git status` still are. fmt/clippy clean, full test suite green.

Refs #146

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-03 22:35:01 +02:00
Nicolas Le Cam 976a1d7630 docs(config): scope the exclude_commands coverage claim to what is peeled
`configuration.md` said an excluded tool "is covered however it is invoked".
The stated limits then covered only tools without their own filter, and exactness
— leaving three invocation forms of *filtered* tools promised but not delivered.

Scope the sentence to the wrapper, interpreter and path spellings that are
actually peeled, and table the three that are not, each with its cause:

- `head -20 f` / `tail -n 5 f` — the line-range fast path returns before the
  exclusion is consulted (#2823); `head f` is excluded normally
- `gradlew.bat build` / `mvnw.cmd test` — path stripping splits on `/`, so a
  `.bat`/`.cmd` spelling never reduces to the tool name (#3617)
- `golangci run ./...` — `golangci run` is one of the rule's own aliases and is
  kept whole, so it misses a `golangci-lint` entry

Each row verified against a build on `develop` at e533c40, including the
documented workaround: `["golangci"]` excludes the alias form but not
`golangci-lint run`, so both entries are needed.

Docs only, no behaviour change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-01 12:42:04 +02:00
aesoft e533c40901 Merge pull request #3749 from KuSh/fix/exclude-commands-wrapper-forms
fix(hooks): match exclude_commands against the peeled command form
2026-09-01 10:04:32 +02:00
Nicolas Le Cam 9ba523960b fix(hooks): match exclude_commands against the peeled command form
`exclude_commands` entries name a tool, but a command can spell that tool with a
wrapper (`npx playwright test`), an interpreter (`python3 -m pytest tests/`) or a
path (`vendor/bin/phpunit tests/`). Those spellings are absorbed by each rule's own
pattern rather than stripped beforehand, so the anchored `^playwright($|\s)` never
matched and the exclusion silently did nothing — the README shipped
`exclude_commands = ["curl", "playwright"]` as the example, and `playwright` is a
tool almost nobody invokes bare.

Peel the wrapper off the command and match what remains, alongside the existing
check on the typed command. The peeled form keeps the arguments, so an anchored
entry still narrows the way it was written: `"^ls$"` excludes a bare `ls` without
swallowing `ls -la`.

Peeling uses the rule's own `rewrite_prefixes`, taking the shortest token-suffix of
the matched prefix that is itself a prefix of that rule. That drops `npx` and
`python3 -m` while keeping a subcommand the rule treats as part of the tool, so
`golangci-lint run` does not collapse to `run`.

Peeling reuses the PHP normalization the rewrite path already applies (`php`
wrapper and ini flags, leading `./`, vendor/composer bin dir), extracted into
`php_tool_form` and shared by both, so `php vendor/bin/phpunit tests/` is excluded
by `["phpunit"]` the same way `vendor/bin/phpunit tests/` is.

The peeled check is gated on a non-empty `exclude_commands`, keeping the default
config off the `RULES` scan on the hook rewrite path.

Matching the resolved `rtk` target instead would have been shorter but wrong in
both directions: it misses tools whose target differs from the binary (`["eslint"]`
would still rewrite `npx eslint .`, since the target is `lint`), and it leaks
across tools sharing a target (`["read"]` would exclude `cat`, `["git"]` would
exclude `yadm`). Peeling has neither failure.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-30 15:28:30 +02:00
Adrien Eppling cddcecd76d docs(awareness): shorten awareness level section 2026-08-20 10:14:35 +02:00
Adrien Eppling bc751926cc docs(awareness): explain levels, upgrade path, and hookless agents 2026-08-20 10:12:03 +02:00
Adrien Eppling aefea91a21 feat(init): add awareness.level config with default/high/full instruction files 2026-08-20 10:10:26 +02:00
derrik-fleming 9550e10d6d docs(config): update example to include max_file_size 2026-07-21 10:52:49 -04:00
Adrien Eppling bbeee4c85e docs(trust): fix README to match silent skip; note global-filter migration 2026-07-01 15:41:54 +02:00
Adrien Eppling 9d3b678242 fix(trust): skip untrusted filters silently on the command path
The warning printed to stderr on every rewritten command, adding tokens; trust is surfaced only in `rtk init`/`rtk trust`.
2026-07-01 14:46:37 +02:00
Adrien Eppling 84f952881b docs: document custom filters + trust in the config guide
Move the user-facing trust docs into docs/guide (config) and out of CODING_PRACTICES.
2026-07-01 13:31:51 +02:00
aesoft 2e401ac38f fix(docs): add missing docs for exclude commands patterns 2026-04-19 13:59:03 +02:00
Florian BRUNIAUX 4c9b528206 docs: Adrien review — hierarchy, counts, consistency, gaps
Hierarchy:
- Move troubleshooting.md and what-rtk-covers.md to guide/resources/
- Add guide/resources/telemetry.md (adapted from docs/TELEMETRY.md,
  user-facing: consent, opt-out, GDPR rights — without internal sections)

Content fixes:
- Remove all hardcoded counts (9 ecosystems, 12 agents, 60+, 7 more)
  replaced with qualitative language throughout
- Unify DB filename: tracking.db → history.db everywhere
  (canonical: src/core/constants.rs HISTORY_DB)
- installation.md: replace bare `cargo install rtk` with warning +
  explicit git URL to avoid Rust Type Kit name collision
- supported-agents.md: remove hardcoded agent count
- quick-start.md: remove hardcoded ecosystem list, link to what-rtk-covers

New content:
- gain.md: add --quota section explaining pro/5x/20x tier meanings
- gain.md: add callout linking to discover.md (find missed savings)
- index.md: add "Analyze your usage" section (rtk discover, rtk session)
- configuration.md: clarify ignore_dirs/ignore_files scope, add prose
  link to telemetry.md
- what-rtk-covers.md: clarify --ultra-compact vs git -u short flag conflict

Cross-references:
- All internal links updated for new resources/ paths
- index.md: link to troubleshooting, telemetry, what-rtk-covers, analytics
- discover.md: updated relative link to troubleshooting

README:
- Add Core team section (Patrick Szymkowiak, Florian Bruniaux, Adrien Eppling)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 14:17:58 +02:00
Florian BRUNIAUX 6e55f8984c docs: address Adrien's review — structure, missing content, agents
Structure:
- Move docs/README.md → .github/docs-pipeline-contract.md (interface
  contract is not user-facing content)
- Rewrite docs/guide/index.md as a proper landing page with RTK intro,
  flow diagram, and navigation (replaces empty nav stub)
- Move configuration.md → getting-started/configuration.md (sidebar order 4,
  after supported-agents per Adrien's suggestion)

Missing content:
- Add docs/guide/analytics/discover.md: rtk discover (missed savings analysis)
  and rtk session (adoption tracking across sessions)
- Add uninstall instructions to installation.md (rtk init -g --uninstall,
  cargo uninstall, brew uninstall)
- Add global flags section to what-rtk-covers.md (-u/--ultra-compact,
  -v/--verbose)
- Add rtk smart command to what-rtk-covers.md Files section

Agents:
- Update supported-agents.md: 10 agents (was 9)
- Add OpenClaw (TypeScript plugin, before_tool_call)
- Add Mistral Vibe (planned, issue #800)
- Fix GitHub Copilot: VS Code = transparent rewrite via PreToolUse,
  Copilot CLI = deny-with-suggestion (upstream limitation)

Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-06 11:16:24 +02:00