./flows
EVERY REPO DESERVES
AN AGENT ROSTER.
./flows holds one markdown agent per job: code review, release notes, issue triage. They're diffable in PRs. They're provable with md eval. And new teammates, human or AI, learn how the project actually works by reading them.
A flow is one markdown file: frontmatter config, prompt body, colocated evals. Run it on any engine. Every rough run is raw material. Bad outputs become failing eval cases. Fixes arrive as reviewable diffs. Nothing lands unless the suite passes. Your agents get better because you used them.
four ways to start
SET UP A PROJECT. CREATE A FLOW.
IMPROVE IT. TAKE IT EVERYWHERE.
These browser-only fixtures show a guided engine inspecting a project and suggesting flows, then how md creates one from an empty terminal, evolves it from evidence, and resolves personal flows everywhere.
Previous and Next move one meaningful beat. In the focused terminal, use ← and →; gates still require confirmation.
Browser fixture only: no repo inspection, engine call, or file write occurs. Commands, gates, and safety labels mirror the product contract.
FREEENGINELOCAL WRITE
Pick a story, then use Previous, Play, Next step, or the terminal. Gates still require confirmation.
change with proof
FEEDBACK IN.
REVIEWABLE PROOF OUT.
Tell a flow what went wrong with md feedback. mdflow drafts a private prompt proposal, checks its capability delta, and measures current versus candidate behavior. Your working tree does not change until you explicitly apply a reviewed run.
feedback → reviewed eval → plan → proposal → proof → review → apply. Every transition has stable status and reason codes. Cost and writes are printed before paid work begins.
➜ ~md feedback flows/answer.md "too verbose — one word"
Feedback fb_01J… saved — status: open, not yet proved
➜ ~md feedback distill fb_01J…
private eval draft created — deliberately failing until reviewed
➜ ~md evolve plan flows/answer.md
Cost 3 invocations · Writes private artifact only
Safety no new command/import capabilities allowed
➜ ~md evolve propose flows/answer.md --yes
current ✗ 0/1 · proposal ✓ 1/1 · capability delta none
VERIFIED IMPROVEMENT — source unchanged — evr_01J…
➜ ~md evolve show evr_01J…
review prompt diff, receipt, and planned/actual cost
➜ ~md evolve apply evr_01J… # separate decision
➜ ~
Claims match proof
“Verified improvement” requires a feedback-linked red/green case. A clean uncovered change is labeled regression-safe, never “fixed.”
Canonical source stays still
Current and proposal run from separate off-path snapshots. Drafting and verification never expose a half-gated candidate at the real flow path.
Evidence is durable
Stable feedback IDs move through open, targeted, resolved, or dismissed. Rejection and infrastructure failures leave the reported problem open.
Capabilities cannot sneak in
The prompt body may change, but new commands, executable fences, URLs, providers, globs, or broader file access are blocked before candidate execution.
Proof is content-bound
Receipts bind flow imports, suite code, merged config, engine/model, mdflow version, and cases. Timeouts and flakes are inconclusive, not passes.
Apply is transactional
Review first. Explicit apply uses a per-flow lock, hash compare-and-swap, atomic writes, lineage, and a hash-guarded rollback command.
$ md feedback flows/review.md "missed the race condition"
Read the protocol: evidence, proof, review, rollbackAgent-first
LET YOUR AGENT
SET IT UP.
You already have an agent open. Paste one of these and let it build your ./flows roster, wire the engines, and add behavioral guardrails. You watch.
Engine Resolution · No Filename Ceremony
The Engine Ladder
The engine is environment, not filename ceremony. Bare review.md runs on your default engine (pi, bridging your Codex login automatically). Pin one per file, per shell, or per project. The ladder resolves it and tells you which rung won.
---
description: review staged changes
---
Review this diff for bugs.
Be terse, cite file:line.
!`git diff --cached`
➜ ~md review.md
review.md → pi (engine: default)
src/auth.ts:42 token never expires...
➜ ~MDFLOW_ENGINE=claude md review.md
review.md → claude (engine: env)
Same flow, different brain.
Evals · Trust Ledger
Evals: Prove It
If a guardrail isn't covered by an eval, it's a wish. Colocate review.eval.ts with your flow. Each case runs in an isolated temporary workspace. The cost is printed before a single turn is spent. Clean runs are stamped in the trust ledger.
const cases = [{
name: "flags the planted bug",
setup: (dir) => plantBug(dir),
check: ({ stdout }) =>
/auth\.ts:\d+/.test(stdout)
? null
: "missed the planted bug",
}];
export default cases;
➜ ~md eval review.md
review.md: 1 case × 1 flow run each = 1 flow invocation
✓ flags the planted bug
1/1 passed
clean run recorded in trust ledger
Multi-Agent
Parallel Analysis
Spawn sub-agents to analyze different parts of your codebase in parallel. Each expert focuses on their domain. The parent synthesizes insights and prioritizes action.
---
model: sonnet
---
Analyze codebase for improvements:
## Security
!`md scan-security.agy.md`
## Performance
!`md scan-perf.codex.md`
## Complexity
!`md scan-complexity.copilot.md`
Prioritize top 5 changes by impact.
➜ ~md audit.claude.md
→ Spawning: scan-security.agy.md
→ Spawning: scan-perf.codex.md
→ Spawning: scan-complexity.copilot.md
→ 3 analyses complete, synthesizing...
Top 5 changes identified by impact...
Chain Agents
Agent Pipelines
Pipe agents together. Research flows into planning flows into implementation. Each agent's output becomes the next agent's input.
---
model: gpt-5.5-codex-max
full-auto: true
---
Implement this plan:
{{ _stdin }}
Write clean, tested code.
➜ ~md research.agy.md \
➜ ~ | md plan.claude.md \
➜ ~ | md implement.codex.md
→ research → plan → implement
Feature implemented with tests...
Sub-Agents
Orchestrated Workflows
Parent agents spawn children, wait for results, then continue. Build release pipelines, review workflows, or any multi-step process.
---
model: sonnet
---
Prepare release {{ _version }}:
## Tests
!`md run-tests.codex.md`
## Changelog
!`md changelog.agy.md`
Generate release notes from above.
➜ ~md release.claude.md --_version "2.0.0"
→ Spawning: run-tests.codex.md
→ Spawning: changelog.agy.md
→ Sub-agents complete, resuming...
Release notes for v2.0.0 ready
@ References
File Imports
Pull in files, globs, line ranges, or URLs. Import conventions, examples, or entire directories. The agent sees exactly what it needs.
---
model: sonnet
---
Review this PR:
@./src/api/**/*.ts
@./src/types/index.ts:1-50
Follow:
@./CONVENTIONS.md
@https://style.company.com/api
➜ ~md review.claude.md
→ Glob: src/api/**/*.ts (12 files)
→ Range: types/index.ts:1-50
→ Import: CONVENTIONS.md
3 issues found, 2 suggestions...
Multi-Provider
Any AI, One Syntax
Same template, any AI. Pin an engine in the filename (task.claude.md, task.agy.md), the frontmatter (engine: codex), or nowhere at all. The ladder resolves it. Portable keys like model translate per engine.
---
model: gemini-3.1-pro
dangerously-skip-permissions: true
---
Refactor to async/await:
@./src/{{ _target }}.ts
{% if _strict %}
No any types.
{% endif %}
➜ ~md refactor.agy.md --_target "api"
refactor.agy.md → agy (engine: filename)
→ Model: pro
Refactored api.ts to async/await
.i. Sessions
Interactive Mode
Add .i. to the filename for a live conversation. Debug issues, explore ideas, iterate on solutions, without re-running the agent.
---
model: sonnet
add-dir: ./src
---
Help me debug: {{ _bug }}
@./src/auth/**/*.ts
➜ ~md debug.i.claude.md --_bug "token expires"
→ Mode: interactive (from .i.)
→ Starting claude session...
Let's trace the token flow...