← Back to library

上下文压缩防重复执行:保留“用户请求→已执行动作”成对信息

场景:compaction 后只保留用户请求而丢失代理已执行动作,导致重复回复/重复执行。技巧:把请求与动作确认绑定入摘要模板,并做压缩后回归校验。

GITHUBDiscovered 2026-02-14Author heliosarchitect
Prerequisites
  • Conversation has context compaction enabled or regularly triggered.
  • You can inspect before/after summaries and turn-level outputs for regression checks.
Steps
  1. Create a reproducible request→action pair (e.g., user asks change; agent confirms completed).
  2. Force or wait for compaction, then inspect summary to confirm both request and action status are preserved as a pair.
  3. If action confirmation is missing, add summarization rule to explicitly encode completion status in compact memory.
  4. Run follow-up prompt referencing the prior task; verify agent does not re-announce or re-execute completed work.
Commands
openclaw gateway status
openclaw logs --local-time
Verify

After compaction, follow-up turns correctly recognize tasks as completed and avoid duplicate responses/actions.

Caveats
  • Proposed fix direction is from issue discussion; final implementation may differ(需验证).
  • Overly verbose compaction summaries can increase token cost; keep structured but concise pairs.
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post