MADFLOW (Multi-Agent Development Flow) is a development framework where multiple AI agents collaborate as a team to autonomously advance software development.
- Simple 2-agent structure: Consists of only a Superintendent and Engineers
- Centralized Superintendent management: The Superintendent oversees PM, design, review, and merging
- Autonomous task management: AI agents handle everything from issue creation to implementation, review, and merging
- Context reset functionality: Automatic refresh mechanism to prevent AI performance degradation
- Git/GitHub integration: Automatically manages branch strategy and issue synchronization
- Auto GitHub account identification: Automatically identifies the GitHub account at startup — no
authorized_usersconfiguration needed - User-namespaced branches and worktrees: Feature branches and worktrees are scoped per GitHub user to prevent conflicts in multi-engineer environments
- Assignee-based issue filtering: Each engineer agent only processes issues assigned to their GitHub account
- Automatic worktree cleanup: Merged worktrees are automatically removed after PR merge
- Legacy resource management: Detects and cleans up old-format branches and worktrees with backward-compatible warnings then auto-deletion
- Lesson injection: Accumulated lessons are automatically injected into the Superintendent's context to improve decision-making over time
- Enhanced CI and review quality: Automated lint, security scanning, coverage thresholds, and risk-level-based merge strategy
- Go 1.25 or higher
- Git
- One of the following (depending on the backend you use):
- Claude Code (
claudecommand) - when using the Claude CLI backend - gemini-cli (
gemini-clicommand) - when using Gemini models ANTHROPIC_API_KEYenvironment variable - when using the Anthropic API key backend (no additional installation required)
- Claude Code (
- GitHub CLI (
gh) (when using GitHub Issue synchronization)
go install github.com/ytnobody/madflow/cmd/madflow@latestDownload the binary for your OS and architecture from GitHub Releases.
# Example for Linux (amd64)
curl -L https://github.com/ytnobody/madflow/releases/latest/download/madflow-linux-amd64 -o madflow
chmod +x madflow
sudo mv madflow /usr/local/bin/After installation, you can also upgrade to the latest version with the madflow upgrade command.
cd your-project
madflow initA madflow.toml file will be generated. Edit the configuration as needed.
madflow startConfiguration is managed via madflow.toml in the project root.
[project]
name = "my-app"
[[project.repos]]
name = "main"
path = "."
[agent]
context_reset_minutes = 8
[agent.models]
superintendent = "claude-opus-4-6"
engineer = "claude-sonnet-4-6"
# Gemini models are also supported:
# superintendent = "gemini-2.0-flash-exp"
# engineer = "gemini-2.5-pro"
# Anthropic API key method (requires ANTHROPIC_API_KEY environment variable):
# superintendent = "anthropic/claude-sonnet-4-6"
# engineer = "anthropic/claude-haiku-4-5"
[branches]
main = "main"
develop = "develop"
# feature_prefix is auto-set to "madflow/<gh_login>/issue-" when GitHub CLI is authenticated.
# Override only if you need a custom prefix:
# feature_prefix = "custom/prefix-"[github]
owner = "myorg"
repos = ["my-app"]
sync_interval_minutes = 5When GitHub integration is enabled, MADFLOW automatically identifies the authenticated GitHub account at startup using gh auth status. No additional authorized_users configuration is required — MADFLOW uses the account returned by gh auth status as the authorized user.
| Command | Description |
|---|---|
madflow init |
Initialize the project |
madflow start |
Start all agents |
madflow use <preset> |
Switch model preset |
madflow version |
Display the current version |
madflow upgrade |
Upgrade madflow to the latest version |
You can switch the models in use with the madflow use <preset> command.
| Preset | superintendent | engineer | Notes |
|---|---|---|---|
claude |
claude-sonnet-4-6 | claude-sonnet-4-6 | Claude CLI (requires Pro/Max) |
claude-cheap |
claude-sonnet-4-6 | claude-haiku-4-5 | Claude CLI cost-reduced version |
gemini |
gemini-2.5-pro | gemini-2.5-pro | Gemini CLI (requires gemini-cli) |
gemini-cheap |
gemini-2.5-flash | gemini-2.5-flash | Gemini fast & low-cost version |
hybrid |
claude-sonnet-4-6 | gemini-2.5-pro | Hybrid configuration |
hybrid-cheap |
claude-sonnet-4-6 | gemini-2.5-flash | Hybrid low-cost version |
claude-api-standard |
anthropic/claude-sonnet-4-6 | anthropic/claude-haiku-4-5 | Anthropic API key method |
claude-api-cheap |
anthropic/claude-haiku-4-5 | anthropic/claude-haiku-4-5 | Anthropic API key method - cheapest |
The claude-api-* presets call Anthropic's API directly using ANTHROPIC_API_KEY instead of the Claude Code CLI.
Benefits:
- No Claude Code Pro/Max subscription required
- Predictable costs with pay-as-you-go pricing
- Independent from Anthropic policy change risks
Setup:
# 1. Set the Anthropic API key as an environment variable
export ANTHROPIC_API_KEY="sk-ant-..."
# 2. Switch to an API key preset
madflow use claude-api-standard # standard quality
# or
madflow use claude-api-cheap # lowest cost
# 3. Start
madflow start| Method | Estimated monthly cost | Notes |
|---|---|---|
| Claude Max (5x) | ¥15,000 | Fixed subscription fee |
claude-api-standard |
¥3,000–8,000 | Pay-as-you-go, varies by usage |
claude-api-cheap |
¥1,000–3,000 | Uses Haiku model |
hybrid-cheap |
Within gemini-cli free tier | Gemini Flash has a free tier |
※ API pricing is an estimate as of February 2026. For actual pricing, refer to the Anthropic official website.
For detailed specifications, refer to SPEC.md. For the implementation plan, refer to IMPLEMENTATION_PLAN.md.
MIT License
In the MADFLOW framework, multiple agents work in parallel on the same repository, which frequently causes branch conflicts. To avoid this, each engineer must use git worktree to isolate their own working directory.
When working on a new issue, create a new worktree with the following command:
# Example: for issue myorg-REPO-42 (with GitHub login "alice")
git worktree add -b madflow/alice/issue-myorg-REPO-42 \
.worktrees/alice/issue-myorg-REPO-42 developBranch names are automatically namespaced as madflow/<gh_login>/issue-<issueID> to prevent
collisions when multiple engineers work on the same repository. The worktree is placed under
.worktrees/<gh_login>/issue-<issueID>/ for the same reason.
MADFLOW follows a documentation-driven development workflow:
- Create worktree: Use the command above to create a worktree for each issue.
- Architecture: Design the solution and identify affected components.
- Documentation: Write or update specification documentation in
docs/specs/to describe the intended behavior. - Tests: Write or update test code that conforms to the specification documentation (test-first).
- Implementation: Write or update implementation code to make the tests pass.
- Create Pull Request: Use GitHub CLI (
gh pr create) to create a Pull Request. - Remove worktree: Once the Pull Request is merged, the worktree is removed automatically. You can also remove it manually:
# Run from the main working directory
git worktree remove .worktrees/alice/issue-myorg-REPO-42