Skip to content

fix(discover,learn): default to scanning all projects instead of encoding CWD - #2228

Closed
mikeangstadt wants to merge 5 commits into
rtk-ai:developfrom
mikeangstadt:fix/discover-learn-no-all-default
Closed

mikeangstadt wants to merge 5 commits into
rtk-ai:developfrom
mikeangstadt:fix/discover-learn-no-all-default

Conversation

@mikeangstadt

@mikeangstadt mikeangstadt commented Jun 2, 2026 •

Copy link
Copy Markdown

Summary

rtk discover and rtk learn reported 0 sessions when run without --all, even when the project had thousands of Claude Code sessions. rtk session (same underlying data) worked fine without --all.

Root Cause

Both commands used encode_project_path() to filter sessions by the current working directory's Claude Code slug. This encoding can fail on path patterns with symlinks, case differences (macOS is case-insensitive but contains() is case-sensitive), or encoding mismatches with Claude Code's actual directory naming. When the filter doesn't match, discover_sessions() returns 0 results.

Change

Changed the default (when neither --all nor --project is given) to pass None as the project filter, matching rtk session behavior. The --project flag remains for explicit project filtering.

Closes #2177


Collaborated & orchestrated by ClosedLoop.AI | GitHub

When ripgrep is not on $PATH, rtk grep falls back to system grep but
was passing ripgrep-specific flags like -g/--glob, --hidden, --pcre2,
--json, etc. that grep does not understand, causing silent failures or
wrong results.

Adds a stateful filter that removes rg-only flags (and their value
arguments) from the extra_args before passing them to grep.

Closes rtk-ai#2167
rtk proxy does not invoke a shell — it spawns the command directly via
exec. When users pass compound shell syntax (&&, ||, |, ;, $(), etc.),
those tokens end up as literal arguments to the spawned process, causing
confusion or incorrect behavior (e.g. bogus files/dirs from shell tokens).

Adds detect_shell_snippet() that validates the command name and all args
for shell control operators and command substitution syntax, returning
a clear error with a suggestion to use `sh -c` or `bash -c` instead.

Closes rtk-ai#2163
Custom TOML filters (from .rtk/filters.toml or ~/.config/rtk/filters.toml)
were parsed and passed rtk verify, but were never consulted by the hook
rewrite path. The rewrite engine (discover/registry.rs) only checked the
hardcoded RULES array, returning empty for any unrecognized command.

Now, when classify_command returns Unsupported, we check the TomlFilterRegistry
for a matching custom filter. If found, the command is rewritten to run
through "rtk <original>" so that fallback execution applies the filter pipeline.

Closes rtk-ai#2179
…ssing

ccusage version drift can change or remove field names in the JSON output.
When month/date/week fields are missing, rtk cc-economics hard-failed
with serde parse errors instead of adapting.

Changes period entry key fields (date, week, month) to Option<String>
and uses filter_map to skip entries without a valid key instead of
crashing the whole command. This allows the command to succeed with
whatever data is available.

Also updates parse_json to use filter_map instead of unwrap/map,
providing graceful degradation for all three granularities
(daily, weekly, monthly).

Closes rtk-ai#2178
…ding CWD

discover/learn used encode_project_path() to filter sessions by the
current working directory. This encoding can fail on path patterns with
symlinks, case differences (macOS), or encoding mismatches with Claude
Code's actual directory naming, causing 0 sessions to be returned.

Changed the default (when neither --all nor --project is given) to pass
None as the project filter, matching rtk session behavior. The --project
flag remains for explicit project filtering.

Closes rtk-ai#2177
@rtk-release-bot

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet.

@rtk-release-bot rtk-release-bot Bot added the stale label Sep 3, 2026
@rtk-release-bot

Copy link
Copy Markdown
Contributor

Closing this pull request after a prolonged period of inactivity. If this is still relevant, please ask for it to be reopened. Thank you!

@rtk-release-bot rtk-release-bot Bot closed this Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

discover/learn scan 0 sessions without --all, even from the matching project cwd

1 participant