@adamchanadam/agent-handoff-kit 0.3.66 → 0.3.67
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 +1 -1
- package/README.md +1 -1
- package/bin/agent-handoff-kit.mjs +115 -47
- package/bin/migration-baselines/official-origin-catalog.json +186 -1
- package/package.json +1 -1
- package/packs/closeout.md +1 -1
- package/runtime-core/AGENTS.core.md +12 -2
- package/runtime-core/SESSION_HANDOFF.md +1 -1
- package/runtime-core/START_NEXT_SESSION_PROMPT.txt +1 -1
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.
|
|
5
|
+
Source package version: `v0.3.67`. 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.
|
|
5
|
+
原始碼套件版本:`v0.3.67`。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">
|
|
@@ -3494,7 +3494,7 @@ async function checkHandoffTemperatureBoundary(root) {
|
|
|
3494
3494
|
return { ok: findings.length === 0, checked: 1, findings };
|
|
3495
3495
|
}
|
|
3496
3496
|
|
|
3497
|
-
const rootMismatchGuard = "If
|
|
3497
|
+
const rootMismatchGuard = "If the root does not match the handoff";
|
|
3498
3498
|
|
|
3499
3499
|
function currentStateEvidenceRules() {
|
|
3500
3500
|
return [
|
|
@@ -3790,52 +3790,47 @@ function isOwnedOpeningLifecycleBoilerplate(line) {
|
|
|
3790
3790
|
|| /^Upgrade never resets consumed \/ not_applicable first-use state back to eligible\./i.test(line);
|
|
3791
3791
|
}
|
|
3792
3792
|
|
|
3793
|
-
function stripResolvedNegatedActionClauses(line) {
|
|
3794
|
-
return line.split(/(?<=[.;;。])\s*/).filter((clause) => {
|
|
3795
|
-
const negated = /\b(?:no|not|never|without|did not|has not|have not)\b/i.test(clause);
|
|
3796
|
-
const action = /\b(?:commit|push|tag|release|publish|deploy|deployment|sync|write|upgrade)\b/i.test(clause);
|
|
3797
|
-
return !(negated && action);
|
|
3798
|
-
}).join(" ");
|
|
3799
|
-
}
|
|
3800
|
-
|
|
3801
3793
|
const ignoredLifecycleEnglish = new Set([
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
"the", "and", "for", "into", "still", "remains"
|
|
3794
|
+
"completed", "complete", "finish", "finished", "continue", "resume", "incomplete", "passed", "pass", "verified", "verify",
|
|
3795
|
+
"pending", "blocked", "limited", "failed", "done", "resolved", "unresolved", "successful", "successfully", "success", "run",
|
|
3796
|
+
"the", "and", "is", "are", "was", "were", "has", "have", "been", "not", "no", "yet", "still", "remains", "remain"
|
|
3806
3797
|
]);
|
|
3807
3798
|
|
|
3808
|
-
function
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3799
|
+
function lifecycleAssertionClauses(line) {
|
|
3800
|
+
// A status belongs to its clause, not every topic in a Completed/QC paragraph.
|
|
3801
|
+
// Keep file extensions and dotted versions intact; separate contrast clauses.
|
|
3802
|
+
return line.split(/[;;](?!\s*(?:condition|trigger|missing evidence|reason|條件|觸發條件|缺少證據|原因)\s*[::])|[。!?!?]+|\.(?=\s|$)|\b(?:but|however|whereas|while)\b|(?:但|不過|然而)/i)
|
|
3803
|
+
.map((clause) => clause.trim().replace(/^[,,\s]+|[,,\s]+$/g, ""))
|
|
3804
|
+
.filter(Boolean);
|
|
3812
3805
|
}
|
|
3813
3806
|
|
|
3814
|
-
function
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
const
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
return new Set([...english, ...chinese]);
|
|
3807
|
+
function isAffirmativeLifecycleAssertion(clause) {
|
|
3808
|
+
// Word boundaries matter: incomplete, unverified and unsuccessful are not
|
|
3809
|
+
// positive results. Recording a limitation is not completing that work.
|
|
3810
|
+
const assertion = clause.replace(/\b(?:without|no)\s+(?:errors?|failures?|issues?|blockers?)\b/gi, "");
|
|
3811
|
+
if (/\b(?:not|never|without|incomplete|unverified|unsuccessful|unresolved|pending|blocked|limited|failed|missing)\b|(?:尚未|未曾|未完成|未通過|未驗證|未核對|不代表|不涵蓋|沒有|仍需|待驗|受限|受阻)/i.test(assertion)) return false;
|
|
3812
|
+
return /\b(?:completed?|finished|pass(?:ed)?|verified|done|resolved|success(?:ful)?)\b|(?:已完成|完成|通過|已驗證|已核對|已解決)/i.test(assertion);
|
|
3821
3813
|
}
|
|
3822
3814
|
|
|
3823
|
-
function
|
|
3824
|
-
const
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3815
|
+
function lifecycleAssertionCore(clause) {
|
|
3816
|
+
const source = openingLifecycleDirectiveText(clause)
|
|
3817
|
+
.replace(/^checks run this session\s*[::]\s*/i, "")
|
|
3818
|
+
.replace(/^(?:non[- ]?blocking|risk|非阻擋|非阻塞|風險)\s*[::—-]\s*/i, "")
|
|
3819
|
+
.replace(/\b(?:without|no)\s+(?:errors?|failures?|issues?|blockers?)\b/gi, "")
|
|
3820
|
+
.replace(/\s+(?:in\s+the\s+)?next\s+(?:session|round)\s*$/i, "")
|
|
3821
|
+
.split(/(?:\b(?:reason|condition|evidence)|原因|條件|證據)\s*[::]/i)[0]
|
|
3822
|
+
.replace(/(?:尚未完成|已經完成|已完成|未完成|已驗證|未驗證|已核對|未核對|已通過|未通過|尚未|仍然|仍|完成|通過|繼續|待辦|受阻)/g, "");
|
|
3823
|
+
const tokens = (source.toLowerCase().match(/[a-z0-9][a-z0-9_-]*|[\u3400-\u9fff]+/g) ?? [])
|
|
3824
|
+
.filter((token) => !ignoredLifecycleEnglish.has(token));
|
|
3825
|
+
return tokens.join(" ");
|
|
3829
3826
|
}
|
|
3830
3827
|
|
|
3831
|
-
function
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
const
|
|
3836
|
-
|
|
3837
|
-
const leftChinese = lifecycleShortChineseCore(left, true);
|
|
3838
|
-
return Boolean(leftChinese && leftChinese === lifecycleShortChineseCore(right));
|
|
3828
|
+
function lifecycleAssertionsMatch(left, right) {
|
|
3829
|
+
// Shared product names / paths / three-word windows are not proof of the
|
|
3830
|
+
// same acceptance scope. Only a complete normalized assertion core matches.
|
|
3831
|
+
// This is a conservative mechanical guard, not natural-language adjudication.
|
|
3832
|
+
const core = lifecycleAssertionCore(left);
|
|
3833
|
+
return core.length >= 2 && core === lifecycleAssertionCore(right);
|
|
3839
3834
|
}
|
|
3840
3835
|
|
|
3841
3836
|
function isExplicitLifecycleReclassification(line) {
|
|
@@ -3892,23 +3887,29 @@ function findHandoffLifecycleContradictions(text) {
|
|
|
3892
3887
|
...handoffStateLines(text, "completed-this-session", "Completed This Session")
|
|
3893
3888
|
.map((line) => ({ section: "Completed This Session", line })),
|
|
3894
3889
|
...handoffStateLines(text, "validation-qc", "Validation / QC")
|
|
3895
|
-
.filter((line) => /(pass|passed|verified|complete|success|通過|完成|已驗證|已核對)/i.test(line))
|
|
3896
3890
|
.map((line) => ({ section: "Validation / QC", line }))
|
|
3897
|
-
]
|
|
3891
|
+
].flatMap((entry) => lifecycleAssertionClauses(entry.line)
|
|
3892
|
+
.filter(isAffirmativeLifecycleAssertion)
|
|
3893
|
+
.map((assertion) => ({ ...entry, assertion })));
|
|
3898
3894
|
const carryForward = [
|
|
3899
3895
|
...handoffStateLines(text, "next-priorities", "Next Priorities")
|
|
3900
3896
|
.map((line) => ({ section: "Next Priorities", line })),
|
|
3901
3897
|
...handoffStateLines(text, "risks-blockers", "Risks / Blockers")
|
|
3902
3898
|
.map((line) => ({ section: "Risks / Blockers", line })),
|
|
3903
3899
|
...handoffStateLines(text, "next-session-opening-message", "Next Session Opening Message")
|
|
3904
|
-
.filter((line) => isOpeningLifecycleCarryForwardLine(line))
|
|
3905
3900
|
.map((line) => ({ section: "Next Session Opening Message", line }))
|
|
3906
3901
|
];
|
|
3907
3902
|
const findings = [];
|
|
3908
3903
|
for (const pending of carryForward) {
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3904
|
+
for (const assertion of lifecycleAssertionClauses(pending.line)) {
|
|
3905
|
+
if (pending.section === "Next Session Opening Message" && !isOpeningLifecycleCarryForwardLine(assertion)) continue;
|
|
3906
|
+
// Risks may repeat a completed local fact to explain an unrelated limit.
|
|
3907
|
+
// Next Priorities still rejects completed work listed as a next action.
|
|
3908
|
+
if (pending.section === "Risks / Blockers" && isAffirmativeLifecycleAssertion(assertion)) continue;
|
|
3909
|
+
if (isResolvedCarryForwardStatement(assertion) || isExplicitLifecycleReclassification(assertion)) continue;
|
|
3910
|
+
for (const done of resolved) {
|
|
3911
|
+
if (lifecycleAssertionsMatch(done.assertion, assertion)) findings.push({ resolved: done, carryForward: pending });
|
|
3912
|
+
}
|
|
3912
3913
|
}
|
|
3913
3914
|
}
|
|
3914
3915
|
return findings;
|
|
@@ -5565,15 +5566,82 @@ function migrateSessionHandoff(targetText, sourceText, context = {}) {
|
|
|
5565
5566
|
const targetPrompt = targetSection.match(/```text\s*\r?\n([\s\S]*?)\r?\n```/);
|
|
5566
5567
|
const sourcePrompt = sourceSection.match(/```text\s*\r?\n([\s\S]*?)\r?\n```/);
|
|
5567
5568
|
if (!targetPrompt || !sourcePrompt) return null;
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5569
|
+
// The opening message carries user state. Upgrade must never regenerate it
|
|
5570
|
+
// from a blank template. A historical official opening may be a whole
|
|
5571
|
+
// multi-line block (and its first line materializes the local root), so
|
|
5572
|
+
// replace only a catalog-proven official prefix. Any remaining paragraph is
|
|
5573
|
+
// user-owned and survives byte-for-content through the migration.
|
|
5574
|
+
const sourceInstruction = sourcePrompt[1].split(/\r?\n/).find((line) => line.startsWith("Resume the current objective. A plain "));
|
|
5575
|
+
const officialOpeningPrefixes = new Set();
|
|
5576
|
+
const officialInstructions = new Set();
|
|
5577
|
+
for (const [version, release] of Object.entries(context.officialCatalog?.releases ?? {})) {
|
|
5578
|
+
if (!release.source?.npm?.integrity || compareSemver(version, context.currentVersion) > 0) continue;
|
|
5579
|
+
const baseline = getOfficialBaseline({ version, targetRel: "dev/SESSION_HANDOFF.md", catalog: context.officialCatalog });
|
|
5580
|
+
const opening = baseline?.state === "present" ? extractOpeningMessage(baseline.text) : null;
|
|
5581
|
+
if (opening) officialOpeningPrefixes.add(normalizeOfficialOpeningPrefix(opening));
|
|
5582
|
+
for (const line of opening?.split(/\r?\n/) ?? []) {
|
|
5583
|
+
if (line.startsWith("Resume the current objective. A plain ")) officialInstructions.add(line);
|
|
5584
|
+
}
|
|
5585
|
+
}
|
|
5586
|
+
let currentPrompt = replaceOfficialOpeningPrefix(
|
|
5587
|
+
targetPrompt[1],
|
|
5588
|
+
sourcePrompt[1],
|
|
5589
|
+
officialOpeningPrefixes
|
|
5590
|
+
) ?? targetPrompt[1].split(/(\r?\n)/).map((line) => (
|
|
5591
|
+
sourceInstruction && officialInstructions.has(line) ? sourceInstruction : line
|
|
5592
|
+
)).join("");
|
|
5593
|
+
currentPrompt = restoreMissingCurrentOpeningLines(currentPrompt, sourcePrompt[1]);
|
|
5594
|
+
const updatedSection = targetSection.replace(targetPrompt[1], () => currentPrompt);
|
|
5571
5595
|
merged = `${merged.slice(0, targetBounds.start)}${updatedSection}${merged.slice(targetBounds.end)}`;
|
|
5572
5596
|
|
|
5573
5597
|
const temperatureRepair = repairHandoffCurrentStateEvidenceBoundary(merged);
|
|
5574
5598
|
return temperatureRepair.text;
|
|
5575
5599
|
}
|
|
5576
5600
|
|
|
5601
|
+
function normalizeOfficialOpeningPrefix(text) {
|
|
5602
|
+
return text
|
|
5603
|
+
.replace(/\r\n?/g, "\n")
|
|
5604
|
+
.replace(/^(Work in )[^\n]+?(\.(?: Read AGENTS\.md, then dev\/SESSION_HANDOFF\.md\.)?)$/m, "$1<ROOT>$2");
|
|
5605
|
+
}
|
|
5606
|
+
|
|
5607
|
+
function replaceOfficialOpeningPrefix(targetPrompt, sourcePrompt, officialPrefixes) {
|
|
5608
|
+
const targetLines = targetPrompt.replace(/\r\n?/g, "\n").split("\n");
|
|
5609
|
+
for (const prefix of [...officialPrefixes].sort((left, right) => right.length - left.length)) {
|
|
5610
|
+
const prefixLines = prefix.split("\n");
|
|
5611
|
+
if (targetLines.length < prefixLines.length) continue;
|
|
5612
|
+
if (normalizeOfficialOpeningPrefix(targetLines.slice(0, prefixLines.length).join("\n")) !== prefix) continue;
|
|
5613
|
+
const userOwnedSuffix = targetLines.slice(prefixLines.length).join("\n");
|
|
5614
|
+
return userOwnedSuffix ? `${sourcePrompt}\n${userOwnedSuffix}` : sourcePrompt;
|
|
5615
|
+
}
|
|
5616
|
+
return null;
|
|
5617
|
+
}
|
|
5618
|
+
|
|
5619
|
+
function restoreMissingCurrentOpeningLines(targetPrompt, sourcePrompt) {
|
|
5620
|
+
const sourceLines = sourcePrompt.replace(/\r\n?/g, "\n").split("\n");
|
|
5621
|
+
const targetLines = targetPrompt.replace(/\r\n?/g, "\n").split("\n");
|
|
5622
|
+
const sourceKeys = sourceLines.map(normalizeOfficialOpeningPrefix);
|
|
5623
|
+
const countKey = (lines, key) => lines.filter((line) => normalizeOfficialOpeningPrefix(line) === key).length;
|
|
5624
|
+
|
|
5625
|
+
for (let sourceIndex = 0; sourceIndex < sourceLines.length; sourceIndex += 1) {
|
|
5626
|
+
const sourceLine = sourceLines[sourceIndex];
|
|
5627
|
+
const sourceKey = sourceKeys[sourceIndex];
|
|
5628
|
+
if (!sourceLine.trim() || countKey(sourceLines, sourceKey) !== 1 || countKey(targetLines, sourceKey) !== 0) continue;
|
|
5629
|
+
|
|
5630
|
+
const previousKey = sourceKeys.slice(0, sourceIndex).reverse().find((key, offset) => (
|
|
5631
|
+
sourceLines[sourceIndex - offset - 1].trim() && countKey(sourceLines, key) === 1 && countKey(targetLines, key) === 1
|
|
5632
|
+
));
|
|
5633
|
+
const nextKey = sourceKeys.slice(sourceIndex + 1).find((key, offset) => (
|
|
5634
|
+
sourceLines[sourceIndex + offset + 1].trim() && countKey(sourceLines, key) === 1 && countKey(targetLines, key) === 1
|
|
5635
|
+
));
|
|
5636
|
+
if (!previousKey || !nextKey) continue;
|
|
5637
|
+
const previousIndex = targetLines.findIndex((line) => normalizeOfficialOpeningPrefix(line) === previousKey);
|
|
5638
|
+
const nextIndex = targetLines.findIndex((line) => normalizeOfficialOpeningPrefix(line) === nextKey);
|
|
5639
|
+
if (previousIndex < 0 || nextIndex < 0 || previousIndex >= nextIndex) continue;
|
|
5640
|
+
targetLines.splice(previousIndex + 1, 0, sourceLine);
|
|
5641
|
+
}
|
|
5642
|
+
return targetLines.join("\n");
|
|
5643
|
+
}
|
|
5644
|
+
|
|
5577
5645
|
function migrateSessionLog(targetText, sourceText) {
|
|
5578
5646
|
let merged = mergeSessionLogTemplateContract(targetText, sourceText);
|
|
5579
5647
|
if (!merged) return null;
|
|
@@ -13601,6 +13601,181 @@
|
|
|
13601
13601
|
"canonicalSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef"
|
|
13602
13602
|
}
|
|
13603
13603
|
}
|
|
13604
|
+
},
|
|
13605
|
+
"0.3.66": {
|
|
13606
|
+
"source": {
|
|
13607
|
+
"npm": {
|
|
13608
|
+
"spec": "@adamchanadam/agent-handoff-kit@0.3.66",
|
|
13609
|
+
"shasum": "d1683ffda56e589c45bcbbc823a87a11a1248a6f",
|
|
13610
|
+
"integrity": "sha512-UbRnCsYmV+8RAV+kt2tz6pyUFztn0bhrcIq5/bPcbHba97f2I0CqTerO04xebMCuCOecE28albCzSBVf/0mSgg==",
|
|
13611
|
+
"entryCount": 34,
|
|
13612
|
+
"gitHead": "ce5bc52b86d7652d5f795106e45fda591c1bb811"
|
|
13613
|
+
},
|
|
13614
|
+
"git": {
|
|
13615
|
+
"tag": "v0.3.66",
|
|
13616
|
+
"directObject": "ce5bc52b86d7652d5f795106e45fda591c1bb811",
|
|
13617
|
+
"peeledCommit": null,
|
|
13618
|
+
"commit": "ce5bc52b86d7652d5f795106e45fda591c1bb811"
|
|
13619
|
+
},
|
|
13620
|
+
"githubRelease": {
|
|
13621
|
+
"tag": "v0.3.66",
|
|
13622
|
+
"publishedAt": "2026-09-05T18:12:04Z"
|
|
13623
|
+
},
|
|
13624
|
+
"sourceDivergence": {
|
|
13625
|
+
"status": "same-commit",
|
|
13626
|
+
"npmGitHead": "ce5bc52b86d7652d5f795106e45fda591c1bb811",
|
|
13627
|
+
"remoteTagCommit": "ce5bc52b86d7652d5f795106e45fda591c1bb811"
|
|
13628
|
+
}
|
|
13629
|
+
},
|
|
13630
|
+
"manifest": {
|
|
13631
|
+
"AGENTS.md": {
|
|
13632
|
+
"state": "present",
|
|
13633
|
+
"contentId": "9fd892ee9d3cd174e9d15913d49ee9845ff0cb8f7e5adb28fa3507f7ab5b4ebc",
|
|
13634
|
+
"rawSha256": "d87dc322173e8a3f2ab2d29b47863511e76f61f091d3cd30bb9bcf9bb1aa3683",
|
|
13635
|
+
"normalizedSha256": "f2f2c8c5cd761e28cb8dad7da77fc193b53f153b5d97d5e965b8cb47280d7fa7",
|
|
13636
|
+
"canonicalSha256": "f2f2c8c5cd761e28cb8dad7da77fc193b53f153b5d97d5e965b8cb47280d7fa7"
|
|
13637
|
+
},
|
|
13638
|
+
"CLAUDE.md": {
|
|
13639
|
+
"state": "present",
|
|
13640
|
+
"contentId": "7a2cf08a1171762ebcb53f43036a2170655379416945258b9c85d4b189ecaecf",
|
|
13641
|
+
"rawSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
|
|
13642
|
+
"normalizedSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
|
|
13643
|
+
"canonicalSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad"
|
|
13644
|
+
},
|
|
13645
|
+
"GEMINI.md": {
|
|
13646
|
+
"state": "present",
|
|
13647
|
+
"contentId": "36da47034bb2ce6c760ddbbbbd49dccc1d17665dbb18bec56ffa3b26bac1c135",
|
|
13648
|
+
"rawSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
|
|
13649
|
+
"normalizedSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
|
|
13650
|
+
"canonicalSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986"
|
|
13651
|
+
},
|
|
13652
|
+
"START_NEXT_SESSION_PROMPT.txt": {
|
|
13653
|
+
"state": "present",
|
|
13654
|
+
"contentId": "de01669f2989762269e57b8f71decc55d58effa649a245136efa6dc1434b78a9",
|
|
13655
|
+
"rawSha256": "7d8652fcd07f2218528ca08ab70d0f7fe0eaba567fb8fa076109b9ff1c12d81e",
|
|
13656
|
+
"normalizedSha256": "7d8652fcd07f2218528ca08ab70d0f7fe0eaba567fb8fa076109b9ff1c12d81e",
|
|
13657
|
+
"canonicalSha256": "b1b9ad0cb5f3a374542a43b6c2c938e1e5d39dd42b91d12a4a74206f5f187113"
|
|
13658
|
+
},
|
|
13659
|
+
"dev/SESSION_HANDOFF.md": {
|
|
13660
|
+
"state": "present",
|
|
13661
|
+
"contentId": "0d3fc9fe11fdffadbe8deab1cb18dc6e4e7b0188ef5bbd7b762c525a2d36d317",
|
|
13662
|
+
"rawSha256": "6d2b9fb9dc158cb849ee5978713070227c007917576048e80bb058cbad1bc2a9",
|
|
13663
|
+
"normalizedSha256": "6d2b9fb9dc158cb849ee5978713070227c007917576048e80bb058cbad1bc2a9",
|
|
13664
|
+
"canonicalSha256": "d974f207f73a824f28e36770323cefe6cdfc364d589e48b49c6996d239d15a7e"
|
|
13665
|
+
},
|
|
13666
|
+
"dev/SESSION_LOG.md": {
|
|
13667
|
+
"state": "present",
|
|
13668
|
+
"contentId": "7b6184ee4dabe89f504a894c3d4803f012d962c7af53c7f29801a8fb28d9d51c",
|
|
13669
|
+
"rawSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47",
|
|
13670
|
+
"normalizedSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47",
|
|
13671
|
+
"canonicalSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47"
|
|
13672
|
+
},
|
|
13673
|
+
"dev/PROJECT_INDEX.md": {
|
|
13674
|
+
"state": "present",
|
|
13675
|
+
"contentId": "c7e652f64d5418bce302c5c96ef4afe56199d4ffa604b3db2283d26ba76d40dd",
|
|
13676
|
+
"rawSha256": "02b1d4c0a068c9ebc4c6c10092f5ccb21c89300920ed84cfade7315c821039c6",
|
|
13677
|
+
"normalizedSha256": "d0a05d9a6aaf52f18ee71d1c2ce44d72687038a67081998d4b404de37852edcb",
|
|
13678
|
+
"canonicalSha256": "3e80b5332e0c2527bd653cb049ac0d40db651e1cdfa1fcb0900f23739e745266"
|
|
13679
|
+
},
|
|
13680
|
+
"dev/DOC_SYNC_REGISTRY.md": {
|
|
13681
|
+
"state": "present",
|
|
13682
|
+
"contentId": "f6545b524dc440d3563041e04a05caff4229863f6cae2a39127f85a29a120249",
|
|
13683
|
+
"rawSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6",
|
|
13684
|
+
"normalizedSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6",
|
|
13685
|
+
"canonicalSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6"
|
|
13686
|
+
},
|
|
13687
|
+
"dev/RULE_PACKS.md": {
|
|
13688
|
+
"state": "present",
|
|
13689
|
+
"contentId": "1b91985b9c6460b7bf4293cc6119097df9b426c3a46199a0a4f1de1712d02faa",
|
|
13690
|
+
"rawSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4",
|
|
13691
|
+
"normalizedSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4",
|
|
13692
|
+
"canonicalSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4"
|
|
13693
|
+
},
|
|
13694
|
+
"dev/PROJECT_DECISIONS.md": {
|
|
13695
|
+
"state": "present",
|
|
13696
|
+
"contentId": "3aae993bd5b85bf6b1d1d458f1bcf82c7d3105c843f053ffa13553bb5931b8c4",
|
|
13697
|
+
"rawSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e",
|
|
13698
|
+
"normalizedSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e",
|
|
13699
|
+
"canonicalSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e"
|
|
13700
|
+
},
|
|
13701
|
+
"dev/rules/safety.md": {
|
|
13702
|
+
"state": "present",
|
|
13703
|
+
"contentId": "dd6bcf74722d038f76d202e2044a6583a6e6ad107fbb010520e513eec799ff4a",
|
|
13704
|
+
"rawSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0",
|
|
13705
|
+
"normalizedSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0",
|
|
13706
|
+
"canonicalSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0"
|
|
13707
|
+
},
|
|
13708
|
+
"dev/rules/coding.md": {
|
|
13709
|
+
"state": "present",
|
|
13710
|
+
"contentId": "1c6deb9a5a281c13e97b0ac96079e9e1beccbd1ff106186e7a6ac78c0eeb75c2",
|
|
13711
|
+
"rawSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
|
|
13712
|
+
"normalizedSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
|
|
13713
|
+
"canonicalSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4"
|
|
13714
|
+
},
|
|
13715
|
+
"dev/rules/writing.md": {
|
|
13716
|
+
"state": "present",
|
|
13717
|
+
"contentId": "ceee5412520ba860e6b40de46bb164e2ce3919d2197d5fadb926198eb7dddd3b",
|
|
13718
|
+
"rawSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
|
|
13719
|
+
"normalizedSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
|
|
13720
|
+
"canonicalSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593"
|
|
13721
|
+
},
|
|
13722
|
+
"dev/rules/research.md": {
|
|
13723
|
+
"state": "present",
|
|
13724
|
+
"contentId": "4414f9c82c6d04ad49d7446f4b0740055242f425ef5b00391d9c8c78c96c0f66",
|
|
13725
|
+
"rawSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
|
|
13726
|
+
"normalizedSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
|
|
13727
|
+
"canonicalSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104"
|
|
13728
|
+
},
|
|
13729
|
+
"dev/rules/agent-governance.md": {
|
|
13730
|
+
"state": "present",
|
|
13731
|
+
"contentId": "5dcd857a4b7e3416bc1c454ba42d0683afa87d414232ec4bd9ebc4665f55d4a1",
|
|
13732
|
+
"rawSha256": "b36a1782d81476545769727e002248e2e6bbfd507e6a66941cc6c3d16ee60a16",
|
|
13733
|
+
"normalizedSha256": "b36a1782d81476545769727e002248e2e6bbfd507e6a66941cc6c3d16ee60a16",
|
|
13734
|
+
"canonicalSha256": "b36a1782d81476545769727e002248e2e6bbfd507e6a66941cc6c3d16ee60a16"
|
|
13735
|
+
},
|
|
13736
|
+
"dev/rules/release.md": {
|
|
13737
|
+
"state": "present",
|
|
13738
|
+
"contentId": "b0a0c9dea88016185f4093f9be4ce3c0e29904222e21dd1fa1735fcc1bb7e744",
|
|
13739
|
+
"rawSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
|
|
13740
|
+
"normalizedSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
|
|
13741
|
+
"canonicalSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7"
|
|
13742
|
+
},
|
|
13743
|
+
"dev/rules/knowledge.md": {
|
|
13744
|
+
"state": "present",
|
|
13745
|
+
"contentId": "e6f5795c7ebaba7b05f04d971b2942b5a0394a3babb44f64a1cc591c9a08cb86",
|
|
13746
|
+
"rawSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c",
|
|
13747
|
+
"normalizedSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c",
|
|
13748
|
+
"canonicalSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c"
|
|
13749
|
+
},
|
|
13750
|
+
"dev/rules/communication.md": {
|
|
13751
|
+
"state": "present",
|
|
13752
|
+
"contentId": "34fd0034cbc75dad43f789b86a414763f01916dda4d59876db9c4d8d92ae6a87",
|
|
13753
|
+
"rawSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
|
|
13754
|
+
"normalizedSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
|
|
13755
|
+
"canonicalSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591"
|
|
13756
|
+
},
|
|
13757
|
+
"dev/rules/closeout.md": {
|
|
13758
|
+
"state": "present",
|
|
13759
|
+
"contentId": "1b7adecd0465c58112db511c0ce1f43607427abcc409bccc6682b952c37c4c74",
|
|
13760
|
+
"rawSha256": "183a8b17d7bca51627843ca6cb840cb8b4583df0516ab7ace344fcd33d3f71a5",
|
|
13761
|
+
"normalizedSha256": "183a8b17d7bca51627843ca6cb840cb8b4583df0516ab7ace344fcd33d3f71a5",
|
|
13762
|
+
"canonicalSha256": "183a8b17d7bca51627843ca6cb840cb8b4583df0516ab7ace344fcd33d3f71a5"
|
|
13763
|
+
},
|
|
13764
|
+
"dev/rules/onboarding.md": {
|
|
13765
|
+
"state": "present",
|
|
13766
|
+
"contentId": "6967a95f2256bc7962cd7f0b2b63249a2537979fe0d8bafd49ef620db873cae4",
|
|
13767
|
+
"rawSha256": "0c416732ae67c7dd3bfd2f27fbb763a940e6248ce8a23e42d8b897db8380d9ce",
|
|
13768
|
+
"normalizedSha256": "0c416732ae67c7dd3bfd2f27fbb763a940e6248ce8a23e42d8b897db8380d9ce",
|
|
13769
|
+
"canonicalSha256": "0c416732ae67c7dd3bfd2f27fbb763a940e6248ce8a23e42d8b897db8380d9ce"
|
|
13770
|
+
},
|
|
13771
|
+
"dev/rules/integrations.md": {
|
|
13772
|
+
"state": "present",
|
|
13773
|
+
"contentId": "a8fc1099da28f511bf9fed5eaf629ca10fb409299b0aed4d233a45fc7701f284",
|
|
13774
|
+
"rawSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef",
|
|
13775
|
+
"normalizedSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef",
|
|
13776
|
+
"canonicalSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef"
|
|
13777
|
+
}
|
|
13778
|
+
}
|
|
13604
13779
|
}
|
|
13605
13780
|
},
|
|
13606
13781
|
"contents": {
|
|
@@ -14543,7 +14718,17 @@
|
|
|
14543
14718
|
"targetRel": "dev/rules/closeout.md",
|
|
14544
14719
|
"canonicalSha256": "183a8b17d7bca51627843ca6cb840cb8b4583df0516ab7ace344fcd33d3f71a5",
|
|
14545
14720
|
"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\nHandoff cold zones are historical / evidence sections, old validation records, completed-work narratives, and unchanged durable anchors. Do not rewrite, reword, reorder, or refresh cold zones for ceremony or style. Change them only when the closeout directly proves their current meaning is false or the section itself is the named target of the reconciliation; otherwise preserve cold-zone bytes where practical and update only hot current-state fields.\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. Apply the packet-only reconstruction check below before answering handoff sufficiency. The next agent must be able to continue from `AGENTS.md`, the handoff, the project index when needed, and routed packs without searching old log history. `complete` is allowed only when all required writes/read-backs and any project-required persistence succeeded; use `not_required` only when that persistence is genuinely not required. If a required commit, push, release record, or equivalent persistence is blocked or not authorized, set both fields to `blocked` with the exact boundary.\n5. Add one concise log entry 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. Run `agent-handoff-kit workspace-health --root <project root>` or equivalent read-only Git probes, then record only the last-verified root, Git root, branch, commit, worktrees / parallel workspaces, uncommitted changes, and unresolved drift. Do not clean or change them without separate authorization. Do not treat `dev/PROJECT_INDEX.md` or old handoff prose as the live worktree truth.\n8. If the session used external tools or helper processes, apply the integrations and safety ownership rules. Close only task-owned resources. Retain shared, user-owned, other-agent-owned, system, or ambiguous resources unless separately authorized; state visibility limits.\n9. Run the short maintenance 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 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.\n\n## Packet-Only Reconstruction Check\n\nBefore closing out, reconstruct the next task using only the handoff, without chat memory, old logs or opening linked sources. Identify the parent outcome and consumer, the current step's relation to it, the exact resume point, remaining step/parent acceptance, and required sources with revision/freshness, reading scope/depth and unread gaps. Cite the owning handoff sections in `Reconstruction evidence`; do not create a second task summary. Then compare that reconstruction against the user's actual request and the relevant sources read this session. Missing, contradictory or assumed critical facts must be repaired in their existing handoff sections or explicitly recorded as blockers with the next clarification/read needed. Do not answer yes on labels or a successful CLI card alone: the CLI checks the recorded answer and evidence presence, not the truth of this reconstruction.\n\nKeep one `Answer:` line (`yes`, `no` or `unknown`, with optional explanation) and one `Reconstruction evidence:` line inside the marked sufficiency section. An affirmative answer requires concrete section references; keep `next-ai-can-continue` consistent. For an older handoff, add missing facts to its existing sections at this authorized closeout; upgrade must preserve user state and must not invent reconstruction evidence. Missing or negative answers, placeholder evidence and duplicate fields block `closeout-status` without changing project files.\n\nUse only the depth needed to resume safely. A standalone task needs no invented parent tree; state that it is the whole task. Finishing a child does not complete its parent or authorize another step. Keep the next consequential action bounded by its input, output and acceptance; do not enumerate every future microstep. Keep decision-relevant terms and identifiers faithful; when a translation could change their meaning, retain the original term alongside it. Reading coverage is previous-session evidence, never permission for the next agent to skip required fresh source reads. Honest blocked-work handoff can be sufficient when the missing fact, impact and safe next action are explicit.\n\n## Maintenance Trigger Check\n\nEvery full closeout runs this short 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"
|
|
14721
|
+
},
|
|
14722
|
+
"9fd892ee9d3cd174e9d15913d49ee9845ff0cb8f7e5adb28fa3507f7ab5b4ebc": {
|
|
14723
|
+
"targetRel": "AGENTS.md",
|
|
14724
|
+
"canonicalSha256": "f2f2c8c5cd761e28cb8dad7da77fc193b53f153b5d97d5e965b8cb47280d7fa7",
|
|
14725
|
+
"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\nWhen resuming, use the handoff's Task Understanding, Active Objective and Next Task Required Reading to recover the parent outcome, current step, resume point, remaining acceptance and source coverage. Surface missing critical context in the startup warning and recommend the specific clarification/read; do not infer parent completion from a finished child or treat previous-session reading as your own. Bare startup remains status-only, with no extra source reads or writes.\n\nRoute intent in this order:\n\n1. Clear closeout intent routes directly to `dev/rules/closeout.md`.\n2. Clear continuity intent such as \"開工\", \"Start Agent Handoff\", \"開始接力\", or \"continue handoff\" resumes the minimum current state from the handoff. A plain continuity message with no same-message task or explicit long-run instruction authorizes only that recovery, 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- Task-first governance locality: when the user supplied a concrete, actionable, authorized task plan and no safety / source-truth / permission blocker prevents it, follow the plan's main acceptance path before governance side work. Governance may become the main path only when the task itself is governance, the user explicitly asks for governance bridge or long-term governance, the content semantically requires cross-session force, or deferring it would create a safety, continuity, source-of-truth, or discoverability blocker. Otherwise, keep governance to the smallest classification, indexing, sync, or Persistence Gate decision that does not change the main deliverable path; do not start governance bridge, long-term-governance routing, repo-wide scans, handoff writes, or closeout solely because the task mentions Markdown, README, docs, specs, plans, checklists, or generated outputs.\n- Materially changed Markdown governance artifacts must be indexed, synchronized, consolidated into their authoritative home, or explicitly classified as temporary / one-time evidence. Other durable formats follow the same human governance rule, but the bundled doctor does not claim to scan them.\n- Ordinary document edits normally use local read-back and task-specific checks only. If the edited document itself is the target authority and the task does not touch Kit-managed files, migrations, release / closeout gates, external effects, cross-source conflicts, or blockers for safe continuation, do not run `agent-handoff-kit doctor`, write handoff / log state, or regenerate the startup mirror solely because a document changed.\n\n## 2.1 Persistence Gate\n\nChoose exactly one tier after a task:\n\n1. No persistence: no durable fact was produced. One-off answers, transient output, active unapproved drafts, and routine rerunnable checks normally use this tier.\n2. Lightweight checkpoint: a durable fact affects future action while the session continues or may be interrupted. This is the default for ongoing sessions. Write only its smallest correct home; do not 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\nPre-closeout checkpoint guard: before writing `dev/SESSION_HANDOFF.md` or `dev/SESSION_LOG.md` without explicit closeout / checkpoint intent, identify the durable fact, why the edited target authority or user-visible answer is insufficient, and why that file is the smallest correct home. Do not write either file merely because the next AI might misread stale state, because a target-authority document changed, or to make the handoff mirror every intermediate step. If the gate selects a checkpoint, update only the named current-state field(s) or one concise log entry; preserve unrelated / historical handoff sections byte-stable where practical, and do not regenerate `START_NEXT_SESSION_PROMPT.txt`.\n\nDuring an ongoing task, between Persistence Gate decisions, `dev/SESSION_HANDOFF.md` may legitimately trail the read-back target authority. Treat that as expected lag, not drift, and do not update handoff merely to mirror each intermediate step. Still apply the gate when a durable or startup-needed fact must survive interruption, the handoff is the smallest correct home, Kit-managed / release / closeout / external-effect state changed, or full closeout is selected.\n\nRoute current objective, next action, active risk, blocker, and startup-needed facts to `dev/SESSION_HANDOFF.md`; chronological evidence to `dev/SESSION_LOG.md`; maps to `dev/PROJECT_INDEX.md`; sync obligations to `dev/DOC_SYNC_REGISTRY.md`; long-term rationale to `dev/PROJECT_DECISIONS.md`; and reusable procedures to the relevant pack, registered reference, or QA check. Do not store the same task contract or reusable rule in several homes.\n\nExternal effects are never implied permission for commit, push, publish, release, deployment, cleanup, or another workspace write. Record verified external impact through the relevant integrations, release, safety, and closeout contracts without exposing private content or secrets.\n\n## 2.2 Upgrade Completion\n\nThe CLI owns upgrade truth. An upgrade is complete only when:\n\n1. The root is not newer than the CLI and every target passes read-only classification.\n2. Conflict produces zero governance-target and version writes.\n3. Staged outputs pass the offline migration acceptance gate: root boundary, structure, cross-file invariants, preservation hashes, and version transition.\n4. The recoverable transaction commits without an unresolved journal; only a failure caused by this transaction triggers rollback.\n5. Whole-project `doctor` reports project health separately. Pre-existing or unrelated health failures do not convert a correct migration into a destructive rollback; new migration-caused blockers do.\n6. The migration report records attempted version, committed version, transaction state, actions, redacted reasons, and backup locations without credential values.\n\nDo not use \"upgrade completed\" to mean \"the entire project is healthy\". Report `migration committed` and `project health` separately. Conflict, incomplete recovery, failed migration acceptance, and future-version roots are not completed upgrades.\n\n## 3. Safety Baseline\n\nDo not delete, reset, overwrite user-owned content, bulk-move, publish, change permissions, or perform another irreversible or external action without the required explicit authorization.\n\nNamed prohibited destructive commands in `dev/rules/safety.md` remain prohibited even when requested. Never use a weaker pack or local instruction to bypass core safety.\n\nVerify the selected root and real target boundaries before writes. Do not follow a link, junction, mount, or computed path outside the confirmed root. Do not expose credential values in output, reports, backups, tests, or logs. 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. Workspace identity is a last-verified snapshot. Live root / Git / worktree truth belongs to `agent-handoff-kit workspace-health --root <project root>` or equivalent read-only Git probes, not to stale prose.\n5. Closeout is not complete until required files are written, read back, and the available closeout checks pass.\n6. After those checks, render the final card with `agent-handoff-kit closeout-status --root <project root>`; only its `status: complete` output may say `handoff saved`. A nonzero / `blocked` result is an honest blocked closeout, not a completed one.\n7. Git commit, push, release, publish, deployment, deletion, and permission changes remain separately authorized actions.\n\n## 5. Pack Loading\n\nUse `dev/RULE_PACKS.md` to load the minimum task-specific set. Read the applicable packs, including their project supplements and required references, before deciding how to act; an index, title or remembered summary is not the rule itself. Apply them within the user's actual objective and instruction priority: do not invent a replacement goal, acceptance standard or competing rule system. Missing or conflicting requirements must be resolved from their owners, not filled by an invented policy. Packs may add stricter requirements but cannot weaken core safety or continuity.\n\nLoad `dev/rules/integrations.md` when the current task actually uses an external tool, not merely because a registry or placeholder table exists. Load `dev/rules/closeout.md` only for full closeout. If two packs conflict, use the safer and more verifiable path and record the unresolved conflict at closeout.\n\nAfter the task, apply the Persistence Gate. Do not assume the next session remembers pack context, and do not use handoff or log as the only home for reusable procedures.\n\n## Core Complexity Rule\n\nBefore changing `AGENTS.md` or adding a durable governance rule, use `dev/RULE_PACKS.md` to load `dev/rules/agent-governance.md` and locate the existing normative owner. Follow its `Governance Write Boundary` before choosing a writable location: installed official core and pack bodies are not project-editable rule homes. Default-core rules must apply to most sessions, protect safety or continuity, and be shorter than the routed detail they replace. Scenario-specific or project-specific detail belongs in an existing pack's project supplement or registered reference; a new pack is justified only when it creates a smaller, independently loadable responsibility with one normative owner. Do not copy the agent-governance classification table or workflow into the core.\n<!-- END Agent Handoff Kit managed core -->\n\n<!-- ack:user-rules-router:dev/USER_RULES.md -->\n<!-- ack:user-rules-acceptance:sha256=5028cb84e0cc2656b75c8d8aa9a5557e6f380da00a439788f35eeef95bf3e898 -->\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"
|
|
14726
|
+
},
|
|
14727
|
+
"5dcd857a4b7e3416bc1c454ba42d0683afa87d414232ec4bd9ebc4665f55d4a1": {
|
|
14728
|
+
"targetRel": "dev/rules/agent-governance.md",
|
|
14729
|
+
"canonicalSha256": "b36a1782d81476545769727e002248e2e6bbfd507e6a66941cc6c3d16ee60a16",
|
|
14730
|
+
"text": "# Agent Governance Pack\n\n## Scope\n\nUse for governance rules, prompts, agent instructions, handoff systems, startup/closeout behavior, skills, and rule packs.\n\n## Load When\n\n- User asks to change AI behavior, project governance, prompts, handoff, startup, closeout, or tool-use rules.\n- A change affects `AGENTS.md`, `dev/*`, rule packs, installer templates, or durable workflow docs.\n- User asks to bridge governance, connect a document to governance, scan for unbridged governance documents, or uses equivalent Chinese phrases such as \"治理打通\", \"把文件接入 Agent Handoff Kit\", \"接入 Agent Handoff Kit\", or \"掃描未接入 Agent Handoff Kit 的重要文件\".\n- User asks to make something long-term, cross-session, reusable, future sessions should remember an API / MCP / tool-use pattern, or uses equivalent Chinese phrases such as \"寫入長期治理\", \"轉成長期機制\", or \"之後都要遵守\".\n- The task creates or materially changes Markdown governance artifacts, source-of-truth files, durable workflow docs, or durable artifacts that future agents may need to discover. Ordinary target-authority documents, drafts, and user-task deliverables do not load this pack solely because they are Markdown or generated.\n\n## Rules\n\n1. Locate the existing source of truth before adding a rule. Read the matching categories in `dev/RULE_PACKS.md`, their applicable packs, project supplements and required references first; then apply `Governance Write Boundary` below. A matching topic does not make official prose writable.\n2. Prefer merge, replace, or registry rows over append-only rule growth, within the verified project-owned location. Change an existing project rule in place rather than duplicating it in another file or appending an override.\n3. Keep public runtime rules generic; project-specific incidents belong in logs, runbooks, or project index.\n4. Do not let development-only workspace rules enter public runtime.\n5. Check complexity budget before adding default-core behavior.\n6. Before creating durable workflow, runbook, or instruction files, first classify the knowledge type and verify whether an existing home can carry it without a new file: current state belongs in `dev/SESSION_HANDOFF.md`; trace evidence belongs in `dev/SESSION_LOG.md`; file / command / reference maps belong in `dev/PROJECT_INDEX.md`; sync obligations belong in `dev/DOC_SYNC_REGISTRY.md`; reusable operating procedures belong in the relevant rule pack or registered reference. New runbooks are last resort only.\n7. When a task uses external skills, subagents, demo workspaces, or another tool's closeout, treat those flows as subordinate to the active root's Agent Handoff Kit governance. The active root still needs the `runtime-core/AGENTS.core.md` persistence gate decision; do not duplicate the gate thresholds in this pack.\n8. Before any pre-closeout handoff / log write for governance work, apply the core Persistence Gate explicitly. A concern that future agents may read stale handoff is not enough when the changed rule, spec, runbook, or document is itself the target authority; leave handoff lag expected unless checkpoint conditions are met. When the gate does select a checkpoint, write only the smallest current-state field or concise log entry and leave historical evidence sections byte-stable where practical.\n9. For long-running projects, maintain `dev/PROJECT_DECISIONS.md` 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.\n10. Governance bridge is a triggered review, not a default startup scan. Use it when an important file, source-of-truth document, runbook, production guide, workflow, checklist, stock list, or similar durable document may need to be connected to project governance.\n11. Content-based trigger: long-term governance routing is content-based, not trigger-only. Even if the user does not use explicit governance-routing phrases, treat a statement as durable governance when it says future sessions must follow it, when it corrects a recurring AI mistake, or when it defines a reusable API / MCP / tool-use pattern. Do not persist long-term governance knowledge only in `dev/SESSION_LOG.md`, `dev/SESSION_HANDOFF.md`, or `START_NEXT_SESSION_PROMPT.txt`; those surfaces may be compressed, archived, or regenerated.\n12. Mid-task changes to product goals, requirements, development checklists, acceptance rules, exclusions, priorities, or scope are task contract changes. Before writing them, check whether the same contract already lives in a spec, backlog, issue list, README, runbook, project index entry, or handoff section. Merge into the existing authoritative home, then leave only a pointer or current-state summary elsewhere.\n13. New Markdown or generated documents are not automatically harmless. After creating or materially changing them, classify each artifact before completion: source of truth, reference, runbook, workflow, checklist, public document, generated output, one-time evidence, draft, or temporary. Durable artifacts must be discoverable from `dev/PROJECT_INDEX.md` or intentionally tied to a registered sync / source-of-truth row. Temporary or one-time evidence must be labeled as such in the task record or closeout so future agents do not treat it as hidden current state.\n14. Do not create a new document to hold a rule, requirement, checklist, or process if an existing authoritative document can carry it. Merge into the existing home or make the new document explicitly subordinate. If two files now carry the same durable instruction, resolve the duplicate by choosing one authoritative home and pointing the other to it.\n\n## Governance Write Boundary\n\nThis is the single write-location contract for installed projects, not for authorized Kit source development. It guides agent edits; it cannot intercept arbitrary editor writes.\n\n1. Classify the change before writing. Use the existing task category and normative owner; read the full relevant rule and its project supplements. A current task instruction is not automatically a durable rule. Do not create a new goal, acceptance threshold or balancing policy merely to reconcile your preferences with the user's request. Follow instruction priority; surface a material unresolved conflict instead of silently inventing an override.\n2. Treat the `AGENTS.md` managed-core region and complete official `dev/rules/*` pack bodies as protected. Daily project edits must not insert, translate, reformat, reorder or remove their contents or delimiters. Verify the installed version's official content before identifying the boundary; a heading, marker or version row alone is not ownership proof. Formal upgrade or an explicitly scoped repair owns official changes. If local rules are already interleaved, preserve them and report the required bounded reconciliation; do not guess which lines to delete or bless the mixed body as official.\n3. Reuse the matching pack's existing project supplement when it owns the rule. Otherwise place a short local rule after the entire verified official body under `## Project Rules`; preserve the official trailing newline. This heading labels the writable appendix, not the end of official ownership. For substantial or shared procedures, reuse a registered project reference; create a new reference only if no suitable owner exists. If `dev/USER_RULES.md` formally owns the rule, use its accepted update procedure rather than editing witnessed bytes or creating a competing copy. Always-needed project entry rules may live outside the managed core only after checking their existing owner.\n4. Preserve project-state schemas separately: edit handoff fields, actual log entries, index data or registry rows in their existing writable sections; do not insert policy into template instructions or alter machine markers. Preserve official routing rows in `dev/RULE_PACKS.md`; add a project row only when a project reference needs a task trigger, naming both the relevant pack and reference. A same-pack appendix uses that pack's existing route. Do not add a route or load a pack merely for bare startup.\n5. Before and after an edit touching core or pack files, compare the complete protected region against the verified input; every protected byte must remain unchanged. Use the installed-version CLI's read-only `upgrade --dry-run --root <project root>` before and after those edits as the compatibility check; record the CLI version and any existing conflict separately. A pre-existing conflict requires reconciliation before claiming the write boundary is verified. A new conflict or changed official region prevents completion; restore only your own scoped change from its verified input without discarding concurrent or pre-existing user work. For ordinary project-state edits, use schema/marker and local readback checks instead of an upgrade preview.\n6. Read back the rule from its normal consumer path: task signal -> router -> relevant pack including the project supplement and required reference -> requested action. Verify its exact requirement, scope and precedence, and that unrelated packs stay unloaded. An indexed file that no applicable route reads is not connected. Evidence must show both correct application and preserved upgrade compatibility; a successful preview alone does not prove an AI followed the rule.\n\n## Governance Bridge Workflow\n\nUse this workflow when the user asks for governance bridge, connect this document to governance, asks to scan for unbridged governance documents, or uses equivalent Chinese phrases such as \"治理打通\", \"把文件接入 Agent Handoff Kit\", \"接入 Agent Handoff Kit\", or \"掃描未接入 Agent Handoff Kit 的重要文件\".\n\n1. Identify the target. If the user named a file, inspect that file and its surrounding directory. If no file is named, run a bounded repo scan for likely durable documents such as source-of-truth files, runbooks, workflows, guides, checklists, stock lists, production guides, and rules.\n2. Check the target file itself: it should state its role, scope, update trigger, owner or responsible workflow when known, and what must not be inferred from it.\n3. Check `dev/PROJECT_INDEX.md`: the file should be discoverable with its role and \"read when\" condition. Source-of-truth or reference files should appear in Fact Base, External Sources, Directory Map, Entry Points, or another existing indexed home that fits the project.\n4. Check `dev/DOC_SYNC_REGISTRY.md`: future same-type changes should have a matching change type or an explicit reason no durable sync rule is needed.\n5. Check related workflows, guides, runbooks, or rule packs: if a process creates or updates the file, that process should say when to update the file or its index row.\n6. Check `dev/SESSION_HANDOFF.md`: only current state, recommended next action with reason, unresolved risk, blocker, or a startup-needed fact should be in handoff. Do not copy whole documents or old evidence into handoff.\n7. Check `dev/SESSION_LOG.md`: this session's bridge review, validation, and evidence can be logged when it affects future action, but log entries must not become current state.\n8. Search for duplicate source-of-truth risk. If another file has the same durable role, recommend merge, reference, or retire options; do not delete, rename, or move files without explicit approval.\n\nFor repo-wide scans, report candidates as candidates. Do not fail ordinary docs merely because they are not indexed; only durable files that future agents need to discover, update, or distinguish from drafts should be bridged.\n\nOutput format:\n\n- Status: bridged / partially bridged / unbridged / blocked.\n- Use bridged only when every applicable governance link is present. If only `dev/PROJECT_INDEX.md` or `dev/SESSION_LOG.md` was updated, report partially bridged.\n- Already bridged: list the governance links that are present.\n- Gaps: list missing links and why they matter for the next agent.\n- Not applicable: list skipped layers with a reason.\n- Suggested patches: list exact files and sections to update.\n- Manual decisions: list duplicates, naming choices, deletion, renaming, external sync, or ownership questions requiring user confirmation.\n- Acceptance: give one concrete check that proves the bridge is complete.\n\n## Generated Artifact Governance Workflow\n\nUse this workflow whenever the current task creates or materially changes Markdown documents or other durable artifacts, even if the user did not explicitly ask for governance bridge.\n\nThis workflow is subordinate to the core task-first governance locality rule. Use it as a proportionate classification / routing check, not as permission to interrupt an explicit user task plan, start a repo-wide governance scan, or turn an ordinary user-task deliverable into governance work.\n\n1. List the artifacts created or materially changed in this task.\n2. Classify each artifact: source of truth, reference, runbook, workflow, checklist, public document, generated output, one-time evidence, draft, or temporary.\n3. For source-of-truth, reference, runbook, workflow, checklist, public document, and reusable generated output, update `dev/PROJECT_INDEX.md` so the file is discoverable with a role and read condition.\n4. For artifacts that require future mirror, external index, publication, or repeated sync, update `dev/DOC_SYNC_REGISTRY.md` or record why no durable sync rule applies.\n5. For one-time evidence, draft, or temporary files, record that classification in `dev/SESSION_LOG.md` or the task summary, and do not promote it to current handoff unless it affects the next action.\n6. Search for duplicate source-of-truth risk before keeping a new document. If another file already owns the same rule, requirement, checklist, or process, merge into that file or make the new document explicitly subordinate.\n7. Before claiming completion, explicitly confirm the artifacts created or materially changed in this task have been classified, indexed, synchronized, consolidated, or marked temporary through the steps above. Existing target-authority documents that only received a local content edit normally need read-back and task-specific validation, not a handoff / log write or a bundled doctor run. You may run the available project governance check and `agent-handoff-kit doctor` only for scoped Kit / typed registered-surface checks; doctor does not discover unregistered ordinary workspace files and cannot replace explicit changed-artifact review.\n\n## Long-term Governance Routing\n\nUse this workflow when the user asks to write something into long-term governance, turn an experience into a mechanism, make a rule apply across sessions, or when the content itself clearly has durable force.\n\n1. Classify the knowledge before writing:\n - Current task contract changes, including product goals, requirements, development checklists, acceptance rules, exclusions, priorities, or scope -> the existing authoritative spec / backlog / issue / runbook when one exists; otherwise `dev/SESSION_HANDOFF.md` current-state sections.\n - Current task state, recommended next action with reason, unresolved risk, or startup-needed fact -> `dev/SESSION_HANDOFF.md`.\n - Chronological evidence or validation trace -> `dev/SESSION_LOG.md`.\n - File maps, command maps, API reference locations, tool capability maps, and external source coordinates -> `dev/PROJECT_INDEX.md`.\n - Sync obligations or external mirror duties -> `dev/DOC_SYNC_REGISTRY.md`.\n - Durable decisions, architecture trade-offs, research-derived rationale, and long-term lessons -> `dev/PROJECT_DECISIONS.md`.\n - Reusable procedures, recurring mistake prevention, API / MCP / tool-use rules -> the relevant rule pack, registered reference, or QA check.\n - API / MCP / tool-use patterns -> project index / registered reference / integrations pack, depending on scope.\n2. If the knowledge is reusable but no existing home fits, propose the smallest new registered reference or rule-pack patch. New runbooks remain last resort.\n3. If the knowledge was first captured in `SESSION_LOG` or handoff for short-term continuity, promote it to the correct durable home before claiming it is long-term.\n4. Add or update a QA check when the same failure class could recur and can be tested.\n5. Repeat-failure escalation: when the same failure class recurs after an AI has already claimed a durable fix for that class, do not continue with another same-pattern patch as ordinary work. Limit the escalation to the affected domain: identify the authoritative owner, correct or remove the failed method there, add a counterexample or replay check that would have failed before the fix when feasible, and state the temporary constraint. If the failure recurs again after that root-fix validation, separate the change and validation roles where the runtime provides an independent reviewer, subagent, or fresh-context pass; when none is available, perform a fresh read-back pass against the replay check and mark independent review unavailable instead of blocking unrelated work. Restore normal flow as soon as the replay and review / read-back pass. Do not create a central penalty database, cross-project blacklist, permanent role split, or public rule carrying project-specific incident details.\n6. Keep governance bridge wording reserved for document orphan prevention. Do not relabel non-file governance as \"file connected to Agent Handoff Kit\".\n\n## Checks\n\n- Verify affected files are indexed or intentionally installed templates.\n- Check `dev/DOC_SYNC_REGISTRY.md` for governance, closeout/startup, and README sync rows.\n- Confirm old overlapping wording was retired or marked legacy.\n- Confirm any new durable file is reachable from `dev/PROJECT_INDEX.md` and does not rely only on a one-session handoff note.\n- Confirm every Markdown document or generated artifact created in this task is indexed, synced, consolidated, or explicitly classified as draft / temporary / one-time evidence.\n- Confirm no new file has become a parallel source for an existing rule, requirement, checklist, or process.\n- Confirm reusable operating procedure knowledge is not stored only in `dev/SESSION_HANDOFF.md`, `dev/SESSION_LOG.md`, or a decision narrative when it belongs in a pack or registered reference.\n- Confirm long-term governance knowledge is promoted out of `dev/SESSION_LOG.md`, `dev/SESSION_HANDOFF.md`, and `START_NEXT_SESSION_PROMPT.txt` when it should survive log archive or prompt regeneration.\n- Confirm repeat-failure escalation, when triggered, is limited to the affected domain, tied to the authoritative owner, backed by a counterexample or replay check when feasible, and does not create a central penalty store, cross-project blacklist, or permanent role split.\n- For governance bridge work, confirm the target file, project index, sync registry, related workflow, handoff/log role split, and duplicate-source risk were all checked or explicitly marked not applicable.\n- For governance bridge work, run bounded searches for the target path/name and the relevant artifact class or sync-change type across the project index, sync registry, related workflows, and current rule owners. If the target is tied to generated outputs, also inspect the workflow or production guide that creates those outputs. Search evidence is a check, not a second source of truth.\n- Before claiming completion, apply the active root's core persistence gate and record the result only when that gate selects a checkpoint or full closeout; do not assume child or demo workspaces cover the parent/root workspace.\n- For long-running projects, confirm `dev/PROJECT_DECISIONS.md` retains its four H2 sections in order (Evolution Timeline / Decisions Archive / Architecture Choices / Insights & Learnings) and 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"
|
|
14546
14731
|
}
|
|
14547
14732
|
},
|
|
14548
|
-
"catalogDigestSha256": "
|
|
14733
|
+
"catalogDigestSha256": "8665ec8cbca184bcdfeb5be04167126bd8adfeadb2ff841c7c4144d1aeb14d76"
|
|
14549
14734
|
}
|
package/package.json
CHANGED
package/packs/closeout.md
CHANGED
|
@@ -30,7 +30,7 @@ Handoff cold zones are historical / evidence sections, old validation records, c
|
|
|
30
30
|
|
|
31
31
|
1. Reconcile `dev/SESSION_HANDOFF.md`; never append a new current-state snapshot beneath an old one. Verify durable anchors, then update only changed closeout-reconciled fields or sections; leave already-current sections unchanged instead of rewriting them for ceremony.
|
|
32
32
|
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.
|
|
33
|
-
The bundled doctor is a mechanical floor for required lifecycle markers and readable sections only.
|
|
33
|
+
The bundled doctor is a mechanical floor for required lifecycle markers and readable sections only. `agent-handoff-kit closeout-status` checks explicit lifecycle declarations and same-scope textual contradictions; it does not prove natural-language semantic consistency. When it blocks, inspect its first `Resolved [...]` / `Carry-forward [...]` pair against the actual evidence: completion of one action does not complete another acceptance scope, and a preserved limitation is not a completion claim. Repair a real contradiction in its owning handoff section. If truthful, distinct scopes are misclassified, preserve the facts, report the checker defect and stop wording retries; do not add a reclassification prefix, invent a trigger, erase a limitation or broaden governance just to pass. A blocked result remains blocked until verified repair. Read all five sections as a whole before marking the lifecycle field resolved. For governance, release, or another project-defined high-risk completion, use the project's independent semantic review gate in addition to `closeout-status`.
|
|
34
34
|
3. Make `Next Priorities` name one recommended next action and a short reason unless blocked or a real user decision is required.
|
|
35
35
|
4. Complete the persistence-routing, handoff-sufficiency, `Closeout outcome`, and `Project-required persistence` fields. Apply the packet-only reconstruction check below before answering handoff sufficiency. The next agent must be able to continue from `AGENTS.md`, the handoff, the project index when needed, and routed packs without searching old log history. `complete` is allowed only when all required writes/read-backs and any project-required persistence succeeded; use `not_required` only when that persistence is genuinely not required. If a required commit, push, release record, or equivalent persistence is blocked or not authorized, set both fields to `blocked` with the exact boundary.
|
|
36
36
|
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.
|
|
@@ -13,13 +13,23 @@ When resuming, use the handoff's Task Understanding, Active Objective and Next T
|
|
|
13
13
|
Route intent in this order:
|
|
14
14
|
|
|
15
15
|
1. Clear closeout intent routes directly to `dev/rules/closeout.md`.
|
|
16
|
-
2. 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,
|
|
16
|
+
2. Clear continuity intent such as "開工", "Start Agent Handoff", "開始接力", or "continue handoff" resumes the minimum current state from the handoff. A plain continuity message with no same-message task or explicit long-run instruction authorizes only that recovery, the display-only current-thread naming checkpoint when safely supported, the startup card, the current objective/risk/recommended next action, and then the end of the turn. It does not authorize task-specific reads, research, plans, protocols, preflight, file searches, sub-agents, QA, packaging, project-file writes, network access, other external actions, or opt-out wording such as "unless you object I will start". First-use exception: when `dev/SESSION_HANDOFF.md` says `First-use guidance state: eligible`, the active objective is empty / `TBD`, and there is no same-message concrete task, load `dev/rules/onboarding.md` and include a short first-use welcome plus the most relevant guided choices in the same response instead of ending status-only. A concrete objective found only in loaded state is not authority to complete it. A same-message task may begin normally. An explicit instruction such as "開工,繼續做到下一個 blocker" or "開工,繼續完成目前目標" may continue under the normal task and safety rules.
|
|
17
17
|
3. A direct ordinary task begins without a startup card or onboarding ceremony. Read only the sources and packs required by that task.
|
|
18
18
|
4. 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.
|
|
19
19
|
|
|
20
20
|
Treat 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.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
### Current-thread naming checkpoint
|
|
23
|
+
|
|
24
|
+
During explicit continuity startup, naming is a required presentation checkpoint when safe current-thread title control is available, not an optional task. After the minimum authorized startup reads, derive the current objective, boundary and recommended next action; resolve this checkpoint before emitting the final startup card or beginning any same-message authorized task work. Do not defer the tool call until after the final response or until the task is finished. If interrupted before the checkpoint resolves, handle it on the next user-authorized turn using current facts; do not schedule a background rename.
|
|
25
|
+
|
|
26
|
+
Use `<project name>|<primary action>` from already-loaded facts: the concrete current user task first, then an unresolved current objective, then a concrete recommended action. Do not revive a completed child task from historical handoff text. When the project is known but no concrete action remains, use the project name alone; do not leave a new task named `開工` merely because the previous work is complete. If the project name is unknown, skip without guessing or extra source reads. `Start Agent Handoff`, `開工`, `開始交接工作` and `開始工作交接` are not primary actions. Titles must not contain progress, completion, status, task/session IDs, absolute paths, secrets or unverified facts.
|
|
27
|
+
|
|
28
|
+
Use the current runtime's exposed tool schema. If a safe current-thread title tool is already available, call it directly; otherwise use a bounded runtime tool-discovery mechanism once with a narrow title/rename/current-thread query, when available. Never invent a tool name or require discovery when the tool is already exposed. Current-title readback is useful when available, but is not required when the tool safely targets the calling/current thread. Replace a generic or stale title; keep an informative title when readback proves it is already relevant, and preserve an explicitly user-chosen title unless the user asks to change it. When the current title cannot be read, use one safe current-thread set call with the derived title. Omit the target identifier only when the schema documents current-thread targeting; otherwise require a verified current-thread identifier. Do not list or inspect unrelated threads solely for naming, and do not create, fork, navigate, message, archive, pin or otherwise manage tasks for this checkpoint.
|
|
29
|
+
|
|
30
|
+
Before the final response, resolve the checkpoint as applied (successful tool result confirms the title), kept (relevant or user-chosen title), unavailable (no safe capability), skipped (project unknown), or failed/unverified (error or no confirmation). Use a targeted current-thread readback when available; an ambiguous write requires readback before any retry. Only a verified mismatch permits one safe corrective call; never loop or overwrite a later user rename. Do not assume a universal timing window or automatic-title overwrite across AI apps. An unavailable capability does not block startup; skip silently. A failed/unverified attempted rename gets a brief startup warning, not a success claim. Once resolved, return the card and stop for bare startup. On a later user-authorized turn, revisit naming when the primary task becomes concrete or changes, or a generic/stale title is observed; do not rename for tests, reviews or small substeps.
|
|
31
|
+
|
|
32
|
+
The title is display-only; it is not project state, permission, progress, completion evidence, a health result, or a source of truth. This checkpoint permits only the bounded title calls above; it does not authorize project/file writes, network research, external task work, extra startup reads or continuation beyond the startup boundary.
|
|
23
33
|
|
|
24
34
|
Read `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.
|
|
25
35
|
|
|
@@ -166,5 +166,5 @@ Work in <absolute project root>. Read AGENTS.md, then dev/SESSION_HANDOFF.md. Tr
|
|
|
166
166
|
|
|
167
167
|
If 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.
|
|
168
168
|
|
|
169
|
-
Resume the current objective. A plain `Start Agent Handoff` / `開工` with no same-message task or explicit long-run instruction only authorizes minimum state recovery,
|
|
169
|
+
Resume the current objective. A plain `Start Agent Handoff` / `開工` with no same-message task or explicit long-run instruction only authorizes minimum state recovery, the display-only current-thread naming checkpoint when safely supported, the startup card, the current objective/risk/recommended next action, and then the end of the turn. It does not authorize task-specific reads, research, plans, protocols, preflight, file searches, sub-agents, QA, packaging, project-file writes, network access, other external actions, or opt-out 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.
|
|
170
170
|
```
|
|
@@ -2,4 +2,4 @@ Work in <absolute project root>. Read AGENTS.md, then dev/SESSION_HANDOFF.md. Tr
|
|
|
2
2
|
|
|
3
3
|
If 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.
|
|
4
4
|
|
|
5
|
-
Resume the current objective. A plain `Start Agent Handoff` / `開工` with no same-message task or explicit long-run instruction only authorizes minimum state recovery,
|
|
5
|
+
Resume the current objective. A plain `Start Agent Handoff` / `開工` with no same-message task or explicit long-run instruction only authorizes minimum state recovery, the display-only current-thread naming checkpoint when safely supported, the startup card, the current objective/risk/recommended next action, and then the end of the turn. It does not authorize task-specific reads, research, plans, protocols, preflight, file searches, sub-agents, QA, packaging, project-file writes, network access, other external actions, or opt-out 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.
|