Repository navigation
What the agent is told by default: dates, shared knowledge, held questions, recent topics - #231
Merged
Merged
Conversation
IncludeDates defaults to true on the four renderers that print dates (one guard test for the twins) and SharedRecallBudget to 3: in simulated conversations both kept every answer and improved the dated ones. The model-dependent extraction switches and supersession stay opt-in. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
"Daniel | is a chef | chef" rendered "Daniel is a chef chef". A predicate that ends with its own object's words, with or without a leading article, is trimmed at write, for every fact on either write path; whole words only, and never to an empty predicate. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
WorkingMemoryOptions.RecentTopicsDays (off by default) ends the profile block with one line naming the owner's entities that live facts extracted in the window mention most, counted by distinct messages (EXTRACTED_FROM provenance with the message time), never the person (self words, their stated name). Only what the person said counts. One read per rebuild, only when enabled; trimmed first when the block is over budget. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
…thing (37.4) The durable redesign of the deferral pulled in review round 8. The memory service decides (every entry point gets it); the host only consents (AgentFrameworkOptions.DeferQuestionTurns sets ExtractionRequest.DeferIfOnlyAsking). A waiting turn is marked on its stored message: it survives a restart, stays in its store and session, is gone when forgotten, and the marks clear only when the releasing extraction succeeds; at most MaxDeferredTurns wait. The E2 context window reaches up to the last target, so the agent's reply between a waiting question and its telling turn is context. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
…ge, relationships, changes of mind (37.3) A new docs/configuration/memory-options.md lists each switch with its default; getting-started, agent-framework, memory-map, schema and architecture say what the memory now does and store (occurred_on, date precision, entity owner_key, the predicate trim), with the known limits. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
… in the baseline The perf gate caught the cost of SharedRecallBudget on by default: an owner-scoped recall searches twice per memory type (PERF-R-07: 9 -> 16 queries), in every store, shared knowledge or not. It stays opt-in (3 is the measured value) until the shared search is skipped where there is nothing shared. IncludeDates stays on. The baseline records PERF-W-08's 15th query, the restated-relationship read justified in #230, so later changes are gated against the current shape. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
…nts what the person said Deferral: a waiting turn is marked for its owner (the session when there is none) and read by an index seek; the owner's next telling turn in any session releases it (a session ending on a question no longer strands it; one agent's shared session id never releases Alice's words into Bob's extraction); any failure while deferring extracts the turn now; "please ..." and "help me ..." are told, not held; waiting turns are counted as the user's messages. Lately: distinct facts from live user messages (a released batch and the agent's words no longer inflate it), the naming exclusion by the same keys as the name lookup, case-blind entity match, rebuilt at least daily. The predicate trim moves a dangling article to the object. A dated recalled turn is deduplicated against the live thread by what was said. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
…t; on by default (37.1b) With SharedRecallBudget set, every owner-scoped recall searched twice per memory type, shared knowledge or not (the perf gate caught it: PERF-R-07 9 -> 16 queries). ISharedCorpusProbe answers whether the store holds shared memory of a kind (Neo4j: one EXISTS per store and kind, a seek on owner_key for facts and entities; "none" cached 30 s, "some" 10 min); without any, the shared search is skipped, and a probe that cannot answer leaves it in place. With the cost gone where nothing is shared, SharedRecallBudget defaults to 3 again. The perf gate passes unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
Three tests read what a turn stored right after it returned; with ExtractInBackground on by default (since #229) that was a race they lost when run on their own (warm runs won it, so full-suite runs passed). They are about owner stamping, provenance and trust, not background timing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
The shared-corpus check cached "none" for 30 seconds, so in a store without shared knowledge, a book taught and then asked about straight away was not recalled until the window expired. Every repository path that writes an owner-less fact, entity or preference (single, batch, fused, derived) now tells the check before the write, and it answers "some" at once; a "some" that turns out wrong only costs one empty search. Only a write from another process still waits out the window. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved critical shared-probe race and multiple moderate deferral, recall, and topic-correctness issues remain.
Review effort: Lite
Findings: 1
Open (7)
Prevent stale existence probes from overwriting Saw cache updates · New Skip shared existence probe when recall budget is zero · New Apply valid-time gates when selecting recent topics · New Key shared database cache by resolved physical store · New Correct incorrect PredicateEcho.Trim storage example · New Correct persisted PredicateEcho.Trim triple in documentation · New Register new Cypher queries in the query registry · New
What changed in this PR
Adds date rendering, shared-memory budgeting, deferred question extraction, predicate cleanup, and recent-topic profile context.
Changes:
- Enables dates and shared recall by default with cached probing.
- Adds durable deferred question turns and predicate normalization.
- Adds “Lately” topics, tests, query updates, and documentation.
| File | Summary |
|---|---|
tests/AgentMemory.Tests.Unit/Services/WorkingMemoryTests.cs |
Tests recent-topic rendering and budgeting. |
tests/AgentMemory.Tests.Unit/Services/SharedKnowledgeBoundaryTests.cs |
Tests shared recall probing and defaults. |
tests/AgentMemory.Tests.Unit/Services/MemoryServiceExtractionContextTests.cs |
Tests deferred-turn context selection. |
tests/AgentMemory.Tests.Unit/Services/DeferredQuestionTurnsTests.cs |
Tests durable question deferral. |
tests/AgentMemory.Tests.Unit/Services/DatesInContextTests.cs |
Tests date defaults. |
tests/AgentMemory.Tests.Unit/Queries/CypherQuerySnapshotTests.cs |
Updates query inventory tests. |
tests/AgentMemory.Tests.Unit/Queries/CypherQuerySnapshot.snap |
Adds query snapshots. |
tests/AgentMemory.Tests.Unit/Infrastructure/SchemaBootstrapperTests.cs |
Updates schema tests. |
tests/AgentMemory.Tests.Unit/Extraction/WithinExtractionCurrentValueTests.cs |
Tests predicate normalization paths. |
tests/AgentMemory.Tests.Unit/Extraction/PredicateEchoTests.cs |
Tests duplicate predicate cleanup. |
tests/AgentMemory.Tests.Unit/Extraction/OnlyAsksTests.cs |
Tests question-only detection. |
tests/AgentMemory.Tests.Unit/AgentFramework/HistoryThreadDedupTests.cs |
Tests dated-turn deduplication. |
tests/AgentMemory.Tests.Unit/AgentFramework/ExtractFromUserOnlyTests.cs |
Tests deferral option wiring. |
tests/AgentMemory.Tests.Unit.SemanticKernel/Neo4jTextSearchTests.cs |
Tests Semantic Kernel date defaults. |
tests/AgentMemory.Tests.Integration/Services/SharedCorpusProbeIntegrationTests.cs |
Tests shared-corpus caching and writes. |
tests/AgentMemory.Tests.Integration/Services/RecentTopicsIntegrationTests.cs |
Tests recent-topic behavior. |
tests/AgentMemory.Tests.Integration/Repositories/DeferredExtractionIntegrationTests.cs |
Tests persisted deferral. |
tests/AgentMemory.Tests.Integration/AgentFramework/StoredPromptInjectionCrossSessionIntegrationTests.cs |
Makes extraction deterministic. |
tests/AgentMemory.Tests.Integration/AgentFramework/PersistExtractFullTurnIntegrationTests.cs |
Uses deterministic inline extraction. |
tests/AgentMemory.Tests.Integration/AgentFramework/MemoryOwnerScopingAgentIntegrationTests.cs |
Uses deterministic inline extraction. |
src/AgentMemory.SemanticKernel/MemoryRecallSecurityOptions.cs |
Enables date rendering. |
src/AgentMemory.Neo4j/Services/Neo4jWorkingMemoryService.cs |
Builds recent-topic profile context. |
src/AgentMemory.Neo4j/Services/Neo4jSharedCorpusProbe.cs |
Caches shared-memory existence. |
src/AgentMemory.Neo4j/Repositories/Neo4jPreferenceRepository.Fused.cs |
Tracks fused shared writes. |
src/AgentMemory.Neo4j/Repositories/Neo4jPreferenceRepository.cs |
Tracks shared preference writes. |
src/AgentMemory.Neo4j/Repositories/Neo4jMessageRepository.cs |
Persists deferred markers. |
src/AgentMemory.Neo4j/Repositories/Neo4jFactRepository.Fused.cs |
Tracks fused shared writes. |
src/AgentMemory.Neo4j/Repositories/Neo4jFactRepository.cs |
Tracks shared fact writes. |
src/AgentMemory.Neo4j/Repositories/Neo4jEntityRepository.Fused.cs |
Tracks fused shared writes. |
src/AgentMemory.Neo4j/Repositories/Neo4jEntityRepository.cs |
Tracks shared entity writes. |
src/AgentMemory.Neo4j/Queries/WorkingMemoryQueries.cs |
Adds recent-topic queries. |
src/AgentMemory.Neo4j/Queries/SchemaQueries.cs |
Adds the deferred-message index. |
src/AgentMemory.Neo4j/Queries/MessageQueries.cs |
Adds deferral queries. |
src/AgentMemory.Neo4j/Infrastructure/ServiceCollectionExtensions.cs |
Registers shared probing. |
src/AgentMemory.Core/Services/MemoryService.cs |
Coordinates deferred extraction. |
src/AgentMemory.Core/Services/MemoryContextFormatterOptions.cs |
Enables date rendering. |
src/AgentMemory.Core/Services/LongTermMemoryService.cs |
Applies shared budgets and probing. |
src/AgentMemory.Core/Services/ISharedCorpusProbe.cs |
Defines the probe contract. |
src/AgentMemory.Core/Extraction/PredicateEcho.cs |
Removes repeated predicate objects. |
src/AgentMemory.Core/Extraction/PersistenceStage.cs |
Applies predicate cleanup before persistence. |
src/AgentMemory.Core/Extraction/ExtractionNoveltyGate.cs |
Detects question-only turns. |
src/AgentMemory.AgentFramework/TurnExtraction.cs |
Wires question deferral. |
src/AgentMemory.AgentFramework/Mapping/MafTypeMapper.cs |
Deduplicates recalled turns. |
src/AgentMemory.AgentFramework/ContextFormatOptions.cs |
Enables date rendering. |
src/AgentMemory.AgentFramework/AgentFrameworkOptions.cs |
Adds deferral configuration. |
src/AgentMemory.Abstractions/Repositories/IMessageRepository.cs |
Adds deferred-message APIs. |
src/AgentMemory.Abstractions/Options/WorkingMemoryOptions.cs |
Adds recent-topic settings. |
src/AgentMemory.Abstractions/Options/MemoryOptions.cs |
Defaults shared recall budgeting. |
src/AgentMemory.Abstractions/Options/ExtractionOptions.cs |
Adds deferred-turn limits. |
src/AgentMemory.Abstractions/Domain/Extraction/ExtractionRequest.cs |
Adds request-level deferral control. |
eng/perf/baselines/hermetic-S.json |
Updates the performance baseline. |
docs/schema.md |
Documents schema and predicate behavior. |
docs/README.md |
Links configuration documentation. |
docs/memory-map.md |
Documents capability defaults. |
docs/getting-started.md |
Documents configuration behavior. |
docs/configuration/memory-options.md |
Adds the options reference. |
docs/architecture.md |
Updates architecture details. |
docs/agent-framework.md |
Documents framework behavior. |
CHANGELOG.md |
Records user-visible changes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| var record = await cursor.SingleAsync().ConfigureAwait(false); | ||
| return record["shared"].As<bool>(); | ||
| }, cancellationToken).ConfigureAwait(false); | ||
| _answers[key] = (shared, now + (shared ? SomeFor : NoneFor)); |
Comment on lines
+112
to
115
| var anyShared = _sharedCorpus is null || await HasSharedAsync(kind).ConfigureAwait(false); | ||
| var sharedTask = anyShared && _sharedRecallBudget > 0 | ||
| ? search(SharedScopes.SharedOnly, _sharedRecallBudget.Value) | ||
| : Task.FromResult<IReadOnlyList<(T Item, double Score)>>(Array.Empty<(T, double)>()); |
Comment on lines
+67
to
+68
| WHERE f.invalidated_at IS NULL AND m.role = 'user' AND m.invalidated_at IS NULL | ||
| AND m.timestamp >= datetime($since) |
| private readonly INeo4jTransactionRunner _tx; | ||
| private readonly IMemoryStoreContext? _store; | ||
| private readonly TimeProvider _time; | ||
| private readonly ConcurrentDictionary<(string? Store, SharedKind Kind), (bool Shared, DateTimeOffset Until)> _answers = new(); |
Comment on lines
+43
to
+44
| - An object the model repeated at the end of its predicate is stored once ("is a chef | chef" becomes | ||
| "is a | chef"). |
|
|
||
| On create, the incoming id becomes the persisted `id`. On match, the existing id is retained, mutable fields are updated, valid windows are coalesced, and `invalidated_at` is reset for live re-assertion. | ||
|
|
||
| Before the merge, a predicate that ends with its own object's words (with or without a leading article) is trimmed, so a model's `Daniel | is a chef | chef` is stored as `Daniel | is a | chef` and renders "Daniel is a chef" once. `works at | Acme` is unchanged, and a predicate is never trimmed to empty. |
Comment on lines
+26
to
+28
| private const string EntityQuery = "RETURN EXISTS { MATCH (e:Entity {owner_key: '*'}) } AS shared"; | ||
| private const string FactQuery = "RETURN EXISTS { MATCH (f:Fact {owner_key: '*'}) } AS shared"; | ||
| private const string PreferenceQuery = "RETURN EXISTS { MATCH (p:Preference) WHERE p.owner_id IS NULL } AS shared"; |
This was referenced Oct 8, 2026
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.



What changes
Defaults
ContextFormatOptions, CoreMemoryContextFormatterOptions, Semantic KernelMemoryRecallSecurityOptions,WorkingMemoryOptions). A guard test keeps the four defaults together.MemoryOptions.SharedRecallBudgetdefaults to 3, so shared knowledge gets its own budget and label.ISharedCorpusProberuns one cached existence check per store and kind, and the shared search is skipped when there is none.Extraction
PredicateEcho).ExtractionRequest.DeferIfOnlyAsking/AgentFrameworkOptions.DeferQuestionTurns.ExtractionOptions.MaxDeferredTurnsturns are held.Profile
WorkingMemoryOptions.RecentTopicsDaysdays.Docs
Tests
main.The model-dependent extraction switches (
TemporalValidityMode.Extract,MarkCorrections,OwnPreferencesOnly) andSupersedeReplacedFactsstay opt-in.Verification
eng/perf/baselines/hermetic-S.json.03a20f7c.0cb4e80b: held turns belong to their owner, and "Lately" counts only what the person said.🤖 Generated with Claude Code
https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9