Skip to content

Make the directory listing limit configurable in the system prompt #2541

@Cluster444

Description

@Cluster444

Right now the files pushed into the system prompt as output from Ripgrep.tree are pretty much useless on a large enough project. The breadth-first nature of it makes it prioritize shallow files, and most useful files are more deeply nested in a lot of projects. For example here's some stats from my rails app

git ls-files - 1168
git ls-files app - 667
git ls-files app/models app/controllers - 228 (100% of this gets ignored currently)

And on top of that, the output is kind of nonsensical, i'm not sure the model is going to make heads of tails of this. For example this is what my /app directory ends up looking like in the prompt

app/
assets/
builds/
[1 truncated]
[2 truncated]
channels/
application_cable/
[2 truncated]
[7 truncated]
constants/
date_formats.rb
controllers/
baskets/
[3 truncated]
[41 truncated]
errors/
user_facing_error.rb
helpers/
content_filters/
[1 truncated]
[37 truncated]
javascript/
actions/
[1 truncated]
[6 truncated]
jobs/
chat/
[1 truncated]
[4 truncated]
lib/
assertion.rb
mailers/
application_mailer.rb
[2 truncated]
models/
[64 truncated]
views/
[32 truncated]

There's at least two config options that would help improve this:

  1. Make the limit configurable
  2. Allow for directory scopes to be applied

And some kind of better formatting that gives a relationship between directories and files as this is all disjointed. Maybe something like

# app/controllers
- this_controller.rb
- that_controller.rb
# app/models
- this.rb
- that.rb
# app/models/this
- taggable.rb
- joinable.rb

this would keep the paths from being repeated, but also give them some element of emphasis that would actually match things like error output.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions