Process Factory Architecture v1.0

Config-driven, block-based execution engine for transparent, auditable pipeline runs

Version: 1.0.0 Date: 2026-03-28 Pattern: DAG Batch (active) Blocks: 18 Run #1: GREEN 91.9%

Overview

The Process Factory Engine replaces ad-hoc skill invocation with tracked, stateful DAG execution. Every skill, ingest job, or analysis task becomes a Block — a universal execution unit with typed inputs, outputs, dependencies, gates, and thresholds.

Why This Exists

After building the full 18-skill clone pipeline (Run #1: GREEN 91.9%), we identified that the same transparency/auditability problem exists when building anything, not just running extractions. The solution: a config-driven engine that makes every pipeline run observable, replayable, and auditable.

Core Principles

Block v2 Schema

The universal execution unit. Every skill, ingest job, or analysis task = one block. 11 field groups covering all three execution patterns.

{
  // ── Identity ──
  id:              string       // "soul-extractor"
  name:            string       // "Soul Extractor"
  layer:           string       // "L2"
  type:            enum         // extract|validate|build|orchestrate|research|ingest

  // ── Execution ──
  skill:           string       // maps to SKILL.md
  model:           string|null  // "opus"|"sonnet"|null (inherit)
  timeout:         number       // 300000 (ms)
  runtime:         enum         // forge|claude-cli|mastery-api|nowpage

  // ── Trigger ──
  trigger: {
    type:          enum         // dependency|cron|webhook|event|manual
    cron:          string|null  // "0 6 * * *" (Pattern 2)
    event:         string|null  // "entity.created(gate=2)" (Pattern 2)
    webhook:       string|null  // "/api/ingest/youtube" (Pattern 2)
  }

  // ── Inputs ──
  inputs: {
    depends:       [{block, key}]   // wiring from other blocks
    files:         [glob]           // workspace file patterns
    env:           [string]         // required env vars
    config:        {k:v}            // runtime config overrides
  }

  // ── Outputs ──
  outputs: {
    artifacts:     [{key, path, format}]
    metrics:       [{key, type}]
    publish:       [{domain, slug}]|null
  }

  // ── Execution Control ──
  execution: {
    parallel_group: string|null     // "L2-extractors"
    human_gate:     enum            // before|after|none
    threshold:      {metric, min}|null
    retryable:      boolean
    max_retries:    number          // 2
  }

  // ── Lifecycle (Pattern 1: one-shot, 2: daemon, 3: on-demand) ──
  lifecycle: { mode: enum }         // one-shot|daemon|on-demand

  // ── Scope ──
  scope: {
    gate:          1|2|3|4|null     // Data Gate tier
    run_params:    {k:v}            // per-run overrides
  }

  // ── Lens (Pattern 3 only) ──
  lens: {
    perspective:   string|null      // "positioning"|"gap_analysis"
    aggregates:    [string]|null    // ["entity_id"]
    feedback_loop: boolean
  }

  // ── Record State (Pattern 2 only) ──
  record_state: {
    track_per:     string|null      // "content_id"|"entity_id"
    states:        [string]         // ["raw","annotated","embedded","scored"]
  }

  // ── Runtime State (engine-managed, not in config) ──
  state: {
    status:        enum             // pending|ready|running|done|failed|blocked|waiting
    started_at:    timestamp|null
    ended_at:      timestamp|null
    score:         number|null
    error:         string|null
    attempts:      number
  }
}

Design Decisions

Three Execution Patterns

All use the same Block v2 schema. Only the scheduler behavior differs.

ACTIVE

Pattern 1: DAG Batch

PRD: PRD 4 (Expert Extraction)

Trigger: dependency (block completion)

Lifecycle: one-shot

Scope: per expert

Example: Clone Factory — 18 blocks, run once per expert, produce complete clone

Scheduler: Evaluate readiness when any block completes. Ready = all deps done + gate approved.

FUTURE

Pattern 2: Stream/Event

PRD: PRD 3 (Universal Ingest)

Trigger: cron / webhook / event

Lifecycle: daemon

Scope: per record

Example: YouTube ingest — watch channel, transcribe new videos, annotate, embed, score

Needs: daemon process manager, event queue, webhook receivers, record_state field

FUTURE

Pattern 3: Analytical Lens

PRD: PRD 5 (Competitor Intel)

Trigger: on-demand / event

Lifecycle: on-demand

Scope: fan-out + aggregate

Example: Pre-meeting brief — fan out to N perspectives, aggregate into strategic brief

Needs: fan-out executor, aggregation engine, feedback collector, lens field

Extension Rule

All extensions are ADDITIVE. Pattern 2 and 3 add new scheduler behaviors and field consumers. They do NOT change Block v2 or the existing DAG scheduler. Each pattern gets its own scheduler implementation that reads the same block schema.

Clone Factory DAG — 18 Blocks

The complete pipeline for cloning an expert's IP into an AI coaching OS.

L0 Recon
deep-research
expert-recon
masterybook-sync
L0.25
expert-framework-creator
HUMAN GATE (after)
L0.5
demo-compiler
L1 Quality
rubric-builder
L2 Extract
soul-extractor
voice-extractor
framework-extractor
resource-extractor
offer-extractor
L2.5 Audit
gap-analyzer
HUMAN GATE (after)
L3 Build
clone-compiler
lead-magnet-builder
onboarding-builder
design-system-extractor
L3.5 Test
clone-tester 85% min
HUMAN GATE (after)
L4 Ship
boarding-orchestrator

Legend

Research Extract Validate Build Orchestrate Parallel Group Human Gate

Key Properties

Data Flow Map

Every block's typed inputs and outputs, showing how data flows through the pipeline.

BlockInputs FromKey OutputsFormat
deep-research(config: expert_name)intel-report, raw-sourcesMD, directory
expert-recon(config: expert_name)recon-reportMD
masterybook-sync(workspace files)notebook-urlURL
expert-framework-creatordeep-research.intel-report, expert-recon.recon-reportexpert-frameworkJSON
demo-compilerdeep-research.intel-reportdemo-prompt, demo-configMD, JSON
rubric-builderexpert-framework-creator.expert-frameworkrubricJSON
soul-extractorexpert-framework-creator.expert-framework, rubric-builder.rubricsoul-jsonJSON
voice-extractorexpert-framework-creator.expert-framework, rubric-builder.rubricvoice-jsonJSON
framework-extractorexpert-framework-creator.expert-framework, rubric-builder.rubricframeworks-jsonJSON
resource-extractorexpert-framework-creator.expert-frameworkresources-jsonJSON
offer-extractorexpert-framework-creator.expert-frameworkoffers-jsonJSON
gap-analyzersoul.json, voice.json, frameworks.json, resources.json, offers.jsongaps-jsonJSON
clone-compilerAll extraction JSONs + gaps.jsonsystem-prompt, knowledge-files, tool-configsMD, MD, JSON
lead-magnet-builderoffers.json, frameworks.json, soul.jsonlead-magnet-htmlHTML
onboarding-builderframeworks.json, offers.jsononboarding-htmlHTML
design-system-extractor(config: brand_url)design-system-htmlHTML
clone-testersystem-prompt, knowledge-files, tool-configs, rubric, expert-frameworktest-results, audit-sheet, simulation-logJSON, MD, JSON
boarding-orchestratorAll artifactsboarding-packHTML

Module ↔ Skill Mapping (PRD 4)

How PRD 4's 9 extraction modules map to our 18 skills. Coverage: 9/9 mapped.

PRD 4 ModuleOur Skill(s)CoverageNotes
M1: Thinking Structuresexpert-framework-creator + soul-extractorFullSplit across two skills intentionally
M2: Voice & Stylevoice-extractorFull
M3: CTA Psychologyoffer-extractorPartialCTA triggers not explicitly separated
M4: Embedded IPframework-extractorFull
M5: Modularizationframework-extractorFoldedPrerequisites/scaffolding included
M6: Meta-Structuresframework-extractorFoldedProgram architectures included
M7: Pattern Recognitionsoul-extractorFoldedDiagnostic patterns included
M8: Prompt Templatesclone-compilerReframedGround truth as test scenarios
M9: Retrieval Patternsclone-compilerReframedRouting rules in tool-configs

Summary: 2 partial (M3 CTA), 3 folded (M5-M7 absorbed into broader extractors), 4 full/reframed. No modules unmapped. The "folded" modules are architectural decisions — their content is extracted, just by a different skill than the PRD originally envisioned.

Execution Timeline

Parallel groups and human gates shown on a layer-by-layer timeline.

LAYER     BLOCKS                           GATE          PARALLEL?
────────  ─────────────────────────────    ──────────    ─────────
L0        deep-research                                  YES (3)
          expert-recon                                   (L0-recon)
          masterybook-sync

L0.25     expert-framework-creator         AFTER ⛔      Sequential

L0.5      demo-compiler                                  Sequential

L1        rubric-builder                                 Sequential

L2        soul-extractor                                 YES (5)
          voice-extractor                                (L2-extractors)
          framework-extractor
          resource-extractor
          offer-extractor

L2.5      gap-analyzer                     AFTER ⛔      Sequential

L3        clone-compiler                                 YES (4)
          lead-magnet-builder                            (L3-builders)
          onboarding-builder
          design-system-extractor

L3.5      clone-tester (85% min)           AFTER ⛔      Sequential

L4        boarding-orchestrator                          Sequential
      

Timing Estimates (based on Run #1)

Intelligence Gathering Pattern (Pattern 3)

How pre-meeting analytical lenses work — future capability for PRD 5.

Flow

  1. Trigger: "Prepare brief for meeting with [entity]" (on-demand or event-driven)
  2. Fan-out: Spawn N perspective blocks, each with a different lens.perspective:
    • Positioning analysis
    • Gap analysis (vs our capabilities)
    • Competitive landscape
    • Partnership risk assessment
  3. Execute: Each perspective block runs independently (parallel)
  4. Aggregate: Merge all perspective outputs into a single strategic brief
  5. Feedback loop: After meeting, user rates brief usefulness → improves future lenses

Block v2 Fields Used

Connection to deep-research

Pattern 3 blocks can delegate heavy research to the existing deep-research skill (via Perplexity Sonar), then apply their specific analytical lens to the raw results. The research infrastructure is shared; only the interpretation differs.

PRD Reconciliation

What matches, what's missing, what's deferred.

PRDStatusCoverageWhat's Needed
PRD 4 (Expert Extraction)FULLY COVERED9/9 modules mapped to 18 skillsNothing — this IS the active build
PRD 3 (Universal Ingest)ARCHITECTURALLY COMPATIBLEBlock v2 has record_state + event triggersDaemon scheduler, event queue, webhook receivers
PRD 5 (Competitor Intel)ARCHITECTURALLY COMPATIBLEBlock v2 has lens + aggregation fieldsFan-out executor, aggregation engine, feedback collector
Master RegistrySTALELists 24 active skills + 8 planned (old inventory)Needs update to reflect 18 boarding pipeline skills
Command CenterALIGNEDProduct dashboard rubric matches Block outputsNothing critical

Extensions Needed for Future Patterns

Pattern 2 (Stream/Event) — PRD 3

  • record_state field — already in schema
  • Daemon process manager — NEW code (keeps blocks alive)
  • Event queue — NEW infrastructure (Redis or Supabase Realtime)
  • Webhook receivers — NEW API routes (/api/ingest/youtube, etc.)

Pattern 3 (Analytical Lens) — PRD 5

  • lens field — already in schema
  • Fan-out executor — NEW code (spawn N blocks dynamically)
  • Aggregation engine — NEW code (merge perspectives)
  • Feedback collector — NEW API route

Critical rule: All extensions are ADDITIVE. They add new scheduler behaviors and field consumers. They do NOT change Block v2 or the existing DAG scheduler.

Build Order

#WhatStatusNotes
1Process Factory Architecture pageDONEThis page (plan.jasondmacdonald.com/process-factory-architecture)
2Block Schema Reference pageDONEplan.jasondmacdonald.com/block-schema
3Clone Factory Template JSONDONE18 blocks, validated (no cycles, all deps resolve)
4DAG Scheduler API routeDONE/api/a360/factory-run (create, start, complete, approve, reject)
5Factory Dashboard (live)DONEalign360.asapai.net/factory-dashboard
6Memory + context updatesDONEMEMORY.md, reconciliation.md, process-factory.md, CLAUDE.md
7Pattern 2 schedulerFUTUREWhen PRD 3 ingest activates
8Pattern 3 schedulerFUTUREWhen PRD 5 intel activates

Session Continuity Protocol

If a session dies, the next session can reconstruct full context from these durable artifacts:

  1. Read plan.jasondmacdonald.com/process-factory-architecture (this page) for full design
  2. Read plan.jasondmacdonald.com/block-schema for technical schema reference
  3. Read MEMORY.md for project state
  4. Read memory/process-factory.md for detailed architecture notes
  5. Read clone-factory-template.json for executable pipeline config
  6. Read folio-saas/app/api/a360/factory-run/route.ts for engine implementation
  7. Read align360.asapai.net/factory-dashboard for live pipeline state

Key Files

FileRole
_workspaces/samuel-ngu/clone-factory-template.jsonExecutable pipeline config (18 blocks)
folio-saas/app/api/a360/factory-run/route.tsDAG scheduler API engine
_workspaces/samuel-ngu/artifacts/factory-dashboard.htmlLive pipeline dashboard
_workspaces/samuel-ngu/artifacts/block-schema-reference.htmlTechnical schema reference
_workspaces/samuel-ngu/artifacts/process-factory-architecture.htmlArchitecture design (this page)
memory/process-factory.mdArchitecture notes for session continuity
memory/reconciliation.mdCompact reconciliation state