Repository navigation
A corrected name renames what it named; relationships through recalled facts; held turns say so - #232
Merged
Merged
Conversation
"It's Priya, not Pruya" closed the old naming fact but left "Pruya" as a second person,
with "Pruya lives in Lisbon" still on it. With ExtractionOptions.RenameOnCorrectedName
(off by default; needs SupersedeReplacedFacts), when a persist closes a naming fact
("is named", "is called", any subject) in favour of a new name, the owner's entity with
the old name is merged into the one with the new name (created if missing; relationships
and mentions move, the old name stays as an alias) and closed, and the live facts said
about the old name are restated under the new one, each superseding its original.
Found from the store after the write rather than threaded through it, so it holds on every
write path (atomic, best-effort, replayed); best-effort like supersession. Integration
tests on a real store with scripted extraction: your own name, a pet's name, and the
switch off (both fail without the change).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
…eferred in the ingestion metrics A turn held for the next one that tells something returned an empty result that read as a success with nothing in it. ExtractionResult.Deferred and the public DeferredMetadataKey say what happened, and memory.ingestion.operations tags it status=Deferred, apart from successes (a unit test on the metric fails without the change). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9
Recall added the relationships between the recalled entities only, so "what does my manager's husband do?" had "Daniel works as chef" and never the edge "Priya Nair married to Daniel". With RecallOptions.MaxRelationships set, the entities the recalled facts name (subjects and objects, by name or alias; not "user") bring theirs too, in the same one query ($names empty: the id-only read, unchanged). New default interface methods GetRelationshipsAroundAsync / GetLiveAroundAsync fall back to the id-only reads. Integration test with entity recall off (the edge can only come through the fact); fails without the change. 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 correctness and concurrency issues remain in corrected-name persistence, along with documentation gaps.
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
Adds opt-in corrected-name renaming, fact-based relationship recall, and deferred extraction observability.
Changes:
- Renames entities and restates affected facts.
- Expands relationship recall through fact-mentioned names and aliases.
- Adds deferred extraction metadata, metrics, tests, and documentation.
| File | Reviewed change |
|---|---|
tests/AgentMemory.Tests.Unit/Observability/InstrumentedMemoryServiceTests.cs |
Deferred metric tests |
tests/AgentMemory.Tests.Integration/Services/RelationshipsThroughFactsIntegrationTests.cs |
Fact-derived relationship recall tests |
tests/AgentMemory.Tests.Integration/Extraction/RenameOnCorrectedNameIntegrationTests.cs |
Corrected-name rename tests |
src/AgentMemory.Observability/InstrumentedMemoryService.cs |
Deferred ingestion metrics |
src/AgentMemory.Neo4j/Repositories/Neo4jRelationshipRepository.cs |
Name-aware relationship reads |
src/AgentMemory.Neo4j/Queries/RelationshipQueries.cs |
Expanded relationship query |
src/AgentMemory.Core/Services/MemoryService.cs |
Deferred metadata wiring |
src/AgentMemory.Core/Services/MemoryContextAssembler.cs |
Fact-name relationship expansion |
src/AgentMemory.Core/Services/LongTermMemoryService.cs |
Relationship API implementation |
src/AgentMemory.Core/Extraction/PersistenceStage.cs |
Corrected-name rename workflow |
src/AgentMemory.Abstractions/Services/ILongTermMemoryService.cs |
New relationship service API |
src/AgentMemory.Abstractions/Repositories/IRelationshipRepository.cs |
New relationship repository API |
src/AgentMemory.Abstractions/Options/ExtractionOptions.cs |
Rename configuration |
src/AgentMemory.Abstractions/Domain/Extraction/ExtractionResult.cs |
Deferred result contract |
docs/configuration/memory-options.md |
Option documentation |
CHANGELOG.md |
User-facing release notes |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| var from = since - TimeSpan.FromSeconds(1); | ||
| foreach (var named in naming) | ||
| { | ||
| var name = named.Object.Trim(); |
Comment on lines
+272
to
+275
| var target = await _entityRepository.FindLiveByNameAsync(name, null, scope, cancellationToken).ConfigureAwait(false) | ||
| ?? await _entityRepository.UpsertAsync(new Entity | ||
| { | ||
| EntityId = _idGenerator.GenerateId(), |
| /// superseding its original, so the history stays readable. Needs <see cref="SupersedeReplacedFacts"/> (which | ||
| /// closes the old naming fact). Owner-scoped: a shared (owner-less) write renames nothing. | ||
| /// </summary> | ||
| public bool RenameOnCorrectedName { get; set; } |
This was referenced Oct 7, 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
ExtractionOptions.RenameOnCorrectedName, which is off by default and needsSupersedeReplacedFacts.is named,is called, any subject: the user, a person, a pet) in favour of a new name.RecallOptions.MaxRelationshipsset).ILongTermMemoryService.GetRelationshipsAroundAsyncandIRelationshipRepository.GetLiveAroundAsyncfall back to the id-only reads.ExtractionResult.Deferredand the publicExtractionResult.DeferredMetadataKeylet a host tell a held turn from an empty success.memory.ingestion.operationstags itstatus=Deferred.Verification
45ba4aa4.🤖 Generated with Claude Code
https://claude.ai/code/session_0139u7CNFuidKuPJBRK7auC9