Add time-based decay, anti-patterns, and agent attribution#14
Merged
acoyfellow merged 2 commits intomainfrom Mar 23, 2026
Merged
Add time-based decay, anti-patterns, and agent attribution#14acoyfellow merged 2 commits intomainfrom
acoyfellow merged 2 commits intomainfrom
Conversation
…ttern tracking - Time-based confidence decay (all three packages): Apply exponential decay at recall time using half-life of 90 days. Memories not recalled or created recently have their effective confidence reduced, keeping recall results fresh. Stored confidence is never mutated by decay. - Agent attribution (deja-local & deja-edge): Add optional `source` parameter to remember() for tracking which agent stored a memory. Backward-compatible. - Anti-pattern tracking (deja-local & deja-edge): When reject() drops confidence below 0.15, the memory auto-inverts to an anti-pattern with "KNOWN PITFALL: " prefix, reset confidence of 0.5, and type "anti-pattern". Negative knowledge actively surfaces during recall as warnings. All 76 tests pass (44 deja-local + 32 deja-edge). https://claude.ai/code/session_01MbQ14BcEn9uFntgrNidpVA
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e25870fb5d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…p bypass P1: deja-edge initSchema() now calls migrateSchema() which runs ALTER TABLE to add last_recalled_at, source, and type columns on existing Durable Objects. Previously, upgraded DOs would fail with "no such column" errors. P2: Strip "KNOWN PITFALL: " prefix when computing trigram similarity for dedup/conflict detection in deja-edge. This prevents re-remembering the same text from bypassing dedup and inserting a duplicate after anti-pattern inversion. (deja-local uses embedding-based dedup which is unaffected since the stored embedding remains from the original text.) Added tests for both fixes. All 78 tests pass (44 local + 34 edge). https://claude.ai/code/session_01MbQ14BcEn9uFntgrNidpVA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds three major features to deja-local and deja-edge memory systems:
sourceparameter to track which agent stored a memoryKey Changes
Time-based Confidence Decay
last_recalled_atcolumn to track when memories were last useddecayedConfidence = storedConfidence × 0.5^(daysSince / 90)Anti-Pattern Tracking
typecolumn ('memory'or'anti-pattern') to track memory classificationreject()drops confidence below 0.15 threshold, memory auto-inverts:'memory'to'anti-pattern'"KNOWN PITFALL: "confirm()ed to boost their confidenceAgent Attribution
sourcecolumn to store which agent created a memoryremember()now accepts optional{ source?: string }parameterSchema Migrations
last_recalled_at,source,typetype: 'memory'andsource: undefinedDocumentation Updates
Implementation Details
injectMemories()to sort learnings by decayed confidencehttps://claude.ai/code/session_01MbQ14BcEn9uFntgrNidpVA