copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

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

Open shariqriazz opened this issue 11 months ago • 5 comments

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

shariqriazz avatar Dec 23 '25 14:12 shariqriazz

José Terrones

  • [x] 4761234946

sofiabustos3855-alt avatar Dec 28 '25 03:12 sofiabustos3855-alt

https://github.com/github/copilot-cli.git

juttijutti333222-create avatar Jan 01 '26 12:01 juttijutti333222-create

Image

juttijutti333222-create avatar Jan 01 '26 12:01 juttijutti333222-create

@patniko Hello any update on this? i see we have compact now.

shariqriazz avatar Feb 01 '26 13:02 shariqriazz

The conversation summarization part of this request has been addressed. The CLI now automatically compacts older turns (replacing truncation with model-based summarization) when the context window fills up, and you can trigger it manually with /compact. The tree-sitter-based code folding piece has not been implemented. If you believe the remaining part should be tracked separately, feel free to reopen this issue.

examon avatar Apr 07 '26 00:04 examon