Skip to content

symfonic.capabilities.memory.recall_evidence

recall_evidence

The tag-only recall evidence governance may consume.

Memory recall is untrusted prompt content. Governance does not need the content, record ids, or provenance to decide whether a configured class of recall deserves review; it only needs the classifications the record producer already attached. Keeping that projection here makes the boundary explicit.

recalled_tags

recalled_tags(result: RetrievalResult) -> tuple[str, ...]

Return stable, non-empty classifications from records recalled this turn.

Malformed third-party metadata is not evidence. It is ignored rather than guessed at, so a dict, number, or bytes value cannot accidentally turn into a broad review signal. The returned values are classifications only; no memory text, identifier, score, or scope crosses this seam.

Source code in src/symfonic/capabilities/memory/recall_evidence.py
def recalled_tags(result: RetrievalResult) -> tuple[str, ...]:
    """Return stable, non-empty classifications from records recalled this turn.

    Malformed third-party metadata is not evidence.  It is ignored rather than
    guessed at, so a dict, number, or bytes value cannot accidentally turn into
    a broad review signal.  The returned values are classifications only; no
    memory text, identifier, score, or scope crosses this seam.
    """
    tags: list[str] = []
    seen: set[str] = set()
    for recalled in result.memories:
        value = recalled.record.metadata.get(RECALL_TAGS_KEY, ())
        values = (value,) if isinstance(value, str) else value
        if not isinstance(values, Sequence) or isinstance(values, (bytes, bytearray)):
            continue
        for item in values:
            if not isinstance(item, str):
                continue
            tag = item.strip()
            key = tag.casefold()
            if tag and key not in seen:
                seen.add(key)
                tags.append(tag)
    return tuple(tags)