DocumentationDark Factory

Dark Factory

The autonomous code generation engine that builds itself

The Dark Factory is GhostFoundry-Syndicate's most ambitious creation—an autonomous code generation system that transforms natural language into production-ready software. It doesn't just write code; it architects solutions, understanding the relationships between your data models, anticipating the APIs you'll need, and generating comprehensive test coverage.

Imagine describing what you want to build the way you'd explain it to a senior engineer, and watching as fully-typed TypeScript, Prisma schemas, Next.js API routes, and React components materialize before your eyes. That's the Dark Factory. It's the future of software development, available today.

What Makes Dark Factory Different

Intelligent Intent Parsing

Unlike simple code completion, Dark Factory understands the why behind your request. It extracts entities, relationships, and implicit requirements from natural language, building a complete mental model of your system before writing a single line of code.

Full-Stack Generation

From Prisma database models to TypeScript interfaces, from REST API routes to React components—Dark Factory generates the entire vertical slice. No more tedious boilerplate. No more inconsistencies between layers. Everything works together because it was designed together.

Human-in-the-Loop Safety

We believe in AI that amplifies human judgment, not replaces it. Every generation pauses at the “Awaiting Approval” checkpoint, letting you review every artifact before deployment. You maintain final authority over what enters your codebase.

Built-in Validation

Generated code passes through rigorous validation before reaching you—TypeScript syntax checks, undefined reference detection, schema consistency verification, and more. Bad code doesn't make it past the factory floor.

Project-Aware Context

Dark Factory doesn't generate code in a vacuum. It understands your existing codebase, your database schema, your API patterns. New generations integrate seamlessly with what you already have, extending rather than conflicting.

Complete Transparency

Watch the pipeline in real-time. See exactly what the AI is thinking at each stage. Inspect every artifact before approval. No black boxes—just clear, understandable generation that you can trust.

How It Works: The 6-Stage Pipeline

Stage 1

Intent Parsing

GPT-4.1 analyzes your natural language request and extracts structured specifications.

What happens:

  • Identifies intent type (create API, model, component, etc.)
  • Extracts entities, properties, and relationships
  • Determines confidence score
  • Maps dependencies to existing system components

Output:

ParsedIntent object with entities, actions, and confidence

Stage 2

Schema Generation

Converts parsed intent into database schemas and API specifications.

What happens:

  • Generates Prisma model definitions
  • Creates REST API endpoint specs
  • Defines TypeScript interfaces
  • Maps entity relationships

Output:

GeneratedSchema with Prisma models and API specs

Stage 3

Code Generation

Produces production-ready code files from the schemas.

What happens:

  • Prisma model files (prisma/generated-models.prisma)
  • API route handlers (app/api/**/route.ts)
  • TypeScript type definitions (lib/types/generated.ts)
  • Test files (__tests__/*.test.ts)

Output:

Array of GeneratedArtifact objects

Stage 4

Validation

Validates generated code for syntax errors and basic quality checks.

What happens:

  • TypeScript syntax validation
  • Undefined reference detection
  • Empty content checks
  • Schema consistency verification

Output:

Validation result with issues list

Stage 5

Awaiting Approval

Human review checkpoint - you decide whether to deploy the generated code.

What happens:

  • Review all generated artifacts
  • Inspect code quality and correctness
  • Approve all or select specific artifacts
  • Reject and regenerate if needed

Output:

Human approval to proceed to deployment

Stage 6

Deployment

Writes approved artifacts to the actual codebase.

What happens:

  • Creates directories if needed
  • Writes files to target paths
  • Updates deployment records
  • Logs all deployment actions

Output:

Deployed code files in the project

What Does "Awaiting Approval" Mean?

Human-in-the-Loop Checkpoint

"Awaiting Approval" is the critical safety checkpoint in the Dark Factory pipeline. After the system generates and validates code, it pauses and waits for human review before deploying anything to your codebase.

What You Can Do

  • • Review all generated code artifacts
  • • Inspect the code quality and logic
  • • See exactly which files will be created
  • • Approve all or select specific artifacts
  • • Reject and request regeneration

Why This Matters

  • • Prevents auto-deployment of bad code
  • • Maintains human oversight of AI actions
  • • Allows review before production impact
  • • Audit trail of all approvals
  • • Constitutional AI compliance

Task Status Reference

parsing

Analyzing your natural language request

generating

Creating schemas and code files

validating

Checking code for errors

awaiting_approval

Ready for human review and approval

deploying

Writing files to codebase

completed

Successfully deployed

failed

Generation or deployment failed

Generated Artifact Types

Prisma Model
prisma/
API Route
app/api/
TypeScript Types
lib/types/
Test File
__tests__/
React Component
components/

Step-by-Step: Building Something

  1. 1

    Go to Dark Factory Dashboard

    Navigate to /dark-factory and click the "Generate" tab.

  2. 2

    Describe What You Want

    Type a natural language description like: "Create an API to track customer orders with status updates, shipping info, and order history"

  3. 3

    Watch the Pipeline Run

    The system parses intent → generates schemas → writes code → validates. You'll see real-time progress in the Tasks tab.

  4. 4

    Review at "Awaiting Approval"

    Click on the task to expand it. Review all generated artifacts in the Artifacts tab. Read the code!

  5. 5

    Deploy to Codebase

    If satisfied, click "Deploy All Artifacts". Files are written to your project. Status changes to "completed".

  6. 6

    Done!

    Your new API, models, and tests are now part of the codebase. Run yarn prisma generate if needed.