Skip to content

feat: add /summarize command to agent mode#3352

Merged
roblourens merged 10 commits intomicrosoft:mainfrom
bharatvansh:feature/agent-summarize-command
Feb 7, 2026
Merged

feat: add /summarize command to agent mode#3352
roblourens merged 10 commits intomicrosoft:mainfrom
bharatvansh:feature/agent-summarize-command

Conversation

@bharatvansh
Copy link
Copy Markdown
Contributor

@bharatvansh bharatvansh commented Jan 31, 2026

Adds a new /summarize command to Agent mode that triggers conversation history summarization using the existing SummarizedConversationHistory prompt infrastructure. The command returns ChatResult.metadata.summary so downstream components can store/use the generated summary.

What’s included

  • Registers a new Agent command contribution:
    • Command: /summarize
    • Visibility gated by config.github.copilot.chat.summarizeAgentConversationHistory.enabled
    • Localized description via package.nls.json
  • Implements /summarize handling in AgentIntent:
    • Excludes the current /summarize turn from the history being summarized
    • Normalizes existing summary metadata before summarizing
    • Produces a summary tied to the latest tool-call round (required for summary association)
    • Returns { metadata: { summary: { toolCallRoundId, text } } }
  • Adds unit tests covering:
    • Successful summarization when enabled and there is tool-call history
    • Graceful behavior when the feature is disabled
    • Friendly message when there is nothing to summarize

User-facing behavior

  • If summarization is disabled, the command responds with a message explaining how to enable it.
  • If there is no prior history (or no tool calls to associate a summary with), the command responds with a friendly “nothing to summarize” message.
  • On success, the command reports progress and returns summary metadata.

Testing

  • npm run test:unit -- src/extension/intents/node/test/agentSummarizeCommand.spec.ts
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new /summarize command to the agent mode chat participant, allowing users to manually trigger summarization of conversation history. The feature is controlled by a configuration setting and provides user-friendly feedback for various scenarios.

Changes:

  • Added a /summarize command handler in AgentIntent that leverages the existing SummarizedConversationHistory component
  • Implemented comprehensive unit tests covering enabled/disabled states, empty history, and successful summarization scenarios
  • Registered the command in VS Code's contribution points with conditional visibility based on configuration

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/extension/intents/node/test/agentSummarizeCommand.spec.ts New test file with 3 test cases covering different scenarios for the /summarize command
src/extension/intents/node/agentIntent.ts Added handleRequest override and handleSummarizeCommand method to handle the new command
package.nls.json Added localized description string for the summarize command
package.json Registered the /summarize command with conditional visibility
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@deepak1556 deepak1556 assigned roblourens and unassigned deepak1556 Feb 2, 2026
@roblourens roblourens assigned lramos15 and unassigned roblourens Feb 2, 2026
@lramos15
Copy link
Copy Markdown
Member

lramos15 commented Feb 2, 2026

Similar to my exploration here #3137

roblourens
roblourens previously approved these changes Feb 7, 2026
Copy link
Copy Markdown
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR- this did not fully work when I started testing it but it was easy to fix up and I think this approach is fine.

@roblourens roblourens enabled auto-merge February 7, 2026 19:38
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 7, 2026
Copy link
Copy Markdown
Contributor

@bhavyaus bhavyaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

@roblourens roblourens added this pull request to the merge queue Feb 7, 2026
Merged via the queue into microsoft:main with commit 9b345d2 Feb 7, 2026
9 checks passed
@bharatvansh bharatvansh deleted the feature/agent-summarize-command branch February 9, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

6 participants