@adamchanadam/agent-handoff-kit 0.3.67 → 0.4.0
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 +230 -197
- package/README.md +222 -189
- package/bin/agent-handoff-kit.mjs +85 -12
- package/bin/commands.mjs +86 -0
- package/bin/handoff-read.mjs +88 -0
- package/bin/migration-baselines/official-origin-catalog.json +196 -1
- package/bin/progress/ICON-LICENSE.txt +21 -0
- package/bin/progress/agent-handoff-kit-logo2-256.png +0 -0
- package/bin/progress/dashboard-hero.png +0 -0
- package/bin/progress/dashboard.mjs +134 -0
- package/bin/progress/icons.svg +36 -0
- package/bin/progress/index.html +28 -0
- package/bin/progress/open.mjs +42 -0
- package/bin/progress/projection.mjs +144 -0
- package/bin/progress/renderer.js +151 -0
- package/bin/progress/server.mjs +76 -0
- package/bin/progress/styles.css +31 -0
- package/docs/commands.md +59 -0
- package/docs/progress.md +67 -0
- package/package.json +3 -1
- package/packs/closeout.md +71 -66
- package/runtime-core/AGENTS.core.md +112 -101
- package/runtime-core/PROJECT_INDEX.md +8 -1
- package/runtime-core/SESSION_HANDOFF.md +157 -147
- package/runtime-core/SESSION_LOG.md +2 -0
|
@@ -13776,6 +13776,181 @@
|
|
|
13776
13776
|
"canonicalSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef"
|
|
13777
13777
|
}
|
|
13778
13778
|
}
|
|
13779
|
+
},
|
|
13780
|
+
"0.3.67": {
|
|
13781
|
+
"source": {
|
|
13782
|
+
"npm": {
|
|
13783
|
+
"spec": "@adamchanadam/agent-handoff-kit@0.3.67",
|
|
13784
|
+
"shasum": "77946e7a85c4c7443fb93807523b5b93284d8b13",
|
|
13785
|
+
"integrity": "sha512-XD+BeiyOrRsIZeSm7bgESWFb4IqbD+KjRPIcaCAakNkIkrMBCiH132Vkj+KgEPS3ahn3fgeJjSjz+1GzKNfz3Q==",
|
|
13786
|
+
"entryCount": 34,
|
|
13787
|
+
"gitHead": null
|
|
13788
|
+
},
|
|
13789
|
+
"git": {
|
|
13790
|
+
"tag": "v0.3.67",
|
|
13791
|
+
"directObject": "8c9169de5a77c90bb6cd6adc7ec8ea7284769b2a",
|
|
13792
|
+
"peeledCommit": "f5c1ce40842bf35206ca0b7f2e648a4414789aa9",
|
|
13793
|
+
"commit": "f5c1ce40842bf35206ca0b7f2e648a4414789aa9"
|
|
13794
|
+
},
|
|
13795
|
+
"githubRelease": {
|
|
13796
|
+
"tag": "v0.3.67",
|
|
13797
|
+
"publishedAt": "2026-09-23T07:47:42Z"
|
|
13798
|
+
},
|
|
13799
|
+
"sourceDivergence": {
|
|
13800
|
+
"status": "npm-gitHead-unavailable",
|
|
13801
|
+
"npmGitHead": null,
|
|
13802
|
+
"remoteTagCommit": "f5c1ce40842bf35206ca0b7f2e648a4414789aa9"
|
|
13803
|
+
}
|
|
13804
|
+
},
|
|
13805
|
+
"manifest": {
|
|
13806
|
+
"AGENTS.md": {
|
|
13807
|
+
"state": "present",
|
|
13808
|
+
"contentId": "f32a0eee963932f893dd4373b9309803a3e6815166f998be85807c48e9dcf3d9",
|
|
13809
|
+
"rawSha256": "61e91da6f2d4b63e25d86cce9029e7e10d7e66139ad681c1bbffe9b54c31da5c",
|
|
13810
|
+
"normalizedSha256": "8d2baa867c387bedc5cd0aef3f0c30704bf429acf977bd1a9a5530c034972d64",
|
|
13811
|
+
"canonicalSha256": "8d2baa867c387bedc5cd0aef3f0c30704bf429acf977bd1a9a5530c034972d64"
|
|
13812
|
+
},
|
|
13813
|
+
"CLAUDE.md": {
|
|
13814
|
+
"state": "present",
|
|
13815
|
+
"contentId": "7a2cf08a1171762ebcb53f43036a2170655379416945258b9c85d4b189ecaecf",
|
|
13816
|
+
"rawSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
|
|
13817
|
+
"normalizedSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad",
|
|
13818
|
+
"canonicalSha256": "9e326c3c1ab08fbcd23b28cd398561c17d851a59997842e0f4f97ff3473ff0ad"
|
|
13819
|
+
},
|
|
13820
|
+
"GEMINI.md": {
|
|
13821
|
+
"state": "present",
|
|
13822
|
+
"contentId": "36da47034bb2ce6c760ddbbbbd49dccc1d17665dbb18bec56ffa3b26bac1c135",
|
|
13823
|
+
"rawSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
|
|
13824
|
+
"normalizedSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986",
|
|
13825
|
+
"canonicalSha256": "b6e8bfc51ba751fec2acd1719c4459b41524f013e0464a5573de7f66d436c986"
|
|
13826
|
+
},
|
|
13827
|
+
"START_NEXT_SESSION_PROMPT.txt": {
|
|
13828
|
+
"state": "present",
|
|
13829
|
+
"contentId": "9902b70a395688d6602b34f9e8085b32b5538e72c9009e28b4258e1fd30b77cc",
|
|
13830
|
+
"rawSha256": "27fb52cab93f926d89c71fb47d3d8a03630d50bf80d7400fcf7521b20d9323c8",
|
|
13831
|
+
"normalizedSha256": "27fb52cab93f926d89c71fb47d3d8a03630d50bf80d7400fcf7521b20d9323c8",
|
|
13832
|
+
"canonicalSha256": "9896feb18fe71a4f3500e2d89cea6991ca1788aebc6c6ead9848f5551750a1c0"
|
|
13833
|
+
},
|
|
13834
|
+
"dev/SESSION_HANDOFF.md": {
|
|
13835
|
+
"state": "present",
|
|
13836
|
+
"contentId": "53e12d77d51d0d3ba0ab82004e879c28a91e912c06b94e1163f283137d1a172e",
|
|
13837
|
+
"rawSha256": "e9a189cebbd6e3e799ec57c87ca1555abb33095cf81319b25897ce812b88387d",
|
|
13838
|
+
"normalizedSha256": "e9a189cebbd6e3e799ec57c87ca1555abb33095cf81319b25897ce812b88387d",
|
|
13839
|
+
"canonicalSha256": "89f9ac90ed822a44bbe2489466c60c5216eb27a54fee142518dcd6690911977c"
|
|
13840
|
+
},
|
|
13841
|
+
"dev/SESSION_LOG.md": {
|
|
13842
|
+
"state": "present",
|
|
13843
|
+
"contentId": "7b6184ee4dabe89f504a894c3d4803f012d962c7af53c7f29801a8fb28d9d51c",
|
|
13844
|
+
"rawSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47",
|
|
13845
|
+
"normalizedSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47",
|
|
13846
|
+
"canonicalSha256": "fb6bfd7026a15f87a54cfa64fbd69f032538b0c3193372876a3722fb997a3a47"
|
|
13847
|
+
},
|
|
13848
|
+
"dev/PROJECT_INDEX.md": {
|
|
13849
|
+
"state": "present",
|
|
13850
|
+
"contentId": "c7e652f64d5418bce302c5c96ef4afe56199d4ffa604b3db2283d26ba76d40dd",
|
|
13851
|
+
"rawSha256": "96341c119d4473f14bc0006c42ac09509b3ae535ab3561d25cc6ce5790a45308",
|
|
13852
|
+
"normalizedSha256": "9f7ecf1a9dd81be1573387cb28aa8f22b914c1a568920ac4f1b8e96e87deda37",
|
|
13853
|
+
"canonicalSha256": "3e80b5332e0c2527bd653cb049ac0d40db651e1cdfa1fcb0900f23739e745266"
|
|
13854
|
+
},
|
|
13855
|
+
"dev/DOC_SYNC_REGISTRY.md": {
|
|
13856
|
+
"state": "present",
|
|
13857
|
+
"contentId": "f6545b524dc440d3563041e04a05caff4229863f6cae2a39127f85a29a120249",
|
|
13858
|
+
"rawSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6",
|
|
13859
|
+
"normalizedSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6",
|
|
13860
|
+
"canonicalSha256": "56807afee836d3ce19cabb1d020ef37168880a405b5eb8c6d7347e25e94c36e6"
|
|
13861
|
+
},
|
|
13862
|
+
"dev/RULE_PACKS.md": {
|
|
13863
|
+
"state": "present",
|
|
13864
|
+
"contentId": "1b91985b9c6460b7bf4293cc6119097df9b426c3a46199a0a4f1de1712d02faa",
|
|
13865
|
+
"rawSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4",
|
|
13866
|
+
"normalizedSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4",
|
|
13867
|
+
"canonicalSha256": "383842f3d2f995a6f0917bb4a7bc6bfa5fd6e3c33ec8aa2cd073ce1695812df4"
|
|
13868
|
+
},
|
|
13869
|
+
"dev/PROJECT_DECISIONS.md": {
|
|
13870
|
+
"state": "present",
|
|
13871
|
+
"contentId": "3aae993bd5b85bf6b1d1d458f1bcf82c7d3105c843f053ffa13553bb5931b8c4",
|
|
13872
|
+
"rawSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e",
|
|
13873
|
+
"normalizedSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e",
|
|
13874
|
+
"canonicalSha256": "c2fbfb759a36145a92750226d0f7585d49ce0fa4bf1cfde474988ce510dc455e"
|
|
13875
|
+
},
|
|
13876
|
+
"dev/rules/safety.md": {
|
|
13877
|
+
"state": "present",
|
|
13878
|
+
"contentId": "dd6bcf74722d038f76d202e2044a6583a6e6ad107fbb010520e513eec799ff4a",
|
|
13879
|
+
"rawSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0",
|
|
13880
|
+
"normalizedSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0",
|
|
13881
|
+
"canonicalSha256": "685e501bb8a8cf721dd742312c9160a46a1066a4a875235eaaf579c1c8e72ab0"
|
|
13882
|
+
},
|
|
13883
|
+
"dev/rules/coding.md": {
|
|
13884
|
+
"state": "present",
|
|
13885
|
+
"contentId": "1c6deb9a5a281c13e97b0ac96079e9e1beccbd1ff106186e7a6ac78c0eeb75c2",
|
|
13886
|
+
"rawSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
|
|
13887
|
+
"normalizedSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4",
|
|
13888
|
+
"canonicalSha256": "79e96a709d7e9ccc629a0e35f88fde72522cccb71a0e7bd103b02ab7a5a1e7f4"
|
|
13889
|
+
},
|
|
13890
|
+
"dev/rules/writing.md": {
|
|
13891
|
+
"state": "present",
|
|
13892
|
+
"contentId": "ceee5412520ba860e6b40de46bb164e2ce3919d2197d5fadb926198eb7dddd3b",
|
|
13893
|
+
"rawSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
|
|
13894
|
+
"normalizedSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593",
|
|
13895
|
+
"canonicalSha256": "106376ae5c4eb703cab471efe2b285e1b0de5e35c2460977731fec2662c24593"
|
|
13896
|
+
},
|
|
13897
|
+
"dev/rules/research.md": {
|
|
13898
|
+
"state": "present",
|
|
13899
|
+
"contentId": "4414f9c82c6d04ad49d7446f4b0740055242f425ef5b00391d9c8c78c96c0f66",
|
|
13900
|
+
"rawSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
|
|
13901
|
+
"normalizedSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104",
|
|
13902
|
+
"canonicalSha256": "b282a48392250b570651f5e2e80c59d6c247617d08db35331d1e7538747a2104"
|
|
13903
|
+
},
|
|
13904
|
+
"dev/rules/agent-governance.md": {
|
|
13905
|
+
"state": "present",
|
|
13906
|
+
"contentId": "5dcd857a4b7e3416bc1c454ba42d0683afa87d414232ec4bd9ebc4665f55d4a1",
|
|
13907
|
+
"rawSha256": "b36a1782d81476545769727e002248e2e6bbfd507e6a66941cc6c3d16ee60a16",
|
|
13908
|
+
"normalizedSha256": "b36a1782d81476545769727e002248e2e6bbfd507e6a66941cc6c3d16ee60a16",
|
|
13909
|
+
"canonicalSha256": "b36a1782d81476545769727e002248e2e6bbfd507e6a66941cc6c3d16ee60a16"
|
|
13910
|
+
},
|
|
13911
|
+
"dev/rules/release.md": {
|
|
13912
|
+
"state": "present",
|
|
13913
|
+
"contentId": "b0a0c9dea88016185f4093f9be4ce3c0e29904222e21dd1fa1735fcc1bb7e744",
|
|
13914
|
+
"rawSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
|
|
13915
|
+
"normalizedSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7",
|
|
13916
|
+
"canonicalSha256": "cb01295a69be627564307bb8475f1a6e6438fae79d910ef3e318e7fcb8ced8a7"
|
|
13917
|
+
},
|
|
13918
|
+
"dev/rules/knowledge.md": {
|
|
13919
|
+
"state": "present",
|
|
13920
|
+
"contentId": "e6f5795c7ebaba7b05f04d971b2942b5a0394a3babb44f64a1cc591c9a08cb86",
|
|
13921
|
+
"rawSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c",
|
|
13922
|
+
"normalizedSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c",
|
|
13923
|
+
"canonicalSha256": "efeed5a4eef59f2ce59852832dddcd0447b2308a76fd01dd7a44ee6a16abb74c"
|
|
13924
|
+
},
|
|
13925
|
+
"dev/rules/communication.md": {
|
|
13926
|
+
"state": "present",
|
|
13927
|
+
"contentId": "34fd0034cbc75dad43f789b86a414763f01916dda4d59876db9c4d8d92ae6a87",
|
|
13928
|
+
"rawSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
|
|
13929
|
+
"normalizedSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591",
|
|
13930
|
+
"canonicalSha256": "8622edcc31d76d12699ee3bb6c95ff74ad5f0e962fa063d4ad0146cfa083d591"
|
|
13931
|
+
},
|
|
13932
|
+
"dev/rules/closeout.md": {
|
|
13933
|
+
"state": "present",
|
|
13934
|
+
"contentId": "6194d8d05fa476660ada628c60d5b05afb1b9d0d37430f79dc41389c05b073d2",
|
|
13935
|
+
"rawSha256": "2ae40352aa9699fa9a6421776fb9e8d4e0078a3d8a3bc6fd1495d0cedd9bc3fe",
|
|
13936
|
+
"normalizedSha256": "2ae40352aa9699fa9a6421776fb9e8d4e0078a3d8a3bc6fd1495d0cedd9bc3fe",
|
|
13937
|
+
"canonicalSha256": "2ae40352aa9699fa9a6421776fb9e8d4e0078a3d8a3bc6fd1495d0cedd9bc3fe"
|
|
13938
|
+
},
|
|
13939
|
+
"dev/rules/onboarding.md": {
|
|
13940
|
+
"state": "present",
|
|
13941
|
+
"contentId": "6967a95f2256bc7962cd7f0b2b63249a2537979fe0d8bafd49ef620db873cae4",
|
|
13942
|
+
"rawSha256": "0c416732ae67c7dd3bfd2f27fbb763a940e6248ce8a23e42d8b897db8380d9ce",
|
|
13943
|
+
"normalizedSha256": "0c416732ae67c7dd3bfd2f27fbb763a940e6248ce8a23e42d8b897db8380d9ce",
|
|
13944
|
+
"canonicalSha256": "0c416732ae67c7dd3bfd2f27fbb763a940e6248ce8a23e42d8b897db8380d9ce"
|
|
13945
|
+
},
|
|
13946
|
+
"dev/rules/integrations.md": {
|
|
13947
|
+
"state": "present",
|
|
13948
|
+
"contentId": "a8fc1099da28f511bf9fed5eaf629ca10fb409299b0aed4d233a45fc7701f284",
|
|
13949
|
+
"rawSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef",
|
|
13950
|
+
"normalizedSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef",
|
|
13951
|
+
"canonicalSha256": "7e51039d57c7c424dbb2c74f9c5ac022193346354593ffa4979008112a2bf8ef"
|
|
13952
|
+
}
|
|
13953
|
+
}
|
|
13779
13954
|
}
|
|
13780
13955
|
},
|
|
13781
13956
|
"contents": {
|
|
@@ -14728,7 +14903,27 @@
|
|
|
14728
14903
|
"targetRel": "dev/rules/agent-governance.md",
|
|
14729
14904
|
"canonicalSha256": "b36a1782d81476545769727e002248e2e6bbfd507e6a66941cc6c3d16ee60a16",
|
|
14730
14905
|
"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"
|
|
14906
|
+
},
|
|
14907
|
+
"f32a0eee963932f893dd4373b9309803a3e6815166f998be85807c48e9dcf3d9": {
|
|
14908
|
+
"targetRel": "AGENTS.md",
|
|
14909
|
+
"canonicalSha256": "8d2baa867c387bedc5cd0aef3f0c30704bf429acf977bd1a9a5530c034972d64",
|
|
14910
|
+
"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, the display-only current-thread naming checkpoint when safely supported, the startup card, the current objective/risk/recommended next action, and then the end of the turn. It does not authorize task-specific reads, research, plans, protocols, preflight, file searches, sub-agents, QA, packaging, project-file writes, network access, other external actions, or opt-out wording such as \"unless you object I will start\". First-use exception: when `dev/SESSION_HANDOFF.md` says `First-use guidance state: eligible`, the active objective is empty / `TBD`, and there is no same-message concrete task, load `dev/rules/onboarding.md` and include a short first-use welcome plus the most relevant guided choices in the same response instead of ending status-only. A concrete objective found only in loaded state is not authority to complete it. A same-message task may begin normally. An explicit instruction such as \"開工,繼續做到下一個 blocker\" or \"開工,繼續完成目前目標\" may continue under the normal task and safety rules.\n3. A direct ordinary task begins without a startup card or onboarding ceremony. Read only the sources and packs required by that task.\n4. Explicit guidance requests such as \"I'm new\", \"teach me\", \"help me start\", \"新手\", \"教我用\", or \"點開始\" may load `dev/rules/onboarding.md`. A fresh install marks first-use guidance as `eligible`, so the first unresolved startup must enter onboarding; upgrade must not reset `consumed` or `not_applicable` back to `eligible`. A short message in a non-eligible root only makes guidance available; it never overrides a concrete objective. If no executable objective remains after state reading, ask one concise question or offer guided onboarding.\n\nTreat a phrase as ambiguous only when its ordinary meaning may genuinely refer to a real-world shift, event, or unrelated context. `開工,繼續 <task>`, `<project> 開工`, and `Start Agent Handoff and continue <task>` are continuity commands, not ambiguous phrases.\n\n### Current-thread naming checkpoint\n\nDuring explicit continuity startup, naming is a required presentation checkpoint when safe current-thread title control is available, not an optional task. After the minimum authorized startup reads, derive the current objective, boundary and recommended next action; resolve this checkpoint before emitting the final startup card or beginning any same-message authorized task work. Do not defer the tool call until after the final response or until the task is finished. If interrupted before the checkpoint resolves, handle it on the next user-authorized turn using current facts; do not schedule a background rename.\n\nUse `<project name>|<primary action>` from already-loaded facts: the concrete current user task first, then an unresolved current objective, then a concrete recommended action. Do not revive a completed child task from historical handoff text. When the project is known but no concrete action remains, use the project name alone; do not leave a new task named `開工` merely because the previous work is complete. If the project name is unknown, skip without guessing or extra source reads. `Start Agent Handoff`, `開工`, `開始交接工作` and `開始工作交接` are not primary actions. Titles must not contain progress, completion, status, task/session IDs, absolute paths, secrets or unverified facts.\n\nUse the current runtime's exposed tool schema. If a safe current-thread title tool is already available, call it directly; otherwise use a bounded runtime tool-discovery mechanism once with a narrow title/rename/current-thread query, when available. Never invent a tool name or require discovery when the tool is already exposed. Current-title readback is useful when available, but is not required when the tool safely targets the calling/current thread. Replace a generic or stale title; keep an informative title when readback proves it is already relevant, and preserve an explicitly user-chosen title unless the user asks to change it. When the current title cannot be read, use one safe current-thread set call with the derived title. Omit the target identifier only when the schema documents current-thread targeting; otherwise require a verified current-thread identifier. Do not list or inspect unrelated threads solely for naming, and do not create, fork, navigate, message, archive, pin or otherwise manage tasks for this checkpoint.\n\nBefore the final response, resolve the checkpoint as applied (successful tool result confirms the title), kept (relevant or user-chosen title), unavailable (no safe capability), skipped (project unknown), or failed/unverified (error or no confirmation). Use a targeted current-thread readback when available; an ambiguous write requires readback before any retry. Only a verified mismatch permits one safe corrective call; never loop or overwrite a later user rename. Do not assume a universal timing window or automatic-title overwrite across AI apps. An unavailable capability does not block startup; skip silently. A failed/unverified attempted rename gets a brief startup warning, not a success claim. Once resolved, return the card and stop for bare startup. On a later user-authorized turn, revisit naming when the primary task becomes concrete or changes, or a generic/stale title is observed; do not rename for tests, reviews or small substeps.\n\nThe title is display-only; it is not project state, permission, progress, completion evidence, a health result, or a source of truth. This checkpoint permits only the bounded title calls above; it does not authorize project/file writes, network research, external task work, extra startup reads or continuation beyond the startup boundary.\n\nRead `dev/PROJECT_INDEX.md` when the task needs its file, command, integration, workspace, or source map. Read `dev/RULE_PACKS.md` when a task pack must be selected. Read `dev/DOC_SYNC_REGISTRY.md` before durable cross-file or external synchronization and during closeout. Pack loading is normally silent; explain it only when it changes risk, requires a user decision, or materially affects the next action.\n\nIf the user supplies the portable startup prompt, use it to locate the root, then trust the handoff over the mirror. If the root is unclear or mismatched, stop and ask for the intended root before reading or editing project state. Missing required governance files are a repair condition, not permission to invent a parallel structure.\n\nBefore a non-trivial task, identify and read the required local and external truth sources or mark them blocked. Reachable is not the same as ingested. Search hits, truncated output, summaries, and status claims do not replace the relevant source content.\n\nProbe an integration only immediately before a task uses it, when the handoff explicitly identifies it as a dependency for the current objective, or when the user requests an integration health check. `TBD`, examples, blank rows, and undeclared placeholders are not installed integrations. Record `Last Verified` only after a real probe and through the normal persistence gate. Never write integration status merely because a session started.\n\nShow the startup card only for explicit continuity startup. For a plain continuity message, show the card after the minimum state recovery and end the turn; its recommended next action is advice, not permission to act. Render the startup card in a fenced `text` block and preserve spacing so the ASCII status marker remains aligned. The first-use exception above replaces that status-only stop with onboarding only when the handoff state is `eligible`, the objective is empty / `TBD`, and there is no same-message concrete task. An explicit same-message task or long-run continuation may combine the card with its first useful action. Direct ordinary tasks do not show the card. If onboarding is explicitly requested or first-use onboarding is triggered, combine any card and guidance in one response.\n\nFor explicit bare continuity startup, after the handoff is read, the startup card may read only the bounded version evidence from `dev/PROJECT_INDEX.md`: the unique stable-semver `| Agent Handoff Kit template version | X.Y.Z | ... |` row inside the unique real `## Stack` section. Do not route on, summarize, or load any other Project Index content for startup, title, permissions, packs, health, or task work. Missing, unreadable, malformed, duplicate, prerelease, or out-of-Stack-only version evidence prints `version unverified`; the turn remains status-only with zero writes. A direct ordinary or stateless task does not read the handoff or Project Index merely to fill a card or version.\n\n```text\n /\\_/\\ Agent Handoff Kit v<version>\n ( o.o ) continuity ready\n > ^ <\n\n🔎 交接狀態:<loaded / new install / resumed>\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=e8ee4b76f78332a241ac8b1134b5a1ca3d392bb6a80f6e761cd8f5a028b39fb1 -->\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"
|
|
14911
|
+
},
|
|
14912
|
+
"9902b70a395688d6602b34f9e8085b32b5538e72c9009e28b4258e1fd30b77cc": {
|
|
14913
|
+
"targetRel": "START_NEXT_SESSION_PROMPT.txt",
|
|
14914
|
+
"canonicalSha256": "9896feb18fe71a4f3500e2d89cea6991ca1788aebc6c6ead9848f5551750a1c0",
|
|
14915
|
+
"text": "Work in <ROOT>.\n\nIf the root does not match the handoff, stop and ask for confirmation. Do not read dev/SESSION_LOG.md during ordinary startup. Read dev/PROJECT_INDEX.md, dev/RULE_PACKS.md, dev/DOC_SYNC_REGISTRY.md, and task packs only when the current task requires them.\n\nResume the current objective. A plain `Start Agent Handoff` / `開工` with no same-message task or explicit long-run instruction only authorizes minimum state recovery, 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."
|
|
14916
|
+
},
|
|
14917
|
+
"53e12d77d51d0d3ba0ab82004e879c28a91e912c06b94e1163f283137d1a172e": {
|
|
14918
|
+
"targetRel": "dev/SESSION_HANDOFF.md",
|
|
14919
|
+
"canonicalSha256": "89f9ac90ed822a44bbe2489466c60c5216eb27a54fee142518dcd6690911977c",
|
|
14920
|
+
"text": "# Session Handoff\n\nLast Updated: TBD\n\n<!-- ack:section:durable-anchors -->\n## Durable Anchors\n\nStable facts that should survive across sessions. Update only when they change, but verify they still match reality at closeout.\n\n1. Project root and boundary: TBD\n2. Product/system identity: TBD\n3. Governance model: TBD\n4. Source-of-truth ownership: TBD\n5. Release / publish boundary: TBD\n6. Installed Integrations registry: `dev/PROJECT_INDEX.md` `## Installed Integrations` is the declaration source. Probe only immediately before actual use, when the current objective names an integration dependency, or when the user asks for a health check. Credential values never appear in `dev/*`; record references only.\n\n<!-- ack:section:closeout-reconciled-state -->\n## Closeout-Reconciled State\n\nThis is the current-state area. At every full closeout, update only sections whose current truth changed; leave already-current sections byte-stable where practical and record checked/no-op only when useful. Do not append a new state snapshot under an old one.\n\nPre-closeout checkpoint edits, when explicitly authorized or required by the core Persistence Gate, update only the named hot current-state field(s) or one concise log entry. Historical evidence, old validation records, completed-work narratives, and unchanged durable anchors are cold zones: preserve them byte-for-byte where practical instead of rewording, reordering, or refreshing them because another AI might otherwise read stale context.\n\n<!-- ack:section:current-baseline -->\n## Current Baseline\n\n1. Project root: TBD\n2. Product/system state: TBD\n3. Governance state: TBD\n4. Source-of-truth notes: TBD\n<!-- ack:field:first-use-guidance-state -->\n5. First-use guidance state: eligible\n\n<!-- ack:section:task-understanding-summary -->\n## Task Understanding Summary\n\n<!-- ack:field:user-intent -->\n- User intent: TBD\n<!-- ack:field:task-essence -->\n- Task essence: TBD\n- User value: TBD\n- Parent outcome / consumer: TBD\n- Task position: TBD — parent -> current step and how this step advances it; use standalone when this is the whole task, unknown when not established.\n<!-- ack:field:success-criteria -->\n- Success criteria: TBD\n- Key background already read: TBD\n- Background still unread or blocked: TBD\n- Non-goals / boundaries: TBD\n\n<!-- ack:section:active-objective -->\n## Active Objective\n\n- Current step: TBD\n- Resume point: TBD — next bounded action, target and last verified result; distinguish finished preparation from unfinished work.\n- Remaining acceptance: TBD — what still proves the current step and the parent outcome; if complete, cite evidence rather than infer from child completion.\n\n<!-- ack:section:completed-this-session -->\n## Completed This Session\n\nRecord only work actually completed in the current session.\n\n1. TBD\n\n<!-- ack:section:next-priorities -->\n## Next Priorities\n\nRecommended next step: TBD — reason: TBD\n\n1. TBD\n\n<!-- ack:section:next-task-required-reading -->\n## Next Task Required Reading\n\nBefore acting on the next task, read or mark blocked:\n\nIn Source, identify the authoritative file/link, revision or unverified freshness, and relevant sections/range. In Why required, name the decision or acceptance it supports. In Status, record the previous session's actual depth (located / skimmed / relevant range read / verified), remaining unread scope, and what the next agent must read before acting. An old read claim is not a fresh read. For no required sources, state none with a reason; do not invent coverage.\n\n| Source | Why required | Status |\n|---|---|---|\n| TBD | TBD | pending |\n\n<!-- ack:section:risks-blockers -->\n## Risks / Blockers\n\n1. TBD\n\n<!-- ack:section:validation-qc -->\n## Validation / QC\n\n- Checks run this session: TBD\n- Checks not run and why: TBD\n- Handoff evidence location: TBD\n\n<!-- ack:section:workspace-identity -->\n## Workspace Identity\n\nExpected project root: TBD\nGit root: TBD\nBranch: TBD\nCommit: TBD\nWorktree / parallel workspace status: TBD\nUncommitted changes summary: TBD\n\n<!-- ack:section:sync-status -->\n## Sync Status\n\nUse statuses from `dev/DOC_SYNC_REGISTRY.md`: `confirmed`, `unverified`, `pending`, `blocked`, `not_applicable`.\n\n- Project index: TBD\n- Doc sync registry: TBD\n- Public docs / README: TBD\n- External knowledge tools: TBD\n\n<!-- ack:section:state-reconciliation-check -->\n## State Reconciliation Check\n\nAt full closeout, complete this check after updating the state sections above.\n\n- Reconciled at: TBD\n<!-- ack:field:state-sections-rewritten-or-confirmed -->\n- State sections rewritten or confirmed current: TBD\n<!-- ack:field:stale-snapshots-left -->\n- Stale snapshots left in this handoff: TBD\n<!-- ack:field:lifecycle-conflicts-resolved -->\n- Completed / pending / risk / opening-message lifecycle conflicts resolved or explicitly reclassified: TBD\n<!-- ack:field:persistence-routing-checked -->\n- Persistence routing checked: TBD\n<!-- ack:field:closeout-outcome -->\n- Closeout outcome: not_started — full closeout has not yet been assessed.\n<!-- ack:field:project-required-persistence -->\n- Project-required persistence: not_assessed — state whether this project's required Git or other persistence completed, is not required, or is blocked.\n<!-- ack:field:recommended-next-step-explicit -->\n- Recommended next step is explicit and reasoned: TBD\n<!-- ack:field:opening-message-matches-current-state -->\n- Opening message matches current state: TBD\n<!-- ack:field:next-ai-can-continue -->\n- Next AI can continue from `AGENTS.md`, this handoff, `dev/PROJECT_INDEX.md`, and needed rule packs without searching old log history: TBD\n\nIf any answer is no, blocked, or uncertain, fix this handoff before declaring handoff ready. `Closeout outcome: complete` is allowed only when required writes, read-backs and project-required persistence are complete. If project-required persistence is blocked, use `Closeout outcome: blocked` and state the blocker; it is not a completed closeout.\n\nLifecycle consistency rule: compare `Completed This Session`, `Validation / QC`, `Next Priorities`, `Risks / Blockers`, and `Next Session Opening Message` as full content, including renamed or paraphrased work. A completed or verified item must not remain as an unresolved next priority, active risk, or startup instruction unless it is explicitly reclassified as monitor-only, follow-up scope, blocked, or reopened with the missing evidence or trigger condition stated. Doctor catches only mechanical contradictions and unresolved fields; its green result is not semantic proof. Recommended next-step rule: `Next Priorities` must name the single recommended next action and a short reason before listing additional options, unless the next action is blocked or genuinely requires a user decision. Persistence routing rule: one-time delivery instructions, historical validation evidence, old hashes, old version facts, and incident notes must stay in trace evidence unless they still affect the next action.\n\nCloseout-card rule: `closeout-status` reads only these existing handoff fields plus fresh doctor / mirror results; it does not create another persistence authority. Its `complete` card is the only permitted source for the user-facing `handoff saved` wording. A nonzero / `blocked` result must be shown as blocked, never summarized as completed.\n\n<!-- ack:section:handoff-sufficiency-check -->\n## Handoff Sufficiency Check\n\nCan the next AI continue from `AGENTS.md`, this handoff, and only the project index / rule packs required by the next task, without searching old log history?\n\nAnswer: TBD\nReconstruction evidence: TBD — apply the packet-only reconstruction check in `dev/rules/closeout.md`; cite the sections supporting the outcome, task position, resume point, remaining acceptance and source coverage. Record gaps explicitly; a bare yes is insufficient.\nKeep the `Answer:` and `Reconstruction evidence:` labels. Use `yes`, `no` or `unknown` for Answer, followed by an explanation if needed. Narrative and section headings may use the project's language.\nIf no, update this handoff before closeout. Unknown critical context blocks dependent work and is not permission to guess. A saved packet may honestly describe blocked work.\n\nContinuity rule: this file carries current state and next action. `dev/SESSION_LOG.md` carries recent evidence only. Archive old detail only when needed; do not create an archive directory by default.\n\n<!-- ack:section:next-session-opening-message -->\n## Next Session Opening Message\n\nThis fenced block is the authoritative agent-managed startup content. At closeout, verify `START_NEXT_SESSION_PROMPT.txt` against this block. Regenerate only if normalized content differs; if the two differ, trust this block and rewrite the convenience copy. User-facing closeout output should show `Start Agent Handoff` / `開工` as the primary next-session entry, plus the path-bearing fallback when the next AI is not yet pointed at this project root; do not hand-write a separate stateful prompt in the final response.\n\n📋 Next session: agent-managed startup content below\n\n```text\nWork in <ROOT>.\n\nIf the root does not match the handoff, stop and ask for confirmation. Do not read dev/SESSION_LOG.md during ordinary startup. Read dev/PROJECT_INDEX.md, dev/RULE_PACKS.md, dev/DOC_SYNC_REGISTRY.md, and task packs only when the current task requires them.\n\nResume the current objective. A plain `Start Agent Handoff` / `開工` with no same-message task or explicit long-run instruction only authorizes minimum state recovery, 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.\n```\n"
|
|
14921
|
+
},
|
|
14922
|
+
"6194d8d05fa476660ada628c60d5b05afb1b9d0d37430f79dc41389c05b073d2": {
|
|
14923
|
+
"targetRel": "dev/rules/closeout.md",
|
|
14924
|
+
"canonicalSha256": "2ae40352aa9699fa9a6421776fb9e8d4e0078a3d8a3bc6fd1495d0cedd9bc3fe",
|
|
14925
|
+
"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. `agent-handoff-kit closeout-status` checks explicit lifecycle declarations and same-scope textual contradictions; it does not prove natural-language semantic consistency. When it blocks, inspect its first `Resolved [...]` / `Carry-forward [...]` pair against the actual evidence: completion of one action does not complete another acceptance scope, and a preserved limitation is not a completion claim. Repair a real contradiction in its owning handoff section. If truthful, distinct scopes are misclassified, preserve the facts, report the checker defect and stop wording retries; do not add a reclassification prefix, invent a trigger, erase a limitation or broaden governance just to pass. A blocked result remains blocked until verified repair. Read all five sections as a whole before marking the lifecycle field resolved. For governance, release, or another project-defined high-risk completion, use the project's independent semantic review gate in addition to `closeout-status`.\n3. Make `Next Priorities` name one recommended next action and a short reason unless blocked or a real user decision is required.\n4. Complete the persistence-routing, handoff-sufficiency, `Closeout outcome`, and `Project-required persistence` fields. Apply the packet-only reconstruction check below before answering handoff sufficiency. The next agent must be able to continue from `AGENTS.md`, the handoff, the project index when needed, and routed packs without searching old log history. `complete` is allowed only when all required writes/read-backs and any project-required persistence succeeded; use `not_required` only when that persistence is genuinely not required. If a required commit, push, release record, or equivalent persistence is blocked or not authorized, set both fields to `blocked` with the exact boundary.\n5. Add one concise log entry 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"
|
|
14731
14926
|
}
|
|
14732
14927
|
},
|
|
14733
|
-
"catalogDigestSha256": "
|
|
14928
|
+
"catalogDigestSha256": "26a8ee80ff9c54bbea98a429a73a141213538f4f4c474e4ffc97e505f519b888"
|
|
14734
14929
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Tailwind Labs, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Deterministic, read-only dashboard. Existing Markdown remains authoritative.
|
|
2
|
+
import {openSync,closeSync,readSync,fstatSync,statSync,realpathSync,existsSync} from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import {createHash} from 'node:crypto';
|
|
5
|
+
import {readBounded,signature,markdown,safe,logEntry} from './projection.mjs';
|
|
6
|
+
import {parseProjectIndexTemplateVersion} from '../upgrade-inventory.mjs';
|
|
7
|
+
|
|
8
|
+
export const DASH_LIMITS=Object.freeze({document:1024*1024,metadata:512*1024,items:128,documents:160,historyBytes:256*1024,historyFiles:4,historyPage:20,entryBytes:64*1024,cursors:32});
|
|
9
|
+
const digest=s=>createHash('sha256').update(s).digest('hex');
|
|
10
|
+
const states=new Set(['planned','active','waiting','review','done','paused','dropped']);
|
|
11
|
+
const clean=s=>safe(String(s||'').replace(/\*\*/g,'').replace(/^\s*[-*]\s+/,'').trim());
|
|
12
|
+
const placeholder=s=>!s||s==='TBD'||/^<.*>$/.test(s)||s==='—'||s==='-';
|
|
13
|
+
const lines=s=>s.replace(/^\uFEFF/,'').split(/\r?\n/);
|
|
14
|
+
const key=s=>clean(s).toLowerCase();
|
|
15
|
+
const known=[
|
|
16
|
+
['handoff','dev/SESSION_HANDOFF.md','handoff','current'],['log','dev/SESSION_LOG.md','log','history'],
|
|
17
|
+
['archive','dev/SESSION_LOG_archive/INDEX.md','archive','history'],['index','dev/PROJECT_INDEX.md','index','reference'],
|
|
18
|
+
['rules','AGENTS.md','rules','rules'],['packs','dev/RULE_PACKS.md','packs','rules'],
|
|
19
|
+
['decisions','dev/PROJECT_DECISIONS.md','decisions','reference'],['sync','dev/DOC_SYNC_REGISTRY.md','sync','reference']
|
|
20
|
+
];
|
|
21
|
+
function section(text,title){return markdown(text).sections.find(s=>key(s.title)===title.toLowerCase());}
|
|
22
|
+
function table(section){
|
|
23
|
+
if(!section)return[];let headers=null,out=[];
|
|
24
|
+
for(const r of section.rows){if(!r.text.trim().startsWith('|'))continue;const cells=r.text.trim().replace(/^\||\|$/g,'').split(/(?<!\\)\|/).map(x=>clean(x.replace(/\\\|/g,'|')));
|
|
25
|
+
if(cells.every(x=>/^:?-+:?$/.test(x)))continue;
|
|
26
|
+
if(!headers){headers=cells.map(key);continue;}
|
|
27
|
+
out.push({...Object.fromEntries(headers.map((h,i)=>[h,cells[i]||''])),line:r.line});
|
|
28
|
+
}return out;
|
|
29
|
+
}
|
|
30
|
+
function fields(s){const out={};for(const r of s?.rows||[]){const m=clean(r.text).match(/^([^::]+)[::]\s*(.*)$/);if(m&&!placeholder(m[2]))out[key(m[1])]=m[2];}return out;}
|
|
31
|
+
function relativeFile(value){
|
|
32
|
+
const s=String(value||'').replace(/`/g,'').split('#')[0];
|
|
33
|
+
if(!s||s.includes('\\')||s.includes('\0')||path.isAbsolute(s)||/^[a-z]+:/i.test(s)||s.split('/').some(x=>!x||x==='.'||x==='..'||x.startsWith('.'))||/(?:^|\/)(?:node_modules|governance_migrations)(?:\/|$)/i.test(s)||/(?:credential|secret|\.env|private.key)/i.test(s))return null;
|
|
34
|
+
return s;
|
|
35
|
+
}
|
|
36
|
+
function checked(root,file){const rel=relativeFile(file);if(!rel)throw Error('boundary');const real=realpathSync(path.join(root,rel)),r=path.relative(root,real);if(r.startsWith('..')||path.isAbsolute(r))throw Error('boundary');if(!statSync(real).isFile())throw Error('not_file');return real;}
|
|
37
|
+
|
|
38
|
+
export function parseWork(text){
|
|
39
|
+
const sections=markdown(text).sections.filter(s=>key(s.title)==='work items');if(sections.length>1)throw Error('work_format');
|
|
40
|
+
const s=sections[0];if(!s)return {items:[],recorded:false};
|
|
41
|
+
if(!s.rows.some(r=>/^\|\s*ID\s*\|\s*Title\s*\|\s*Status\s*\|\s*Parent\s*\|\s*Summary\s*\|\s*Source\s*\|/i.test(r.text.trim())))throw Error('work_format');
|
|
42
|
+
const rows=table(s).filter(r=>!placeholder(r.id));if(rows.length>DASH_LIMITS.items)throw Error('work_capacity');
|
|
43
|
+
const ids=new Set();const items=rows.map(r=>{
|
|
44
|
+
if(!/^[a-z0-9][a-z0-9_-]{0,63}$/i.test(r.id)||ids.has(r.id)||!states.has(r.status)||placeholder(r.title))throw Error('work_format');ids.add(r.id);
|
|
45
|
+
const source=placeholder(r.source)?null:relativeFile(r.source);if(!placeholder(r.source)&&!source)throw Error('work_source');
|
|
46
|
+
return {id:r.id,title:r.title,titleZh:r['title zh-hant']||null,status:r.status,parent:placeholder(r.parent)?null:r.parent,summary:r.summary||'',summaryZh:r['summary zh-hant']||null,artifact:source,source:{file:'dev/SESSION_HANDOFF.md',line:r.line}};
|
|
47
|
+
});
|
|
48
|
+
for(const item of items){let at=item,seen=new Set();while(at.parent){if(seen.has(at.id))throw Error('work_cycle');seen.add(at.id);at=items.find(x=>x.id===at.parent);if(!at)throw Error('work_parent');}}
|
|
49
|
+
return {items,recorded:true};
|
|
50
|
+
}
|
|
51
|
+
export function parseProfile(text){const f=fields(section(text,'Project'));return {name:f.name||null,nameZh:f['name zh-hant']||null,goal:f.goal||null,goalZh:f['goal zh-hant']||null};}
|
|
52
|
+
|
|
53
|
+
function logEntries(text,file,startLine=1){
|
|
54
|
+
return markdown(text).sections.map(s=>logEntry(s,file,startLine)).filter(Boolean);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function createDashboard(root,source){
|
|
58
|
+
root=realpathSync(root);const cache=new Map(),cursors=new Map(),watched=new Map();let acceptedIndex=null,projectKitVersion=null,historyRevision=0,revision=0,work={items:[],recorded:false},profile={},docs=[],links=[],errors={},last='';
|
|
59
|
+
function read(file,limit=DASH_LIMITS.metadata){const sig=signature(root,file),old=cache.get(file);if(old?.sig===sig)return old;try{const r=readBounded(root,file,limit);const v={...r,sig};cache.set(file,v);return v;}catch(e){const v={sig,error:e.message,previous:old?.error?old.previous:old};cache.set(file,v);return v;}}
|
|
60
|
+
function refresh(){if(existsSync(path.join(root,'dev/governance_migrations/.upgrade.lock')))return false;
|
|
61
|
+
errors={};const h=source?.state?{text:source.state.acceptedHandoff,error:source.state.errors.handoff||(!source.state.acceptedHandoff?'unavailable':null)}:read('dev/SESSION_HANDOFF.md',DASH_LIMITS.document);let i=read('dev/PROJECT_INDEX.md');
|
|
62
|
+
projectKitVersion=i.error?null:parseProjectIndexTemplateVersion(i.text);
|
|
63
|
+
if(!h.error){try{work=parseWork(h.text);}catch(e){errors.work=e.message;}}else errors.work=h.error;
|
|
64
|
+
if(!i.error){try{const next=parseProfile(i.text);const block=section(i.text,'Project');if((profile.name||profile.goal)&&!block||block&&!block.rows.some(r=>/^(?:-\s*)?Name:\s*\S/.test(r.text)))throw Error('index_format');profile=next;acceptedIndex=i;}catch{errors.index='format';i=acceptedIndex||{error:'format'};}}else{if(i.sig!=='missing'||acceptedIndex)errors.index=i.error;if(acceptedIndex)i=acceptedIndex;}
|
|
65
|
+
const all=known.map(([id,file,role,group])=>({id,file,role,group,title:null,registered:true}));
|
|
66
|
+
if(!i.error){for(const r of table(section(i.text,'Directory Map'))){const file=relativeFile(r.path);if(file&&!all.some(x=>x.file===file)&&/\.(md|txt|html|pdf|csv|json)$/i.test(file))all.push({id:digest(file).slice(0,16),file,role:'document',group:'reference',title:r.role||file,registered:true,source:{file:'dev/PROJECT_INDEX.md',line:r.line}});}}
|
|
67
|
+
for(const item of work.items)if(item.artifact&&!all.some(x=>x.file===item.artifact))all.push({id:digest(item.artifact).slice(0,16),file:item.artifact,role:'artifact',group:'results',title:item.title,titleZh:item.titleZh,registered:true,source:item.source});
|
|
68
|
+
if(all.length>DASH_LIMITS.documents)errors.documents='capacity';
|
|
69
|
+
docs=all.slice(0,DASH_LIMITS.documents).map(d=>{try{const st=statSync(checked(root,d.file));return {...d,available:true,updated:new Date(st.mtimeMs).toISOString(),bytes:st.size};}catch{return {...d,available:false};}});
|
|
70
|
+
links=[['index','handoff','routes'],['rules','handoff','governs'],['packs','rules','routes'],['log','archive','archives']].filter(([a,b])=>docs.some(x=>x.id===a&&x.available)&&docs.some(x=>x.id===b&&x.available)).map(([from,to,type])=>({from,to,type,basis:'kit-contract'}));
|
|
71
|
+
// Project-specific links must be explicit, never inferred from prose or filenames.
|
|
72
|
+
if(!i.error)for(const r of table(section(i.text,'Document Relations'))){const a=docs.find(x=>x.file===relativeFile(r.from)),b=docs.find(x=>x.file===relativeFile(r.to));if(a&&b&&['references','routes','mirrors','checks'].includes(r.relation))links.push({from:a.id,to:b.id,type:r.relation,basis:'dev/PROJECT_INDEX.md',line:r.line});}
|
|
73
|
+
for(const file of ['dev/SESSION_LOG.md','dev/SESSION_LOG_archive/INDEX.md',...watched.keys()]){const sig=signature(root,file);if(watched.has(file)&&watched.get(file)!==sig)historyRevision++;watched.set(file,sig);}
|
|
74
|
+
const value=JSON.stringify({work,profile,projectKitVersion,docs,links,errors,historyRevision});if(value===last)return false;last=value;revision++;return true;
|
|
75
|
+
}
|
|
76
|
+
function snapshot(){return{revision,historyRevision,work,profile,projectKitVersion,documents:docs,links,errors,limits:DASH_LIMITS};}
|
|
77
|
+
function document(id){if(existsSync(path.join(root,'dev/governance_migrations/.upgrade.lock')))throw Error('upgrade');const doc=docs.find(x=>x.id===id);if(!doc)throw Error('unknown_document');checked(root,doc.file);if(!/\.(md|txt|csv|json)$/i.test(doc.file))return{...doc,text:null,reason:'preview_unavailable'};const r=readBounded(root,doc.file,DASH_LIMITS.document);return{...doc,text:safe(r.text),updated:r.mtime,hash:r.hash};}
|
|
78
|
+
function history({from='',to='',search='',work:workId='',cursor=''}={}){
|
|
79
|
+
if(existsSync(path.join(root,'dev/governance_migrations/.upgrade.lock')))throw Error('upgrade');
|
|
80
|
+
for(const d of [from,to])if(d&&(!/^\d{4}-\d{2}-\d{2}$/.test(d)||Number.isNaN(Date.parse(d))||new Date(d+'T00:00:00Z').toISOString().slice(0,10)!==d))throw Error('date');if(from&&to&&from>to)throw Error('date');if(search.length>100||workId.length>64)throw Error('query');
|
|
81
|
+
const query={from,to,search,workId},q=digest(JSON.stringify(query));let job;
|
|
82
|
+
if(cursor){job=cursors.get(cursor);if(!job||job.q!==q||Date.now()-job.created>15*60_000)throw Error('expired');cursors.delete(cursor);for(const [file,sig]of Object.entries(job.signatures))if(signature(root,file)!==sig)throw Error('history_changed');}
|
|
83
|
+
else{
|
|
84
|
+
const files=['dev/SESSION_LOG.md'],warnings=[];const idx=read('dev/SESSION_LOG_archive/INDEX.md');
|
|
85
|
+
if(!idx.error){const block=section(idx.text,'Batch 清單')||section(idx.text,'Batches')||markdown(idx.text).sections.find(s=>s.rows.some(x=>/\|.*(?:File path|Path).*\|/i.test(x.text)));const rows=table(block);
|
|
86
|
+
if(!block||!block.rows.some(r=>/\|.*Date range.*\|.*(?:File path|Path).*\|/i.test(r.text)))warnings.push('archive_index');
|
|
87
|
+
for(const r of rows){const file=String(r['file path']||r.path||'').replace(/`/g,'');const rel=relativeFile('dev/SESSION_LOG_archive/'+file);if(!rel||!/^archive_[\w.-]+\.md$/.test(file)){warnings.push('archive_index');continue;}
|
|
88
|
+
const dates=String(r['date range']||'').match(/\d{4}-\d{2}-\d{2}/g);if(!dates||dates.length!==2||dates[0]>dates[1]||dates.some(d=>Number.isNaN(Date.parse(d))||new Date(d+'T00:00:00Z').toISOString().slice(0,10)!==d)){warnings.push('archive_range');files.push(rel);continue;}
|
|
89
|
+
if((!from||dates[1]>=from)&&(!to||dates[0]<=to))files.push(rel);
|
|
90
|
+
}
|
|
91
|
+
}else if(idx.sig!=='missing')warnings.push('archive_index');
|
|
92
|
+
else if(existsSync(path.join(root,'dev/SESSION_LOG_archive')))warnings.push('archive_index');
|
|
93
|
+
job={q,query,files:[...new Set(files)],index:0,offset:0,line:1,buffer:'',entry:'',entryLine:1,fence:null,seen:{},queue:[],warnings:[...new Set(warnings)],created:Date.now(),signatures:{'dev/SESSION_LOG_archive/INDEX.md':signature(root,'dev/SESSION_LOG_archive/INDEX.md')},bytes:0};
|
|
94
|
+
}
|
|
95
|
+
// Bound every request independently of total history. Resume byte offsets using an opaque cursor.
|
|
96
|
+
let budget=DASH_LIMITS.historyBytes,fileBudget=DASH_LIMITS.historyFiles;
|
|
97
|
+
const emit=(text,file,line)=>{try{if(text.includes('<!-- ack:log-entry:start -->')&&!text.includes('<!-- ack:log-entry:end -->'))job.warnings.push('incomplete_entry');for(const item of logEntries(text,file,line)){
|
|
98
|
+
if(from&&item.date<from||to&&item.date>to||workId&&item.work!==workId||search&&!`${item.title}\n${item.body}`.toLocaleLowerCase().includes(search.toLocaleLowerCase()))continue;
|
|
99
|
+
if(job.seen[item.id]){if(job.seen[item.id]!==item.fingerprint)job.warnings.push('event_conflict');continue;}job.seen[item.id]=item.fingerprint;job.queue.push(item);
|
|
100
|
+
}}catch{job.warnings.push('incomplete_entry');}};
|
|
101
|
+
while(job.queue.length<DASH_LIMITS.historyPage&&job.index<job.files.length&&budget>0&&fileBudget>0){
|
|
102
|
+
const file=job.files[job.index];let fd;
|
|
103
|
+
try{
|
|
104
|
+
const real=checked(root,file),sig=signature(root,file);if(job.signatures[file]&&job.signatures[file]!==sig)throw Error('history_changed');job.signatures[file]=sig;
|
|
105
|
+
if(watched.size>=130&&!watched.has(file)){const victim=[...watched.keys()].find(x=>x.includes('/archive_'));if(victim)watched.delete(victim);}watched.set(file,sig);
|
|
106
|
+
fd=openSync(real,'r');const st=fstatSync(fd);if(st.size<job.offset)throw Error('history_changed');
|
|
107
|
+
const len=Math.min(32768,budget,st.size-job.offset),buf=Buffer.alloc(len);const n=readSync(fd,buf,0,len,job.offset);job.offset+=n;budget-=n;job.bytes+=n;
|
|
108
|
+
// Buffer bytes between chunks so a multi-byte UTF-8 character is never split.
|
|
109
|
+
const pending=Buffer.concat([Buffer.from(job.buffer,'base64'),buf.subarray(0,n)]);const end=job.offset===st.size?pending.length:pending.lastIndexOf(10)+1;
|
|
110
|
+
job.buffer=pending.subarray(end).toString('base64');if(pending.length>DASH_LIMITS.entryBytes&&end===0)throw Error('entry_capacity');
|
|
111
|
+
const text=new TextDecoder('utf-8',{fatal:true}).decode(pending.subarray(0,end));
|
|
112
|
+
for(const raw of text?text.split('\n').slice(0,text.endsWith('\n')?-1:undefined):[]){
|
|
113
|
+
const line=raw.replace(/\r$/,'');let visible=line;
|
|
114
|
+
if(!job.fence&&!/^\s*<!-- ack:log-entry:(?:start|end) -->\s*$/.test(line)){if(job.inComment){const end=visible.indexOf('-->');if(end<0)visible='';else{visible=visible.slice(end+3);job.inComment=false;}}while(visible.includes('<!--')){const start=visible.indexOf('<!--'),end=visible.indexOf('-->',start+4);if(end<0){visible=visible.slice(0,start);job.inComment=true;break;}visible=visible.slice(0,start)+visible.slice(end+3);}}
|
|
115
|
+
const f=visible.match(/^\s*(`{3,}|~{3,})(.*)$/);if(f){if(!job.fence)job.fence=f[1];else if(job.fence[0]===f[1][0]&&f[1].length>=job.fence.length&&!f[2].trim())job.fence=null;}
|
|
116
|
+
if(!job.fence&&!job.inComment&&/^\s*<!-- ack:log-entry:start -->\s*$/.test(line)){if(job.entry)emit(job.entry,file,job.entryLine);job.entry='';job.marked=true;job.line++;continue;}
|
|
117
|
+
const heading=!job.fence&&/^## \d{4}-\d{2}-\d{2}\s*[—–-]/.test(visible);
|
|
118
|
+
if(heading){if(job.entry)emit(job.entry,file,job.entryLine);job.entry=(job.marked?'<!-- ack:log-entry:start -->\n':'')+line+'\n';job.entryLine=job.line-(job.marked?1:0);job.marked=false;}
|
|
119
|
+
else if(job.entry)job.entry+=line+'\n';
|
|
120
|
+
if(Buffer.byteLength(job.entry)>DASH_LIMITS.entryBytes){job.entry='';job.warnings.push('entry_capacity');}job.line++;
|
|
121
|
+
}
|
|
122
|
+
if(signature(root,file)!==sig||fstatSync(fd).mtimeMs!==st.mtimeMs)throw Error('history_changed');
|
|
123
|
+
if(job.offset===st.size){if(job.entry)emit(job.entry,file,job.entryLine);if(job.marked||job.fence||job.inComment)job.warnings.push('incomplete_entry');job.index++;job.offset=0;job.line=1;job.entry='';job.buffer='';job.fence=null;job.marked=false;job.inComment=false;fileBudget--;}
|
|
124
|
+
}catch(e){if(e.message==='history_changed')throw e;job.warnings.push(e.message==='boundary'?'boundary':'history_unreadable');job.index++;job.offset=0;job.line=1;job.entry='';job.buffer='';job.fence=null;job.marked=false;fileBudget--;}
|
|
125
|
+
finally{if(fd!==undefined)closeSync(fd);}
|
|
126
|
+
}
|
|
127
|
+
job.queue.sort((a,b)=>b.date.localeCompare(a.date));const items=job.queue.splice(0,DASH_LIMITS.historyPage);const complete=job.index>=job.files.length&&!job.queue.length;
|
|
128
|
+
// Cap remembered deduplication identities; explicit coverage warning instead of silent unbounded growth.
|
|
129
|
+
if(Object.keys(job.seen).length>10000){job.warnings.push('history_capacity');job.index=job.files.length;job.queue=[];}
|
|
130
|
+
let next=null;if(!complete&&Object.keys(job.seen).length<=10000){next=digest(q+Date.now()+Math.random());job.created=Date.now();if(cursors.size>=DASH_LIMITS.cursors)cursors.delete(cursors.keys().next().value);cursors.set(next,job);}
|
|
131
|
+
return{items,next,complete:complete&&!job.warnings.length,warnings:[...new Set(job.warnings)],bytesRead:DASH_LIMITS.historyBytes-budget,filesChecked:job.index,totalFiles:job.files.length,range:{from,to},revision};
|
|
132
|
+
}
|
|
133
|
+
return{refresh,snapshot,document,history};
|
|
134
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg"><symbol id="document" viewBox="0 0 24 24">
|
|
2
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"/>
|
|
3
|
+
</symbol>
|
|
4
|
+
<symbol id="clock" viewBox="0 0 24 24">
|
|
5
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/>
|
|
6
|
+
</symbol>
|
|
7
|
+
<symbol id="check" viewBox="0 0 24 24">
|
|
8
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12c0 1.268-.63 2.39-1.593 3.068a3.745 3.745 0 0 1-1.043 3.296 3.745 3.745 0 0 1-3.296 1.043A3.745 3.745 0 0 1 12 21c-1.268 0-2.39-.63-3.068-1.593a3.746 3.746 0 0 1-3.296-1.043 3.745 3.745 0 0 1-1.043-3.296A3.745 3.745 0 0 1 3 12c0-1.268.63-2.39 1.593-3.068a3.745 3.745 0 0 1 1.043-3.296 3.746 3.746 0 0 1 3.296-1.043A3.746 3.746 0 0 1 12 3c1.268 0 2.39.63 3.068 1.593a3.746 3.746 0 0 1 3.296 1.043 3.746 3.746 0 0 1 1.043 3.296A3.745 3.745 0 0 1 21 12Z"/>
|
|
9
|
+
</symbol>
|
|
10
|
+
<symbol id="search" viewBox="0 0 24 24">
|
|
11
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"/>
|
|
12
|
+
</symbol>
|
|
13
|
+
<symbol id="close" viewBox="0 0 24 24">
|
|
14
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"/>
|
|
15
|
+
</symbol>
|
|
16
|
+
<symbol id="arrow" viewBox="0 0 24 24">
|
|
17
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"/>
|
|
18
|
+
</symbol>
|
|
19
|
+
<symbol id="grid" viewBox="0 0 24 24">
|
|
20
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25A2.25 2.25 0 0 1 13.5 18v-2.25Z"/>
|
|
21
|
+
</symbol>
|
|
22
|
+
<symbol id="archive" viewBox="0 0 24 24">
|
|
23
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"/>
|
|
24
|
+
</symbol>
|
|
25
|
+
<symbol id="map" viewBox="0 0 24 24">
|
|
26
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9 6.75V15m6-6v8.25m.503 3.498 4.875-2.437c.381-.19.622-.58.622-1.006V4.82c0-.836-.88-1.38-1.628-1.006l-3.869 1.934c-.317.159-.69.159-1.006 0L9.503 3.252a1.125 1.125 0 0 0-1.006 0L3.622 5.689C3.24 5.88 3 6.27 3 6.695V19.18c0 .836.88 1.38 1.628 1.006l3.869-1.934c.317-.159.69-.159 1.006 0l4.994 2.497c.317.158.69.158 1.006 0Z"/>
|
|
27
|
+
</symbol>
|
|
28
|
+
<symbol id="calendar" viewBox="0 0 24 24">
|
|
29
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"/>
|
|
30
|
+
</symbol>
|
|
31
|
+
<symbol id="link" viewBox="0 0 24 24">
|
|
32
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"/>
|
|
33
|
+
</symbol>
|
|
34
|
+
<symbol id="copy" viewBox="0 0 24 24">
|
|
35
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"/>
|
|
36
|
+
</symbol></svg>
|