dark-factory

command module
v0.55.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: BSD-2-Clause Imports: 9 Imported by: 0

README

Dark Factory

CI Go Reference Go Report Card

Autonomous coding pipeline — drop prompts in, get commits out.

One factory per project, sequential prompt processing, zero human intervention between spec and commit.

How It Works

You (fast)                                    Factory (slow, unattended)
├── write prompt    ──→  prompts/              (inbox, passive)
├── ready to go     ──→  prompts/in-progress/  ┌─ watcher renames, processor executes
├── write prompt 2  ──→  prompts/              │  YOLO → commit → tag → push
├── move to queue   ──→  prompts/in-progress/  │  YOLO → commit → tag → push
└── go AFK                                     └─ idle, watching prompts/in-progress/
                                                    ↓
You come back                       ←── changes committed and pushed

Prerequisites

  • Go 1.26+ — to build dark-factory
  • Docker — to run claude-yolo containers
  • claude-yolo imagedocker pull docker.io/bborbe/claude-yolo:v0.3.0
  • ~/.claude-yolo/ — Claude Code config for the YOLO agent (see YOLO Container Setup)
  • DARK_FACTORY_CLAUDE_CONFIG_DIR — set to ~/.claude-yolo (otherwise defaults to ~/.claude)

Installation

go install github.com/bborbe/dark-factory@latest

Or build from source:

git clone https://github.com/bborbe/dark-factory.git
cd dark-factory
make install

Quick Start

# 1. Initialize project
cd ~/your-project
mkdir -p prompts/in-progress prompts/completed prompts/log
cat > .dark-factory.yaml <<'EOF'
workflow: direct
EOF

# 2. Write a prompt
cat > prompts/my-feature.md << 'EOF'
<summary>
- Adds a /health endpoint returning 200 OK
- No authentication required
- Existing endpoints unchanged
</summary>

<objective>
Add a health check endpoint for load balancer probes.
</objective>

<context>
Read CLAUDE.md for project conventions.
</context>

<requirements>
1. Add GET /health handler returning 200 with body "ok"
2. Register in the router
3. Add test
</requirements>

<constraints>
- Do NOT commit — dark-factory handles git
- Existing tests must still pass
</constraints>

<verification>
Run `make precommit` -- must pass.
</verification>
EOF

# 3. Approve and run
dark-factory prompt approve my-feature
dark-factory daemon

Commands

Command Purpose
dark-factory daemon Watch for prompts and process continuously
dark-factory run Process all queued prompts and exit
dark-factory status Show combined status
dark-factory prompt list List prompts with status
dark-factory prompt approve <name> Queue a prompt for execution
dark-factory prompt retry Re-queue failed prompts
dark-factory spec list List specs with status
dark-factory spec approve <name> Approve a spec (triggers prompt generation)
dark-factory spec complete <name> Mark a verified spec as completed

Claude Code Plugin

Dark-factory includes a Claude Code plugin for writing and auditing specs and prompts.

claude plugin marketplace add bborbe/dark-factory
claude plugin install dark-factory
Command Description
/dark-factory:create-spec Create a spec file interactively
/dark-factory:create-prompt Create a prompt from spec or description
/dark-factory:audit-spec Audit spec against quality criteria
/dark-factory:audit-prompt Audit prompt against Definition of Done

Configuration

Optional .dark-factory.yaml in project root:

workflow: direct                                     # "direct" (default) or "pr"
autoMerge: false                                     # auto-merge PR (requires pr workflow)
autoRelease: false                                   # create release after merge
containerImage: docker.io/bborbe/claude-yolo:v0.3.0  # YOLO Docker image
model: claude-sonnet-4-6                             # Claude model
serverPort: 0                                        # REST API port (0 = disabled)

See docs/init-project.md for the full config reference.

YOLO Container Configuration

Dark-factory executes prompts inside a claude-yolo Docker container. The container needs a Claude Code config directory on the host, mounted into the container.

