AI Initiative logoAI Initiative
Reading room / AI workflow research

01: AI-Driven Software Development

A research proposal exploring 01 AI Driven Software Development.

Research proposal
This is the retained source text, not a new validation of its claims. Numerical results and comparative claims require the accompanying source review before public reuse.

Read the connected case study or article →

Author not established in the source · Date not established

Provenance, authorship and editorial notes

01: AI-Driven Software Development

Id

ideas-01-ai-driven-software-development

Project

AI workflow research

Source path

ideas/01_AI_Driven_Software_Development.md

Source sha256

aef72539e29355aa22d66d203a9afddcec2b1c3c5e453db9ffc7d841d5a8c57e

Repo head
Not recorded
Date
Not recorded
Author
Not recorded
Document status

Research proposal

Publication status

Retained source / publication not established

Summary

A research proposal exploring 01 AI Driven Software Development.

Topics

No entries recorded.

Related ids

No entries recorded.

Evidence concerns
  • Retained source claims are not a fresh implementation or runtime certification.
  • Historical concept and design language must not be presented as delivered functionality.
  • Quantified benefits, zero-defect language and success targets in this source are hypotheses or assertions, not verified measurements.
Headings
  • 01: AI-Driven Software Development
  • Pure-AI SDLC with Parallel Phases and Async-First Architecture
  • Executive Summary
  • Problem Statement
  • Critical Issue 1: Sync/Async Mixing
  • File: workflow/shared_toolkit.py (lines 70-92)
  • PROBLEM: threading.Lock in async context
  • File: workflow/workflow_api_v2.py (line 1424)
  • PROBLEM: Sync wrapped in async wrapped in thread
  • Critical Issue 2: Sequential Phase Execution
  • File: phases/phase_integrated_executor.py (lines 187-192)
  • PROBLEM: Strict sequential loop
  • Solution Architecture
  • Part A: Async-First Rewrite
  • Part B: Parallel Phase Execution
  • Core Components
  • 1. Async Rate Limiter
  • 2. Async PostgreSQL Backend
  • 3. DAG Phase Executor
  • 4. Partial Output System
  • Integration Points
  • Files to Modify
  • Phase Dependency Graph
  • config/phase_dependencies.yaml
  • Implementation Plan
  • Phase A: Async-First (Weeks 1-6)
  • Phase B: Parallel Phases (Weeks 7-10)
  • Expected Results
  • Async-First Improvements
  • Parallel Phase Improvements
  • Combined Impact
  • Risks & Mitigations
  • Success Criteria
  • Vision: True Autonomous SDLC
Opening excerpt

**Pillar:** #1 of 12 - Core Priority
**Timeline:** 10 Weeks (6 Async-First + 4 Parallel Phases)
**Dependencies:** None
**Expected ROI:** 2-3x workflow speedup, zero deadlocks, true autonomous execution

01: AI-Driven Software Development

Pure-AI SDLC with Parallel Phases and Async-First Architecture

Pillar: #1 of 12 - Core Priority
Timeline: 10 Weeks (6 Async-First + 4 Parallel Phases)
Dependencies: None
Expected ROI: 2-3x workflow speedup, zero deadlocks, true autonomous execution


Executive Summary

Move from AI-assisted to AI-driven SDLC where agents control the loop from ideation to production with minimal human friction. This pillar addresses two critical blockers discovered in Maestro's architecture:

1. Async/Sync Mixing: Blocking operations cause 10-50ms latency per call and deadlock risk
2. Sequential Phases: False dependencies force phases to wait when they could run in parallel

Fixing these enables true autonomous execution at 2-3x current speed.


Problem Statement

Critical Issue 1: Sync/Async Mixing

# File: workflow/shared_toolkit.py (lines 70-92)
# PROBLEM: threading.Lock in async context

class RateLimiter:
    def __init__(self):
        self._lock = threading.Lock()  # BLOCKS EVENT LOOP!

    async def acquire(self):
        with self._lock:
            time.sleep(self.delay)  # FREEZES ALL ASYNC OPS!
# File: workflow/workflow_api_v2.py (line 1424)
# PROBLEM: Sync wrapped in async wrapped in thread

context = await asyncio.wait_for(
    asyncio.to_thread(_sync_execute_phase),  # Thread overhead!
    timeout=1800
)

Impact: 10-50ms per operation, deadlock risk (MD-4000 was a symptom)

