@adamchanadam/agent-handoff-kit 0.3.60 → 0.3.62

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  [繁體中文](README.md) · [Getting started](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-intro.en.html) · [Practical guide](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-guide.en.html) · [AI install page](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-ai-install.en.html)
4
4
 
5
- Source package version: `v0.3.60`. npm `@latest` and GitHub Release are verified by post-publish readback.
5
+ Source package version: `v0.3.62`. npm `@latest` and GitHub Release are verified by post-publish readback.
6
6
 
7
7
  <p align="center">
8
8
  <img src="https://raw.githubusercontent.com/Adamchanadam/agent-handoff-kit/main/images/agent-handoff-kit-promo-30s.gif" alt="Agent Handoff Kit overview animation" width="720">
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  English: [README.en.md](README.en.md) · [Getting started](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-intro.en.html) · [Practical guide](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-guide.en.html) · [AI install page](https://adamchanadam.github.io/agent-handoff-kit/agent-handoff-kit-ai-install.en.html)
4
4
 
5
- 原始碼套件版本:`v0.3.60`。npm `@latest` 與 GitHub Release 以發佈後讀回為準。
5
+ 原始碼套件版本:`v0.3.62`。npm `@latest` 與 GitHub Release 以發佈後讀回為準。
6
6
 
7
7
  <p align="center">
8
8
  <img src="https://raw.githubusercontent.com/Adamchanadam/agent-handoff-kit/main/images/agent-handoff-kit-promo-30s.gif" alt="Agent Handoff Kit 功能簡介動畫" width="720">
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { spawnSync } from "node:child_process";
3
4
  import { createInterface } from "node:readline/promises";
4
5
  import { stdin as input, stdout as output } from "node:process";
6
+ import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
5
7
  import { chmod, copyFile, link, lstat, mkdir, open, readFile, readdir, realpath, rename, rmdir, stat, unlink, writeFile } from "node:fs/promises";
6
8
  import { createHash, randomUUID } from "node:crypto";
7
9
  import { hostname } from "node:os";
@@ -567,7 +569,7 @@ async function main() {
567
569
  const version = await readPackageVersion();
568
570
  // `doctor` renders version alignment itself. Let that single health run own
569
571
  // the lookup instead of checking once here and once again inside doctor.
570
- if (command !== "closeout-status" && command !== "doctor") await maybePrintUpdateNotice(version);
572
+ if (!new Set(["closeout-status", "doctor", "workspace-health"]).has(command)) await maybePrintUpdateNotice(version);
571
573
  if (!command || options.help) {
572
574
  printHelp(version);
573
575
  return;
@@ -590,6 +592,11 @@ async function main() {
590
592
  return;
591
593
  }
592
594
 
595
+ if (command === "workspace-health") {
596
+ runWorkspaceHealth(root);
597
+ return;
598
+ }
599
+
593
600
  throw new Error(`unknown command "${command}"`);
594
601
  }
595
602
 
@@ -616,6 +623,13 @@ async function runCloseoutStatus(root, version) {
616
623
  }
617
624
  if (!assessPromptMirrorRoot(root).ok) findings.push("opening-message mirror is not current");
618
625
 
626
+ const workspaceHealth = collectWorkspaceHealth(root);
627
+ const workspaceFindings = assessHandoffWorkspaceIdentity(handoffText, workspaceHealth);
628
+ if (workspaceFindings.length > 0) {
629
+ findings.push("workspace identity read-back is not healthy");
630
+ details.push(...workspaceFindings);
631
+ }
632
+
619
633
  // A closeout card needs a fresh local health readback, not a version-notice
620
634
  // network request. The caller has already completed the closeout workflow.
621
635
  const doctor = await assessUpgradeNoopHealth(root, version, { skipVersionRegistryLookup: true });
@@ -682,6 +696,386 @@ function projectRequiredPersistence(value) {
682
696
  return "blocked";
683
697
  }
684
698
 
699
+ function runWorkspaceHealth(root) {
700
+ const health = collectWorkspaceHealth(root);
701
+ printWorkspaceHealth(health);
702
+ if (health.status !== "verified") process.exitCode = 1;
703
+ }
704
+
705
+ function collectWorkspaceHealth(root) {
706
+ const resolvedRoot = path.resolve(root);
707
+ const rootProbe = runGit(resolvedRoot, ["rev-parse", "--show-toplevel"]);
708
+ if (!rootProbe.ok) {
709
+ const fallback = collectWorkspaceHealthFromGitFiles(resolvedRoot, rootProbe.error);
710
+ if (fallback) return fallback;
711
+ return {
712
+ status: "verified",
713
+ root: resolvedRoot,
714
+ git: "no",
715
+ reason: "no .git metadata found",
716
+ details: []
717
+ };
718
+ }
719
+
720
+ const gitRoot = normalizeGitOutputPath(rootProbe.stdout.trim());
721
+ const branchProbe = runGit(resolvedRoot, ["rev-parse", "--abbrev-ref", "HEAD"]);
722
+ const headProbe = runGit(resolvedRoot, ["rev-parse", "HEAD"]);
723
+ const statusProbe = runGit(resolvedRoot, ["status", "--short", "--branch"]);
724
+ const worktreeProbe = runGit(resolvedRoot, ["worktree", "list", "--porcelain"]);
725
+ const statusLines = statusProbe.ok
726
+ ? statusProbe.stdout.split(/\r?\n/u).map((line) => line.trimEnd()).filter(Boolean)
727
+ : [];
728
+ const dirtyLines = statusLines.filter((line) => !line.startsWith("##"));
729
+ const worktreePaths = worktreeProbe.ok
730
+ ? parseGitWorktreePaths(worktreeProbe.stdout)
731
+ : [];
732
+ const failed = [
733
+ ["branch", branchProbe],
734
+ ["head", headProbe],
735
+ ["status", statusProbe],
736
+ ["worktree list", worktreeProbe]
737
+ ].filter(([, probe]) => !probe.ok);
738
+
739
+ return {
740
+ status: failed.length === 0 ? "verified" : "unverified",
741
+ root: resolvedRoot,
742
+ git: "yes",
743
+ gitRoot,
744
+ branch: branchProbe.ok ? branchProbe.stdout.trim() : "unverified",
745
+ head: headProbe.ok ? headProbe.stdout.trim() : "unverified",
746
+ dirty: statusProbe.ok ? dirtyLines.length > 0 : null,
747
+ dirtySummary: statusProbe.ok ? summarizeDirtyLines(dirtyLines) : "unverified",
748
+ worktreesVerified: worktreeProbe.ok,
749
+ worktreeCount: worktreePaths.length,
750
+ worktreePaths,
751
+ reason: failed.length === 0 ? "" : failed.map(([label, probe]) => `${label}: ${firstGitLine(probe) || probe.detail}`).join("; "),
752
+ details: failed.map(([label, probe]) => `${label}: ${firstGitLine(probe) || probe.detail}`)
753
+ };
754
+ }
755
+
756
+ function collectWorkspaceHealthFromGitFiles(root, commandError = "") {
757
+ const metadata = findGitMetadataRoot(root);
758
+ if (!metadata) return null;
759
+ const head = readGitHead(metadata.gitDir, metadata.commonDir);
760
+ const worktreePaths = readGitWorktreePathsFromMetadata(metadata);
761
+ return {
762
+ status: "verified",
763
+ root,
764
+ git: "yes",
765
+ gitRoot: metadata.worktreeRoot,
766
+ branch: head.branch,
767
+ head: head.commit,
768
+ dirty: null,
769
+ dirtySummary: "unverified",
770
+ worktreesVerified: true,
771
+ worktreeCount: worktreePaths.length,
772
+ worktreePaths,
773
+ reason: commandError ? `git command unavailable; read .git metadata directly (${commandError})` : "read .git metadata directly",
774
+ details: []
775
+ };
776
+ }
777
+
778
+ function findGitMetadataRoot(startPath) {
779
+ let current = path.resolve(startPath);
780
+ while (true) {
781
+ const dotGit = path.join(current, ".git");
782
+ if (pathExistsSync(dotGit)) {
783
+ const gitDir = resolveGitDir(dotGit);
784
+ if (gitDir) {
785
+ const commonDir = resolveGitCommonDir(gitDir);
786
+ return { worktreeRoot: current, gitDir, commonDir };
787
+ }
788
+ }
789
+ const parent = path.dirname(current);
790
+ if (parent === current) return null;
791
+ current = parent;
792
+ }
793
+ }
794
+
795
+ function resolveGitDir(dotGitPath) {
796
+ try {
797
+ const info = lstatSync(dotGitPath);
798
+ if (info.isDirectory()) return dotGitPath;
799
+ if (!info.isFile()) return "";
800
+ const text = readFileSync(dotGitPath, "utf8").trim();
801
+ const match = text.match(/^gitdir:\s*(.+)$/iu);
802
+ if (!match) return "";
803
+ const gitDir = match[1].trim();
804
+ return path.resolve(path.dirname(dotGitPath), gitDir);
805
+ } catch {
806
+ return "";
807
+ }
808
+ }
809
+
810
+ function resolveGitCommonDir(gitDir) {
811
+ const commonDirFile = path.join(gitDir, "commondir");
812
+ try {
813
+ const relative = readFileSync(commonDirFile, "utf8").trim();
814
+ if (relative) return path.resolve(gitDir, relative);
815
+ } catch {
816
+ // Ordinary repositories do not have a commondir file.
817
+ }
818
+ return gitDir;
819
+ }
820
+
821
+ function readGitHead(gitDir, commonDir) {
822
+ const rawHead = safeReadTextSync(path.join(gitDir, "HEAD")).trim();
823
+ if (!rawHead) return { branch: "unverified", commit: "unverified" };
824
+ if (!rawHead.startsWith("ref:")) return { branch: "HEAD", commit: rawHead };
825
+ const ref = rawHead.slice("ref:".length).trim();
826
+ const branch = ref.startsWith("refs/heads/") ? ref.slice("refs/heads/".length) : ref;
827
+ const commit = resolveGitRef(commonDir, ref) || "unverified";
828
+ return { branch, commit };
829
+ }
830
+
831
+ function resolveGitRef(commonDir, ref) {
832
+ const direct = safeReadTextSync(path.join(commonDir, ...ref.split("/"))).trim();
833
+ if (direct) return direct;
834
+ const packedRefs = safeReadTextSync(path.join(commonDir, "packed-refs"));
835
+ for (const line of packedRefs.split(/\r?\n/u)) {
836
+ if (!line || line.startsWith("#") || line.startsWith("^")) continue;
837
+ const [sha, packedRef] = line.trim().split(/\s+/u);
838
+ if (packedRef === ref) return sha;
839
+ }
840
+ return "";
841
+ }
842
+
843
+ function readGitWorktreePathsFromMetadata(metadata) {
844
+ const paths = new Set();
845
+ if (path.basename(metadata.commonDir) === ".git") paths.add(path.dirname(metadata.commonDir));
846
+ paths.add(metadata.worktreeRoot);
847
+ const worktreesDir = path.join(metadata.commonDir, "worktrees");
848
+ try {
849
+ for (const entry of readdirSync(worktreesDir, { withFileTypes: true })) {
850
+ if (!entry.isDirectory()) continue;
851
+ const gitdirText = safeReadTextSync(path.join(worktreesDir, entry.name, "gitdir")).trim();
852
+ if (gitdirText) paths.add(path.dirname(path.resolve(worktreesDir, entry.name, gitdirText)));
853
+ }
854
+ } catch {
855
+ // No linked worktrees.
856
+ }
857
+ return [...paths].map((entry) => path.resolve(entry));
858
+ }
859
+
860
+ function safeReadTextSync(filePath) {
861
+ try {
862
+ return readFileSync(filePath, "utf8");
863
+ } catch {
864
+ return "";
865
+ }
866
+ }
867
+
868
+ function pathExistsSync(filePath) {
869
+ try {
870
+ lstatSync(filePath);
871
+ return true;
872
+ } catch {
873
+ return false;
874
+ }
875
+ }
876
+
877
+ function runGit(root, args) {
878
+ const result = spawnSync("git", ["-C", root, ...args], {
879
+ encoding: "utf8",
880
+ timeout: 3000,
881
+ windowsHide: true,
882
+ maxBuffer: 1024 * 1024
883
+ });
884
+ const stdout = result.stdout ?? "";
885
+ const stderr = result.stderr ?? "";
886
+ return {
887
+ ok: !result.error && result.status === 0,
888
+ status: result.status,
889
+ stdout,
890
+ stderr,
891
+ error: result.error?.message ?? "",
892
+ detail: [stderr, stdout].join("\n").trim()
893
+ };
894
+ }
895
+
896
+ function parseGitWorktreePaths(outputText) {
897
+ return outputText
898
+ .split(/\r?\n/u)
899
+ .filter((line) => line.startsWith("worktree "))
900
+ .map((line) => normalizeGitOutputPath(line.slice("worktree ".length).trim()))
901
+ .filter(Boolean);
902
+ }
903
+
904
+ function firstGitLine(probe) {
905
+ return [probe.stderr, probe.stdout, probe.error, probe.detail]
906
+ .join("\n")
907
+ .split(/\r?\n/u)
908
+ .map((line) => line.trim())
909
+ .find(Boolean) ?? "";
910
+ }
911
+
912
+ function normalizeGitOutputPath(value) {
913
+ if (!value) return "";
914
+ try {
915
+ return path.resolve(value.replace(/\//gu, path.sep));
916
+ } catch {
917
+ return value;
918
+ }
919
+ }
920
+
921
+ function summarizeDirtyLines(lines) {
922
+ if (lines.length === 0) return "clean";
923
+ const sample = lines.slice(0, 5).join("; ");
924
+ return lines.length > 5 ? `${sample}; ... (${lines.length} entries)` : sample;
925
+ }
926
+
927
+ function printWorkspaceHealth(health) {
928
+ console.log(`root: ${health.root}`);
929
+ console.log(`workspace: ${health.status}`);
930
+ console.log(`git: ${health.git}`);
931
+ if (health.git === "yes") {
932
+ console.log(`git root: ${health.gitRoot}`);
933
+ console.log(`branch: ${health.branch}`);
934
+ console.log(`commit: ${health.head}`);
935
+ console.log(`dirty: ${health.dirty === null ? "unverified" : health.dirty ? "yes" : "no"}`);
936
+ if (health.dirty) console.log(`dirty summary: ${health.dirtySummary}`);
937
+ console.log(`worktrees: ${health.worktreesVerified ? health.worktreeCount : "unverified"}`);
938
+ if (health.worktreePaths.length > 1) {
939
+ for (const worktreePath of health.worktreePaths.slice(0, 5)) console.log(`- ${worktreePath}`);
940
+ if (health.worktreePaths.length > 5) console.log(`- ... (${health.worktreePaths.length} total)`);
941
+ }
942
+ }
943
+ if (health.reason) console.log(`reason: ${health.reason}`);
944
+ }
945
+
946
+ function assessHandoffWorkspaceIdentity(handoffText, health) {
947
+ const section = extractSectionText(handoffText, "workspace-identity", "Workspace Identity");
948
+ if (!section.trim()) return ["Workspace: handoff Workspace Identity section is unreadable"];
949
+ const findings = [];
950
+ if (health.status !== "verified") {
951
+ if (workspaceSectionClaimsVerifiedState(section)) {
952
+ findings.push(`Workspace: live workspace identity is unverified (${health.reason || "git probe failed"})`);
953
+ }
954
+ return findings.slice(0, 6);
955
+ }
956
+
957
+ if (health.git === "no") {
958
+ if (workspaceSectionClaimsGitRepository(section)) {
959
+ findings.push("Workspace: handoff records Git identity, but live root is not a Git repository");
960
+ }
961
+ return findings.slice(0, 6);
962
+ }
963
+
964
+ if (workspaceSectionClaimsNoGit(section)) {
965
+ findings.push(`Workspace: handoff says no Git, but live Git root is ${health.gitRoot}`);
966
+ }
967
+
968
+ const gitRootValue = workspaceFieldValue(section, "Git root");
969
+ if (hasSubstantiveWorkspaceValue(gitRootValue)
970
+ && !workspaceValueMeansNoGit(gitRootValue)
971
+ && !workspaceTextIncludesPath(gitRootValue, health.gitRoot)) {
972
+ findings.push(`Workspace: handoff Git root does not match live Git root ${health.gitRoot}`);
973
+ }
974
+
975
+ const branchValue = workspaceFieldValue(section, "Branch");
976
+ if (hasSubstantiveWorkspaceValue(branchValue)
977
+ && !workspaceValueMeansNoGit(branchValue)
978
+ && health.branch !== "unverified"
979
+ && !workspaceValueIncludesToken(branchValue, health.branch)
980
+ && !(health.branch === "HEAD" && /\b(detached|HEAD)\b/iu.test(branchValue))) {
981
+ findings.push(`Workspace: handoff branch does not match live branch ${health.branch}`);
982
+ }
983
+
984
+ const commitValue = workspaceFieldValue(section, "Commit");
985
+ if (hasSubstantiveWorkspaceValue(commitValue)
986
+ && !workspaceValueMeansNoGit(commitValue)
987
+ && health.head !== "unverified"
988
+ && !workspaceValueIncludesToken(commitValue, health.head)
989
+ && !workspaceValueIncludesToken(commitValue, health.head.slice(0, 7))) {
990
+ findings.push(`Workspace: handoff commit does not match live HEAD ${health.head.slice(0, 12)}`);
991
+ }
992
+
993
+ const worktreeValue = workspaceFieldValue(section, "Worktree / parallel workspace status") || section;
994
+ if (health.worktreesVerified && health.worktreeCount > 1 && workspaceValueClaimsNoParallelWorktree(worktreeValue)) {
995
+ findings.push(`Workspace: handoff says no parallel worktree, but Git reports ${health.worktreeCount} worktrees`);
996
+ }
997
+ if (!health.worktreesVerified && workspaceValueClaimsNoParallelWorktree(worktreeValue)) {
998
+ findings.push("Workspace: handoff says no parallel worktree, but Git worktree list is unverified");
999
+ }
1000
+
1001
+ const uncommittedValue = workspaceFieldValue(section, "Uncommitted changes summary");
1002
+ if (health.dirty === true && workspaceValueClaimsClean(uncommittedValue)) {
1003
+ findings.push("Workspace: handoff says worktree is clean, but live Git status has uncommitted changes");
1004
+ }
1005
+ if (health.dirty === false && workspaceValueClaimsDirty(uncommittedValue)) {
1006
+ findings.push("Workspace: handoff says worktree has uncommitted changes, but live Git status is clean");
1007
+ }
1008
+
1009
+ return findings.slice(0, 6);
1010
+ }
1011
+
1012
+ function workspaceFieldValue(section, label) {
1013
+ const escaped = escapeRegExp(label);
1014
+ const line = section.split(/\r?\n/u).find((candidate) => new RegExp(`^\\s*(?:[-*]\\s*)?${escaped}\\s*:`, "iu").test(candidate.trim()));
1015
+ if (!line) return "";
1016
+ return line.slice(line.indexOf(":") + 1).trim();
1017
+ }
1018
+
1019
+ function hasSubstantiveWorkspaceValue(value) {
1020
+ const normalized = (value ?? "").replace(/[`"'。.]+/gu, "").trim();
1021
+ if (!normalized) return false;
1022
+ return !/^(TBD|todo|pending|unknown|unverified|not_assessed|n\/a|not_applicable|none|待定|待確認|未知|未核實|未核验|不適用)$/iu.test(normalized);
1023
+ }
1024
+
1025
+ function workspaceValueMeansNoGit(value) {
1026
+ return /\b(no git|non-git|not a git repository|not_git)\b|(?:沒有|無|不是).{0,12}\bGit\b/iu.test(value ?? "");
1027
+ }
1028
+
1029
+ function workspaceSectionClaimsNoGit(section) {
1030
+ return workspaceValueMeansNoGit(workspaceFieldValue(section, "Git root"))
1031
+ || workspaceValueMeansNoGit(section);
1032
+ }
1033
+
1034
+ function workspaceSectionClaimsGitRepository(section) {
1035
+ const values = [
1036
+ workspaceFieldValue(section, "Git root"),
1037
+ workspaceFieldValue(section, "Branch"),
1038
+ workspaceFieldValue(section, "Commit")
1039
+ ];
1040
+ return values.some((value) => hasSubstantiveWorkspaceValue(value) && !workspaceValueMeansNoGit(value));
1041
+ }
1042
+
1043
+ function workspaceSectionClaimsVerifiedState(section) {
1044
+ return workspaceSectionClaimsGitRepository(section)
1045
+ || workspaceValueClaimsNoParallelWorktree(workspaceFieldValue(section, "Worktree / parallel workspace status"))
1046
+ || workspaceValueClaimsClean(workspaceFieldValue(section, "Uncommitted changes summary"))
1047
+ || workspaceValueClaimsDirty(workspaceFieldValue(section, "Uncommitted changes summary"));
1048
+ }
1049
+
1050
+ function workspaceTextIncludesPath(text, targetPath) {
1051
+ if (!targetPath) return false;
1052
+ const normalize = (value) => {
1053
+ const replaced = String(value).replace(/[`"']/gu, "").replace(/\\/gu, "/").replace(/\/+$/u, "");
1054
+ return process.platform === "win32" ? replaced.toLowerCase() : replaced;
1055
+ };
1056
+ return normalize(text).includes(normalize(targetPath));
1057
+ }
1058
+
1059
+ function workspaceValueIncludesToken(value, token) {
1060
+ if (!token) return false;
1061
+ return new RegExp(`(^|[^\\w.-])${escapeRegExp(token)}($|[^\\w.-])`, "iu").test(value ?? "");
1062
+ }
1063
+
1064
+ function workspaceValueClaimsNoParallelWorktree(value) {
1065
+ return /\b(no|none|single|only one|1)\b.{0,50}\b(parallel|worktrees?|worktree)\b|\b(no other|no parallel)\b.{0,40}\b(worktrees?|workspace)?\b|(?:沒有|無|沒有其他|無其他).{0,20}(?:平行|parallel|worktree)|(?:單一|只有一個).{0,20}(?:worktree|工作區)/iu.test(value ?? "");
1066
+ }
1067
+
1068
+ function workspaceValueClaimsClean(value) {
1069
+ const normalized = value ?? "";
1070
+ return /\b(clean|no uncommitted|nothing to commit|no changes|0 changes)\b|(?:沒有|無).{0,20}未提交|(?:乾淨|干净)/iu.test(normalized);
1071
+ }
1072
+
1073
+ function workspaceValueClaimsDirty(value) {
1074
+ const normalized = value ?? "";
1075
+ if (workspaceValueClaimsClean(normalized)) return false;
1076
+ return /\b(dirty|uncommitted|modified|local edits?|dirty set|edit set)\b|未提交|有修改|有變更/iu.test(normalized);
1077
+ }
1078
+
685
1079
  function printCloseoutStatusCard(version, result) {
686
1080
  console.log(` /\\_/\\ Agent Handoff Kit v${version}`);
687
1081
  if (result.ok) {
@@ -6061,12 +6455,14 @@ Usage:
6061
6455
  agent-handoff-kit init [--dry-run] [--yes] [--root <path>]
6062
6456
  agent-handoff-kit upgrade [--dry-run] [--yes] [--root <path>]
6063
6457
  agent-handoff-kit doctor [--root <path>]
6458
+ agent-handoff-kit workspace-health [--root <path>]
6064
6459
  agent-handoff-kit closeout-status [--root <path>]
6065
6460
 
6066
6461
  Commands:
6067
6462
  init Plan or install missing core files and rule packs.
6068
6463
  upgrade Preserve existing files; merge safe core updates or report conflicts.
6069
6464
  doctor Check required installed files.
6465
+ workspace-health Read live root / Git / worktree state without writing files.
6070
6466
  closeout-status Render the state-bound closeout card after a full closeout.
6071
6467
 
6072
6468
  中文速讀:
@@ -6092,6 +6488,7 @@ Commands:
6092
6488
  npx --yes @adamchanadam/agent-handoff-kit@latest init
6093
6489
  npx --yes @adamchanadam/agent-handoff-kit@latest upgrade
6094
6490
  npx --yes @adamchanadam/agent-handoff-kit@latest doctor
6491
+ npx --yes @adamchanadam/agent-handoff-kit@latest workspace-health
6095
6492
 
6096
6493
  升級前如想先看會改甚麼,才用預演:
6097
6494
  npx --yes @adamchanadam/agent-handoff-kit@latest upgrade --dry-run
@@ -12551,6 +12551,356 @@
12551
12551
  "canonicalSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef"
12552
12552
  }
12553
12553
  }
12554
+ },
12555
+ "0.3.60": {
12556
+ "source": {
12557
+ "npm": {
12558
+ "spec": "@adamchanadam/agent-handoff-kit@0.3.60",
12559
+ "shasum": "242a15f7b8fcf3062c265395f09180554e7406ba",
12560
+ "integrity": "sha512-0nrv8bgHQs1dzC4xOJWM4robGhEVhouk5FulJq7dXXqYuaQPJ0U5Wx42nHTW4kV1GvXc2kHi+6iqLbi38MV8Ew==",
12561
+ "entryCount": 34,
12562
+ "gitHead": "8067c91cf6813000a02eef7426fdf9c3e0a45734"
12563
+ },
12564
+ "git": {
12565
+ "tag": "v0.3.60",
12566
+ "directObject": "8067c91cf6813000a02eef7426fdf9c3e0a45734",
12567
+ "peeledCommit": null,
12568
+ "commit": "8067c91cf6813000a02eef7426fdf9c3e0a45734"
12569
+ },
12570
+ "githubRelease": {
12571
+ "tag": "v0.3.60",
12572
+ "publishedAt": "2026-08-08T21:38:50Z"
12573
+ },
12574
+ "sourceDivergence": {
12575
+ "status": "same-commit",
12576
+ "npmGitHead": "8067c91cf6813000a02eef7426fdf9c3e0a45734",
12577
+ "remoteTagCommit": "8067c91cf6813000a02eef7426fdf9c3e0a45734"
12578
+ }
12579
+ },
12580
+ "manifest": {
12581
+ "AGENTS.md": {
12582
+ "state": "present",
12583
+ "contentId": "8b7d0d1f393ef31dad5affa802ccff999ca0805e7fcb24791bd7276c1c5d967c",
12584
+ "rawSha256": "9d56cf1546da08679b6b3c431f0aaf5e44f1f6247629d09d1913674f07782824",
12585
+ "normalizedSha256": "9d56cf1546da08679b6b3c431f0aaf5e44f1f6247629d09d1913674f07782824",
12586
+ "canonicalSha256": "9d56cf1546da08679b6b3c431f0aaf5e44f1f6247629d09d1913674f07782824"
12587
+ },
12588
+ "CLAUDE.md": {
12589
+ "state": "present",
12590
+ "contentId": "7a2cf08a1171762ebcb53f43036a2170655379416945258b9c85d4b189ecaecf",
12591
+ "rawSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
12592
+ "normalizedSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
12593
+ "canonicalSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad"
12594
+ },
12595
+ "GEMINI.md": {
12596
+ "state": "present",
12597
+ "contentId": "36da47034bb2ce6c760ddbbbbd49dccc1d17665dbb18bec56ffa3b26bac1c135",
12598
+ "rawSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
12599
+ "normalizedSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
12600
+ "canonicalSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986"
12601
+ },
12602
+ "START_NEXT_SESSION_PROMPT.txt": {
12603
+ "state": "present",
12604
+ "contentId": "de01669f2989762269e57b8f71decc55d58effa649a245136efa6dc1434b78a9",
12605
+ "rawSha256": "99008837f298fa1c20d1ab2c5397b5e7ea762287b58e78ad452951fa4cc235d0",
12606
+ "normalizedSha256": "99008837f298fa1c20d1ab2c5397b5e7ea762287b58e78ad452951fa4cc235d0",
12607
+ "canonicalSha256": "b1b9ad0cb5f3a374542a43b6c2c938e1e5d39dd42b91d12a4a74206f5f187113"
12608
+ },
12609
+ "dev/SESSION_HANDOFF.md": {
12610
+ "state": "present",
12611
+ "contentId": "df3d7d3bed1b51793910643d74b2391bbd79686acd1537b87f0d332548a35399",
12612
+ "rawSha256": "f676a8aa0ebf71d9cce75ddc8e15781efe02356d54ff6129b8634f0cd988d324",
12613
+ "normalizedSha256": "f676a8aa0ebf71d9cce75ddc8e15781efe02356d54ff6129b8634f0cd988d324",
12614
+ "canonicalSha256": "e64a5a0b9dd1b4bcade6bb0bae4870b5ab7d2fa550a826e957a53d853a5e032f"
12615
+ },
12616
+ "dev/SESSION_LOG.md": {
12617
+ "state": "present",
12618
+ "contentId": "7b6184ee4dabe89f504a894c3d4803f012d962c7af53c7f29801a8fb28d9d51c",
12619
+ "rawSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47",
12620
+ "normalizedSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47",
12621
+ "canonicalSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47"
12622
+ },
12623
+ "dev/PROJECT_INDEX.md": {
12624
+ "state": "present",
12625
+ "contentId": "c2ff51ecd87013f6301a0697d9bc2937eac218cf684ae39341a282250ec46897",
12626
+ "rawSha256": "6907ced264bc9c4ce182fefc63f3d2b4c0be97914dbbe2e58bada61edff1ae7e",
12627
+ "normalizedSha256": "341ecffecee274ea974cd9501b4e8e3ba0b7fbc8d873c5c639b1f5ae06a05382",
12628
+ "canonicalSha256": "8fd316fca77004a94404582a5152c2bbdcf89610b52e7c0fdbfb0076c5cdd759"
12629
+ },
12630
+ "dev/DOC_SYNC_REGISTRY.md": {
12631
+ "state": "present",
12632
+ "contentId": "f6545b524dc440d3563041e04a05caff4229863f6cae2a39127f85a29a120249",
12633
+ "rawSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6",
12634
+ "normalizedSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6",
12635
+ "canonicalSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6"
12636
+ },
12637
+ "dev/RULE_PACKS.md": {
12638
+ "state": "present",
12639
+ "contentId": "9e9643115e4abef66f2c52510c0c63ce0f4a978ceb0ed5655b7c9c07a4f98c39",
12640
+ "rawSha256": "5715644cf26aa64fa42bf2173e02cadeff1731d6ea1647cfcde4bbf0915f4230",
12641
+ "normalizedSha256": "5715644cf26aa64fa42bf2173e02cadeff1731d6ea1647cfcde4bbf0915f4230",
12642
+ "canonicalSha256": "5715644cf26aa64fa42bf2173e02cadeff1731d6ea1647cfcde4bbf0915f4230"
12643
+ },
12644
+ "dev/PROJECT_DECISIONS.md": {
12645
+ "state": "present",
12646
+ "contentId": "3aae993bd5b85bf6b1d1d458f1bcf82c7d3105c843f053ffa13553bb5931b8c4",
12647
+ "rawSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e",
12648
+ "normalizedSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e",
12649
+ "canonicalSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e"
12650
+ },
12651
+ "dev/rules/safety.md": {
12652
+ "state": "present",
12653
+ "contentId": "dd6bcf74722d038f76d202e2044a6583a6e6ad107fbb010520e513eec799ff4a",
12654
+ "rawSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0",
12655
+ "normalizedSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0",
12656
+ "canonicalSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0"
12657
+ },
12658
+ "dev/rules/coding.md": {
12659
+ "state": "present",
12660
+ "contentId": "1c6deb9a5a281c13e97b0ac96079e9e1beccbd1ff106186e7a6ac78c0eeb75c2",
12661
+ "rawSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
12662
+ "normalizedSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
12663
+ "canonicalSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4"
12664
+ },
12665
+ "dev/rules/writing.md": {
12666
+ "state": "present",
12667
+ "contentId": "ceee5412520ba860e6b40de46bb164e2ce3919d2197d5fadb926198eb7dddd3b",
12668
+ "rawSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
12669
+ "normalizedSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
12670
+ "canonicalSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593"
12671
+ },
12672
+ "dev/rules/research.md": {
12673
+ "state": "present",
12674
+ "contentId": "4414f9c82c6d04ad49d7446f4b0740055242f425ef5b00391d9c8c78c96c0f66",
12675
+ "rawSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
12676
+ "normalizedSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
12677
+ "canonicalSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104"
12678
+ },
12679
+ "dev/rules/agent-governance.md": {
12680
+ "state": "present",
12681
+ "contentId": "5a0d043130825f68dc53329450c5101c3b595bd2675e70b731a29309b4394415",
12682
+ "rawSha256": "98a7f5805783bf98b446c3ef29f019d53a9b9d51fd15f401ea91daab2f708860",
12683
+ "normalizedSha256": "98a7f5805783bf98b446c3ef29f019d53a9b9d51fd15f401ea91daab2f708860",
12684
+ "canonicalSha256": "98a7f5805783bf98b446c3ef29f019d53a9b9d51fd15f401ea91daab2f708860"
12685
+ },
12686
+ "dev/rules/release.md": {
12687
+ "state": "present",
12688
+ "contentId": "b0a0c9dea88016185f4093f9be4ce3c0e29904222e21dd1fa1735fcc1bb7e744",
12689
+ "rawSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
12690
+ "normalizedSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
12691
+ "canonicalSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7"
12692
+ },
12693
+ "dev/rules/knowledge.md": {
12694
+ "state": "present",
12695
+ "contentId": "e6f5795c7ebaba7b05f04d971b2942b5a0394a3babb44f64a1cc591c9a08cb86",
12696
+ "rawSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c",
12697
+ "normalizedSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c",
12698
+ "canonicalSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c"
12699
+ },
12700
+ "dev/rules/communication.md": {
12701
+ "state": "present",
12702
+ "contentId": "34fd0034cbc75dad43f789b86a414763f01916dda4d59876db9c4d8d92ae6a87",
12703
+ "rawSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
12704
+ "normalizedSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
12705
+ "canonicalSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591"
12706
+ },
12707
+ "dev/rules/closeout.md": {
12708
+ "state": "present",
12709
+ "contentId": "0d0c85ac4318670d9ffba85e46cc709ee3b0a9bcb0ad7586079859f98e0a1c72",
12710
+ "rawSha256": "45b8019de97dd730380af9c211da92b541580797a66694b9b4188bed49e999b6",
12711
+ "normalizedSha256": "45b8019de97dd730380af9c211da92b541580797a66694b9b4188bed49e999b6",
12712
+ "canonicalSha256": "45b8019de97dd730380af9c211da92b541580797a66694b9b4188bed49e999b6"
12713
+ },
12714
+ "dev/rules/onboarding.md": {
12715
+ "state": "present",
12716
+ "contentId": "3989b14439cd64894d9cad444e73e35d0a5c1c67e85991819111483d1df67124",
12717
+ "rawSha256": "ffd0f2337cf1f5998d94ede375af920a0f14e9662ee6b50ca8b568511ac9d5d8",
12718
+ "normalizedSha256": "ffd0f2337cf1f5998d94ede375af920a0f14e9662ee6b50ca8b568511ac9d5d8",
12719
+ "canonicalSha256": "ffd0f2337cf1f5998d94ede375af920a0f14e9662ee6b50ca8b568511ac9d5d8"
12720
+ },
12721
+ "dev/rules/integrations.md": {
12722
+ "state": "present",
12723
+ "contentId": "a8fc1099da28f511bf9fed5eaf629ca10fb409299b0aed4d233a45fc7701f284",
12724
+ "rawSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef",
12725
+ "normalizedSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef",
12726
+ "canonicalSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef"
12727
+ }
12728
+ }
12729
+ },
12730
+ "0.3.61": {
12731
+ "source": {
12732
+ "npm": {
12733
+ "spec": "@adamchanadam/agent-handoff-kit@0.3.61",
12734
+ "shasum": "cf91982cb6e07c721b83a6f7ad966363df130e62",
12735
+ "integrity": "sha512-/yWddSi0sFrrEuXL2RlFxCEbpMNTpSWVxeACW51BgKhbfNlTySfPZRONQRDGw5jOF6YZfeoPzVgMSAWdNPBRVQ==",
12736
+ "entryCount": 34,
12737
+ "gitHead": "e6a1960713521a13b8028ecb06f3c8b30ae388a8"
12738
+ },
12739
+ "git": {
12740
+ "tag": "v0.3.61",
12741
+ "directObject": "e6a1960713521a13b8028ecb06f3c8b30ae388a8",
12742
+ "peeledCommit": null,
12743
+ "commit": "e6a1960713521a13b8028ecb06f3c8b30ae388a8"
12744
+ },
12745
+ "githubRelease": {
12746
+ "tag": "v0.3.61",
12747
+ "publishedAt": "2026-08-08T23:13:16Z"
12748
+ },
12749
+ "sourceDivergence": {
12750
+ "status": "same-commit",
12751
+ "npmGitHead": "e6a1960713521a13b8028ecb06f3c8b30ae388a8",
12752
+ "remoteTagCommit": "e6a1960713521a13b8028ecb06f3c8b30ae388a8"
12753
+ }
12754
+ },
12755
+ "manifest": {
12756
+ "AGENTS.md": {
12757
+ "state": "present",
12758
+ "contentId": "c48570efb996d5b9fd25bdbcd29a3ddd0ff25e2e6f3ed1185370d61b3ef94dd7",
12759
+ "rawSha256": "cebf6a899d26ce7e92364fe0effccdc268bc57bfb919c68b6be35ee13d1c2e59",
12760
+ "normalizedSha256": "cebf6a899d26ce7e92364fe0effccdc268bc57bfb919c68b6be35ee13d1c2e59",
12761
+ "canonicalSha256": "cebf6a899d26ce7e92364fe0effccdc268bc57bfb919c68b6be35ee13d1c2e59"
12762
+ },
12763
+ "CLAUDE.md": {
12764
+ "state": "present",
12765
+ "contentId": "7a2cf08a1171762ebcb53f43036a2170655379416945258b9c85d4b189ecaecf",
12766
+ "rawSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
12767
+ "normalizedSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
12768
+ "canonicalSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad"
12769
+ },
12770
+ "GEMINI.md": {
12771
+ "state": "present",
12772
+ "contentId": "36da47034bb2ce6c760ddbbbbd49dccc1d17665dbb18bec56ffa3b26bac1c135",
12773
+ "rawSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
12774
+ "normalizedSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
12775
+ "canonicalSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986"
12776
+ },
12777
+ "START_NEXT_SESSION_PROMPT.txt": {
12778
+ "state": "present",
12779
+ "contentId": "de01669f2989762269e57b8f71decc55d58effa649a245136efa6dc1434b78a9",
12780
+ "rawSha256": "bb947db0648d3ba537ac03b58e5156cd01b9c056490f9353d65dee1a76c1b6b0",
12781
+ "normalizedSha256": "bb947db0648d3ba537ac03b58e5156cd01b9c056490f9353d65dee1a76c1b6b0",
12782
+ "canonicalSha256": "b1b9ad0cb5f3a374542a43b6c2c938e1e5d39dd42b91d12a4a74206f5f187113"
12783
+ },
12784
+ "dev/SESSION_HANDOFF.md": {
12785
+ "state": "present",
12786
+ "contentId": "54e20421bf99c389617d6cca9d3c8182bb836ed087a01c0ae98e55012ac393ea",
12787
+ "rawSha256": "2474f38a76799cd82c0f883c705bfe4e971438082b807fafed37fe771e712c57",
12788
+ "normalizedSha256": "2474f38a76799cd82c0f883c705bfe4e971438082b807fafed37fe771e712c57",
12789
+ "canonicalSha256": "fc4bf3ddddfa198a13d0ca610ad375a80fb79ec9ef9a7284da75f011969d1d94"
12790
+ },
12791
+ "dev/SESSION_LOG.md": {
12792
+ "state": "present",
12793
+ "contentId": "7b6184ee4dabe89f504a894c3d4803f012d962c7af53c7f29801a8fb28d9d51c",
12794
+ "rawSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47",
12795
+ "normalizedSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47",
12796
+ "canonicalSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47"
12797
+ },
12798
+ "dev/PROJECT_INDEX.md": {
12799
+ "state": "present",
12800
+ "contentId": "c2ff51ecd87013f6301a0697d9bc2937eac218cf684ae39341a282250ec46897",
12801
+ "rawSha256": "1a0e221fe5ad767c86475583e7aaf7e864f946de892569917622af85374784f8",
12802
+ "normalizedSha256": "f5474e91045cece1a988e850eb1380605bec407fee0e259a69d7674975848d0d",
12803
+ "canonicalSha256": "8fd316fca77004a94404582a5152c2bbdcf89610b52e7c0fdbfb0076c5cdd759"
12804
+ },
12805
+ "dev/DOC_SYNC_REGISTRY.md": {
12806
+ "state": "present",
12807
+ "contentId": "f6545b524dc440d3563041e04a05caff4229863f6cae2a39127f85a29a120249",
12808
+ "rawSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6",
12809
+ "normalizedSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6",
12810
+ "canonicalSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6"
12811
+ },
12812
+ "dev/RULE_PACKS.md": {
12813
+ "state": "present",
12814
+ "contentId": "9e9643115e4abef66f2c52510c0c63ce0f4a978ceb0ed5655b7c9c07a4f98c39",
12815
+ "rawSha256": "5715644cf26aa64fa42bf2173e02cadeff1731d6ea1647cfcde4bbf0915f4230",
12816
+ "normalizedSha256": "5715644cf26aa64fa42bf2173e02cadeff1731d6ea1647cfcde4bbf0915f4230",
12817
+ "canonicalSha256": "5715644cf26aa64fa42bf2173e02cadeff1731d6ea1647cfcde4bbf0915f4230"
12818
+ },
12819
+ "dev/PROJECT_DECISIONS.md": {
12820
+ "state": "present",
12821
+ "contentId": "3aae993bd5b85bf6b1d1d458f1bcf82c7d3105c843f053ffa13553bb5931b8c4",
12822
+ "rawSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e",
12823
+ "normalizedSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e",
12824
+ "canonicalSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e"
12825
+ },
12826
+ "dev/rules/safety.md": {
12827
+ "state": "present",
12828
+ "contentId": "dd6bcf74722d038f76d202e2044a6583a6e6ad107fbb010520e513eec799ff4a",
12829
+ "rawSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0",
12830
+ "normalizedSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0",
12831
+ "canonicalSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0"
12832
+ },
12833
+ "dev/rules/coding.md": {
12834
+ "state": "present",
12835
+ "contentId": "1c6deb9a5a281c13e97b0ac96079e9e1beccbd1ff106186e7a6ac78c0eeb75c2",
12836
+ "rawSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
12837
+ "normalizedSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
12838
+ "canonicalSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4"
12839
+ },
12840
+ "dev/rules/writing.md": {
12841
+ "state": "present",
12842
+ "contentId": "ceee5412520ba860e6b40de46bb164e2ce3919d2197d5fadb926198eb7dddd3b",
12843
+ "rawSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
12844
+ "normalizedSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
12845
+ "canonicalSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593"
12846
+ },
12847
+ "dev/rules/research.md": {
12848
+ "state": "present",
12849
+ "contentId": "4414f9c82c6d04ad49d7446f4b0740055242f425ef5b00391d9c8c78c96c0f66",
12850
+ "rawSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
12851
+ "normalizedSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
12852
+ "canonicalSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104"
12853
+ },
12854
+ "dev/rules/agent-governance.md": {
12855
+ "state": "present",
12856
+ "contentId": "5a0d043130825f68dc53329450c5101c3b595bd2675e70b731a29309b4394415",
12857
+ "rawSha256": "98a7f5805783bf98b446c3ef29f019d53a9b9d51fd15f401ea91daab2f708860",
12858
+ "normalizedSha256": "98a7f5805783bf98b446c3ef29f019d53a9b9d51fd15f401ea91daab2f708860",
12859
+ "canonicalSha256": "98a7f5805783bf98b446c3ef29f019d53a9b9d51fd15f401ea91daab2f708860"
12860
+ },
12861
+ "dev/rules/release.md": {
12862
+ "state": "present",
12863
+ "contentId": "b0a0c9dea88016185f4093f9be4ce3c0e29904222e21dd1fa1735fcc1bb7e744",
12864
+ "rawSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
12865
+ "normalizedSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
12866
+ "canonicalSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7"
12867
+ },
12868
+ "dev/rules/knowledge.md": {
12869
+ "state": "present",
12870
+ "contentId": "e6f5795c7ebaba7b05f04d971b2942b5a0394a3babb44f64a1cc591c9a08cb86",
12871
+ "rawSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c",
12872
+ "normalizedSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c",
12873
+ "canonicalSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c"
12874
+ },
12875
+ "dev/rules/communication.md": {
12876
+ "state": "present",
12877
+ "contentId": "34fd0034cbc75dad43f789b86a414763f01916dda4d59876db9c4d8d92ae6a87",
12878
+ "rawSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
12879
+ "normalizedSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
12880
+ "canonicalSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591"
12881
+ },
12882
+ "dev/rules/closeout.md": {
12883
+ "state": "present",
12884
+ "contentId": "0f41dae8104d06e1c4aaa6d25c8db12d0e4d93bbd9bdf5aed2dd6d18c25c8893",
12885
+ "rawSha256": "e21b0885f3a9b971bd05bdb54e07966ab72eff33bd84242a7c218f9cf6da1f6f",
12886
+ "normalizedSha256": "e21b0885f3a9b971bd05bdb54e07966ab72eff33bd84242a7c218f9cf6da1f6f",
12887
+ "canonicalSha256": "e21b0885f3a9b971bd05bdb54e07966ab72eff33bd84242a7c218f9cf6da1f6f"
12888
+ },
12889
+ "dev/rules/onboarding.md": {
12890
+ "state": "present",
12891
+ "contentId": "3989b14439cd64894d9cad444e73e35d0a5c1c67e85991819111483d1df67124",
12892
+ "rawSha256": "ffd0f2337cf1f5998d94ede375af920a0f14e9662ee6b50ca8b568511ac9d5d8",
12893
+ "normalizedSha256": "ffd0f2337cf1f5998d94ede375af920a0f14e9662ee6b50ca8b568511ac9d5d8",
12894
+ "canonicalSha256": "ffd0f2337cf1f5998d94ede375af920a0f14e9662ee6b50ca8b568511ac9d5d8"
12895
+ },
12896
+ "dev/rules/integrations.md": {
12897
+ "state": "present",
12898
+ "contentId": "a8fc1099da28f511bf9fed5eaf629ca10fb409299b0aed4d233a45fc7701f284",
12899
+ "rawSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef",
12900
+ "normalizedSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef",
12901
+ "canonicalSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef"
12902
+ }
12903
+ }
12554
12904
  }
12555
12905
  },
12556
12906
  "contents": {
@@ -13398,7 +13748,32 @@
13398
13748
  "targetRel": "AGENTS.md",
13399
13749
  "canonicalSha256": "a3039356a5e997ed87d1fb8a27eb29a093e12d11a07ef0ea5d11c8e2568a906b",
13400
13750
  "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\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\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, one optional display-only current-thread title update 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\nDuring explicit continuity startup, the only optional presentation effect beyond state recovery and card/status is a user-visible task/conversation title update, when the active runtime safely supports current-thread title control. Current-title readback is useful when available to avoid overwriting an already informative title, but it is not required when the tool safely targets the calling/current thread. If title control is exposed only through a bounded runtime tool-discovery mechanism, use that discovery once with a narrow title/rename/current-thread query before deciding the control is unavailable; then call only the discovered safe current-thread title tool. Do not list or inspect unrelated threads solely for naming, and do not create, fork, navigate, message, archive, pin, or otherwise manage tasks as part of startup title naming. Do not title from the raw continuity trigger or before handoff-derived startup facts are final. First derive the startup card's current objective, risk/boundary, and recommended next action; then choose and apply any title update as the last presentation side effect before returning the startup response. Replace only a generic or stale title, or update once when the main objective clearly changes; keep an informative title when readback proves it is already relevant, and do not rename for tests, reviews, or small substeps. Use `<project name>|<primary action>` from facts already loaded for startup: a concrete same-message task first, otherwise the loaded current objective plus recommended next action. Within those facts, select one concrete primary action in this order: the same-message task; the loaded current objective; the recommended next action. The continuity trigger itself and generic phrases such as `Start Agent Handoff`, `開工`, `開始交接工作`, or `開始工作交接` are not primary actions. If the loaded facts do not provide both a concrete project name and a concrete primary action, skip the title update. Do not read `dev/PROJECT_INDEX.md`, files, network, or other state solely to name the title. The title must not contain progress, completion, status, task/session IDs, absolute paths, secrets, or unverified facts. If safe current-thread title control is unavailable after the bounded discovery above, skip silently. The title is display-only; it is not project state, permission, progress, completion evidence, a health result, or a source of truth, and it does not authorize project/file writes, network activity, external task work, 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. 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>\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- 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- 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\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 regenerate the startup mirror or perform full closeout.\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\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. Permission or lock failure is a stop condition, not permission to elevate or switch to a riskier command.\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. Closeout is not complete until required files are written, read back, and the available closeout checks pass.\n5. 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.\n6. 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. 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. 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 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=3c1eb60446b6a065753c20c8b5c069d1085761fdc796cfc5be125a5cd5ec8231 -->\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"
13751
+ },
13752
+ "8b7d0d1f393ef31dad5affa802ccff999ca0805e7fcb24791bd7276c1c5d967c": {
13753
+ "targetRel": "AGENTS.md",
13754
+ "canonicalSha256": "9d56cf1546da08679b6b3c431f0aaf5e44f1f6247629d09d1913674f07782824",
13755
+ "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\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\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, one optional display-only current-thread title update 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\nDuring explicit continuity startup, the only optional presentation effect beyond state recovery and card/status is a user-visible task/conversation title update, when the active runtime safely supports current-thread title control. Current-title readback is useful when available to avoid overwriting an already informative title, but it is not required when the tool safely targets the calling/current thread. If title control is exposed only through a bounded runtime tool-discovery mechanism, use that discovery once with a narrow title/rename/current-thread query before deciding the control is unavailable; then call only the discovered safe current-thread title tool. Do not list or inspect unrelated threads solely for naming, and do not create, fork, navigate, message, archive, pin, or otherwise manage tasks as part of startup title naming. Do not title from the raw continuity trigger or before handoff-derived startup facts are final. First derive the startup card's current objective, risk/boundary, and recommended next action; then choose and apply any title update as the last presentation side effect before returning the startup response. Replace only a generic or stale title, or update once when the main objective clearly changes; keep an informative title when readback proves it is already relevant, and do not rename for tests, reviews, or small substeps. Use `<project name>|<primary action>` from facts already loaded for startup: a concrete same-message task first, otherwise the loaded current objective plus recommended next action. Within those facts, select one concrete primary action in this order: the same-message task; the loaded current objective; the recommended next action. The continuity trigger itself and generic phrases such as `Start Agent Handoff`, `開工`, `開始交接工作`, or `開始工作交接` are not primary actions. If the loaded facts do not provide both a concrete project name and a concrete primary action, skip the title update. Do not read `dev/PROJECT_INDEX.md`, files, network, or other state solely to name the title. The title must not contain progress, completion, status, task/session IDs, absolute paths, secrets, or unverified facts. If safe current-thread title control is unavailable after the bounded discovery above, skip silently. The title is display-only; it is not project state, permission, progress, completion evidence, a health result, or a source of truth, and it does not authorize project/file writes, network activity, external task work, 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>\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- 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- 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 regenerate the startup mirror or perform full closeout.\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\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. Permission or lock failure is a stop condition, not permission to elevate or switch to a riskier command.\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. Closeout is not complete until required files are written, read back, and the available closeout checks pass.\n5. 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.\n6. 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. 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. 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 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=5660d7e33a8bb2fc0e55579c969204bff579cb0bb77b001444ba8645b706e306 -->\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"
13756
+ },
13757
+ "5a0d043130825f68dc53329450c5101c3b595bd2675e70b731a29309b4394415": {
13758
+ "targetRel": "dev/rules/agent-governance.md",
13759
+ "canonicalSha256": "98a7f5805783bf98b446c3ef29f019d53a9b9d51fd15f401ea91daab2f708860",
13760
+ "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 documents, generated outputs, specifications, runbooks, checklists, guides, source-of-truth files, or research artifacts that future agents may need to discover.\n\n## Rules\n\n1. Locate the existing source of truth before adding a rule.\n2. Prefer merge, replace, or registry rows over append-only rule growth.\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 `runtime-core/AGENTS.core.md` persistence gate decision; do not duplicate the gate thresholds in this pack.\n8. For long-running projects, maintain `dev/PROJECT_DECISIONS.md` per R-028 closeout discipline (see `runtime-core/AGENTS.core.md` closeout maintenance trigger check): capture major decisions when they happen, run the short trigger check at every closeout, and do full long-term maintenance only when a hard trigger, semantic trigger, or 10-closeout backstop applies. Short single-task projects keep this as a no-op default; users are not expected to edit this file manually.\n9. 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.\n10. 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.\n11. 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.\n12. 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.\n13. 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 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\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. 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- 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 that the closeout maintenance trigger check was recorded, with full maintenance applied where its trigger conditions were met.\n\n## Closeout\n\nRecord the changed rule home, reason, complexity impact, retired wording, and follow-up checks.\n"
13761
+ },
13762
+ "c48570efb996d5b9fd25bdbcd29a3ddd0ff25e2e6f3ed1185370d61b3ef94dd7": {
13763
+ "targetRel": "AGENTS.md",
13764
+ "canonicalSha256": "cebf6a899d26ce7e92364fe0effccdc268bc57bfb919c68b6be35ee13d1c2e59",
13765
+ "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\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\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, one optional display-only current-thread title update 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\nDuring explicit continuity startup, the only optional presentation effect beyond state recovery and card/status is a user-visible task/conversation title update, when the active runtime safely supports current-thread title control. Current-title readback is useful when available to avoid overwriting an already informative title, but it is not required when the tool safely targets the calling/current thread. If title control is exposed only through a bounded runtime tool-discovery mechanism, use that discovery once with a narrow title/rename/current-thread query before deciding the control is unavailable; then call only the discovered safe current-thread title tool. Do not list or inspect unrelated threads solely for naming, and do not create, fork, navigate, message, archive, pin, or otherwise manage tasks as part of startup title naming. Do not title from the raw continuity trigger or before handoff-derived startup facts are final. First derive the startup card's current objective, risk/boundary, and recommended next action; then choose and apply any title update as the last presentation side effect before returning the startup response. Replace only a generic or stale title, or update once when the main objective clearly changes; keep an informative title when readback proves it is already relevant, and do not rename for tests, reviews, or small substeps. Use `<project name>|<primary action>` from facts already loaded for startup: a concrete same-message task first, otherwise the loaded current objective plus recommended next action. Within those facts, select one concrete primary action in this order: the same-message task; the loaded current objective; the recommended next action. The continuity trigger itself and generic phrases such as `Start Agent Handoff`, `開工`, `開始交接工作`, or `開始工作交接` are not primary actions. If the loaded facts do not provide both a concrete project name and a concrete primary action, skip the title update. Do not read `dev/PROJECT_INDEX.md`, files, network, or other state solely to name the title. The title must not contain progress, completion, status, task/session IDs, absolute paths, secrets, or unverified facts. If safe current-thread title control is unavailable after the bounded discovery above, skip silently. The title is display-only; it is not project state, permission, progress, completion evidence, a health result, or a source of truth, and it does not authorize project/file writes, network activity, external task work, 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>\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- 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- 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 regenerate the startup mirror or perform full closeout.\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\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. Permission or lock failure is a stop condition, not permission to elevate or switch to a riskier command.\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. Closeout is not complete until required files are written, read back, and the available closeout checks pass.\n5. 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.\n6. 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. 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. 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 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=60f1a4d9d58a0a9b1f61e8e8cd660058663b4b6a31e4bebde4e565dda335ba31 -->\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"
13766
+ },
13767
+ "54e20421bf99c389617d6cca9d3c8182bb836ed087a01c0ae98e55012ac393ea": {
13768
+ "targetRel": "dev/SESSION_HANDOFF.md",
13769
+ "canonicalSha256": "fc4bf3ddddfa198a13d0ca610ad375a80fb79ec9ef9a7284da75f011969d1d94",
13770
+ "text": "# Session Handoff\n\nLast Updated: TBD\n\n<!-- ack:section:durable-anchors -->\n## Durable Anchors\n\nStable facts that should survive across sessions. Update only when they change, but verify they still match reality at closeout.\n\n1. Project root and boundary: TBD\n2. Product/system identity: TBD\n3. Governance model: TBD\n4. Source-of-truth ownership: TBD\n5. Release / publish boundary: TBD\n6. Installed Integrations registry: `dev/PROJECT_INDEX.md` `## Installed Integrations` is the declaration source. Probe only immediately before actual use, when the current objective names an integration dependency, or when the user asks for a health check. Credential values never appear in `dev/*`; record references only.\n\n<!-- ack:section:closeout-reconciled-state -->\n## Closeout-Reconciled State\n\nThis is the current-state area. At every full closeout, update only sections whose current truth changed; leave already-current sections byte-stable where practical and record checked/no-op only when useful. Do not append a new state snapshot under an old one.\n\n<!-- ack:section:current-baseline -->\n## Current Baseline\n\n1. Project root: TBD\n2. Product/system state: TBD\n3. Governance state: TBD\n4. Source-of-truth notes: TBD\n<!-- ack:field:first-use-guidance-state -->\n5. First-use guidance state: eligible\n\n<!-- ack:section:task-understanding-summary -->\n## Task Understanding Summary\n\n<!-- ack:field:user-intent -->\n- User intent: TBD\n<!-- ack:field:task-essence -->\n- Task essence: TBD\n- User value: TBD\n<!-- ack:field:success-criteria -->\n- Success criteria: TBD\n- Key background already read: TBD\n- Background still unread or blocked: TBD\n- Non-goals / boundaries: TBD\n\n<!-- ack:section:active-objective -->\n## Active Objective\n\nTBD\n\n<!-- ack:section:completed-this-session -->\n## Completed This Session\n\nRecord only work actually completed in the current session.\n\n1. TBD\n\n<!-- ack:section:next-priorities -->\n## Next Priorities\n\nRecommended next step: TBD — reason: TBD\n\n1. TBD\n\n<!-- ack:section:next-task-required-reading -->\n## Next Task Required Reading\n\nBefore acting on the next task, read or mark blocked:\n\n| Source | Why required | Status |\n|---|---|---|\n| TBD | TBD | pending |\n\n<!-- ack:section:risks-blockers -->\n## Risks / Blockers\n\n1. TBD\n\n<!-- ack:section:validation-qc -->\n## Validation / QC\n\n- Checks run this session: TBD\n- Checks not run and why: TBD\n- Handoff evidence location: TBD\n\n<!-- ack:section:workspace-identity -->\n## Workspace Identity\n\nExpected project root: TBD\nGit root: TBD\nBranch: TBD\nCommit: TBD\nWorktree / parallel workspace status: TBD\nUncommitted changes summary: TBD\n\n<!-- ack:section:sync-status -->\n## Sync Status\n\nUse statuses from `dev/DOC_SYNC_REGISTRY.md`: `confirmed`, `unverified`, `pending`, `blocked`, `not_applicable`.\n\n- Project index: TBD\n- Doc sync registry: TBD\n- Public docs / README: TBD\n- External knowledge tools: TBD\n\n<!-- ack:section:state-reconciliation-check -->\n## State Reconciliation Check\n\nAt full closeout, complete this check after updating the state sections above.\n\n- Reconciled at: TBD\n<!-- ack:field:state-sections-rewritten-or-confirmed -->\n- State sections rewritten or confirmed current: TBD\n<!-- ack:field:stale-snapshots-left -->\n- Stale snapshots left in this handoff: TBD\n<!-- ack:field:lifecycle-conflicts-resolved -->\n- Completed / pending / risk / opening-message lifecycle conflicts resolved or explicitly reclassified: TBD\n<!-- ack:field:persistence-routing-checked -->\n- Persistence routing checked: TBD\n<!-- ack:field:closeout-outcome -->\n- Closeout outcome: not_started — full closeout has not yet been assessed.\n<!-- ack:field:project-required-persistence -->\n- Project-required persistence: not_assessed — state whether this project's required Git or other persistence completed, is not required, or is blocked.\n<!-- ack:field:recommended-next-step-explicit -->\n- Recommended next step is explicit and reasoned: TBD\n<!-- ack:field:opening-message-matches-current-state -->\n- Opening message matches current state: TBD\n<!-- ack:field:next-ai-can-continue -->\n- Next AI can continue from `AGENTS.md`, this handoff, `dev/PROJECT_INDEX.md`, and needed rule packs without searching old log history: TBD\n\nIf any answer is no, blocked, or uncertain, fix this handoff before declaring handoff ready. `Closeout outcome: complete` is allowed only when required writes, read-backs and project-required persistence are complete. If project-required persistence is blocked, use `Closeout outcome: blocked` and state the blocker; it is not a completed closeout.\n\nLifecycle consistency rule: compare `Completed This Session`, `Validation / QC`, `Next Priorities`, `Risks / Blockers`, and `Next Session Opening Message` as full content, including renamed or paraphrased work. A completed or verified item must not remain as an unresolved next priority, active risk, or startup instruction unless it is explicitly reclassified as monitor-only, follow-up scope, blocked, or reopened with the missing evidence or trigger condition stated. Doctor catches only mechanical contradictions and unresolved fields; its green result is not semantic proof. Recommended next-step rule: `Next Priorities` must name the single recommended next action and a short reason before listing additional options, unless the next action is blocked or genuinely requires a user decision. Persistence routing rule: one-time delivery instructions, historical validation evidence, old hashes, old version facts, and incident notes must stay in trace evidence unless they still affect the next action.\n\nCloseout-card rule: `closeout-status` reads only these existing handoff fields plus fresh doctor / mirror results; it does not create another persistence authority. Its `complete` card is the only permitted source for the user-facing `handoff saved` wording. A nonzero / `blocked` result must be shown as blocked, never summarized as completed.\n\n<!-- ack:section:handoff-sufficiency-check -->\n## Handoff Sufficiency Check\n\nCan the next AI continue from `AGENTS.md`, this handoff, and only the project index / rule packs required by the next task, without searching old log history?\n\nAnswer: TBD\nIf no, update this handoff before closeout.\n\nContinuity rule: this file carries current state and next action. `dev/SESSION_LOG.md` carries recent evidence only. Archive old detail only when needed; do not create an archive directory by default.\n\n<!-- ack:section:next-session-opening-message -->\n## Next Session Opening Message\n\nThis fenced block is the authoritative agent-managed startup content. At closeout, verify `START_NEXT_SESSION_PROMPT.txt` against this block. Regenerate only if normalized content differs; if the two differ, trust this block and rewrite the convenience copy. User-facing closeout output should show `Start Agent Handoff` / `開工` as the primary next-session entry, plus the path-bearing fallback when the next AI is not yet pointed at this project root; do not hand-write a separate stateful prompt in the final response.\n\n📋 Next session: agent-managed startup content below\n\n```text\nWork in <ROOT>.\n\nIf the root does not match the handoff, stop and ask for confirmation. Do not read dev/SESSION_LOG.md during ordinary startup. Read dev/PROJECT_INDEX.md, dev/RULE_PACKS.md, dev/DOC_SYNC_REGISTRY.md, and task packs only when the current task requires them.\n\nResume the current objective. A plain `Start Agent Handoff` / `開工` with no same-message task or explicit long-run instruction only authorizes minimum state recovery, one optional display-only current-thread title update 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 execution wording. First-use exception: when this handoff says `First-use guidance state: eligible`, the current objective is empty / `TBD`, and there is no same-message concrete task, load onboarding 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 this handoff is not authority to complete the objective. A same-message task may begin normally; an explicit instruction such as `開工,繼續做到下一個 blocker` or `開工,繼續完成目前目標` may continue under the normal task and safety rules. Upgrade never resets consumed / not_applicable first-use state back to eligible.\n```\n"
13771
+ },
13772
+ "0f41dae8104d06e1c4aaa6d25c8db12d0e4d93bbd9bdf5aed2dd6d18c25c8893": {
13773
+ "targetRel": "dev/rules/closeout.md",
13774
+ "canonicalSha256": "e21b0885f3a9b971bd05bdb54e07966ab72eff33bd84242a7c218f9cf6da1f6f",
13775
+ "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\nRead the current `dev/SESSION_HANDOFF.md`, `dev/SESSION_LOG.md`, `dev/PROJECT_INDEX.md`, and `dev/DOC_SYNC_REGISTRY.md`. 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- 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. 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\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. The semantic lifecycle gate is `agent-handoff-kit closeout-status`; when it blocks, use its first `Resolved [...]` / `Carry-forward [...]` pair to repair the handoff, not a separate project workaround, repeated doctor runs, or a broader governance rewrite. 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. 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 for work actually performed. Record evidence disposition and the prompt-mirror verification result; omit the full opening message by design.\n6. Update the project index and sync registry only when their owned maps or obligations changed. Record each applicable sync target as `confirmed`, `unverified`, `pending`, `blocked`, or `not_applicable`.\n7. Record the actual root, Git root, branch, commit, worktrees / parallel workspaces, uncommitted changes, and unresolved drift. Do not clean or change them without separate authorization.\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 trigger check below and record its result in the log.\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 and its output is the only final card source: copy its status faithfully. A nonzero result means the closeout is blocked; do not replace it with a success summary.\n\n## Maintenance Trigger Check\n\nEvery full closeout runs this short check; full maintenance runs only when triggered.\n\n- SESSION_LOG: trigger when the main log reaches at least 11 entries, exceeds 1500 lines, or the 10-closeout backstop is due. Keep recent safety-buffer entries; collapse only content already absorbed by an authoritative home. Archive older raw entries to `dev/SESSION_LOG_archive/archive_<batch>_<low_date>_to_<high_date>.md` and maintain `INDEX.md`. Port unique narrative before collapsing it.\n- PROJECT_DECISIONS: trigger when a decisions-like handoff section has at least 30 entries; retain the newest 8–22 in the hot tier and move older decisions into the decisions archive. Also write substantive task evolution, a multi-option architectural choice with rationale, or a cross-session learning when observed.\n- Backstop: every 10 closeouts, run the full long-term maintenance pass even when no semantic trigger is obvious. If the count cannot be determined confidently at the boundary, treat the backstop as due.\n\nIf no trigger applies, record one no-op reason. 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. It renders the verified version when available and otherwise `version unverified`; never print the literal placeholder `v<version>`, hand-compose a substitute card, or use `handoff saved` unless the command reports `status: complete`.\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. Do not hand-compose a third stateful prompt in the final response.\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"
13401
13776
  }
13402
13777
  },
13403
- "catalogDigestSha256": "339a01f72cb3a0df101c424dad51b04392371e316687a9effda007c2b2598491"
13778
+ "catalogDigestSha256": "f71b0577d2489e5436a1780272091022d71c91e806dfed8537da26e0dfc54b2d"
13404
13779
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamchanadam/agent-handoff-kit",
3
- "version": "0.3.60",
3
+ "version": "0.3.62",
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
@@ -20,26 +20,26 @@ Use Kit markers as machine boundaries: `ack:section:*`, `ack:field:*`, `ack:log-
20
20
  - Reusable procedures belong in the relevant pack, registered reference, or QA check.
21
21
  - `START_NEXT_SESSION_PROMPT.txt` is generated only from the handoff opening-message block.
22
22
 
23
- Do not copy the full opening message into `dev/SESSION_LOG.md` or any third current governance file. The log records that the mirror was regenerated and verified, plus an evidence reference when useful.
23
+ Do 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.
24
24
 
25
25
  ## Full Closeout
26
26
 
27
- Full closeout is differential. 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.
28
-
29
- 1. Reconcile `dev/SESSION_HANDOFF.md`; never append a new current-state snapshot beneath an old one. Verify durable anchors, then rewrite or explicitly confirm every closeout-reconciled section.
27
+ Full 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. 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.
28
+
29
+ 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.
30
30
  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.
31
31
  The bundled doctor is a mechanical floor for required lifecycle markers and readable sections only. The semantic lifecycle gate is `agent-handoff-kit closeout-status`; when it blocks, use its first `Resolved [...]` / `Carry-forward [...]` pair to repair the handoff, not a separate project workaround, repeated doctor runs, or a broader governance rewrite. 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`.
32
32
  3. Make `Next Priorities` name one recommended next action and a short reason unless blocked or a real user decision is required.
33
33
  4. Complete the persistence-routing, handoff-sufficiency, `Closeout outcome`, and `Project-required persistence` fields. 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.
34
34
  5. Add one concise log entry for work actually performed. Record evidence disposition and the prompt-mirror verification result; omit the full opening message by design.
35
35
  6. Update the project index and sync registry only when their owned maps or obligations changed. Record each applicable sync target as `confirmed`, `unverified`, `pending`, `blocked`, or `not_applicable`.
36
- 7. Record the actual root, Git root, branch, commit, worktrees / parallel workspaces, uncommitted changes, and unresolved drift. Do not clean or change them without separate authorization.
36
+ 7. 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.
37
37
  8. 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.
38
38
  9. Run the short maintenance trigger check below and record its result in the log.
39
39
  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`.
40
- 11. Regenerate `START_NEXT_SESSION_PROMPT.txt` from the sole fenced handoff opening-message block. 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.
40
+ 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.
41
41
  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.
42
- 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 and its output is the only final card source: copy its status faithfully. A nonzero result means the closeout is blocked; do not replace it with a success summary.
42
+ 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: copy its status faithfully. A nonzero result means the closeout is blocked; do not replace it with a success summary.
43
43
 
44
44
  ## Maintenance Trigger Check
45
45
 
@@ -61,11 +61,13 @@ In every user-facing reply, lead with ordinary language: state the result and it
61
61
 
62
62
  Choose exactly one tier after a task:
63
63
 
64
- 1. No persistence: no durable fact was produced. One-off answers, transient output, active unapproved drafts, and routine rerunnable checks normally use this tier.
65
- 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 regenerate the startup mirror or perform full closeout.
66
- 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.
67
-
68
- Route 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.
64
+ 1. No persistence: no durable fact was produced. One-off answers, transient output, active unapproved drafts, and routine rerunnable checks normally use this tier.
65
+ 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 regenerate the startup mirror or perform full closeout.
66
+ 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.
67
+
68
+ During 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.
69
+
70
+ Route 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.
69
71
 
70
72
  External 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.
71
73
 
@@ -101,9 +103,10 @@ The always-enforced closeout invariants are:
101
103
  1. Current state lives in `dev/SESSION_HANDOFF.md`; trace evidence lives in `dev/SESSION_LOG.md`.
102
104
  2. Completed, pending, risk, validation, and opening-message lifecycle states agree.
103
105
  3. `START_NEXT_SESSION_PROMPT.txt` is regenerated from the sole authoritative handoff block and no third full copy is retained.
104
- 4. Closeout is not complete until required files are written, read back, and the available closeout checks pass.
105
- 5. 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.
106
- 6. Git commit, push, release, publish, deployment, deletion, and permission changes remain separately authorized actions.
106
+ 4. 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.
107
+ 5. Closeout is not complete until required files are written, read back, and the available closeout checks pass.
108
+ 6. 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.
109
+ 7. Git commit, push, release, publish, deployment, deletion, and permission changes remain separately authorized actions.
107
110
 
108
111
  ## 5. Pack Loading
109
112
 
@@ -112,13 +112,14 @@ Do not store credential values or machine-private paths here. Local machine-only
112
112
  ## Local QC Commands
113
113
 
114
114
  | Check | Command | Run before | Last verified |
115
- |---|---|---|---|
115
+ |---|---|---|---|
116
116
  | Agent Handoff Kit doctor | `npx --yes @adamchanadam/agent-handoff-kit@latest doctor --root .` | closeout / Kit contract health / explicit registered-path checks | package latest |
117
+ | Agent Handoff Kit workspace health | `npx --yes @adamchanadam/agent-handoff-kit@latest workspace-health --root .` | closeout workspace identity read-back / suspected wrong root or worktree drift | package latest |
117
118
  | Project governance check | Check newly created durable artifacts against `dev/PROJECT_INDEX.md` and `dev/DOC_SYNC_REGISTRY.md`; register, sync, consolidate, or explicitly classify as temporary / one-time evidence. This is an AI responsibility, not a root-discovery doctor scan. | closeout / durable file changes | unverified until project-specific command exists |
118
119
 
119
120
  ## Workspace Identity
120
121
 
121
- Record this at closeout so the next AI can detect wrong-root or workspace drift.
122
+ Record the last closeout snapshot here so the next AI can detect wrong-root or workspace drift. Live root / Git / worktree truth is read with `agent-handoff-kit workspace-health --root <project root>` or equivalent read-only Git probes; do not maintain a long-term dynamic worktree list here.
122
123
 
123
124
  | Field | Value | Last verified |
124
125
  |---|---|---|
@@ -17,7 +17,7 @@ Stable facts that should survive across sessions. Update only when they change,
17
17
  <!-- ack:section:closeout-reconciled-state -->
18
18
  ## Closeout-Reconciled State
19
19
 
20
- This is the current-state area. At every full closeout, rewrite or explicitly confirm every section below. Do not append a new state snapshot under an old one.
20
+ This is the current-state area. At every full closeout, update only sections whose current truth changed; leave already-current sections byte-stable where practical and record checked/no-op only when useful. Do not append a new state snapshot under an old one.
21
21
 
22
22
  <!-- ack:section:current-baseline -->
23
23
  ## Current Baseline
@@ -147,7 +147,7 @@ Continuity rule: this file carries current state and next action. `dev/SESSION_L
147
147
  <!-- ack:section:next-session-opening-message -->
148
148
  ## Next Session Opening Message
149
149
 
150
- This fenced block is the authoritative agent-managed startup content. At closeout, regenerate `START_NEXT_SESSION_PROMPT.txt` from this block. If the two differ, trust this block and rewrite the convenience copy. User-facing closeout output should show `Start Agent Handoff` / `開工` as the primary next-session entry, plus the path-bearing fallback when the next AI is not yet pointed at this project root; do not hand-write a separate stateful prompt in the final response.
150
+ This fenced block is the authoritative agent-managed startup content. At closeout, verify `START_NEXT_SESSION_PROMPT.txt` against this block. Regenerate only if normalized content differs; if the two differ, trust this block and rewrite the convenience copy. User-facing closeout output should show `Start Agent Handoff` / `開工` as the primary next-session entry, plus the path-bearing fallback when the next AI is not yet pointed at this project root; do not hand-write a separate stateful prompt in the final response.
151
151
 
152
152
  📋 Next session: agent-managed startup content below
153
153