spec-merge-back
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesespec-merge-back
spec-merge-back
Overview
Overview
Merge-back 是 Spec Pack 生命周期的“晋升阶段”:把本次需求中会长期复用/会约束未来需求的内容晋升到 (Project SSOT),其余内容仍留在 作为交付证据。
.aisdlc/project/{FEATURE_DIR}核心原则:Project SSOT 只沉淀 入口 + 护栏(不变量)+ 证据链;禁止把“一次性交付细节”搬到 project。
Merge-back is the "promotion phase" of the Spec Pack lifecycle: content in this requirement that will be reused for a long time / will constrain future requirements is promoted to (Project SSOT), and the remaining content stays in as delivery evidence.
.aisdlc/project/{FEATURE_DIR}Core Principle: Project SSOT only stores entry + guardrails (invariants) + evidence chain; it is forbidden to move "one-time delivery details" to the project.
When to Use
When to Use
适用于:
- 本次需求完成,准备将资产晋升到 (ADR / API Contract / Data Contract / Ops / NFR / Registry)。
.aisdlc/project/ - 中已出现
{FEATURE_DIR}/implementation/plan.md,需要在结束前清空或留痕。## Merge-back 待办清单 - 团队反复在多个需求里重复同一类“契约口径/门禁口径/运维入口”,需要沉淀为长期资产。
不适用于:
- 你只是要把代码分支合并到 main(那是 git merge/rebase,不是 merge-back)。
- 仓库还没有 的骨架(这是 CONTEXT GAP,应先用
.aisdlc/project/或项目初始化流程建立 project SSOT)。project-discover*
Applicable scenarios:
- This requirement is completed, and you are ready to promote assets to (ADR / API Contract / Data Contract / Ops / NFR / Registry).
.aisdlc/project/ - has appeared in
## Merge-back To-do List, which needs to be cleared or documented before closing.{FEATURE_DIR}/implementation/plan.md - The team repeatedly repeats the same type of "contract caliber/access control caliber/operation and maintenance entry" in multiple requirements, which needs to be precipitated as long-term assets.
Inapplicable scenarios:
- You just want to merge code branches to main (that is git merge/rebase, not merge-back).
- The repository does not yet have the skeleton (this is CONTEXT GAP, you should first use
.aisdlc/project/or the project initialization process to build the project SSOT).project-discover*
Core Pattern (Gates first)
Core Pattern (Gates first)
Gate 0: 必须定位 FEATURE_DIR(禁止口头路径)
Gate 0: FEATURE_DIR must be located (verbal path is forbidden)
powershell
. ".\skills\spec-context\scripts\spec-common.ps1"
$context = Get-SpecContext
$FEATURE_DIR = $context.FEATURE_DIR
Write-Host "FEATURE_DIR=$FEATURE_DIR"失败即停止: 报错就停止,不允许“先写一版/先猜路径”。
Get-SpecContextpowershell
. ".\skills\spec-context\scripts\spec-common.ps1"
$context = Get-SpecContext
$FEATURE_DIR = $context.FEATURE_DIR
Write-Host "FEATURE_DIR=$FEATURE_DIR"Stop on failure: Stop immediately if reports an error, do not allow "write a version first / guess the path first".
Get-SpecContextGate 1: project SSOT 必须存在
Gate 1: Project SSOT must exist
- 必须存在:
.aisdlc/project/ - 不存在:输出 并停止(禁止“随便建个目录能跑就行”)。
CONTEXT GAP: .aisdlc/project missing
- Must exist:
.aisdlc/project/ - If not exist: Output and stop (forbid "just create a random directory to make it run").
CONTEXT GAP: .aisdlc/project missing
Implementation (SOP)
Implementation (SOP)
Step 1: 收集晋升清单(唯一主入口)
Step 1: Collect promotion list (the only main entry)
以 中的 为主入口,汇总本次需要晋升的条目,并按类别分组:
{FEATURE_DIR}/implementation/plan.md## Merge-back 待办清单- ADR(关键决策)
- API Contract(按模块)
- Data Contract(按模块)
- Ops(runbook/monitoring/rollback)
- NFR(如适用)
- Registry()
.aisdlc/project/index.md - 可选晋升(通用测试策略/质量门禁口径等)
禁止:跳过待办改用“凭记忆总结”。若时间紧,可用plan.md补证据,但清单来源仍以git diff为主。plan.md
Take in as the main entry, summarize the items to be promoted this time, and group them by category:
## Merge-back To-do List{FEATURE_DIR}/implementation/plan.md- ADR (key decisions)
- API Contract (by module)
- Data Contract (by module)
- Ops (runbook/monitoring/rollback)
- NFR (if applicable)
- Registry ()
.aisdlc/project/index.md - Optional promotion (general test strategy/quality access control caliber, etc.)
Forbidden: Skip theto-do list and use "summarize from memory" instead. If time is tight, you can useplan.mdto supplement evidence, but the source of the list is still mainlygit diff.plan.md
Step 2: 生成/更新 {FEATURE_DIR}/merge_back.md
(清单与证据)
{FEATURE_DIR}/merge_back.mdStep 2: Generate/update {FEATURE_DIR}/merge_back.md
(list and evidence)
{FEATURE_DIR}/merge_back.md{FEATURE_DIR}/merge_back.md- project 落点(目标路径 + 锚点)
- 不变量摘要(需要长期护栏时:3–7 条)
- 证据入口(OpenAPI/Schema/DDL/脚本/CI/测试/监控入口)
- 状态:Done / Not Done(Not Done 必须写缺口与计划)
若用户要求“先别改 project、后面有人手动做”:仍然必须完成 Step 1–2,并把 Step 3 的 project 晋升项标记为 Not Done + 计划(否则 merge-back 不可审计、容易永久遗漏)。
{FEATURE_DIR}/merge_back.md- Project landing location (target path + anchor)
- Invariant summary (when long-term guardrails are needed: 3–7 items)
- Evidence entry (OpenAPI/Schema/DDL/script/CI/test/monitoring entry)
- Status: Done / Not Done (Not Done items must specify gaps and plans)
If the user requires "don't modify the project first, someone will do it manually later": You still must complete Step 1–2, and mark the project promotion items in Step 3 as Not Done + plan (otherwise merge-back is not auditable and easy to be permanently missed).
Step 3: 晋升到 project SSOT(只升长期资产)
Step 3: Promote to project SSOT (only promote long-term assets)
对齐 的默认必晋升项:
design/aisdlc.md- ADR → + 索引
.aisdlc/project/adr/ - API/Data 契约 → /
.aisdlc/project/components/{module}.md#api-contract#data-contract- 只写:权威入口 + 不变量摘要 + 证据入口 + Evidence Gaps
- 禁止把字段大全抄进 project
- Ops → (入口式,不重复本次发布执行细节)
.aisdlc/project/ops/ - NFR → (如适用)
.aisdlc/project/nfr.md - Registry → (状态更新到 Merged & Archived 或团队约定状态)
.aisdlc/project/index.md
Align with the default mandatory promotion items in :
design/aisdlc.md- ADR → + index
.aisdlc/project/adr/ - API/Data Contract → /
.aisdlc/project/components/{module}.md#api-contract#data-contract- Only write: authoritative entry + invariant summary + evidence entry + Evidence Gaps
- Forbid copying the full field list into the project
- Ops → (entry type, do not repeat the execution details of this release)
.aisdlc/project/ops/ - NFR → (if applicable)
.aisdlc/project/nfr.md - Registry → (update status to Merged & Archived or the status agreed by the team)
.aisdlc/project/index.md
Step 4: DoD 自检(完成标准)
Step 4: DoD self-check (completion criteria)
- 已落盘,覆盖 ADR/API/Data/Ops/NFR/Registry(适用项)。
{FEATURE_DIR}/merge_back.md - project 侧入口可导航,组件页锚点稳定(/
#api-contract)。#data-contract - Done 项都有“可点击落点 + 证据入口”;Not Done 项有“缺口 + 计划”。
- project 未被一次性交付细节污染(没有整包复制 spec、没有把实现步骤搬上来)。
- has been saved, covering ADR/API/Data/Ops/NFR/Registry (applicable items).
{FEATURE_DIR}/merge_back.md - The entry on the project side is navigable, and the component page anchor is stable (/
#api-contract).#data-contract - Done items have "clickable landing location + evidence entry"; Not Done items have "gap + plan".
- The project is not contaminated by one-time delivery details (no full package replication of spec, no moving implementation steps to the project).
Red Flags (STOP)
Red Flags (STOP)
- 用户说“别跑脚本,FEATURE_DIR 我口头告诉你” → 必须拒绝,坚持 。
spec-context - 用户要求“把 design/implementation/release/verification 都复制到 project,越全越好” → 禁止(会污染 project SSOT)。
- 不存在但你准备“先随便建一下” → 禁止(CONTEXT GAP,先建 project SSOT 骨架)。
.aisdlc/project - 你开始写“git merge/rebase 清单” → 你把 merge-back 误解成 git 合并了,立刻停止纠正。
- 你准备跳过 的 Merge-back 待办 → 高概率遗漏或漂移。
implementation/plan.md
- The user says "don't run the script, I'll tell you the FEATURE_DIR verbally" → Must refuse, insist on using .
spec-context - The user requires "copy all design/implementation/release/verification to the project, the more comprehensive the better" → Forbidden (will contaminate the project SSOT).
- does not exist but you are going to "build a random one first" → Forbidden (CONTEXT GAP, build the project SSOT skeleton first).
.aisdlc/project - You start writing a "git merge/rebase list" → You have mistaken merge-back for git merge, stop and correct immediately.
- You are going to skip the Merge-back to-do list in → High probability of omission or drift.
implementation/plan.md
Rationalizations (and counters)
Rationalizations (and counters)
| 常见借口 | 现实/反制 |
|---|---|
| “很急,先复制整包到 project,后面再整理” | 整包复制会长期污染 project;正确做法是只晋升“入口+不变量+证据链”。 |
| “用户给了 FEATURE_DIR,不用跑 spec-context” | 口头路径不可信;必须以 |
| “project 目录没有,我先建个最小的让它跑起来” | merge-back 不负责初始化 project SSOT;缺失即 |
| “不看 plan.md 待办也能总结” | 待办是唯一执行期汇总入口;跳过会遗漏且不可审计。 |
| Common Excuses | Facts/Countermeasures |
|---|---|
| "It's urgent, copy the whole package to the project first, and sort it out later" | Full package replication will contaminate the project for a long time; the correct approach is to only promote "entry + invariants + evidence chain". |
| "The user gave the FEATURE_DIR, no need to run spec-context" | Verbal paths are not reliable; the output of |
| "The project directory does not exist, I will build a minimal one first to make it run" | merge-back is not responsible for initializing the project SSOT; if missing, report |
| "I can summarize without looking at the plan.md to-do list" | The to-do list is the only summary entry during the execution period; skipping it will lead to omission and is not auditable. |
完成后输出与自动路由(必须执行)
Post-completion Output and Automatic Routing (Mandatory)
merge_back.md- 输出 ROUTER_SUMMARY(YAML 形态,供 Router 决策):
yaml
ROUTER_SUMMARY:
stage: MergeBack
artifacts:
- "{FEATURE_DIR}/merge_back.md"
needs_human_review: true
blocked: false
block_reason: ""
notes: "已晋升 ADR/契约/ops/NFR/registry;Done/Not Done 与证据入口齐全。"-
立即执行:将上述
using-aisdlc作为路由输入传递给 using-aisdlc,由 Router 判定下一步并自动推进(无需等待用户说「继续」)。ROUTER_SUMMARY- 若 Router 判定可自动续跑:在同一轮对话内继续执行下一步 worker skill
- 若 Router 触发硬中断:停下并输出阻断原因、需要的输入、候选下一步
-
对话输出:在调用 using-aisdlc 前,可简短说明「本阶段产物已落盘,正在调用 using-aisdlc 路由下一步。」
After is saved, must complete the following actions (in order, cannot be omitted):
merge_back.md- Output ROUTER_SUMMARY (YAML format, for Router decision making):
yaml
ROUTER_SUMMARY:
stage: MergeBack
artifacts:
- "{FEATURE_DIR}/merge_back.md"
needs_human_review: true
blocked: false
block_reason: ""
notes: "已晋升 ADR/契约/ops/NFR/registry;Done/Not Done 与证据入口齐全。"-
Executeimmediately: Pass the above
using-aisdlcas routing input to using-aisdlc, and the Router will determine the next step and automatically advance (no need to wait for the user to say "continue").ROUTER_SUMMARY- If the Router determines that automatic continuation is possible: Continue to execute the next worker skill in the same round of conversation
- If the Router triggers a hard interrupt: Stop and output the blocking reason, required input, and candidate next steps
-
Conversation output: Before calling using-aisdlc, you can briefly explain "The products of this phase have been saved, and using-aisdlc is being called to route the next step."