@prismer/runtime 2.0.8 → 2.2.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +3430 -0
  2. package/README.md +34 -12
  3. package/apc/skills/FIELD-DICTIONARY.md +111 -0
  4. package/apc/skills/bug-reproduce/SKILL.md +150 -0
  5. package/apc/skills/bug-reproduce/skill.json +96 -0
  6. package/apc/skills/code-review/SKILL.md +198 -0
  7. package/apc/skills/code-review/skill.json +124 -0
  8. package/apc/skills/design-review/SKILL.md +122 -0
  9. package/apc/skills/design-review/skill.json +88 -0
  10. package/apc/skills/doc-sync/SKILL.md +168 -0
  11. package/apc/skills/doc-sync/skill.json +81 -0
  12. package/apc/skills/env-doctor/SKILL.md +194 -0
  13. package/apc/skills/env-doctor/skill.json +209 -0
  14. package/apc/skills/git-ops/SKILL.md +189 -0
  15. package/apc/skills/git-ops/skill.json +94 -0
  16. package/apc/skills/impact-trace/SKILL.md +168 -0
  17. package/apc/skills/impact-trace/skill.json +104 -0
  18. package/apc/skills/observability/SKILL.md +195 -0
  19. package/apc/skills/observability/skill.json +116 -0
  20. package/apc/skills/release-db-config-sync/SKILL.md +186 -0
  21. package/apc/skills/release-db-config-sync/skill.json +109 -0
  22. package/apc/skills/release-ota-promote/SKILL.md +195 -0
  23. package/apc/skills/release-ota-promote/skill.json +176 -0
  24. package/apc/skills/release-preflight/SKILL.md +174 -0
  25. package/apc/skills/release-preflight/skill.json +175 -0
  26. package/apc/skills/release-rollback/SKILL.md +214 -0
  27. package/apc/skills/release-rollback/skill.json +230 -0
  28. package/apc/skills/release-tag/SKILL.md +194 -0
  29. package/apc/skills/release-tag/skill.json +94 -0
  30. package/apc/skills/releasing-prod/SKILL.md +49 -0
  31. package/apc/skills/releasing-test/SKILL.md +135 -0
  32. package/apc/skills/sdk-release/SKILL.md +200 -0
  33. package/apc/skills/spec-intake/SKILL.md +169 -0
  34. package/apc/skills/spec-intake/skill.json +93 -0
  35. package/apc/skills/test-result-feedback/SKILL.md +239 -0
  36. package/apc/skills/test-result-feedback/skill.json +193 -0
  37. package/apc/skills/test-runner/SKILL.md +169 -0
  38. package/apc/skills/test-runner/skill.json +103 -0
  39. package/apc/skills/ui-align/SKILL.md +209 -0
  40. package/apc/skills/ui-align/skill.json +114 -0
  41. package/apc/skills/ui-canvas/SKILL.md +148 -0
  42. package/apc/skills/ui-canvas/skill.json +127 -0
  43. package/built-in-skills/agent-coordination/SKILL.md +59 -37
  44. package/built-in-skills/agent-meta/SKILL.md +1 -0
  45. package/built-in-skills/assets/SKILL.md +8 -6
  46. package/built-in-skills/browser-use/SKILL.md +93 -0
  47. package/built-in-skills/canvas-design/SKILL.md +1 -0
  48. package/built-in-skills/claim-agent-ownership/SKILL.md +3 -2
  49. package/built-in-skills/claude-api/SKILL.md +1 -0
  50. package/built-in-skills/codebase-design/DEEPENING.md +37 -0
  51. package/built-in-skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
  52. package/built-in-skills/codebase-design/LICENSE +21 -0
  53. package/built-in-skills/codebase-design/SKILL.md +116 -0
  54. package/built-in-skills/conversation-compaction/SKILL.md +114 -0
  55. package/built-in-skills/council-creator/SKILL.md +426 -0
  56. package/built-in-skills/diagnosing-bugs/LICENSE +21 -0
  57. package/built-in-skills/diagnosing-bugs/SKILL.md +136 -0
  58. package/built-in-skills/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
  59. package/built-in-skills/doc-coauthoring/SKILL.md +1 -0
  60. package/built-in-skills/document-generation/SKILL.md +105 -0
  61. package/built-in-skills/domain-modeling/ADR-FORMAT.md +47 -0
  62. package/built-in-skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  63. package/built-in-skills/domain-modeling/LICENSE +21 -0
  64. package/built-in-skills/domain-modeling/SKILL.md +76 -0
  65. package/built-in-skills/frontend-design/SKILL.md +1 -0
  66. package/built-in-skills/human-approval/SKILL.md +17 -2
  67. package/built-in-skills/image-generate/SKILL.md +103 -302
  68. package/built-in-skills/image-generate/scripts/generate-and-deliver.mjs +289 -0
  69. package/built-in-skills/ingest/SKILL.md +13 -45
  70. package/built-in-skills/internal-comms/SKILL.md +1 -0
  71. package/built-in-skills/liteparse/SKILL.md +130 -110
  72. package/built-in-skills/mcp-builder/SKILL.md +1 -0
  73. package/built-in-skills/memory/SKILL.md +420 -55
  74. package/built-in-skills/memory-dream/SKILL.md +339 -0
  75. package/built-in-skills/office-artifacts/SKILL.md +17 -4
  76. package/built-in-skills/okr/SKILL.md +154 -0
  77. package/built-in-skills/persona/SKILL.md +81 -0
  78. package/built-in-skills/persona-generator/SKILL.md +296 -0
  79. package/built-in-skills/pkf-svg/SKILL.md +253 -0
  80. package/built-in-skills/pkf-writing/SKILL.md +236 -0
  81. package/built-in-skills/prismer-im-collab/SKILL.md +26 -6
  82. package/built-in-skills/proactivity/SKILL.md +84 -0
  83. package/built-in-skills/remotion/SKILL.md +431 -0
  84. package/built-in-skills/role-builder/SKILL.md +203 -0
  85. package/built-in-skills/role-builder/scripts/author-role.mjs +334 -0
  86. package/built-in-skills/role-builder/scripts/ingest-role.mjs +223 -0
  87. package/built-in-skills/role-builder/scripts/instantiate-and-run.mjs +290 -0
  88. package/built-in-skills/role-builder/scripts/operation-harness.mjs +267 -0
  89. package/built-in-skills/skill-authoring/SKILL.md +110 -100
  90. package/built-in-skills/skill-authoring/skill.json +3 -3
  91. package/built-in-skills/skill-builder/SKILL.md +171 -0
  92. package/built-in-skills/skill-builder/scripts/ingest.mjs +265 -0
  93. package/built-in-skills/skill-creator/SKILL.md +165 -423
  94. package/built-in-skills/skill-creator/references/external-library-import.md +110 -0
  95. package/built-in-skills/skill-creator/scripts/import-library.mjs +475 -0
  96. package/built-in-skills/slack-gif-creator/SKILL.md +20 -0
  97. package/built-in-skills/tasks/SKILL.md +38 -23
  98. package/built-in-skills/tdd/LICENSE +21 -0
  99. package/built-in-skills/tdd/SKILL.md +110 -0
  100. package/built-in-skills/tdd/mocking.md +59 -0
  101. package/built-in-skills/tdd/refactoring.md +10 -0
  102. package/built-in-skills/tdd/tests.md +61 -0
  103. package/built-in-skills/team/SKILL.md +2 -1
  104. package/built-in-skills/web-artifacts-builder/SKILL.md +1 -0
  105. package/built-in-skills/webapp-testing/SKILL.md +1 -0
  106. package/built-in-skills/wechat-pay/SKILL.md +59 -0
  107. package/dist/cli.cjs +71872 -19960
  108. package/dist/cli.js +71803 -19846
  109. package/dist/index.cjs +72010 -19966
  110. package/dist/index.d.cts +4258 -712
  111. package/dist/index.d.ts +4258 -712
  112. package/dist/index.js +72156 -20118
  113. package/package.json +37 -6
  114. package/plugins/memory/prismer/__init__.py +1211 -0
  115. package/plugins/memory/prismer/plugin.yaml +8 -0
  116. package/plugins/memory/prismer/tool-schemas.generated.json +249 -0
  117. package/plugins/tools/prismer-recall/__init__.py +282 -0
  118. package/plugins/tools/prismer-recall/plugin.yaml +15 -0
  119. package/built-in-skills/memory-curation/SKILL.md +0 -135
