|
| 1 | +--- |
| 2 | +name: autoresearch-finalize |
| 3 | +version: 1.0.0 |
| 4 | +description: | |
| 5 | + Finalize autoresearch experiments into clean, reviewable branches. Use when: |
| 6 | + - An autoresearch session has accumulated kept experiments on a branch |
| 7 | + - The user wants to extract clean, independent branches from the experiment history |
| 8 | + - The user wants to prepare autoresearch results for code review and merging |
| 9 | + Groups kept experiments by logical change, creates independent branches from |
| 10 | + the merge-base, each reviewable and mergeable on its own. |
| 11 | +--- |
| 12 | + |
| 13 | +# Autoresearch Finalize |
| 14 | + |
| 15 | +Turn a noisy autoresearch branch into clean, independent branches — one per logical change, each starting from the merge-base. |
| 16 | + |
| 17 | +## When to Use |
| 18 | + |
| 19 | +After an autoresearch session has produced kept experiments, the branch history is a messy sequence of incremental improvements, reverts, and re-tries. This skill extracts the net-positive changes into clean branches that can be reviewed and merged independently. |
| 20 | + |
| 21 | +## Procedure |
| 22 | + |
| 23 | +### Step 1: Analyze the Experiment History |
| 24 | + |
| 25 | +Read `autoresearch.jsonl` to understand what was kept: |
| 26 | + |
| 27 | +```bash |
| 28 | +python3 autoresearch_helper.py summary --jsonl autoresearch.jsonl |
| 29 | +``` |
| 30 | + |
| 31 | +This shows all kept experiments with their descriptions, metrics, and which files were changed. |
| 32 | + |
| 33 | +Also review the git log to see the actual commits: |
| 34 | + |
| 35 | +```bash |
| 36 | +git log --oneline --stat $(git merge-base HEAD main)..HEAD |
| 37 | +``` |
| 38 | + |
| 39 | +### Step 2: Group Changes |
| 40 | + |
| 41 | +Group kept experiments into **logical changesets**. Each group should: |
| 42 | +- Represent a single coherent optimization or change |
| 43 | +- Not share modified files with other groups (so branches can merge independently) |
| 44 | +- Have a clear description of what it achieves and the metric improvement |
| 45 | + |
| 46 | +Present the proposed grouping to the user for approval: |
| 47 | + |
| 48 | +``` |
| 49 | +Group 1: "Reduce model depth from 8 to 6" |
| 50 | + Files: train.py (DEPTH, HEAD_DIM, N_EMBED) |
| 51 | + Metric improvement: val_bpb 1.15 -> 1.08 (-6.1%) |
| 52 | + Experiments: #3, #7, #12 |
| 53 | +
|
| 54 | +Group 2: "Switch to cosine LR schedule" |
| 55 | + Files: train.py (lr_schedule, warmup_steps) |
| 56 | + Metric improvement: val_bpb 1.08 -> 1.05 (-2.8%) |
| 57 | + Experiments: #15, #18 |
| 58 | +
|
| 59 | +Shall I proceed with this grouping? |
| 60 | +``` |
| 61 | + |
| 62 | +Wait for user confirmation before proceeding. |
| 63 | + |
| 64 | +### Step 3: Resolve File Conflicts |
| 65 | + |
| 66 | +If groups share files, you must resolve this before creating branches. Options: |
| 67 | +- Merge the groups into one (if changes are related) |
| 68 | +- Split the file changes more carefully (if they're truly independent modifications to different parts of the file) |
| 69 | +- Ask the user which group gets priority for the contested file |
| 70 | + |
| 71 | +Groups **must not share files** — each branch must be independently mergeable. |
| 72 | + |
| 73 | +### Step 4: Create Clean Branches |
| 74 | + |
| 75 | +For each group: |
| 76 | + |
| 77 | +```bash |
| 78 | +# Find the merge base |
| 79 | +merge_base=$(git merge-base HEAD main) |
| 80 | + |
| 81 | +# Create a clean branch from the merge base |
| 82 | +git checkout -b autoresearch/finalize/<group-name> $merge_base |
| 83 | + |
| 84 | +# Apply only the final state of files in this group |
| 85 | +# (cherry-pick or manually apply the net changes) |
| 86 | +git checkout autoresearch/<session-branch> -- <file1> <file2> ... |
| 87 | + |
| 88 | +# Commit with a descriptive message including metrics |
| 89 | +git commit -m "<group description> |
| 90 | +
|
| 91 | +Autoresearch results: |
| 92 | +- Metric: <name> improved from <baseline> to <best> (<delta>%) |
| 93 | +- Confidence: <score>x noise floor |
| 94 | +- Experiments: <count> total, <kept> kept |
| 95 | +
|
| 96 | +Changes: |
| 97 | +- <bullet point summary of what changed and why>" |
| 98 | +``` |
| 99 | + |
| 100 | +### Step 5: Verify Each Branch |
| 101 | + |
| 102 | +For each finalized branch: |
| 103 | +1. Run the benchmark to confirm the metric improvement holds |
| 104 | +2. Run any checks (tests, types, lint) if applicable |
| 105 | +3. Verify the branch merges cleanly with main |
| 106 | + |
| 107 | +### Step 6: Report Results |
| 108 | + |
| 109 | +Present a summary: |
| 110 | + |
| 111 | +``` |
| 112 | +Created 2 clean branches from 20 experiments: |
| 113 | +
|
| 114 | + autoresearch/finalize/reduce-depth |
| 115 | + val_bpb: 1.15 -> 1.08 (-6.1%) |
| 116 | + Files: train.py |
| 117 | + Ready for review |
| 118 | +
|
| 119 | + autoresearch/finalize/cosine-schedule |
| 120 | + val_bpb: 1.08 -> 1.05 (-2.8%) |
| 121 | + Files: train.py (different sections) |
| 122 | + Ready for review |
| 123 | +
|
| 124 | +Original experiment branch preserved: autoresearch/<session-branch> |
| 125 | +``` |
| 126 | + |
| 127 | +## Notes |
| 128 | + |
| 129 | +- The original experiment branch is preserved — finalization creates new branches, it doesn't modify the experiment branch. |
| 130 | +- Each finalized branch starts from the merge-base, so they can be reviewed and merged independently without ordering dependencies. |
| 131 | +- If all changes touch the same file and can't be separated, create a single finalized branch with all improvements combined. |
| 132 | +- Include metric improvements in commit messages so reviewers can see the impact. |
0 commit comments