Skip to content

memory2 - per-stream metadata kv store #1977

@leshy

Description

@leshy

want to attach arbitrary key/value config to a stream and have it persist alongside observations.

first usage of this is record reply #1976 storing original topic names for streams (but I assume this is just first usage, embedding model name for embedding stream would be another example)

store.streams.lidar.metadata.calibration_offset = 3
store.streams.lidar.metadata.set("frame_id", "base_link")
store.streams.lidar.metadata.update({"sensor_model": "mid360", "rate_hz": 10})
store.streams.lidar.metadata["calibration_offset"]  # 3

distinct from per-observation Observation.tags (dimos/memory2/type/observation.py:57), which is immutable-derive (obs.tag(k=v) returns a new observation). keeping the APIs separate on purpose — observations are immutable, stream metadata is mutable config that's set once and read often.

requirements:

  • attribute + dict-style get/set, plus set() / update() / delete()
  • persisted by the backend (sqlite store gets a kv table; null/memory stores keep a dict)
  • json-serializable values only at first; reject anything else loudly
  • survives store reopen

should we...?

  • make it Notifier-watchable so subscribers get told when metadata changes?
  • expose it on the Backend directly so transforms/embedders can read it (e.g. a vectorstore reads embedding_model from stream metadata)?

related: #1652 (postgres store would also need this).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions