Skip to content

Bring Smart Context (Summarization & Folding) from VS Code to CLI #828

@shariqriazz

Description

@shariqriazz

Describe the feature or problem you'd like to solve

The VS Code Copilot extension implements sophisticated context management strategies that appear to be missing from the CLI. Currently, the CLI uses a strict sliding window strategy (truncation) for conversation history. This causes it to "forget" instructions from the beginning of a long session as soon as the token limit is reached, making it difficult to maintain context in long-running agentic tasks.

Proposed solution

Please bring the "Smart Context" capabilities from the VS Code extension to the gh copilot CLI:

  1. Auto-Summarization: Implement the summarization logic (similar to the Summarizer class in the VS Code extension) to compress older conversation turns into a summary instead of dropping them completely.
  2. Smart Code Folding: Use tree-sitter or similar parsing to condense code blocks in the context (keeping signatures, hiding bodies) to allow more files to fit in the window.
    This would significantly improve the CLI's ability to handle complex tasks and make the terminal experience comparable to the VS Code Chat experience

Example prompts or workflows

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions