Toni Granados

Toni Granados

New tool: newest-files


AI agents have gotten very good as of late and they’ve completely transformed how I work. There are still many things they don’t do that well, but for certain things, they excel. One of those things they are great at is applying an existing pattern to a new thing.

This kind of task is easily accomplished by providing the example in the context for the LLM, but sometimes finding that example might be tricky, especially for big, old, established codebases in which there might be multiple ways of achieving the same thing, including old or deprecated code.

In big repos, the newest files often represent the most relevant patterns, conventions, and ideas. That’s exactly what an AI model should imitate.

To help with this, I’ve built newest-files, a simple CLI tool that prints the list of the newest files in a git repo. You can use a glob to filter the files and even see the commit and PR where they were introduced, to gather even more context on how they were built in the first place.

Agents can call this tool before generating code, pulling in real, relevant and up-to-date examples from your repo instead of relying on guesses. It helps them enhance their context on their own and do what they do best: context-aware copy-paste.

The tool is available in Homebrew, so you can install it by just running:

brew tap tngranados/newest-files
brew install newest-files

Or check out the GitHub repo.

I’ve also included some instructions explaining how to use the tool and its purpose that you can feed directly into your AI agent. Check them out here.

Here is an example using it in the Discourse repo:

$ newest-files 'app/jobs/**/*.rb'

Created          │ Author               │ File                                                       │ Commit
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
2025-10-09 00:33 │ Natalie Tay          │ app/jobs/regular/process_localized_cooked.rb               │ 38e64200
2025-10-03 16:14 │ Ted Johansson        │ app/jobs/scheduled/notify_admins_of_problems.rb            │ 911502eb
2025-08-21 14:18 │ Ted Johansson        │ app/jobs/scheduled/clear_expired_impersonations.rb         │ b24a3d81
2025-08-20 12:55 │ Juan David Martínez… │ app/jobs/regular/site_setting_update_default_categories.rb │ 0d721b47
2025-08-20 12:55 │ Juan David Martínez… │ app/jobs/regular/site_setting_update_default_tags.rb       │ 0d721b47
2025-07-23 11:58 │ Blake Erickson       │ app/jobs/regular/check_video_conversion_status.rb          │ af3abb54
2025-07-23 11:58 │ Blake Erickson       │ app/jobs/regular/convert_video.rb                          │ af3abb54
2025-02-11 10:26 │ Bianca Nenciu        │ app/jobs/scheduled/calculate_scores.rb                     │ 87f88459
2025-02-11 10:26 │ Bianca Nenciu        │ app/jobs/scheduled/clean_up_bookmarks.rb                   │ 87f88459
2025-02-11 10:26 │ Bianca Nenciu        │ app/jobs/scheduled/clean_up_drafts.rb                      │ 87f88459

Showing 10 newest files matching 'app/jobs/**/*.rb'

In one glance, you get the newest patterns for jobs, super helpful when adding a new one or showing an AI agent how they should look today, not five years ago.

This is the first time I release a tool I built for myself to the public, but I’ve been using it for a while now with great success and thought it might be useful for others. Hopefully you find it useful too.

If you try it, I’d love feedback or ideas for improvements.