跳到正文
Skillpedia
通用编程8.2k · #12523

autoresearch-finalize

它能做什么

这项技能从 autoresearch 会话中提取保留的改动,并把它们整理成干净的分支,每个想法一个分支。适合希望在合并前获得可评审成果的人。

适用场景

  • ✓当 autoresearch 会话已经结束,你希望评审其中的改动时。
  • ✓当你有许多零散的实验提交,需要按主题整理时。
  • ✓当你想在准备分支之前,确认哪些改动被保留时。

技能链接

https://github.com/davebcn87/pi-autoresearch/blob/main/skills/autoresearch-finalize/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/davebcn87/pi-autoresearch/blob/main/skills/autoresearch-finalize/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请完成我的 autoresearch 会话,让每项改进都位于独立的干净分支中,供评审。”

每周 5 个新技能,1 分钟读完。

工作原理

这项技能读取会话日志,只保留标记为已保留的实验,并按主题进行分组。它会先提出分组方案供你审阅,然后以共同起点(与 main 分支的 merge-base)为每个分组创建一个分支。

技术内容(原始 SKILL.md)

作者在 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

  1. Read .auto/log.jsonl (legacy: autoresearch.jsonl). Filter to kept experiments only.
  2. Read .auto/prompt.md (legacy: autoresearch.md) for context.
  3. Expand all short commit hashes to full hashes: git rev-parse <short_hash>
  4. Get the merge-base: git merge-base HEAD main
  5. For each kept commit, get the diff stat (use $BASE..<commit> for the first, <prev_kept>..<commit> for subsequent).
  6. 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.js and group 2 calls it in parser.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_commit must be a full hash. Expand from jsonl short hashes with git 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.
常见问题

我可以先检查分组吗?

可以。在构建分支之前,这项技能会先展示建议的分组。

没有被保留的改动会怎样?

只使用标记为已保留的实验,因此被丢弃的尝试会被排除在外。

它与哪个分支进行比较?

它使用与 main 分支的 merge-base 作为每个分组的起点。

详情

作者的原始描述

Finalize an autoresearch session into clean, reviewable branches. Use when asked to "finalize autoresearch", "clean up experiments", or "prepare autoresearch for review".

repo: davebcn87/pi-autoresearch

热度

GitHub 星标
8.2k
排名
#12523
许可证
MIT
更新时间
2026/10/7

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能