Repository navigation
feat: make list_directory file sizes opt-in via showSizes - #778
Merged
will-lamerton merged 2 commits intoAug 9, 2026
Merged
will-lamerton merged 2 commits into
will-lamerton merged 2 commits into
Conversation
list_directory appended a byte size to every file entry unconditionally, ~8-10 tokens per entry for information that's rarely load-bearing when the model is just orienting itself in a directory (400-500 tokens on a 50-entry listing, more on recursive listings). It also cost an lstat syscall per file purely to get that size. Added a showSizes boolean (default false) to gate both the lstat call and the size string. Sizes are still available on demand: per-file via read_file's metadata_only, or for a listing via showSizes=true. Updated the tool description, which claimed sizes were always included. Fixes Nano-Collective#767
MsfPablo
requested review from
Avtrkrb,
akramcodez and
will-lamerton
as code owners
August 3, 2026 16:39
9 of 17 tasks
akramcodez
reviewed
Aug 4, 2026
akramcodez
left a comment
Member
There was a problem hiding this comment.
LGTM great work @MsfPablo :)
Member
|
Nice work @MsfPablo :) |
12 of 13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #767.
list_directoryappended a byte size to every file entry unconditionally — roughly 8-10 tokens per entry for information that's rarely load-bearing when the model is just orienting itself in a directory (400-500 tokens on a 50-entry listing, more on recursive listings). It also cost anlstatsyscall per file purely to get that size.Added a
showSizesboolean toListDirectoryArgsand the tool schema, defaulting tofalse:lstatcall onshowSizes(skipped entirely when not requested)entry.size ? ... : ''size-string logic already handlessizebeingundefinedcorrectly, so no change needed thereshowSizes=trueas opt-in, and points toread_file'smetadata_onlyfor a single file's sizeTest plan
pnpm run test:format,test:lint,test:types— all cleanpnpm run test:ava source/tools/list-directory.spec.tsx— 30 tests passlist_directory shows file sizes→list_directory hides file sizes by default(asserts nobytesin output) and addedlist_directory shows file sizes when showSizes=trueto cover the opt-in path explicitly