@adamchanadam/agent-handoff-kit 0.4.3 → 0.4.5

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.
package/README.en.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Your session relay baton.** Help the next AI conversation pick up your work: keep progress, key decisions, file locations and unfinished tasks.
6
6
 
7
- Code version covered: `v0.4.3`. This guide includes updates that have not been released yet. Features available to download depend on the published version.
7
+ Code version covered: `v0.4.5`. This guide includes updates that have not been released yet. Features available to download depend on the published version.
8
8
 
9
9
  [![Agent Handoff Kit introduction video](https://raw.githubusercontent.com/Adamchanadam/agent-handoff-kit/main/images/agent-handoff-kit-promo-30s.gif)](https://youtu.be/RopbfBiSw1I)
10
10
 
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Session 接力棒**。讓下一次 AI 對話接得上:保留進度、重要決定、文件位置和未完事項。
6
6
 
7
- 文件對應程式版本:`v0.4.3`。這份說明包含尚未發布的更新;正式下載可用的功能,以已發布版本為準。
7
+ 文件對應程式版本:`v0.4.5`。這份說明包含尚未發布的更新;正式下載可用的功能,以已發布版本為準。
8
8
 
9
9
  [![Agent Handoff Kit 宣傳動畫](https://raw.githubusercontent.com/Adamchanadam/agent-handoff-kit/main/images/agent-handoff-kit-promo-30s.gif)](https://youtu.be/RopbfBiSw1I)
10
10
 
@@ -786,7 +786,7 @@ function assessCloseoutDeclarations(text) {
786
786
  }
787
787
  for (const [id, label] of [["recommended-next-step-explicit", "recommended next step"], ["opening-message-matches-current-state", "opening message"]]) {
788
788
  const value = field(id);
789
- if (!isAffirmativeLifecycleFieldValue(value) || isUnresolvedLifecycleFieldValue(value)) {
789
+ if (!isAffirmativeLifecycleFieldValue(value) || isExplicitlyUnresolvedCloseoutFieldValue(value, id)) {
790
790
  findings.push(`Handoff: ${label} declaration is missing, negative or unverified; reconcile it before closeout.`);
791
791
  }
792
792
  }
@@ -1195,7 +1195,7 @@ function assessHandoffWorkspaceIdentity(handoffText, health) {
1195
1195
  findings.push(`Workspace: handoff Git root does not match live Git root ${health.gitRoot}`);
1196
1196
  }
1197
1197
 
1198
- const branchValue = workspaceFieldValue(section, "Branch");
1198
+ const { branchValue, commitValue } = workspaceBranchCommitValues(section);
1199
1199
  if (hasSubstantiveWorkspaceValue(branchValue)
1200
1200
  && !workspaceValueMeansNoGit(branchValue)
1201
1201
  && health.branch !== "unverified"
@@ -1204,7 +1204,6 @@ function assessHandoffWorkspaceIdentity(handoffText, health) {
1204
1204
  findings.push(`Workspace: handoff branch does not match live branch ${health.branch}`);
1205
1205
  }
1206
1206
 
1207
- const commitValue = workspaceFieldValue(section, "Commit");
1208
1207
  if (hasSubstantiveWorkspaceValue(commitValue)
1209
1208
  && !workspaceValueMeansNoGit(commitValue)
1210
1209
  && health.head !== "unverified"
@@ -1235,8 +1234,24 @@ function assessHandoffWorkspaceIdentity(handoffText, health) {
1235
1234
  function workspaceFieldValue(section, label) {
1236
1235
  const escaped = escapeRegExp(label);
1237
1236
  const line = section.split(/\r?\n/u).find((candidate) => new RegExp(`^\\s*(?:[-*]\\s*)?${escaped}\\s*:`, "iu").test(candidate.trim()));
1238
- if (!line) return "";
1239
- return line.slice(line.indexOf(":") + 1).trim();
1237
+ if (line) return line.slice(line.indexOf(":") + 1).trim();
1238
+ for (const candidate of section.split(/\r?\n/u)) {
1239
+ const cells = candidate.trim().replace(/^\||\|$/gu, "").split("|").map((cell) => cell.trim());
1240
+ if (cells.length >= 2 && new RegExp(`^${escaped}$`, "iu").test(cells[0])) return cells[1];
1241
+ }
1242
+ return "";
1243
+ }
1244
+
1245
+ function workspaceBranchCommitValues(section) {
1246
+ const branchValue = workspaceFieldValue(section, "Branch");
1247
+ const commitValue = workspaceFieldValue(section, "Commit");
1248
+ const combined = workspaceFieldValue(section, "Branch / commit");
1249
+ if (!combined) return { branchValue, commitValue };
1250
+ const [combinedBranch = "", combinedCommit = ""] = combined.split(/\s+\/\s+/u, 2).map((value) => value.trim());
1251
+ return {
1252
+ branchValue: branchValue || combinedBranch,
1253
+ commitValue: commitValue || combinedCommit
1254
+ };
1240
1255
  }
1241
1256
 
1242
1257
  function hasSubstantiveWorkspaceValue(value) {
@@ -1261,16 +1276,13 @@ function workspaceValueIsNaturalNotApplicable(value) {
1261
1276
  }
1262
1277
 
1263
1278
  function workspaceSectionClaimsNoGit(section) {
1264
- return workspaceRootMeansNoGit(workspaceFieldValue(section, "Git root"))
1265
- || workspaceValueMeansNoGit(section);
1279
+ return workspaceRootMeansNoGit(workspaceFieldValue(section, "Git root"));
1266
1280
  }
1267
1281
 
1268
1282
  function workspaceSectionClaimsGitRepository(section) {
1269
1283
  const gitRoot = workspaceFieldValue(section, "Git root");
1270
- const values = [
1271
- workspaceFieldValue(section, "Branch"),
1272
- workspaceFieldValue(section, "Commit")
1273
- ];
1284
+ const { branchValue, commitValue } = workspaceBranchCommitValues(section);
1285
+ const values = [branchValue, commitValue];
1274
1286
  return (hasSubstantiveWorkspaceValue(gitRoot) && !workspaceRootMeansNoGit(gitRoot))
1275
1287
  || values.some((value) => hasSubstantiveWorkspaceValue(value)
1276
1288
  && !workspaceValueMeansNoGit(value)
@@ -3991,7 +4003,7 @@ function assessHandoffLifecycleConsistency(text) {
3991
4003
  const fieldValue = fieldValueAfterMarker(text, "lifecycle-conflicts-resolved");
3992
4004
  const contradictions = findHandoffLifecycleContradictions(text);
3993
4005
  const conflict = contradictions[0];
3994
- if (isUnresolvedLifecycleFieldValue(fieldValue)) {
4006
+ if (isExplicitlyUnresolvedLifecycleFieldValue(fieldValue)) {
3995
4007
  return { ok: false, reason: "lifecycle field is explicitly unresolved", conflict };
3996
4008
  }
3997
4009
  if (isPlaceholderLifecycleFieldValue(fieldValue) && hasSubstantiveHandoffState(text)) {
@@ -4003,6 +4015,33 @@ function assessHandoffLifecycleConsistency(text) {
4003
4015
  return { ok: true, reason: "" };
4004
4016
  }
4005
4017
 
4018
+ function isExplicitlyUnresolvedLifecycleFieldValue(value) {
4019
+ return isExplicitlyUnresolvedCloseoutFieldValue(value, "lifecycle-conflicts-resolved");
4020
+ }
4021
+
4022
+ function isExplicitlyUnresolvedCloseoutFieldValue(value, fieldId) {
4023
+ const trimmed = normalizeLifecycleFieldValue(value);
4024
+ if (!isAffirmativeLifecycleFieldValue(trimmed)) return isUnresolvedLifecycleFieldValue(trimmed);
4025
+ const detail = trimmed
4026
+ .replace(/^(?:yes|resolved|confirmed|complete|completed|ok|passed|all clear)\b|^(?:是|完成|已完成|已解決|已核對|已確認|通過)(?=$|[\s,。;:、,.!:;—–-])/iu, "")
4027
+ .replace(/^[\s,。;:、,.!:;—–-]+/u, "")
4028
+ .trim();
4029
+ const subject = fieldId === "recommended-next-step-explicit"
4030
+ ? /\b(?:(?:recommended\s+)?next\s+step|this\s+(?:field|declaration))\b|(?:(?:推薦)?下一步|本欄|此欄|本項|此項)/iu
4031
+ : fieldId === "opening-message-matches-current-state"
4032
+ ? /\b(?:opening\s+message|current\s+state|this\s+(?:field|declaration))\b|(?:開場白|開場訊息|目前狀態|當前狀態|本欄|此欄|本項|此項)/iu
4033
+ : /\b(?:lifecycle(?:\s+(?:conflicts?|state|field|declarations?|reconciliation))?|handoff(?:\s+(?:conflicts?|state|field|declarations?|reconciliation))?|this\s+(?:field|declaration))\b|(?:生命週期|生命周期|交接(?:矛盾|衝突|狀態)?|本欄|此欄|本項|此項)/iu;
4034
+ return detail.split(/[;;。!?!?]+/u).map((part) => part.trim()).filter(Boolean).some((clause, index) => {
4035
+ const state = clause.replace(/^(?:but|however|whereas|while|但|不過|然而)\s*[,,]?\s*/iu, "");
4036
+ if (/^(?:unresolved|still unresolved|not resolved|not confirmed|unverified|uncertain|blocked|pending|unknown|needs-review)(?=$|[\s,.;:—–-])/iu.test(state)
4037
+ || /^(?:(?:仍|尚)?未(?:解決|確認|核對)|未完成)(?=$|[\s,。;:、,.!:;—–-])/u.test(state)) return true;
4038
+ if (index === 0 && /^(?:(?:仍|尚)?未(?:解決|確認|核對)|未完成)/u.test(state)) return true;
4039
+ const unresolved = /\b(?:unresolved|still unresolved|not resolved|not confirmed|unverified|uncertain|blocked|pending|unknown|needs-review)\b|(?:仍|尚)?未(?:解決|確認|核對|完成)/iu;
4040
+ const between = "[^,,;;。.!?!?]*";
4041
+ return new RegExp(`(?:${subject.source})${between}(?:${unresolved.source})|(?:${unresolved.source})${between}(?:${subject.source})`, "iu").test(state);
4042
+ });
4043
+ }
4044
+
4006
4045
  function handoffLifecycleDiagnosticDetails(lifecycle) {
4007
4046
  if (lifecycle.conflict) {
4008
4047
  const { resolved, carryForward } = lifecycle.conflict;
@@ -14476,6 +14476,356 @@
14476
14476
  "canonicalSha256": "994ef946877e868418c02221f1a5d24d501da590694656921b9e1ae962d05a50"
14477
14477
  }
14478
14478
  }
14479
+ },
14480
+ "0.4.3": {
14481
+ "source": {
14482
+ "npm": {
14483
+ "spec": "@adamchanadam/agent-handoff-kit@0.4.3",
14484
+ "shasum": "808862be4e18046d80d203549710290246494ded",
14485
+ "integrity": "sha512-/dN3LcDCnBYiNeapyRYZ2BCCrj+9dFoAAcT4qSEV/bTDddPjbMU0ehqTkuRvdGTDYb7nx5WcbLzQfNAA1dlWBQ==",
14486
+ "entryCount": 52,
14487
+ "gitHead": null
14488
+ },
14489
+ "git": {
14490
+ "tag": "v0.4.3",
14491
+ "directObject": "fec999fb28a08f46cae9af5b928172c2196d5b19",
14492
+ "peeledCommit": "78732b057c19e15122bba819a3cc250e050a634a",
14493
+ "commit": "78732b057c19e15122bba819a3cc250e050a634a"
14494
+ },
14495
+ "githubRelease": {
14496
+ "tag": "v0.4.3",
14497
+ "publishedAt": "2026-10-07T05:27:27Z"
14498
+ },
14499
+ "sourceDivergence": {
14500
+ "status": "npm-gitHead-unavailable",
14501
+ "npmGitHead": null,
14502
+ "remoteTagCommit": "78732b057c19e15122bba819a3cc250e050a634a"
14503
+ }
14504
+ },
14505
+ "manifest": {
14506
+ "AGENTS.md": {
14507
+ "state": "present",
14508
+ "contentId": "567486537e4b81fd04c9204b3c94f2fbcf9632f336a8526fa0010a5753b86d93",
14509
+ "rawSha256": "d13294564bb63225f3ec273a986813441d38fcb58f5a86aec07f94956eb0b544",
14510
+ "normalizedSha256": "ed471f313cb6055a638661f9c5d77c37086089ad9715e2f73bdbeaac65139cc2",
14511
+ "canonicalSha256": "ed471f313cb6055a638661f9c5d77c37086089ad9715e2f73bdbeaac65139cc2"
14512
+ },
14513
+ "CLAUDE.md": {
14514
+ "state": "present",
14515
+ "contentId": "7a2cf08a1171762ebcb53f43036a2170655379416945258b9c85d4b189ecaecf",
14516
+ "rawSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
14517
+ "normalizedSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
14518
+ "canonicalSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad"
14519
+ },
14520
+ "GEMINI.md": {
14521
+ "state": "present",
14522
+ "contentId": "36da47034bb2ce6c760ddbbbbd49dccc1d17665dbb18bec56ffa3b26bac1c135",
14523
+ "rawSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
14524
+ "normalizedSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
14525
+ "canonicalSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986"
14526
+ },
14527
+ "START_NEXT_SESSION_PROMPT.txt": {
14528
+ "state": "present",
14529
+ "contentId": "9902b70a395688d6602b34f9e8085b32b5538e72c9009e28b4258e1fd30b77cc",
14530
+ "rawSha256": "6db53bb33849bc9daac07c8f2e873ed2e7558ce71e4d5ab78baef3e71a3724a8",
14531
+ "normalizedSha256": "6db53bb33849bc9daac07c8f2e873ed2e7558ce71e4d5ab78baef3e71a3724a8",
14532
+ "canonicalSha256": "9896feb18fe71a4f3500e2d89cea6991ca1788aebc6c6ead9848f5551750a1c0"
14533
+ },
14534
+ "dev/SESSION_HANDOFF.md": {
14535
+ "state": "present",
14536
+ "contentId": "73afc36c2bcfc236bc694af6ed5183637cef1e1089c80a0dc2c1a1a7214ca5c2",
14537
+ "rawSha256": "c7c35739ac4f80a5f2d7dbb395b36d62a5cce4f0b0a02cea5b35797c95e2364e",
14538
+ "normalizedSha256": "c7c35739ac4f80a5f2d7dbb395b36d62a5cce4f0b0a02cea5b35797c95e2364e",
14539
+ "canonicalSha256": "882588e529835a84071fbbdddab70324392c9bcbb206d9dc2c804ac01108197f"
14540
+ },
14541
+ "dev/SESSION_LOG.md": {
14542
+ "state": "present",
14543
+ "contentId": "fa77d46a61f58e2fabc537b5c6ff31c33eb4413088797e87bf1b442ddec291c5",
14544
+ "rawSha256": "8da41cb8b8e766f40e8ab4365c32e9b6be6cc9265dc22d18bbbe75e8ad771cbd",
14545
+ "normalizedSha256": "8da41cb8b8e766f40e8ab4365c32e9b6be6cc9265dc22d18bbbe75e8ad771cbd",
14546
+ "canonicalSha256": "8da41cb8b8e766f40e8ab4365c32e9b6be6cc9265dc22d18bbbe75e8ad771cbd"
14547
+ },
14548
+ "dev/PROJECT_INDEX.md": {
14549
+ "state": "present",
14550
+ "contentId": "c4c0db7c6e7a19796cd7ca1ed2a666461aa49a0b0d087a99deca43853ffdb468",
14551
+ "rawSha256": "50aec22374992bfb2f25dc18bc42915db68c70d92b3fcc20501c63287ba0f40b",
14552
+ "normalizedSha256": "fc723a45da301307ac7de1221faa770fdb336b30d44770eb81f2dc45cf1b5797",
14553
+ "canonicalSha256": "d13af58d29f15710e54469e929847a611a066f286198feeebada13192404141c"
14554
+ },
14555
+ "dev/DOC_SYNC_REGISTRY.md": {
14556
+ "state": "present",
14557
+ "contentId": "4c9f768eda712b65a04372059ea937864da01083346d007808cd935cc4825829",
14558
+ "rawSha256": "d32534a19c1247705c05431a30d1d294222faf372c0b777cfc087a7a52fb98ac",
14559
+ "normalizedSha256": "d32534a19c1247705c05431a30d1d294222faf372c0b777cfc087a7a52fb98ac",
14560
+ "canonicalSha256": "d32534a19c1247705c05431a30d1d294222faf372c0b777cfc087a7a52fb98ac"
14561
+ },
14562
+ "dev/RULE_PACKS.md": {
14563
+ "state": "present",
14564
+ "contentId": "1b91985b9c6460b7bf4293cc6119097df9b426c3a46199a0a4f1de1712d02faa",
14565
+ "rawSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4",
14566
+ "normalizedSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4",
14567
+ "canonicalSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4"
14568
+ },
14569
+ "dev/PROJECT_DECISIONS.md": {
14570
+ "state": "present",
14571
+ "contentId": "23daf5c72689add04511e62f8d7c354706b7c302a0188c7d0cf2e8cbcfc301d3",
14572
+ "rawSha256": "6d41cfe8799cad57587d75458b086434abb842ac91b72274b432454c710546b5",
14573
+ "normalizedSha256": "6d41cfe8799cad57587d75458b086434abb842ac91b72274b432454c710546b5",
14574
+ "canonicalSha256": "6d41cfe8799cad57587d75458b086434abb842ac91b72274b432454c710546b5"
14575
+ },
14576
+ "dev/rules/safety.md": {
14577
+ "state": "present",
14578
+ "contentId": "4f85c8af8a8abd02abf6d1a6f957c2979262cd82edda3dff89e17571b9489a51",
14579
+ "rawSha256": "a76f8206ce9c1208f90ed84504b4866666380131b0392d4bbd48c733368b51c8",
14580
+ "normalizedSha256": "a76f8206ce9c1208f90ed84504b4866666380131b0392d4bbd48c733368b51c8",
14581
+ "canonicalSha256": "a76f8206ce9c1208f90ed84504b4866666380131b0392d4bbd48c733368b51c8"
14582
+ },
14583
+ "dev/rules/coding.md": {
14584
+ "state": "present",
14585
+ "contentId": "1c6deb9a5a281c13e97b0ac96079e9e1beccbd1ff106186e7a6ac78c0eeb75c2",
14586
+ "rawSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
14587
+ "normalizedSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
14588
+ "canonicalSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4"
14589
+ },
14590
+ "dev/rules/writing.md": {
14591
+ "state": "present",
14592
+ "contentId": "ceee5412520ba860e6b40de46bb164e2ce3919d2197d5fadb926198eb7dddd3b",
14593
+ "rawSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
14594
+ "normalizedSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
14595
+ "canonicalSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593"
14596
+ },
14597
+ "dev/rules/research.md": {
14598
+ "state": "present",
14599
+ "contentId": "4414f9c82c6d04ad49d7446f4b0740055242f425ef5b00391d9c8c78c96c0f66",
14600
+ "rawSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
14601
+ "normalizedSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
14602
+ "canonicalSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104"
14603
+ },
14604
+ "dev/rules/agent-governance.md": {
14605
+ "state": "present",
14606
+ "contentId": "c0d63d30bd1be62f11ceb5146c4716a8b8eb61dd5d9aa34518196de528333cea",
14607
+ "rawSha256": "882780d38aae36d1693f65ba24ecfe6a3c7ee000d2875e2abb2508a13f4f7679",
14608
+ "normalizedSha256": "882780d38aae36d1693f65ba24ecfe6a3c7ee000d2875e2abb2508a13f4f7679",
14609
+ "canonicalSha256": "882780d38aae36d1693f65ba24ecfe6a3c7ee000d2875e2abb2508a13f4f7679"
14610
+ },
14611
+ "dev/rules/release.md": {
14612
+ "state": "present",
14613
+ "contentId": "b0a0c9dea88016185f4093f9be4ce3c0e29904222e21dd1fa1735fcc1bb7e744",
14614
+ "rawSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
14615
+ "normalizedSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
14616
+ "canonicalSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7"
14617
+ },
14618
+ "dev/rules/knowledge.md": {
14619
+ "state": "present",
14620
+ "contentId": "44d90de2a8a9230ee761934ff02a9ba91eb5dff4e649031cf1eb2d6e99d907af",
14621
+ "rawSha256": "401027a04c28e05d816005c63bfd0114ad470ac3f831182c1352fc833a3ad30f",
14622
+ "normalizedSha256": "401027a04c28e05d816005c63bfd0114ad470ac3f831182c1352fc833a3ad30f",
14623
+ "canonicalSha256": "401027a04c28e05d816005c63bfd0114ad470ac3f831182c1352fc833a3ad30f"
14624
+ },
14625
+ "dev/rules/communication.md": {
14626
+ "state": "present",
14627
+ "contentId": "34fd0034cbc75dad43f789b86a414763f01916dda4d59876db9c4d8d92ae6a87",
14628
+ "rawSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
14629
+ "normalizedSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
14630
+ "canonicalSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591"
14631
+ },
14632
+ "dev/rules/closeout.md": {
14633
+ "state": "present",
14634
+ "contentId": "ef9b8179cf351edf8abc77754ec8df630097d9770f6c7e7fe16e1b26a94a2337",
14635
+ "rawSha256": "cf9095ac53bf6216ed7106c3abe694b5a4beeee7128cd5eff87c26629524636a",
14636
+ "normalizedSha256": "cf9095ac53bf6216ed7106c3abe694b5a4beeee7128cd5eff87c26629524636a",
14637
+ "canonicalSha256": "cf9095ac53bf6216ed7106c3abe694b5a4beeee7128cd5eff87c26629524636a"
14638
+ },
14639
+ "dev/rules/onboarding.md": {
14640
+ "state": "present",
14641
+ "contentId": "ce2b623d5f0d79ed1a471abd788da11c043f15bb823a9a40c7e1e79079db649d",
14642
+ "rawSha256": "8c5f81d3a15a79310a82c63ed62ae4a4113db2ce7d70e4e247bfa784fa6f6927",
14643
+ "normalizedSha256": "8c5f81d3a15a79310a82c63ed62ae4a4113db2ce7d70e4e247bfa784fa6f6927",
14644
+ "canonicalSha256": "8c5f81d3a15a79310a82c63ed62ae4a4113db2ce7d70e4e247bfa784fa6f6927"
14645
+ },
14646
+ "dev/rules/integrations.md": {
14647
+ "state": "present",
14648
+ "contentId": "704880052d258dd6e95f7404cefe30695ecf9b153477d21ab4de703afa134fe7",
14649
+ "rawSha256": "994ef946877e868418c02221f1a5d24d501da590694656921b9e1ae962d05a50",
14650
+ "normalizedSha256": "994ef946877e868418c02221f1a5d24d501da590694656921b9e1ae962d05a50",
14651
+ "canonicalSha256": "994ef946877e868418c02221f1a5d24d501da590694656921b9e1ae962d05a50"
14652
+ }
14653
+ }
14654
+ },
14655
+ "0.4.4": {
14656
+ "source": {
14657
+ "npm": {
14658
+ "spec": "@adamchanadam/agent-handoff-kit@0.4.4",
14659
+ "shasum": "bfda53fd8d0229b27e67e2190753fa32a2ae1851",
14660
+ "integrity": "sha512-1H6ib7StICVApD+EaieTEMwzo0LAhOQnChKHXJFaAH0QXJ/9FrxgiklnBzyoqOTbVbMGkYoQ5KHJz5hloS59EA==",
14661
+ "entryCount": 52,
14662
+ "gitHead": null
14663
+ },
14664
+ "git": {
14665
+ "tag": "v0.4.4",
14666
+ "directObject": "e34995b151da1e54f4641362d99b29ef138717da",
14667
+ "peeledCommit": "8dbe0e09d910d705f33498ee7089fa711d3064b6",
14668
+ "commit": "8dbe0e09d910d705f33498ee7089fa711d3064b6"
14669
+ },
14670
+ "githubRelease": {
14671
+ "tag": "v0.4.4",
14672
+ "publishedAt": "2026-10-18T11:08:42Z"
14673
+ },
14674
+ "sourceDivergence": {
14675
+ "status": "npm-gitHead-unavailable",
14676
+ "npmGitHead": null,
14677
+ "remoteTagCommit": "8dbe0e09d910d705f33498ee7089fa711d3064b6"
14678
+ }
14679
+ },
14680
+ "manifest": {
14681
+ "AGENTS.md": {
14682
+ "state": "present",
14683
+ "contentId": "2b4b4fbb486d8a6c92ec644d989c8db7b75ef5dc3994fd33ff98e4542c28349d",
14684
+ "rawSha256": "eb29e00387722ff591c523e7be3e76b889ae809f2245cb51cc26c7aac1459b8d",
14685
+ "normalizedSha256": "0509ff24d7f353b3a277c6753ca9b04dda676ba6ce127e667fd9342cef950e09",
14686
+ "canonicalSha256": "0509ff24d7f353b3a277c6753ca9b04dda676ba6ce127e667fd9342cef950e09"
14687
+ },
14688
+ "CLAUDE.md": {
14689
+ "state": "present",
14690
+ "contentId": "7a2cf08a1171762ebcb53f43036a2170655379416945258b9c85d4b189ecaecf",
14691
+ "rawSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
14692
+ "normalizedSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
14693
+ "canonicalSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad"
14694
+ },
14695
+ "GEMINI.md": {
14696
+ "state": "present",
14697
+ "contentId": "36da47034bb2ce6c760ddbbbbd49dccc1d17665dbb18bec56ffa3b26bac1c135",
14698
+ "rawSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
14699
+ "normalizedSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
14700
+ "canonicalSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986"
14701
+ },
14702
+ "START_NEXT_SESSION_PROMPT.txt": {
14703
+ "state": "present",
14704
+ "contentId": "9902b70a395688d6602b34f9e8085b32b5538e72c9009e28b4258e1fd30b77cc",
14705
+ "rawSha256": "6b9ea678c8dce2bbec9011867c173c4044eb934f831a430533d325ae30d5e308",
14706
+ "normalizedSha256": "6b9ea678c8dce2bbec9011867c173c4044eb934f831a430533d325ae30d5e308",
14707
+ "canonicalSha256": "9896feb18fe71a4f3500e2d89cea6991ca1788aebc6c6ead9848f5551750a1c0"
14708
+ },
14709
+ "dev/SESSION_HANDOFF.md": {
14710
+ "state": "present",
14711
+ "contentId": "73afc36c2bcfc236bc694af6ed5183637cef1e1089c80a0dc2c1a1a7214ca5c2",
14712
+ "rawSha256": "a82a845af778038a7908db2065290bb32c9f1c5f32fbf0b1c5d0772d23d66455",
14713
+ "normalizedSha256": "a82a845af778038a7908db2065290bb32c9f1c5f32fbf0b1c5d0772d23d66455",
14714
+ "canonicalSha256": "882588e529835a84071fbbdddab70324392c9bcbb206d9dc2c804ac01108197f"
14715
+ },
14716
+ "dev/SESSION_LOG.md": {
14717
+ "state": "present",
14718
+ "contentId": "fa77d46a61f58e2fabc537b5c6ff31c33eb4413088797e87bf1b442ddec291c5",
14719
+ "rawSha256": "8da41cb8b8e766f40e8ab4365c32e9b6be6cc9265dc22d18bbbe75e8ad771cbd",
14720
+ "normalizedSha256": "8da41cb8b8e766f40e8ab4365c32e9b6be6cc9265dc22d18bbbe75e8ad771cbd",
14721
+ "canonicalSha256": "8da41cb8b8e766f40e8ab4365c32e9b6be6cc9265dc22d18bbbe75e8ad771cbd"
14722
+ },
14723
+ "dev/PROJECT_INDEX.md": {
14724
+ "state": "present",
14725
+ "contentId": "c4c0db7c6e7a19796cd7ca1ed2a666461aa49a0b0d087a99deca43853ffdb468",
14726
+ "rawSha256": "c5f3331e1133ad178a4b420fb49c9d28fc5a5022275ba9ef4d667f88c1fb2234",
14727
+ "normalizedSha256": "4e540ca4c392e326ad9e7ca2cbcb8897135c8be9b5a2004f224124999348f517",
14728
+ "canonicalSha256": "d13af58d29f15710e54469e929847a611a066f286198feeebada13192404141c"
14729
+ },
14730
+ "dev/DOC_SYNC_REGISTRY.md": {
14731
+ "state": "present",
14732
+ "contentId": "4c9f768eda712b65a04372059ea937864da01083346d007808cd935cc4825829",
14733
+ "rawSha256": "d32534a19c1247705c05431a30d1d294222faf372c0b777cfc087a7a52fb98ac",
14734
+ "normalizedSha256": "d32534a19c1247705c05431a30d1d294222faf372c0b777cfc087a7a52fb98ac",
14735
+ "canonicalSha256": "d32534a19c1247705c05431a30d1d294222faf372c0b777cfc087a7a52fb98ac"
14736
+ },
14737
+ "dev/RULE_PACKS.md": {
14738
+ "state": "present",
14739
+ "contentId": "1b91985b9c6460b7bf4293cc6119097df9b426c3a46199a0a4f1de1712d02faa",
14740
+ "rawSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4",
14741
+ "normalizedSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4",
14742
+ "canonicalSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4"
14743
+ },
14744
+ "dev/PROJECT_DECISIONS.md": {
14745
+ "state": "present",
14746
+ "contentId": "23daf5c72689add04511e62f8d7c354706b7c302a0188c7d0cf2e8cbcfc301d3",
14747
+ "rawSha256": "6d41cfe8799cad57587d75458b086434abb842ac91b72274b432454c710546b5",
14748
+ "normalizedSha256": "6d41cfe8799cad57587d75458b086434abb842ac91b72274b432454c710546b5",
14749
+ "canonicalSha256": "6d41cfe8799cad57587d75458b086434abb842ac91b72274b432454c710546b5"
14750
+ },
14751
+ "dev/rules/safety.md": {
14752
+ "state": "present",
14753
+ "contentId": "4f85c8af8a8abd02abf6d1a6f957c2979262cd82edda3dff89e17571b9489a51",
14754
+ "rawSha256": "a76f8206ce9c1208f90ed84504b4866666380131b0392d4bbd48c733368b51c8",
14755
+ "normalizedSha256": "a76f8206ce9c1208f90ed84504b4866666380131b0392d4bbd48c733368b51c8",
14756
+ "canonicalSha256": "a76f8206ce9c1208f90ed84504b4866666380131b0392d4bbd48c733368b51c8"
14757
+ },
14758
+ "dev/rules/coding.md": {
14759
+ "state": "present",
14760
+ "contentId": "1c6deb9a5a281c13e97b0ac96079e9e1beccbd1ff106186e7a6ac78c0eeb75c2",
14761
+ "rawSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
14762
+ "normalizedSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
14763
+ "canonicalSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4"
14764
+ },
14765
+ "dev/rules/writing.md": {
14766
+ "state": "present",
14767
+ "contentId": "ceee5412520ba860e6b40de46bb164e2ce3919d2197d5fadb926198eb7dddd3b",
14768
+ "rawSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
14769
+ "normalizedSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
14770
+ "canonicalSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593"
14771
+ },
14772
+ "dev/rules/research.md": {
14773
+ "state": "present",
14774
+ "contentId": "4414f9c82c6d04ad49d7446f4b0740055242f425ef5b00391d9c8c78c96c0f66",
14775
+ "rawSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
14776
+ "normalizedSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
14777
+ "canonicalSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104"
14778
+ },
14779
+ "dev/rules/agent-governance.md": {
14780
+ "state": "present",
14781
+ "contentId": "c0d63d30bd1be62f11ceb5146c4716a8b8eb61dd5d9aa34518196de528333cea",
14782
+ "rawSha256": "882780d38aae36d1693f65ba24ecfe6a3c7ee000d2875e2abb2508a13f4f7679",
14783
+ "normalizedSha256": "882780d38aae36d1693f65ba24ecfe6a3c7ee000d2875e2abb2508a13f4f7679",
14784
+ "canonicalSha256": "882780d38aae36d1693f65ba24ecfe6a3c7ee000d2875e2abb2508a13f4f7679"
14785
+ },
14786
+ "dev/rules/release.md": {
14787
+ "state": "present",
14788
+ "contentId": "b0a0c9dea88016185f4093f9be4ce3c0e29904222e21dd1fa1735fcc1bb7e744",
14789
+ "rawSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
14790
+ "normalizedSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
14791
+ "canonicalSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7"
14792
+ },
14793
+ "dev/rules/knowledge.md": {
14794
+ "state": "present",
14795
+ "contentId": "44d90de2a8a9230ee761934ff02a9ba91eb5dff4e649031cf1eb2d6e99d907af",
14796
+ "rawSha256": "401027a04c28e05d816005c63bfd0114ad470ac3f831182c1352fc833a3ad30f",
14797
+ "normalizedSha256": "401027a04c28e05d816005c63bfd0114ad470ac3f831182c1352fc833a3ad30f",
14798
+ "canonicalSha256": "401027a04c28e05d816005c63bfd0114ad470ac3f831182c1352fc833a3ad30f"
14799
+ },
14800
+ "dev/rules/communication.md": {
14801
+ "state": "present",
14802
+ "contentId": "34fd0034cbc75dad43f789b86a414763f01916dda4d59876db9c4d8d92ae6a87",
14803
+ "rawSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
14804
+ "normalizedSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
14805
+ "canonicalSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591"
14806
+ },
14807
+ "dev/rules/closeout.md": {
14808
+ "state": "present",
14809
+ "contentId": "ef9b8179cf351edf8abc77754ec8df630097d9770f6c7e7fe16e1b26a94a2337",
14810
+ "rawSha256": "cf9095ac53bf6216ed7106c3abe694b5a4beeee7128cd5eff87c26629524636a",
14811
+ "normalizedSha256": "cf9095ac53bf6216ed7106c3abe694b5a4beeee7128cd5eff87c26629524636a",
14812
+ "canonicalSha256": "cf9095ac53bf6216ed7106c3abe694b5a4beeee7128cd5eff87c26629524636a"
14813
+ },
14814
+ "dev/rules/onboarding.md": {
14815
+ "state": "present",
14816
+ "contentId": "ce2b623d5f0d79ed1a471abd788da11c043f15bb823a9a40c7e1e79079db649d",
14817
+ "rawSha256": "8c5f81d3a15a79310a82c63ed62ae4a4113db2ce7d70e4e247bfa784fa6f6927",
14818
+ "normalizedSha256": "8c5f81d3a15a79310a82c63ed62ae4a4113db2ce7d70e4e247bfa784fa6f6927",
14819
+ "canonicalSha256": "8c5f81d3a15a79310a82c63ed62ae4a4113db2ce7d70e4e247bfa784fa6f6927"
14820
+ },
14821
+ "dev/rules/integrations.md": {
14822
+ "state": "present",
14823
+ "contentId": "704880052d258dd6e95f7404cefe30695ecf9b153477d21ab4de703afa134fe7",
14824
+ "rawSha256": "994ef946877e868418c02221f1a5d24d501da590694656921b9e1ae962d05a50",
14825
+ "normalizedSha256": "994ef946877e868418c02221f1a5d24d501da590694656921b9e1ae962d05a50",
14826
+ "canonicalSha256": "994ef946877e868418c02221f1a5d24d501da590694656921b9e1ae962d05a50"
14827
+ }
14828
+ }
14479
14829
  }
14480
14830
  },
14481
14831
  "contents": {
@@ -15528,6 +15878,36 @@
15528
15878
  "targetRel": "dev/rules/integrations.md",
15529
15879
  "canonicalSha256": "994ef946877e868418c02221f1a5d24d501da590694656921b9e1ae962d05a50",
15530
15880
  "text": "# Integrations Pack\n\n## Scope\n\nUse this pack for governance of already-installed external tool integrations: **Connectors** (official or platform-vetted MCP servers), **MCPs** (community or custom MCP servers), **Plugins** (bundles that may register skills, MCP servers, hooks, or apps), and **Skills** (`SKILL.md` instruction sets).\n\nWhen a task touches external sources or external write surfaces such as Notion, Google Drive, Dropbox, Slack, Linear, GitHub, HubSpot, browsers, screenshots, DevTools, Playwright, desktop app automation, crawlers, notebooks, or local helper services, this pack makes the agent check declared integrations and tool operation references first, prefer direct runtime access when available, and fall back to manual packets only when the integration is unavailable.\n\nThis pack does not teach users how to install tools. Installation is handled by the user's AI runtime, tool vendor, or official documentation. This pack governs what happens after a tool is already installed: declaration, verification, safe use, resource lifecycle, drift handling, and cross-session continuity.\n\n## Load When\n\n- The task mentions Notion, Google Drive, Slack, Linear, Dropbox, HubSpot, GitHub, browser automation, UI validation, screenshot capture, Chrome, Playwright, DevTools, desktop app automation, crawlers, notebooks, local helper services, or other external tools.\n- The user asks whether the agent can directly read or write an external system.\n- The current task or handoff names a declared integration as a dependency, or the user requests an integration health check.\n- First-time onboarding asks the user to declare installed external tools.\n- The project uses a multi-layer source-of-truth setup, for example Notion index + local source files + Google Drive reference mirrors.\n- The user reports resource pressure, stale MCP or plugin services, browser automation left running, cache growth, or slowdown after external-tool use.\n\n## Discipline\n\n### 1. Credential Separation Principle\n\nCredential values such as API keys, OAuth tokens, app secrets, and refresh tokens belong only in AI runtime secure storage, OS credential stores, tool configuration, environment indirection, or user-managed secret stores. Agent Handoff Kit files may record credential references, never credential values.\n\n| Storage layer | Examples | What Kit files may record |\n|---|---|---|\n| AI runtime secure storage / Connector storage | Notion, Slack, Linear, Google Drive, Atlassian, HubSpot, or similar connectors | Storage type or connector name only |\n| OS credential store | macOS Keychain, Windows Credential Manager, Linux secret service | `OS credential store` only |\n| Tool config / env indirection | AI tool MCP config, plugin config, environment variable name | Config location or env var name only; never the value |\n| User-managed secret store | Team vault or secret manager | Store type or owner only |\n\nNo file under `dev/` should contain a credential value. Enforce three rules:\n\n1. Do not ask the user to paste credential values into chat.\n2. If a credential-like prefix appears, redact it and warn the user to rotate the token when appropriate. Examples include `sk-`, `sk-ant-`, `ntn_`, `secret_`, `ya29.`, `1//`, `xoxp-`, `xoxb-`, `ghp_`, `gho_`, `ghs_`, `github_pat_`, `sl.`, `AKIA`, and `AIza`.\n3. Before writing to `dev/PROJECT_INDEX.md` `## Installed Integrations`, self-check that no credential value is being persisted. Doctor also checks `PROJECT_INDEX`, `SESSION_HANDOFF`, and `SESSION_LOG` for common credential prefixes.\n\n### 2. External Tool Usage Verification Gate\n\nAgents must not use model memory, old session experience, copied examples, Connector marketing text, or guessed command shapes as the source for external-tool usage. Before first use of an external tool layer in the current task, and again before any write, destructive action, permission-sensitive action, raw API / SDK / CLI / URI call, plugin API change, or retry after `unknown tool`, `invalid arguments`, HTTP 400 / 404, permission, auth, or schema errors, verify the current usage source for that layer:\n\n| Layer | Required current source before invocation |\n|---|---|\n| Connector / MCP tool | Current runtime-exposed tool name, description, and input schema. Use the tool list/schema exposed by the active AI runtime or MCP server; do not invent `mcp__*` names or arguments. |\n| Plugin / Skill | Current plugin/skill instructions plus any registered MCP tool schema it exposes. |\n| Raw API / SDK / CLI / URI | Current official documentation or a project-local runbook that states source, version/date, and scope. If the runbook lacks those, verify against official docs. |\n| Local app plugin API | Official API documentation, official type definitions, official sample project, or local installed package types matching the project version. |\n| Project-local runbook | Accept as a task source only when it records the upstream source, version/date, scope, and known limits. |\n\nIf the required source cannot be inspected, first classify the actual failure and check an already-authorized capable source/channel plus any normal platform approval. Mark only the affected use `blocked` or `unverified` when none can establish the needed contract; ask the user only for docs, schema, access, or a decision the AI cannot obtain, and use a manual packet only when it preserves the needed evidence. Do not continue by trial and error or bypass a real refusal. Connector-first means schema-first for the active runtime, not memory-first.\n\n#### Runtime-Controlled Tool Operation Variants\n\nFor browser and tool-operation work, first check `dev/PROJECT_INDEX.md` `## Tool Operation References` when present. A successful method from a previous session is reusable only when it is registered there with source, version/date, scope, known limits, and last verification.\n\n| Variant | Examples | Required source before use |\n|---|---|---|\n| Browser / UI validation | Browser tool, screenshot, Chrome, DevTools, Playwright smoke test, visual QA | Active runtime browser/tool schema; registered tool operation reference; or current official docs for raw CLI/SDK use. Do not guess Chrome, Playwright, or DevTools commands. |\n| Desktop or local app automation | Desktop app session, app plugin, local browser profile, extension-dependent workflow | Active app/plugin/tool schema or official automation API docs. Do not mutate user sessions, profiles, or extension state without confirmation. |\n| Crawler / scraper / local helper | Firecrawl-like tools, crawler services, local helper server | Active tool schema, registered operation reference, or official docs. Respect source permissions, rate limits, and cleanup boundaries. |\n| Notebook / data runtime | Notebook kernel, data runtime, long-lived analysis server | Active runtime/kernel schema or registered operation reference. Classify kernels and servers by ownership before cleanup. |\n| Raw CLI / SDK / tool server | Direct command invocation, SDK script, MCP/tool server operation | Current official docs, installed package types, or registered operation reference. Mark blocked or unverified if unavailable. |\n\n#### Local HTML / app validation fallback\n\nA blocked browser surface is not the same as a blocked validation task. If a browser tool rejects a local `file://` page because of URL policy, sandbox policy, or browser-use safety policy, do not try to bypass that policy through raw CDP, alternate browser surfaces, extension state, or hidden browser commands. Treat the rejected `file://` attempt as one failed surface and switch to a materially safer project-local validation path when available.\n\nFor local HTML, static app, generated guide, or local UI validation, the preferred fallback is a short-lived localhost service:\n\n1. Check `PROJECT_INDEX` `## Tool Operation References` for a registered browser, Chrome DevTools, Playwright, or local validation procedure.\n2. If no registered procedure is available and the file can be safely served, start a task-owned local static server bound to loopback such as `127.0.0.1`.\n3. Open the served `http://127.0.0.1:<port>/...` URL with the verified browser, DevTools, or Playwright surface.\n4. Verify real behavior through visible page state, text hits, click/state changes, console evidence, screenshot, or another task-relevant readback.\n5. Close the task-owned browser tab/context and stop the localhost service before completion; record any cleanup limit under the resource lifecycle rules.\n\nOnly mark local HTML / app validation as `blocked` after the registered operation reference, the localhost fallback, and the available verified browser / DevTools / Playwright surface are each unavailable or fail for a stated reason. A `file://` rejection alone is not enough evidence to stop.\n\n### 2.1 External Tool Resource Lifecycle\n\nExternal tools must be treated as resources with ownership, not just capabilities. After using Connector, MCP, plugin, browser automation, local server, crawler, notebook, or similar external tool services, classify any opened session, process, browser context, temporary directory, cache, or helper service into one of these ownership classes:\n\n| Ownership class | Examples | Agent action |\n|---|---|---|\n| Task-owned | Process, browser context, temp directory, or helper service clearly started by this task and no longer needed. Evidence may include parent-child process chain, start time, tool family, task-created path, or runtime session handle. | Close or clean up automatically through the runtime or tool's graceful shutdown API when available; OS-level termination is allowed only when ownership is clear and graceful close is unavailable or failed. |\n| Agent-managed | Kit-managed or agent-created temp/cache under a known task workspace, with bounded path and age/size rules. | Clean automatically inside the declared boundary. Never scan or clean broad user, system, browser, package-manager, or marketplace caches through this class. |\n| Shared / user-owned / other-agent-owned / system-level | User's normal browser, another AI agent's active browser or MCP service, global MCP service, global npm/cache directory, shared credential store, project files, OS temp root, or any process whose owner is uncertain. | Do not terminate, delete, disable, or reconfigure automatically. Report evidence and propose exact remediation for user confirmation. |\n| Unknown | Generic `node`, `python`, `chrome`, or helper process without reliable owner evidence. | Treat as shared until proven otherwise. |\n\nFor ordinary external-tool tasks, perform a lightweight closeout check: close task-owned handles, note any known retained session, and report only meaningful residual risk. For long-running, multi-tool, MCP-heavy, browser-automation, repeated-error, or user-reported slowdown tasks, perform a fuller resource review when the runtime exposes enough data: group by tool family, count, approximate memory where available, age / start time where available, and ownership class. If process command lines or environment details may contain secrets, redact arguments and secret-like values before reporting.\n\nThe preferred cleanup order is: graceful tool/session close, then task-owned process termination, then task-owned temp cleanup. Shared or ambiguous resources require explicit user confirmation with exact process IDs or paths, tool names, expected impact, and restart path before any termination, cache deletion, tool disablement, or configuration change. Never terminate or clean up a tool resource that may belong to another AI agent running on the same machine unless ownership has been proven for the current task.\n\n### 3. Integration Type Discipline\n\n#### 3.1 Connectors\n\nConnectors are ready-to-use external tool surfaces exposed by the active AI runtime. Their credentials are normally managed by runtime secure storage, OS credential storage, or connector storage.\n\nDiscipline:\n\n- Use only runtime-exposed tools whose current name, description, and input schema have been inspected.\n- Read back every external write before claiming success.\n- If auth fails, surface the failure and point the user to the runtime or connector settings. Do not attempt automatic re-auth.\n\n#### 3.2 MCPs\n\nMCP servers may be official, community, custom, or project-local. Custom MCPs often depend on manual configuration.\n\nDiscipline:\n\n- Use only the active runtime's exposed tool name, description, and input schema.\n - Treat non-vetted or custom MCP write operations with extra caution. Destructive writes require dry-run and user confirmation under `dev/rules/safety.md`.\n- If the server fails because of process crash, config error, or unavailable runtime state, surface the failure, recommend checking MCP config and restarting the host tool, and do not blindly retry.\n\n#### 3.3 Plugins\n\nPlugins are distribution bundles. A plugin may register skills, MCP servers, hooks, apps, or other runtime capabilities.\n\nDiscipline:\n\n- Do not invoke a plugin as a separate abstraction unless the runtime exposes such an action.\n- If a plugin provides a skill, follow the skill trigger rules.\n- If a plugin provides an MCP server or app tool, treat it under the Connector / MCP rules above and the resource lifecycle rules in this pack.\n\n#### 3.4 Skills\n\nSkills are instruction overlays, usually stored as `SKILL.md`, and may be installed directly or shipped by a plugin.\n\nDiscipline:\n\n- Invoke a skill when the user explicitly names it or when the skill's trigger conditions are clearly met.\n- Skill instructions coexist with rule-pack discipline.\n- If a skill conflicts with safety, governance, or closeout rules, the rule pack and core safety boundary take precedence.\n\n### 4. Source-of-truth Architecture\n\nWhen a project uses multiple integrations as a source-of-truth system, read `dev/PROJECT_INDEX.md` `## Installed Integrations` `### Source-of-truth Architecture` before acting.\n\n| Layer | Role | Write direction |\n|---|---|---|\n| Source of truth | Original auditable reference content | User places or controls it; agent does not directly write it unless the project explicitly declares that integration as writable truth. |\n| Index | Metadata, summary, tags, and references for source files | Agent may read/write through declared Connector or MCP when verified. |\n| Persistent mirror | Backup or cross-device reference mirror | User-controlled sync by default; agent does not push automatically. |\n| Working draft | Task output and local work product | Agent may read/write local files under normal safety rules. |\n\nEach layer's responsible integration must be explicit in `PROJECT_INDEX`. Do not cross layers, for example by treating an index as primary truth or pushing a working draft to a mirror without authorization.\n\n### 5. Cross-session Lifecycle\n\n#### Phase 0 — First-contact declaration\n\nDuring first-time onboarding, ask the user whether relevant external tools are already installed or available. This may be handled by the onboarding pack's external-tool scenario.\n\n#### Phase 1 — Initial recording\n\nRecord declared integrations in `PROJECT_INDEX` `## Installed Integrations`, using the Connectors / MCPs / Plugins / Skills subsections and the Source-of-truth Architecture table when needed.\n\n#### Phase 2 — Cross-session handoff\n\n`SESSION_HANDOFF` durable anchors should point future agents to `PROJECT_INDEX` `## Installed Integrations`. Follow the core Intent And Startup contract for when to read that section; a durable anchor does not add it to every next-session opening read order.\n\n#### Phase 3 — Before-use availability probe\n\nImmediately before the current task uses a declared integration, run the smallest relevant availability probe when the runtime exposes the needed tool schema. Do not probe unrelated integrations at startup. `TBD`, examples, blank rows, and placeholder-only tables are not declarations.\n\n- Probe success: update `Last Verified` only through the normal Persistence Gate, then proceed.\n- Probe fail: record the actual unavailable/failed result where the Persistence Gate applies, then use this pack's fallback flow only for the affected surface.\n\n#### Phase 4 — Task execution\n\nApply the knowledge pack's Connector-first discipline: check declaration, use the verified direct tool when available, then follow this pack's classified fallback. A manual packet or user question is a last resort only when an authorized capable channel cannot supply the needed evidence.\n\n#### Phase 5 — Mid-session drift handling\n\nIf an integration fails mid-task because of expired auth, rate limit, network timeout, tool crash, or missing runtime capability:\n\n- Surface the failure and impact.\n- Do not auto-fix credentials or auth.\n- Update `PROJECT_INDEX` `Last Verified` only after a real successful probe and the normal Persistence Gate; record an actual failed probe as failure/drift without relabeling it available.\n- Record the drift in `SESSION_LOG` and unresolved risk in `SESSION_HANDOFF` when it affects future work.\n\n#### Phase 6 — Cross-tool consistency\n\nIntegration declarations are project-level; they do not guarantee every AI runtime has the same tools installed. A new runtime must verify availability, warn on capability differences, and use this pack's fallback flow for the affected surface; do not require the user to install or switch tools before checking an already-authorized capable channel.\n\n## Rules\n\n1. **Credential separation**: never ask for, log, or persist credential values. Redact credential-like values and warn about rotation when appropriate.\n2. **External Tool Usage Verification Gate**: verify current runtime schema, official docs, official types/samples, or registered tool operation references before invoking or retrying external tools.\n3. **Declaration before use**: read `dev/PROJECT_INDEX.md` `## Installed Integrations` and `## Tool Operation References` before external-tool or runtime-controlled tool-operation work. If absent, inspect the active runtime for an authorized capable tool/schema before asking the user about access or source information.\n4. **Connector-first default**: when a declared integration is functional, prefer the verified direct tool call. Manual paste is fallback, not default.\n5. **Write operations require read-back verification**: read back every external write before claiming success.\n6. **No auto-fix credential / auth issues**: surface auth failures to the user and point to the runtime settings or tool owner.\n7. **Cross-tool capability awareness**: verify availability immediately before use, when the current objective declares the integration as a dependency, or when the user requests a health check.\n8. **Do not cross source-of-truth layers**: follow the role and write direction declared in `PROJECT_INDEX`.\n9. **Drift event mandatory recording**: record integration drift in `PROJECT_INDEX`, `SESSION_LOG`, and `SESSION_HANDOFF` when it affects future work.\n10. **Plugin / Skill subordination**: plugin and skill instructions coexist with rule packs; safety, governance, and closeout rules take precedence on conflict.\n11. **External tool resource lifecycle**: after external-tool use, classify resources by ownership. Task-owned / agent-managed resources may be closed or cleaned automatically; shared, user-owned, system-level, other-agent-owned, or unknown resources require evidence reporting and user confirmation before remediation.\n12. **Local HTML / app validation fallback**: if `file://` browser access is blocked, do not bypass the policy and do not stop on that single surface failure. Use a registered operation reference or a short-lived loopback localhost service for actual browser / DevTools / Playwright validation, then close the task-owned service and record the evidence.\n13. **Terminal-state contract**: a tool operation succeeds only when the runtime returns an explicit successful terminal state and any required read-back passes. Stopped, aborted, timeout, spawn / transport error, signal, missing final result, or partial stdout before termination makes the affected operation indeterminate or failed, not successful. It does not make unrelated already-verified task evidence permanently invalid. For read-only operations, verify the state and rerun only the affected operation when still needed. For any operation that may have written externally or to disk, read back the actual target state before retrying, recovery, or success claims.\n\n## Checks\n\n- Verify `dev/PROJECT_INDEX.md` `## Installed Integrations` exists and has the expected subsections when the project declares integrations.\n- Before probing or invoking a declared integration, inspect current runtime tool description and input schema.\n- Before browser validation, screenshots, Chrome, Playwright, DevTools, desktop automation, crawler, notebook, or raw CLI/SDK/tool-server work, verify the current source from runtime schema, official docs, or `PROJECT_INDEX` `## Tool Operation References`.\n- Before external-tool first use, write, destructive operation, raw API / SDK / CLI / URI / plugin API call, or retry after tool error, confirm the current usage source.\n- Surface and record mid-session integration drift.\n- After external-tool use, perform ownership-based resource closeout. For long-running, multi-tool, MCP, browser automation, repeated-error, or slowdown scenarios, report grouped residual processes or services when observable.\n- Before closeout, update `Last Verified` only for integrations with a real successful probe and when the normal Persistence Gate selects the write; retain actual failed-probe drift separately.\n- Self-check credential leakage before writing `PROJECT_INDEX`, `SESSION_HANDOFF`, or `SESSION_LOG`.\n- Verify that `PROJECT_INDEX` External Sources `via` references match declared Installed Integrations entries.\n- For local HTML / app validation, verify that a rejected `file://` attempt is followed by a registered operation reference or short-lived localhost fallback before declaring `blocked`.\n- Treat stopped, aborted, timeout, spawn / transport error, signal, and missing final result as operation-level indeterminate / failed states. Never count partial stdout, a wrapper exit code, or an outer command's success as terminal success without the expected final state and read-back.\n\n## Closeout\n\n1. Update `PROJECT_INDEX` `## Installed Integrations` `Last Verified` cells only after real successful probes and when the normal Persistence Gate selects the write; record actual failed drift without claiming availability.\n2. If drift happened, record the drift narrative, impact, and suggested next handling in `SESSION_LOG`.\n3. Add unresolved integration failures to `SESSION_HANDOFF` `## Risks / Blockers`.\n4. If unresolved drift affects startup, mention the next-session verification need in the opening message.\n5. If the user declared a new integration during the session, ensure it is registered in `PROJECT_INDEX` and cross-referenced from External Sources when applicable.\n6. If shared or ambiguous external-tool processes, caches, browser contexts, or helper services remain, record only a redacted evidence summary and recommended remediation. Do not write raw secret-bearing command lines into handoff or log files.\n\n## Anti-patterns\n\n| Anti-pattern | Why it is wrong | Correct approach |\n|---|---|---|\n| Assuming no Connector or MCP exists whenever the user mentions Notion, Google Drive, or another external source | Mature connector ecosystems make paste-only fallback an unreliable default. | Read `PROJECT_INDEX` Installed Integrations, then inspect the active runtime for an authorized capable tool/schema; ask only for missing user-held access or source information. |\n| Guessing tool names, endpoints, CLI flags, URI parameters, or plugin APIs from memory | Stale examples cause unknown tool, invalid args, 400 / 404, permission, or auth loops. | Verify active runtime schema, official docs, official types/samples, or versioned local runbooks. |\n| Treating browser validation as ordinary coding and guessing Chrome, Playwright, or DevTools commands | Browser and tool-control surfaces differ across runtimes, profiles, plugins, and installed packages. | Verify the active runtime schema, official docs, or a registered tool operation reference; use the classified fallback only for the affected surface when unavailable. |\n| Treating a Connector marketing page or old example as executable schema | Marketing pages do not prove the active runtime's current tool name or input schema. | Use active runtime tool list/schema as the invocation source. |\n| Retrying unknown tool / invalid args by changing names or parameters repeatedly | Trial-and-error hides the real schema or docs gap. | Stop same-pattern retries and return to the External Tool Usage Verification Gate. |\n| Writing credential values into `PROJECT_INDEX`, `SESSION_HANDOFF`, or `SESSION_LOG` | Project files and git history are persistent; leaked credentials remain exposed. | Record credential references only, never values. |\n| Using a credential value pasted in chat and then recording it | Chat history and logs may persist the secret. | Redact, warn, and ask the user to rotate if needed. |\n| Auto-fixing auth or re-auth flows | Auth belongs to the user and the runtime/tool boundary. | Surface the failure and point to the runtime or tool settings. |\n| Claiming an external write succeeded without read-back | External writes may fail silently or partially. | Read back and compare before claiming success. |\n| Crossing source-of-truth layers | It can corrupt truth, mirrors, or working drafts. | Follow the declared layer role and write direction in `PROJECT_INDEX`. |\n| Skipping current availability verification because an old handoff said the tool worked | Tokens expire, runtimes change, and tools can be removed. | Probe availability in the current runtime before using the integration. |\n| Treating stopped, aborted, timeout, spawn / transport error, signal, missing final result, or partial PASS output as success | Tool output can be partial, wrappers can hide inner failure, and external writes may be unknown. | Mark the affected operation indeterminate or failed; read back any possible write target before retrying or claiming success. |\n| Leaving task-owned MCP / browser / helper processes running after the task | Turns one-off tool use into a long-lived resource leak and can slow the host. | Use graceful close or task-owned process cleanup automatically; switch to user confirmation only when ownership is unclear. |\n| Broadly killing by process name such as `node.exe`, `python`, or `chrome` | A generic process name does not prove ownership and may terminate user work, another project, or another AI agent's active tools. | Classify by tool family, process ID, start time, parent chain, and task-created path; treat unknown ownership as shared. |\n| Automatically cleaning global caches, marketplace caches, OS temp roots, or browser profiles | May remove shared state, login state, or data other tools still need. | Automatically clean only task-owned / agent-managed bounded paths; report evidence and wait for confirmation otherwise. |\n\n## Cross-reference\n\n- `dev/rules/knowledge.md` Rule 5: Connector-first source access discipline.\n- `dev/rules/safety.md` Rule 10: external API / SDK / CLI / tool verification boundary.\n- `dev/rules/safety.md` Rule 12: credential leak prevention.\n- `dev/rules/safety.md` Rule 14: process termination and cache cleanup boundary for external-tool resources.\n- `dev/rules/onboarding.md` Scenario F: first-contact declaration entry point.\n- installed `AGENTS.md`: task-triggered availability probe discipline.\n- `dev/PROJECT_INDEX.md` `## Installed Integrations` and `## External Sources` `via` column: declaration registry.\n"
15881
+ },
15882
+ "567486537e4b81fd04c9204b3c94f2fbcf9632f336a8526fa0010a5753b86d93": {
15883
+ "targetRel": "AGENTS.md",
15884
+ "canonicalSha256": "ed471f313cb6055a638661f9c5d77c37086089ad9715e2f73bdbeaac65139cc2",
15885
+ "text": "<!-- BEGIN Agent Handoff Kit managed core -->\n# Agent Handoff Kit Core Runtime\n\nThis is the small always-read contract. Detailed task and closeout procedures live in routed packs.\n\n## 1. Intent And Startup\n\n### Upgrade lock guard\n\nBefore any handoff, user-rule router, pack, or other project-state read, use the verified project root to probe `dev/governance_migrations/.upgrade.lock`. A present lock, or inability to establish its absence, stops ordinary work and all further project-state reads and searches. Do not search for recovery instructions or edit or delete the lock. Before that explanation, render this fenced brand card:\n\n```text\n /\\_/\\ Agent Handoff Kit\n ( x.x ) continuity unavailable\n > ^ <\n```\n\nIt must not claim loaded, healthy, saved, or version-verified state. Explain that continuity is unavailable and give the supported recovery command `agent-handoff-kit upgrade --yes --root <verified-project-root>`. Bare startup never runs this command automatically. If the existence probe is unreadable, report continuity unavailable without claiming a lock is present and do not auto-recover. When the visible user request explicitly authorizes update, upgrade or recovery, only the official CLI performs transaction recovery; resume ordinary state loading only after that CLI succeeds and a new probe establishes lock absence.\n\nClassify the user's visible intent before loading project state. For explicit continuity, closeout, or a task whose next action depends on persisted project state, read `dev/SESSION_HANDOFF.md` first; it is the current-state authority. A direct ordinary or stateless task does not read the handoff merely because the project root is known. If the message is genuinely unresolved and the handoff can resolve it, read the handoff before asking the user.\n\nDo not read `dev/SESSION_LOG.md` during ordinary startup; it is trace-back evidence only. Do not read `START_NEXT_SESSION_PROMPT.txt` in addition to the handoff when already operating in the project root; that file is a portable generated mirror for an agent that has not yet been pointed at the root.\n\nWhen resuming, recover the parent outcome, current step, resume point, remaining acceptance and source coverage from the fully received handoff under the checkpoint below. Preserve decision-changing user corrections, rejected approaches and their reasons, reusable work and permission boundaries. Surface missing critical context in the startup warning and recommend the specific clarification/read; do not infer parent completion from a finished child or treat previous-session reading as your own. Bare startup remains status-only, with no extra source reads or writes.\n\nRoute intent in this order:\n\n1. Clear closeout intent routes directly to `dev/rules/closeout.md`.\n2. Clear continuity intent such as \"開工\", \"Start Agent Handoff\", \"開始接力\", or \"continue handoff\" resumes the minimum current state from the handoff. A plain continuity message with no same-message task or explicit long-run instruction authorizes only that recovery, the display-only current-thread naming checkpoint when safely supported, the startup card, the current objective/risk/recommended next action, and then the end of the turn. It does not authorize task-specific reads, research, plans, protocols, preflight, file searches, sub-agents, QA, packaging, project-file writes, network access, other external actions, or opt-out wording such as \"unless you object I will start\". First-use exception: when `dev/SESSION_HANDOFF.md` says `First-use guidance state: eligible`, the active objective is empty / `TBD`, and there is no same-message concrete task, load `dev/rules/onboarding.md` and include a short first-use welcome plus the most relevant guided choices in the same response instead of ending status-only. A concrete objective found only in loaded state is not authority to complete it. A same-message task may begin normally. An explicit instruction such as \"開工,繼續做到下一個 blocker\" or \"開工,繼續完成目前目標\" may continue under the normal task and safety rules.\n3. A direct ordinary task begins without a startup card or onboarding ceremony. Read only the sources and packs required by that task.\n4. Explicit guidance requests such as \"I'm new\", \"teach me\", \"help me start\", \"新手\", \"教我用\", or \"點開始\" may load `dev/rules/onboarding.md`. A fresh install marks first-use guidance as `eligible`, so the first unresolved startup must enter onboarding; upgrade must not reset `consumed` or `not_applicable` back to `eligible`. A short message in a non-eligible root only makes guidance available; it never overrides a concrete objective. If no executable objective remains after state reading, ask one concise question or offer guided onboarding.\n\nTreat a phrase as ambiguous only when its ordinary meaning may genuinely refer to a real-world shift, event, or unrelated context. `開工,繼續 <task>`, `<project> 開工`, and `Start Agent Handoff and continue <task>` are continuity commands, not ambiguous phrases.\n\n### Handoff reception and recovery checkpoint\n\nBefore claiming `loaded`, `resumed` or `continuity ready`, complete both gates below. A successful closeout, read command, exit code, digest, section list or summary does not establish reception or understanding.\n\n1. **Receive the whole packet.** Read all of `dev/SESSION_HANDOFF.md`, including its middle and end, from one unchanged file version. A full-file command is only a request: inspect the actual tool result. If output is truncated, omitted, paginated or uncertain, use smaller bounded reads and track contiguous ranges from the start through EOF, with no gaps or mixed versions. Check the entire returned body, not just its header/footer; a tool can retain both ends while omitting the middle. Reread any uncertain range. If the file changes during reading, restart coverage for the new version. Native file tools are valid; compare file identity before/after the read sequence. When an already-available local Kit CLI supports it, `handoff-read --root <root>` offers bounded Unicode ranges; continue with its `nextOffset` as `--offset` and the same `--sha256`, reducing `--max-chars` on truncation. Verify its canonical `root` matches the intended workspace; a root alias is not permission to read an unexpected location. Links below that root are rejected. This helper serves content only. Do not download, install, probe integrations or write a receipt for bare startup. Missing/unreadable content stays incomplete.\n2. **Recover the work.** From that packet, reconcile the user's outcome and consumer, current task's relation to it, completed work and reusable evidence, decision reasons and rejected approaches, remaining obligations/acceptance, exact bounded next action, required fresh sources, and authorization/stop boundaries. Preserve corrections and distinguish historical state from current truth. Use existing section locations as internal evidence; do not create another summary file or dump the packet into the reply. Missing or contradictory facts that prevent safe recovery make the checkpoint incomplete; identify their effect and the smallest clarification/read. A packet that honestly describes blocked work can still be sufficient: show its dependency blocker without inventing completion or requiring every linked source at startup. Eligible first-use TBD state still routes to onboarding; it is not a failed task handoff.\n\nUntil both gates pass, replace the card's `continuity ready` with `continuity incomplete`, use `incomplete` for its handoff status, and name the unread/conflicting scope. Do not begin dependent task work. Complete safe same-file supplementary reads before giving up; elapsed time or a green CLI is not acceptance. Full reception does not prove every historical fact or linked source; follow the normal required-reading gate before an authorized action. Bare startup still ends after its card. With explicit continuation, check the recovered input, output, downstream use and acceptance against the current request, read the necessary sources, and continue within the authorized scope, including multiple steps when completion or the next blocker was explicitly requested; neither the packet nor this checkpoint grants new permissions. These gates also apply after interrupted reads or context compaction when coverage cannot be recovered from actual evidence.\n\n### Current-thread naming checkpoint\n\nDuring explicit continuity startup, naming is a required presentation checkpoint when safe current-thread title control is available, not an optional task. After the minimum authorized startup reads, derive the current objective, boundary and recommended next action; resolve this checkpoint before emitting the final startup card or beginning any same-message authorized task work. Do not defer the tool call until after the final response or until the task is finished. If interrupted before the checkpoint resolves, handle it on the next user-authorized turn using current facts; do not schedule a background rename.\n\nUse `<project name>|<primary action>` from already-loaded facts: the concrete current user task first, then an unresolved current objective, then a concrete recommended action. Do not revive a completed child task from historical handoff text. When the project is known but no concrete action remains, use the project name alone; do not leave a new task named `開工` merely because the previous work is complete. If the project name is unknown, skip without guessing or extra source reads. `Start Agent Handoff`, `開工`, `開始交接工作` and `開始工作交接` are not primary actions. Titles must not contain progress, completion, status, task/session IDs, absolute paths, secrets or unverified facts.\n\nUse the current runtime's exposed tool schema. If a safe current-thread title tool is already available, call it directly; otherwise use a bounded runtime tool-discovery mechanism once with a narrow title/rename/current-thread query, when available. Never invent a tool name or require discovery when the tool is already exposed. Current-title readback is useful when available, but is not required when the tool safely targets the calling/current thread. Replace a generic or stale title; keep an informative title when readback proves it is already relevant, and preserve an explicitly user-chosen title unless the user asks to change it. When the current title cannot be read, use one safe current-thread set call with the derived title. Omit the target identifier only when the schema documents current-thread targeting; otherwise require a verified current-thread identifier. Do not list or inspect unrelated threads solely for naming, and do not create, fork, navigate, message, archive, pin or otherwise manage tasks for this checkpoint.\n\nBefore the final response, resolve the checkpoint as applied (successful tool result confirms the title), kept (relevant or user-chosen title), unavailable (no safe capability), skipped (project unknown), or failed/unverified (error or no confirmation). Use a targeted current-thread readback when available; an ambiguous write requires readback before any retry. Only a verified mismatch permits one safe corrective call; never loop or overwrite a later user rename. Do not assume a universal timing window or automatic-title overwrite across AI apps. An unavailable capability does not block startup; skip silently. A failed/unverified attempted rename gets a brief startup warning, not a success claim. Once resolved, return the card and stop for bare startup. On a later user-authorized turn, revisit naming when the primary task becomes concrete or changes, or a generic/stale title is observed; do not rename for tests, reviews or small substeps.\n\nThe title is display-only; it is not project state, permission, progress, completion evidence, a health result, or a source of truth. This checkpoint permits only the bounded title calls above; it does not authorize project/file writes, network research, external task work, extra startup reads or continuation beyond the startup boundary.\n\nRead `dev/PROJECT_INDEX.md` when the task needs its file, command, integration, workspace, or source map. Read `dev/RULE_PACKS.md` when a task pack must be selected. Read `dev/DOC_SYNC_REGISTRY.md` before durable cross-file or external synchronization and during closeout. Pack loading is normally silent; explain it only when it changes risk, requires a user decision, or materially affects the next action.\n\nIf the user supplies the portable startup prompt, use it to locate the root, then trust the handoff over the mirror. If the root is unclear or mismatched, stop and ask for the intended root before reading or editing project state. Missing required governance files are a repair condition, not permission to invent a parallel structure.\n\nBefore a non-trivial task, identify and read the required local and external truth sources or mark them blocked. Reachable is not the same as ingested. Search hits, truncated output, summaries, and status claims do not replace the relevant source content.\n\nProbe an integration only immediately before a task uses it, when the handoff explicitly identifies it as a dependency for the current objective, or when the user requests an integration health check. `TBD`, examples, blank rows, and undeclared placeholders are not installed integrations. Record `Last Verified` only after a real probe and through the normal persistence gate. Never write integration status merely because a session started.\n\nShow the startup card only for explicit continuity startup. For a plain continuity message, show the card after the minimum state recovery and end the turn; its recommended next action is advice, not permission to act. Render the startup card in a fenced `text` block and preserve spacing so the ASCII status marker remains aligned. The first-use exception above replaces that status-only stop with onboarding only when the handoff state is `eligible`, the objective is empty / `TBD`, and there is no same-message concrete task. An explicit same-message task or long-run continuation may combine the card with its first useful action. Direct ordinary tasks do not show the card. If onboarding is explicitly requested or first-use onboarding is triggered, combine any card and guidance in one response.\n\nFor explicit bare continuity startup, after the handoff is read, the startup card may read only the bounded version evidence from `dev/PROJECT_INDEX.md`: the unique stable-semver `| Agent Handoff Kit template version | X.Y.Z | ... |` row inside the unique real `## Stack` section. Do not route on, summarize, or load any other Project Index content for startup, title, permissions, packs, health, or task work. Missing, unreadable, malformed, duplicate, prerelease, or out-of-Stack-only version evidence prints `version unverified`; the turn remains status-only with zero writes. A direct ordinary or stateless task does not read the handoff or Project Index merely to fill a card or version.\n\n```text\n /\\_/\\ Agent Handoff Kit v<version>\n ( o.o ) continuity ready\n > ^ <\n\n🔎 交接狀態:<loaded / new install / resumed / incomplete>\n📌 目前目標:<current objective>\n⚠️ 注意事項:<important boundary or none>\n🚀 推薦下一步:<one action + reason>\n```\n\nUse the full product name, plain user language, and one recommended next action. Never print the literal placeholder `v<version>`.\n\n## 2. Proportionate Work Loop\n\nApply PLAN → READ → CHANGE → QC internally and in proportion to task state and risk. Do not make the user watch governance ceremony that does not help the task.\n\nIn every user-facing reply, lead with ordinary language: state the result and its practical effect, then the next action when one helps. Put exact commands, errors, hashes, and detailed evidence after that; brevity must not hide uncertainty or safety risk.\n\n- Simple answers, pure conversation or creation with no durable state, and low-risk tasks with an obvious target may proceed directly with proportionate reading and checking.\n- Non-trivial work reads relevant sources before changing them.\n- For failures spanning steps or recurring, trace relevant inputs, processing, saved state and actual consumers until evidence explains the cause and direct impact. Then stop expanding the investigation and repair the affected locations with that cause within the authorized scope; do not turn a simple local fix into a whole-system audit.\n- When repeated attempts produce no improved result, unblocked dependency or new evidence, reassess the cause and method before retrying; preserve useful results. Necessary waits and experiments that yield new evidence are not stagnation. Existing safety and retry limits still apply.\n- High-risk work states scope, impact, acceptance, and required confirmation before writes.\n- External skill flows, subagents, task plans, demo workspaces, and another tool's finish step do not replace the active root's persistence decision.\n- Task-first governance locality: when the user supplied a concrete, actionable, authorized task plan and no safety / source-truth / permission blocker prevents it, follow the plan's main acceptance path before governance side work. Governance may become the main path only when the task itself is governance, the user explicitly asks for governance bridge or long-term governance, the content semantically requires cross-session force, or deferring it would create a safety, continuity, source-of-truth, or discoverability blocker. Otherwise, keep governance to the smallest classification, indexing, sync, or Persistence Gate decision that does not change the main deliverable path; do not start governance bridge, long-term-governance routing, repo-wide scans, handoff writes, or closeout solely because the task mentions Markdown, README, docs, specs, plans, checklists, or generated outputs.\n- Materially changed Markdown governance artifacts must be indexed, synchronized, consolidated into their authoritative home, or explicitly classified as temporary / one-time evidence. Other durable formats follow the same human governance rule, but the bundled doctor does not claim to scan them.\n- Ordinary document edits normally use local read-back and task-specific checks only. If the edited document itself is the target authority and the task does not touch Kit-managed files, migrations, release / closeout gates, external effects, cross-source conflicts, or blockers for safe continuation, do not run `agent-handoff-kit doctor`, write handoff / log state, or regenerate the startup mirror solely because a document changed.\n\n## 2.1 Persistence Gate\n\nChoose exactly one tier after a task:\n\n1. No persistence: no durable fact was produced. One-off answers, transient output, active unapproved drafts, and routine rerunnable checks normally use this tier.\n2. Lightweight checkpoint: a durable fact affects future action while the session continues or may be interrupted. This is the default for ongoing sessions. Write only its smallest correct home; do not perform full closeout. Apply the bounded opening/mirror consistency rule below only when this checkpoint changes actionable state repeated there.\n3. Full closeout: explicit end-of-session / handoff intent, a real day / tool-session boundary, or a state where the current agent cannot continue and the next agent must take over. Ordinary external-tool use, a completed release / governance subtask, or a durable note during an ongoing session is not by itself a full closeout trigger. Load `dev/rules/closeout.md` only when this tier is selected.\n\nPre-closeout checkpoint guard: before writing `dev/SESSION_HANDOFF.md` or `dev/SESSION_LOG.md` without explicit closeout / checkpoint intent, identify the durable fact, why the edited target authority or user-visible answer is insufficient, and why that file is the smallest correct home. Do not write either file merely because the next AI might misread stale state, because a target-authority document changed, or to make the handoff mirror every intermediate step. If the gate selects a checkpoint, update only the named current-state field(s) or one concise log entry; preserve unrelated / historical handoff sections byte-stable where practical. Without the opening-consistency condition below, do not regenerate `START_NEXT_SESSION_PROMPT.txt`.\n\nCheckpoint opening consistency: when an authorized checkpoint changes actionable facts repeated in the `Next Session Opening Message`, reconcile only those affected current facts in that same checkpoint. Derive `START_NEXT_SESSION_PROMPT.txt` from the sole marked opening block only if normalized content differs, then verify the block/mirror and the changed objective, next action and completion boundary agree. Do not merely label an authoritative opening historical while leaving instructions to redo completed work. Preserve unrelated opening text and cold evidence; this condition does not authorize full closeout, new task work, extra source scans or persistence after an ordinary document edit.\n\nDuring an ongoing task, between Persistence Gate decisions, `dev/SESSION_HANDOFF.md` may legitimately trail the read-back target authority. Treat that as expected lag, not drift, and do not update handoff merely to mirror each intermediate step. Still apply the gate when a durable or startup-needed fact must survive interruption, the handoff is the smallest correct home, Kit-managed / release / closeout / external-effect state changed, or full closeout is selected.\n\nRoute current objective, next action, active risk, blocker, and startup-needed facts to `dev/SESSION_HANDOFF.md`; chronological evidence to `dev/SESSION_LOG.md`; maps to `dev/PROJECT_INDEX.md`; sync obligations to `dev/DOC_SYNC_REGISTRY.md`; long-term rationale to `dev/PROJECT_DECISIONS.md`; and reusable procedures to the relevant pack, registered reference, or QA check. Do not store the same task contract or reusable rule in several homes.\n\nExternal effects are never implied permission for commit, push, publish, release, deployment, cleanup, or another workspace write. Record verified external impact through the relevant integrations, release, safety, and closeout contracts without exposing private content or secrets.\n\n## 2.2 Upgrade Completion\n\nThe CLI owns upgrade truth. An upgrade is complete only when:\n\n1. The root is not newer than the CLI and every target passes read-only classification.\n2. Conflict produces zero governance-target and version writes.\n3. Staged outputs pass the offline migration acceptance gate: root boundary, structure, cross-file invariants, preservation hashes, and version transition.\n4. The recoverable transaction commits without an unresolved journal; only a failure caused by this transaction triggers rollback.\n5. Whole-project `doctor` reports project health separately. Pre-existing or unrelated health failures do not convert a correct migration into a destructive rollback; new migration-caused blockers do.\n6. The migration report records attempted version, committed version, transaction state, actions, redacted reasons, and backup locations without credential values.\n\nDo not use \"upgrade completed\" to mean \"the entire project is healthy\". Report `migration committed` and `project health` separately. Conflict, incomplete recovery, failed migration acceptance, and future-version roots are not completed upgrades.\n\n## 3. Safety Baseline\n\nDo not delete, reset, overwrite user-owned content, bulk-move, publish, change permissions, or perform another irreversible or external action without the required explicit authorization.\n\nNamed prohibited destructive commands in `dev/rules/safety.md` remain prohibited even when requested. Never use a weaker pack or local instruction to bypass core safety.\n\nVerify the selected root and real target boundaries before writes. Do not follow a link, junction, mount, or computed path outside the confirmed root. Do not expose credential values in output, reports, backups, tests, or logs. A real permission or lock refusal stops the affected operation; it is not permission to elevate, switch provider or mode, or use a riskier command. Normal platform approval and another already-authorized safe method remain available only after their actual scope and safety are verified.\n\nDo not modify unrelated files or erase unexpected user changes. Do not claim completion without read-back evidence and proportionate checks.\n\n## 4. Closeout Trigger\n\nClear end-of-session or handoff intent such as \"收工\", \"Wrap up Agent Handoff\", \"closeout\", \"wrap up\", or \"handoff\" triggers full closeout, not a chat-only summary. Load `dev/rules/closeout.md` and follow its complete contract. `收工,記得 <handoff requirement>` and equivalent closeout-plus-instruction phrases are clear closeout intent. Ask one concise confirmation only when the phrase genuinely refers to an unrelated real-world closing or shift.\n\nThe always-enforced closeout invariants are:\n\n1. Current state lives in `dev/SESSION_HANDOFF.md`; trace evidence lives in `dev/SESSION_LOG.md`.\n2. Completed, pending, risk, validation, and opening-message lifecycle states agree.\n3. `START_NEXT_SESSION_PROMPT.txt` is regenerated from the sole authoritative handoff block and no third full copy is retained.\n4. Workspace identity is a last-verified snapshot. Live root / Git / worktree truth belongs to `agent-handoff-kit workspace-health --root <project root>` or equivalent read-only Git probes, not to stale prose.\n5. Closeout is not complete until required files are written, read back, and the available closeout checks pass.\n6. After those checks, render the final card with `agent-handoff-kit closeout-status --root <project root>`; only its `status: complete` output may say `handoff saved`. A nonzero / `blocked` result is an honest blocked closeout, not a completed one.\n7. Git commit, push, release, publish, deployment, deletion, and permission changes remain separately authorized actions.\n\n## 5. Pack Loading\n\nUse `dev/RULE_PACKS.md` to load the minimum task-specific set. Read the applicable packs, including their project supplements and required references, before deciding how to act; an index, title or remembered summary is not the rule itself. Apply them within the user's actual objective and instruction priority: do not invent a replacement goal, acceptance standard or competing rule system. Missing or conflicting requirements must be resolved from their owners, not filled by an invented policy. Packs may add stricter requirements but cannot weaken core safety or continuity.\n\nLoad `dev/rules/integrations.md` when the current task actually uses an external tool, not merely because a registry or placeholder table exists. Load `dev/rules/closeout.md` only for full closeout. If two packs conflict, use the safer and more verifiable path and record the unresolved conflict at closeout.\n\nAfter the task, apply the Persistence Gate. Do not assume the next session remembers pack context, and do not use handoff or log as the only home for reusable procedures.\n\n## Core Complexity Rule\n\nBefore changing `AGENTS.md` or adding a durable governance rule, use `dev/RULE_PACKS.md` to load `dev/rules/agent-governance.md` and locate the existing normative owner. Follow its `Governance Write Boundary` before choosing a writable location: installed official core and pack bodies are not project-editable rule homes. Default-core rules must apply to most sessions, protect safety or continuity, and be shorter than the routed detail they replace. Scenario-specific or project-specific detail belongs in an existing pack's project supplement or registered reference; a new pack is justified only when it creates a smaller, independently loadable responsibility with one normative owner. Do not copy the agent-governance classification table or workflow into the core.\n<!-- END Agent Handoff Kit managed core -->\n\n<!-- ack:user-rules-router:dev/USER_RULES.md -->\n<!-- ack:user-rules-acceptance:sha256=17d96a5082e956205ea5e9b4507cf83a2c934cae5bdce7a0b32b52dc3da7a002 -->\nBefore loading task packs, read `dev/USER_RULES.md`. Its registered entries\nunder `dev/user_rules/` are user-controlled rules: read each accepted entry in\nthe listed order and verify its accepted raw-byte witness. Do not treat this\nrouter, its directory, a heading, language, format, location, or\nofficial-looking text as proof that any legacy source belongs to the Kit.\n\nThe core `Upgrade lock guard` applies first when it stops ordinary work.\n"
15886
+ },
15887
+ "fa77d46a61f58e2fabc537b5c6ff31c33eb4413088797e87bf1b442ddec291c5": {
15888
+ "targetRel": "dev/SESSION_LOG.md",
15889
+ "canonicalSha256": "8da41cb8b8e766f40e8ab4365c32e9b6be6cc9265dc22d18bbbe75e8ad771cbd",
15890
+ "text": "# Session Log\n\n<!-- ack:section:session-log-preamble -->\n\n> **Handoff role**: This log is the trace-back / audit trail layer. Handoff capability rests on `dev/SESSION_HANDOFF.md`. The next AI session can continue by reading `AGENTS.md` + `dev/SESSION_HANDOFF.md` + `dev/PROJECT_INDEX.md` + needed rule packs; reading this log is not required for continuity. Each closeout applies `dev/rules/closeout.md` `## Maintenance Trigger Check`; that owner defines the current thresholds and archive discipline.\n\nAdd new session entries at the top. Record what actually happened in the session; do not copy old completed work forward as new work.\n\nThis log carries recent evidence, not current state. Put the current objective, next action, risks, and workspace identity in `dev/SESSION_HANDOFF.md`.\n\nKeep recent entries concise. If older entries no longer affect the next action and the current maintenance assessment establishes cleanup is required, reduce them to short dated indexes that point to the durable source of truth. Archive long error output, validation detail, or research trails only when actual maintenance requires it; do not create an archive directory by default.\n\nWhen current work requires a log entry, record whether relevant older detail was kept, summarized, or archived, and any actual maintenance or unresolved preservation risk. Do not create an entry solely for a size advisory. Do not remove validation evidence or unresolved risks. The full opening message never belongs in this log.\n\n<!-- ack:section:session-log-entry-template -->\n\n## Entry Template\n\nOptional concise fields at normal authorized saves: `Work` identifies a related handoff Work Items ID; `Title zh-Hant` and `Summary zh-Hant` provide Chinese display text. An optional `Event ID` uniquely identifies an event across a move or correction; the existing `ID` identifies the agent/session and is not an event identity. Omit unknown or unnecessary fields. Do not rewrite old history or create extra entries to refresh a dashboard.\n\n````markdown\n<!-- ack:log-entry:start -->\n## <YYYY-MM-DD> — <short session title>\n\n- **ID:** <agent_or_session_id>\n- **Summary:** <one sentence>\n- **Changed:** <files changed, or none>\n- **Done:** <work completed this session>\n- **QC:** <checks run and results, or why not run>\n- **Evidence disposition:** <one-time only / kept as recent trace evidence / absorbed into handoff / indexed in PROJECT_INDEX / promoted to PROJECT_DECISIONS / promoted to rule pack>\n- **Sync:** <doc/external sync status>\n- **Pending:** <next work>\n- **Risks:** <known risks or none>\n- **Log maintenance:** <actual maintenance action, preservation risk, or not_applicable>\n- **Opening-message mirror:** <regenerated and verified / blocked; full text omitted by design>\n<!-- ack:log-entry:end -->\n````\n"
15891
+ },
15892
+ "23daf5c72689add04511e62f8d7c354706b7c302a0188c7d0cf2e8cbcfc301d3": {
15893
+ "targetRel": "dev/PROJECT_DECISIONS.md",
15894
+ "canonicalSha256": "6d41cfe8799cad57587d75458b086434abb842ac91b72274b432454c710546b5",
15895
+ "text": "# Project Decisions Log\n\nThis file stores long-term project evolution, decisions, architecture trade-offs, and accumulated learning observations. It is a warm narrative layer. AI agents do not need to read this file at startup unless the current task asks for historical rationale or the closeout maintenance trigger says to update it.\n\nShort single-task projects can leave this file nearly empty. Long-running projects use it for substantive task evolution, a multi-option architectural choice with rationale, or cross-session learning. Closeout count thresholds are maintenance advisories, not a reason to invent a decision entry or sweep unknown historical material. When the user asks why earlier choices were made, this file is the first long-term narrative reference.\n\nThe user is not expected to maintain this file manually. The AI updates it during closeout when required, and may record major decisions when they happen.\n\nResearch-derived decisions use this compact evidence-chain format inside the relevant section, without creating a new section:\n\n```text\n- YYYY-MM-DD [research-derived] Decision summary. Evidence chain: Source=source:<id>; Summary=<source finding>; Inference=<reasoning>; Decision impact=<what changed>; Uncertainty=<limits or none>.\n```\n\nThe `source:<id>` token must also appear in `dev/PROJECT_INDEX.md` under `Fact Base` or `External Sources`, so later sessions can trace the decision back to its source map.\n\nThis file does not store raw build / upload / QC evidence, current next actions, one-time task results, or reusable operating procedures. Keep those in `dev/SESSION_LOG.md`, `dev/SESSION_HANDOFF.md`, or the relevant rule pack / registered reference.\n\n---\n\n## Evolution Timeline\n\nLong-term narrative of task or product evolution. Newest first. Append when the AI observes substantive task evolution.\n\n(empty)\n\n## Decisions Archive\n\nOlder decision entries may move from `SESSION_HANDOFF.md` only when `dev/rules/closeout.md` identifies an actual preservation, continuation, semantic, or project-specific need. A threshold advisory alone does not force splitting or sweeping unknown material. Newest first.\n\n(empty)\n\n## Architecture Choices\n\nMajor architecture choices and rationale. Append when planning involves a multi-option trade-off and the selected path has been confirmed.\n\n(empty)\n\n## Insights & Learnings\n\nAccumulated lessons, reflections, and cross-session patterns. Append when the AI observes a recurring pattern across sessions.\n\n(empty)\n"
15896
+ },
15897
+ "c0d63d30bd1be62f11ceb5146c4716a8b8eb61dd5d9aa34518196de528333cea": {
15898
+ "targetRel": "dev/rules/agent-governance.md",
15899
+ "canonicalSha256": "882780d38aae36d1693f65ba24ecfe6a3c7ee000d2875e2abb2508a13f4f7679",
15900
+ "text": "# Agent Governance Pack\n\n## Scope\n\nUse for governance rules, prompts, agent instructions, handoff systems, startup/closeout behavior, skills, and rule packs.\n\n## Load When\n\n- User asks to change AI behavior, project governance, prompts, handoff, startup, closeout, or tool-use rules.\n- A change affects `AGENTS.md`, `dev/*`, rule packs, installer templates, or durable workflow docs.\n- User asks to bridge governance, connect a document to governance, scan for unbridged governance documents, or uses equivalent Chinese phrases such as \"治理打通\", \"把文件接入 Agent Handoff Kit\", \"接入 Agent Handoff Kit\", or \"掃描未接入 Agent Handoff Kit 的重要文件\".\n- User asks to make something long-term, cross-session, reusable, future sessions should remember an API / MCP / tool-use pattern, or uses equivalent Chinese phrases such as \"寫入長期治理\", \"轉成長期機制\", or \"之後都要遵守\".\n- The task creates or materially changes Markdown governance artifacts, source-of-truth files, durable workflow docs, or durable artifacts that future agents may need to discover. Ordinary target-authority documents, drafts, and user-task deliverables do not load this pack solely because they are Markdown or generated.\n\n## Rules\n\n1. Locate the existing source of truth before adding a rule. Read the matching categories in `dev/RULE_PACKS.md`, their applicable packs, project supplements and required references first; then apply `Governance Write Boundary` below. A matching topic does not make official prose writable.\n2. Prefer merge, replace, or registry rows over append-only rule growth, within the verified project-owned location. Change an existing project rule in place rather than duplicating it in another file or appending an override.\n3. Keep public runtime rules generic; project-specific incidents belong in logs, runbooks, or project index.\n4. Do not let development-only workspace rules enter public runtime.\n5. Check complexity budget before adding default-core behavior.\n6. Before creating durable workflow, runbook, or instruction files, first classify the knowledge type and verify whether an existing home can carry it without a new file: current state belongs in `dev/SESSION_HANDOFF.md`; trace evidence belongs in `dev/SESSION_LOG.md`; file / command / reference maps belong in `dev/PROJECT_INDEX.md`; sync obligations belong in `dev/DOC_SYNC_REGISTRY.md`; reusable operating procedures belong in the relevant rule pack or registered reference. New runbooks are last resort only.\n7. When a task uses external skills, subagents, demo workspaces, or another tool's closeout, treat those flows as subordinate to the active root's Agent Handoff Kit governance. The active root still needs the installed `AGENTS.md` Persistence Gate decision; do not duplicate the gate thresholds in this pack.\n8. Before any pre-closeout handoff / log write for governance work, apply the core Persistence Gate explicitly. A concern that future agents may read stale handoff is not enough when the changed rule, spec, runbook, or document is itself the target authority; leave handoff lag expected unless checkpoint conditions are met. When the gate does select a checkpoint, write only the smallest current-state field or concise log entry and leave historical evidence sections byte-stable where practical.\n9. For long-running projects, maintain `dev/PROJECT_DECISIONS.md` under `dev/rules/closeout.md` `## Maintenance Trigger Check`: capture major decisions when they happen and run the short assessment at every closeout. Counts may prompt review, but do not force a historical sweep or create a no-op log record without an actual preservation, continuation, semantic, or project-specific requirement. Short single-task projects keep this as a no-op default; users are not expected to edit this file manually.\n10. Governance bridge is a triggered review, not a default startup scan. Use it when an important file, source-of-truth document, runbook, production guide, workflow, checklist, stock list, or similar durable document may need to be connected to project governance.\n11. Content-based trigger: long-term governance routing is content-based, not trigger-only. Even if the user does not use explicit governance-routing phrases, treat a statement as durable governance when it says future sessions must follow it, when it corrects a recurring AI mistake, or when it defines a reusable API / MCP / tool-use pattern. Do not persist long-term governance knowledge only in `dev/SESSION_LOG.md`, `dev/SESSION_HANDOFF.md`, or `START_NEXT_SESSION_PROMPT.txt`; those surfaces may be compressed, archived, or regenerated.\n12. Mid-task changes to product goals, requirements, development checklists, acceptance rules, exclusions, priorities, or scope are task contract changes. Before writing them, check whether the same contract already lives in a spec, backlog, issue list, README, runbook, project index entry, or handoff section. Merge into the existing authoritative home, then leave only a pointer or current-state summary elsewhere.\n13. New Markdown or generated documents are not automatically harmless. After creating or materially changing them, classify each artifact before completion: source of truth, reference, runbook, workflow, checklist, public document, generated output, one-time evidence, draft, or temporary. Durable artifacts must be discoverable from `dev/PROJECT_INDEX.md` or intentionally tied to a registered sync / source-of-truth row. Temporary or one-time evidence must be labeled as such in the task record or closeout so future agents do not treat it as hidden current state.\n14. Do not create a new document to hold a rule, requirement, checklist, or process if an existing authoritative document can carry it. Merge into the existing home or make the new document explicitly subordinate. If two files now carry the same durable instruction, resolve the duplicate by choosing one authoritative home and pointing the other to it.\n\n## Governance Write Boundary\n\nThis is the single write-location contract for installed projects, not for authorized Kit source development. It guides agent edits; it cannot intercept arbitrary editor writes.\n\n1. Classify the change before writing. Use the existing task category and normative owner; read the full relevant rule and its project supplements. A current task instruction is not automatically a durable rule. Do not create a new goal, acceptance threshold or balancing policy merely to reconcile your preferences with the user's request. Follow instruction priority; surface a material unresolved conflict instead of silently inventing an override.\n2. Treat the `AGENTS.md` managed-core region and complete official `dev/rules/*` pack bodies as protected. Daily project edits must not insert, translate, reformat, reorder or remove their contents or delimiters. Verify the installed version's official content before identifying the boundary; a heading, marker or version row alone is not ownership proof. Formal upgrade or an explicitly scoped repair owns official changes. If local rules are already interleaved, preserve them and report the required bounded reconciliation; do not guess which lines to delete or bless the mixed body as official.\n3. Reuse the matching pack's existing project supplement when it owns the rule. Otherwise place a short local rule after the entire verified official body under `## Project Rules`; preserve the official trailing newline. This heading labels the writable appendix, not the end of official ownership. For substantial or shared procedures, reuse a registered project reference; create a new reference only if no suitable owner exists. If `dev/USER_RULES.md` formally owns the rule, use its accepted update procedure rather than editing witnessed bytes or creating a competing copy. Always-needed project entry rules may live outside the managed core only after checking their existing owner.\n4. Preserve project-state schemas separately: edit handoff fields, actual log entries, index data or registry rows in their existing writable sections; do not insert policy into template instructions or alter machine markers. Preserve official routing rows in `dev/RULE_PACKS.md`; add a project row only when a project reference needs a task trigger, naming both the relevant pack and reference. A same-pack appendix uses that pack's existing route. Do not add a route or load a pack merely for bare startup.\n5. Before and after an ordinary project-rule edit touching core or pack files, compare the complete protected region against the verified input; every protected byte must remain unchanged. For a formal upgrade or explicitly scoped repair, verify the approved official diff against the verified input and perform its required readback instead; preserve interleaved or unknown user content and do not guess which bytes to remove. Use the installed-version CLI's read-only `upgrade --dry-run --root <project root>` where that lifecycle applies; record the CLI version and any existing conflict separately. A pre-existing conflict requires reconciliation before claiming the write boundary is verified. A new conflict or a change outside the approved scope prevents completion; restore only your own scoped change from its verified input without discarding concurrent or pre-existing user work. For ordinary project-state edits, use schema/marker and local readback checks instead of an upgrade preview.\n6. Read back the rule from its normal consumer path: task signal -> router -> relevant pack including the project supplement and required reference -> requested action. Verify its exact requirement, scope and precedence, and that unrelated packs stay unloaded. An indexed file that no applicable route reads is not connected. Evidence must show both correct application and preserved upgrade compatibility; a successful preview alone does not prove an AI followed the rule.\n\n## Governance Bridge Workflow\n\nUse this workflow when the user asks for governance bridge, connect this document to governance, asks to scan for unbridged governance documents, or uses equivalent Chinese phrases such as \"治理打通\", \"把文件接入 Agent Handoff Kit\", \"接入 Agent Handoff Kit\", or \"掃描未接入 Agent Handoff Kit 的重要文件\".\n\n1. Identify the target. If the user named a file, inspect that file and its surrounding directory. If no file is named, run a bounded repo scan for likely durable documents such as source-of-truth files, runbooks, workflows, guides, checklists, stock lists, production guides, and rules.\n2. Check the target file itself: it should state its role, scope, update trigger, owner or responsible workflow when known, and what must not be inferred from it.\n3. Check `dev/PROJECT_INDEX.md`: the file should be discoverable with its role and \"read when\" condition. Source-of-truth or reference files should appear in Fact Base, External Sources, Directory Map, Entry Points, or another existing indexed home that fits the project.\n4. Check `dev/DOC_SYNC_REGISTRY.md`: future same-type changes should have a matching change type or an explicit reason no durable sync rule is needed.\n5. Check related workflows, guides, runbooks, or rule packs: if a process creates or updates the file, that process should say when to update the file or its index row.\n6. Check `dev/SESSION_HANDOFF.md`: only current state, recommended next action with reason, unresolved risk, blocker, or a startup-needed fact should be in handoff. Do not copy whole documents or old evidence into handoff.\n7. Check `dev/SESSION_LOG.md`: this session's bridge review, validation, and evidence can be logged when it affects future action, but log entries must not become current state.\n8. Search for duplicate source-of-truth risk. If another file has the same durable role, recommend merge, reference, or retire options; do not delete, rename, or move files without explicit approval.\n\nFor repo-wide scans, report candidates as candidates. Do not fail ordinary docs merely because they are not indexed; only durable files that future agents need to discover, update, or distinguish from drafts should be bridged.\n\nOutput format:\n\n- Status: bridged / partially bridged / unbridged / blocked.\n- Use bridged only when every applicable governance link is present. If only `dev/PROJECT_INDEX.md` or `dev/SESSION_LOG.md` was updated, report partially bridged.\n- Already bridged: list the governance links that are present.\n- Gaps: list missing links and why they matter for the next agent.\n- Not applicable: list skipped layers with a reason.\n- Suggested patches: list exact files and sections to update.\n- Manual decisions: list duplicates, naming choices, deletion, renaming, external sync, or ownership questions requiring user confirmation.\n- Acceptance: give one concrete check that proves the bridge is complete.\n\n## Generated Artifact Governance Workflow\n\nUse this workflow whenever the current task creates or materially changes Markdown documents or other durable artifacts, even if the user did not explicitly ask for governance bridge.\n\nThis workflow is subordinate to the core task-first governance locality rule. Use it as a proportionate classification / routing check, not as permission to interrupt an explicit user task plan, start a repo-wide governance scan, or turn an ordinary user-task deliverable into governance work.\n\n1. List the artifacts created or materially changed in this task.\n2. Classify each artifact: source of truth, reference, runbook, workflow, checklist, public document, generated output, one-time evidence, draft, or temporary.\n3. For source-of-truth, reference, runbook, workflow, checklist, public document, and reusable generated output, update `dev/PROJECT_INDEX.md` so the file is discoverable with a role and read condition.\n4. For artifacts that require future mirror, external index, publication, or repeated sync, update `dev/DOC_SYNC_REGISTRY.md` or record why no durable sync rule applies.\n5. For one-time evidence, draft, or temporary files, record that classification in `dev/SESSION_LOG.md` or the task summary, and do not promote it to current handoff unless it affects the next action.\n6. Search for duplicate source-of-truth risk before keeping a new document. If another file already owns the same rule, requirement, checklist, or process, merge into that file or make the new document explicitly subordinate.\n7. Before claiming completion, explicitly confirm the artifacts created or materially changed in this task have been classified, indexed, synchronized, consolidated, or marked temporary through the steps above. Existing target-authority documents that only received a local content edit normally need read-back and task-specific validation, not a handoff / log write or a bundled doctor run. You may run the available project governance check and `agent-handoff-kit doctor` only for scoped Kit / typed registered-surface checks; doctor does not discover unregistered ordinary workspace files and cannot replace explicit changed-artifact review.\n\n## Long-term Governance Routing\n\nUse this workflow when the user asks to write something into long-term governance, turn an experience into a mechanism, make a rule apply across sessions, or when the content itself clearly has durable force.\n\n1. Classify the knowledge before writing:\n - Current task contract changes, including product goals, requirements, development checklists, acceptance rules, exclusions, priorities, or scope -> the existing authoritative spec / backlog / issue / runbook when one exists; otherwise `dev/SESSION_HANDOFF.md` current-state sections.\n - Current task state, recommended next action with reason, unresolved risk, or startup-needed fact -> `dev/SESSION_HANDOFF.md`.\n - Chronological evidence or validation trace -> `dev/SESSION_LOG.md`.\n - File maps, command maps, API reference locations, tool capability maps, and external source coordinates -> `dev/PROJECT_INDEX.md`.\n - Sync obligations or external mirror duties -> `dev/DOC_SYNC_REGISTRY.md`.\n - Durable decisions, architecture trade-offs, research-derived rationale, and long-term lessons -> `dev/PROJECT_DECISIONS.md`.\n - Reusable procedures, recurring mistake prevention, API / MCP / tool-use rules -> the relevant rule pack, registered reference, or QA check.\n - API / MCP / tool-use patterns -> project index / registered reference / integrations pack, depending on scope.\n2. If the knowledge is reusable but no existing home fits, propose the smallest new registered reference or rule-pack patch. New runbooks remain last resort.\n3. If the knowledge was first captured in `SESSION_LOG` or handoff for short-term continuity, promote it to the correct durable home before claiming it is long-term.\n4. Add or update a QA check when the same failure class could recur and can be tested.\n5. Repeat-failure escalation: when the same failure class recurs after an AI has already claimed a durable fix for that class, do not continue with another same-pattern patch as ordinary work. Limit the escalation to the affected domain: identify the authoritative owner, correct or remove the failed method there, add a counterexample or replay check that would have failed before the fix when feasible, and state the temporary constraint. If the failure recurs again after that root-fix validation, separate the change and validation roles where the runtime provides an independent reviewer, subagent, or fresh-context pass; when none is available, perform a fresh read-back pass against the replay check and mark independent review unavailable instead of blocking unrelated work. Restore normal flow as soon as the replay and review / read-back pass. Do not create a central penalty database, cross-project blacklist, permanent role split, or public rule carrying project-specific incident details.\n6. Keep governance bridge wording reserved for document orphan prevention. Do not relabel non-file governance as \"file connected to Agent Handoff Kit\".\n\n## Checks\n\n- Verify affected files are indexed or intentionally installed templates.\n- Check `dev/DOC_SYNC_REGISTRY.md` for governance, closeout/startup, and README sync rows.\n- Confirm old overlapping wording was retired or marked legacy.\n- Confirm any new durable file is reachable from `dev/PROJECT_INDEX.md` and does not rely only on a one-session handoff note.\n- Confirm every Markdown document or generated artifact created in this task is indexed, synced, consolidated, or explicitly classified as draft / temporary / one-time evidence.\n- Confirm no new file has become a parallel source for an existing rule, requirement, checklist, or process.\n- Confirm reusable operating procedure knowledge is not stored only in `dev/SESSION_HANDOFF.md`, `dev/SESSION_LOG.md`, or a decision narrative when it belongs in a pack or registered reference.\n- Confirm long-term governance knowledge is promoted out of `dev/SESSION_LOG.md`, `dev/SESSION_HANDOFF.md`, and `START_NEXT_SESSION_PROMPT.txt` when it should survive log archive or prompt regeneration.\n- Confirm repeat-failure escalation, when triggered, is limited to the affected domain, tied to the authoritative owner, backed by a counterexample or replay check when feasible, and does not create a central penalty store, cross-project blacklist, or permanent role split.\n- For governance bridge work, confirm the target file, project index, sync registry, related workflow, handoff/log role split, and duplicate-source risk were all checked or explicitly marked not applicable.\n- For governance bridge work, run bounded searches for the target path/name and the relevant artifact class or sync-change type across the project index, sync registry, related workflows, and current rule owners. If the target is tied to generated outputs, also inspect the workflow or production guide that creates those outputs. Search evidence is a check, not a second source of truth.\n- Before claiming completion, apply the active root's core persistence gate and record the result only when that gate selects a checkpoint or full closeout; do not assume child or demo workspaces cover the parent/root workspace.\n- For long-running projects, confirm `dev/PROJECT_DECISIONS.md` retains its four H2 sections in order (Evolution Timeline / Decisions Archive / Architecture Choices / Insights & Learnings) and apply the closeout maintenance assessment. Record only actual maintenance or a current risk; do full work only for an actual preservation, continuation, semantic, or project-specific requirement. A count alone does not force a historical sweep or no-op record.\n\n## Closeout\n\nRecord the changed rule home, reason, complexity impact, retired wording, and follow-up checks.\n"
15901
+ },
15902
+ "ef9b8179cf351edf8abc77754ec8df630097d9770f6c7e7fe16e1b26a94a2337": {
15903
+ "targetRel": "dev/rules/closeout.md",
15904
+ "canonicalSha256": "cf9095ac53bf6216ed7106c3abe694b5a4beeee7128cd5eff87c26629524636a",
15905
+ "text": "# Closeout Pack\n\n## Scope\n\nThis pack is the single detailed contract for full Agent Handoff Kit closeout. Load it only for clear end-of-session or handoff intent. It does not authorize Git, release, publish, deployment, deletion, permission, or cleanup actions.\n\n## Required Reads\n\nReceive the current `dev/SESSION_HANDOFF.md` in full; in the same session, reuse only evidence already fully received from the unchanged file, and supplement every unread, truncated, or changed range. Read the current-session-relevant `dev/SESSION_LOG.md` entry, carry-forward risks, and any actual maintenance need. Read the affected complete command, route, rule, source, workspace mapping, and any required supplement in `dev/PROJECT_INDEX.md`; do not replace that reading with keyword hits. Classify every applicable `dev/DOC_SYNC_REGISTRY.md` obligation. Read `dev/PROJECT_DECISIONS.md`, integration rules, or another pack only when its closeout trigger or the session's actual work requires it.\n\n## Write Contract\n\nUse Kit markers as machine boundaries: `ack:section:*`, `ack:field:*`, `ack:log-entry:start/end`, and managed-core BEGIN/END. Human headings may be localized; markers may not be removed or translated.\n\n- Current state, objective, recommended next action, active risk, blocker, required reading, workspace identity, and sync status belong in `dev/SESSION_HANDOFF.md`.\n- When saving meaningful work changes, maintain the handoff's concise `Work Items` table using its declared fields, and keep project-wide name/goal in `PROJECT_INDEX` `Project`. Add the table/section to older projects only at an authorized state save when useful. Reconcile changed statuses against the evidence; do not duplicate full reports, rewrite old history, or create per-terminal-step records for the dashboard. Read-only dashboard viewing never triggers these writes.\n- Chronological work and evidence disposition belong in `dev/SESSION_LOG.md`.\n- File / command / source / capability maps belong in `dev/PROJECT_INDEX.md`.\n- Recurring sync obligations belong in `dev/DOC_SYNC_REGISTRY.md`.\n- Long-term evolution, architectural rationale, and accumulated learning belong in `dev/PROJECT_DECISIONS.md` when triggered.\n- Reusable procedures belong in the relevant pack, registered reference, or QA check.\n- `START_NEXT_SESSION_PROMPT.txt` is generated only from the handoff opening-message block.\n\nDo not copy the full opening message into `dev/SESSION_LOG.md` or any third current governance file. The log records whether the mirror was verified no-op or regenerated and verified, plus an evidence reference when useful.\n\n## Full Closeout\n\nFull closeout is differential and write-minimal. Update only fields whose current truth changed. For unchanged state, preserve bytes where practical and record checked/no-op only when it helps the next agent. A same-session fully received unchanged source may be reused; incomplete, truncated, or changed sources require supplementary reading before relying on them. Reuse a completed task check only when its recorded root, task input, tool identity, commit / artifact identity, and required file hashes still match the current state. Do not rerun task QA that is already bound to unchanged identity. Do rerun checks affected by closeout writes, gates that are incomplete or indeterminate, closeout-specific checks, and the final `closeout-status` read-back. If a closeout attempt is interrupted, stopped, aborted, times out, or hits a spawn / transport error, resume at the first incomplete or indeterminate gate; do not restart from the beginning unless the root, input, tool identity, commit, artifact, or relevant hash changed.\n\nHandoff cold zones are historical / evidence sections, old validation records, completed-work narratives, and unchanged durable anchors. Stable anchors and decision-changing current facts stay in the packet. Do not rewrite, reword, reorder, or refresh cold zones for ceremony or style. When older detailed narrative no longer changes the next action, preserve it byte-for-byte in existing trace/archive storage and verify that copy before removing it from the current packet. Do not rewrite or archive unchanged material at every closeout, impose an arbitrary size cap, or weaken the required full reception of the current packet.\n\n1. Reconcile `dev/SESSION_HANDOFF.md`; never append a new current-state snapshot beneath an old one. Verify durable anchors, then update only changed closeout-reconciled fields or sections; leave already-current sections unchanged instead of rewriting them for ceremony.\n2. Reconcile lifecycle state across `Completed This Session`, `Validation / QC`, `Next Priorities`, `Risks / Blockers`, and `Next Session Opening Message`. Completed or verified work cannot remain unresolved unless explicitly reclassified as monitor-only, follow-up scope, blocked, or reopened with its missing evidence or trigger.\n The bundled doctor is a mechanical floor for required lifecycle markers and readable sections only. `agent-handoff-kit closeout-status` checks explicit lifecycle declarations and same-scope textual contradictions; it does not prove natural-language semantic consistency. When it blocks, inspect its first `Resolved [...]` / `Carry-forward [...]` pair against the actual evidence: completion of one action does not complete another acceptance scope, and a preserved limitation is not a completion claim. Repair a real contradiction in its owning handoff section. If truthful, distinct scopes are misclassified, preserve the facts, report the checker defect and stop wording retries; do not add a reclassification prefix, invent a trigger, erase a limitation or broaden governance just to pass. A blocked result remains blocked until verified repair. Read all five sections as a whole before marking the lifecycle field resolved. For governance, release, or another project-defined high-risk completion, use the project's independent semantic review gate in addition to `closeout-status`.\n3. Make `Next Priorities` name one recommended next action and a short reason unless blocked or a real user decision is required.\n4. Complete the persistence-routing, handoff-sufficiency, `Closeout outcome`, and `Project-required persistence` fields. Apply the packet-only reconstruction check below before answering handoff sufficiency. The next agent must be able to continue from `AGENTS.md`, the handoff, the project index when needed, and routed packs without searching old log history. `complete` is allowed only when all required writes/read-backs and any project-required persistence succeeded; use `not_required` only when that persistence is genuinely not required. If a required commit, push, release record, or equivalent persistence is blocked or not authorized, set both fields to `blocked` with the exact boundary.\n5. Add one concise log entry only for current work, risk, actual maintenance, or another durable fact that a later agent needs. Record evidence disposition and the prompt-mirror verification result when an entry is needed; omit the full opening message by design. A no-op closeout must not create a false work record.\n6. Update the project index only when affected complete mappings, rules, or supplements changed. Classify every applicable sync-registry target as `confirmed`, `unverified`, `pending`, `blocked`, or `not_applicable`.\n7. Run `agent-handoff-kit workspace-health --root <project root>` or equivalent read-only Git probes, then record only the last-verified root, Git root, branch, commit, worktrees / parallel workspaces, uncommitted changes, and unresolved drift. Do not clean or change them without separate authorization. Do not treat `dev/PROJECT_INDEX.md` or old handoff prose as the live worktree truth.\n8. If the session used external tools or helper processes, apply the integrations and safety ownership rules. Close only task-owned resources. Retain shared, user-owned, other-agent-owned, system, or ambiguous resources unless separately authorized; state visibility limits.\n9. Run the short maintenance assessment below. Record only actual maintenance work or a current risk; do not create a log entry solely to report a size advisory.\n10. Mark first-use guidance `consumed` after the first successfully completed task or first full closeout. Upgrade must never reset `consumed` or `not_applicable` to `eligible`.\n11. Verify `START_NEXT_SESSION_PROMPT.txt` against the sole fenced handoff opening-message block first. Regenerate it only when normalized content differs, then run the project's fixed prompt-mirror checker or perform an equivalent anchored read-back that verifies marker, heading, fence, full-copy uniqueness, and normalized content equality.\n12. Run available project-specific closeout checks. Do not run a separate bundled `doctor`: the `closeout-status` command below performs the one required fresh doctor read-back. Do not treat an external update-check failure as local closeout failure. Fix state or mirror failures before claiming handoff ready.\n13. Run `agent-handoff-kit closeout-status --root <project root>` after the handoff and prompt read-back. It performs the one required fresh doctor read-back plus a read-only workspace-health comparison against the handoff snapshot, and its output is the only final card source. A nonzero result means the closeout is blocked; do not replace it with a success summary.\n\n## Packet-Only Reconstruction Check\n\nBefore closing out, reconstruct the next task using only the handoff, without chat memory, old logs or opening linked sources. Identify the parent outcome and consumer, the current step's relation to it, the exact resume point, remaining step/parent acceptance, and required sources with revision/freshness, reading scope/depth and unread gaps. Also recover decision-changing user corrections, reasons for accepted/rejected approaches, reusable artifacts with their evidence limits, every remaining consequential obligation and its downstream use, and permission/stop boundaries. Cite the owning handoff sections in `Reconstruction evidence`; do not create a second task summary. Then compare that reconstruction against the user's actual request and the relevant sources read this session. Missing, contradictory or assumed critical facts must be repaired in their existing handoff sections or explicitly recorded as blockers with the next clarification/read needed. Do not answer yes on labels or a successful CLI card alone: the CLI checks the recorded answer and evidence presence, not the truth of this reconstruction.\n\nCheck whether a reader could repeat a rejected attempt, redo accepted work, omit an obligation, act on obsolete instructions, or choose a plausible but wrong next action while still agreeing with the packet's headline. If so, preserve the missing decision-changing fact in its existing owning section, not merely in a linked historical log. Keep the packet sufficient and proportionate; do not paste the whole chat or silently discard important facts to fit an output limit. Transport truncation is handled by the core reception checkpoint, not by weakening the task.\n\nCloseout verifies this session's saved packet. It cannot certify that a future reader received or understood it. Do not describe `closeout-status: complete` as successful future-session reception; the next agent must pass the core Handoff reception and recovery checkpoint independently.\n\nKeep one `Answer:` line (`yes`, `no` or `unknown`, with optional explanation) and one `Reconstruction evidence:` line inside the marked sufficiency section. An affirmative answer requires concrete section references; keep `next-ai-can-continue` consistent. For an older handoff, add missing facts to its existing sections at this authorized closeout; upgrade must preserve user state and must not invent reconstruction evidence. Missing or negative answers, placeholder evidence and duplicate fields block `closeout-status` without changing project files.\n\nUse only the depth needed to resume safely. A standalone task needs no invented parent tree; state that it is the whole task. Finishing a child does not complete its parent or authorize another step. Keep the next consequential action bounded by its input, output and acceptance; do not enumerate every future microstep. Keep decision-relevant terms and identifiers faithful; when a translation could change their meaning, retain the original term alongside it. Reading coverage is previous-session evidence, never permission for the next agent to skip required fresh source reads. Honest blocked-work handoff can be sufficient when the missing fact, impact and safe next action are explicit.\n\n## Maintenance Trigger Check\n\nEvery full closeout runs this short assessment. It reports potential maintenance, but a pure `SESSION_LOG` size advisory is not a `closeout-status` blocker.\n\n- SESSION_LOG: at 11 or more entries, more than 1500 lines, or a due 10-closeout backstop, report the shared maintenance advisory. Do full maintenance only when the current work establishes an actual preservation or continuation need, or a project-specific contract requires it. Keep recent safety-buffer entries; collapse only content already absorbed by an authoritative home. Before shortening an active source, verify the preserved copy. Archive older raw entries to `dev/SESSION_LOG_archive/archive_<batch>_<low_date>_to_<high_date>.md` and maintain `INDEX.md` only when archive work is actually performed. Unknown count alone does not force a historical sweep.\n- PROJECT_DECISIONS: at 30 or more decisions-like handoff entries, assess whether actual long-term maintenance is needed; retain the newest 8–22 in the hot tier and move older decisions into the decisions archive only when that work is required. Write substantive task evolution, a multi-option architectural choice with rationale, or a cross-session learning when observed.\n- Backstop: a known due 10-closeout count is an advisory to assess long-term maintenance. Do not infer a historical sweep from an unknown count; project-specific stricter requirements still apply.\n\nIf no actual maintenance applies, leave historical trace content unchanged. Handoff carries continuity; log and project decisions carry trace and long-term narrative.\n\n## Opening Message And Card\n\nThe handoff opening-message block is authoritative. It must name the absolute root, route the agent through `AGENTS.md` and the handoff, state the current objective and boundary, and avoid instructing the next agent to redo completed work. It must not require SESSION_LOG as an ordinary startup read.\n\nUse `agent-handoff-kit closeout-status --root <project root>` after the required read-backs. When it returns a card, copy the full card verbatim in a fenced `text` block before any explanation for both `status: complete` and `status: blocked`; never reduce it to selected status or blocker lines, print the literal placeholder `v<version>`, hand-compose a substitute success/blocked card, or use `handoff saved` unless the command reports `status: complete`. Only when no CLI card exists because the CLI could not be launched or returned no card may the final response show a fenced `closeout unavailable` card with no version and no `saved`/`complete` claim, followed by the actual missing condition. That presentation does not complete closeout and never replaces a returned complete or blocked CLI card.\n\n```text\n /\\_/\\ Agent Handoff Kit v<version>\n ( -.- ) handoff saved\n > ^ <\n\nstatus: complete\n✅ Done: <completed summary>\n🔎 QC: <validation summary>\n📌 Handoff: opening message ready\n⚠️ Boundary: <important boundary or none>\n```\n\nFor `status: blocked`, the command instead says `handoff blocked`; retain that status, blocker reason, and human explanation: `這不是失敗;只是還有事未保存、未提交、未驗證或需要處理。先照 Blocker 行處理,不要把本輪當作已完成交接。` Then give the short local-root entry `Start Agent Handoff` / `開工` and the path-bearing fallback for an agent not yet pointed at the root. The narrow `closeout unavailable` presentation above is allowed only when there is no CLI card; do not use it to replace a returned blocked card or hand-compose a third stateful prompt.\n\n## Stop Conditions\n\nDo not claim closeout complete when any required write or read-back failed, lifecycle state conflicts remain, the mirror is stale or duplicated, the root is uncertain, mandatory sync is unclassified, `closeout-status` is nonzero, or required Git persistence was explicitly part of the project's closeout contract but did not succeed. State the exact blocker and leave the project in an honest resumable state.\n"
15906
+ },
15907
+ "2b4b4fbb486d8a6c92ec644d989c8db7b75ef5dc3994fd33ff98e4542c28349d": {
15908
+ "targetRel": "AGENTS.md",
15909
+ "canonicalSha256": "0509ff24d7f353b3a277c6753ca9b04dda676ba6ce127e667fd9342cef950e09",
15910
+ "text": "<!-- BEGIN Agent Handoff Kit managed core -->\n# Agent Handoff Kit Core Runtime\n\nThis is the small always-read contract. Detailed task and closeout procedures live in routed packs.\n\n## 1. Intent And Startup\n\n### Upgrade lock guard\n\nBefore any handoff, user-rule router, pack, or other project-state read, use the verified project root to probe `dev/governance_migrations/.upgrade.lock`. A present lock, or inability to establish its absence, stops ordinary work and all further project-state reads and searches. Do not search for recovery instructions or edit or delete the lock. Before that explanation, render this fenced brand card:\n\n```text\n /\\_/\\ Agent Handoff Kit\n ( x.x ) continuity unavailable\n > ^ <\n```\n\nIt must not claim loaded, healthy, saved, or version-verified state. Explain that continuity is unavailable and give the supported recovery command `agent-handoff-kit upgrade --yes --root <verified-project-root>`. Bare startup never runs this command automatically. If the existence probe is unreadable, report continuity unavailable without claiming a lock is present and do not auto-recover. When the visible user request explicitly authorizes update, upgrade or recovery, only the official CLI performs transaction recovery; resume ordinary state loading only after that CLI succeeds and a new probe establishes lock absence.\n\nClassify the user's visible intent before loading project state. For explicit continuity, closeout, or a task whose next action depends on persisted project state, read `dev/SESSION_HANDOFF.md` first; it is the current-state authority. A direct ordinary or stateless task does not read the handoff merely because the project root is known. If the message is genuinely unresolved and the handoff can resolve it, read the handoff before asking the user.\n\nDo not read `dev/SESSION_LOG.md` during ordinary startup; it is trace-back evidence only. Do not read `START_NEXT_SESSION_PROMPT.txt` in addition to the handoff when already operating in the project root; that file is a portable generated mirror for an agent that has not yet been pointed at the root.\n\nWhen resuming, recover the parent outcome, current step, resume point, remaining acceptance and source coverage from the fully received handoff under the checkpoint below. Preserve decision-changing user corrections, rejected approaches and their reasons, reusable work and permission boundaries. Surface missing critical context in the startup warning and recommend the specific clarification/read; do not infer parent completion from a finished child or treat previous-session reading as your own. Bare startup remains status-only, with no extra source reads or writes.\n\nRoute intent in this order:\n\n1. Clear closeout intent routes directly to `dev/rules/closeout.md`.\n2. Clear continuity intent such as \"開工\", \"Start Agent Handoff\", \"開始接力\", or \"continue handoff\" resumes the minimum current state from the handoff. A plain continuity message with no same-message task or explicit long-run instruction authorizes only that recovery, the display-only current-thread naming checkpoint when safely supported, the startup card, the current objective/risk/recommended next action, and then the end of the turn. It does not authorize task-specific reads, research, plans, protocols, preflight, file searches, sub-agents, QA, packaging, project-file writes, network access, other external actions, or opt-out wording such as \"unless you object I will start\". First-use exception: when `dev/SESSION_HANDOFF.md` says `First-use guidance state: eligible`, the active objective is empty / `TBD`, and there is no same-message concrete task, load `dev/rules/onboarding.md` and include a short first-use welcome plus the most relevant guided choices in the same response instead of ending status-only. A concrete objective found only in loaded state is not authority to complete it. A same-message task may begin normally. An explicit instruction such as \"開工,繼續做到下一個 blocker\" or \"開工,繼續完成目前目標\" may continue under the normal task and safety rules.\n3. A direct ordinary task begins without a startup card or onboarding ceremony. Read only the sources and packs required by that task.\n4. Explicit guidance requests such as \"I'm new\", \"teach me\", \"help me start\", \"新手\", \"教我用\", or \"點開始\" may load `dev/rules/onboarding.md`. A fresh install marks first-use guidance as `eligible`, so the first unresolved startup must enter onboarding; upgrade must not reset `consumed` or `not_applicable` back to `eligible`. A short message in a non-eligible root only makes guidance available; it never overrides a concrete objective. If no executable objective remains after state reading, ask one concise question or offer guided onboarding.\n\nTreat a phrase as ambiguous only when its ordinary meaning may genuinely refer to a real-world shift, event, or unrelated context. `開工,繼續 <task>`, `<project> 開工`, and `Start Agent Handoff and continue <task>` are continuity commands, not ambiguous phrases.\n\n### Handoff reception and recovery checkpoint\n\nBefore claiming `loaded`, `resumed` or `continuity ready`, complete both gates below. A successful closeout, read command, exit code, digest, section list or summary does not establish reception or understanding.\n\n1. **Receive the whole packet.** Read all of `dev/SESSION_HANDOFF.md`, including its middle and end, from one unchanged file version. A full-file command is only a request: inspect the actual tool result. If output is truncated, omitted, paginated or uncertain, use smaller bounded reads and track contiguous ranges from the start through EOF, with no gaps or mixed versions. Check the entire returned body, not just its header/footer; a tool can retain both ends while omitting the middle. Reread any uncertain range. If the file changes during reading, restart coverage for the new version. Native file tools are valid; compare file identity before/after the read sequence. When an already-available local Kit CLI supports it, `handoff-read --root <root>` offers bounded Unicode ranges; continue with its `nextOffset` as `--offset` and the same `--sha256`, reducing `--max-chars` on truncation. Verify its canonical `root` matches the intended workspace; a root alias is not permission to read an unexpected location. Links below that root are rejected. This helper serves content only. Do not download, install, probe integrations or write a receipt for bare startup. Missing/unreadable content stays incomplete.\n2. **Recover the work.** From that packet, reconcile the user's outcome and consumer, current task's relation to it, completed work and reusable evidence, decision reasons and rejected approaches, remaining obligations/acceptance, exact bounded next action, required fresh sources, and authorization/stop boundaries. Preserve corrections and distinguish historical state from current truth. Use existing section locations as internal evidence; do not create another summary file or dump the packet into the reply. Missing or contradictory facts that prevent safe recovery make the checkpoint incomplete; identify their effect and the smallest clarification/read. A packet that honestly describes blocked work can still be sufficient: show its dependency blocker without inventing completion or requiring every linked source at startup. Eligible first-use TBD state still routes to onboarding; it is not a failed task handoff.\n\nUntil both gates pass, replace the card's `continuity ready` with `continuity incomplete`, use `incomplete` for its handoff status, and name the unread/conflicting scope. Do not begin dependent task work. Complete safe same-file supplementary reads before giving up; elapsed time or a green CLI is not acceptance. Full reception does not prove every historical fact or linked source; follow the normal required-reading gate before an authorized action. Bare startup still ends after its card. With explicit continuation, check the recovered input, output, downstream use and acceptance against the current request, read the necessary sources, and continue within the authorized scope, including multiple steps when completion or the next blocker was explicitly requested; neither the packet nor this checkpoint grants new permissions. These gates also apply after interrupted reads or context compaction when coverage cannot be recovered from actual evidence.\n\n### Current-thread naming checkpoint\n\nDuring explicit continuity startup, naming is a required presentation checkpoint when safe current-thread title control is available, not an optional task. After the minimum authorized startup reads, derive the current objective, boundary and recommended next action; resolve this checkpoint before emitting the final startup card or beginning any same-message authorized task work. Do not defer the tool call until after the final response or until the task is finished. If interrupted before the checkpoint resolves, handle it on the next user-authorized turn using current facts; do not schedule a background rename.\n\nUse `<project name>|<primary action>` from already-loaded facts: the concrete current user task first, then an unresolved current objective, then a concrete recommended action. Do not revive a completed child task from historical handoff text. When the project is known but no concrete action remains, use the project name alone; do not leave a new task named `開工` merely because the previous work is complete. If the project name is unknown, skip without guessing or extra source reads. `Start Agent Handoff`, `開工`, `開始交接工作` and `開始工作交接` are not primary actions. Titles must not contain progress, completion, status, task/session IDs, absolute paths, secrets or unverified facts.\n\nUse the current runtime's exposed tool schema. If a safe current-thread title tool is already available, call it directly; otherwise use a bounded runtime tool-discovery mechanism once with a narrow title/rename/current-thread query, when available. Never invent a tool name or require discovery when the tool is already exposed. Current-title readback is useful when available, but is not required when the tool safely targets the calling/current thread. Replace a generic or stale title; keep an informative title when readback proves it is already relevant, and preserve an explicitly user-chosen title unless the user asks to change it. When the current title cannot be read, use one safe current-thread set call with the derived title. Omit the target identifier only when the schema documents current-thread targeting; otherwise require a verified current-thread identifier. Do not list or inspect unrelated threads solely for naming, and do not create, fork, navigate, message, archive, pin or otherwise manage tasks for this checkpoint.\n\nBefore the final response, resolve the checkpoint as applied (successful tool result confirms the title), kept (relevant or user-chosen title), unavailable (no safe capability), skipped (project unknown), or failed/unverified (error or no confirmation). Use a targeted current-thread readback when available; an ambiguous write requires readback before any retry. Only a verified mismatch permits one safe corrective call; never loop or overwrite a later user rename. Do not assume a universal timing window or automatic-title overwrite across AI apps. An unavailable capability does not block startup; skip silently. A failed/unverified attempted rename gets a brief startup warning, not a success claim. Once resolved, return the card and stop for bare startup. On a later user-authorized turn, revisit naming when the primary task becomes concrete or changes, or a generic/stale title is observed; do not rename for tests, reviews or small substeps.\n\nThe title is display-only; it is not project state, permission, progress, completion evidence, a health result, or a source of truth. This checkpoint permits only the bounded title calls above; it does not authorize project/file writes, network research, external task work, extra startup reads or continuation beyond the startup boundary.\n\nRead `dev/PROJECT_INDEX.md` when the task needs its file, command, integration, workspace, or source map. Read `dev/RULE_PACKS.md` when a task pack must be selected. Read `dev/DOC_SYNC_REGISTRY.md` before durable cross-file or external synchronization and during closeout. Pack loading is normally silent; explain it only when it changes risk, requires a user decision, or materially affects the next action.\n\nIf the user supplies the portable startup prompt, use it to locate the root, then trust the handoff over the mirror. If the root is unclear or mismatched, stop and ask for the intended root before reading or editing project state. Missing required governance files are a repair condition, not permission to invent a parallel structure.\n\nBefore a non-trivial task, identify and read the required local and external truth sources or mark them blocked. Reachable is not the same as ingested. Search hits, truncated output, summaries, and status claims do not replace the relevant source content.\n\nProbe an integration only immediately before a task uses it, when the handoff explicitly identifies it as a dependency for the current objective, or when the user requests an integration health check. `TBD`, examples, blank rows, and undeclared placeholders are not installed integrations. Record `Last Verified` only after a real probe and through the normal persistence gate. Never write integration status merely because a session started.\n\nShow the startup card only for explicit continuity startup. For a plain continuity message, show the card after the minimum state recovery and end the turn; its recommended next action is advice, not permission to act. Render the startup card in a fenced `text` block and preserve spacing so the ASCII status marker remains aligned. The first-use exception above replaces that status-only stop with onboarding only when the handoff state is `eligible`, the objective is empty / `TBD`, and there is no same-message concrete task. An explicit same-message task or long-run continuation may combine the card with its first useful action. Direct ordinary tasks do not show the card. If onboarding is explicitly requested or first-use onboarding is triggered, combine any card and guidance in one response.\n\nFor explicit bare continuity startup, after the handoff is read, the startup card may read only the bounded version evidence from `dev/PROJECT_INDEX.md`: the unique stable-semver `| Agent Handoff Kit template version | X.Y.Z | ... |` row inside the unique real `## Stack` section. Do not route on, summarize, or load any other Project Index content for startup, title, permissions, packs, health, or task work. Missing, unreadable, malformed, duplicate, prerelease, or out-of-Stack-only version evidence prints `version unverified`; the turn remains status-only with zero writes. A direct ordinary or stateless task does not read the handoff or Project Index merely to fill a card or version.\n\n```text\n /\\_/\\ Agent Handoff Kit v<version>\n ( o.o ) continuity ready\n > ^ <\n\n🔎 交接狀態:<loaded / new install / resumed / incomplete>\n📌 目前目標:<current objective>\n⚠️ 注意事項:<important boundary or none>\n🚀 推薦下一步:<one action + reason>\n```\n\nUse the full product name, plain user language, and one recommended next action. Never print the literal placeholder `v<version>`.\n\n## 2. Proportionate Work Loop\n\nApply PLAN → READ → CHANGE → QC internally and in proportion to task state and risk. Do not make the user watch governance ceremony that does not help the task.\n\nIn every user-facing reply, lead with ordinary language: state the result and its practical effect, then the next action when one helps. Put exact commands, errors, hashes, and detailed evidence after that; brevity must not hide uncertainty or safety risk.\n\n- Simple answers, pure conversation or creation with no durable state, and low-risk tasks with an obvious target may proceed directly with proportionate reading and checking.\n- Non-trivial work reads relevant sources before changing them.\n- For failures spanning steps or recurring, trace relevant inputs, processing, saved state and actual consumers until evidence explains the cause and direct impact. Then stop expanding the investigation and repair the affected locations with that cause within the authorized scope; do not turn a simple local fix into a whole-system audit.\n- When repeated attempts produce no improved result, unblocked dependency or new evidence, reassess the cause and method before retrying; preserve useful results. Necessary waits and experiments that yield new evidence are not stagnation. Existing safety and retry limits still apply.\n- High-risk work states scope, impact, acceptance, and required confirmation before writes.\n- External skill flows, subagents, task plans, demo workspaces, and another tool's finish step do not replace the active root's persistence decision.\n- Task-first governance locality: when the user supplied a concrete, actionable, authorized task plan and no safety / source-truth / permission blocker prevents it, follow the plan's main acceptance path before governance side work. Governance may become the main path only when the task itself is governance, the user explicitly asks for governance bridge or long-term governance, the content semantically requires cross-session force, or deferring it would create a safety, continuity, source-of-truth, or discoverability blocker. Otherwise, keep governance to the smallest classification, indexing, sync, or Persistence Gate decision that does not change the main deliverable path; do not start governance bridge, long-term-governance routing, repo-wide scans, handoff writes, or closeout solely because the task mentions Markdown, README, docs, specs, plans, checklists, or generated outputs.\n- Materially changed Markdown governance artifacts must be indexed, synchronized, consolidated into their authoritative home, or explicitly classified as temporary / one-time evidence. Other durable formats follow the same human governance rule, but the bundled doctor does not claim to scan them.\n- Ordinary document edits normally use local read-back and task-specific checks only. If the edited document itself is the target authority and the task does not touch Kit-managed files, migrations, release / closeout gates, external effects, cross-source conflicts, or blockers for safe continuation, do not run `agent-handoff-kit doctor`, write handoff / log state, or regenerate the startup mirror solely because a document changed.\n\n## 2.1 Persistence Gate\n\nChoose exactly one tier after a task:\n\n1. No persistence: no durable fact was produced. One-off answers, transient output, active unapproved drafts, and routine rerunnable checks normally use this tier.\n2. Lightweight checkpoint: a durable fact affects future action while the session continues or may be interrupted. This is the default for ongoing sessions. Write only its smallest correct home; do not perform full closeout. Apply the bounded opening/mirror consistency rule below only when this checkpoint changes actionable state repeated there.\n3. Full closeout: explicit end-of-session / handoff intent, a real day / tool-session boundary, or a state where the current agent cannot continue and the next agent must take over. Ordinary external-tool use, a completed release / governance subtask, or a durable note during an ongoing session is not by itself a full closeout trigger. Load `dev/rules/closeout.md` only when this tier is selected.\n\nPre-closeout checkpoint guard: before writing `dev/SESSION_HANDOFF.md` or `dev/SESSION_LOG.md` without explicit closeout / checkpoint intent, identify the durable fact, why the edited target authority or user-visible answer is insufficient, and why that file is the smallest correct home. Do not write either file merely because the next AI might misread stale state, because a target-authority document changed, or to make the handoff mirror every intermediate step. If the gate selects a checkpoint, update only the named current-state field(s) or one concise log entry; preserve unrelated / historical handoff sections byte-stable where practical. Without the opening-consistency condition below, do not regenerate `START_NEXT_SESSION_PROMPT.txt`.\n\nCheckpoint opening consistency: when an authorized checkpoint changes actionable facts repeated in the `Next Session Opening Message`, reconcile only those affected current facts in that same checkpoint. Derive `START_NEXT_SESSION_PROMPT.txt` from the sole marked opening block only if normalized content differs, then verify the block/mirror and the changed objective, next action and completion boundary agree. Do not merely label an authoritative opening historical while leaving instructions to redo completed work. Preserve unrelated opening text and cold evidence; this condition does not authorize full closeout, new task work, extra source scans or persistence after an ordinary document edit.\n\nDuring an ongoing task, between Persistence Gate decisions, `dev/SESSION_HANDOFF.md` may legitimately trail the read-back target authority. Treat that as expected lag, not drift, and do not update handoff merely to mirror each intermediate step. Still apply the gate when a durable or startup-needed fact must survive interruption, the handoff is the smallest correct home, Kit-managed / release / closeout / external-effect state changed, or full closeout is selected.\n\nRoute current objective, next action, active risk, blocker, and startup-needed facts to `dev/SESSION_HANDOFF.md`; chronological evidence to `dev/SESSION_LOG.md`; maps to `dev/PROJECT_INDEX.md`; sync obligations to `dev/DOC_SYNC_REGISTRY.md`; long-term rationale to `dev/PROJECT_DECISIONS.md`; and reusable procedures to the relevant pack, registered reference, or QA check. Do not store the same task contract or reusable rule in several homes.\n\nExternal effects are never implied permission for commit, push, publish, release, deployment, cleanup, or another workspace write. Record verified external impact through the relevant integrations, release, safety, and closeout contracts without exposing private content or secrets.\n\n## 2.2 Upgrade Completion\n\nThe CLI owns upgrade truth. An upgrade is complete only when:\n\n1. The root is not newer than the CLI and every target passes read-only classification.\n2. Conflict produces zero governance-target and version writes.\n3. Staged outputs pass the offline migration acceptance gate: root boundary, structure, cross-file invariants, preservation hashes, and version transition.\n4. The recoverable transaction commits without an unresolved journal; only a failure caused by this transaction triggers rollback.\n5. Whole-project `doctor` reports project health separately. Pre-existing or unrelated health failures do not convert a correct migration into a destructive rollback; new migration-caused blockers do.\n6. The migration report records attempted version, committed version, transaction state, actions, redacted reasons, and backup locations without credential values.\n\nDo not use \"upgrade completed\" to mean \"the entire project is healthy\". Report `migration committed` and `project health` separately. Conflict, incomplete recovery, failed migration acceptance, and future-version roots are not completed upgrades.\n\n## 3. Safety Baseline\n\nDo not delete, reset, overwrite user-owned content, bulk-move, publish, change permissions, or perform another irreversible or external action without the required explicit authorization.\n\nNamed prohibited destructive commands in `dev/rules/safety.md` remain prohibited even when requested. Never use a weaker pack or local instruction to bypass core safety.\n\nVerify the selected root and real target boundaries before writes. Do not follow a link, junction, mount, or computed path outside the confirmed root. Do not expose credential values in output, reports, backups, tests, or logs. A real permission or lock refusal stops the affected operation; it is not permission to elevate, switch provider or mode, or use a riskier command. Normal platform approval and another already-authorized safe method remain available only after their actual scope and safety are verified.\n\nDo not modify unrelated files or erase unexpected user changes. Do not claim completion without read-back evidence and proportionate checks.\n\n## 4. Closeout Trigger\n\nClear end-of-session or handoff intent such as \"收工\", \"Wrap up Agent Handoff\", \"closeout\", \"wrap up\", or \"handoff\" triggers full closeout, not a chat-only summary. Load `dev/rules/closeout.md` and follow its complete contract. `收工,記得 <handoff requirement>` and equivalent closeout-plus-instruction phrases are clear closeout intent. Ask one concise confirmation only when the phrase genuinely refers to an unrelated real-world closing or shift.\n\nThe always-enforced closeout invariants are:\n\n1. Current state lives in `dev/SESSION_HANDOFF.md`; trace evidence lives in `dev/SESSION_LOG.md`.\n2. Completed, pending, risk, validation, and opening-message lifecycle states agree.\n3. `START_NEXT_SESSION_PROMPT.txt` is regenerated from the sole authoritative handoff block and no third full copy is retained.\n4. Workspace identity is a last-verified snapshot. Live root / Git / worktree truth belongs to `agent-handoff-kit workspace-health --root <project root>` or equivalent read-only Git probes, not to stale prose.\n5. Closeout is not complete until required files are written, read back, and the available closeout checks pass.\n6. After those checks, render the final card with `agent-handoff-kit closeout-status --root <project root>`; only its `status: complete` output may say `handoff saved`. A nonzero / `blocked` result is an honest blocked closeout, not a completed one.\n7. Git commit, push, release, publish, deployment, deletion, and permission changes remain separately authorized actions.\n\n## 5. Pack Loading\n\nUse `dev/RULE_PACKS.md` to load the minimum task-specific set. Read the applicable packs, including their project supplements and required references, before deciding how to act; an index, title or remembered summary is not the rule itself. Apply them within the user's actual objective and instruction priority: do not invent a replacement goal, acceptance standard or competing rule system. Missing or conflicting requirements must be resolved from their owners, not filled by an invented policy. Packs may add stricter requirements but cannot weaken core safety or continuity.\n\nLoad `dev/rules/integrations.md` when the current task actually uses an external tool, not merely because a registry or placeholder table exists. Load `dev/rules/closeout.md` only for full closeout. If two packs conflict, use the safer and more verifiable path and record the unresolved conflict at closeout.\n\nAfter the task, apply the Persistence Gate. Do not assume the next session remembers pack context, and do not use handoff or log as the only home for reusable procedures.\n\n## Core Complexity Rule\n\nBefore changing `AGENTS.md` or adding a durable governance rule, use `dev/RULE_PACKS.md` to load `dev/rules/agent-governance.md` and locate the existing normative owner. Follow its `Governance Write Boundary` before choosing a writable location: installed official core and pack bodies are not project-editable rule homes. Default-core rules must apply to most sessions, protect safety or continuity, and be shorter than the routed detail they replace. Scenario-specific or project-specific detail belongs in an existing pack's project supplement or registered reference; a new pack is justified only when it creates a smaller, independently loadable responsibility with one normative owner. Do not copy the agent-governance classification table or workflow into the core.\n<!-- END Agent Handoff Kit managed core -->\n\n<!-- ack:user-rules-router:dev/USER_RULES.md -->\n<!-- ack:user-rules-acceptance:sha256=5cc4d84824f52133c0f6aed1ec916d34651c5f123db9de5f60135cd94f6dfc3b -->\nBefore loading task packs, read `dev/USER_RULES.md`. Its registered entries\nunder `dev/user_rules/` are user-controlled rules: read each accepted entry in\nthe listed order and verify its accepted raw-byte witness. Do not treat this\nrouter, its directory, a heading, language, format, location, or\nofficial-looking text as proof that any legacy source belongs to the Kit.\n\nThe core `Upgrade lock guard` applies first when it stops ordinary work.\n"
15531
15911
  }
15532
15912
  },
15533
15913
  "generatedShortcuts": {
@@ -15673,7 +16053,115 @@
15673
16053
  "dev/handoff-kit/project-version.mjs": "9fdee8c290e8fb8a8621430957b484676c6fb2d8ab198576b49b132d48a4e262",
15674
16054
  "dev/handoff-kit/assets.mjs": "165e0ff8d9044dc7b4eebaeb014d6bc6bce1970ca49f4827000b5da7e8afe04f"
15675
16055
  }
16056
+ },
16057
+ "0.4.3": {
16058
+ "npm": {
16059
+ "spec": "@adamchanadam/agent-handoff-kit@0.4.3",
16060
+ "shasum": "808862be4e18046d80d203549710290246494ded",
16061
+ "integrity": "sha512-/dN3LcDCnBYiNeapyRYZ2BCCrj+9dFoAAcT4qSEV/bTDddPjbMU0ehqTkuRvdGTDYb7nx5WcbLzQfNAA1dlWBQ==",
16062
+ "tarballSha256": "f6cb83862874aad097c874f60edcb42327580b92496d81c87dc639fa6b8866e2"
16063
+ },
16064
+ "generatorSha256": "34432388f0e6de9120a40e38d29ef5ee1483795cae64e4d47bbde68413a9d5d3",
16065
+ "files": {
16066
+ ".claude/skills/handoff-kit-start/SKILL.md": "9e0e4312fe9bc8e6801c5e0ea32026144a10ba364118b61058470aef2cf12cdf",
16067
+ ".agents/skills/handoff-kit-start/SKILL.md": "9e0e4312fe9bc8e6801c5e0ea32026144a10ba364118b61058470aef2cf12cdf",
16068
+ ".agents/skills/handoff-kit-start/agents/openai.yaml": "a294dd1815bef68434d4fbf93261d5192abdc6f3570e6b6030d19f2bf657a984",
16069
+ ".gemini/commands/handoff-kit-start.toml": "23c0da1953e98d18a1d9a1f725af5174a4e16a2b41fb69f7fd650af1efaf24ce",
16070
+ ".claude/skills/handoff-kit-close/SKILL.md": "46d999d993a282092ad93bb69d2848749d0b448eb71fe7a3394a3caa7e68e8ab",
16071
+ ".agents/skills/handoff-kit-close/SKILL.md": "46d999d993a282092ad93bb69d2848749d0b448eb71fe7a3394a3caa7e68e8ab",
16072
+ ".agents/skills/handoff-kit-close/agents/openai.yaml": "7ff3064232dfa62d9b0a75c5cc743afb77a1c6986e8c423618cc37cf0031501d",
16073
+ ".gemini/commands/handoff-kit-close.toml": "98898d53857b14d46ba2a19bf06397c2ee221f68e5ff877cf3a4f2ee2cf8142d",
16074
+ ".claude/skills/handoff-kit-progress/SKILL.md": "ee2a16a983cfb612099271adc5ff4ad628003cfc56963c71e4e853288d03f0b4",
16075
+ ".agents/skills/handoff-kit-progress/SKILL.md": "ee2a16a983cfb612099271adc5ff4ad628003cfc56963c71e4e853288d03f0b4",
16076
+ ".agents/skills/handoff-kit-progress/agents/openai.yaml": "cbb31a137fe249e7ec563ea70759c7bd7792d0b72dd912d38ef25226667902c4",
16077
+ ".gemini/commands/handoff-kit-progress.toml": "b0ec3e0f3773d6de8df241ca79f143b0781f7fc1034ec4a0fc9464966c752918",
16078
+ ".claude/skills/handoff-kit-align/SKILL.md": "7a8e1d22043e36dc1c74b8ec262f292e574cdb1f3dce0264370e5134fe52ebba",
16079
+ ".agents/skills/handoff-kit-align/SKILL.md": "7a8e1d22043e36dc1c74b8ec262f292e574cdb1f3dce0264370e5134fe52ebba",
16080
+ ".agents/skills/handoff-kit-align/agents/openai.yaml": "4001a19fc73b01be44de48b44db2d5c361e38c637a1b4ffa1b215dd5615bca5d",
16081
+ ".gemini/commands/handoff-kit-align.toml": "5077dad5129d5219ceb7cb3c87c09f169c53c062d51edf7b415ca8aba50f7bb0",
16082
+ ".claude/skills/handoff-kit-onboard/SKILL.md": "161f6fc817e0c03ec8093c574d066bf1d5e7716ae47870a9cb8683311f4dd7b7",
16083
+ ".agents/skills/handoff-kit-onboard/SKILL.md": "161f6fc817e0c03ec8093c574d066bf1d5e7716ae47870a9cb8683311f4dd7b7",
16084
+ ".agents/skills/handoff-kit-onboard/agents/openai.yaml": "5ef6ac65e96d20a71287c5f44abad14dc4f7b91d4fefd5b4ec7f672273917265",
16085
+ ".gemini/commands/handoff-kit-onboard.toml": "915c92a522a9995f201e85521d9f40f6cf499f52988dfac04cf22585f72dfbe7",
16086
+ ".claude/skills/handoff-kit-remember/SKILL.md": "14b6f9906ab816bfe1d02ec5fdb822ad3c3981346040bcf3bcad7ae85fb52ce8",
16087
+ ".agents/skills/handoff-kit-remember/SKILL.md": "14b6f9906ab816bfe1d02ec5fdb822ad3c3981346040bcf3bcad7ae85fb52ce8",
16088
+ ".agents/skills/handoff-kit-remember/agents/openai.yaml": "9bed15e27ee9725e2a31b57d10687349a5754dcfcae55aca167c763f6f1e0e80",
16089
+ ".gemini/commands/handoff-kit-remember.toml": "c577c8af5430dbc0e1a5b4a2d1f74a19ef279f695572ca8b5de3b4aeb35e7892",
16090
+ ".claude/skills/handoff-kit-check/SKILL.md": "6948d45ff7d95f5dd66930d02dba6b99aadbc51d6e220a32b9a1ffdbe99d7bae",
16091
+ ".agents/skills/handoff-kit-check/SKILL.md": "6948d45ff7d95f5dd66930d02dba6b99aadbc51d6e220a32b9a1ffdbe99d7bae",
16092
+ ".agents/skills/handoff-kit-check/agents/openai.yaml": "666d4b602e019e06a7dd70742fc459cd2afab2a442bce038c87dfce09d429bb2",
16093
+ ".gemini/commands/handoff-kit-check.toml": "f8985c17fe064f2902e941369b5a761fe27a4ba897a0e88e9cc67d7170ad9136",
16094
+ ".claude/skills/handoff-kit-update/SKILL.md": "b8cf133ae63068257e1a8b570ce2cba8ef29d5438465ca5caaaca093095416a7",
16095
+ ".agents/skills/handoff-kit-update/SKILL.md": "b8cf133ae63068257e1a8b570ce2cba8ef29d5438465ca5caaaca093095416a7",
16096
+ ".agents/skills/handoff-kit-update/agents/openai.yaml": "12177a56d5a3573cb079506de78375f83ccb06f8fa7e1828a3d7c237de82e7bf",
16097
+ ".gemini/commands/handoff-kit-update.toml": "baad57bb779e91f4be1b6b9b7570bb36e5238c23e5e750d9bbc3ef6c7e98bd9b",
16098
+ ".claude/skills/handoff-kit-help/SKILL.md": "d3b0d4fe6505b28284d7bc93b6124b5bd84898356b57ff0c217a74e63d00100d",
16099
+ ".agents/skills/handoff-kit-help/SKILL.md": "d3b0d4fe6505b28284d7bc93b6124b5bd84898356b57ff0c217a74e63d00100d",
16100
+ ".agents/skills/handoff-kit-help/agents/openai.yaml": "a87a82d80551abfe32588d6b66b44b21c45aa636ef0392cc886dfb5cc65a609a",
16101
+ ".gemini/commands/handoff-kit-help.toml": "880e88bd61747f82bf54fe274ab00d368374904a102ee34ffe5341c03c513f56",
16102
+ "dev/handoff-kit/launch.mjs": "d0bcbf596f08f722c9af84c7779e1b3ef77b49234e840e97d78bf2296b9dca2c",
16103
+ "dev/handoff-kit/open.mjs": "7725ff1ee0da9b1753d5d8648c73272b6b0948b9ca567c1e89734e2b1275f28d",
16104
+ "dev/handoff-kit/server.mjs": "52fb563cac05d08a934c759f6157035767eabf3de977085a7b811bde78177cbf",
16105
+ "dev/handoff-kit/projection.mjs": "06429ecdffab697acd88f3327c00e17d92cfa1d3629edf35afea6a51d1288ce7",
16106
+ "dev/handoff-kit/dashboard.mjs": "73a50e69886d00d706677ef925ac74bed6d7d7ba299642d7880c25d05885ca61",
16107
+ "dev/handoff-kit/project-version.mjs": "8814c81f7053147e6b6816dc356790330257fddae53404d88a5d2b7c01a6ebcb",
16108
+ "dev/handoff-kit/assets.mjs": "1b249b49ddb624b0efe34ff029afec4c8cd4706fdf8323ad7aa3897c7cd61dea"
16109
+ }
16110
+ },
16111
+ "0.4.4": {
16112
+ "npm": {
16113
+ "spec": "@adamchanadam/agent-handoff-kit@0.4.4",
16114
+ "shasum": "bfda53fd8d0229b27e67e2190753fa32a2ae1851",
16115
+ "integrity": "sha512-1H6ib7StICVApD+EaieTEMwzo0LAhOQnChKHXJFaAH0QXJ/9FrxgiklnBzyoqOTbVbMGkYoQ5KHJz5hloS59EA==",
16116
+ "tarballSha256": "4cdb10d8b61a72c9141e1b821e4489081ed8163a332c21a4432b04ffbc4b7305"
16117
+ },
16118
+ "generatorSha256": "34432388f0e6de9120a40e38d29ef5ee1483795cae64e4d47bbde68413a9d5d3",
16119
+ "files": {
16120
+ ".claude/skills/handoff-kit-start/SKILL.md": "9e0e4312fe9bc8e6801c5e0ea32026144a10ba364118b61058470aef2cf12cdf",
16121
+ ".agents/skills/handoff-kit-start/SKILL.md": "9e0e4312fe9bc8e6801c5e0ea32026144a10ba364118b61058470aef2cf12cdf",
16122
+ ".agents/skills/handoff-kit-start/agents/openai.yaml": "a294dd1815bef68434d4fbf93261d5192abdc6f3570e6b6030d19f2bf657a984",
16123
+ ".gemini/commands/handoff-kit-start.toml": "23c0da1953e98d18a1d9a1f725af5174a4e16a2b41fb69f7fd650af1efaf24ce",
16124
+ ".claude/skills/handoff-kit-close/SKILL.md": "46d999d993a282092ad93bb69d2848749d0b448eb71fe7a3394a3caa7e68e8ab",
16125
+ ".agents/skills/handoff-kit-close/SKILL.md": "46d999d993a282092ad93bb69d2848749d0b448eb71fe7a3394a3caa7e68e8ab",
16126
+ ".agents/skills/handoff-kit-close/agents/openai.yaml": "7ff3064232dfa62d9b0a75c5cc743afb77a1c6986e8c423618cc37cf0031501d",
16127
+ ".gemini/commands/handoff-kit-close.toml": "98898d53857b14d46ba2a19bf06397c2ee221f68e5ff877cf3a4f2ee2cf8142d",
16128
+ ".claude/skills/handoff-kit-progress/SKILL.md": "ee2a16a983cfb612099271adc5ff4ad628003cfc56963c71e4e853288d03f0b4",
16129
+ ".agents/skills/handoff-kit-progress/SKILL.md": "ee2a16a983cfb612099271adc5ff4ad628003cfc56963c71e4e853288d03f0b4",
16130
+ ".agents/skills/handoff-kit-progress/agents/openai.yaml": "cbb31a137fe249e7ec563ea70759c7bd7792d0b72dd912d38ef25226667902c4",
16131
+ ".gemini/commands/handoff-kit-progress.toml": "b0ec3e0f3773d6de8df241ca79f143b0781f7fc1034ec4a0fc9464966c752918",
16132
+ ".claude/skills/handoff-kit-align/SKILL.md": "7a8e1d22043e36dc1c74b8ec262f292e574cdb1f3dce0264370e5134fe52ebba",
16133
+ ".agents/skills/handoff-kit-align/SKILL.md": "7a8e1d22043e36dc1c74b8ec262f292e574cdb1f3dce0264370e5134fe52ebba",
16134
+ ".agents/skills/handoff-kit-align/agents/openai.yaml": "4001a19fc73b01be44de48b44db2d5c361e38c637a1b4ffa1b215dd5615bca5d",
16135
+ ".gemini/commands/handoff-kit-align.toml": "5077dad5129d5219ceb7cb3c87c09f169c53c062d51edf7b415ca8aba50f7bb0",
16136
+ ".claude/skills/handoff-kit-onboard/SKILL.md": "161f6fc817e0c03ec8093c574d066bf1d5e7716ae47870a9cb8683311f4dd7b7",
16137
+ ".agents/skills/handoff-kit-onboard/SKILL.md": "161f6fc817e0c03ec8093c574d066bf1d5e7716ae47870a9cb8683311f4dd7b7",
16138
+ ".agents/skills/handoff-kit-onboard/agents/openai.yaml": "5ef6ac65e96d20a71287c5f44abad14dc4f7b91d4fefd5b4ec7f672273917265",
16139
+ ".gemini/commands/handoff-kit-onboard.toml": "915c92a522a9995f201e85521d9f40f6cf499f52988dfac04cf22585f72dfbe7",
16140
+ ".claude/skills/handoff-kit-remember/SKILL.md": "14b6f9906ab816bfe1d02ec5fdb822ad3c3981346040bcf3bcad7ae85fb52ce8",
16141
+ ".agents/skills/handoff-kit-remember/SKILL.md": "14b6f9906ab816bfe1d02ec5fdb822ad3c3981346040bcf3bcad7ae85fb52ce8",
16142
+ ".agents/skills/handoff-kit-remember/agents/openai.yaml": "9bed15e27ee9725e2a31b57d10687349a5754dcfcae55aca167c763f6f1e0e80",
16143
+ ".gemini/commands/handoff-kit-remember.toml": "c577c8af5430dbc0e1a5b4a2d1f74a19ef279f695572ca8b5de3b4aeb35e7892",
16144
+ ".claude/skills/handoff-kit-check/SKILL.md": "6948d45ff7d95f5dd66930d02dba6b99aadbc51d6e220a32b9a1ffdbe99d7bae",
16145
+ ".agents/skills/handoff-kit-check/SKILL.md": "6948d45ff7d95f5dd66930d02dba6b99aadbc51d6e220a32b9a1ffdbe99d7bae",
16146
+ ".agents/skills/handoff-kit-check/agents/openai.yaml": "666d4b602e019e06a7dd70742fc459cd2afab2a442bce038c87dfce09d429bb2",
16147
+ ".gemini/commands/handoff-kit-check.toml": "f8985c17fe064f2902e941369b5a761fe27a4ba897a0e88e9cc67d7170ad9136",
16148
+ ".claude/skills/handoff-kit-update/SKILL.md": "b8cf133ae63068257e1a8b570ce2cba8ef29d5438465ca5caaaca093095416a7",
16149
+ ".agents/skills/handoff-kit-update/SKILL.md": "b8cf133ae63068257e1a8b570ce2cba8ef29d5438465ca5caaaca093095416a7",
16150
+ ".agents/skills/handoff-kit-update/agents/openai.yaml": "12177a56d5a3573cb079506de78375f83ccb06f8fa7e1828a3d7c237de82e7bf",
16151
+ ".gemini/commands/handoff-kit-update.toml": "baad57bb779e91f4be1b6b9b7570bb36e5238c23e5e750d9bbc3ef6c7e98bd9b",
16152
+ ".claude/skills/handoff-kit-help/SKILL.md": "d3b0d4fe6505b28284d7bc93b6124b5bd84898356b57ff0c217a74e63d00100d",
16153
+ ".agents/skills/handoff-kit-help/SKILL.md": "d3b0d4fe6505b28284d7bc93b6124b5bd84898356b57ff0c217a74e63d00100d",
16154
+ ".agents/skills/handoff-kit-help/agents/openai.yaml": "a87a82d80551abfe32588d6b66b44b21c45aa636ef0392cc886dfb5cc65a609a",
16155
+ ".gemini/commands/handoff-kit-help.toml": "880e88bd61747f82bf54fe274ab00d368374904a102ee34ffe5341c03c513f56",
16156
+ "dev/handoff-kit/launch.mjs": "d0bcbf596f08f722c9af84c7779e1b3ef77b49234e840e97d78bf2296b9dca2c",
16157
+ "dev/handoff-kit/open.mjs": "7725ff1ee0da9b1753d5d8648c73272b6b0948b9ca567c1e89734e2b1275f28d",
16158
+ "dev/handoff-kit/server.mjs": "52fb563cac05d08a934c759f6157035767eabf3de977085a7b811bde78177cbf",
16159
+ "dev/handoff-kit/projection.mjs": "06429ecdffab697acd88f3327c00e17d92cfa1d3629edf35afea6a51d1288ce7",
16160
+ "dev/handoff-kit/dashboard.mjs": "73a50e69886d00d706677ef925ac74bed6d7d7ba299642d7880c25d05885ca61",
16161
+ "dev/handoff-kit/project-version.mjs": "8814c81f7053147e6b6816dc356790330257fddae53404d88a5d2b7c01a6ebcb",
16162
+ "dev/handoff-kit/assets.mjs": "1020b4cce66fb30634e3b0cd8247c11cd36fb4b4e9b30b3d303968bc777fdbb5"
16163
+ }
15676
16164
  }
15677
16165
  },
15678
- "catalogDigestSha256": "97b87e4c943f52fd1e8834471f7f85163fc7e0a0aa5545bad8d8e988ea7077bb"
16166
+ "catalogDigestSha256": "ee1d176e1d2d6c3c2bff1209c630f00dc1edc161a1949ac609584c856b14da31"
15679
16167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamchanadam/agent-handoff-kit",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Lightweight agent harness for project memory, handoff, and multi-session continuity.",
5
5
  "type": "module",
6
6
  "bin": {
package/packs/closeout.md CHANGED
@@ -29,7 +29,7 @@ Full closeout is differential and write-minimal. Update only fields whose curren
29
29
 
30
30
  Handoff cold zones are historical / evidence sections, old validation records, completed-work narratives, and unchanged durable anchors. Stable anchors and decision-changing current facts stay in the packet. Do not rewrite, reword, reorder, or refresh cold zones for ceremony or style. When older detailed narrative no longer changes the next action, preserve it byte-for-byte in existing trace/archive storage and verify that copy before removing it from the current packet. Do not rewrite or archive unchanged material at every closeout, impose an arbitrary size cap, or weaken the required full reception of the current packet.
31
31
 
32
- 1. Reconcile `dev/SESSION_HANDOFF.md`; never append a new current-state snapshot beneath an old one. Verify durable anchors, then update only changed closeout-reconciled fields or sections; leave already-current sections unchanged instead of rewriting them for ceremony.
32
+ 1. Reconcile `dev/SESSION_HANDOFF.md`; never append a new current-state snapshot beneath an old one. Verify durable anchors, then update only changed closeout-reconciled fields or sections.
33
33
  2. Reconcile lifecycle state across `Completed This Session`, `Validation / QC`, `Next Priorities`, `Risks / Blockers`, and `Next Session Opening Message`. Completed or verified work cannot remain unresolved unless explicitly reclassified as monitor-only, follow-up scope, blocked, or reopened with its missing evidence or trigger.
34
34
  The bundled doctor is a mechanical floor for required lifecycle markers and readable sections only. `agent-handoff-kit closeout-status` checks explicit lifecycle declarations and same-scope textual contradictions; it does not prove natural-language semantic consistency. When it blocks, inspect its first `Resolved [...]` / `Carry-forward [...]` pair against the actual evidence: completion of one action does not complete another acceptance scope, and a preserved limitation is not a completion claim. Repair a real contradiction in its owning handoff section. If truthful, distinct scopes are misclassified, preserve the facts, report the checker defect and stop wording retries; do not add a reclassification prefix, invent a trigger, erase a limitation or broaden governance just to pass. A blocked result remains blocked until verified repair. Read all five sections as a whole before marking the lifecycle field resolved. For governance, release, or another project-defined high-risk completion, use the project's independent semantic review gate in addition to `closeout-status`.
35
35
  3. Make `Next Priorities` name one recommended next action and a short reason unless blocked or a real user decision is required.
@@ -41,7 +41,7 @@ Handoff cold zones are historical / evidence sections, old validation records, c
41
41
  9. Run the short maintenance assessment below. Record only actual maintenance work or a current risk; do not create a log entry solely to report a size advisory.
42
42
  10. Mark first-use guidance `consumed` after the first successfully completed task or first full closeout. Upgrade must never reset `consumed` or `not_applicable` to `eligible`.
43
43
  11. Verify `START_NEXT_SESSION_PROMPT.txt` against the sole fenced handoff opening-message block first. Regenerate it only when normalized content differs, then run the project's fixed prompt-mirror checker or perform an equivalent anchored read-back that verifies marker, heading, fence, full-copy uniqueness, and normalized content equality.
44
- 12. Run available project-specific closeout checks. Do not run a separate bundled `doctor`: the `closeout-status` command below performs the one required fresh doctor read-back. Do not treat an external update-check failure as local closeout failure. Fix state or mirror failures before claiming handoff ready.
44
+ 12. Run available project-specific closeout checks. Do not run a separate bundled `doctor`; step 13 performs it. Do not treat an external update-check failure as local closeout failure. Fix state or mirror failures before claiming handoff ready.
45
45
  13. Run `agent-handoff-kit closeout-status --root <project root>` after the handoff and prompt read-back. It performs the one required fresh doctor read-back plus a read-only workspace-health comparison against the handoff snapshot, and its output is the only final card source. A nonzero result means the closeout is blocked; do not replace it with a success summary.
46
46
 
47
47
  ## Packet-Only Reconstruction Check
@@ -84,7 +84,7 @@ status: complete
84
84
  ⚠️ Boundary: <important boundary or none>
85
85
  ```
86
86
 
87
- For `status: blocked`, the command instead says `handoff blocked`; retain that status, blocker reason, and human explanation: `這不是失敗;只是還有事未保存、未提交、未驗證或需要處理。先照 Blocker 行處理,不要把本輪當作已完成交接。` Then give the short local-root entry `Start Agent Handoff` / `開工` and the path-bearing fallback for an agent not yet pointed at the root. The narrow `closeout unavailable` presentation above is allowed only when there is no CLI card; do not use it to replace a returned blocked card or hand-compose a third stateful prompt.
87
+ For `status: blocked`, the command instead says `handoff blocked`; retain that status, blocker reason, and human explanation: `這不是失敗;只是還有事未保存、未提交、未驗證或需要處理。先照 Blocker 行處理,不要把本輪當作已完成交接。` Then give the short local-root entry `Start Agent Handoff` / `開工` and the path-bearing fallback for an agent not yet pointed at the root. Do not hand-compose a third stateful prompt.
88
88
 
89
89
  ## Stop Conditions
90
90
 
package/packs/coding.md CHANGED
@@ -16,6 +16,8 @@ Use for code changes, tests, builds, package managers, SDKs, CLIs, APIs, or deve
16
16
  3. Prefer project-local patterns and helpers over new abstractions.
17
17
  4. Do not guess current SDK, CLI, package, API, or deployment behavior when docs or project files can verify it.
18
18
  5. Preserve unrelated user changes.
19
+ 6. Before first running new or changed code, including your own tests and helper scripts, read its usage text or header comment as a separate step before composing the command, noting how it uses arguments, environment variables, deletion and overwrite. If it can delete or overwrite anything outside a temporary location it created, first confirm the work is already recoverable (committed, backed up, or run against an isolated copy). This rule does not authorize a commit or backup; if the work is not recoverable, ask the user.
20
+ 7. Tests, fixtures and helper scripts you write that delete or clear must verify the target is a temporary location they created (resolved path, expected name prefix, not the project or working directory or any ancestor of them); otherwise they must stop and report failure, never pass. Product features that delete by design follow `dev/rules/safety.md`.
19
21
 
20
22
  ## Checks
21
23
 
@@ -198,7 +198,7 @@ Integration declarations are project-level; they do not guarantee every AI runti
198
198
  10. **Plugin / Skill subordination**: plugin and skill instructions coexist with rule packs; safety, governance, and closeout rules take precedence on conflict.
199
199
  11. **External tool resource lifecycle**: after external-tool use, classify resources by ownership. Task-owned / agent-managed resources may be closed or cleaned automatically; shared, user-owned, system-level, other-agent-owned, or unknown resources require evidence reporting and user confirmation before remediation.
200
200
  12. **Local HTML / app validation fallback**: if `file://` browser access is blocked, do not bypass the policy and do not stop on that single surface failure. Use a registered operation reference or a short-lived loopback localhost service for actual browser / DevTools / Playwright validation, then close the task-owned service and record the evidence.
201
- 13. **Terminal-state contract**: a tool operation succeeds only when the runtime returns an explicit successful terminal state and any required read-back passes. Stopped, aborted, timeout, spawn / transport error, signal, missing final result, or partial stdout before termination makes the affected operation indeterminate or failed, not successful. It does not make unrelated already-verified task evidence permanently invalid. For read-only operations, verify the state and rerun only the affected operation when still needed. For any operation that may have written externally or to disk, read back the actual target state before retrying, recovery, or success claims.
201
+ 13. **Terminal-state contract**: a tool operation succeeds only when the runtime returns an explicit successful terminal state and any required read-back passes. Stopped, aborted, timeout, spawn / transport error, signal, missing final result, or partial stdout before termination makes the affected operation indeterminate or failed, not successful. A wrapper exit code or an outer command's success is not a terminal success without the expected final state and read-back. It does not make unrelated already-verified task evidence permanently invalid. For read-only operations, verify the state and rerun only the affected operation when still needed. For any operation that may have written externally or to disk, read back the actual target state before retrying, recovery, or success claims.
202
202
 
203
203
  ## Checks
204
204
 
@@ -212,7 +212,6 @@ Integration declarations are project-level; they do not guarantee every AI runti
212
212
  - Self-check credential leakage before writing `PROJECT_INDEX`, `SESSION_HANDOFF`, or `SESSION_LOG`.
213
213
  - Verify that `PROJECT_INDEX` External Sources `via` references match declared Installed Integrations entries.
214
214
  - For local HTML / app validation, verify that a rejected `file://` attempt is followed by a registered operation reference or short-lived localhost fallback before declaring `blocked`.
215
- - Treat stopped, aborted, timeout, spawn / transport error, signal, and missing final result as operation-level indeterminate / failed states. Never count partial stdout, a wrapper exit code, or an outer command's success as terminal success without the expected final state and read-back.
216
215
 
217
216
  ## Closeout
218
217
 
@@ -228,20 +227,8 @@ Integration declarations are project-level; they do not guarantee every AI runti
228
227
  | Anti-pattern | Why it is wrong | Correct approach |
229
228
  |---|---|---|
230
229
  | Assuming no Connector or MCP exists whenever the user mentions Notion, Google Drive, or another external source | Mature connector ecosystems make paste-only fallback an unreliable default. | Read `PROJECT_INDEX` Installed Integrations, then inspect the active runtime for an authorized capable tool/schema; ask only for missing user-held access or source information. |
231
- | Guessing tool names, endpoints, CLI flags, URI parameters, or plugin APIs from memory | Stale examples cause unknown tool, invalid args, 400 / 404, permission, or auth loops. | Verify active runtime schema, official docs, official types/samples, or versioned local runbooks. |
232
- | Treating browser validation as ordinary coding and guessing Chrome, Playwright, or DevTools commands | Browser and tool-control surfaces differ across runtimes, profiles, plugins, and installed packages. | Verify the active runtime schema, official docs, or a registered tool operation reference; use the classified fallback only for the affected surface when unavailable. |
233
- | Treating a Connector marketing page or old example as executable schema | Marketing pages do not prove the active runtime's current tool name or input schema. | Use active runtime tool list/schema as the invocation source. |
234
230
  | Retrying unknown tool / invalid args by changing names or parameters repeatedly | Trial-and-error hides the real schema or docs gap. | Stop same-pattern retries and return to the External Tool Usage Verification Gate. |
235
- | Writing credential values into `PROJECT_INDEX`, `SESSION_HANDOFF`, or `SESSION_LOG` | Project files and git history are persistent; leaked credentials remain exposed. | Record credential references only, never values. |
236
- | Using a credential value pasted in chat and then recording it | Chat history and logs may persist the secret. | Redact, warn, and ask the user to rotate if needed. |
237
- | Auto-fixing auth or re-auth flows | Auth belongs to the user and the runtime/tool boundary. | Surface the failure and point to the runtime or tool settings. |
238
- | Claiming an external write succeeded without read-back | External writes may fail silently or partially. | Read back and compare before claiming success. |
239
- | Crossing source-of-truth layers | It can corrupt truth, mirrors, or working drafts. | Follow the declared layer role and write direction in `PROJECT_INDEX`. |
240
- | Skipping current availability verification because an old handoff said the tool worked | Tokens expire, runtimes change, and tools can be removed. | Probe availability in the current runtime before using the integration. |
241
- | Treating stopped, aborted, timeout, spawn / transport error, signal, missing final result, or partial PASS output as success | Tool output can be partial, wrappers can hide inner failure, and external writes may be unknown. | Mark the affected operation indeterminate or failed; read back any possible write target before retrying or claiming success. |
242
- | Leaving task-owned MCP / browser / helper processes running after the task | Turns one-off tool use into a long-lived resource leak and can slow the host. | Use graceful close or task-owned process cleanup automatically; switch to user confirmation only when ownership is unclear. |
243
231
  | Broadly killing by process name such as `node.exe`, `python`, or `chrome` | A generic process name does not prove ownership and may terminate user work, another project, or another AI agent's active tools. | Classify by tool family, process ID, start time, parent chain, and task-created path; treat unknown ownership as shared. |
244
- | Automatically cleaning global caches, marketplace caches, OS temp roots, or browser profiles | May remove shared state, login state, or data other tools still need. | Automatically clean only task-owned / agent-managed bounded paths; report evidence and wait for confirmation otherwise. |
245
232
 
246
233
  ## Cross-reference
247
234
 
package/packs/safety.md CHANGED
@@ -22,7 +22,7 @@ Use for file operations, shell commands, Git changes, package managers, installe
22
22
  8. Branch deletion, tag deletion, force push, and history rewrite require separate explicit authorization and affected-ref verification. The absolute prohibitions in Rule 5 remain prohibited even when such authorization exists.
23
23
  9. Before staging or committing, inspect current status and avoid staging unrelated parent-repo, sibling-directory, generated, credential, or user-owned changes.
24
24
  10. Before using external APIs, SDKs, CLIs, package managers, deploy tools, cloud tools, release tools, browser automation, DevTools, Playwright, crawlers, notebooks, desktop app automation, or local helper services, verify current official documentation or project-local runbooks. For external tools, first apply the External Tool Usage Verification Gate in `dev/rules/integrations.md`: inspect current runtime tool schema for Connector / MCP calls, and use current official docs, official type definitions, official samples, or registered tool operation references for raw API / SDK / CLI / URI / plugin API work. Differentiate three layers of external access:
25
- (a) Anthropic-vetted Connectors (e.g. Notion / Google Drive / Slack via Claude Desktop Extensions): trust the vetted MCP server boundary only after inspecting the active runtime tool name, description, and input schema; still verify destructive write parameters before invocation.
25
+ (a) Anthropic-vetted Connectors: trust the vetted MCP server boundary only after inspecting the active runtime tool name, description, and input schema; still verify destructive write parameters before invocation.
26
26
  (b) Community / custom MCP servers (user-installed via manual config): treat with extra caution — destructive writes require dry-run + user confirmation; verify server behavior against current tool schema and project-local runbook if available.
27
27
  (c) Raw external APIs / SDKs / CLIs (no MCP layer): full Rule 10 verification of official docs required; mark unverified if blocked.
28
28
  11. Do not print, copy, log, commit, upload, or generate files containing secret values. Use redacted placeholders or line references.
@@ -1,7 +1,5 @@
1
1
  # Agent Handoff Kit Core Runtime
2
2
 
3
- This is the small always-read contract. Detailed task and closeout procedures live in routed packs.
4
-
5
3
  ## 1. Intent And Startup
6
4
 
7
5
  ### Upgrade lock guard
@@ -44,9 +42,9 @@ Until both gates pass, replace the card's `continuity ready` with `continuity in
44
42
 
45
43
  During explicit continuity startup, naming is a required presentation checkpoint when safe current-thread title control is available, not an optional task. After the minimum authorized startup reads, derive the current objective, boundary and recommended next action; resolve this checkpoint before emitting the final startup card or beginning any same-message authorized task work. Do not defer the tool call until after the final response or until the task is finished. If interrupted before the checkpoint resolves, handle it on the next user-authorized turn using current facts; do not schedule a background rename.
46
44
 
47
- Use `<project name>|<primary action>` from already-loaded facts: the concrete current user task first, then an unresolved current objective, then a concrete recommended action. Do not revive a completed child task from historical handoff text. When the project is known but no concrete action remains, use the project name alone; do not leave a new task named `開工` merely because the previous work is complete. If the project name is unknown, skip without guessing or extra source reads. `Start Agent Handoff`, `開工`, `開始交接工作` and `開始工作交接` are not primary actions. Titles must not contain progress, completion, status, task/session IDs, absolute paths, secrets or unverified facts.
45
+ Use `<project name>|<primary action>` from already-loaded facts: the concrete current user task first, then an unresolved current objective, then a concrete recommended action. Do not revive a completed child task from historical handoff text. When the project is known but no concrete action remains, use the project name alone. If the project name is unknown, skip without guessing or extra source reads. `Start Agent Handoff`, `開工`, `開始交接工作` and `開始工作交接` are not primary actions. Titles must not contain progress, completion, status, task/session IDs, absolute paths, secrets or unverified facts.
48
46
 
49
- Use the current runtime's exposed tool schema. If a safe current-thread title tool is already available, call it directly; otherwise use a bounded runtime tool-discovery mechanism once with a narrow title/rename/current-thread query, when available. Never invent a tool name or require discovery when the tool is already exposed. Current-title readback is useful when available, but is not required when the tool safely targets the calling/current thread. Replace a generic or stale title; keep an informative title when readback proves it is already relevant, and preserve an explicitly user-chosen title unless the user asks to change it. When the current title cannot be read, use one safe current-thread set call with the derived title. Omit the target identifier only when the schema documents current-thread targeting; otherwise require a verified current-thread identifier. Do not list or inspect unrelated threads solely for naming, and do not create, fork, navigate, message, archive, pin or otherwise manage tasks for this checkpoint.
47
+ Use the current runtime's exposed tool schema. If a safe current-thread title tool is already available, call it directly; otherwise use a bounded runtime tool-discovery mechanism once with a narrow title/rename/current-thread query, when available. Never invent a tool name. Current-title readback is useful when available, but is not required when the tool safely targets the calling/current thread. Replace a generic or stale title; keep an informative title when readback proves it is already relevant, and preserve an explicitly user-chosen title unless the user asks to change it. When the current title cannot be read, use one safe current-thread set call with the derived title. Omit the target identifier only when the schema documents current-thread targeting; otherwise require a verified current-thread identifier. Do not list or inspect unrelated threads solely for naming, and do not create, fork, navigate, message, archive, pin or otherwise manage tasks for this checkpoint.
50
48
 
51
49
  Before the final response, resolve the checkpoint as applied (successful tool result confirms the title), kept (relevant or user-chosen title), unavailable (no safe capability), skipped (project unknown), or failed/unverified (error or no confirmation). Use a targeted current-thread readback when available; an ambiguous write requires readback before any retry. Only a verified mismatch permits one safe corrective call; never loop or overwrite a later user rename. Do not assume a universal timing window or automatic-title overwrite across AI apps. An unavailable capability does not block startup; skip silently. A failed/unverified attempted rename gets a brief startup warning, not a success claim. Once resolved, return the card and stop for bare startup. On a later user-authorized turn, revisit naming when the primary task becomes concrete or changes, or a generic/stale title is observed; do not rename for tests, reviews or small substeps.
52
50
 
@@ -60,7 +58,7 @@ Before a non-trivial task, identify and read the required local and external tru
60
58
 
61
59
  Probe an integration only immediately before a task uses it, when the handoff explicitly identifies it as a dependency for the current objective, or when the user requests an integration health check. `TBD`, examples, blank rows, and undeclared placeholders are not installed integrations. Record `Last Verified` only after a real probe and through the normal persistence gate. Never write integration status merely because a session started.
62
60
 
63
- Show the startup card only for explicit continuity startup. For a plain continuity message, show the card after the minimum state recovery and end the turn; its recommended next action is advice, not permission to act. Render the startup card in a fenced `text` block and preserve spacing so the ASCII status marker remains aligned. The first-use exception above replaces that status-only stop with onboarding only when the handoff state is `eligible`, the objective is empty / `TBD`, and there is no same-message concrete task. An explicit same-message task or long-run continuation may combine the card with its first useful action. Direct ordinary tasks do not show the card. If onboarding is explicitly requested or first-use onboarding is triggered, combine any card and guidance in one response.
61
+ Show the startup card only for explicit continuity startup. For a plain continuity message, show the card after the minimum state recovery and end the turn; its recommended next action is advice, not permission to act. Render the startup card in a fenced `text` block and preserve spacing so the ASCII status marker remains aligned. An explicit same-message task or long-run continuation may combine the card with its first useful action. Direct ordinary tasks do not show the card. If onboarding is explicitly requested or first-use onboarding is triggered, combine any card and guidance in one response.
64
62
 
65
63
  For explicit bare continuity startup, after the handoff is read, the startup card may read only the bounded version evidence from `dev/PROJECT_INDEX.md`: the unique stable-semver `| Agent Handoff Kit template version | X.Y.Z | ... |` row inside the unique real `## Stack` section. Do not route on, summarize, or load any other Project Index content for startup, title, permissions, packs, health, or task work. Missing, unreadable, malformed, duplicate, prerelease, or out-of-Stack-only version evidence prints `version unverified`; the turn remains status-only with zero writes. A direct ordinary or stateless task does not read the handoff or Project Index merely to fill a card or version.
66
64
 
@@ -101,7 +99,7 @@ Choose exactly one tier after a task:
101
99
  2. Lightweight checkpoint: a durable fact affects future action while the session continues or may be interrupted. This is the default for ongoing sessions. Write only its smallest correct home; do not perform full closeout. Apply the bounded opening/mirror consistency rule below only when this checkpoint changes actionable state repeated there.
102
100
  3. Full closeout: explicit end-of-session / handoff intent, a real day / tool-session boundary, or a state where the current agent cannot continue and the next agent must take over. Ordinary external-tool use, a completed release / governance subtask, or a durable note during an ongoing session is not by itself a full closeout trigger. Load `dev/rules/closeout.md` only when this tier is selected.
103
101
 
104
- Pre-closeout checkpoint guard: before writing `dev/SESSION_HANDOFF.md` or `dev/SESSION_LOG.md` without explicit closeout / checkpoint intent, identify the durable fact, why the edited target authority or user-visible answer is insufficient, and why that file is the smallest correct home. Do not write either file merely because the next AI might misread stale state, because a target-authority document changed, or to make the handoff mirror every intermediate step. If the gate selects a checkpoint, update only the named current-state field(s) or one concise log entry; preserve unrelated / historical handoff sections byte-stable where practical. Without the opening-consistency condition below, do not regenerate `START_NEXT_SESSION_PROMPT.txt`.
102
+ Pre-closeout checkpoint guard: before writing `dev/SESSION_HANDOFF.md` or `dev/SESSION_LOG.md` without explicit closeout / checkpoint intent, identify the durable fact, why the edited target authority or user-visible answer is insufficient, and why that file is the smallest correct home. Do not write either file merely because the next AI might misread stale state, or because a target-authority document changed. If the gate selects a checkpoint, update only the named current-state field(s) or one concise log entry; preserve unrelated / historical handoff sections byte-stable where practical. Without the opening-consistency condition below, do not regenerate `START_NEXT_SESSION_PROMPT.txt`.
105
103
 
106
104
  Checkpoint opening consistency: when an authorized checkpoint changes actionable facts repeated in the `Next Session Opening Message`, reconcile only those affected current facts in that same checkpoint. Derive `START_NEXT_SESSION_PROMPT.txt` from the sole marked opening block only if normalized content differs, then verify the block/mirror and the changed objective, next action and completion boundary agree. Do not merely label an authoritative opening historical while leaving instructions to redo completed work. Preserve unrelated opening text and cold evidence; this condition does not authorize full closeout, new task work, extra source scans or persistence after an ordinary document edit.
107
105
 
@@ -152,7 +150,7 @@ The always-enforced closeout invariants are:
152
150
 
153
151
  Use `dev/RULE_PACKS.md` to load the minimum task-specific set. Read the applicable packs, including their project supplements and required references, before deciding how to act; an index, title or remembered summary is not the rule itself. Apply them within the user's actual objective and instruction priority: do not invent a replacement goal, acceptance standard or competing rule system. Missing or conflicting requirements must be resolved from their owners, not filled by an invented policy. Packs may add stricter requirements but cannot weaken core safety or continuity.
154
152
 
155
- Load `dev/rules/integrations.md` when the current task actually uses an external tool, not merely because a registry or placeholder table exists. Load `dev/rules/closeout.md` only for full closeout. If two packs conflict, use the safer and more verifiable path and record the unresolved conflict at closeout.
153
+ Load `dev/rules/integrations.md` when the current task actually uses an external tool, not merely because a registry or placeholder table exists. If two packs conflict, use the safer and more verifiable path and record the unresolved conflict at closeout.
156
154
 
157
155
  After the task, apply the Persistence Gate. Do not assume the next session remembers pack context, and do not use handoff or log as the only home for reusable procedures.
158
156