blun-king-cli 9.1.567 → 9.1.569

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/agent-spine-plugin/.claude-plugin/marketplace.json +1 -1
  2. package/agent-spine-plugin/.claude-plugin/plugin.json +1 -1
  3. package/agent-spine-plugin/.codex-plugin/plugin.json +2 -1
  4. package/agent-spine-plugin/CHANGELOG.md +1581 -0
  5. package/agent-spine-plugin/README.md +30 -4
  6. package/agent-spine-plugin/blun.plugin.json +3 -3
  7. package/agent-spine-plugin/docs/acceptance.md +61 -0
  8. package/agent-spine-plugin/docs/assignment-continuation.md +48 -0
  9. package/agent-spine-plugin/docs/host-integration.md +178 -0
  10. package/agent-spine-plugin/docs/preflight-recall.md +69 -0
  11. package/agent-spine-plugin/docs/preservation-contract.md +53 -0
  12. package/agent-spine-plugin/docs/quality-gates.md +50 -0
  13. package/agent-spine-plugin/docs/releasing.md +85 -0
  14. package/agent-spine-plugin/docs/session-timeline.md +251 -0
  15. package/agent-spine-plugin/docs/source-roots.md +113 -0
  16. package/agent-spine-plugin/docs/structured-completion.md +67 -0
  17. package/agent-spine-plugin/docs/world-model.md +94 -0
  18. package/agent-spine-plugin/hooks/codex.json +2 -2
  19. package/agent-spine-plugin/hooks/hooks.json +1 -1
  20. package/agent-spine-plugin/hooks/version.json +1 -1
  21. package/agent-spine-plugin/package.json +13 -3
  22. package/agent-spine-plugin/scripts/check-codex-install.js +226 -0
  23. package/agent-spine-plugin/scripts/check-hosts.js +14 -5
  24. package/agent-spine-plugin/scripts/check-install-hook.js +226 -0
  25. package/agent-spine-plugin/scripts/check-install-selfstarter.js +154 -0
  26. package/agent-spine-plugin/scripts/check-install.js +478 -0
  27. package/agent-spine-plugin/scripts/check-line-budget.js +58 -0
  28. package/agent-spine-plugin/scripts/check-syntax.js +29 -0
  29. package/agent-spine-plugin/scripts/github-actions.js +11 -0
  30. package/agent-spine-plugin/scripts/hermetic-process.js +183 -0
  31. package/agent-spine-plugin/scripts/release-check.js +145 -0
  32. package/agent-spine-plugin/scripts/run-acceptance.js +19 -0
  33. package/agent-spine-plugin/scripts/run-checks.js +47 -0
  34. package/agent-spine-plugin/scripts/run-tests-hermetic.js +89 -0
  35. package/agent-spine-plugin/skills/agent-spine/SKILL.md +16 -2
  36. package/agent-spine-plugin/spine-example/1-identity.md +12 -0
  37. package/agent-spine-plugin/spine-example/2-voice.md +6 -0
  38. package/agent-spine-plugin/spine-example/3-conduct.md +8 -0
  39. package/agent-spine-plugin/spine-example/4-history.md +4 -0
  40. package/agent-spine-plugin/src/cli-agent.js +296 -0
  41. package/agent-spine-plugin/src/cli-attention.js +95 -0
  42. package/agent-spine-plugin/src/cli-autonomy.js +36 -0
  43. package/agent-spine-plugin/src/cli-common.js +71 -0
  44. package/agent-spine-plugin/src/cli-continuity.js +116 -0
  45. package/agent-spine-plugin/src/cli-core.js +128 -0
  46. package/agent-spine-plugin/src/cli-diagnostics.js +291 -0
  47. package/agent-spine-plugin/src/cli-host.js +21 -0
  48. package/agent-spine-plugin/src/cli-learning.js +305 -0
  49. package/agent-spine-plugin/src/cli-premortem.js +16 -0
  50. package/agent-spine-plugin/src/cli-sharing.js +230 -0
  51. package/agent-spine-plugin/src/cli.js +40 -1350
  52. package/agent-spine-plugin/src/codex-reader-launcher.js +182 -0
  53. package/agent-spine-plugin/src/hook.js +185 -567
  54. package/agent-spine-plugin/src/index.js +16 -2
  55. package/agent-spine-plugin/src/lib/acceptance.js +113 -11
  56. package/agent-spine-plugin/src/lib/action-lesson-recall.js +53 -0
  57. package/agent-spine-plugin/src/lib/attention-context.js +167 -0
  58. package/agent-spine-plugin/src/lib/attention-events.js +113 -0
  59. package/agent-spine-plugin/src/lib/attention-privacy.js +72 -0
  60. package/agent-spine-plugin/src/lib/attention-schema.js +164 -0
  61. package/agent-spine-plugin/src/lib/attention-storage.js +93 -0
  62. package/agent-spine-plugin/src/lib/attention.js +9 -600
  63. package/agent-spine-plugin/src/lib/audit-premortem.js +223 -0
  64. package/agent-spine-plugin/src/lib/audit.js +56 -6
  65. package/agent-spine-plugin/src/lib/autonomy-policy.js +110 -0
  66. package/agent-spine-plugin/src/lib/autonomy-store.js +202 -0
  67. package/agent-spine-plugin/src/lib/autonomy.js +8 -0
  68. package/agent-spine-plugin/src/lib/briefing.js +67 -4
  69. package/agent-spine-plugin/src/lib/catalog-document-read.js +51 -0
  70. package/agent-spine-plugin/src/lib/catalog.js +1 -1
  71. package/agent-spine-plugin/src/lib/codex-installation.js +231 -0
  72. package/agent-spine-plugin/src/lib/codex-skill-installation.js +211 -0
  73. package/agent-spine-plugin/src/lib/context.js +3 -1
  74. package/agent-spine-plugin/src/lib/delivery-agent-usage.js +224 -0
  75. package/agent-spine-plugin/src/lib/delivery-assignment.js +220 -0
  76. package/agent-spine-plugin/src/lib/delivery-command-actions.js +453 -0
  77. package/agent-spine-plugin/src/lib/delivery-knowledge.js +78 -0
  78. package/agent-spine-plugin/src/lib/delivery-premortem-binding.js +107 -0
  79. package/agent-spine-plugin/src/lib/delivery-premortem-closure.js +171 -0
  80. package/agent-spine-plugin/src/lib/delivery-premortem-codec.js +45 -0
  81. package/agent-spine-plugin/src/lib/delivery-premortem-correction.js +101 -0
  82. package/agent-spine-plugin/src/lib/delivery-premortem-file.js +21 -0
  83. package/agent-spine-plugin/src/lib/delivery-premortem-index.js +493 -0
  84. package/agent-spine-plugin/src/lib/delivery-premortem-inspection.js +37 -0
  85. package/agent-spine-plugin/src/lib/delivery-premortem-recovery.js +120 -0
  86. package/agent-spine-plugin/src/lib/delivery-premortem-rejection.js +65 -0
  87. package/agent-spine-plugin/src/lib/delivery-premortem-results.js +28 -0
  88. package/agent-spine-plugin/src/lib/delivery-premortem-session-guard.js +46 -0
  89. package/agent-spine-plugin/src/lib/delivery-premortem-write-ledger.js +285 -0
  90. package/agent-spine-plugin/src/lib/delivery-premortem.js +499 -0
  91. package/agent-spine-plugin/src/lib/delivery-shell-heredoc.js +115 -0
  92. package/agent-spine-plugin/src/lib/delivery-shell-substitutions.js +111 -0
  93. package/agent-spine-plugin/src/lib/delivery-shell-wrapper.js +64 -0
  94. package/agent-spine-plugin/src/lib/delivery-target.js +73 -0
  95. package/agent-spine-plugin/src/lib/delivery-verification.js +445 -0
  96. package/agent-spine-plugin/src/lib/documents.js +27 -5
  97. package/agent-spine-plugin/src/lib/filesystem-retry.js +2 -0
  98. package/agent-spine-plugin/src/lib/gateway-common.js +68 -0
  99. package/agent-spine-plugin/src/lib/gateway-control.js +302 -0
  100. package/agent-spine-plugin/src/lib/gateway-delivery.js +103 -0
  101. package/agent-spine-plugin/src/lib/gateway-execution.js +350 -0
  102. package/agent-spine-plugin/src/lib/gateway-host-lifecycle.js +185 -0
  103. package/agent-spine-plugin/src/lib/gateway-inspection.js +85 -0
  104. package/agent-spine-plugin/src/lib/gateway-knowledge.js +129 -0
  105. package/agent-spine-plugin/src/lib/gateway-policy-provenance.js +197 -0
  106. package/agent-spine-plugin/src/lib/gateway-premortem-disposition.js +82 -0
  107. package/agent-spine-plugin/src/lib/gateway-premortem.js +363 -0
  108. package/agent-spine-plugin/src/lib/gateway-runs.js +300 -0
  109. package/agent-spine-plugin/src/lib/gateway-runtime-identity.js +31 -0
  110. package/agent-spine-plugin/src/lib/gateway-runtime-records.js +21 -0
  111. package/agent-spine-plugin/src/lib/gateway-runtime.js +18 -1623
  112. package/agent-spine-plugin/src/lib/gateway-state-transaction.js +356 -0
  113. package/agent-spine-plugin/src/lib/gateway-state.js +342 -0
  114. package/agent-spine-plugin/src/lib/hook-artifact-guards.js +356 -0
  115. package/agent-spine-plugin/src/lib/hook-audit.js +16 -2
  116. package/agent-spine-plugin/src/lib/hook-briefing-use.js +68 -0
  117. package/agent-spine-plugin/src/lib/hook-context.js +424 -0
  118. package/agent-spine-plugin/src/lib/hook-final-message.js +26 -0
  119. package/agent-spine-plugin/src/lib/hook-input.js +27 -0
  120. package/agent-spine-plugin/src/lib/hook-output.js +140 -0
  121. package/agent-spine-plugin/src/lib/hook-premortem.js +257 -0
  122. package/agent-spine-plugin/src/lib/hook-process-advisory.js +37 -0
  123. package/agent-spine-plugin/src/lib/hook-protection.js +95 -0
  124. package/agent-spine-plugin/src/lib/hook-stop-verification.js +84 -0
  125. package/agent-spine-plugin/src/lib/hook-timeline.js +91 -0
  126. package/agent-spine-plugin/src/lib/identifier-analysis.js +446 -0
  127. package/agent-spine-plugin/src/lib/indexed-memory.js +23 -6
  128. package/agent-spine-plugin/src/lib/knowledge-evidence.js +431 -0
  129. package/agent-spine-plugin/src/lib/learning-applications.js +441 -0
  130. package/agent-spine-plugin/src/lib/learning-candidates.js +274 -0
  131. package/agent-spine-plugin/src/lib/learning-context.js +130 -0
  132. package/agent-spine-plugin/src/lib/learning-delivery-contracts.js +310 -0
  133. package/agent-spine-plugin/src/lib/learning-evaluation-contracts.js +350 -0
  134. package/agent-spine-plugin/src/lib/learning-evaluation-registration.js +372 -0
  135. package/agent-spine-plugin/src/lib/learning-evaluation-revocation.js +292 -0
  136. package/agent-spine-plugin/src/lib/learning-evidence-contracts.js +321 -0
  137. package/agent-spine-plugin/src/lib/learning-findings.js +458 -0
  138. package/agent-spine-plugin/src/lib/learning-measurement-contracts.js +285 -0
  139. package/agent-spine-plugin/src/lib/learning-measurements.js +265 -0
  140. package/agent-spine-plugin/src/lib/learning-outcome-contracts.js +165 -0
  141. package/agent-spine-plugin/src/lib/learning-outcomes.js +343 -0
  142. package/agent-spine-plugin/src/lib/learning-reconciliation.js +290 -0
  143. package/agent-spine-plugin/src/lib/learning-retry-contracts.js +188 -0
  144. package/agent-spine-plugin/src/lib/learning-schema.js +229 -0
  145. package/agent-spine-plugin/src/lib/learning-scope-targets.js +424 -0
  146. package/agent-spine-plugin/src/lib/learning-state-upgrade.js +477 -0
  147. package/agent-spine-plugin/src/lib/learning-status-configuration.js +476 -0
  148. package/agent-spine-plugin/src/lib/learning-storage.js +203 -0
  149. package/agent-spine-plugin/src/lib/learning-trial-recovery.js +218 -0
  150. package/agent-spine-plugin/src/lib/learning-validation-contracts.js +375 -0
  151. package/agent-spine-plugin/src/lib/learning-validation-renewal.js +298 -0
  152. package/agent-spine-plugin/src/lib/learning-validation-runtime.js +234 -0
  153. package/agent-spine-plugin/src/lib/learning.js +36 -6923
  154. package/agent-spine-plugin/src/lib/lesson-recall-session.js +172 -0
  155. package/agent-spine-plugin/src/lib/mcp-autonomy-tools.js +37 -0
  156. package/agent-spine-plugin/src/lib/mcp-delivery-completion.js +124 -0
  157. package/agent-spine-plugin/src/lib/mcp-delivery-tools.js +45 -0
  158. package/agent-spine-plugin/src/lib/mcp-premortem.js +68 -0
  159. package/agent-spine-plugin/src/lib/mcp-runtime.js +269 -0
  160. package/agent-spine-plugin/src/lib/mcp-source-context.js +51 -0
  161. package/agent-spine-plugin/src/lib/mcp-timeline-tools.js +164 -0
  162. package/agent-spine-plugin/src/lib/mcp-world-tools.js +52 -0
  163. package/agent-spine-plugin/src/lib/owned-file-lock.js +30 -10
  164. package/agent-spine-plugin/src/lib/project-portfolio.js +176 -0
  165. package/agent-spine-plugin/src/lib/selfstarter-core.js +382 -0
  166. package/agent-spine-plugin/src/lib/selfstarter-jobs.js +149 -0
  167. package/agent-spine-plugin/src/lib/selfstarter-lease.js +204 -0
  168. package/agent-spine-plugin/src/lib/selfstarter-policy.js +90 -0
  169. package/agent-spine-plugin/src/lib/selfstarter-workspace.js +111 -0
  170. package/agent-spine-plugin/src/lib/selfstarter.js +11 -911
  171. package/agent-spine-plugin/src/lib/session-timeline-auth.js +316 -0
  172. package/agent-spine-plugin/src/lib/session-timeline-codex.js +58 -0
  173. package/agent-spine-plugin/src/lib/session-timeline-contract.js +48 -0
  174. package/agent-spine-plugin/src/lib/session-timeline-enrollment-source.js +41 -0
  175. package/agent-spine-plugin/src/lib/session-timeline-enrollment-storage.js +132 -0
  176. package/agent-spine-plugin/src/lib/session-timeline-enrollment-transport.js +17 -0
  177. package/agent-spine-plugin/src/lib/session-timeline-enrollment.js +500 -0
  178. package/agent-spine-plugin/src/lib/session-timeline-event-extract.js +157 -0
  179. package/agent-spine-plugin/src/lib/session-timeline-host-origin.js +74 -0
  180. package/agent-spine-plugin/src/lib/session-timeline-host-receipt.js +117 -0
  181. package/agent-spine-plugin/src/lib/session-timeline-invocation.js +201 -0
  182. package/agent-spine-plugin/src/lib/session-timeline-king.js +79 -0
  183. package/agent-spine-plugin/src/lib/session-timeline-prior.js +59 -0
  184. package/agent-spine-plugin/src/lib/session-timeline-provider.js +34 -0
  185. package/agent-spine-plugin/src/lib/session-timeline-query.js +55 -0
  186. package/agent-spine-plugin/src/lib/session-timeline-results.js +31 -0
  187. package/agent-spine-plugin/src/lib/session-timeline-root.js +11 -0
  188. package/agent-spine-plugin/src/lib/session-timeline-search.js +82 -0
  189. package/agent-spine-plugin/src/lib/session-timeline-sid-acl.js +217 -0
  190. package/agent-spine-plugin/src/lib/session-timeline-source.js +83 -0
  191. package/agent-spine-plugin/src/lib/session-timeline-state.js +45 -0
  192. package/agent-spine-plugin/src/lib/session-timeline-transport.js +50 -0
  193. package/agent-spine-plugin/src/lib/session-timeline-windows-acl.js +148 -0
  194. package/agent-spine-plugin/src/lib/session-timeline.js +453 -0
  195. package/agent-spine-plugin/src/lib/source-roots.js +69 -136
  196. package/agent-spine-plugin/src/lib/source-tree-scan.js +178 -0
  197. package/agent-spine-plugin/src/lib/task-knowledge-context.js +78 -0
  198. package/agent-spine-plugin/src/lib/timeline-tool-guard.js +202 -0
  199. package/agent-spine-plugin/src/lib/world-knowledge.js +249 -0
  200. package/agent-spine-plugin/src/lib/world-model.js +278 -0
  201. package/agent-spine-plugin/src/mcp.js +20 -161
  202. package/agent-spine-plugin/src/version.js +1 -1
  203. package/agent-spine-plugin/src/worker.js +22 -5
  204. package/bin/agent-resume-snapshot.cjs +2 -2
  205. package/bin/agentspine-king-goal-inbox.mjs +111 -0
  206. package/bin/agentspine-king-goal-intake.mjs +106 -0
  207. package/bin/baseline-skill-performance-policy.cjs +1 -16
  208. package/bin/core-bootstrap.js +2 -0
  209. package/bin/curiosity-scout-policy.cjs +5 -1
  210. package/bin/input-draft-persistence.cjs +2 -2
  211. package/bin/king-tui-function-contract.json +33 -0
  212. package/bin/launcher-restart-policy.cjs +150 -0
  213. package/bin/launcher-runtime.js +56 -44
  214. package/bin/managed-context-startup-policy.cjs +27 -0
  215. package/bin/managed-plugin-selection.cjs +116 -0
  216. package/bin/mistake-relevance-policy.cjs +1 -1
  217. package/bin/observer-hooks.cjs +14 -0
  218. package/bin/oversized-context-offload-policy.cjs +86 -0
  219. package/bin/plugin-bootstrap.js +7 -40
  220. package/bin/proactive-compaction-policy.cjs +1 -1
  221. package/bin/provider-model-refresh-deadline.cjs +53 -0
  222. package/bin/provider-model-refresh-policy.cjs +107 -0
  223. package/bin/release-artifact-freeze-policy.cjs +30 -0
  224. package/bin/repeated-user-message-projection.cjs +3 -126
  225. package/bin/research-page-result.cjs +74 -0
  226. package/bin/runtime-exit-ledger.cjs +1 -0
  227. package/bin/session-compaction-policy.cjs +84 -0
  228. package/bin/skill-listing-performance-policy.cjs +2 -2
  229. package/bin/standard-tools-bootstrap.js +0 -37
  230. package/bin/subagent-skill-policy.cjs +3 -1
  231. package/bin/telegram-approval-relay.cjs +12 -7
  232. package/bin/telegram-private-conversation-policy.cjs +3 -2
  233. package/bin/telegram-queue-handoff-policy.cjs +24 -0
  234. package/bin/thinking-activity-status-policy.cjs +1 -1
  235. package/bin/thinking-only-guard.cjs +16 -12
  236. package/bin/tool-call-loop-policy.cjs +0 -2
  237. package/bin/tool-result-offload-policy.cjs +11 -2
  238. package/bin/tui-functional-contract.cjs +55 -0
  239. package/bin/update-notice.js +18 -14
  240. package/bin/user-message-offload-policy.cjs +1 -1
  241. package/bin/user-prompt-hook-origin-policy.cjs +34 -0
  242. package/bin/windows-node-crash-dump.cjs +110 -0
  243. package/blun.mjs +2517 -1048
  244. package/codebase-index/codebase_index.py +4 -3
  245. package/package.json +3 -17
  246. package/standard-skills/research-evidence/SKILL.md +39 -0
  247. package/standard-skills/research-evidence/references/evidence-format.md +82 -0
  248. package/standard-skills/research-evidence/scripts/evidence-collection.cjs +254 -0
  249. package/standard-skills/research-evidence/scripts/score-report.cjs +112 -0
  250. package/standard-skills/web-lesen/SKILL.md +37 -22
  251. package/standard-skills/web-lesen/scripts/crawl_public.py +376 -0
  252. package/telegram-plugin/DELIVERY.md +36 -0
  253. package/telegram-plugin/bin/telegram-approval-relay.cjs +13 -7
  254. package/telegram-plugin/bin/telegram-launcher-status-queue.cjs +122 -0
  255. package/telegram-plugin/bin/telegram-private-conversation-policy.cjs +3 -2
  256. package/telegram-plugin/bin/telegram-reply-parts.cjs +149 -0
  257. package/telegram-plugin/dist/bridge.mjs +7 -56
  258. package/telegram-plugin/dist/mcp-server.mjs +33 -4
  259. package/agent-spine-plugin/skill/SKILL.md +0 -76
  260. package/bin/mnemo-connect-heartbeat.cjs +0 -204
  261. package/bin/mnemo-tool-agent-policy.cjs +0 -22
  262. package/telegram-plugin/bin/telegram-mnemo-capture.cjs +0 -297
