-
Notifications
You must be signed in to change notification settings - Fork 6k
fix(kv-cache): inject subdirectory hints as tail messages #9767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,6 +93,24 @@ impl SubdirectoryHintTracker { | |
| } | ||
| results | ||
| } | ||
|
|
||
| /// Returns hint text for directories newly touched since the last call, | ||
| /// joined into a single block, or None if nothing new was discovered. | ||
| /// Intended to be injected as an agent-visible tail message so the system | ||
| /// prompt stays stable. | ||
| pub fn collect_new_hints(&mut self, working_dir: &Path) -> Option<String> { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This drops the |
||
| let new_hints = self.load_new_hints(working_dir); | ||
| if new_hints.is_empty() { | ||
| return None; | ||
| } | ||
| Some( | ||
| new_hints | ||
| .into_iter() | ||
| .map(|(_, content)| content) | ||
| .collect::<Vec<_>>() | ||
| .join("\n\n"), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| fn resolve_to_parent_dir(token: &str, working_dir: &Path) -> Option<PathBuf> { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-blocking nit: the dedup |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the right instinct -- these discovered hints should be part of the message that they discover, but I see some issues here:
how did you test this? the stats on the PR suggests this all saves tokens, but if we hit this path multiple times, I am not sure it wouldl