Skip to content

perf(tools): list glob matches under their directory - #476

Merged
mrnasil merged 1 commit into
mainfrom
perf/glob-group-by-dir
Nov 25, 2026
Merged

mrnasil merged 1 commit into
mainfrom
perf/glob-group-by-dir

Conversation

@mrnasil

@mrnasil mrnasil commented Nov 25, 2026

Copy link
Copy Markdown
Member

What

glob results list the files that share a directory once, under a dir/ line, indented by name:

crates/agent/src/agent/
  cache_warm.rs
  compact.rs
crates/memory/src/onnx.rs
README.md

A directory with a single match and files at the root keep their full path, so nothing is ambiguous.

Why

A deep tree repeats its directory prefix on every line. In the dev token workload (scripts/bench_tokens.py --workload dev) the capped crates/**/*.rs listing (200 of 748 paths) was the largest single tool result: 1,896 → 1,040 o200k tokens (−45%) for the same paths. That result then rides in every later request of the session.

No code parses glob output (checked agent, TUI, ACP mapping).

Tests

  • by_directory_lists_shared_directories_once covers root files, single-file dirs, grouped dirs, nested dirs and the empty case.
  • finds_files_by_suffix_and_skips_heavy_dirs asserts the grouped form.
  • fmt, clippy, budgets; tools line coverage measured locally (only the pre-existing Windows-only miss at the glob fallback remains).

🤖 Generated with Claude Code

A deep tree repeats its directory prefix on every line of a glob
result. Files that share a directory are now listed once under a
`dir/` line, indented by name; single files and root files keep their
full path. On the dev token workload's capped `crates/**/*.rs`
listing (200 paths) this goes from 1,896 to 1,040 o200k tokens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mrnasil
mrnasil merged commit 3c0b9a1 into main Nov 25, 2026
7 checks passed
@mrnasil
mrnasil deleted the perf/glob-group-by-dir branch November 25, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant