m_flow is a free, open source databases project written in Python and released under Apache-2.0. It has 4,504 GitHub stars, 258 forks and 13 open issues, and was last pushed 16 days ago. On this registry it ranks #63 of 81 tracked projects in Databases, with 5 head-to-head comparisons available. It gained 3 stars over the last 3 tracked days.

What is m_flow?

What it is

M-flow is a Python bio-inspired cognitive memory engine positioned as a new paradigm for Graph RAG. It lives in the LLM retrieval and agent-memory ecosystem, as a database-like component for knowledge graphs, episodic memory, long-term memory, and MCP workflows.

The project addresses the gap between similarity and relevance in retrieval systems. Traditional RAG often ranks text units by vector distance, while many GraphRAG systems use entities, relations, and communities mainly to organize or expand context. M-flow instead uses a four-layer cone graph, Episode to Facet to FacetPoint to Entity, to anchor a query at a matching granularity and then propagate evidence along typed, semantically weighted edges. The returned unit is an Episode bundle, scored by the strongest reasoning path that connects it to the query, so a downstream LLM can compose an answer from coherent evidence.

Key capabilities

  • It scores evidence paths through typed, semantically weighted graph edges instead of relying only on vector similarity.
  • It anchors queries on matching granularity in a four-layer cone graph: Episode, Facet, FacetPoint, Entity.
  • It returns an Episode bundle with associated Facets and FacetPoints for downstream LLM composition.
  • It uses vector search across multiple granularities to find entry points before graph propagation decides scoring.
  • It is positioned for agent memory, episodic memory, long-term memory, knowledge graphs, and MCP workflows.

Who uses it and how

  • Teams building LLM agents can use it as a memory engine for episodic and long-term recall.
  • Developers can integrate it into Graph RAG pipelines where entity and relation structure must influence retrieval scoring.
  • The topic list indicates use in MCP workflows, where it can serve as a memory component.
  • Users can inspect the retrieval architecture and examples to understand how evidence paths are formed.

Getting started

The README excerpt does not give Docker images or package-manager commands; it points to Quick Start, examples, and architecture docs, and states Python 3.10–3.13 support.

When to use it — and when not to

Use it when graph evidence paths matter more than chunk similarity, especially for episodic agent memory and multi-granularity context. Avoid it when you need a documented one-command deployment, a named database backend, or a mature project history, because the provided facts list no Docker image, package manager, or storage requirement and show a zero-year repo age. The excerpt does not specify database, storage, or SMTP operations, so self-hosting burden cannot be fully assessed.

project readme (upstream, from github) — read inline

M-flow

RAG matches chunks. GraphRAG structures context. M-flow scores evidence paths.

Retrieval through reasoning and association — M-flow operates like a cognitive memory system.

m-flow.ai · flowelement.ai · Quick Start · Architecture · Examples · OpenClaw Skill · Contact

Tests Python License


What is M-flow?

The real shift is not whether a system builds a graph, but what the graph is allowed to do at retrieval time.

Graph topology encodes relevance.

In most RAG systems, retrieval is still dominated by similarity: the query is embedded, textual units are ranked by vector distance, and structure—if present—mainly helps organize, summarize, or expand context. Many GraphRAG systems add entities, relations, and community structure, but the graph often remains supportive rather than decisive in scoring.

M-flow takes a different approach: the graph is the scoring engine. When a query arrives, vector search casts a wide net across multiple granularities to find entry points. Then the graph takes over — propagating evidence along typed, semantically weighted edges, and scoring each knowledge unit by the strongest chain of reasoning that connects it to the query.

Relevance is not a score. It's a path.

That distinction matters because similarity and relevance are not identical.
Similarity is proximity in representation space. Relevance is whether the system can connect the query to the answer through a coherent structure of evidence.

Similar and relevant sometimes overlap, but they are fundamentally different.
Consider an everyday query: "Why was Maria upset at Monday's standup?"

Traditional retrieval — keyword overlap can look related, yet miss the real cause:

flowchart LR
    Q["Query: Why was Maria upset\nat Monday's standup?"] -->|"similarity on repeated words:\nstandup / upset / team"| C1["Document: how to run effective\ndaily standups (handling conflict,\nteam communication tips)"]
    C1 -->|"✗ high keyword overlap,\nbut generic advice"| R["Looks relevant by words,\nnot the cause of THIS event"]

M-flow retrieval — anchor at matching granularity, then graph propagation to the Episode bundle:

M-flow stores knowledge in a four-layer cone graph: Episode → Facet → FacetPoint → Entity. A query lands on the layer that matches its granularity — a precise cue hits a fine-grained FacetPoint; a broader theme hits a Facet or an Episode summary. Here the specific cue "I wasn't told about the deadline" anchors on a FacetPoint at the same granularity, and graph propagation then routes up through its Facet to the Episode it belongs to. Each returned bundle is one Episode, scored by its strongest path of evidence.

