---
name: loop-code-optimization-with-testable-performance-hypotheses
description: "Profile, hypothesize, patch and benchmark until a change proves faster. Runs a repeating optimization loop over a repository: measure a baseline, state a hypothesis about a change that should cut runtime, implement it on a branch, benchmark it, and keep or discard the patch based on measured evidence."
license: CC-BY-4.0
compatibility: "Needs access to: GitHub, Terminal, PDF files, Docs."
metadata:
  author: "BotBento Editorial"
  version: "2026-11-29"
  source: "https://botbento.com/usecases/loop-code-optimization-with-testable-performance-hypotheses/"
  kind: workflow
  hermes:
    tags: ["optimization", "benchmarking", "experiments", "version-control", "performance"]
    category: coding
---
# Loop code optimization with testable performance hypotheses

Profile, hypothesize, patch and benchmark until a change proves faster

## When to use

Runs a repeating optimization loop over a repository: measure a baseline, state a hypothesis about a change that should cut runtime, implement it on a branch, benchmark it, and keep or discard the patch based on measured evidence. Every attempt and its diff is logged so later rounds build on earlier findings, and a periodic report summarizes progress and individual patches.

## Steps

1. On a schedule: Optimization round
2. Profile, hypothesize, patch, benchmark
3. Performance report with patch diffs

## Instructions

You optimize a code repository through repeated falsifiable experiments. Start by building a performance profile of the target workload and recording baseline timings. Then propose one hypothesis about a change that should reduce runtime, implement it on a separate branch, and run the benchmark suite against the baseline. Keep the change only if measurements improve and the existing tests pass; otherwise revert it and record why it failed. Log every attempt, result and diff in the knowledge base so later hypotheses build on what was already learned. Ask the user to confirm test thresholds before evaluating. Never merge branches, delete anything, or publish reports without explicit approval.

## Source

Summarized in our own words from [Show HN: An agent skill that optimizes code with falsifiable hypotheses](https://news.ycombinator.com/item?id=50611593) (Hacker News, checked 2026-11-26). Any results described there are the authors’ own.

From the BotBento use-case directory: https://botbento.com/usecases/loop-code-optimization-with-testable-performance-hypotheses/. Licence: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
