Skip to main content

AI Agent Development Workflow CLI - Universal version

Project description

DevFlow v2.0

Universal AI Agent Development Workflow CLI with TOML-based progressive disclosure.

Overview

DevFlow v2.0 is a development workflow tool designed for AI-assisted software development. It uses TOML configuration to define workflows with progressive disclosure - AI agents see one step at a time, advancing only when gates are satisfied.

Key Features

  • TOML Workflow Definition - Configure workflows in .devflow/workflows/*.toml
  • Progressive Disclosure - One step at a time via CLI
  • Gate System - Objective verification before advancement
  • Fail Routes - Automatic routing on gate failure with escalation thresholds
  • Cross-Workflow References - Seamless transitions between workflows (e.g., MODE-B → MODE-A)
  • Workflow Inheritance - Extend existing workflows
  • Prompt Reuse - File references for complex prompts
  • Config Variables - Reference {test_command}, {lint_command} etc. from config
  • Universal Design - Works with any programming language
  • Ralph Loop - Autonomous execution: devflow run drives the workflow automatically
  • VCS Abstraction - Git/SVN/no-VCS checkpointing via unified driver interface

Installation

pip install agent-devflow

Or from source:

git clone https://github.com/Dqz00116/devflow
cd devflow
pip install -e .

Quick Start

If .devflow/ already exists in the project, skip init and use it directly.

devflow init copies workflows and prompts from the DevFlow repository's own .devflow/ as the template.

# Only run init if .devflow/ does NOT already exist
devflow init --language python --name "My Project"

# List available workflows
devflow list-workflows

# Select a workflow (e.g., MODE-A for feature development)
devflow select-workflow MODE-A

# Follow the displayed instruction
devflow current

# When done, mark step complete and advance
devflow done

# Repeat until workflow complete

Workflow Commands

devflow list-workflows              # List all available workflows
devflow select-workflow MODE-A      # Select and start a workflow
devflow current                     # Show current step instruction
devflow done                        # Check gates and advance (or route on failure)
devflow back                        # Go back to previous step
devflow workflow-status             # Show workflow status
devflow approve ITEM                # Mark item as user-approved
devflow set KEY VALUE               # Set a state variable

# Ralph Loop — Autonomous Execution
devflow run [--tool local] [--max-iterations 10]   # Start autonomous loop
devflow loop-status                                  # Show loop status and remaining tasks
devflow sync-backlog                                 # Generate backlog from current workflow
devflow loop-reset                                   # Reset loop progress (preserves history)

Workflow Structure

Workflows are defined in TOML format:

# .devflow/workflows/my-workflow.toml
[workflow]
id = "MY-WORKFLOW"
name = "Feature Development"
extends = []  # Inheritance support

[[steps]]
id = "req-create"
name = "Create Requirement"
prompt = """
Your instruction here...
"""
gates = ["file_exists:docs/requirements/REQ-{workflow_run_id}.md"]
next = "next-step"

[[steps]]
id = "complex-step"
name = "Complex Step"
prompt_file = "prompts/complex.md"  # File reference
gates = ["command_success:{test_command}"]
next = ""

[[steps.fail_route]]
min_fails = 1
max_fails = 2
target = "fallback-step"    # Fails 1-2 times → go to fallback

[[steps.fail_route]]
min_fails = 3
target = "OTHER-WORKFLOW:escalation"  # Fails 3+ times → cross-workflow

Config Variables

Reference project commands from .devflow/config.toml in gates and prompts:

  • {test_command} - Test command (e.g., pytest, go test ./...)
  • {test_unit_command} - Unit test command
  • {test_integration_command} - Integration test command
  • {lint_command} - Lint command
  • {build_command} - Build command
  • {workflow_run_id} - Current workflow run ID (auto-generated)

Gate Conditions

Gates verify step completion before advancing:

  • file_exists:path/to/file - File must exist
  • file_exists_pattern:docs/REQ-*.md - Any file matching glob
  • file_contains:path/file.md:content - File must contain text
  • file_contains_pattern:docs/REQ-*.md:content - Any matching file contains text
  • user_approved:ITEM-001 - User approval required (via devflow approve)
  • command_success:pytest - Command must exit 0
  • state_set:var_name - State variable must be set

Fail Routes

When gates fail, steps can define automatic routing based on failure count. This implements branching without requiring agent decisions.

[[steps]]
id = "debug-fix"
gates = ["command_success:{test_command}"]
next = "debug-verify"

[[steps.fail_route]]
min_fails = 1
max_fails = 2
target = "debug-root-cause"    # Fails 1-2 times → re-investigate

[[steps.fail_route]]
min_fails = 3
target = "debug-question"      # Fails 3+ times → escalate to human

Behavior:

  • min_fails: Required, integer >= 1
  • max_fails: Optional, defaults to infinity
  • target: Step ID or cross-workflow reference (WORKFLOW-ID:STEP-ID)
  • Routes match in declaration order; first match wins
  • No matching route = stay and retry
  • Fail count persists across visits (only resets when gates pass), enabling escalation

Cross-Workflow References

Steps can reference steps in other workflows:

[[steps]]
id = "debug-finish"
next = "MODE-A:write-plan"    # After debug, enter MODE-A at write-plan

On transition:

  • Target workflow is loaded automatically
  • current_workflow switches to the target
  • workflow_run_id is preserved for file naming continuity

Included Workflows

MODE-A: Feature Development

  1. req-create - Create requirement document
  2. req-approve - Get user approval + create FEAT document
  3. brainstorm - Explore design options
  4. write-plan - Decompose into tasks
  5. implement-sdd - TDD implementation
  6. code-review - Review changes (requires user_approved)
  7. test-run - Run all tests
  8. verify - Collect evidence
  9. finish - Deliver and cleanup (requires REQ status: done)

MODE-B: Debug

  1. debug-root-cause - Investigate root cause
  2. debug-pattern - Pattern analysis
  3. debug-hypothesis - Form and test hypothesis (fail → back to root-cause)
  4. debug-fix - Implement fix (fails 1-2x → root-cause; fails 3x → escalate)
  5. debug-question - Question architecture (requires user_approved, then → root-cause)
  6. debug-verify - Verify fix
  7. debug-finish - Complete debug → auto-transitions to MODE-A:write-plan

Fail route escalation:

debug-fix fails 1-2 times → debug-root-cause (re-investigate)
debug-fix fails 3+ times  → debug-question (escalate to human)
debug-question approved   → debug-root-cause (try again with guidance)
debug-finish complete     → MODE-A:write-plan (full review cycle)

Project Structure

.devflow/
├── workflows/
│   ├── MODE-A.toml          # Feature development
│   └── MODE-B.toml          # Debug workflow
├── prompts/
│   ├── brainstorm.md        # Reusable prompts
│   ├── implement-sdd.md
│   └── ...
├── config.toml              # Project config
└── state.toml               # Current workflow & step (gitignored)

docs/
├── requirements/            # REQ files
├── features/                # FEAT files (technical implementation docs)
├── superpowers/specs/       # Design docs
├── superpowers/plans/       # Implementation plans
├── evidence/                # Verification evidence
├── debug/                   # Debug analysis
└── completion/              # Workflow completion summaries

Configuration

Project configuration in .devflow/config.toml:

[project]
name = "my-project"
language = "python"
stack = "Python 3.11 + FastAPI"

[commands]
test = "pytest"
test_unit = "pytest tests/unit -v"
test_integration = "pytest tests/integration -v"
lint = "ruff check ."
build = "python -m build"

[paths]
src = "src"
tests = "tests"
docs = "docs"

Legacy CLI Commands

DevFlow includes legacy commands for direct requirement/task management. These bypass the workflow engine; prefer workflow commands (current/done) for AI agents.

devflow init --language python --name "My Project"
devflow req new REQ-001 --title "Feature"
devflow feat new FEAT-001 -r REQ-001 -t "Implementation"
devflow task new -r REQ-001 -t "Task"
devflow status

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_devflow-0.1.3.tar.gz (232.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_devflow-0.1.3-py3-none-any.whl (65.3 kB view details)

Uploaded Python 3

File details

Details for the file agent_devflow-0.1.3.tar.gz.

File metadata

  • Download URL: agent_devflow-0.1.3.tar.gz
  • Upload date:
  • Size: 232.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for agent_devflow-0.1.3.tar.gz
Algorithm Hash digest
SHA256 032642f959a0ef402d2fc59f41dd7c0149b34150a58eafc857b77a18a59b004f
MD5 517ad450c28f575eb52b1c25680857ca
BLAKE2b-256 b740e538b597a6059751bd4872262f351cce0017dec1add68440f30535fe545a

See more details on using hashes here.

File details

Details for the file agent_devflow-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: agent_devflow-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 65.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for agent_devflow-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ba9219ba84277b4a239b2a7b0a1f62dd4e919efbc84f8e4ce5d890f2dd39e12d
MD5 ab321c5d59bc653a839f62bc233d9cbe
BLAKE2b-256 4ba9ee38b529ffcb139d1e717776c5a163431ea16ddf4f79ed643b4eb71e18a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page