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.2.tar.gz (86.4 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.2-py3-none-any.whl (65.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_devflow-0.1.2.tar.gz
  • Upload date:
  • Size: 86.4 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.2.tar.gz
Algorithm Hash digest
SHA256 e279c6fd40e77f249444be2e0201fca1b5a767d1489f6f3e9e9be06f2bc4b382
MD5 0e920e9c84cbdab86189b2636143b7e6
BLAKE2b-256 122c3aee21696267e80e83785a31d40f380bc38fc598ab8432cf4f0aeb203c79

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agent_devflow-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 65.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8f200226526ef3d725071e6c40ff8eb75292cd57cdb97071d5865dbbfbd83a6f
MD5 7446217b1e3207a12804fc4f1b81464b
BLAKE2b-256 1370ae1210a9ba70904ff0f9e7d0f53af0b957e5455ad54f008d7b61b391f625

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