flowchart LR
    Q["Query:<br/>Why was Maria upset<br/>at Monday's standup?"]
    Q -->|"vector hit at matching<br/>granularity"| FP["FacetPoint (anchor)<br/>'I wasn't told about<br/>the deadline'<br/>— Maria, Mon 09:15"]
    FP -->|"belongs to"| F["Facet<br/>Deadline communication<br/>gap raised at standup"]
    F -->|"part of"| EP["Episode (bundle)<br/>Monday standup discussion<br/>(contains Maria's complaint AND<br/>the weekend deadline change<br/>context she referenced)"]
    EP --> R["Answer composed from<br/>the Episode bundle's contents:<br/>Maria was blindsided by a<br/>weekend deadline change<br/>she was not included in"]

The downstream LLM then composes the final answer from the bundle's content (the Episode together with its Facets and FacetPoints). For the full path-cost mechanism, see Retrieval Architecture.

Key idea: similarity matches by overlapping words; M-flow matches by granularity-aligned anchors and then routes through the cone graph to a coherent Episode bundle.

The graph finds the answer not by matching words, but by following the chain of evidence. This difference — from candidate matching to path-cost retrieval — is what drives M-flow's advantage in our reported benchmarks.

M-flow operates like a cognitive system: it captures signal at the sharpest point of detail, traces associations through structured memory, and arrives at the right answer the way human recall does.

How It Works

M-flow organizes knowledge into a four-level Cone Graph — a layered hierarchy from abstract summaries to atomic facts:

Level What it captures Query example
Episode A bounded semantic focus — an incident, decision process, or workflow "What happened with the tech stack decision?"
Facet One dimension of that Episode — a topical cross-section "What were the performance targets?"
FacetPoint An atomic assertion or fact derived from a Facet "Was the P99 target under 500ms?"
Entity A named thing — person, tool, metric — linked across all Episodes "Tell me about GPT-4o" → surfaces all related contexts

Graph-routed Bundle Search

Retrieval is graph-routed: the system casts a wide net across all levels, projects the hits into the knowledge graph, propagates cost along supported evidence paths, and scores each Episode by its strongest chain of evidence.

One strong path is enough — the way a single association can trigger an entire memory.

Association as controlled propagation

M-flow treats association as controlled graph propagation, not as a one-shot similarity match.

A query first lands on the most precise anchor it can find — an Entity, FacetPoint, Facet, or Episode. From that anchor, evidence spreads through nearby typed edges and connected memory units. Each hop expands the semantic field, but each edge also adds cost. This means association is not a random graph walk: only paths with coherent, low-cost connections remain competitive.

A simple analogy: thinking of classmate A may first bring up the fact that A grew up in California. That fact opens a wider neighborhood of California-related memories; within that neighborhood, the Lakers may become the next low-cost association. M-flow models this kind of recall as path-cost propagation through a structured memory graph.

In the inverted-cone view, each hop can be seen as moving toward a wider semantic cross-section: from a precise cue, to a related fact or facet, to the broader Episode that contains the useful context.

The figure below is a visual aid for this process, laid out left-to-right (cue on the left, broader Episodes on the right; supplementary to the text above):

flowchart LR
    Q["Cue / query\nclassmate A"]
    A["Anchor (Entity)\nA"]
    FP1["FacetPoint\nA grew up in California"]
    F1["Facet\nCalifornia background"]
    FP2["FacetPoint\nA is a Lakers fan"]
    E1["Episode\nschool years context"]
    E2["Episode\nNBA chat memory"]

    Q -->|anchor match| A
    A -->|typed edge + cost| FP1
    FP1 -->|graph propagation| F1
    F1 -->|supported path| E1
    F1 -->|low additional cost| FP2
    FP2 -->|supported path| E2

Unified multi-granularity retrieval

Storing knowledge at multiple granularities is useful, but it is not enough.

Some memory systems keep separate layers for episodic memories, atomic facts, entities, or summaries. When these layers are queried separately, retrieval tends to work best when the user's query matches the selected layer: an episodic query retrieves Episodes; an atomic query retrieves atomic facts.

M-flow connects these granularities inside one graph. Episodes, Facets, FacetPoints, Entities, and semantic edge descriptions are all searchable entry points, but they are not isolated retrieval silos. A precise query can enter through a FacetPoint and return the Episode it belongs to. A broad query can enter through an Episode summary. An entity query can bridge multiple Episodes through the same Entity node.

The user does not need to choose the right memory layer. M-flow lets the query find the right-granularity anchor, then uses the graph to return the memory bundle with the strongest supporting path.

How the routing maps in practice:

Query style Typical entry layer
Broad / thematic — "How did Q3 planning go?" Episode summary (direct hit; penalized)
Mid-grained / topical — "deadline communication issues" Facet
Precise / atomic — "'I wasn't told about the deadline'" FacetPoint
Entity-centered — "anything about Maria" Entity

M-flow retrieval at a glance

**1. Graph-led retrieval (not

readme truncated — read the full docs on github

Frequently asked questions

Is m_flow free to use?

m_flow is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does m_flow do?

A bio-inspired cognitive memory engine — a new paradigm for Graph RAG.

What is m_flow written in?

m_flow is primarily written in Python. Its source is publicly available at https://github.com/FlowElement-xinliuyuansu/m_flow, and it has 4,504 GitHub stars.