@@ -0,0 +1,214 @@
1
+ ---
2
+ name: release-rollback
3
+ description: Roll a release back for real when post-deploy regression goes red — apc release rollback flips the current version to pulled and the last good version back to current in the release ledger, and (with --mirror) repoints the bare mirror ref. Behind an approval gate; with no previous good version it BLOCKS instead of spinning green. green(0) applied · staged(3) plan awaiting approval · blocked(1) nothing to roll back to.
4
+ license: MIT
5
+ scope: coding
6
+ compatibility:
7
+ - claude-code
8
+ allowed-tools:
9
+ - Bash
10
+ metadata:
11
+ category: release
12
+ ---
13
+
14
+ # release-rollback
15
+
16
+ 上线后回归红时的**真回滚**(`apc/01` §2 release-rollback,收口步 10)。它落两个真副作用:
17
+
18
+ 1. **release 账本回退**:把当前 `current` 版本翻 `pulled`、上一好版本翻回 `current`(真写 JSON ledger,可读回核验)。
19
+ 2. **版本指针回退**(给了 `--mirror`):把 bare mirror 的 `refs/heads/release-current` 重指到上一好 tag 的 commit(真 git 副作用,`git ls-remote` 可核验)。
20
+
21
+ **什么时候用**:`release-verify`(部署后回归)红了,需要把 fleet 退回上一个好版本。回滚后应建 bug task 回 bugfix 入口。
22
+
23
+ ## 承重纪律(发版 skill 的命根子,先记死)
24
+
25
+ - **审批门不可跳**。未审批 = `staged`(出回滚计划 dry-run,不执行)。本机替身以 `--approved <token>` 非空为门(真 approvalId 服务端校验 = M5)。审批人看到的是**回滚计划**(from→to 版本 + 影响面),不是"agent 说要回滚了"。
26
+ - **无上一好版本 → `blocked`,绝不空转返绿**。账本只有一条、或更早的都已 `pulled` ⇒ 无从回滚 ⇒ blocked(exit 1)。这是本 verb 的**负控注入点**:一个"回滚"skill 若在没东西可回滚时也返绿,就是开卷考试。
27
+ - **prod 不做**。本 skill 是 test 环境的回滚;prod 回滚走人 + M5 路径。
28
+
29
+ ## Anti-pattern(直接判红)
30
+
31
+ - ❌ **无上一好版本时硬造一个"回滚成功"**。planRollback `ok:false` 就是 blocked,别放松。
32
+ - ❌ **拿到 `staged`(计划)就以为已回滚**。staged 是"等审批",账本还没改。
33
+ - ❌ **手工改 ledger JSON / `git update-ref`** 绕过 verb 的审批门和 plan 计算。
34
+
35
+ ## 工具契约(签名以此为准)
36
+
37
+ > `apc` **不在 PATH**——在仓库根用 `npx tsx sdk/apc/bin/apc.ts <sub>`。
38
+
39
+ | 命令 | 作用 | 退出码 |
40
+ | --- | --- | --- |
41
+ | `npx tsx sdk/apc/bin/apc.ts release rollback [--ledger <path>] [--mirror <bare>] [--approved <token>] [--json]` | 算回滚计划 → 审批门 → 写账本回退(+ 可选 mirror ref 重指) | `0` green(applied)· `3` staged(计划待审批)· `1` blocked(无上一好版本) |
42
+
43
+ `--json` 字段(**名以此为准**):
44
+
45
+ - 顶层:`{ verb:'rollback', decision, ledgerPath, plan, approved, applied, mirrorRepointed, blockers:[], notes:[] }`
46
+ - `plan`:`{ ok:true, from:{version,tag,status}, to:{version,tag,status}, next:[...] }` **或** `{ ok:false, reason }`
47
+ - ledger 条目形状:`{ version, tag, status:'current'|'pulled'|'superseded', ts }`(`current` 唯一)
48
+
49
+ ## Workflow
50
+
51
+ ### 1. 备好 release 账本(本机替身)
52
+
53
+ 账本记录发过的版本序列,当前版本 `status:'current'`。本机替身用一份 JSON(真 release-status 行的替身):
54
+
55
+ ```bash
56
+ cat > /tmp/apc-rollback-ledger.json <<'JSON'
57
+ [
58
+ { "version": "2.0.5", "tag": "k8s-test-20260720-v2.0.5", "status": "superseded", "ts": "2026-07-20T00:00:00Z" },
59
+ { "version": "2.0.6", "tag": "k8s-test-20260722-v2.0.6", "status": "superseded", "ts": "2026-07-22T00:00:00Z" },
60
+ { "version": "2.0.7", "tag": "k8s-test-20260724-v2.0.7", "status": "current", "ts": "2026-07-24T00:00:00Z" }
61
+ ]
62
+ JSON
63
+ ```
64
+
65
+ ### 2. dry-run:出回滚计划(不带 `--approved`)
66
+
67
+ ```bash
68
+ npx tsx sdk/apc/bin/apc.ts release rollback --ledger /tmp/apc-rollback-ledger.json --json > /tmp/rb-dry.json; R=$?
69
+ echo "rollback(dry) exit=$R"
70
+ # 预期:decision=staged (exit 3),plan.ok=true,plan.from=2.0.7 → plan.to=2.0.6
71
+ ```
72
+
73
+ ### 3. 审批后执行(带 `--approved`)—— 真写账本
74
+
75
+ ```bash
76
+ npx tsx sdk/apc/bin/apc.ts release rollback --ledger /tmp/apc-rollback-ledger.json --approved "$APPROVAL_TOKEN" --json > /tmp/rb.json; R=$?
77
+ echo "rollback(apply) exit=$R"
78
+ # 预期:decision=green (exit 0),applied=true;读回 ledger:2.0.7→pulled,2.0.6→current
79
+ ```
80
+
81
+ 给了 `--mirror <bare>` 还会把 `refs/heads/release-current` 重指到 `to.tag`(`git ls-remote` 可核)。
82
+
83
+ ### 4. 负控:无上一好版本 → blocked
84
+
85
+ ```bash
86
+ echo '[{"version":"2.0.7","tag":"k8s-test-20260724-v2.0.7","status":"current","ts":"2026-07-24T00:00:00Z"}]' > /tmp/rb-single.json
87
+ npx tsx sdk/apc/bin/apc.ts release rollback --ledger /tmp/rb-single.json --json; echo "single exit=$?"
88
+ # 预期:decision=blocked (exit 1),plan.ok=false,reason="无上一好版本可回退"
89
+ ```
90
+
91
+ ## Failure / 边界
92
+
93
+ - 账本无 `current` / 无上一好版本 → `blocked`(真拒,非空转)。
94
+ - 本机替身:账本 = 本地 JSON(站位真 release-status 行);mirror ref = bare 替身;审批 = `--approved` 非空。真 OTA `action:'rollback'`/`pulled` + 真 manifest 指针回退 + 服务端 approvalId = M5。
95
+ - 回滚后建 bug task 回 bugfix 入口——真 task 创建 = M5 / S10 observability(本 skill 只在 `notes` 提示)。
96
+
97
+ ## 输出契约(机器判据按这个复算,别自由发挥格式)
98
+
99
+ 本 skill 的判据**不是**「报告里出现了 `pulled` / `current` 这些字」,而是:**重解析你贴的三份 `--json` 产物**、**从 `decision` 反推退出码**、并把 apply 产物的 `plan.next` 与**磁盘上那份账本文件逐字段深比**(`json-claim` 的 `fileEquals` + `freshArtifacts`)。
100
+
101
+ **路径是钉死的**(判据要回读它):
102
+
103
+ ```bash
104
+ mkdir -p .e2e-tmp/apc-release-rollback
105
+ # 三条账本:2.0.5/2.0.6 superseded、2.0.7 current
106
+ $EDITOR .e2e-tmp/apc-release-rollback/ledger.json
107
+ # 负控用另一份,单条 current
108
+ $EDITOR .e2e-tmp/apc-release-rollback/ledger-single.json
109
+ ```
110
+
111
+ 报告必须带这组行 + **三份原样 JSON**(dry-run → apply → 负控):
112
+
113
+ ```
114
+ RUN-AT: <apply 那次运行的 ISO-8601 墙钟时间>
115
+ PLAN-FROM: 2.0.7
116
+ PLAN-TO: 2.0.6
117
+ STAGED-APPLIED: false
118
+ STAGED-EXIT: 3
119
+ APPLIED: true
120
+ ROLLED-TO: 2.0.6
121
+ APPLY-EXIT: 0
122
+ NEG-DECISION: blocked
123
+ NEG-PLAN-OK: false
124
+ NEG-EXIT: 1
125
+ ```
126
+
127
+ 判据会判红的情况(任一):
128
+
129
+ - 没有可解析的 fenced JSON;
130
+ - 任一 `*-EXIT` 不是从对应 `decision` 推出来的(green→0 · staged→3 · blocked→1);
131
+ - dry-run 产物 `approved:false` 却 `applied:true`——**审批门被跳**;
132
+ - **apply 产物的 `plan.next` 与 `.e2e-tmp/apc-release-rollback/ledger.json` 磁盘内容不深等**——`applied:true` 而账本没翻,就是宣称了一个没发生的副作用;
133
+ - `RUN-AT` 与那份账本文件的 mtime 差超过 20 分钟——**拿上一次 apply 的旧账本冒充这次**;
134
+ - 负控产物不是 `plan.ok:false` + `blocked` + `applied:false` + `mirrorRepointed:false` + 有 `plan.reason`——**没有上一好版本时必须红,不许空转返绿**。
135
+
136
+ > ⚠️ **别重复 apply**:第 3 步之后再跑一次 apply 会把账本二次翻转,你贴的产物就不再等于磁盘上的账本,判据会红——这不是判据的毛病,是「报告描述的那次写入已经被后一次覆盖」的如实结论。负控**必须**用另一份 `ledger-single.json`。
137
+
138
+ **诚实边界**:判据能证明「账本现在正是产物声称写成的样子、且写入时间与你声明的运行同期」,**不能**证明这次写入是 verb 干的而不是你手工 `cat >` 出来的——没有哪个本地产物是不可伪造的。它杀的是廉价伪造(编计划、叙述已 apply、拿旧账本顶包)。真 release 状态行(服务端账本)落地 = M5。
139
+
140
+ ## 产出(副作用 oracle,报告里必须给)
141
+
142
+ 1. **decision + 真退出码**:`green`/`staged`/`blocked` ⇄ `0`/`3`/`1`。
143
+ 2. **回滚计划**:`plan.from.version → plan.to.version`(ok:true 时),或 `plan.reason`(ok:false)。
144
+ 3. **账本真副作用**(green 时):读回 ledger 确认 `current`→`pulled`、上一好版本→`current`;不是聊天里说"已回滚"。
145
+ 4. **负控证据**:单条账本 → `blocked` + `plan.ok:false` + reason,**证明没东西可回滚时它会红**。
146
+ 5. **mirror 重指**(给了 `--mirror`):`mirrorRepointed:true` + `git ls-remote` 核验 `release-current` 指向 `to.tag`。
147
+
148
+ **不许**:无上一好版本时硬返绿;把 staged 计划当已回滚;手改 ledger/ref 绕审批。
149
+
150
+ ## Checklist
151
+
152
+ - [ ] dry-run 拿到 plan(from→to)+ staged,再带 `--approved` 执行
153
+ - [ ] green 后读回 ledger 确认 current→pulled、上一好版本→current
154
+ - [ ] 跑了单条账本负控,确认 blocked + plan.ok:false(回滚 skill 的命根子)
155
+ - [ ] 给了 `--mirror` 时用 `git ls-remote` 核验 release-current 重指
156
+
157
+ ## 审批门(doc03 §1)
158
+
159
+ 本 skill 收口 doc03 §1 审批点 **「回滚」**(release-rollback 执行前)。dry-run 出计划,**真回滚前必须建人审批并停手**:
160
+
161
+ 1. **出示 dry-run 证据**(审批人看到的):回滚目标版本(`plan.from.version → plan.to.version`)+ 影响面(`plan.next[]`,01 §2)。无上一好版本 → `blocked`(`plan.ok:false`),无审批可建。
162
+ 2. **建真 cloud 审批**(真路径 = `human-approval` built-in skill 的 CLI)——把上面证据装进请求:
163
+
164
+ ```bash
165
+ cloud approval request-human --task-id "$PRISMER_TASK_ID" \
166
+ --action "回滚 <plan.from.version> → <plan.to.version>(test)" \
167
+ --context "部署后回归红;回滚计划 from→to + 影响面见 dry-run 回执" \
168
+ --risk "OTA 账本翻 pulled/current + manifest 指针回退;回滚后建 bug task 回 bugfix 入口"
169
+ ```
170
+
171
+ 返回 `approvalId`;**建完即停手本轮**(human-approval 铁律:平台在人裁决后重派)。
172
+ 3. **block**:未 approve 前 `staged`(exit 3),账本不改;无上一好版本 → `blocked`(负控注入点,绝不空转返绿)。
173
+ 4. **post-approval = M5 real-remote**:真 OTA `action:'rollback'`/`pulled` + 真 manifest 指针回退 + 服务端校验 `approvalId`,属 **M5 real-remote**,本机替身(本地 JSON ledger + bare mirror)不触真远端、不冒充已回滚。
174
+
175
+ ## PKF 直写(研发回环 · doc07 §B2 写入点①)
176
+
177
+ **产出时机**:回滚收口(green/staged/blocked)后,把这次回滚的结论**直写成一张 PKF 记忆页**(pageType=`decision`,ReleaseCard 语义 apc/09 §1)——同一页既是回审批人侧的富报告,也是可召回的事故/发版记录。回滚后的事故根因复盘另走 memory skill 的 CONSTRUCT→PLACE→WRITE,两条边并存(doc07 §B1)。这条直写是账本真副作用之外的一次投影。
178
+
179
+ **语法照 `pkf-writing` skill**——本 skill 不再内嵌语法骨架(frontmatter / typed link / 数据块写法都在那边)。写入面**不新造**:code agent 走 `prismer memory write`(SS-14 §4.3 appendix;hermes 侧是 native `memory_write`)。
180
+
181
+ **声明**(doc10 §2.5 格式,报告末尾一行):
182
+
183
+ ```
184
+ PKF: prismer://workspace/<ws>/memory/<path>
185
+ ```
186
+
187
+ 写入面不可达时如实声明 `PKF: none — 写入面不可达(<哪一条>)`,**绝不允许**为了满足规则而假装写了。
188
+
189
+ **回读**:声明后必须回读该页(`pkf_read` / memory read),确认**真实存在、正文非空**且与结论一致(回滚天然带 `contradicts`——指向被 `pulled` 版本当初的发版决策页;无上一好版本(blocked)时如实写 `plan.ok=false` 与 reason,**绝不**在页里粉饰成"已回滚");typed link 的 `prismer://` 目标必须**真实存在**(validator 规则 2c/4 挡 `invalid-prismer-host`),无对应页就删该 link 行、宁缺勿造伪目标;写入自动挂 INDEX 反孤儿锚(SS-14 §4.2),优先 edit 既有页而非 dump 新叶(PLACE 治理照走)。
190
+
191
+ <!-- APC-ACK:v1 -->
192
+
193
+ ## 调用回执(APC 平台方运营纪律 · 自动注入,勿手改)
194
+
195
+ 执行本 skill 的**第一步**,先落一条调用回执:
196
+
197
+ ```bash
198
+ cloud skill ack release-rollback --task "$PRISMER_TASK_ID"
199
+ ```
200
+
201
+ **按退出码分流**(这条命令的退出码是承重信息,禁止用 `||` 兜底、`; true`、
202
+ `set +e` 或重定向把它抹掉):
203
+
204
+ | exit | 含义 | 你要做的 |
205
+ | --- | --- | --- |
206
+ | `0` | 回执已落库(`im_task_logs.action='skill_ack'`) | 继续执行本 skill |
207
+ | `3` | **无 task 上下文**——本次运行没有 task,产不出回执 | 继续执行本 skill;但本次运行**没有回执**,任何报告里都不得声称已 ack |
208
+ | `4` | 你不是该 task 的 assignee,服务端拒绝 | 停下并上报:回执只能由执行该 task 的 agent 产生 |
209
+ | `1` | 其它失败(网络 / 服务端) | 重试一次;仍失败则继续执行,并在结果里显式标注「回执缺失」 |
210
+
211
+ 回执只证明本 skill **被调度**,不证明**执行正确**——效果证明由本 skill 自己的
212
+ acceptanceCriteria 副作用断言承担(apc/04 §2 层 1 诚实标注)。
213
+
214
+ <!-- /APC-ACK:v1 -->
@@ -0,0 +1,230 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "slug": "release-rollback",
4
+ "name": "Release Rollback",
5
+ "description": "Roll a release back for real: apc release rollback flips the current version to pulled and the last good version back to current in the release ledger, and (with --mirror) repoints the bare mirror ref. Behind an approval gate; with no previous good version it BLOCKS instead of spinning green. green(0)/staged(3)/blocked(1).",
6
+ "category": "release",
7
+ "version": "1.0.0",
8
+ "license": "MIT",
9
+ "compatibility": ["claude-code"],
10
+ "runtime": {
11
+ "kind": "text-workflow",
12
+ "requires": {
13
+ "env": [],
14
+ "bins": ["cloud"],
15
+ "capabilities": []
16
+ }
17
+ },
18
+ "sampleTasks": [
19
+ {
20
+ "title": "Dry-run a rollback plan, apply it after approval, read the ledger back, and prove the no-good-version block",
21
+ "prompt": "Roll a release back using the local substitute ledger, prove the approval gate, and prove the negative control. The `apc` CLI is NOT on PATH — invoke it as `npx tsx sdk/apc/bin/apc.ts <subcommand>` from the repo root (its --json stdout is pure JSON). Use the PINNED paths below — the ledger is read back off disk by the criteria, so a different path scores red. Steps: (1) SEED — write `.e2e-tmp/apc-release-rollback/ledger.json` with three entries where 2.0.5/2.0.6 are status superseded and 2.0.7 is status current (each entry has version, tag, status, ts). (2) DRY-RUN — run `npx tsx sdk/apc/bin/apc.ts release rollback --ledger <abs>/.e2e-tmp/apc-release-rollback/ledger.json --json` WITHOUT --approved; confirm decision=staged (exit 3), applied=false and read plan.from.version → plan.to.version (2.0.7 → 2.0.6). (3) APPLY — rerun WITH `--approved local-token`; confirm decision=green (exit 0) and applied=true, then READ THE LEDGER BACK off disk (`cat`) and confirm 2.0.7 is now pulled and 2.0.6 is now current — the ledger file, not the chat message, is the oracle. (4) NEGATIVE CONTROL — write a SEPARATE single-entry ledger at `.e2e-tmp/apc-release-rollback/ledger-single.json` with only 2.0.7 status current, run rollback against it, and confirm decision=blocked (exit 1) with plan.ok=false and a reason like 'no previous good version' — this proves rollback goes red when there is nothing to roll back to. Do NOT run the apply against the single-entry ledger, and do NOT re-run the apply after step 3 (it would flip the ledger a second time and the read-back would no longer match the product you pasted).\n\n--- YOUR REPORT MUST USE THIS MACHINE-CHECKED OUTPUT CONTRACT. All three products are re-parsed, the exit code is re-derived from `decision`, and `plan.next` is compared FIELD BY FIELD against the ledger file that is actually on disk. Narrating an applied rollback that the file does not hold FAILS:\n\n```\nRUN-AT: <ISO-8601 wall time of the APPLY run, e.g. 2026-07-25T23:32:11.000Z>\nPLAN-FROM: 2.0.7\nPLAN-TO: 2.0.6\nSTAGED-APPLIED: false\nSTAGED-EXIT: 3\nAPPLIED: true\nROLLED-TO: 2.0.6\nAPPLY-EXIT: 0\nNEG-DECISION: blocked\nNEG-PLAN-OK: false\nNEG-EXIT: 1\n```\n\nfollowed by the THREE raw `--json` products, each verbatim in its own fenced json block (dry-run, apply, negative control).\n\nHARD RULES: paste each product UNEDITED. `STAGED-EXIT`/`APPLY-EXIT`/`NEG-EXIT` are a pure function of `decision` (green→0, staged→3, blocked→1). The apply product's `plan.next` must DEEP-EQUAL `.e2e-tmp/apc-release-rollback/ledger.json` as it sits on disk right now, and `RUN-AT` must sit next to that file's mtime — an `applied:true` whose ledger never flipped, or a stale ledger from an earlier run, is red.",
22
+ "expectedArtifacts": [
23
+ "three raw `apc release rollback --json` products (dry-run / apply / negative control) pasted verbatim",
24
+ "`PLAN-FROM`/`PLAN-TO`/`APPLIED`/`ROLLED-TO` equal to the products' fields, and every `*-EXIT` derived from its decision",
25
+ "ledger read-back: `plan.next` deep-equals `.e2e-tmp/apc-release-rollback/ledger.json` on disk (current→pulled, last-good→current)",
26
+ "`RUN-AT` contemporaneous with that ledger file's mtime — the write really happened at that moment",
27
+ "negative control: single-entry ledger → decision=blocked + plan.ok=false + a real reason + applied=false"
28
+ ],
29
+ "acceptanceCriteria": [
30
+ {
31
+ "label": "the approval gate is real: unapproved is staged(3) with applied=false and a well-formed plan (from→to) — an unapproved rollback may not touch the ledger",
32
+ "type": "structured",
33
+ "checker": "json-claim",
34
+ "args": {
35
+ "equals": {
36
+ "decision": "staged",
37
+ "verb": "rollback",
38
+ "applied": false,
39
+ "approved": false,
40
+ "plan.ok": true
41
+ },
42
+ "require": ["plan.from.version", "plan.to.version", "plan.next", "ledgerPath"],
43
+ "types": {
44
+ "plan.next": "array"
45
+ },
46
+ "declaredLines": {
47
+ "PLAN-FROM": "plan.from.version",
48
+ "PLAN-TO": "plan.to.version",
49
+ "STAGED-APPLIED": "applied"
50
+ },
51
+ "derivedLines": {
52
+ "STAGED-EXIT": {
53
+ "from": "decision",
54
+ "map": {
55
+ "green": "0",
56
+ "staged": "3",
57
+ "blocked": "1"
58
+ }
59
+ }
60
+ },
61
+ "implications": [
62
+ {
63
+ "if": {
64
+ "path": "approved",
65
+ "equals": false
66
+ },
67
+ "then": {
68
+ "path": "applied",
69
+ "equals": false
70
+ }
71
+ },
72
+ {
73
+ "if": {
74
+ "path": "decision",
75
+ "equals": "staged"
76
+ },
77
+ "then": {
78
+ "path": "blockers",
79
+ "empty": true
80
+ }
81
+ }
82
+ ]
83
+ },
84
+ "match": "<structured:json-claim:staged>",
85
+ "required": true
86
+ },
87
+ {
88
+ "label": "the apply really landed: the approved product says applied=true AND its plan.next deep-equals the release ledger as it sits on disk (2.0.7→pulled, 2.0.6→current), with the file written at the moment the run claims",
89
+ "type": "structured",
90
+ "checker": "json-claim",
91
+ "args": {
92
+ "equals": {
93
+ "decision": "green",
94
+ "verb": "rollback",
95
+ "applied": true,
96
+ "approved": true,
97
+ "plan.ok": true
98
+ },
99
+ "require": ["plan.next", "plan.to.version", "ledgerPath"],
100
+ "types": {
101
+ "plan.next": "array"
102
+ },
103
+ "declaredLines": {
104
+ "APPLIED": "applied",
105
+ "ROLLED-TO": "plan.to.version"
106
+ },
107
+ "derivedLines": {
108
+ "APPLY-EXIT": {
109
+ "from": "decision",
110
+ "map": {
111
+ "green": "0",
112
+ "staged": "3",
113
+ "blocked": "1"
114
+ }
115
+ }
116
+ },
117
+ "implications": [
118
+ {
119
+ "if": {
120
+ "path": "decision",
121
+ "equals": "green"
122
+ },
123
+ "then": {
124
+ "path": "blockers",
125
+ "empty": true
126
+ }
127
+ }
128
+ ],
129
+ "fileEquals": {
130
+ "plan.next": {
131
+ "file": ".e2e-tmp/apc-release-rollback/ledger.json",
132
+ "json": true
133
+ }
134
+ },
135
+ "freshArtifacts": {
136
+ "timestampLine": "RUN-AT",
137
+ "paths": [".e2e-tmp/apc-release-rollback/ledger.json"],
138
+ "skewMinutes": 20
139
+ }
140
+ },
141
+ "match": "<structured:json-claim:applied>",
142
+ "required": true
143
+ },
144
+ {
145
+ "label": "the negative control really fired: a ledger with no previous good version yields plan.ok=false + blocked + applied=false + a stated reason — rollback goes red instead of spinning green",
146
+ "type": "structured",
147
+ "checker": "json-claim",
148
+ "args": {
149
+ "equals": {
150
+ "plan.ok": false,
151
+ "verb": "rollback",
152
+ "decision": "blocked",
153
+ "applied": false
154
+ },
155
+ "require": ["plan.reason", "blockers", "ledgerPath"],
156
+ "types": {
157
+ "plan.reason": "string",
158
+ "blockers": "array"
159
+ },
160
+ "declaredLines": {
161
+ "NEG-DECISION": "decision",
162
+ "NEG-PLAN-OK": "plan.ok"
163
+ },
164
+ "derivedLines": {
165
+ "NEG-EXIT": {
166
+ "from": "decision",
167
+ "map": {
168
+ "green": "0",
169
+ "staged": "3",
170
+ "blocked": "1"
171
+ }
172
+ }
173
+ },
174
+ "implications": [
175
+ {
176
+ "if": {
177
+ "path": "plan.ok",
178
+ "equals": false
179
+ },
180
+ "then": {
181
+ "path": "applied",
182
+ "equals": false
183
+ }
184
+ },
185
+ {
186
+ "if": {
187
+ "path": "plan.ok",
188
+ "equals": false
189
+ },
190
+ "then": {
191
+ "path": "blockers",
192
+ "nonEmpty": true
193
+ }
194
+ },
195
+ {
196
+ "if": {
197
+ "path": "plan.ok",
198
+ "equals": false
199
+ },
200
+ "then": {
201
+ "path": "mirrorRepointed",
202
+ "equals": false
203
+ }
204
+ }
205
+ ]
206
+ },
207
+ "match": "<structured:json-claim:negative-control>",
208
+ "required": true
209
+ }
210
+ ]
211
+ }
212
+ ],
213
+ "security": {
214
+ "dataAccess": ["local-filesystem", "git-remote"],
215
+ "humanApprovalRequiredFor": [
216
+ "applying a rollback (approval gate; local substitute is --approved token, real approvalId = M5)"
217
+ ]
218
+ },
219
+ "provenance": {
220
+ "sourceKind": "inline-spec",
221
+ "sourceRefs": [
222
+ "docs/apc/01-release-control-plane.md",
223
+ "docs/apc/05-devchain-gaps-and-skills.md",
224
+ "sdk/apc/cli/release-rollback.ts",
225
+ "sdk/apc/cli/release-common.ts"
226
+ ],
227
+ "authoredBy": "prismer-platform",
228
+ "authoredAt": "2026-07-24T00:00:00Z"
229
+ }
230
+ }
@@ -0,0 +1,194 @@
1
+ ---
2
+ name: release-tag
3
+ description: Cut a release tag behind a real tier gate and cloud approval readback. The approval, task, approved commit, and resulting tag are bound; self-approval and HEAD drift fail closed. Prod prefixes remain refused.
4
+ license: MIT
5
+ scope: coding
6
+ compatibility:
7
+ - claude-code
8
+ allowed-tools:
9
+ - Bash
10
+ metadata:
11
+ category: release
12
+ ---
13
+
14
+ # release-tag
15
+
16
+ 发版打 tag(`apc/01` §2 release-tag,收口步 6)。它把**测试→上线的焊点**焊死:**没有 tier 全绿 / baseline 无新红的结构化证据,审批请求根本不创建、tag 绝不 push**。tier 门跑真 `run.ts` 读真退出码;tag 名按 `<channel>-<target>-YYYYMMDD-vX.Y.Z` 算;审批通过后 `git tag && push` 到**本地 bare mirror 替身**(真 GitLab push + pipeline 轮询 = M5)。
17
+
18
+ **什么时候用**:`release-preflight` 绿 + `release-db-config-sync` 无阻塞之后,要把一个 test 版本推上 CI。
19
+
20
+ ## 承重纪律(发版 skill 的命根子,先记死)
21
+
22
+ - **prod 前缀 tag 必拒**(不变量 2 · 两人闸)。四个映射 `APP_ENV=prod` 的前缀——`k8s-prod-*` / `desktop-prod-*` / `prod-*` / `ali-k8s-prod-*`——**先于一切 git / tier 动作硬拒**,本 verb 不做任何 git 动作。**别试 prod**:真 prod 红线由 GitLab protected tags(P-1,运维配置)落地,本 skill 只护到"不替你打 prod tag"。要发 prod = 人走 M5 路径。
23
+ - **`--tier` 必须显式传,没有默认值**。`TD`(桌面冒烟)在 `apps/desktop/e2e/smoke/` 无 spec 时会自动 `skipped-with-note`(`passed:0/failed:0`),单独拿它当发版门是一道**不可能红**的空门——之前 SKILL 范例全不带 `--tier` 让 agent 照抄默认值正是这么踩的坑(`apc/12` §0.12)。**选一个会真执行断言的层**,例如 `--tier=T0,T1`;prod 前缀路径(下方触发)例外——它先于 tier 门拒绝,不需要 `--tier`。
24
+ - **tier 绿是 push 的硬前置,"绿"必须是真跑过用例**。tier 红 / `env_blocked` / **空跑**(该轮所有 tier 的 `passed+failed` 合计为 0,即一个用例都没真执行)⇒ `blocked`,审批请求不创建、tag 不 push。**不许**放松 tier、挑能绿的层、或拿一个恰好全 skip 的层骗过门。
25
+ - **审批门不可跳**。tier 绿但未审批 = `staged`(dry-run:出 tag + tier 证据,不 push)。批准路径必须同时传 `--task <taskId> --approved <approvalId>`;CLI 从 cloud 读回批件和 task,校验 `approved` / `release_tag` / task 绑定 / 非自批,且两者 metadata 的 commit SHA 必须一致。随机 token 不再能放行。
26
+ - **tag 打获批 commit,不打 HEAD**。并行工作使 HEAD 漂移也不得把未审内容带入 tag;获批 SHA 不在 repo 则 fail-closed。
27
+
28
+ ## Anti-pattern(直接判红)
29
+
30
+ - ❌ **给 `--target prod` 或手拼 prod 前缀 tag** 想让 skill 打 prod。命中即 blocked,别绕。
31
+ - ❌ **tier `blocked` 时先打 tag 再补测试**。焊点就是不让这发生。
32
+ - ❌ **拿到 `staged` 就以为发版完成**。staged 是"等审批",tag 还没 push。
33
+ - ❌ **用 `git tag` + 裸 `git push origin`** 手工绕过本 verb,跳过 tier 门和审批门。
34
+
35
+ ## 工具契约(签名以此为准)
36
+
37
+ > `apc` **不在 PATH**——在仓库根用 `npx tsx sdk/apc/bin/apc.ts <sub>`。
38
+
39
+ | 命令 | 作用 | 退出码 |
40
+ | --- | --- | --- |
41
+ | `npx tsx sdk/apc/bin/apc.ts release tag [--channel k8s\|desktop] [--target test\|prod] [--version X.Y.Z] --tier=<tiers> [--task <taskId> --approved <approvalId>] [--json]` | prod 人闸 → tier 门 → cloud 批件/task/commit 他证 → 把获批 SHA push 到本地 bare mirror | `0` green(pushed)· `3` staged(tier 绿待审批)· `1` blocked(tier 红 / 他证失败 / prod 拒 / push 失败)· `2` 用法错 |
42
+
43
+ `--tier` **没有默认值**(`--target prod` 路径除外——它先于 tier 门拒绝);不传直接 usage 错 exit 2。选一个会真执行断言的层,例如 `--tier=T0,T1`——**别用 `--tier=TD`** 当唯一层:无桌面冒烟 spec 时它是空门。
44
+
45
+ `--json` 字段(**名以此为准**):
46
+
47
+ - 顶层:`{ verb:'tag', decision, tag, target, channel, tier, approved, approvalId, taskId, commitSha, pushed, mirror, blockers:[], notes:[] }`
48
+ - `tag`:算出的 tag 名(如 `k8s-test-20260724-v2.0.7`);`--version` 缺省读 `/VERSION`
49
+ - `tier`:`{ tier, exitCode, envBlocked, regressions, emptyRun }`(prod 拒时 `exitCode:-1`,因为压根没跑到 tier;`emptyRun:true` = 该轮所有 tier 的 `passed+failed` 合计为 0,一个用例都没真跑,即便 `exitCode` 是 0 也判 `blocked`)
50
+ - `mirror`:push 目标(默认 `.dev-stack/apc-bare-origin.git` bare 替身)
51
+
52
+ ## Workflow
53
+
54
+ ### 1. dry-run:算 tag + 过 tier 门(不带 `--approved`)
55
+
56
+ ```bash
57
+ npx tsx sdk/apc/bin/apc.ts release tag --channel k8s --target test --tier=T0,T1 --json > /tmp/tag-dry.json; T=$?
58
+ echo "tag(dry) exit=$T"
59
+ ```
60
+
61
+ - `decision:staged`(exit 3)+ tier 绿 → 拿到 `tag` 名,进审批。
62
+ - `decision:blocked`(exit 1)→ 读 `tier`/`blockers`;tier 红 / 空跑(`tier.emptyRun:true`)就停手回 bugfix,别往下走。
63
+ - 忘了 `--tier` → exit 2 用法错,不是"用了默认 TD"——没有默认值。
64
+
65
+ ### 2. 审批后 push(cloud 批件 + task 绑定)
66
+
67
+ ```bash
68
+ # approval 必须是 cloud 中已被另一个人批准的 release_tag 记录,并且与 task 携带同一 commit SHA
69
+ npx tsx sdk/apc/bin/apc.ts release tag --channel k8s --target test --tier=T0,T1 \
70
+ --task "$PRISMER_TASK_ID" --approved "$APPROVAL_ID" --json > /tmp/tag.json; T=$?
71
+ echo "tag(push) exit=$T"
72
+ ```
73
+
74
+ - `decision:green`(exit 0)+ `approved:true` + `pushed:true` → tag 已落 bare mirror;必须用 `git rev-parse refs/tags/<tag>^{commit}` 核验结果等于产物的 `commitSha`。
75
+
76
+ ### 3. prod 一律拒(验证人闸,不是要发 prod)
77
+
78
+ ```bash
79
+ npx tsx sdk/apc/bin/apc.ts release tag --channel k8s --target prod --json; echo "prod exit=$?"
80
+ # 预期:decision=blocked, exit 1, blockers 含 "prod 人闸",无任何 git 动作
81
+ # 注意:这条命令没带 --tier ——prod 人闸先于 tier 门开火,压根不需要它
82
+ ```
83
+
84
+ ## Failure / 边界
85
+
86
+ - push 失败(bare mirror 不存在 / git 错误)→ `blocked` + `blockers` 含真 git stderr。bare 替身由 `apc env up --safe` 拉起。
87
+ - 本机替身:push 只到 **本地 bare mirror**,**不推 GitLab**;cloud approval/task/commit 他证已是真路径。真 GitLab push + pipeline 轮询仍是 M5(诚实 ⬜)。
88
+
89
+ ## 输出契约(机器判据按这个复算,别自由发挥格式)
90
+
91
+ 本 skill 的判据**不是**「报告里出现了 `staged` / `prod` 这些字」,而是:**重解析你贴的三份 `--json` 产物**、**从 `decision` 反推退出码**、**用只读 git plumbing 回读 bare mirror 的 ref 库**、**用 tier 门自己写的副产物给这次运行定时**(`structured-criteria.ts` 的 `json-claim` + `git-claim-readback`)。
92
+
93
+ 先在**隔离沙箱**里搭演示(**绝不在共享工作树打 tag/push**):
94
+
95
+ ```bash
96
+ mkdir -p .e2e-tmp/apc-release-tag && git init -q --bare .e2e-tmp/apc-release-tag/mirror.git
97
+ mkdir -p .e2e-tmp/apc-release-tag/work && cd .e2e-tmp/apc-release-tag/work
98
+ git init -q -b main && echo demo > f.txt && git add f.txt && git commit -qm init
99
+ git remote add mirror "$REPO/.e2e-tmp/apc-release-tag/mirror.git"
100
+ ```
101
+
102
+ > `--repo` / `--mirror` **必须传绝对路径**——verb 内部会把相对 `--repo` 再解析一次(`git -C <rel>` 又在 `cwd=<rel>` 下跑),相对路径必失败。
103
+
104
+ 报告必须带下面这组行 + **三份原样 JSON**:
105
+
106
+ ```
107
+ RUN-AT: <审批那次运行的 ISO-8601 墙钟时间>
108
+ STAGED-TAG: <dry-run 产物的 tag>
109
+ STAGED-PUSHED: false
110
+ STAGED-EXIT: 3
111
+ TAG-NAME: <审批产物的 tag>
112
+ TIER-EXIT: 0
113
+ TAG-EXIT: 0
114
+ PROD-TAG: <verb 算出并拒掉的 k8s-prod-… tag>
115
+ PROD-DECISION: blocked
116
+ GIT-REPO: .e2e-tmp/apc-release-tag/work
117
+ GIT-TAG: <tag> | remote: mirror | sha: <该 tag 在 mirror 上解析出的 commit sha>
118
+ GIT-REFUSED-TAG: <k8s-prod-… tag> | remote: mirror
119
+ ```
120
+
121
+ 紧跟着把三次 `--json` 的 stdout **一字不改**贴进三个 fenced json 块(dry-run → 审批 → prod)。
122
+
123
+ 判据会判红的情况(任一):
124
+
125
+ - 没有可解析的 fenced JSON(只有散文「tag 打好了」);
126
+ - `STAGED-EXIT` / `TAG-EXIT` 不是从 `decision` 推出来的那个(green→0 · staged→3 · blocked→1)——**退出码是 decision 的函数,不是措辞**;
127
+ - 审批产物 `decision:green` 却 `tier.exitCode != 0` / `tier.regressions` 非空 / `blockers` 非空——**tier 绿是 push 的硬前置**;
128
+ - dry-run 产物 `approved:false` 却 `pushed:true`——**审批门被跳**;
129
+ - prod 产物不是 `blocked` + `pushed:false` + `tier.exitCode:-1`——`-1` 表示**人闸先于 tier 门开火,压根没跑到测试**,写成 0 就等于承认跑过 tier,判红;
130
+ - **`GIT-TAG` 声明的 tag 不在 mirror 的 ref 库里**,或它解析出的 commit ≠ 你声明的 sha——「push 了」是 ref,不是句子。**未审批的 dry-run 不许声明 `GIT-TAG`**(它什么都没推);
131
+ - `GIT-TAG` 的 tag 名不匹配 `<channel>-test-YYYYMMDD-vX.Y.Z`,或它本身命中 prod 前缀;
132
+ - **`GIT-REFUSED-TAG` 竟然在 mirror 上**——那不是拒绝,是推上去了;
133
+ - `GIT-REPO` 不在 `.e2e-tmp/` 下,或指向打分器自己的工作树;
134
+ - `RUN-AT` 与 tier 门副产物 `scripts/test203/artifacts/desktop-shell-skip-evidence.txt` 的 mtime **差超过 20 分钟**——tier 门没真跑,磁盘上就没有这一刻的痕迹。
135
+
136
+ **诚实边界**:①`RUN-AT` 是**你声明**的墙钟时间,判据只能证明它与副产物 mtime 同期,**不能**证明它就是"现在"——它杀的是「拿几天前的旧产物冒充这次跑」,不是「重放一次一致的旧快照」。②tier 副产物路径是**按本 sample task 钉的 TD 层**,换 tier 必须同步换 args。③判据不证明 mirror 上那个 commit 的内容对,只证明 tag 真在、真指向你声明的 sha。
137
+
138
+ ## 产出(副作用 oracle,报告里必须给)
139
+
140
+ 1. **decision + 真退出码**:`green`/`staged`/`blocked` ⇄ `0`/`3`/`1`。
141
+ 2. **算出的 tag 名**:`<channel>-<target>-YYYYMMDD-vX.Y.Z` 全字打印。
142
+ 3. **tier 门证据**:`tier.exitCode` + regressions(tier 红时列出)——证明"没绿不 push"。
143
+ 4. **push 副作用**:green 时 `pushed:true` + mirror 路径(`git ls-remote` 可核验真 tag ref)。
144
+ 5. **prod 拒证据**:`--target prod` → `blocked` + exit 1 + "prod 人闸" blocker + **零 git 动作**(不是聊天里说"prod 不能发")。
145
+
146
+ **不许**:把 `staged` 当发版完成;试图打 prod tag;绕过 verb 手工 tag/push;tier 红仍 push。
147
+
148
+ ## Checklist
149
+
150
+ - [ ] 先 dry-run 拿到 tag 名 + tier 绿证据,再带 `--approved` push
151
+ - [ ] green 时确认 `pushed:true` + 记录 mirror;用 `git ls-remote` 复核 tag ref
152
+ - [ ] 演示 prod 前缀被拒(blocked/exit 1/零 git 动作),没试图绕
153
+ - [ ] tier 红 / env_blocked 时停手,没有放松 tier 或先 tag 后测
154
+
155
+ ## PKF 直写(研发回环 · doc07 §B2 写入点①)
156
+
157
+ **产出时机**:tag 收口(green/staged/blocked)后,把这次打 tag 的结论**直写成一张 PKF 记忆页**(pageType=`decision`,ReleaseCard 语义 apc/09 §1)——同一页既是回审批人侧的富报告,也是可召回的发版记录。经验教训另走 memory skill 的 CONSTRUCT→PLACE→WRITE,两条边并存(doc07 §B1)。这条直写是投影,不改 prod 人闸 / tier 门 / 审批门任何一步。
158
+
159
+ **语法照 `pkf-writing` skill**——本 skill 不再内嵌语法骨架(frontmatter / typed link / 数据块写法都在那边)。写入面**不新造**:code agent 走 `prismer memory write`(SS-14 §4.3 appendix;hermes 侧是 native `memory_write`)。
160
+
161
+ **声明**(doc10 §2.5 格式,报告末尾一行):
162
+
163
+ ```
164
+ PKF: prismer://workspace/<ws>/memory/<path>
165
+ ```
166
+
167
+ 写入面不可达时如实声明 `PKF: none — 写入面不可达(<哪一条>)`,**绝不允许**为了满足规则而假装写了。
168
+
169
+ **回读**:声明后必须回读该页(`pkf_read` / memory read),确认**真实存在、正文非空**且与结论一致;typed link 的 `prismer://` 目标必须**真实存在**(validator 规则 2c/4 挡 `invalid-prismer-host`),无对应页就删该 link 行、宁缺勿造伪目标;写入自动挂 INDEX 反孤儿锚(SS-14 §4.2),优先 edit 既有页而非 dump 新叶(PLACE 治理照走)。
170
+
171
+ <!-- APC-ACK:v1 -->
172
+
173
+ ## 调用回执(APC 平台方运营纪律 · 自动注入,勿手改)
174
+
175
+ 执行本 skill 的**第一步**,先落一条调用回执:
176
+
177
+ ```bash
178
+ cloud skill ack release-tag --task "$PRISMER_TASK_ID"
179
+ ```
180
+
181
+ **按退出码分流**(这条命令的退出码是承重信息,禁止用 `||` 兜底、`; true`、
182
+ `set +e` 或重定向把它抹掉):
183
+
184
+ | exit | 含义 | 你要做的 |
185
+ | --- | --- | --- |
186
+ | `0` | 回执已落库(`im_task_logs.action='skill_ack'`) | 继续执行本 skill |
187
+ | `3` | **无 task 上下文**——本次运行没有 task,产不出回执 | 继续执行本 skill;但本次运行**没有回执**,任何报告里都不得声称已 ack |
188
+ | `4` | 你不是该 task 的 assignee,服务端拒绝 | 停下并上报:回执只能由执行该 task 的 agent 产生 |
189
+ | `1` | 其它失败(网络 / 服务端) | 重试一次;仍失败则继续执行,并在结果里显式标注「回执缺失」 |
190
+
191
+ 回执只证明本 skill **被调度**,不证明**执行正确**——效果证明由本 skill 自己的
192
+ acceptanceCriteria 副作用断言承担(apc/04 §2 层 1 诚实标注)。
193
+
194
+ <!-- /APC-ACK:v1 -->