Skip to content

Reduce memory preamble noise and fix scheduler reminder deferral#4

Merged
not-reed merged 1 commit intomainfrom
feat/memory-injection-fixes
Apr 6, 2026
Merged

Reduce memory preamble noise and fix scheduler reminder deferral#4
not-reed merged 1 commit intomainfrom
feat/memory-injection-fixes

Conversation

@not-reed
Copy link
Copy Markdown
Owner

@not-reed not-reed commented Apr 6, 2026

Summary

  • Recent memory filter: recentMemories are now filtered by cosine similarity (≥ 0.2) against the current message before preamble injection. Unrelated memories are never injected — the model can't volunteer what it can't see. Falls back to unfiltered if embedding fails. Note: newly-stored memories without an embedding yet are skipped until the async embedding generation completes (next turn).
  • Scheduler reminder deferral fix: reminders must be delivered immediately and considered done — no more "I'll mention this later in your shift" deferral pattern
  • memory_forget on correction: when user says a memory is wrong/outdated, agent must forget it immediately, not just acknowledge
  • Verbal promise rule: "I'll remind you" requires a real schedule_create backing it
  • memory_store date hint: appointments must store YYYY-MM-DD, not day-of-week, to avoid Monday/Tuesday false positives week-over-week
  • Removed "Proactive Communication" section: was actively encouraging unprompted memory surfacing

Test plan

  • Send a short generic message ("morning") — verify unrelated recent memories don't appear in agent's response
  • Set a one-shot reminder, let it fire — verify agent delivers it immediately without deferring to "later"
  • Tell agent a memory is wrong — verify it calls memory_forget before responding
  • Store an appointment — verify it includes a specific date, not just "on Monday"

🤖 Generated with Claude Code

- Filter recentMemories by cosine similarity (>= 0.2) before preamble
  injection — unrelated memories are never seen and can't be volunteered
- Add RECENT_MEMORY_MIN threshold constant to similarity.ts
- Remove "Proactive Communication" section from system prompt (was
  actively encouraging unprompted memory surfacing)
- Add memory_forget-on-correction rule: when user says a memory is wrong,
  forget it immediately rather than just acknowledging
- Add verbal-promise rule: "I'll remind you later" requires a real
  schedule_create, not just intent
- Fix scheduler reminder deferral: reminders must be delivered immediately
  and considered done — no "I'll mention this later in your shift"
- Add specific-date hint to memory_store: appointments must use YYYY-MM-DD,
  not day-of-week, to avoid Monday/Tuesday false positives across weeks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 6, 2026

Deploying sprawl with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5947150
Status: ✅  Deploy successful!
Preview URL: https://2d8d2639.sprawl.pages.dev
Branch Preview URL: https://feat-memory-injection-fixes.sprawl.pages.dev

View logs

@not-reed not-reed merged commit a848e64 into main Apr 6, 2026
2 checks passed
@not-reed not-reed deleted the feat/memory-injection-fixes branch April 6, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant