github / github/copilot-cli

Feature: allow /compact to be invoked by the agent (programmatic compaction)

未關閉
#3,916 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:agents area:context-memory
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

## Summary
`/compact` is currently a user-only slash command. The agent itself should be able to invoke compaction when it detects it's running short on context or when a long task naturally hits a phase boundary.

## Use cases
- Multi-phase workflows (e.g. plan → implement → review pipelines) where the agent knows when a phase is complete and the prior context can be safely summarized.
- Long-running autonomous sessions where the user isn't present to trigger `/compact` manually.
- Skill / plugin authors who want to script a compaction step at a known-safe boundary.

## Proposal
Expose `/compact` as a callable tool (e.g. `compact_context`) so the agent can invoke it programmatically, with the same effect as the user typing the slash command. Permission-gate it the same way other state-changing tools are gated.

## Out of scope
Auto-compaction policy (when to fire, what to summarize) is separate; this issue is only about exposing the existing capability to the agent.

貢獻指南

開啟貢獻指南

研究方向

先找出現有的 /compact 命令,以及狀態變更工具的註冊與權限閘控路徑。確認可呼叫工具如何產生與使用者命令相同的效果,接著檢查相關的 CLI 測試或測試模式。完成的標準是 agent 能以相同的權限閘控呼叫壓縮,而不新增自動壓縮策略。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
shell
領域
cli, tooling
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。