feat: add excluded_memory_listing_dirs config option#1145
feat: add excluded_memory_listing_dirs config option#1145YouJianFengXue wants to merge 1 commit intooraios:mainfrom
Conversation
|
If you do not actually want to use these memories anymore, why do you not move them out of the memories folder or delete them entirely? |
|
Good question! The archived memories are still needed — they just shouldn't clutter the listing output. Why not delete them? Why not move them out of The core use case: This is analogous to how An alternative approach could be to support glob/regex patterns (like |
1abe638 to
1f29d88
Compare
I prefer this, it's more flexible and still easy to use. The directory exclusion is easy to cover with this. An option @YouJianFengXue I disagree that |
1f29d88 to
453717d
Compare
|
Thanks for the feedback! I've reworked the PR based on your suggestions: Key changes (v1 → v2):
Example config: ignored_memories: ["_archive/.*", "_episodes/.*"]Behavior:
The implementation mirrors the existing |
|
Thanks @YouJianFengXue . Could you pls extend changelog and docs? |
453717d to
826db4b
Compare
|
Done! Updated per your feedback:
|
MischaPanch
left a comment
There was a problem hiding this comment.
LGTM, @opcode81 pls have a quick look and merge if you agree
|
Note for us - we should extend the changelog with other recent changes to the memory system, just linking to docs should be enough |
Summary
excluded_memory_listing_dirsconfig option to exclude top-level directories from memory listingserena_config.yml) and project (project.yml) levelread_only_memory_patterns)Problem
Projects with large numbers of archived memory files (e.g.
_archive/,_episodes/) see inflatedactivate_projectandlist_memoriesoutput. In one real case, 1,700+ archived.mdfiles causedactivate_projectoutput to balloon to ~26k tokens — most of it useless noise.There is currently no way to exclude directories from memory listing.
read_only_memory_patternsonly marks entries as read-only but still lists them.ignored_pathsonly controls code navigation, not memory listing.Solution
Add
excluded_memory_listing_dirs: list[str]toSharedConfig(inherited by bothSerenaConfigandProjectConfig). TheMemoriesManager._list_memoriesmethod checks each file's top-level directory against this set and skips matches.Files inside excluded directories can still be read directly via
read_memory(which uses direct path resolution viaget_memory_file_path, not the listing method).Example usage
Changes
src/serena/config/serena_config.pySharedConfig, pass inProjectConfig._from_dictsrc/serena/project.pyMemoriesManager.__init__, filter in_list_memories, merge configs inProject.__init__src/serena/resources/serena_config.template.ymlsrc/serena/resources/project.template.ymlTest plan
activate_projectoutput excludes files in configured directories[])