.do
Iterate

Iterate

Continuously improve your Business-as-Code based on data, feedback, and experimentation results

Continuously improve your Business-as-Code through data-driven iteration, user feedback, and experiment insights.

Overview

The Iterate phase is where continuous improvement happens. Using insights from experiments, user feedback, analytics, and monitoring, you systematically enhance your business operations to drive better outcomes.

This phase emphasizes:

  • Data-Driven Decisions: Let metrics guide improvements
  • Rapid Iteration: Ship improvements quickly and safely
  • Feedback Loops: Close the loop from data to action
  • Continuous Learning: Build institutional knowledge
  • Compound Growth: Small improvements add up

Iteration Workflows

Pattern 1: Experiment-Driven Iteration

Act on experiment results:

// Monitor experiment completion
on($.Experiment.completed, async (experiment, $) => {
  const analysis = await $.Experiment.analyze(experiment.name)

  if (analysis.winner && analysis.confidence > 0.95) {
    // Graduate winning variant
    await $.Experiment.graduate(experiment.name, analysis.winner)

    // Create follow-up experiments
    const followUps = await $.ai.generate('followup-experiments', {
      baseExperiment: experiment,
      results: analysis,
      objective: 'compound-improvements',
    })

    for (const followUp of followUps) {
      await db.create($.Experiment, {
        name: followUp.name,
        hypothesis: followUp.hypothesis,
        parentExperiment: experiment.id,
        status: 'proposed',
      })
    }
  } else if (analysis.confidence < 0.8) {
    // Inconclusive - iterate on experiment design
    await send($.Team.product, {
      type: 'experiment-inconclusive',
      experiment: experiment.name,
      recommendation: 'redesign-or-extend',
    })
  }
})

// Compound improvements
on($.Experiment.graduated, async (experiment, $) => {
  // Track cumulative impact
  const cumulativeImpact = await $.Metrics.calculateCumulative({
    experiments: await db.list($.Experiment, {
      where: { status: 'graduated' },
    }),
  })

  await send($.Dashboard.update, {
    metric: 'cumulative-experiment-lift',
    value: cumulativeImpact.totalLift,
  })
})

Pattern 2: Feedback-Driven Iteration

Act on user feedback:

// Aggregate and prioritize feedback
on($.User.submits.Feedback, async (feedback, $) => {
  // Classify and cluster
  const analysis = await $.ai.analyze(feedback.content, {
    sentiment: true,
    topics: true,
    urgency: true,
    actionable: true,
  })

  // Update feature request or bug
  if (analysis.actionable) {
    const existing = await db.findOne($.FeatureRequest, {
      where: { topic: { similar: analysis.topic, threshold: 0.8 } },
    })

    if (existing) {
      await db.update($.FeatureRequest, existing.id, {
        votes: existing.votes + 1,
        feedback: [...existing.feedback, feedback.id],
      })
    } else {
      await db.create($.FeatureRequest, {
        topic: analysis.topic,
        description: analysis.summary,
        urgency: analysis.urgency,
        sentiment: analysis.sentiment,
        votes: 1,
        feedback: [feedback.id],
      })
    }
  }
})

// Prioritize and implement top requests
const priorityQueue = $.queue({
  name: 'feature-priority',
  scoring: (request) => {
    return request.votes * getUrgencyWeight(request.urgency) * getSentimentWeight(request.sentiment)
  },
})

// Auto-create tasks for high-priority items
on($.FeatureRequest.created, async (request, $) => {
  const score = priorityQueue.score(request)

  if (score > THRESHOLD) {
    await db.create($.Task, {
      title: `Implement: ${request.topic}`,
      description: request.description,
      priority: 'high',
      source: 'user-feedback',
      featureRequest: request.id,
    })

    await send($.Team.product, {
      type: 'high-priority-request',
      request,
    })
  }
})

Pattern 3: Metrics-Driven Iteration

Act on metric changes:

