M-flow is a retrieval and memory engine for large-language-model applications that uses knowledge-graph paths to connect questions with evidence. It is for systems that need reasoning-oriented Graph RAG and cognitive-style memory, with the catalogue instruction serving as an agent workflow for using it.
Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/flowelement-xinliuyuansu/m_flow/agents-mdgit clone --depth 1 https://github.com/FlowElement-xinliuyuansu/m_flowWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/flowelement-xinliuyuansu/m_flow/agents-md)<a href="https://agentmods.dev/instructions/flowelement-xinliuyuansu/m_flow/agents-md"><img src="https://agentmods.dev/badge/instructions/flowelement-xinliuyuansu/m_flow/agents-md.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01075 | $0.01075 |
| Opus 5 | $0.00537 | $0.00537 |
| Sonnet 5 | $0.00215 | $0.00215 |
| Haiku 4.5 | $0.00108 | $0.00108 |
Grade A, and why
m_flow AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 152 lines — stays where its author put it; the contents beside it link to each section on GitHub.
M-flow — Developer & Agent Reference
This file is intended for AI coding assistants (Cursor, Copilot, etc.) and human contributors alike. It describes the repository layout, toolchain, and conventions needed to make changes safely.
1. Repository Map
m_flow/ Python core (FastAPI + pipeline engine)
api/ HTTP routers: add, memorize, search, delete, …
cli/ CLI entrypoint (`mflow`)
adapters/ DB adapters (graph, vector, cache)
llm/ LLM providers, prompts, structured output
core/ Domain models (Episode, Facet, FacetPoint, …)
memory/ Memory processing (episodic, procedural)
retrieval/ Search & retrieval algorithms
pipeline/ Composable pipeline tasks & orchestration
auth/ Authentication & multi-tenancy
eval/ Evaluation harnesses & adapters
shared/ Logging, settings, loaders, cross-cutting utilities
tests/ Pytest suite (unit / integration / CLI)
m_flow-frontend/ Next.js console (pnpm)
m_flow-mcp/ MCP server — exposes memory as tool calls
mflow_workers/ Modal / worker helpers for distributed runs
examples/ Runnable demo scripts (Python, notebooks)
alembic/ SQL migration scripts (Alembic)
Extension Points
- New data source → add a loader under
shared/loaders/ - New pipeline step → add a task under
pipeline/ - New graph DB → implement the adapter interface in
adapters/graph/ - New vector store → implement adapter in
adapters/vector/ - New LLM provider → extend
llm/LLMGateway.py
2. Local Development
Python backend (requires Python 3.10 – 3.13)
# Bootstrap
uv sync --dev --all-extras --reinstall
# Run the API server
uv run python -m m_flow.api.client
# CLI quick-start
uv run mflow add "M-flow builds structured memory for agents."
uv run mflow memorize
uv run mflow search "How does M-flow work?"
uv run mflow -ui # launches backend + frontend + MCP
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 152 lines · 1,075 tokens per session scan A c86577d5cde0
m_flow AGENTS.md is an instructions file published in the GitHub repository FlowElement-xinliuyuansu/m_flow (4,497 stars, last pushed 4d ago), licensed Apache-2.0. It adds 1,075 tokens to every session, about $0.0054 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
vellis AGENTS.md
AGENTS.md instructions for volantlabs/vellis, covering agents.md, repository purpose, startup checks, installing vellis for a user and model-first component workflow.
aingle GEMINI.md
Gemini CLI instructions for ApiliumCode/aingle, covering systemprompt: architect & developer mode, 1. reglas de identidad y propiedad, 2. gestión de contexto (carpeta /contexto), 3. calidad y ejecución de código and 4. administración de capacidades y límites (anti-colapso).
omnigraph AGENTS.md
AGENTS.md instructions for ModernRelay/omnigraph, covering omnigraph agent guide, required reading, repository snapshot, documentation map and engineering rules.
engraphis AGENTS.md
AGENTS.md instructions for Coding-Dev-Tools/engraphis, covering agents.md — engraphis, internal subagent delegation, 0. read this first — two architectures live in one package, 1. commands and ── unified dashboard + memory inspector ──.
altk-evolve AGENTS.md
AGENTS.md instructions for AgentToolkit/altk-evolve, covering what is evolve?, key concepts, architecture flow, project directory tree (some files omitted for brevity) and first time setup.
Meterless AGENTS.md
Instructions for Meterless/Meterless, covering agent instructions for meterless, routing table, isolation rule, repo-wide rules and non-coding agents.