Quick setup (use bborbe's config):

git clone https://github.com/bborbe/claude-yolo.git ~/.claude-yolo
cd ~/.claude-yolo && claude login
export DARK_FACTORY_CLAUDE_CONFIG_DIR=~/.claude-yolo

Minimal setup (create your own): You need three files — OAuth credentials (claude login), settings.json, and a CLAUDE.md with agent instructions.

See docs/yolo-container-setup.md for both options in detail.

Directory Structure

your-project/
├── .dark-factory.yaml        # config
├── prompts/                  # inbox (drop prompts here)
│   ├── in-progress/          # queued/executing
│   ├── completed/            # archived
│   └── log/                  # execution logs
├── specs/                    # spec inbox
│   ├── in-progress/          # approved specs
│   └── completed/            # done specs
└── scenarios/                # end-to-end verification

Documentation

Guide Purpose
Init Project Set up a new project for dark-factory
Spec Writing Write behavioral specs for multi-prompt features
Prompt Writing Write effective prompts for the YOLO agent
Running Start, monitor, and troubleshoot the pipeline
Scenario Writing Write end-to-end verification checklists
YOLO Container Setup Set up ~/.claude-yolo/ config directory
CLAUDE.md Guide Write project CLAUDE.md files for dark-factory

Design Principles

  • YOLO has NO git access — all git ops happen on the host
  • Sequential processing — prompts execute in number order
  • Frontmatter = state — no database
  • Fresh context per prompt — no context rot
  • Stop on failure — never skip failed prompts
  • Instance lock — one dark-factory per project

License

BSD-2-Clause

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
pkg
cmd
Package cmd implements CLI commands for the dark-factory tool.
Package cmd implements CLI commands for the dark-factory tool.
config
Package config handles configuration loading and validation.
Package config handles configuration loading and validation.
executor
Package executor runs prompt files inside Docker containers.
Package executor runs prompt files inside Docker containers.
factory
Package factory wires all dependencies for the dark-factory application.
Package factory wires all dependencies for the dark-factory application.
generator
Package generator creates prompt files from spec definitions.
Package generator creates prompt files from spec definitions.
git
Package git provides version control operations for commits, tags, branches, and PRs.
Package git provides version control operations for commits, tags, branches, and PRs.
lock
Package lock provides file-based mutual exclusion for single-instance enforcement.
Package lock provides file-based mutual exclusion for single-instance enforcement.
processor
Package processor manages the prompt execution lifecycle.
Package processor manages the prompt execution lifecycle.
project
Package project defines project-level types and naming.
Package project defines project-level types and naming.
prompt
Package prompt handles prompt file loading, saving, and queue management.
Package prompt handles prompt file loading, saving, and queue management.
report
Package report generates and parses completion reports from prompt execution.
Package report generates and parses completion reports from prompt execution.
review
Package review implements automated PR review polling and fix prompt generation.
Package review implements automated PR review polling and fix prompt generation.
runner
Package runner orchestrates the main dark-factory event loop.
Package runner orchestrates the main dark-factory event loop.
server
Package server provides HTTP handlers for status, queue, and inbox endpoints.
Package server provides HTTP handlers for status, queue, and inbox endpoints.
spec
Package spec handles specification file loading, status management, and listing.
Package spec handles specification file loading, status management, and listing.
specnum
Package specnum provides spec number parsing utilities.
Package specnum provides spec number parsing utilities.
specwatcher
Package specwatcher watches spec files and triggers prompt generation on changes.
Package specwatcher watches spec files and triggers prompt generation on changes.
status
Package status aggregates and formats system status information.
Package status aggregates and formats system status information.
version
Package version provides build version information.
Package version provides build version information.
watcher
Package watcher monitors the prompts directory for file changes and normalizes filenames.
Package watcher monitors the prompts directory for file changes and normalizes filenames.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL