How SAM Works

From PRD to production-ready code through autonomous TDD pipelines. Four phases, seven agents, zero human intervention required.

The Autonomous Pipeline

SAM orchestrates specialized agents through a structured 4-phase pipeline, enforcing quality at every step.

๐Ÿ“‹
PRD
Input
โ†’
โœ“
Validation
Phase 1
โ†’
๐Ÿ“
Planning
Phase 2
โ†’
๐Ÿ”„
TDD Loop
Phase 3
โ†’
๐Ÿ“š
Completion
Phase 4
โ†’
๐Ÿš€
Code
Output
โœ“

Phase 1

Validation

PRD Validation

Before any development begins, the PRD is thoroughly validated for technical feasibility and completeness.

Agents Involved

๐Ÿ—๏ธ Atlas (Architect) ๐ŸŽจ Iris (UX Designer)

Gate Criteria

  • โœ“ PRD has clear objectives
  • โœ“ Features are technically feasible
  • โœ“ Acceptance criteria are testable
  • โœ“ No blocking risks identified

Planning & Story Generation

The validated PRD is broken down into implementable epics and user stories with clear acceptance criteria.

Process

  1. Analyze PRD for feature groupings (epics)
  2. Break features into user stories
  3. Define acceptance criteria for each story
  4. Prioritize story order based on dependencies
  5. Initialize sprint-status tracking

Output

  • ๐Ÿ“„ Story files for each feature
  • ๐Ÿ“Š Updated pipeline-status.yaml
  • ๐Ÿ“‹ Dependency graph
๐Ÿ“

Phase 2

Planning

Phase 3: TDD Implementation Loop

Each story goes through strict RED-GREEN-REFACTOR cycles until complete.

๐Ÿงช
RED
Write Failing Tests
Titan
โ†’
๐Ÿ’ป
GREEN
Implement Code
Dyna
โ†’
๐Ÿ”
REFACTOR
Review & Improve
Argus

RED Phase

Titan writes failing acceptance tests based on story acceptance criteria. Tests MUST fail before proceeding.

Gate: All tests failing due to missing implementation

GREEN Phase

Dyna implements minimum code to make all tests pass. Retries up to 3 times if tests don't pass.

Gate: All acceptance and unit tests passing

REFACTOR Phase

Argus reviews code for quality, security, and performance. Auto-fixes issues while keeping tests green.

Gate: All issues addressed, tests still passing
๐Ÿ“š

Phase 4

Completion

Documentation & Reporting

Once all stories are complete, Sage generates comprehensive documentation and produces a final pipeline report.

Agents Involved

๐Ÿ“š Sage (Tech Writer)

Output

  • ๐Ÿ“– Feature documentation
  • ๐Ÿ“„ Updated README
  • ๐Ÿ“Š Pipeline execution report
  • โœ… Test coverage summary

State Tracking

SAM tracks every step in pipeline-status.yaml for full transparency and resumability.

run_id: "2026-01-28T10:30:00Z"
prd_path: "path/to/prd.md"
current_phase: "implementation"

stories:
  - id: "epic-1-story-1"
    title: "User can log in"
    status: "done"
    red_phase:
      completed: true
      tests_written: 5
    green_phase:
      completed: true
      tests_passing: 5
    refactor_phase:
      completed: true
      issues_fixed: 3

  - id: "epic-1-story-2"
    title: "User can reset password"
    status: "green"
    red_phase:
      completed: true
    green_phase:
      completed: false
      retry_count: 2

Ready to See SAM in Action?

Learn more about each specialized agent or get in touch to discuss how SAM can transform your development workflow.