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 摘要。