-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: add option to persist context references across conversations #8440
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
Conversation
… conversations - Added new VSCode setting 'roo-cline.persistContextReferences' (default: false) - When enabled, @mentions and /commands persist in the input field after sending messages - Extracts and preserves context references when clearing the input field - Maintains backward compatibility with default behavior (clearing context) - Addresses issue #8439 for improved workflow efficiency
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.
Performing a self-review like a mirror test for sentience: I see wiring missing and consistency ghosts.
| "roo-cline.persistContextReferences": { | ||
| "type": "boolean", | ||
| "default": false, | ||
| "description": "%settings.persistContextReferences.description%" |
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.
[P1] The setting 'roo-cline.persistContextReferences' is contributed here, but I don't see backend wiring to read this VSCode setting and populate ExtensionState.persistContextReferences (and to react to configuration changes). Without wiring, the feature may remain disabled. Consider reading the configuration and including it in the 'state' sent to the webview.
| const allMentions = [...new Set([...mentionMatches, ...commandMatches])] | ||
|
|
||
| // Return as space-separated string | ||
| return allMentions.join(" ") |
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.
[P3] Minor: consider trimming the joined string to avoid leading/trailing whitespace when no mentions are present at one end.
| return allMentions.join(" ") | |
| return allMentions.join(" ").trim() |
| vscode.postMessage({ type: "queueMessage", text, images }) | ||
| setInputValue("") | ||
| // If persistContextReferences is enabled, preserve mentions | ||
| if (persistContextReferences) { |
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.
[P2] For consistency with regular send and queue paths, please also preserve mentions after primary/secondary button flows when 'persistContextReferences' is enabled (e.g., reuse extractMentions()). Otherwise input-clearing differs depending on which path is used.
| | "openRouterImageGenerationSelectedModel" | ||
| | "includeTaskHistoryInEnhance" | ||
| | "reasoningBlockCollapsed" | ||
| | "persistContextReferences" |
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.
[P1] ExtensionState now exposes 'persistContextReferences', but I couldn't find where the extension initializes this from the VS Code configuration or updates it when settings change. Please wire through the setting so the webview receives the intended value.
| "settings.useAgentRules.description": "Enable loading of AGENTS.md files for agent-specific rules (see https://agent-rules.org/)", | ||
| "settings.apiRequestTimeout.description": "Maximum time in seconds to wait for API responses (0 = no timeout, 1-3600s, default: 600s). Higher values are recommended for local providers like LM Studio and Ollama that may need more processing time.", | ||
| "settings.newTaskRequireTodos.description": "Require todos parameter when creating new tasks with the new_task tool", | ||
| "settings.persistContextReferences.description": "Keep context references (@mentions) in the input field after sending a message, allowing them to persist across conversations in the same task", |
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.
[P3] Localization: new key added here; consider adding corresponding keys to other locale nls files to avoid fallback-only behavior.
Summary
This PR addresses Issue #8439 by adding an option to persist context references (@mentions and /commands) in the input field after sending messages.
Problem
Users had to re-reference files and folders in every message within the same task window, which was inefficient for ongoing conversations about the same context.
Solution
Added a new VSCode setting
roo-cline.persistContextReferences(default: false) that, when enabled:Changes
src/package.jsonsrc/package.nls.jsonpackages/types/src/global-settings.tsandsrc/shared/ExtensionMessage.tswebview-ui/src/context/ExtensionStateContext.tsxwebview-ui/src/components/chat/ChatView.tsxTesting
Future Improvements
As noted in the review, future enhancements could include:
extractMentionsfunctionFixes #8439
Important
Adds
roo-cline.persistContextReferencessetting to persist context references in the input field after sending messages, with state management and UI updates.roo-cline.persistContextReferencessetting inpackage.jsonto persist @mentions and /commands in the input field after sending messages.ChatView.tsxto extract and preserve context references when sending messages or resetting chat.ExtensionStateContext.tsxto managepersistContextReferencesstate.setPersistContextReferencesfunction for state updates.persistContextReferencesinpackage.nls.json.This description was created by
for 64f37fc. You can customize this summary. It will automatically update as commits are pushed.