[F] AI and Human Workflow - RobertArtigas/DCT2CLASS_Docs GitHub Wiki

AI-Assisted + Human-in-the-Loop Workflow

A Language-Agnostic Model for Responsible AI Code Generation

This document maps the language-agnostic generated + handcrafted workflow directly to an AI-assisted, human-in-the-loop development model.

It defines clear roles for:

  • architecture,
  • metadata,
  • AI systems,
  • and human engineers,

so that AI accelerates delivery without eroding control, quality, or accountability.


Core Principle

AI generates proposals. Humans retain authority.

AI is treated as a powerful generator, not as an autonomous developer.


Overview: The Five Phases with AI in the Loop

  1. Architecture Design (Human-led, AI-assisted)
  2. Metadata Definition (Human-owned, AI-validated)
  3. AI-Assisted Code Generation (Controlled, replayable)
  4. Human Extension and Refinement (Protected)
  5. Testing, Verification, and Regeneration (Automated + Human review)

1) Design the Architecture (Human Authority)

Purpose: Establish intent and constraints before AI touches code.

Human Responsibilities

  • Define system boundaries and responsibilities
  • Choose architectural patterns and tradeoffs
  • Record decisions (ADRs)

AI-Assisted Support

  • Explore alternative architectures
  • Identify risks, bottlenecks, and tradeoffs
  • Generate diagrams or summaries for review

Hard Rules

  • AI may suggest architecture
  • Humans must decide architecture
  • No architecture emerges implicitly from AI-generated code

2) Collect and Manage Metadata (Human-Owned Source of Truth)

Purpose: Encode system intent in structured, verifiable form.

Human Responsibilities

  • Define schemas, contracts, constraints
  • Approve metadata changes
  • Version and validate metadata

AI-Assisted Support

  • Draft schemas from examples
  • Validate consistency and completeness
  • Detect missing constraints or ambiguities

Hard Rules

  • Metadata is explicit and reviewable
  • AI may not invent requirements
  • Metadata exists independently of generated code

3) AI-Assisted Code Generation (Controlled Automation)

Purpose: Convert metadata + architecture into code safely.

AI Responsibilities

  • Generate scaffolding and boilerplate
  • Propose implementations based on inputs
  • Follow provided templates, prompts, and constraints

Human Responsibilities

  • Own prompts and generation templates
  • Review and approve AI output
  • Decide what is accepted, rejected, or revised

Required Controls

  • Prompts stored and versioned
  • Metadata + prompt + model version recorded
  • Generation wrapped in scripts or pipelines

Hard Rules

  • Same inputs should produce equivalent outputs
  • AI output must be explainable
  • Generation must be replayable or reproducible

4) Human Extension and Refinement (Protected Zone)

Purpose: Add judgment, business logic, and nuance.

Human Responsibilities

  • Write and own core business logic
  • Refine AI-generated scaffolding
  • Make intentional design choices

AI-Assisted Support

  • Suggest refactors or improvements (non-destructive)
  • Generate tests or documentation
  • Explain unfamiliar code paths

Hard Rules

  • AI never overwrites human-authored code
  • Human-written code is clearly isolated
  • Regeneration cannot destroy human intent

5) Testing, Verification, and Regeneration

Purpose: Ensure correctness, safety, and long-term maintainability.

Automated Responsibilities

  • Regenerate code in CI to detect drift
  • Run tests, linters, security checks
  • Validate metadata and contracts

Human Responsibilities

  • Review failures and diffs
  • Approve changes to prompts, metadata, or architecture
  • Decide when regeneration is safe

Hard Rules

  • Regeneration is routine and safe
  • Failures are traceable to source
  • AI output never bypasses quality gates

Role Separation Summary

Role Authority
Human Architect Final system intent
Human Engineer Business logic, correctness
AI Generator Proposal and automation
Metadata Source of truth
CI/CD Enforcement and verification

Common Failure Modes (and What This Model Prevents)

AI as Architect

  • Prevented by explicit human decision points

Prompt Drift

  • Prevented by versioned prompts and replayable generation

Silent Semantic Errors

  • Prevented by protected human logic and testing gates

Loss of Accountability

  • Prevented by clear ownership at every phase

High-Leverage Guardrails

  1. Prompts are treated as code
  2. Metadata is explicit and validated
  3. AI output is always reviewable
  4. Human-written code is never overwritten
  5. Regeneration is safe and boring

Summary

AI-assisted development works only when humans stay in the loop.

This workflow ensures that:

  • AI accelerates mechanics,
  • humans retain intent,
  • systems remain explainable,
  • and long-term maintenance stays possible.

Closing Insight

AI scales capability. Humans retain responsibility.

The strength of an AI-assisted system is determined not by the model, but by the discipline of the surrounding workflow.

Code Wiki Main Repositories