Cookbook/The Slot Machine Workflow for Complex Tasks
workflow
12 min

The Slot Machine Workflow for Complex Tasks

workflow
complex-tasks
strategy

The Slot Machine Workflow for Complex Tasks

What You'll Learn

A unique workflow strategy from Anthropic's Data Science & ML Engineering team that treats OpenAI Codex sessions like a slot machine - save state, run for 30 minutes, then either accept results or start fresh.

Prerequisites

  • OpenAI Codex CLI installed
  • A complex task that might require multiple attempts
  • Ability to save/restore project state (git, snapshots, etc.)

Steps

Step 1: Save Your Starting State

Before beginning any complex task, create a clean checkpoint:

# Create a git branch for experimentation
git checkout -b codex-attempt-1
git add .
git commit -m "Checkpoint before OpenAI Codex session"

Step 2: Set a Timer for 30 Minutes

Use a timer to bound your OpenAI Codex session:

# On macOS/Linux
timer 30m

# Or use your phone/watch timer

Step 3: Give OpenAI Codex Full Context and Let It Run

Provide comprehensive instructions and let OpenAI Codex work autonomously:

codex "Implement a real-time data pipeline that:
- Ingests data from Kafka
- Transforms using our business rules in transforms.py
- Stores in TimescaleDB
- Includes monitoring and error handling
- Has comprehensive tests"

Step 4: Evaluate Results at 30 Minutes

When the timer goes off, stop and evaluate:

  • Did OpenAI Codex make good progress?
  • Is the approach sound?
  • Are there fundamental issues?

Step 5: Accept or Reset

If results are promising:

git add .
git commit -m "OpenAI Codex implementation - keeping"
git checkout main
git merge codex-attempt-1

If results are problematic:

# Abandon this attempt
git checkout main
git branch -D codex-attempt-1

# Start fresh with lessons learned
git checkout -b codex-attempt-2

Example Usage

Here's how the Data Science team uses this for building dashboard apps:

# Attempt 1: Let OpenAI Codex build the full dashboard
git checkout -b dashboard-v1
codex "Build a JavaScript/TypeScript dashboard for our ML metrics"
# Timer runs for 30 minutes...

# Not quite right - too complex. Reset and try simpler approach
git checkout main
git branch -D dashboard-v1

# Attempt 2: Break into smaller pieces
git checkout -b dashboard-v2
codex "Build just the data fetching layer for our ML metrics dashboard"
# This works! Keep it and continue

Tips & Variations

  • Interrupt for Simplicity: As the Data Science team notes: "Ask 'why are you doing this? Try something simpler'"
  • Document Lessons: Keep notes on what didn't work to inform future attempts
  • Adjust Time: 30 minutes is a guideline - adjust based on task complexity
  • Multiple Slots: Run several "slot machine" attempts in parallel on different approaches

Why This Works

This approach is particularly effective for:

  • Exploratory development where the best approach isn't clear
  • Complex refactoring tasks that might go wrong
  • Learning new technologies where OpenAI Codex might make mistakes
  • Preventing sunk cost fallacy - it's easier to abandon 30 minutes than 3 hours

Master OpenAI Codex with Expert Training

These recipes are from our comprehensive 2-day training course. Learn directly from experts and transform your development workflow.

OpenAI Codex Training

© 2025 OpenAI Codex Training. Based on "OpenAI Codex: The Unofficial Guide"