Critical Issue 2: Sequential Phase Execution

# File: phases/phase_integrated_executor.py (lines 187-192)
# PROBLEM: Strict sequential loop

for phase in target_phases:
    self.current_phase = phase
    phase_execution = await self.execute_phase(phase=phase)  # WAIT

Reality: Many phases have partial independence:


Solution Architecture

Part A: Async-First Rewrite

Current:                          Target:
┌─────────────────────────┐      ┌─────────────────────────┐
│ asyncio event loop      │      │ asyncio event loop      │
│  ├─ async handler       │      │  ├─ async handler       │
│  │   └─ threading.Lock  │ →→→  │  │   └─ asyncio.Lock    │
│  │       └─ BLOCKED     │      │  │       └─ YIELDS      │
│  └─ (everything waits)  │      │  └─ (other tasks run)   │
└─────────────────────────┘      └─────────────────────────┘

Key Changes:

ComponentCurrentTarget
Locksthreading.Lockasyncio.Lock
Sleeptime.sleep()asyncio.sleep()
Databasepsycopg2 (sync)asyncpg (async)
Rate limiterThread-blockingAsync token bucket
Checkpointsjson.dumps()orjson + streaming

Part B: Parallel Phase Execution

Current (Sequential):
Requirements → Design → Implementation → Testing → Deployment
     ↓          ↓           ↓              ↓           ↓
   WAIT      WAIT        WAIT          WAIT        WAIT

Target (DAG-Based):
Requirements ────────────────────────────────→
     ↓ (partial output: core requirements)
  Design ─────────────────────────────→
     ↓ (partial: architecture)    ↓ (partial: interfaces)
  Implementation ───────────────────────→
     ↓ (module A)          ↓ (module B)
  Testing ──────────────────────────────→
     ↓ (infra prep can start early)
  Deployment ───────────────────────────→

Core Components

1. Async Rate Limiter

class AsyncRateLimiter:
    """
    Non-blocking rate limiter using async token bucket.
    """

    def __init__(self, rate: float, burst: int = 1):
        self._lock = asyncio.Lock()  # Async lock!
        self._tokens = burst
        self._rate = rate
        self._last_update = time.monotonic()

    async def acquire(self):
        async with self._lock:
            now = time.monotonic()
            elapsed = now - self._last_update
            self._tokens = min(self._tokens + elapsed * self._rate, self._burst)

            if self._tokens < 1:
                wait_time = (1 - self._tokens) / self._rate
                await asyncio.sleep(wait_time)  # Non-blocking!
                self._tokens = 0
            else:
                self._tokens -= 1

            self._last_update = time.monotonic()

2. Async PostgreSQL Backend

import asyncpg

class AsyncPostgresBackend:
    """
    Pure async database access with proper connection pooling.
    """

    async def initialize(self):
        self._pool = await asyncpg.create_pool(
            dsn=self.connection_string,
            min_size=10,   # Up from 1
            max_size=50,   # Up from 5
            command_timeout=60,
        )

    async def save(self, key: str, value: dict, version: int):
        async with self._pool.acquire() as conn:
            await conn.execute('''
                INSERT INTO state (key, value, version)
                VALUES ($1, $2, $3)
                ON CONFLICT (key, version) DO UPDATE SET value = $2
            ''', key, orjson.dumps(value), version)

    async def load(self, key: str) -> Optional[dict]:
        async with self._pool.acquire() as conn:
            row = await conn.fetchrow('''
                SELECT value FROM state WHERE key = $1
                ORDER BY version DESC LIMIT 1
            ''', key)
            return orjson.loads(row['value']) if row else None

3. DAG Phase Executor

class DAGPhaseExecutor:
    """
    Execute phases based on true dependencies, not sequence.
    """

    def __init__(self):
        self.dependency_graph = self._build_dependency_graph()
        self.partial_outputs = PartialOutputRegistry()

    async def execute(self, workflow: Workflow) -> WorkflowResult:
        completed = set()
        results = {}

        while not self.dependency_graph.is_complete(completed):
            # Find phases whose dependencies are satisfied
            ready = self.dependency_graph.get_ready_nodes(completed)

            if not ready:
                raise DeadlockError("No phases ready")

            # Execute all ready phases in parallel
            phase_results = await asyncio.gather(*[
                self._execute_phase(phase, workflow, results)
                for phase in ready
            ])

            # Update completed set with phases and partial outputs
            for phase, result in zip(ready, phase_results):
                completed.add(phase)
                results[phase] = result

                for partial in result.partial_outputs:
                    completed.add(f"{phase}:{partial.name}")

        return WorkflowResult(results)

