zai-org / zai-org/feedback

[建议 / Feature] /compact 支持附加提示词:命令后的自由文本当前被静默丢弃(3.9.2 实测取证)

Open
#412 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • 我已搜索过现有 issue,确认这不是重复提议 / I searched existing issues and confirmed this isn't a duplicate.(最接近的 #348 是「压缩可编排」,#357 是「SessionStart hook 派发」,与本议题不同)
  • 我已阅读 CONTRIBUTING.md
问题类别 · Category

对话 / Agent 交互 · Agent chat / interaction

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

环境 · Environment

ZCode 3.9.2,Windows 11

使用场景 · Use case

长会话(约 34 万 token 上下文)需要压缩时,希望按 Claude Code 的使用习惯在 /compact 后面附加一段提示词,指示总结时重点保留什么(技术决策、踩坑记录、待办、下一步约束等):

/compact 重点保留下载链路的状态与挂起项、各出版商的封锁结论、命名规约和研判层判据……

实际行为:压缩正常发生,但命令后附加的文字被静默丢弃——没有进入总结、没有进入对话、没有落库,用户毫无感知。写了半天的引导词直接消失,这是所有失败模式里最伤的一种(连"失败提示"都没有)。

我做了三处独立取证,可以确认文字在客户端解析层就被丢弃、从未进入任何管线:

  1. ~/.zcode/cli/db/db.sqliteinput_history 表:该次输入记录的 text 字段仅为 /compact(8 字符),attachments 为空;
  2. session_input 表的入队原文:{"text":"/compact","intent":{"kind":"compact","attachmentRefs":[]}}
  3. ~/.zcode/cli/rollout/model-io-sess_*.jsonl 中该次压缩请求(querySource=compact):685 条消息末尾的 summarize 指令为 5977 字符的纯模板,与另一次无附加文字的 /compact 逐字节同长,无任何用户内容注入。

一个有意思的细节:summarize 模板里仍保留着与 Claude Code 同款的钩子句 "There may be additional summarization instructions provided in the included context. If so, remember to follow these instructions…"——说明下游管线为附加指令预留了位置,只是命令解析/UI 层没有把 /compact 后的自由文本接进去。

建议方案 · Proposal

按优先级:

  1. 支持 /compact <自由文本>:命令后的文本注入 summarize 指令的 additional instructions 位置(钩子句已在模板中),对齐 Claude Code 行为,迁移用户零成本;
  2. 若暂不支持,请勿静默丢弃:命令解析检测到多余文本时给出明确提示(如 toast「/compact 暂不支持附加提示词」或把剩余文本回退为普通消息),静默吞掉用户输入比不支持本身更糟;
  3. 可选增强:压缩时的确认 UI 提供「本次压缩重点」输入框,作为显式的引导入口。
补充 · Additional context
  • 当前的 workaround:压缩后第一条普通消息补充意图,或用 /goal 让长期目标穿越压缩持续生效;
  • 官方文档(zcode.z.ai/cn/docs/commands)对 /compact 仅写「压缩当前对话上下文,保留关键信息」,未说明是否支持参数——建议无论实现取哪条路,文档同步写清楚。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the /compact entry in the linked command documentation and compare it with the reported input_history, session_input, and model-io-sess_*.jsonl records. Done means the behavior for trailing text is defined and implemented—either passing it into summarization or reporting that it is unsupported—and the /compact documentation states whether arguments are accepted.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.