// Monitor key metrics
on($.Metrics.updated, async (metric, $) => {
  // Detect anomalies
  const anomaly = await $.ai.detectAnomaly(metric, {
    baseline: 'historical-average',
    threshold: 2, // 2 standard deviations
  })

  if (anomaly.detected) {
    // Investigate cause
    const investigation = await $.ai.investigate({
      metric: metric.name,
      change: anomaly.delta,
      timeframe: anomaly.period,
      context: await getRecentChanges(),
    })

    // Create action item
    await db.create($.Investigation, {
      metric: metric.name,
      anomaly,
      hypothesis: investigation.likelyCauses,
      status: 'investigating',
    })

    // Alert team
    if (anomaly.severity === 'high') {
      await send($.Alert.send, {
        severity: 'high',
        metric: metric.name,
        message: `${metric.name} ${anomaly.direction} by ${anomaly.delta}`,
        investigation: investigation.id,
      })
    }
  }
})

// Track metric trends
on($.Metrics.trend.detected, async (trend, $) => {
  if (trend.direction === 'declining' && trend.metric.critical) {
    // Create improvement initiative
    const initiative = await db.create($.Initiative, {
      name: `Improve ${trend.metric.name}`,
      goal: `Reverse ${trend.direction} trend`,
      currentValue: trend.currentValue,
      targetValue: trend.baseline,
      deadline: '+30 days',
    })

    // Generate improvement ideas
    const ideas = await $.ai.generate('improvement-ideas', {
      metric: trend.metric,
      trend,
      context: await getBusinessContext(),
    })

    for (const idea of ideas) {
      await db.create($.Experiment, {
        name: idea.name,
        hypothesis: idea.hypothesis,
        initiative: initiative.id,
        status: 'proposed',
      })
    }
  }
})

Pattern 4: Performance-Driven Iteration

Optimize performance issues:

// Monitor performance
on($.Performance.degrades, async (event, $) => {
  // Identify bottleneck
  const analysis = await $.Performance.analyze({
    endpoint: event.endpoint,
    threshold: event.threshold,
    samples: 1000,
  })

  // Create optimization task
  await db.create($.Task, {
    title: `Optimize ${event.endpoint}`,
    description: `P95 latency: ${analysis.p95}ms (threshold: ${event.threshold}ms)`,
    priority: 'high',
    type: 'performance',
    analysis,
  })

  // Attempt auto-fix
  if (analysis.cause === 'n+1-query') {
    await $.Database.addEagerLoading(analysis.query)
  } else if (analysis.cause === 'missing-cache') {
    await $.Cache.enable(event.endpoint, {
      ttl: analysis.recommendedTTL,
    })
  }
})

// Track performance improvements
on($.Performance.improved, async (event, $) => {
  await send($.Analytics.track, {
    event: 'performance_improved',
    endpoint: event.endpoint,
    before: event.before,
    after: event.after,
    improvement: (event.before - event.after) / event.before,
  })
})

Iteration Strategies

Strategy 1: Rapid Iteration

Ship small improvements frequently:

// Continuous deployment
const rapidIterationWorkflow = {
  // 1. Identify opportunity
  onOpportunityDetected: async (opportunity) => {
    // Quick validation
    const feasibility = await $.ai.assess(opportunity, {
      effort: true,
      impact: true,
      risk: true,
    })

    if (feasibility.effort === 'low' && feasibility.impact === 'high') {
      // Fast track
      await db.create($.Task, {
        ...opportunity,
        priority: 'immediate',
        timeline: '1-day',
      })
    }
  },

  // 2. Implement quickly
  onImplementationComplete: async (task) => {
    // Deploy behind feature flag
    await $.Feature.create({
      name: task.featureName,
      enabled: false,
      rollout: 'gradual',
    })

    // Enable for team first
    await $.Feature.enable(task.featureName, {
      users: await getTeamMembers(),
    })
  },

  // 3. Monitor and expand
  onStableForTeam: async (feature) => {
    // Gradual rollout
    await $.Feature.startRollout(feature.name, {
      schedule: '0% → 100% over 24 hours',
    })
  },
}

Strategy 2: Focused Iteration

Deep dive on specific metrics:

// North Star metric focus
const focusedIterationCampaign = {
  metric: 'activation_rate',
  duration: '90 days',
  goal: 'increase from 40% to 60%',

  // Weekly iteration cycle
  cycle: async () => {
    // 1. Analyze current state
    const analysis = await $.Metrics.analyze('activation_rate', {
      segments: true,
      funnel: true,
      dropoff: true,
    })

    // 2. Generate hypotheses
    const hypotheses = await $.ai.generate('hypotheses', {
      metric: 'activation_rate',
      analysis,
      goal: 'reduce-dropoff',
    })

    // 3. Prioritize and test
    for (const hypothesis of hypotheses.slice(0, 3)) {
      await $.Experiment.create({
        name: hypothesis.name,
        hypothesis: hypothesis.statement,
        variants: hypothesis.variants,
        metric: 'activation_rate',
        duration: '1 week',
      })
    }

    // 4. Review and iterate
    await $.Schedule.create({
      trigger: '+7 days',
      action: 'review-and-iterate',
    })
  },
}

