# Experiment

Automated optimization loop with scalar fitness function.

- Repository: https://github.com/SethGammon/Citadel (927 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add SethGammon/Citadel --skill experiment -g -a claude-code -y`
Codex: `npx skills add SethGammon/Citadel --skill experiment -g -a codex -y`
Cursor: `npx skills add SethGammon/Citadel --skill experiment -g -a cursor -y`
Gemini CLI: `npx skills add SethGammon/Citadel --skill experiment -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add SethGammon/Citadel`

## Description

Automated optimization loop with scalar fitness function. Proposes changes in isolated worktrees, measures against a fixed baseline, and retains verified candidates locally. Supports convergence detection and diminishing returns.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# /experiment, Metric-Driven Optimization Loop

## Identity

Coordinate bounded metric-driven experiments in isolated checkouts, retaining
candidates locally until the declared verification and independent review pass.

## Orientation

### When to Use

- When you want to optimize a measurable metric (bundle size, error count, test coverage, FPS)
- When you have a clear hypothesis but aren't sure which of several approaches wins
- When manual A/B testing would be too slow or error-prone
- NOT when the goal is subjective ("make it feel better"), the metric must be a number

### Inputs

The user provides three things:
1. **scope**: Files to modify (glob pattern, e.g., "src/api/**/*.ts")
2. **metric**: Project command that outputs a single number (e.g., `node tools/bundle-bytes.cjs`)
3. **budget**: Iteration cap (default: 5) or time cap (e.g., "10 minutes")

Ask only for missing inputs that cannot be resolved from the request or project.
The metric MUST exit successfully and output a single finite number to stdout.

## Protocol

### Step 1: BASELINE

The rest: https://github.com/SethGammon/Citadel/blob/HEAD/skills/experiment/SKILL.md
