openclaw/PROPOSED_CHANGES.md
root 62a03e8688 fix: prevent hallucination after failed compaction summary
- Improve FALLBACK_SUMMARY to instruct agent to check CURRENT_WORK.md
- Add clear instructions to read memory files before responding
- Warn against hallucinating non-existent conversations
- Make memory flush prompt explicitly require CURRENT_WORK.md update
- Strengthen system prompt to emphasize this is mandatory

This prevents the agent from continuing conversations that never
happened when compaction summarization fails (e.g., no API key,
network error, etc.).
2026-01-28 21:40:39 +00:00

48 lines
1.5 KiB
Markdown

# Proposed Clawdbot Improvements
## Issue: Hallucination after failed compaction summary
When compaction summarization fails (no API key, error, etc.), the agent receives:
"Summary unavailable due to context limits. Older messages were truncated."
This provides ZERO context, leading to hallucination about non-existent conversations.
## Proposed Fix 1: Better fallback message
In `src/agents/pi-extensions/compaction-safeguard.ts`:
```typescript
const FALLBACK_SUMMARY = [
"Summary unavailable due to context limits. Older messages were truncated.",
"",
"⚠️ IMPORTANT: You have NO context from previous messages.",
"Before continuing:",
"1. Read CURRENT_WORK.md if it exists",
"2. Read memory/YYYY-MM-DD.md for today's context",
"3. ASK the user what they were working on if unclear",
"4. DO NOT assume or hallucinate previous conversation content",
].join("\n");
```
## Proposed Fix 2: Better default memory flush prompt
In `src/auto-reply/reply/memory-flush.ts`:
```typescript
export const DEFAULT_MEMORY_FLUSH_PROMPT = [
"Pre-compaction memory flush.",
"MANDATORY: Update CURRENT_WORK.md with the current task and context.",
"Also store durable memories to memory/YYYY-MM-DD.md.",
`If nothing to store, reply with ${SILENT_REPLY_TOKEN}.`,
].join(" ");
```
## Why this matters
Without proper context recovery instructions, Claude will:
- Hallucinate about previous conversations
- Continue non-existent tasks
- Confuse users with irrelevant responses
The fix ensures the agent knows to CHECK files and ASK rather than assume.