Strategy 3: Systematic Iteration

Methodical improvement across dimensions:

// Systematic improvement framework
const dimensions = {
  performance: {
    metrics: ['p95_latency', 'error_rate', 'uptime'],
    goal: 'operational-excellence',
  },
  conversion: {
    metrics: ['signup_rate', 'activation_rate', 'paid_conversion'],
    goal: 'growth',
  },
  retention: {
    metrics: ['churn_rate', 'engagement', 'nps'],
    goal: 'product-market-fit',
  },
  efficiency: {
    metrics: ['cogs', 'cac', 'ltv_cac_ratio'],
    goal: 'unit-economics',
  },
}

// Rotate focus quarterly
on($.Quarter.starts, async (quarter, $) => {
  const focus = selectQuarterlyFocus(quarter, dimensions)

  await db.create($.Initiative, {
    name: `Q${quarter.number} Focus: ${focus.goal}`,
    metrics: focus.metrics,
    duration: '90 days',
    goal: focus.goal,
  })

  // Generate improvement backlog
  for (const metric of focus.metrics) {
    const opportunities = await $.ai.analyze(metric, {
      findOpportunities: true,
      competitors: true,
      benchmarks: true,
    })

    for (const opp of opportunities) {
      await db.create($.Experiment, {
        name: opp.name,
        hypothesis: opp.hypothesis,
        initiative: focus.name,
        priority: opp.impact,
      })
    }
  }
})

Learning Systems

Pattern: Build Institutional Knowledge

Capture and share learnings:

// Document experiment learnings
on($.Experiment.completed, async (experiment, $) => {
  const learnings = await $.ai.extract({
    experiment,
    format: 'structured-insights',
  })

  await db.create($.Learning, {
    source: 'experiment',
    experiment: experiment.id,
    insights: learnings.insights,
    recommendations: learnings.recommendations,
    applicableTo: learnings.contexts,
  })

  // Share with team
  await send($.Team.all, {
    type: 'experiment-learnings',
    experiment: experiment.name,
    insights: learnings.insights,
  })
})

// Build playbook
const playbook = await $.Playbook.generate({
  from: await db.list($.Learning, {
    where: { confidence: { gte: 0.8 } },
  }),
  format: 'best-practices',
})

// Apply learnings to new situations
on($.Task.created, async (task, $) => {
  const relevantLearnings = await db.list($.Learning, {
    where: {
      applicableTo: { contains: task.type },
    },
  })

  if (relevantLearnings.length > 0) {
    await send($.Task.annotate, {
      taskId: task.id,
      learnings: relevantLearnings,
      message: 'Consider these past learnings',
    })
  }
})

Best Practices

Do's

  1. Start with data - Let metrics guide decisions
  2. Iterate quickly - Small, frequent improvements
  3. Document learnings - Build institutional knowledge
  4. Compound improvements - Stack wins over time
  5. Close feedback loops - From insight to action
  6. Celebrate progress - Acknowledge improvements
  7. Stay focused - Don't optimize everything at once

Don'ts

  1. Don't ignore signals - Act on data
  2. Don't optimize prematurely - Validate problems first
  3. Don't iterate blindly - Have hypotheses
  4. Don't forget users - Keep them involved
  5. Don't chase perfection - Ship improvements incrementally
  6. Don't lose context - Understand the "why"
  7. Don't stop iterating - Continuous improvement

CLI Tools

# Analyze metrics
do iterate analyze --metric activation_rate --period 30d

# Generate improvement ideas
do iterate ideas --metric churn_rate --count 10

# Create experiment from idea
do iterate experiment --idea idea-123

# Review recent experiments
do iterate review --status completed --period 30d

# Export learnings
do iterate learnings --format playbook

Next Steps


Iteration Tip: The fastest path to excellence is continuous small improvements, not occasional big ones.