experiment
Automated optimization loop with scalar fitness function.
Skill by mayankjain1815-commits
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/mayankjain1815-commits-experiment
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/experiment
What's inside
- Skill name
experiment- Description
- Automated optimization loop with scalar fitness function. Proposes changes in isolated worktrees, measures with a metric command, keeps improvements, discards failures. Supports convergence detection and diminishing returns.
- License
- MIT
- Instructions
- 147 lines in SKILL.md · view on GitHub
Files (3)
- SKILL.md
- no-metric.md · __benchmarks__/
- with-metric.md · __benchmarks__/
SKILL.md (first lines)
# /experiment — Metric-Driven Optimization Loop
## Inputs
The user provides three things:
1. **scope**: Files to modify (glob pattern, e.g., "src/api/**/*.ts")
2. **metric**: Shell command that outputs a single number (e.g., `npm run build 2>&1 | tail -1 | grep -oP '\d+'`)
3. **budget**: Iteration cap (default: 5) or time cap (e.g., "10 minutes")
If any input is missing, ask for it. The metric MUST output a single number to stdout.
## Protocol
### Step 1: BASELINE
1. Stash any uncommitted changes (restore on exit)
2. Run the metric command. Record the baseline value.
3. Determine direction: does lower = better (bundle size, error count) or higher = better (FPS, test count)?
Ask the user if ambiguous.
4. Log: `Baseline: {value} ({metric command})`
### Step 2: ITERATE
For each iteration (up to budget):
1. **Create isolation**: Spawn a sub-agent in a worktree (`isolation: "worktree"`)
2. **Propose change**: The agent modifies files within scope to improve the metric.
Provide context: baseline value, metric direction, scope, what previous iterations tried.
3. **Measure**: Run the metric command in the worktree (via `node scripts/run-with-timeout.js 300`)
4. **Gate**: Run typecheck (also via timeout wrapper). If it fails, discard immediately.
5. **Evaluate**:
- Improved? → KEEP. Merge the worktree branch. New baseline = new value.
- Same or worse? → DISCARD. Delete the worktree.
6. **Log iteration**:
```
Iteration {N}: {value} ({delta from baseline}) → {KEEP|DISCARD}
Change: {one-line description of what was tried}
```
### Step 3: CONVERGENCE CHECK
After each iteration, check:
- **Local optimum**: Last 3 iterations all discarded → stop ("no more improvements found")
- **Diminishing returns**: Last kept improvement was < 0.5% → stop ("diminishing returns")
- **Budget exhausted**: Iteration count or time exceeded → stop
### Step 4: REPORT
Write results to `.planning/research/experiment-{slug}.md`:
```
# Experiment: {Description}
> Metric: `{command}`
> Direction: {lower|higher} is better
> Scope: {glob pattern}
> Budget: {N iterations}
> Date: {ISO date}
## Results
| Iteration | Value | Delta | Verdict | Change |
|-----------|-------|-------|---------|--------|
| baseline | {N} | — | — | — |
| 1 | {N} | {+/-} | KEEP | {desc} |
| 2 | {N} | {+/-} | DISCARD | {desc} |
## Outcome
- **Start**: {baseline}
- **End**: {final value}
- **Improvement**: {percentage}
- **Iterations**: {kept}/{total}
- **Stop reason**: {convergence|diminishing|budget}
## Kept Changes
{List of changes that were kept, with commit hashes}
```
Also log to `.planning/telemetry/agent-runs.jsonl`:
```json
{"event":"experiment-complete","slug":"{slug}","baseline":0,"final":0,"improvement":"0%","kept":0,"total":0,"timestamp":"ISO"}
```
## Common Metrics
| Goal | Metric Command |
|------|---------------|
| Reduce bundle size | `npm run build 2>&1 \| grep -oP 'Total size: \K\d+'` |
| Reduce type errors | `npx tsc --noEmit 2>&1 \| grep -c 'error TS'` |
| Increase test pass rate | `npm test 2>&1 \| grep -oP '\d+ passing'` |
| Reduce file count | `find src -name '*.ts' \| wc -l` |
| Reduce line count | `wc -l src/**/*.ts \| tail -1 \| awk '{print $1}'` |
## 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
## Safety Rules
- NEVER modify files outside scope
- ALWAYS use worktree isolation for changes
- ALWAYS run typecheck before keeping a change
- Restore stashed changes on exit (even on error)
- If the metric command fails, treat as DISCARD (not crash)
## Contextual Gates
**Disclosure:** "Running experiment loop on [target] with fitness: [function]. Each iteration commits. Budget: [N iterations]."
**Reversibility:** amber — modifies source files across iterations; each iteration is committed; undo with `git revert` on kept commits.
**Trust gates:**
- Familiar (5+ sessions): iterates and commits autonomously; novices should use /improve with manual review between steps.
## Quality Gates
- Baseline was measured before any iterations ran
- Every kept iteration improved the metric AND passed typecheckFrom mayankjain1815-commits/CITADEL, MIT.
More from mayankjain1815-commits/CITADEL
- 0.519score
create-skill
mayankjain1815-commits
Creates new skills from the user's repeating patterns.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
daemon
mayankjain1815-commits
Continuous autonomous operation mode.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
grill
mayankjain1815-commits
Relentless one-question-at-a-time interview that sharpens a vague plan or design into shared understanding before any build.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
decision-map
mayankjain1815-commits
Turn a loose idea into a git-tracked, session-resumable map of typed investigation tickets, then drive them to resolution one at a time.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
evolve
mayankjain1815-commits
Research-driven multi-cycle improvement director.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
fleet
mayankjain1815-commits
Parallel campaign orchestrator.
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
deploy-steward
mayankjain1815-commits
Mainline deploy steward.
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
design
mayankjain1815-commits
Generates and maintains a design manifest for visual consistency.
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
do
mayankjain1815-commits
Unified router that auto-routes user intent to the right orchestrator or skill.
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
doc-gen
mayankjain1815-commits
Documentation generator with three modes: function-level (JSDoc/docstrings), module-level (directory READMEs), and API reference (endpoints/exports).
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
architect
mayankjain1815-commits
Given a PRD, produces an implementation architecture: file tree, component breakdown, data model, and a phased build plan with end conditions that Archon can…
SkillCFreshness: C★ 4Claude Code +9 - 0.516score
archon
mayankjain1815-commits
Autonomous multi-session campaign agent.
SkillCFreshness: C★ 4Claude Code +9
Signals
- Stars
- 4
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jun 11, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from mayankjain1815-commits
- 0.519score
decision-map
mayankjain1815-commits
Turn a loose idea into a git-tracked, session-resumable map of typed investigation tickets, then drive them to resolution one at a time.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
fleet
mayankjain1815-commits
Parallel campaign orchestrator.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
create-skill
mayankjain1815-commits
Creates new skills from the user's repeating patterns.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
daemon
mayankjain1815-commits
Continuous autonomous operation mode.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
evolve
mayankjain1815-commits
Research-driven multi-cycle improvement director.
SkillCFreshness: C★ 4Claude Code +9 - 0.519score
grill
mayankjain1815-commits
Relentless one-question-at-a-time interview that sharpens a vague plan or design into shared understanding before any build.
SkillCFreshness: C★ 4Claude Code +9
Cite this page
experiment skill. Agent Mart. https://agentmart.dev/skills/mayankjain1815-commits-experiment (last updated 2026-10-24)