Skip to content

fix(reflection): require explicit staleness before overwriting memory facts - #4097

Open
Tusharv23 wants to merge 1 commit into
letta-ai:mainfrom
Tusharv23:feature/sleeptime-conflict-resolution
Open

Tusharv23 wants to merge 1 commit into
letta-ai:mainfrom
Tusharv23:feature/sleeptime-conflict-resolution

Conversation

@Tusharv23

Copy link
Copy Markdown

Summary

Addresses #4029.

The sleeptime reflection prompt currently instructs the subagent to "resolve contradictions in favor of the latest evidence" unconditionally. This newest-wins rule causes destructive memory overwrites: a single unverified or anecdotal observation can replace a confirmed durable fact, including safety-critical ones (e.g., a confirmed severe allergy softened to "mild" after one anecdote about eating shellfish without reaction).

This PR replaces the inline conflict clause with a structured Durability and Resolutions policy: update only when newer evidence explicitly establishes staleness; otherwise record the conflicting observation as a separate fact and leave the original unchanged; never weaken confirmed safety-critical facts on anecdote.

Prompt-only change (src/agent/subagents/builtin/reflection.md); no code touched.

Tradeoff: memory grows slightly faster (conflicts are annotated instead of overwritten), in exchange for not destroying confirmed facts on weak evidence.

Verification

  • Measured on a 120-run eval matrix: 4 conflict cases (true update / compatible split / inferential overwrite / confidence preservation) x 10 Bedrock models (frontier + small) x 3 repeats, two-stage harness (verbatim reflection prompt, then neutral extractor, then mechanical scoring with manual adjudication of edge cases):
    • Baseline reflection.md: 90/120 correct conflict handling
    • This PR's prompt: 110/120
    • True-update case stays 100%, so legitimate updates still go through
    • Remaining failures concentrate in the smallest models (llama3.1-8b, nova-micro)
  • The exact committed text was additionally sanity-checked (N=12: 3 models x 4 cases) and behaves identically to the measured version.
  • Full harness, raw run evidence, and scoring code: https://github.com/Tusharv23/letta-conflict-eval
  • bun test on this branch: 6872 pass / 46 fail, identical counts to clean main on the same machine (pre-existing environment-dependent failures: telemetry auth, PTY, stream-json integration). No new failures introduced.

AI Disclosure

  • This pull request was written entirely by a human
  • This pull request was written with AI assistance and reviewed and edited by a human
  • I have read the AI Policy and agree to its terms

AI Tool(s) Used

GitHub Copilot (Claude Fable 5) - used to help draft the prompt wording, plan the eval harness. All runs, changes and eval results done by me.

Human Verification

I have reviewed and understand every change in this pull request and take responsibility for its correctness.

… facts

Replaces the unconditional newest-wins conflict rule in the sleeptime
reflection prompt with a structured Durability and Resolutions policy:

- Update only when newer evidence explicitly establishes staleness
- Annotate conflicting-but-unverified evidence as a separate fact
- Restraint: never weaken safety-critical facts on anecdote

Measured on a 120-run eval matrix (4 conflict cases x 3 Bedrock models
x repeats): correct conflict handling improved from 90/120 to 110/120,
with the largest gains on safety-critical overwrite cases.

Addresses letta-ai#4029
@Tusharv23
Tusharv23 force-pushed the feature/sleeptime-conflict-resolution branch from 06f0d66 to fd9e982 Compare August 28, 2026 10:39
@Tusharv23

Copy link
Copy Markdown
Author

Hey @kl2806, checking in on this PR. Since submitting I've re-run the sanity set against the final wording (11/12, results in the PR body) and added confidence intervals to the underlying eval. Happy to make any changes if the wording or scope needs adjusting, is there anything blocking a review?

This branch has not been deployed

No deployments
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