Skip to content

symfonic.capabilities.memory.legacy_access

legacy_access

Legacy access bookkeeping for the records a native recall admitted.

CORE-227. Legacy hydration re-reads each recalled entry's node through GraphMemoryStore.get_node (SymfonicAgent._run_spreading_activation), and that read is what advances the node's access_count and updated_at -- the frequency signal legacy ranking and consolidation later read. The migrated hydration reads the same store through :class:LegacyRetrievalPort and never re-reads a node, so a served-memory turn on the kernel route left both fields untouched.

This decorator restores that one effect and nothing else: after the wrapped hydration it re-reads, through the legacy engine's own graph store, each record the coordinator admitted. It renders no neighbour context and changes no ranking, block or count. Like legacy, a failed re-read never fails the turn.

LegacyAccessHydrator

LegacyAccessHydrator(inner: Any, *, graph: Any, scope_of: Any)

A hydrator that records legacy access for each admitted memory.

Parameters:

Name Type Description Default
inner Any

the hydrator whose result is returned unchanged.

required
graph Any

the legacy GraphMemoryStore whose get_node records an access, the same store the legacy retrieval engine reads.

required
scope_of Any

the port's translation from a capability scope to the legacy TenantScope.

required
Source code in src/symfonic/capabilities/memory/legacy_access.py
def __init__(self, inner: Any, *, graph: Any, scope_of: Any) -> None:
    """
    Args:
        inner: the hydrator whose result is returned unchanged.
        graph: the legacy ``GraphMemoryStore`` whose ``get_node`` records
            an access, the same store the legacy retrieval engine reads.
        scope_of: the port's translation from a capability scope to the
            legacy ``TenantScope``.
    """
    self._inner = inner
    self._graph = graph
    self._scope_of = scope_of

hydrate async

hydrate(query: Any) -> Any

Hydrate, then re-read each admitted record as legacy hydration does.

Source code in src/symfonic/capabilities/memory/legacy_access.py
async def hydrate(self, query: Any) -> Any:
    """Hydrate, then re-read each admitted record as legacy hydration does."""
    hydration = await self._inner.hydrate(query)
    ids = [m.record.record_id for m in hydration.retrieval.result.memories]
    if ids:
        await self._record_access(query.scope, ids)
    return hydration