m_flow
AGENTS.md4.5k starsChanged 3 months agoApache-2.0View on GitHub
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. See m_flow-mcp/README.md for Docker and API-mode options. Test layout: CI (.github/workflows/) runs the same commands; passing locally ≈ passing CI. Follow Conventional Commits:
- Reads credentials
- Installs packages
Files
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 + MCPFrontend console (Next.js / pnpm)
cd m_flow-frontend
pnpm install
pnpm dev # http://localhost:3000
pnpm lint && pnpm buildMCP server
cd m_flow-mcp
uv sync --dev --all-extras
uv run python src/server.py # stdio
uv run python src/server.py --transport sse # SSE modeSee m_flow-mcp/README.md for Docker and API-mode options.
3. Quality Gates
Tests
PYTHONPATH=. uv run pytest m_flow/tests/unit/ -v # ~963 test cases
PYTHONPATH=. uv run pytest m_flow/tests/integration/ -v # needs .env keysTest layout:
| Directory | Scope |
m_flow/tests/unit/ | Pure-logic, no network |
m_flow/tests/integration/ | Requires LLM / DB credentials |
m_flow/tests/cli_tests/ | CLI smoke tests |
Linting & Formatting
uv run ruff check . # lint (line-length 100, see pyproject.toml)
uv run ruff format . # auto-format
uv run mypy m_flow/ # optional type-checkCI (.github/workflows/) runs the same commands; passing locally ≈ passing CI.
4. Conventions
Code Style
| Aspect | Rule |
| Indentation | 4 spaces (Python), 2 spaces (TS/YAML) |
| Naming | snake_case functions/modules, PascalCase classes |
| Type hints | Required on public API signatures |
| Error handling | Structured; use m_flow.shared.logging_utils |
| Imports | Sorted by ruff; no wildcard imports |
Commit Messages
Follow Conventional Commits:
feat(graph): add temporal edge weighting
fix(api): handle missing auth cookie
docs: update installation instructionsPull Requests
- Branch from
dev. - Include scope, local test commands run, and any UI/MCP impacts.
- Sign commits (
git commit -s) and affirm the DCO (seeCONTRIBUTING.md). - PR titles are validated by CI (
pr_lintworkflow).
5. Docker
docker compose up # backend only
docker compose --profile ui up # backend + frontend
docker compose --profile neo4j up # backend + Neo4jEnvironment variables are documented in .env.template.
Trending
Quiet since April.thin dataabout the whole repository
Who's talking about FlowElement-ai/m_flow
The biggest 1 of 1 mention linking to the repository that our crawl found. Each line is their own headline.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