@@ -0,0 +1,85 @@
1
+ # Release process
2
+
3
+ AgentSpine releases are intentionally tag-authorized while the package is pre-1.0. A maintainer decides when to tag; the repository then builds, verifies, attests, and publishes one traceable release bundle from that exact commit. Pull requests and ordinary branch pushes can never enter the release workflow.
4
+
5
+ ## Local release gate
6
+
7
+ Update every release version surface: `package.json`, both version fields in `package-lock.json`, the BLUN, Claude and Codex host manifests, the Claude marketplace entry, `hooks/version.json`, and `src/version.js`. Move the relevant changelog entries from **Unreleased** into a dated SemVer section, then run:
8
+
9
+ ```bash
10
+ npm ci
11
+ npm run check
12
+ npm run release:check -- --tag vX.Y.Z
13
+ python3 /path/to/plugin-creator/scripts/validate_plugin.py .
14
+ python3 /path/to/skill-creator/scripts/quick_validate.py skills/agent-spine
15
+ npm pack --dry-run
16
+ ```
17
+
18
+ The plugin validator must implement the current [Codex plugin-bundled hooks contract](https://developers.openai.com/codex/hooks#plugin-bundled-hooks), including the documented `hooks` override. A validator snapshot that rejects this field is stale and cannot certify this release; do not remove the override, because Codex would otherwise load the Claude-specific default hook bundle.
19
+
20
+ `release:check` fails unless:
21
+
22
+ - all release version surfaces agree and the tag is exactly `v{package.version}`;
23
+ - the changelog has a dated section for that version;
24
+ - the Git worktree is clean;
25
+ - npm reports SHA-512 integrity and a correctly versioned tarball;
26
+ - every required Claude Code, Codex, MCP, CLI, source, skill, documentation, license, and changelog file is packaged;
27
+ - no `.env`, key material, Git metadata, tests, workflow files, generated AgentSpine state, or user-owned `AGENTS.md`, `CLAUDE.md`, `SOUL.md`, or `MEMORY.md` enters the tarball;
28
+ - the package remains within explicit file-count and unpacked-size ceilings.
29
+
30
+ ## Tag and automated release
31
+
32
+ Only after the release commit is on a fully green `main`, create a signed or annotated tag and push it:
33
+
34
+ ```bash
35
+ git tag -s vX.Y.Z -m "AgentSpine vX.Y.Z"
36
+ git push origin vX.Y.Z
37
+ ```
38
+
39
+ The tag workflow then:
40
+
41
+ 1. checks out the immutable tag with full history;
42
+ 2. proves the tagged commit is contained in `main`;
43
+ 3. installs only the lockfile dependency graph;
44
+ 4. repeats the complete test, audit, host, metadata, changelog, and package-boundary gates;
45
+ 5. creates the `.tgz`, a CycloneDX SBOM, and SHA-256 checksums;
46
+ 6. creates GitHub build-provenance and SBOM attestations through short-lived OIDC credentials;
47
+ 7. transfers the bundle through a named workflow artifact;
48
+ 8. gives only the final isolated job `contents: write` and creates the GitHub Release from the existing tag.
49
+
50
+ Every external action is pinned to a full commit SHA. Dependabot watches those pins. The normal CI workflow has only `contents: read`; the build/attestation release job has `contents: read`, `id-token: write`, and `attestations: write`; only the asset-publication job has `contents: write`. No release job receives AgentSpine memory, signing keys, bearer values, npm tokens, or user source files.
51
+
52
+ Protect the GitHub `release` environment with required reviewers if the repository plan supports it. Enable immutable releases and tag protection in repository settings where available. Workflow checks are defense in depth and do not replace repository rulesets.
53
+
54
+ ## Verify a downloaded release
55
+
56
+ After downloading the tarball, SBOM, and `SHA256SUMS` from GitHub Releases:
57
+
58
+ ```bash
59
+ sha256sum --check SHA256SUMS
60
+ gh attestation verify agent-spine-X.Y.Z.tgz \
61
+ --repo Maykbiletti/AgentSpine
62
+ ```
63
+
64
+ Inspect the package without installation:
65
+
66
+ ```bash
67
+ npm pack --dry-run ./agent-spine-X.Y.Z.tgz
68
+ ```
69
+
70
+ Then install the exact tarball in fresh Claude Code and Codex environments and repeat `agentspine doctor`, the MCP handshake, source scan, verification, and audit.
71
+
72
+ ## Optional npm publication
73
+
74
+ The GitHub workflow deliberately does not publish to npm until ownership of the package name and the registry-side trust relationship are configured. When enabled, use npm Trusted Publishing bound to this repository, the exact release workflow filename, a GitHub-hosted runner, and a protected release environment. Keep OIDC provenance enabled and do not introduce a long-lived `NPM_TOKEN`.
75
+
76
+ Authoritative references:
77
+
78
+ - [GitHub artifact attestations](https://docs.github.com/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds)
79
+ - [GitHub secure use reference](https://docs.github.com/actions/reference/security/secure-use)
80
+ - [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/)
81
+ - [npm provenance statements](https://docs.npmjs.com/generating-provenance-statements/)
82
+
83
+ ## Rollback
84
+
85
+ Never move, reuse, or delete an existing public version tag to hide a bad release. Publish a patch release that reverts the faulty behavior, retain the original checksums and attestations, and explain the affected versions. Uninstalling AgentSpine or deleting its external state must still leave every scanned project file untouched.
@@ -0,0 +1,251 @@
1
+ # Bounded session timeline and evidence recall
2
+
3
+ Long-lived hosts already persist a session transcript. AgentSpine leaves that
4
+ host-owned file in place: it never copies, archives, rewrites, places it in
5
+ `MEMORY.md`, or injects it into a briefing. The timeline sidecar stores only a
6
+ small, restart-safe index of redacted objective evidence, not a second
7
+ transcript.
8
+
9
+ ## Enrollment contract
10
+
11
+ The Claude, Codex, and King adapters are deny-by-default. A regular `UserPromptSubmit` hook first
12
+ creates a short-lived opaque receipt only after its exact host preflight has
13
+ been verified. The receipt binds one regular, non-symlinked transcript below a
14
+ verified host `projects` (Claude) or `sessions` (Codex and King) root to the exact host, session, entity, user, tenant,
15
+ project, task, and optional goal step. It is not exposed in hook context or to
16
+ the model.
17
+
18
+ The local owner may then activate that one snapshot explicitly:
19
+
20
+ ```text
21
+ agentspine timeline-receipt --root /path/to/project
22
+ agentspine timeline-enroll --root /path/to/project --receipt asthr_… --confirm-local-timeline
23
+ ```
24
+
25
+ The receipt is one-use, expires quickly, and needs the same protected local
26
+ host transport that created it. Normal CLI flags cannot substitute a path,
27
+ host, session, or scope. Enrollment initializes only sidecar metadata from the
28
+ signed record and may revalidate fixed source metadata plus a ≤4 KiB prefix; it
29
+ never scans or indexes historic transcript content. It is context-only and
30
+ creates no identity, permission, delegation, tool access, approval, or policy
31
+ exception.
32
+
33
+ Every capture and retrieval checks the exact binding again. The profile and
34
+ provider-specific transcript root must be real non-symlinked directories; the source must be a
35
+ single-link regular non-symlinked file below that root. `groupId` must be
36
+ exactly `null`; groups and unknown visibility are excluded from enrollment,
37
+ capture, and recall. Another provider needs its own equivalent verified host
38
+ evidence and does not inherit Claude enrollment by name, transcript text, or
39
+ path convention.
40
+
41
+ If the enrolled transcript changes or grows, the old snapshot is unavailable.
42
+ There is deliberately no append or full-history fallback. A fresh host receipt
43
+ and a new local confirmation renew the immutable snapshot. If a torn local
44
+ enrollment state cannot be repaired, a local owner can discard only that
45
+ sidecar state:
46
+
47
+ ```text
48
+ agentspine timeline-enrollment-recover --root /path/to/project --confirm-local-timeline-recovery
49
+ ```
50
+
51
+ Recovery retains no old source, receipt, or evidence and requires a fresh host
52
+ receipt before another enrollment.
53
+
54
+ ## Bounded retrieval
55
+
56
+ Hooks do not scan, backfill, or search historic transcripts. They can expose a
57
+ small freshness/status hint and a continuation capsule only. A matching
58
+ `PreToolUse` guard may revalidate source metadata and a fixed ≤4 KiB prefix to
59
+ reject a changed snapshot; it never extracts history. The only historic reader
60
+ is a bound, on-demand MCP call:
61
+
62
+ ```text
63
+ session_timeline_index(maxBytes)
64
+ session_timeline_search(at | terms)
65
+ session_timeline_search(at | terms, includePriorSessions: true)
66
+ ```
67
+
68
+ Indexing is serialized and bounded to 64 KiB–16 MiB per call. A search needs
69
+ either one exact UTC instant such as `2026-09-04T12:40:00.000Z`, or at least two
70
+ concrete terms such as `Suite PASS`. An instant is exact unless the caller
71
+ explicitly requests a valid window. There is no broad-text fallback and no
72
+ whole-transcript MCP tool. Timestamp seeking reads only bounded byte probes and
73
+ a selected bounded range; term search uses only already indexed cards.
74
+
75
+ After a restart, the lifecycle hint may report only the number of already
76
+ indexed prior sessions and objective events for the exact same private task.
77
+ It does not contain transcript text. When a concrete question is relevant,
78
+ `includePriorSessions: true` restricts candidate sources to the same host,
79
+ entity, user, tenant, project, task and compatible goal. It ranks their signed
80
+ sidecar cards before opening a source, selects at most one prior immutable
81
+ snapshot, and verifies only matching original lines. A missing match does not
82
+ fall back to scanning old transcripts.
83
+
84
+ A matching host guard replaces all MCP-provided binding fields with its exact
85
+ one-use invocation. Raw stdio, a reused invocation, a changed argument,
86
+ foreign host/session/scope, a group claim, an expired receipt, a changed source,
87
+ or an unsafe sidecar returns no cards. Plain stdio is not a cross-process
88
+ identity channel: the feature remains unavailable without the protected local
89
+ host transport capability. None of these records is a permission or approval.
90
+
91
+ At most eight cards return. Each carries a timestamp, bounded redacted excerpt,
92
+ stable opaque session and message references, source digest, deterministic room ID, and the
93
+ `untrusted-session-history` trust marker. No public event digest or raw
94
+ transcript byte is returned. Secret-shaped values and instruction-like archive
95
+ text are redacted or discarded before state is written or a card is returned.
96
+ Historic text remains untrusted context: it can support a check or a question,
97
+ never an identity, permission, tool, delegation, access, payment, credential,
98
+ policy exception, or external effect.
99
+
100
+ ## Memory-palace structure
101
+
102
+ A room ID is deterministic for the enrolled source digest and a fixed one MiB
103
+ byte-offset segment. A
104
+ `agentspine.session-continuation-capsule/v1` contains only current task, goal,
105
+ step, selected-lesson digest, outcome status, and room IDs. It contains no
106
+ transcript text and does not make a room visible by itself.
107
+
108
+ The authenticated sidecar holds source metadata, bounded redacted cards, and a
109
+ state signature. A separate signed head detects state-only and mixed sidecar
110
+ rollback while the protected integrity anchor remains intact. An exact
111
+ one-generation torn write can be repaired under the owned lock; malformed,
112
+ gapped, missing, altered, symlinked, hard-linked, re-rooted, racing, or
113
+ signature-invalid state yields no cards. Restoring a complete matching local
114
+ integrity directory is not distinguishable without an independent monotonic
115
+ anchor, so AgentSpine makes no stronger rollback claim. It never preserves
116
+ transcript bytes.
117
+
118
+ ## Measured boundary
119
+
120
+ The synthetic acceptance sources contain 2,500 memory links, four old
121
+ CSS-archive error lessons, and a multi-megabyte prior-session JSONL transcript.
122
+ Before explicit prior-session selection, the restarted session finds no matching
123
+ current result. After selection, the concrete `12:40` query retrieves only the
124
+ matching verified objective result and stable source references; it does not
125
+ load unrelated links or full history. The probes cover source-byte preservation, exact scope
126
+ and group denial, expired and reused records, source/state tampering, profile
127
+ changes, crashes, concurrency, final JSONL records, redaction, and bounded
128
+ results.
129
+
130
+ ## Research inputs
131
+
132
+ On 2026-09-04, AgentSpine reviewed two public repositories as untrusted
133
+ architectural context only:
134
+
135
+ - [Claude-Mem](https://github.com/thedotmack/claude-mem), `v13.24.0` at
136
+ `1df66c2`, Apache-2.0: the search → timeline → observation split informed
137
+ bounded retrieval.
138
+ - [MemPalace](https://github.com/MemPalace/mempalace), `v3.9.0` at `d5250c7`,
139
+ MIT: raw-source ownership plus indexed time anchors informed the sidecar
140
+ boundary.
141
+
142
+ No external code or script was copied or executed. License, architecture, and
143
+ the current AgentSpine contracts were reviewed before independently implemented
144
+ synthetic tests.
145
+
146
+
147
+ ## Codex native rollout contract
148
+
149
+ The `codex-rollout-jsonl/v1` adapter accepts only an explicitly enrolled,
150
+ uncompressed native rollout below the verified Codex profile's `sessions`
151
+ directory. It never lists that directory or discovers neighboring sessions.
152
+ Before enrollment, a bounded first-line read (at most 64 KiB) validates the
153
+ `session_meta` record: native session identity, canonical project `cwd`, CLI
154
+ version syntax, and absent/legacy history mode. The per-session transport,
155
+ owner-confirmed enrollment and one-use PreToolUse invocation remain required.
156
+ A Codex lookup leaves native permission decisions to Codex; the lookup adds no
157
+ prompt or permission grant. King/BLUN cannot reuse this adapter through its
158
+ Codex-compatible instruction hierarchy.
159
+
160
+ Only native `response_item` tool outputs (`function_call_output`,
161
+ `custom_tool_call_output`, `mcp_tool_call_output`) become historical result
162
+ candidates. User and assistant messages do not. Results include timestamp,
163
+ content digest, stable session/message references, native `call_id`, and a
164
+ bounded original excerpt. They remain **untrusted historical context**, never
165
+ current test verification, completion evidence or a learning authorization.
166
+ Structured facts and corrections remain in the separate structured knowledge
167
+ view; raw transcripts are not copied there. Conflicting historical outcomes
168
+ are retained rather than combined into a new claim.
169
+
170
+ The search ranks the existing bounded index before opening one selected source.
171
+ Sources must match the same host, project, tenant, user and task; groups,
172
+ unregistered private files, symlink escapes and modified snapshots are excluded.
173
+ A source change makes the snapshot unavailable, including after restart. No
174
+ automatic enrollment refresh, receipt reset or retry follows. Missing history
175
+ must be stated honestly while ordinary authorized work remains possible.
176
+
177
+ Unsupported: compressed, paginated or inherited/forked history; unknown record
178
+ or explicit schema versions; automatic import of a real user's sessions.
179
+ `cli_version` is header provenance, not proof that every version of a
180
+ Codex installation is compatible. The supported structural contract is pinned
181
+ below. A changed host format requires a reviewed adapter and fresh synthetic
182
+ acceptance, not unchecked migration. No Otto/Fredrik live acceptance is implied.
183
+
184
+ ### Primary source provenance
185
+
186
+ Inspected 2026-09-06: official [Codex hooks documentation](https://learn.chatgpt.com/docs/hooks)
187
+ provides `session_id` and optional `transcript_path`, and explicitly states that
188
+ the transcript format is not a stable interface. The adapter was independently
189
+ implemented against [openai/codex commit 6af345407d9c2a568da9d01b6c4b81a9e61495c0](https://github.com/openai/codex/tree/6af345407d9c2a568da9d01b6c4b81a9e61495c0),
190
+ Apache-2.0: `codex-rs/rollout/src/lib.rs`,
191
+ `codex-rs/history/src/rollout_payload.rs`, and the protocol definitions
192
+ `protocol.rs` / `models.rs`. That source workspace reports `0.0.0`; it is not an
193
+ installed release-version claim. External sources supplied format evidence
194
+ only; no implementation was copied or executed.
195
+
196
+ Synthetic acceptance exercises native hooks and restarted MCP processes:
197
+ session A stores a measured failure, session B retrieves its exact source after
198
+ compaction, replay/races admit only one invocation, and foreign scope, changed
199
+ sources, model claims, secret-bearing outputs and unknown formats yield no
200
+ verified historical result. Fixtures create their own profiles and sessions.
201
+
202
+ ## King native agent-wire contract
203
+
204
+ The `king-agent-wire-jsonl/v1` adapter is separate from both Claude and Codex.
205
+ King may use the Codex-compatible `AGENTS.md` hierarchy for project rules, but
206
+ that does not turn its history into a Codex rollout. The verified King lifecycle
207
+ keeps the runtime host identity as `codex` while binding timeline records to the
208
+ distinct `king` provider.
209
+
210
+ King history is never discovered automatically. The trusted local launcher must
211
+ provide both `AGENTSPINE_KING_TIMELINE_SOURCE`, pointing to the current
212
+ `sessions/.../session_<id>/agents/main/wire.jsonl`, and
213
+ `AGENTSPINE_KING_WIRE_PROTOCOL_VERSION`, matching that file's metadata header.
214
+ The source must remain below the canonical non-symlinked `BLUN_HOME/sessions`
215
+ root. A prompt, model response, MCP argument, remembered fact, or filename alone
216
+ cannot create this mapping. Missing mappings leave history unavailable without
217
+ blocking ordinary host-authorized work.
218
+
219
+ Enrollment reads only the bounded first record. It requires the exact metadata
220
+ shape and configured `protocol_version`, a positive integer creation time, and
221
+ the current session directory. Indexing accepts only the reviewed King record
222
+ types and extracts objective evidence solely from
223
+ `context.append_loop_event` records whose event is `tool.result`. User and
224
+ assistant messages, model claims, unknown records, unknown schema versions, and
225
+ non-text tool outputs create no evidence card. The native `toolCallId` becomes
226
+ the stable message reference; the record time remains the source timestamp.
227
+
228
+ King keeps its own permission decisions. AgentSpine only binds a one-use,
229
+ context-only lookup to the current verified gateway, transport, source, and
230
+ scope. Restart and compaction reuse signed sidecar metadata, then revalidate the
231
+ unchanged original source before any selected line is opened. A protocol change,
232
+ source mutation, replay, foreign project or tenant, group context, or unknown
233
+ record makes recall unavailable and never triggers a retry or enrollment reset.
234
+
235
+ ### Primary source provenance
236
+
237
+ Inspected 2026-09-06: [BLUN Code commit fbb97459a3fa2157f8bfea3d24931be63288ab11](https://github.com/Maykbiletti/blun-code/tree/fbb97459a3fa2157f8bfea3d24931be63288ab11),
238
+ application version `1.0.109`, MIT. Its public verification fixture locates the
239
+ main agent wire at `sessions/.../session_<id>/agents/main/wire.jsonl` and reads
240
+ `context.append_loop_event` / `tool.result`; the vendored King runtime type
241
+ surface identifies the reviewed record union and metadata fields. The vendored
242
+ `@blun/king-sdk` contract is version `0.12.1`, MIT. External files were treated
243
+ as untrusted format evidence; no implementation was copied or executed.
244
+
245
+ Synthetic repository acceptance proves A-to-B recall of one measured `FAIL
246
+ 0/15` result after restart and compaction, with immutable source bytes and
247
+ stable session/message references. It also covers exact gateway binding,
248
+ wrong protocol, wrong path/scope/provider, replay/race, mutation, and unknown
249
+ records. This does not prove Fredrik's installed launcher supplies these two
250
+ protected mappings, that King enforces a returned block decision, or that a
251
+ live session passed. Those remain separate live-host checks.
@@ -0,0 +1,113 @@
1
+ # Host-native source roots
2
+
3
+ ## MCP preflight source parity (0.72.2)
4
+
5
+ `session_briefing`, `delivery_knowledge_query`, `resolve_context`, and
6
+ `read_document` resolve bounded sources internally. The knowledge query shares
7
+ one catalog across contract readers and its nested briefing; it never falls back
8
+ to a home-tree scan. Pass the exact resolved project root and choose the host
9
+ with `host` where supported. `read_document` accepts the same host selector and
10
+ host source IDs returned by the briefing. Generic mode loads project sources,
11
+ not another provider's profile or auto-memory.
12
+
13
+ Catalogs, source registries, environments and user-state locations are internal
14
+ inputs, not trusted MCP arguments. A required preflight with incomplete discovery
15
+ returns an error without a successful receipt. Retry after correcting the source
16
+ problem; no state reset is necessary. Read-only briefing may return bounded
17
+ available context with diagnostics, while hook scan errors retain their existing
18
+ fail-open lifecycle handling. Source metadata and receipts confer no authority.
19
+
20
+ Synthetic tests count directory accesses through actual MCP requests, exercise
21
+ permission-error retry, independent protocol instances, exact requirement scope,
22
+ source replacement and read races. They do not establish installed Codex, Claude
23
+ or Kimi tool availability; native discovery and live task outcomes need separate
24
+ measurements. No live configuration or user source is changed by this repair.
25
+
26
+ AgentSpine `0.8.0` resolves active user, project, and host-memory sources before every production lifecycle hook. Resolution does not depend on the directory from which the plugin was installed, and it never treats the entire home directory as one project.
27
+
28
+ ## Resolution contract
29
+
30
+ ```mermaid
31
+ flowchart LR
32
+ H["Native hook payload"] --> R["Provider-neutral source-root resolver"]
33
+ C["Claude profile"] --> R
34
+ X["Codex profile"] --> R
35
+ P["Active project chain"] --> R
36
+ B["Explicit local state binding"] --> R
37
+ R --> U["User-wide sources"]
38
+ R --> J["Exact project sources"]
39
+ R --> M["Exact Claude project memory"]
40
+ U --> S["Byte-budgeted session_briefing"]
41
+ J --> S
42
+ M --> S
43
+ ```
44
+
45
+ Claude resolution follows the documented user and project hierarchy: `CLAUDE_CONFIG_DIR` or `~/.claude`, user `CLAUDE.md` and rules, the active project chain, and the exact project-memory directory evidenced by `autoMemoryDirectory`, `CLAUDE_CODE_PROJECT_DIR_NAME`, or the native hook `transcript_path`. Inside that directory, `MEMORY.md` is the only index. The live path never enumerates that directory and never follows links found inside a fact file. AgentSpine does not guess Claude's private project-directory encoding. See Anthropic's [memory hierarchy and storage-location documentation](https://code.claude.com/docs/en/memory) and [Claude configuration directory documentation](https://code.claude.com/docs/en/claude-directory).
46
+
47
+ ## Indexed and lazy memory
48
+
49
+ Every direct index link is counted as indexed, but its target is opened only when a marker proves relevance:
50
+
51
+ ```markdown
52
+ - [Communication style](style.md) <!-- agentspine:always -->
53
+ - [BLUN project](projects/blun.md) <!-- agentspine:project=project:blun -->
54
+ - [Alpha team](groups/alpha.md) <!-- agentspine:group=group:alpha -->
55
+ - [Owner preference](people/owner.md) <!-- agentspine:entity=person:owner -->
56
+ - [Current handoff](tasks/handoff.md) <!-- agentspine:task=task:handoff -->
57
+ - [Carbonara preference](food/pasta.md) <!-- agentspine:keywords=carbonara,pasta -->
58
+ ```
59
+
60
+ An exact person, project, group, or task ID must match the current hook scope. Prompt relevance requires a normalized keyword match against the link label, filename, or explicit `keywords` marker. If relevance is uncertain, the target remains unopened. The index itself is always loaded so the host retains its native memory overview.
61
+
62
+ The persistent cache lives under AgentSpine's platform state directory, outside ordinary agent projects. If the active project root is exactly a recognized user home, the configured AgentSpine state subtree may be below that root but is explicitly pruned before source enumeration; it is never context. The exception does not apply to nested project roots. The cache stores integrity-checked snapshots keyed by an opaque root digest and relative path. A cache hit still opens and validates the original path and file identity, but does not reread or rehash unchanged source bytes. Corrections, deletion, link removal, source-binding rollback, purge, restart, and compaction invalidate or prune the affected cache record immediately. Cache contents and relevance markers are context-only.
63
+
64
+ Indexed targets use no-follow open semantics. Parent components, canonical scope, regular-file status, size, identity, modification metadata, and the pathname-to-handle identity are checked around the same read. A changing target is retried a bounded number of times and then rejected as a race; mixed snapshots are never injected.
65
+
66
+ The live resolver processes at most 4,096 direct index links, selects at most eight relevant targets, and opens them one at a time under the host resolver's two-second work budget. `MEMORY.md` and each target are limited to 4 MiB, while the complete external cache is capped at 16 MiB. Exceeding a bound fails closed instead of widening discovery.
67
+
68
+ Codex resolution uses `CODEX_HOME` or `~/.codex`, selects `AGENTS.override.md` before `AGENTS.md` at user scope, and walks from the configured project root to `cwd`. Per directory it selects override, regular, then the configured `project_doc_fallback_filenames`; `project_root_markers` and `project_doc_max_bytes` are read from the active profile's `config.toml`. Without a root marker, only `cwd` is the project root. See OpenAI's [AGENTS.md discovery order](https://developers.openai.com/codex/agent-configuration/agents-md) and [configuration reference](https://developers.openai.com/codex/config-reference).
69
+
70
+ Only regular files under these evidenced roots are read. Symlinks are skipped. The resolver caps source count, per-file bytes, aggregate bytes, and recursive host-rule files. Required native instructions are collected first. Optional project-wide Markdown then uses only the remaining aggregate budget, at most 240 files, 8,192 directory entries and the shared two-second resolution budget. Reaching one of those optional discovery bounds keeps the deterministic partial context, skips the remainder and emits an audited `bounded-truncated` warning instead of blocking tools. Mandatory-source, aggregate-byte and safety failures are unchanged.
71
+
72
+ A project-root scan is never run when the resolved root is the user's home directory or the exact configured Claude, Codex, or BLUN profile root. The self-starter applies the same exact-root exclusion before catalog construction or fingerprinting. A project nested inside a profile is not excluded and remains bounded and fully enforced. Foreign repositories and arbitrary hidden directories are not traversed.
73
+
74
+ An inaccessible or concurrently removed entry is omitted from a bounded scan and reported in its skipped-path diagnostics. If a deeper scanner still reports a raw `EPERM` or `EACCES` directory-enumeration error, or a scanner-tagged incomplete traversal, every native hook event returns successfully and appends the actual event, phase, code, and affected path to the local scan audit. This availability rule does not convert policy, identity, permission, protected-source, or execution-grant failures into allows.
75
+
76
+ ## Portable user continuity
77
+
78
+ Accepted preferences, no-gos, corrections, and references can be attached once to the local user through an explicit state binding. The binding references the existing external AgentSpine state; it does not copy records between project hashes.
79
+
80
+ ```bash
81
+ agentspine source-bind /path/where/continuity-was-configured \
82
+ --host all \
83
+ --scope state-user \
84
+ --project /current/project \
85
+ --host-home /current/profile \
86
+ --confirm-local-binding
87
+ ```
88
+
89
+ Only portable low-risk learning and the known person relationship context are read from this binding. Project facts, tasks, attention events, group/private project content, delegation policy, execution grants, jobs, secrets, and trust material remain in the exact project state. The registry is append-audited and supports explicit rollback and purge:
90
+
91
+ ```bash
92
+ agentspine source-status --host claude --cwd /current/project --json
93
+ agentspine source-rollback binding:ID --confirm-local-binding
94
+ agentspine source-purge binding:ID --confirm-local-binding
95
+ ```
96
+
97
+ Bindings and their provenance are context-only. They cannot create identity equivalence, roles, permissions, delegation, host trust, or self-starter rights.
98
+
99
+ ## Empty and damaged state
100
+
101
+ Hook context includes a bounded `sourceResolution` report with checked scopes, counts, profile digest, project root, and the concrete empty or fail-closed reason. Indexed-memory diagnostics add counts for indexed, relevant, loaded, cache hits, cache misses, missing targets, scope omissions, path escapes, symlinks, size rejection, races, and live directory enumeration. They never include fact contents or fact paths. `agentspine doctor --host claude|codex --cwd … --json`, `agentspine source-status`, and `agentspine audit … --host … --json` expose the same report.
102
+
103
+ Live hooks never enumerate orphaned files. An operator can request the separate bounded offline diagnostic explicitly:
104
+
105
+ ```bash
106
+ agentspine doctor --host claude --cwd /current/project --offline-memory-orphans --json
107
+ ```
108
+
109
+ It reports counts only, reads no orphan content, follows no symlinks, and grants no cleanup or deletion authority.
110
+
111
+ The installed-bundle check reproduces the original zero-source failure from an AgentSpine checkout and a foreign `cwd`, repeats restart and compaction, exercises custom Claude and Codex homes, Codex fallback and nested override precedence, and proves no broad home scan, no foreign-project visibility, zero model-side MCP calls, exactly one hook set, and unchanged source bytes.
112
+
113
+ The scale acceptance creates 50,000 real unindexed files beside six indexed entries. For the fully matching scope it records five loaded facts, seven safe opens (`MEMORY.md` twice plus five targets), zero directory enumerations, and no opens, reads, hashes, or counts for the 50,000 files. The same instrumentation result is independent of the unindexed file count; wall-clock thresholds are deliberately not used as a correctness oracle.
@@ -0,0 +1,67 @@
1
+ # Structured delivery completion
2
+
3
+ Process assistance is advisory. Missing, consumed, late or unverified delivery
4
+ receipts do not prevent authorized programming, analysis or ordinary replies.
5
+ Do not reset evidence or repeat tests solely to dismiss a warning. The hook
6
+ records mutation intent before allowing work and emits a bounded, deduplicated
7
+ warning. An unverified Stop does not close a job or record successful learning.
8
+ Access, protected-source, scope and effect-authorization checks remain enforced.
9
+ `complete_delivery` still rejects invalid evidence; permitting a reply does not
10
+ certify a successful delivery or grant publication authority.
11
+
12
+ AgentSpine 0.72.4 adds `complete_delivery` for ordinary assignment-bound writing deliveries. Version 0.72.5 requires the actual test process result: structured exit code zero or the existing command-bound final marker. Transport success, a still-running process and prose output are not test evidence. An agent can store its three completed premortem checks through MCP and then give the user a normal summary. The operation does not execute a test, create host identity, authorize a write, consume the assignment or bypass Stop.
13
+
14
+ ## Call sequence
15
+
16
+ 1. Obtain the hook-issued assignment and requirement. Call `session_briefing`, `delivery_knowledge_query` and `record_delivery_premortem` before the first write.
17
+ 2. Make the changes through the host. Run a recognized test after the latest write. AgentSpine must have observed successful execution through the tool hook; a model-provided success flag is not evidence.
18
+ 3. Call `complete_delivery` with the exact root, requirement ID, complete binding, registered artifact digest, latest write digest and three checks. Use the returned identifiers, never identifiers copied from another delivery.
19
+ 4. Report the result normally. Stop independently rechecks observed tests, pending writes, scope, mandatory calls, closure integrity and the existing safety gates.
20
+
21
+ The arguments have this shape; replace placeholders with actual bound values:
22
+
23
+ ```json
24
+ {
25
+ "root": "/synthetic/project",
26
+ "requirementId": "<hook-issued requirement ID>",
27
+ "binding": {
28
+ "host": "codex",
29
+ "sessionId": "session:synthetic",
30
+ "projectId": "project:synthetic",
31
+ "assignmentId": "<hook-issued assignment ID>"
32
+ },
33
+ "artifactDigest": "<registered SHA-256>",
34
+ "lastWriteDigest": "<latest write SHA-256>",
35
+ "checks": [
36
+ { "category": "baseline-environment", "checkId": "<registered check ID>", "status": "PASS", "result": "Source comparison passed." },
37
+ { "category": "contract-tests", "checkId": "<registered check ID>", "status": "PASS", "result": "Observed artifact test passed." },
38
+ { "category": "delivery-path", "checkId": "<registered check ID>", "status": "PASS", "result": "Delivered tree matches the tested tree." }
39
+ ]
40
+ }
41
+ ```
42
+
43
+ Include established entity, group and task fields exactly. Results must be nonempty single-line text, at most 1,024 characters, without secret-shaped content. There must be one check per registered category. These descriptions are the agent's auditable account, not an independent measurement; the server separately requires observed successful post-write tests. Extra arguments such as `success` or a caller-supplied `testStateDigest` are rejected.
44
+
45
+ ## Preservation and concurrency
46
+
47
+ The existing closure and event journal gain sealed `completionSource: "mcp"` and `testStateDigest` metadata capturing the observed verification state. Existing registrations, rejection receipts and previous-version records are not migrated or rewritten. Stop checks current evidence rather than trusting an old success forever.
48
+
49
+ Identical retries return the stored closure. Changes to test evidence during the call cannot return successful completion. A later write invalidates the closure and requires fresh tests and its new write digest. A later failed or unverified test invalidates earlier successful verification. Changed check results conflict with an existing closure instead of overwriting history. Foreign bindings and consumed receipts cannot complete another assignment.
50
+
51
+ The existing atomic replacement and owned lock protect storage. A regression terminates the real MCP process immediately before replacement, verifies unchanged state bytes, waits for the actual lock lease and retries through MCP. It never edits state or lock timestamps to recover.
52
+
53
+ ## Boundaries and measured evidence
54
+
55
+ Goal- or queue-bound deliveries must use their existing checkpoint and outcome route. `complete_delivery` explicitly rejects them; goal protections are unchanged. The legacy five-line closure remains supported. Skill text does not register tools, and an isolated server test does not establish native Codex, Claude or Kimi compatibility.
56
+
57
+ Run `node --test test/delivery-completion.test.js test/assignment-continuation.test.js test/delivery-verification.test.js test/mcp.test.js`.
58
+
59
+ Before the MCP call, a normal Stop summary is allowed with unverified completion and an advisory. Afterwards the same summary can carry verified completion, including after a separate MCP process restart. Negative probes cover absent tests, later failed tests, new writes, foreign bindings, replay, malformed checks, secret-shaped values, concurrent calls and manipulated closure metadata: these never become valid evidence merely because the host can reply. Synthetic source bytes remain unchanged.
60
+
61
+ Child tests clear inherited `NODE_TEST_CONTEXT` and require TAP evidence of one executed test and zero failures. An actual wrong artifact expectation must produce one failed test and exit 1. This corrects a 0.72.3 test-harness weakness: a recursive child test runner could skip its test while returning exit 0. Earlier positive exit status alone is not counted as proof that the artifact assertion ran.
62
+
63
+ Version 0.72.5 exercises the official Codex `PostToolUse` fields (`Bash`, `tool_input.command`, `tool_response`), the measured Work `exec_command` result and PowerShell `exitCode`. This establishes the parser contract but not a live Otto restart or installed-reader migration. Native installation/update registration, loaded-reader compatibility, external recovery-event semantics and the live F79 task remain unverified. CodexLink and live session configuration are outside this change.
64
+
65
+ CI 147's Windows aggregate audit failure was not reproduced by the diagnostic branch's ten passing matrix jobs. The assertion now reports failed gates without relaxing it or changing deadlines. Passing a later run does not establish that intermittent failure's cause.
66
+
67
+ The first completion candidate exceeded the unchanged mandatory hook-context budget on long macOS and Windows paths. CI 150's diagnostic traced the apparent style rejection to that earlier preflight block. A synthetic 138-byte temporary-root probe reproduces the failure locally. Compact guidance retains every mandatory call, binding, check and legacy closure field, while the long-path Acceptance probe now passes without raising the injection limit or shortening user sources.
@@ -0,0 +1,94 @@
1
+ # Provenance-bound world model
2
+
3
+ AgentSpine's world model keeps durable assertions about synthetic or real-world subjects outside user-owned source files. It is designed for continuity across turns, restarts, and compaction without turning remembered text or model output into truth or authority.
4
+
5
+ ## Evidence classes
6
+
7
+ Every assertion has one immutable `evidenceKind`:
8
+
9
+ - `objective-measurement` records an externally checkable observation;
10
+ - `explicit-user-feedback` records an explicit correction or confirmation;
11
+ - `model-suggestion` records a hypothesis that must remain a proposal.
12
+
13
+ All three require a stable evidence ID, an evidence SHA-256, an exact observation timestamp, a subject, a predicate, a privacy scope, and the stored value. A model suggestion can never supersede established context. It stays in `proposals` even when its value happens to match an established fact.
14
+
15
+ `record_world_assertion` is append-only. Repeating the same ID and material is idempotent; reusing an ID for different material fails closed. A newer measured or explicitly user-confirmed assertion can list older same-subject, same-predicate assertions in `supersedes`. Their history remains stored while the new assertion becomes the active view.
16
+
17
+ ## Truth and uncertainty rules
18
+
19
+ `world_context` returns four separate collections:
20
+
21
+ - `facts`: unexpired measured or explicitly user-confirmed assertions with one non-conflicting value;
22
+ - `conflicts`: active established values that disagree for the same subject and predicate;
23
+ - `proposals`: active model suggestions;
24
+ - `stale`: assertions whose explicit expiry has passed.
25
+
26
+ A conflict removes that subject/predicate from `facts` and sets `uncertainty.requiresResolution`. No confidence average can hide it. Expired evidence is never silently reused. Resolving a conflict requires a new established assertion that explicitly supersedes the conflicting assertion IDs.
27
+
28
+ Session briefing reads this same model. It can expose conflicts, proposals, and stale items as uncertainty, but only the `facts` collection is established world context.
29
+
30
+ ## Structured knowledge and correction history
31
+
32
+ An assertion may opt into one of five explicit knowledge kinds: `fact`, `user-preference`, `decision`, `task-state`, or `error-lesson`. This is a typed view over the same immutable evidence record, not a second memory store. Each typed item retains its evidence source and digest, observation and recording times, exact project/group/privacy scope, and optional stable session/message references. Decisions additionally require a bounded rationale.
33
+
34
+ `world_context` derives one of four evidence-based statuses:
35
+
36
+ - `confirmed` for current objective measurements or explicit user feedback;
37
+ - `assumption` for model suggestions, including repeated matching suggestions;
38
+ - `contradictory` for unresolved established values that disagree;
39
+ - `superseded` for explicitly replaced or expired entries.
40
+
41
+ Contradictory entries never enter `facts`. A newer explicit correction names every replaced assertion in `supersedes`; the current view then contains the correction while `includeKnowledgeHistory: true` exposes the traceable predecessors. Legacy assertions remain readable but are never retroactively assigned a knowledge kind.
42
+
43
+ The session briefing carries only the bounded current structured view. Detailed correction history remains opt-in through `world_context`, preventing restarts from loading an ever-growing record. Secret-shaped structured values or rationales are rejected both at ingestion and state validation. A source reference is provenance only: it cannot confirm a model suggestion or create authority.
44
+
45
+ ## Normal-task continuation capsule
46
+
47
+ A `task-state` assertion may use predicate `task.continuation` and value schema
48
+ `agentspine.task-continuation/v1`. Its task ID must equal the assertion subject.
49
+ The bounded value records the current objective, `active`, `blocked`, `paused`,
50
+ or `completed` state, the last verified step and measurement ID/digest, at most eight
51
+ open questions, and one next step. Both the checkpoint and its last verified
52
+ step carry stable session/message provenance. A completed checkpoint requires a
53
+ passed last step, objective-measurement evidence, and no open questions or next step.
54
+
55
+ `world_context` derives `knowledge.continuation` only from current, confirmed,
56
+ conflict-free checkpoints. Repeated model suggestions remain assumptions and
57
+ never appear as resumable work. Competing established checkpoints are withheld
58
+ until an explicit supersession resolves them. A newer correction preserves all
59
+ predecessors in opt-in history. The selected checkpoint survives process restart
60
+ and enters `SessionStart`/`PostCompact` briefing without rereading a transcript.
61
+ Terminal checkpoints remain visible separately so completed work is not started
62
+ again. At most eight capsules are returned, and `continuationTaskId` narrows the
63
+ view to one exact task.
64
+
65
+ This capsule is a working-memory aid, not a job lease or permission. It cannot
66
+ start a tool, authorize a file change, publish, delegate, or replace the existing
67
+ coordination, goal-plan, timeline, host, and safety contracts.
68
+
69
+ ## Task-relevant knowledge
70
+
71
+ When `continuationTaskId` selects one current resumable capsule, `world_context`
72
+ derives `knowledge.taskContext` from the loaded structured index. A deterministic
73
+ query over its objective, questions, and next step selects at most six confirmed
74
+ facts, preferences, decisions, or error lessons and keeps their source references.
75
+ Uncertain, stale, superseded, private, foreign, and terminal state is excluded.
76
+ No transcript or source is opened, and the view grants no authority.
77
+
78
+ ## Privacy and authority
79
+
80
+ Assertions use `private`, `shared`, or exact `group` privacy. A group read rejects private inclusion, sees only its exact group records plus shared records, and cannot observe another group's values. Project-scoped records are visible only in that exact project; unscoped records may follow the same installation across project turns when intentionally read from that root.
81
+
82
+ Every record and result is `context-only`. Predicate and nested-value keys that resemble permissions, authorization, credentials, secrets, tokens, tool access, delegation, production access, payment, or spending are rejected. World context is never consulted by host authorization, delegation, execution, signing, or trust code.
83
+
84
+ State is written atomically under an owned, heartbeat-protected lock with a 5 MiB bound and mode `0600`. Corrupt JSON, altered value digests, invalid schemas, or authority-shaped persisted data fail closed. The state lives at `world-model.json` under the external per-project AgentSpine state directory; Markdown and other user sources are never changed.
85
+
86
+ ## Research provenance
87
+
88
+ The design review on 2026-09-04 inspected repository `main` at commit `26b181e95dde34d2fea62cdb8f37258e2bb3f082`, current tests, project instructions, history, open pull requests, and the following public primary sources as untrusted context:
89
+
90
+ - [W3C PROV-DM](https://www.w3.org/TR/prov-dm/), W3C Recommendation dated 2013-04-30, W3C Document License. Relevant principle: represent provenance through distinct entities, activities, agents, and relations rather than an ungrounded truth label.
91
+ - [NIST AI Risk Management Framework 1.0](https://www.nist.gov/itl/ai-risk-management-framework), released 2023-01-26, official NIST publication. Relevant principle: trustworthy behavior needs explicit measurement, evaluation, and risk handling; the NIST page reported an AI RMF revision in progress when checked.
92
+ - [NIST AI RMF Playbook — Measure](https://airc.nist.gov/airmf-resources/playbook/measure/), checked 2026-09-04, official NIST guidance. Relevant principles: record provenance, repeat measurements, expose measurable and unmeasurable risks, and compare user/community feedback separately from internal measurements.
93
+
94
+ No external code, data, executable, credential, policy, or permission was imported. The standards influenced only AgentSpine's local schema boundaries and synthetic evaluation cases; AgentSpine remains Apache-2.0.
@@ -4,7 +4,7 @@
4
4
  "SessionStart": [
5
5
  {
6
6
  "matcher": "startup|resume|clear|compact",
7
- "hooks": [{ "type": "command", "command": "node \"${PLUGIN_ROOT}/src/hook.js\"", "timeout": 180 }]
7
+ "hooks": [{ "type": "command", "command": "node \"${PLUGIN_ROOT}/src/hook.js\"", "timeout": 15 }]
8
8
  }
9
9
  ],
10
10
  "UserPromptSubmit": [
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "PreToolUse": [
16
16
  {
17
- "matcher": "Edit|Write|apply_patch|Bash",
17
+ "matcher": "^(?:Edit|Write|apply_patch|Bash|PowerShell|mcp__(?:plugin_agent-spine_agent-spine|agent-spine)__session_timeline_(?:index|search))$",
18
18
  "hooks": [{ "type": "command", "command": "node \"${PLUGIN_ROOT}/src/hook.js\"", "timeout": 15 }]
19
19
  }
20
20
  ],