feat(prompts): add /m2_evolve and auto mode for pr/next/release - #20
Merged
Conversation
Add /m2_evolve: a long-running self-iterating optimization flow that works a goal on a 12h budget via sense/plan/act/verify/judge iterations, keeps a resumable ledger under .evolve/, and reverts anything that does not measurably improve. It never opens or merges a PR itself. Add an 'auto' trailing modifier to /m2_pr, /m2_next and /m2_release that resolves every confirmation node autonomously and reports once at the end. The shared contract lives in copilot-instructions section 9: decision rules, a non-waivable ABORT list, a mandatory origin-freshness check, and mandatory gh api verification of PR identity before any merge or branch deletion. Kept as one commit because both changes share copilot-instructions section 9, README and CHANGELOG; any file-level split yields an intermediate commit that fails scripts/validate.py routing-coverage check. Merged with --squash per repo history, so branch granularity does not reach main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
新增
/m2_evolve長時間自主迭代優化指令,並為/m2_pr、/m2_next、/m2_release加上後置auto全自動模式。auto讓 agent 自行解決每個確認節點、一路跑到任務完成,最後才輸出單一的工作流程 + 結果報告;共用契約集中寫在copilot-instructions§9,三支 prompt 只描述各自的差異。Why
兩件事都在補「agent 能自己走完多久」這條線的兩端。
/m2_evolve補的是長度:既有四支指令都是單次流程,沒有一支能「給一個目標,讓它反覆改到收斂」。實務上這種需求最容易失控——agent 會為了讓驗證變綠而改測試、放寬 lint、或宣稱沒實際跑過的驗證。因此這支 prompt 的重點不在「會迭代」,而在「作弊會被擋下來」。auto補的是中斷次數:/m2_pr→ 確認合併 →/m2_next→ 確認刪分支,一輪要停三、四次。人在電腦前時這是對的,但在明確授權的情況下應該可以一路跑完。關鍵是「不需要人參與決策」不能等於「不需要安全檢查」,所以 ABORT 清單一條都沒放寬。How
/m2_evolve.evolve/<run-id>/(CHARTER / BASELINE / STATE.json / LEDGER.md),支援/m2_evolve resume冷啟動接續。帳本以.git/info/exclude忽略而不改.gitignore——它是本機過程檔,不該污染下游 repo 的版控設定,而且第 1.1 節才剛要求 working tree 乾淨。ask/notify/silent)、檔案 kill switch(.evolve/STOP、.evolve/PAUSE,一個迭代檢查三次)、不可停用的 tripwire、以及隨時可直接打開看的LEDGER.md。git add -A)、送出前git diff --cached自檢機密資料;退回時用git restore加上逐一刪除本迭代新建的檔,禁用git clean -fd/git reset --hard(它們會動到使用者自己的未追蹤檔)。auto模式copilot-instructions§9,避免三支 prompt 各寫一套後漂移。auto一條都不免:CI 紅/逾時/取消、diff 含機密資料、已追蹤檔未 commit、本機落後origin、PR 身分無法查證、tag 或版號已被用掉、合併衝突、需繞過 branch protection。git rev-list --left-right --count origin/main...HEAD左邊必須是0)。落後的 base 是最具破壞性的失敗模式——所有編輯都對到舊檔,開出來的 PR 會直接回退掉期間已合併的工作。gh api查證 PR 身分(head.ref/base.ref/ title 全對)。gh pr create印出的 URL 與gh pr list都曾指到不相干的 PR,沒人盯著時合錯 PR 幾乎無法還原。m2_next auto只有未追蹤檔就保留並繼續、有已追蹤檔的未 commit 變更就中止,且只刪本次 PR 的分支;m2_release auto在版號與 tag 不一致、版號已在 CHANGELOG、合併後 HEAD 不是 bump commit、或 release PR 夾帶其他檔時一律停下且不打 tag。其他
copilot-instructions§9 原本「不可跳過確認節點」修正為「唯一例外是使用者明打auto」,並補上/m2_evolve的 routing 條目(scripts/validate.py會檢查路由表涵蓋所有 prompt file)。auto。Impact
auto模式、copilot-instructions§9 新增一節。auto時三支流程的確認節點完全照舊。auto讓 agent 能在無人確認下合併 PR。已用 ABORT 清單、新鮮度檢查與 PR 身分查證三道防線收斂,但建議先在本 repo 實跑幾次再推廣。Verification
python scripts/validate.py→ 5 個 prompt file 全數通過、0 警告CHANGELOG.md(v2.2.0)origin/main(本次即是先發現落後 6 個 commit、重做後才提交)git diff --cached自檢無機密資料/m2_pr auto端到端尚未跑過完整的「自行合併」路徑(本 PR 即為首次;auto 的合併節點會在這裡第一次實際執行)/m2_next auto、/m2_release auto尚未實跑,屬規格