seeded WorkflowMemory rows
→ retrieve relevant memories for a current/future claim
→ score and rank them
→ ignore irrelevant or unsafe matches
→ format top memories for future agent context
→ write MemoryHit audit rows
→ prove it with a retrieval smoke test
Day 4 added the retrieval layer for ClaimFlow AI workflow memory.
The goal was not to dump old claims into the agent context. The goal was to take compact WorkflowMemory cards created from prior workflow outcomes and retrieve only the memories that are relevant to the current claim.
The retrieval flow is:
current claim state
→ build structured memory query
→ fetch candidate memories
→ score each memory
→ rank relevant memories
→ format safe memory context
→ write MemoryHit audit rows for real runs
Memory remains context, not evidence. It can warn, explain a pattern, or help route a claim to review. It cannot overwrite current extraction, replace policy evidence, approve, reject, or make final decisions.
The memory query was built to convert the current claim into structured retrieval signals.
Without this layer, retrieval would either be too broad or unsafe. For example, matching only on claimant name could incorrectly attach one claimant’s history to another claimant with a similar name.
So Day 4 builds a BuiltMemoryQuery from stable claim state:
runId
claimantId / customerId
policyId
vendorId
missingFields
requiredEvidence
fieldPaths
tags
lossType
damageType
The query can be built from either:
1. A real DB ExtractionRun
2. A Week 5 packet fixture
This lets the same retrieval code work for both product flow and smoke-test/eval fixtures.
The retrieval layer uses structured signals instead of raw old claim history.