Skip to content

Formal derived_from relation type for memory provenance #19

Description

@arreyder

Problem

When a consolidation/summarization process produces a new memory from several source observations (see #5), we need to know which sources it came from — for citation, debugging bad summaries, and cascading deletes.

Today relate_memories supports arbitrary bidirectional links, but there's no standard relation type for provenance. The broker's MemoryPacketItem.Reason is a freeform string, not a queryable edge.

Proposal

Add a reserved relation type derived_from (and its inverse source_of) to relate_memories. Extend list/search/similar tools to optionally follow/include provenance edges.

Schema

No new Solr schema — relations are already stored. Just a convention + validation.

Tooling

  • relate_memories rejects unknown relation types when strict=true (keeps freeform as default for back-compat)
  • get_memory(id, include_sources=true) returns source observations inline
  • delete_memory(id, cascade_derived=true) optionally deletes children

When we'd write derived_from

  • Consolidation job produces an extracted_fact from N observation memories
  • Bulk import of a conversation thread → per-turn observations, then a summary memory linked back
  • Manual /remember that summarizes a previous scratchpad note

Acceptance

Prior art

agentmemory calls this "citation provenance" — every compressed memory traces back to source observations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions