johnlindquist/mdflow

Multi-backend CLI for executable markdown prompts. Run .md files against Claude, Codex, Gemini, or Copilot.

What it solves

mdflow is a Git-native control plane for agentic workflows. It solves the problem of inconsistent, non-repeatable AI agent tasks by allowing users to define specific jobs (like code reviews or release notes) as version-controlled Markdown files. This transforms prompts into first-class CLI commands that can be piped, chained, and guarded by behavioral evaluations.

How it works

  • Markdown as Commands: Files named with a specific pattern (e.g., task.claude.md) are automatically mapped to a CLI engine (like Claude, Codex, or Gemini). The Markdown body serves as the prompt, and YAML frontmatter is converted into CLI flags.
  • Engine Resolution: It uses a resolution ladder to determine which AI engine to run, prioritizing explicit CLI flags, environment variables, and filenames over defaults.
  • Context Isolation: By default, it strips ambient context (like user config or session persistence) to ensure runs are isolated and repeatable, though this can be opted out of via _isolated: false.
  • Lifecycle Hooks: Users can attach TypeScript files (hooks) to flows to inject context or block actions during specific events (e.g., userPromptSubmit).
  • Behavioral Evals: It includes an md eval command to run behavioral test cases in isolated workspaces, ensuring prompt revisions don't introduce regressions.
  • Evolution Protocol: The md evolve command allows users to propose and verify prompt improvements based on feedback without immediately overwriting the source file.

Who it’s for

Developers and teams who want to treat their AI agent prompts as code, incorporating version control, regression testing, and a standardized way to execute AI tasks across different CLI-based LLM engines.

Highlights

  • Git-native: Flows are stored in the ./flows directory and are diffable in pull requests.
  • Unix Philosophy: Supports stdin/stdout, allowing agents to be piped (e.g., git diff | md review.md).
  • Flow Workbench: An interactive CLI surface for searching and running project, global, and installed flows.
  • Engine Agnostic: Supports a wide range of engines including pi, claude, codex, copilot, gemini, and agy.
  • Template Variables: Supports dynamic inputs via frontmatter variables, CLI flags, and interactive form prompts.

Related

  • Project
  • Project
  • Project
  • Project
  • Project