autoresearch-finalize
What it does
This skill takes the kept changes from an autoresearch session and groups them into clean branches, one per idea. It is for people who want reviewable work before merging.
When to use it
- ✓When an autoresearch session has finished and you want its changes reviewed.
- ✓When you have many small experiment commits and need them organized by topic.
- ✓When you want to confirm which changes were kept before preparing branches.
Skill link
https://github.com/davebcn87/pi-autoresearch/blob/main/skills/autoresearch-finalize/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Finalize my autoresearch session so each improvement is in its own clean branch for review.”
5 new skills a week. 1 minute to read.
How it works
The skill reads the session log, keeps only the experiments marked as kept and groups them by topic. It proposes the groups for you to review, then builds one branch per group from the common starting point with the main branch.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Finalize Autoresearch
Turn a noisy autoresearch branch into clean, independent branches — one per logical change, each starting from the merge-base.
Step 1 — Analyze and Propose Groups
- Read
.auto/log.jsonl(legacy:autoresearch.jsonl). Filter to kept experiments only. - Read
.auto/prompt.md(legacy:autoresearch.md) for context. - Expand all short commit hashes to full hashes:
git rev-parse <short_hash> - Get the merge-base:
git merge-base HEAD main - For each kept commit, get the diff stat (use
$BASE..<commit>for the first,<prev_kept>..<commit>for subsequent). - Group kept commits into logical changesets:
- Preserve application order. Group N comes before Group N+1.
- No two groups may touch the same file. Each branch is applied to merge-base independently — overlapping files would conflict. If two groups touch the same file, merge them into one group.
- Watch for cross-file dependencies. Each branch is independent, so if group 1 adds an API in
api.jsand group 2 calls it inparser.js, group 2's branch won't work in isolation. When proposing groups, flag dependencies: "group 2 depends on group 1 — review together." If the dependency is tight, merge the groups. - Keep each group small and focused. One idea, one theme per group.
- Don't hardcode a count. Could be 2, could be 15.
Present the proposed grouping to the user:
Proposed branches (each from merge-base, independent):
1. **Switch test runner to forks pool** (commits abc1234, def5678)
Files: vitest.config.ts, package.json
Metric: 42.3s → 38.1s (-9.9%)
2. **Tune worker count and timeouts** (commits ghi9012, jkl3456)
Files: test/setup.ts
Metric: 38.1s → 31.7s (-16.8%)
Wait for approval before proceeding.
Step 2 — Write groups.json and Run
Write groups.json:
{
"base": "<full merge-base hash>",
"trunk": "main",
"final_tree": "<full hash of current HEAD>",
"goal": "short-slug",
"groups": [
{
"title": "Switch to forks pool",
"body": "Why + what changed.\n\nExperiments: #3, #5\nMetric: total_time 42.3s → 38.1s (-9.9%)",
"last_commit": "<full hash of last kept commit in this group>",
"slug": "forks-pool"
}
]
}
Key rules:
last_commitmust be a full hash. Expand from jsonl short hashes withgit rev-parse.- No two groups may share a file. The script validates this and fails if violated.
Then run:
bash <SKILL_DIR>/finalize.sh /tmp/groups.json
The script creates one branch per group from the merge-base, verifies the union matches the original branch, and prints a summary with all branches, cleanup commands, and any ideas from .auto/ideas.md (legacy: autoresearch.ideas.md).
On creation failure: rolls back (deletes branches, restores original branch, pops stash). On verification failure: exits non-zero but leaves branches intact for inspection.
Step 3 — Report
After the script finishes, report to the user:
- Branches created and what each contains
- Overall metric improvement (baseline → best)
- Show the cleanup commands from the script's summary output
Edge Cases
- Only 1 kept experiment: One branch is fine — don't force splits.
- Overlapping files between groups: The script fails with an error naming the file. Merge the overlapping groups and retry.
- Non-experiment commits on the branch: Skip them — only process kept experiments from the jsonl.
FAQ
Do I get to check the groups first?
Yes. The skill presents proposed groups before the branches are built.
What happens to changes that were not kept?
Only experiments marked as kept are used, so discarded attempts are left out.
Which branch does it compare against?
It uses the merge-base with the main branch as the starting point for each group.
Details
Original description by the author
Finalize an autoresearch session into clean, reviewable branches. Use when asked to "finalize autoresearch", "clean up experiments", or "prepare autoresearch for review".
Popularity
- GitHub stars
- 8.2k
- Ranking position
- #12523
- License
- MIT
- Updated
- 10/7/2026
Comments
- …
More skills from this repository
autoresearch-create
8.2kHelps your agent run an autonomous experiment loop that tries ideas, keeps what improves a chosen target and discards the rest.
autoresearch-hooks
8.2kTeaches your agent to write small scripts that run before and after each experiment, for alerts, saved notes or fetching research.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.