The mem.graph namespace links sessions into the knowledge graph and queries it.
graph.link(
    session_id: str,
    *,
    used_papers: list[str] | None = None,
    claims: list[str] | None = None,
    **kw: Any,
) -> int
Link a session to the papers and claims it used. Returns the session node ID.
mem.graph.link("session_014", used_papers=["10.1/astro", "10.2/cortex"])

graph.materialize

graph.materialize() -> int
Materialize cross-session relatedness edges. Returns the number of related edges created. Two sessions relate when they share enough papers (by Jaccard overlap).
mem.graph.link("s1", used_papers=["10/a", "10/b"])
mem.graph.link("s2", used_papers=["10/a", "10/b"])
assert mem.graph.materialize() == 1

graph.query

graph.query(*, seed_session: str | None = None, hops: int = 2) -> dict[str, Any]
Return a subgraph (nodes + edges) for visualization — optionally seeded at a session and limited to hops.
viz = mem.graph.query(seed_session="session_014", hops=2)
The top-level client also exposes session linking directly:
link_session(session_id: str, **kw: Any) -> int
Kwargs: used_dois, cited_claim_ids, research_question, domain. Returns the session node ID.
node_id = mem.link_session(
    "session_014",
    used_dois=["10.1/astro"],
    research_question="Do Ca²⁺ microdomains gate gliotransmission?",
    domain="neuroscience",
)

Surface directions

Turn linked sessions into novel research directions.