4. Partial Output System

class PartialOutputRegistry:
    """
    Allow phases to emit partial outputs that unblock downstream.
    """

    async def emit(self, phase: str, name: str, value: Any):
        key = f"{phase}:{name}"
        self._outputs[key] = value

        # Notify waiting phases
        for callback in self._waiters[key]:
            await callback(value)

    async def wait_for(self, phase: str, name: str, timeout: float = 300) -> Any:
        key = f"{phase}:{name}"

        if key in self._outputs:
            return self._outputs[key]

        waiter = asyncio.Future()
        self._waiters[key].append(waiter)
        return await asyncio.wait_for(waiter, timeout)

Integration Points

Files to Modify

FileChangeRisk
workflow/shared_toolkit.pyReplace threading.Lock → asyncio.LockMedium
workflow/workflow_api_v2.pyRemove asyncio.to_thread wrappersHigh
maestro/state/postgres_backend.pyRewrite with asyncpgHigh
phases/phase_integrated_executor.pyDAG-based executionHigh
teams/team_execution_v2_split_mode.pyAsync checkpointsMedium

Phase Dependency Graph

# config/phase_dependencies.yaml
phases:
  requirements:
    depends_on: []
    partial_outputs:
      - name: core
        unblocks: [design]
      - name: infra
        unblocks: [deployment_prep]

  design:
    depends_on: ["requirements:core"]
    partial_outputs:
      - name: architecture
        unblocks: [security_review, implementation]
      - name: interfaces
        unblocks: [test_scaffold]

  security_review:
    depends_on: ["design:architecture"]
    parallel_with: [implementation]

  implementation:
    depends_on: ["design:interfaces"]
    partial_outputs:
      - name: module
        unblocks: [testing]

  test_scaffold:
    depends_on: ["design:interfaces"]
    parallel_with: [implementation]

  testing:
    depends_on: ["implementation:module", "test_scaffold"]

  deployment_prep:
    depends_on: ["requirements:infra"]
    parallel_with: [design, implementation, testing]

  deployment:
    depends_on: ["testing", "deployment_prep"]

Implementation Plan

Phase A: Async-First (Weeks 1-6)

Weeks 1-2: Replace Threading Primitives
Weeks 3-4: Async Database Layer
Weeks 5-6: Remove Thread Wrappers

Phase B: Parallel Phases (Weeks 7-10)

Week 7: DAG Engine
Week 8: Partial Output System
Week 9: Phase Integration
Week 10: Production Rollout

Expected Results

Async-First Improvements

MetricCurrentTargetImprovement
Lock acquisition10-50ms<1ms10-50x
DB query latency5-10ms + wait2-5ms2-5x
Concurrent workflows5-1050-10010x
Deadlock incidentsOccasionalZero100%

Parallel Phase Improvements

Workflow TypeSequentialParallelSpeedup
Simple feature60 min30 min2x
Complex feature150 min60 min2.5x
Bug fix30 min15 min2x
Architecture300 min120 min2.5x

Combined Impact

KPICurrentTarget
Cycle time (spec → deploy)HoursMinutes
Defect densityBaseline-50%
Agent-generated PRs<50%>80%

Risks & Mitigations

RiskLikelihoodMitigation
Breaking existing codeHighFeature flags, gradual rollout
asyncpg incompatibilityLowCompatibility layer, fallback
DAG deadlockLowTimeout monitoring, circuit breakers
Performance regressionLowA/B testing, benchmarks

Success Criteria

CriterionTarget
Deadlock rateZero
Workflow throughput10x increase
Average latency2-3x reduction
Parallel execution>50% of phases

Vision: True Autonomous SDLC

When complete, Maestro workflows will:

1. Execute autonomously - No blocking waits, no deadlocks
2. Parallelize intelligently - Phases overlap where dependencies allow
3. Scale horizontally - 50-100 concurrent workflows
4. Self-heal - Combined with Pillar #3 for full autonomy

This transforms Maestro from a guided assistant to a true autonomous software development system.


Status: Ready for Implementation
Owner: Core Infrastructure Team

Continue exploring