@markus-global/cli 0.12.3 → 0.12.5-rc.1

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 (159) hide show
  1. package/dist/background-maintenance.d.ts +25 -0
  2. package/dist/background-maintenance.d.ts.map +1 -1
  3. package/dist/background-maintenance.js +61 -0
  4. package/dist/background-maintenance.js.map +1 -1
  5. package/dist/commands/im-inbound-origin.d.ts +38 -0
  6. package/dist/commands/im-inbound-origin.d.ts.map +1 -0
  7. package/dist/commands/im-inbound-origin.js +48 -0
  8. package/dist/commands/im-inbound-origin.js.map +1 -0
  9. package/dist/commands/start.d.ts.map +1 -1
  10. package/dist/commands/start.js +211 -46
  11. package/dist/commands/start.js.map +1 -1
  12. package/dist/markus.mjs +18523 -9866
  13. package/dist/web-ui/assets/{AsyncState-_UC7xcxJ.js → AsyncState-fJJNUOXK.js} +1 -1
  14. package/dist/web-ui/assets/ChatComponents-S7d2CAAU.js +14 -0
  15. package/dist/web-ui/assets/{ContentRenderer-C-V5k_3K.js → ContentRenderer-DWqhC0uq.js} +6 -6
  16. package/dist/web-ui/assets/DeliverableShareModal-B7DwzEnt.js +1 -0
  17. package/dist/web-ui/assets/{Deliverables-CQnWqbTb.js → Deliverables-CueBYYpx.js} +2 -2
  18. package/dist/web-ui/assets/MarkdownMessage-D8BsJzvD.js +4 -0
  19. package/dist/web-ui/assets/{Search-CVYQIy_D.js → Search-CaYXz3u-.js} +1 -1
  20. package/dist/web-ui/assets/{SendToChat-IOAvuta-.js → SendToChat-_9sm7UBY.js} +1 -1
  21. package/dist/web-ui/assets/Settings-DTL14pY8.js +8 -0
  22. package/dist/web-ui/assets/{Store-BEsLd_RN.js → Store-DpGqUMS2.js} +1 -1
  23. package/dist/web-ui/assets/Switch-NYQTn8wl.js +1 -0
  24. package/dist/web-ui/assets/Team-DB-JytPl.js +93 -0
  25. package/dist/web-ui/assets/Work-sQq-gy3S.js +142 -0
  26. package/dist/web-ui/assets/{arc-DP1Vf7Sx.js → arc-JtkmqkSR.js} +1 -1
  27. package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-Buq8JYN8.js → architectureDiagram-3BPJPVTR-B8zM5fky.js} +1 -1
  28. package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-BCa2p2_X.js → blockDiagram-GPEHLZMM-BQgjaOcE.js} +1 -1
  29. package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-BxsgggQY.js → c4Diagram-AAUBKEIU-BnZvYRwj.js} +1 -1
  30. package/dist/web-ui/assets/channel-Zno2q8Ba.js +1 -0
  31. package/dist/web-ui/assets/{chunk-2J33WTMH-BJZZ60c9.js → chunk-2J33WTMH-KONx1qvt.js} +1 -1
  32. package/dist/web-ui/assets/{chunk-4BX2VUAB-C5hc4E6J.js → chunk-4BX2VUAB-BqkxAkWs.js} +1 -1
  33. package/dist/web-ui/assets/{chunk-55IACEB6-CbyvZ6Mk.js → chunk-55IACEB6-DxLiTj85.js} +1 -1
  34. package/dist/web-ui/assets/{chunk-727SXJPM-JmNt9TVA.js → chunk-727SXJPM-Dhj-9NIs.js} +1 -1
  35. package/dist/web-ui/assets/{chunk-AQP2D5EJ-BTk0v5ba.js → chunk-AQP2D5EJ-M1vQ4YYc.js} +1 -1
  36. package/dist/web-ui/assets/{chunk-FMBD7UC4-BO-dhB1U.js → chunk-FMBD7UC4-DaXv58SH.js} +1 -1
  37. package/dist/web-ui/assets/{chunk-ND2GUHAM-BdjCcLdb.js → chunk-ND2GUHAM-Brkz9FCu.js} +1 -1
  38. package/dist/web-ui/assets/{chunk-QZHKN3VN-BAzRC82n.js → chunk-QZHKN3VN-DIsEGiBf.js} +1 -1
  39. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-hI59DDUw.js +1 -0
  40. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-hI59DDUw.js +1 -0
  41. package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-CVffmErT.js → cose-bilkent-S5V4N54A-CSjC_YL5.js} +1 -1
  42. package/dist/web-ui/assets/{dagre-BM42HDAG-Dd9pB2fX.js → dagre-BM42HDAG-BevSxaQN.js} +1 -1
  43. package/dist/web-ui/assets/{diagram-2AECGRRQ-BG_AUqzM.js → diagram-2AECGRRQ-CT3Hj8jy.js} +1 -1
  44. package/dist/web-ui/assets/{diagram-5GNKFQAL-D5qFMRFf.js → diagram-5GNKFQAL-CAebHy6q.js} +1 -1
  45. package/dist/web-ui/assets/{diagram-KO2AKTUF-B3qTxSWl.js → diagram-KO2AKTUF-BvRWS7BX.js} +1 -1
  46. package/dist/web-ui/assets/{diagram-LMA3HP47-BrxC1636.js → diagram-LMA3HP47-gR9HBKc4.js} +1 -1
  47. package/dist/web-ui/assets/{diagram-OG6HWLK6-BvXyEQ9-.js → diagram-OG6HWLK6-B5HGsfNo.js} +1 -1
  48. package/dist/web-ui/assets/{docx-preview-DBAZFeEb.js → docx-preview-pRjmDg6F.js} +1 -1
  49. package/dist/web-ui/assets/{erDiagram-TEJ5UH35-CMap9oy_.js → erDiagram-TEJ5UH35-mrPW01aQ.js} +1 -1
  50. package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-BZerJtvk.js → flowDiagram-I6XJVG4X-BrZ1G-Tt.js} +1 -1
  51. package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-CagPMHMO.js → ganttDiagram-6RSMTGT7-Dq_5mate.js} +1 -1
  52. package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-DZ5dDKRu.js → gitGraphDiagram-PVQCEYII-Cb3yTWUy.js} +1 -1
  53. package/dist/web-ui/assets/index-9SXWNIl0.css +1 -0
  54. package/dist/web-ui/assets/index-Bco6UnT7.js +867 -0
  55. package/dist/web-ui/assets/{infoDiagram-5YYISTIA-CHLdsDUZ.js → infoDiagram-5YYISTIA-CcnNlnvs.js} +1 -1
  56. package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-SdeinQaS.js → ishikawaDiagram-YF4QCWOH-BqHTPtO1.js} +1 -1
  57. package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-BtlL2fi0.js → journeyDiagram-JHISSGLW-DKBB9B-C.js} +1 -1
  58. package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-BKPQYXkB.js → kanban-definition-UN3LZRKU-BVO5tbNl.js} +1 -1
  59. package/dist/web-ui/assets/{mermaid.core-MkJR6w4B.js → mermaid.core-bMoKRCj4.js} +5 -5
  60. package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-CbOmHX_u.js → mindmap-definition-RKZ34NQL-Bk0lFKmi.js} +1 -1
  61. package/dist/web-ui/assets/{pieDiagram-4H26LBE5-CypGjJP1.js → pieDiagram-4H26LBE5-BRPnBLeL.js} +1 -1
  62. package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-CGtemfUz.js → quadrantDiagram-W4KKPZXB-CAqdqT5W.js} +1 -1
  63. package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-N7YfpCvE.js → requirementDiagram-4Y6WPE33-Vv5YNzCu.js} +1 -1
  64. package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-CYnSrei-.js → sankeyDiagram-5OEKKPKP-Ciq1EgmQ.js} +1 -1
  65. package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-CsB7dCPF.js → sequenceDiagram-3UESZ5HK-DVRqp161.js} +1 -1
  66. package/dist/web-ui/assets/{stateDiagram-AJRCARHV-DTDFUXFP.js → stateDiagram-AJRCARHV-zbjDSKA3.js} +1 -1
  67. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-C54VSYn7.js +1 -0
  68. package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-C_bWAN9B.js → timeline-definition-PNZ67QCA-D0hr0d1U.js} +1 -1
  69. package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-CX_qAuUT.js → vennDiagram-CIIHVFJN-CtuZLcPo.js} +1 -1
  70. package/dist/web-ui/assets/{wardley-L42UT6IY-q53jQ293.js → wardley-L42UT6IY-nP2-eCDJ.js} +1 -1
  71. package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-D34dKCJU.js → wardleyDiagram-YWT4CUSO-Dxc7OveP.js} +1 -1
  72. package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-BFAngp66.js → xychartDiagram-2RQKCTM6-Bm2LvPhZ.js} +1 -1
  73. package/dist/web-ui/index.html +2 -2
  74. package/docs/README.md +50 -16
  75. package/docs/api/guides/websocket.md +43 -0
  76. package/docs/api/reference.md +657 -0
  77. package/docs/architecture/a2a-communication.md +303 -0
  78. package/docs/architecture/agent-runtime.md +145 -28
  79. package/docs/architecture/architecture.md +30 -11
  80. package/docs/architecture/cognitive-architecture.md +189 -15
  81. package/docs/architecture/concurrent-processing.md +190 -31
  82. package/docs/architecture/context-assembly.md +264 -0
  83. package/docs/architecture/derived-views.md +463 -0
  84. package/docs/architecture/desktop-auto-update.md +185 -0
  85. package/docs/architecture/facts.md +406 -0
  86. package/docs/architecture/learning-loop.md +11 -0
  87. package/docs/architecture/limits.md +79 -0
  88. package/docs/architecture/mailbox-system.md +786 -668
  89. package/docs/architecture/memory-system.md +1 -1
  90. package/docs/architecture/messaging-gateway.md +7 -0
  91. package/docs/architecture/notification-delivery.md +221 -0
  92. package/docs/architecture/notification-sounds.md +177 -0
  93. package/docs/architecture/prompt-engineering.md +171 -700
  94. package/docs/{design/remote-access-contract.md → architecture/remote-access.md} +4 -0
  95. package/docs/architecture/state-machines.md +288 -5
  96. package/docs/architecture/tool-loop-harness.md +362 -0
  97. package/docs/architecture/tool-system.md +40 -16
  98. package/docs/design/background-callback-in-turn-delivery-2026-11-22.md +95 -0
  99. package/docs/design/c10-0b-pick-identity-leak-2026-11-22.md +233 -0
  100. package/docs/design/c10-a-identity-columns-2026-11-22.md +182 -0
  101. package/docs/design/c10-c-trust-boundary-2026-11-23.md +222 -0
  102. package/docs/design/c10-external-adapters-plan-2026-11-19.md +448 -0
  103. package/docs/design/c8-residual-mechanisms-2026-11-15.md +984 -0
  104. package/docs/design/external-signal-decision-loop-2026-11-25.md +579 -0
  105. package/docs/guides/development.md +1 -1
  106. package/docs/{architecture → guides}/mailbox-audit-checklist.md +7 -0
  107. package/docs/guides/remote-access.md +1 -1
  108. package/docs/{design/agent-stop-intent-audit.md → records/agent-stop-intent-audit-2026-11-08.md} +4 -0
  109. package/docs/records/c10-l5-gate-verification-2026-11-26.md +72 -0
  110. package/docs/records/c10-l5-live-verification-2026-11-25.md +117 -0
  111. package/docs/records/cut6-c4-verification-2026-11-12.md +268 -0
  112. package/docs/records/cut6-mailbox-address-envelope-design-2026-11-12.md +871 -0
  113. package/docs/records/cut7-c7a-red-green-evidence-2026-11-13.md +105 -0
  114. package/docs/records/cut7-c7a-workunit-implementation-2026-11-13.md +116 -0
  115. package/docs/records/cut7-c7b-verification-2026-11-14.md +90 -0
  116. package/docs/records/cut7-live-verification-2026-11-14.md +33 -0
  117. package/docs/records/cut7-wiring-negative-cache-2026-11-14.md +64 -0
  118. package/docs/records/cut7-workunit-execution-plan-2026-11-13.md +206 -0
  119. package/docs/records/cut8-a-entity-keys-design-2026-11-14.md +377 -0
  120. package/docs/records/cut8-b-turn-delta-injection-2026-11-14.md +362 -0
  121. package/docs/records/cut8-c-single-clock-2026-11-14.md +119 -0
  122. package/docs/records/cut8-c-single-clock-design-2026-11-14.md +150 -0
  123. package/docs/records/cut8-d-2026-11-14.md +231 -0
  124. package/docs/records/cut8-live-verification-2026-11-14.md +1018 -0
  125. package/docs/records/cut9-adjacent-identity-paths-2026-11-15.md +200 -0
  126. package/docs/records/cut9-identity-declaration-2026-11-15.md +163 -0
  127. package/docs/records/cut9-inbox-dual-run-diff-2026-11-15.md +117 -0
  128. package/docs/records/cut9-live-verification-2026-11-15.md +222 -0
  129. package/docs/records/cut9-runtime-probe-2026-11-19.md +520 -0
  130. package/docs/{design/deliverable-sharing.md → records/deliverable-sharing-2026-08-12.md} +10 -3
  131. package/docs/records/identity-backlog-disposition-2026-11-22.md +143 -0
  132. package/docs/records/marketplace-orphan-freeze-2026-11-22.md +239 -0
  133. package/docs/{architecture/notify-user-context-truth.md → records/notify-user-context-truth-2026-10-28.md} +6 -0
  134. package/docs/{handoff → records}/remote-access-handoff.md +1 -1
  135. package/package.json +1 -1
  136. package/templates/roles/HANDBOOK.md +1 -1
  137. package/templates/skills/agent-building/SKILL.md +1 -1
  138. package/dist/web-ui/assets/ChatComponents-Ca9tWI9W.js +0 -12
  139. package/dist/web-ui/assets/DeliverableShareModal-BvpyowYJ.js +0 -1
  140. package/dist/web-ui/assets/MarkdownMessage-DedA8Zob.js +0 -4
  141. package/dist/web-ui/assets/Settings-BQDqf4q5.js +0 -8
  142. package/dist/web-ui/assets/Switch-C6InTNUi.js +0 -1
  143. package/dist/web-ui/assets/Team-nfNyWj-s.js +0 -85
  144. package/dist/web-ui/assets/Work-BQvgkynj.js +0 -142
  145. package/dist/web-ui/assets/channel-BTSrOo6c.js +0 -1
  146. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-BSYlcnF9.js +0 -1
  147. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-BSYlcnF9.js +0 -1
  148. package/dist/web-ui/assets/index-CKPQYzzR.js +0 -867
  149. package/dist/web-ui/assets/index-CzHSs0Vd.css +0 -1
  150. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-AVnDjlzF.js +0 -1
  151. package/docs/api/api.md +0 -353
  152. package/docs/architecture/llm-provider-timeouts.md +0 -60
  153. package/docs/architecture/state-ownership.md +0 -83
  154. /package/docs/architecture/{frontend/team-chat.md → team-chat.md} +0 -0
  155. /package/docs/{analysis → records}/2026-10-29-a2a-cache-hit-rate.md +0 -0
  156. /package/docs/{fixes → records}/2026-11-12-session-expiry-and-mention-thinking.md +0 -0
  157. /package/docs/{handoff → records}/approval-tri-state-handoff.md +0 -0
  158. /package/docs/{design → records}/overview-attention-redesign.md +0 -0
  159. /package/docs/{remote-access/fast-path-plan.md → records/remote-access-fast-path-plan-2026-10-17.md} +0 -0
@@ -0,0 +1,520 @@
1
+ # C9 runtime probe — terminal hooks, derived board, independent verifier
2
+
3
+ Date: 2026-11-19 · Instance under test: `feat/refactor-plan` @ `617e9fda` (merge of #464),
4
+ packaged build, PID 90267 · Requirement: `req_dcbf7ddf997c6346e0ee1ba2` (C9)
5
+
6
+ Plan card: **C10-0D** in `docs/design/c10-external-adapters-plan-2026-11-19.md` (PR #466).
7
+ Code record this one closes: `docs/records/cut9-live-verification-2026-11-15.md`.
8
+
9
+ ---
10
+
11
+ ## 1. What was missing, and why it is a record and not a conversation
12
+
13
+ C9's code was verified on 2026-11-15 (`cut9-live-verification-2026-11-15.md`), but only
14
+ half was: **branch code does not run at review time**, and until 2026-11-19 14:09:30 the
15
+ serving instance predated C9-E. So the sentence "the terminal hook bites" had never been
16
+ executed against a running build — it was inferred from tests.
17
+
18
+ This record is the runtime half: steps 0–5 of the C9-E probe spec, executed against a
19
+ serving instance whose build actually contains C9-E, with every reading timestamped and
20
+ every command re-runnable.
21
+
22
+ Its predecessor's closing line is the standard being applied here: *a verification that
23
+ exists only in a conversation is not a verification, because the next reader cannot check
24
+ it.*
25
+
26
+ ---
27
+
28
+ ## 2. Step 0 — is the running build actually the C9 build?
29
+
30
+ Read `2026-11-19 19:17:05 CST`. Nothing was restarted to take these readings.
31
+
32
+ ```bash
33
+ ps -p 90267 -o pid,lstart,etime,command
34
+ stat -f '%Sm %z bytes %N' -t '%Y-%m-%dT%H:%M:%S' \
35
+ packages/desktop/dist-electron/mac-arm64/Markus.app/Contents/Resources/app.asar
36
+ curl -s http://127.0.0.1:8056/api/health
37
+ LC_ALL=C grep -a -o 'loop_' .../Resources/app.asar | wc -l
38
+ LC_ALL=C grep -a -o 'declarationDebt' .../Resources/app.asar | wc -l
39
+ LC_ALL=C grep -a -o 'self_verification_forbidden' .../Resources/app.asar | wc -l
40
+ LC_ALL=C grep -a -o 'task.completion_evidence' .../Resources/app.asar | wc -l
41
+ ```
42
+
43
+ | Reading | Value |
44
+ |---|---|
45
+ | process | PID **90267**, started **2026-11-19 14:09:30 CST** |
46
+ | `app.asar` mtime | **2026-11-19 12:13:48**, 45,342,983 bytes |
47
+ | `/api/health` | `{"status":"ok","version":"0.12.3","agents":100,"bindHost":"0.0.0.0"}` |
48
+ | git HEAD | `617e9fda602492c652768fdf7fc37577262b9961` (merge PR #464, 2026-11-19 12:11:51) |
49
+ | symbol `loop_` (#464 work) | **19** |
50
+ | symbol `declarationDebt` | **3** |
51
+ | symbol `self_verification_forbidden` (C9-E) | **3** |
52
+ | symbol `task.completion_evidence` (C9-E) | **19** |
53
+
54
+ Plan §0.1 recorded `loop_` ×17 and `declarationDebt` ×2 at 14:1x. The counts here are
55
+ 19 and 3 because this probe counts **occurrences** (`grep -o | wc -l`) rather than
56
+ matching lines; same build, same asar mtime, different counting. Recorded rather than
57
+ silently reconciled — a differing number with a stated cause is data, an unexplained
58
+ number is noise.
59
+
60
+ **Conclusion:** the serving process started *after* the asar was built and the asar
61
+ contains C9-E symbols. Every reading below therefore measures the C9 build.
62
+
63
+ ---
64
+
65
+ ## 3. Step 1 — tool reachability (registered ≠ callable)
66
+
67
+ Readings taken from this execution session against the serving instance.
68
+
69
+ | Call | Timestamp (CST) | Result |
70
+ |---|---|---|
71
+ | `fact_assert` (task `tsk_df3169…`, `work.defect_class`) | 19:20:20 | **`status: "asserted"`**, row `fact_51218253447b6d8020d25a47` |
72
+ | `task_submit_review` (no completion evidence) | 19:19:0x | **rejected** — see §4 for the ordering finding |
73
+
74
+ The `fact_assert` write carried identity end-to-end:
75
+
76
+ ```
77
+ fact.id = fact_51218253447b6d8020d25a47
78
+ workUnitRef = task_tsk_df3169e699273f3d3ce31f31_r1
79
+ assertedBy = agt_d7f911ea2163f2151277b90e
80
+ sourceRefs = ["docs/architecture/facts.md:130",
81
+ "packages/core/src/agent-manager.ts:3768",
82
+ "tsk_df3169e699273f3d3ce31f31"]
83
+ ```
84
+
85
+ Confirmed by direct read of `~/.markus/data.db` (read-only):
86
+
87
+ ```
88
+ id | predicate | asserted_by | work_unit_ref
89
+ fact_51218253447b6d8020d25a47 | work.defect_class | agt_d7f911ea2163f2151277b90e | task_tsk_df3169e699273f3d3ce31f31_r1
90
+ ```
91
+
92
+ The first `task_submit_review` attempt was refused **before** the facts gate could be
93
+ reached:
94
+
95
+ > `Cannot submit for review: 8 subtask(s) still pending. Complete them with
96
+ > subtask_complete, or cancel inapplicable ones with subtask_cancel. Pending: "步骤0…"…`
97
+
98
+ That is the documented order in `TaskService.submitForReview`
99
+ (`packages/org-manager/src/task-service.ts:5104`): status guard → **pending-subtask guard**
100
+ → `assertCompletionEvidence` → persistence. It matters for replay: a probe taken on a card
101
+ with open subtasks measures the subtask gate, not the facts gate. The facts gate itself is
102
+ measured in §4.
103
+
104
+ ---
105
+
106
+ ## 4. Step 2 — negative A: no fact, submit, must be red
107
+
108
+ Executed on a **second instance** (independent port and data dir — see §7 for why), driving
109
+ the real `TaskService.submitForReview` of that process.
110
+
111
+ ```
112
+ 2026-11-19T11:26:47.336Z created tsk_bc526c294dd6158026550c8e status=pending
113
+ 2026-11-19T11:26:47.336Z approved status=in_progress
114
+ 2026-11-19T11:26:47.337Z submit_without_fact RESULT=REJECTED
115
+ ```
116
+
117
+ Exact error text (one line in the log, wrapped here):
118
+
119
+ ```
120
+ Cannot submit for review: task tsk_bc526c294dd6158026550c8e has no active
121
+ "task.completion_evidence" fact. Submission must point at evidence, not only prose.
122
+ Assert it first:
123
+ fact_assert({ subject_kind: "task", subject_id: "tsk_bc526c294dd6158026550c8e",
124
+ predicate: "task.completion_evidence",
125
+ value: { summary: "<what this work proved, 2-5 sentences>",
126
+ evidence_refs: ["<deliverable/comment/branch id or absolute path>", ...] },
127
+ source_refs: ["<the same ids>"] })
128
+ If a fact already exists but is out of date, use fact_supersede with a reason instead.
129
+ ```
130
+
131
+ The rejection is **actionable**: it names the tool, the subject, the predicate, and the two
132
+ value fields, and it names the escape hatch (`fact_supersede`) for a stale fact. A gate
133
+ that only says "missing evidence" trains the model to hallucinate a different call.
134
+
135
+ ### 4.1 A second finding from the same run: facts need a work-unit identity
136
+
137
+ The first attempt to satisfy the gate in-process was rejected again, by the writer:
138
+
139
+ ```
140
+ {"status":"rejected","code":"missing_provenance",
141
+ "message":"A fact needs identity: work_unit_ref (this turn is not bound to a WorkUnit),
142
+ asserted_by, and at least one source_ref. Empty is an error, not a default."}
143
+ ```
144
+
145
+ This is the C7/C8 identity chain holding on the C9 path: a probe process has no turn, so it
146
+ has no `work_unit_ref`, so it cannot write a fact. The repair is not to relax the writer —
147
+ it is to supply the real ref (`task_<taskId>_r<round>`), which the positive case in §5 does.
148
+
149
+ ---
150
+
151
+ ## 5. Step 3 — positive: assert per the error text, submit clean
152
+
153
+ ### 5.1 A first draft claimed "same task" without measuring it
154
+
155
+ The first version of this section paired §4's rejection on `tsk_bc526c29…` (`/tmp/mpw4`)
156
+ with a fact asserted on `tsk_fcd5661a…` (`/tmp/mpw5`) and described the result as "same
157
+ task". Review rejected that reading and was right: two cards in two data directories prove
158
+ "the gate *can* be satisfied", not "the same call flips on the same card". Re-measured on
159
+ one instance, one card.
160
+
161
+ ### 5.2 Same instance, same card, one variable
162
+
163
+ ```
164
+ instance : port 8068, data dir /tmp/mpw9 (fresh copy; ~/.markus never written)
165
+ harness : probe-samecard.mjs — drives that process's real TaskService/FactService
166
+ ```
167
+
168
+ ```
169
+ 2026-11-19T11:47:48.270Z create tsk_bac93960ba5b152c3cd42693 status=pending
170
+ 2026-11-19T11:47:48.271Z approve status=in_progress executionRound=1
171
+ 2026-11-19T11:47:48.284Z submitForReview (no fact) → REJECTED
172
+ (task stays in_progress)
173
+ 2026-11-19T11:47:48.284Z factService.assert status=asserted
174
+ fact_cf1a57834f6927bace1abd76
175
+ workUnitRef=task_tsk_bac93960ba5b152c3cd42693_r1
176
+ 2026-11-19T11:47:48.286Z submitForReview (same id, same method) → ACCEPTED
177
+ status=review
178
+ ```
179
+
180
+ Exact rejection text on that card:
181
+
182
+ ```
183
+ Cannot submit for review: task tsk_bac93960ba5b152c3cd42693 has no active
184
+ "task.completion_evidence" fact. Submission must point at evidence, not only prose.
185
+ Assert it first: …
186
+ ```
187
+
188
+ Red → green on the **same card, same instance, same method**, 2 ms apart, with nothing
189
+ changed except the presence of the fact. That is what "the gate bites" means operationally:
190
+ the same call flips because the evidence exists, not because anything was relaxed.
191
+
192
+ Stated limitation, not hidden: a fresh instance seeds **one** agent, so executor and
193
+ reviewer are the same `agt_…` here. `assertCompletionEvidence`
194
+ (`task-service.ts:1079-1098`) queries facts by task subject only and never reads the
195
+ reviewer, so the reading holds — but this is not a two-agent run and is not presented as
196
+ one.
197
+
198
+ ---
199
+
200
+ ## 6. Step 4 — negative B: independent verifier (producer ≠ confirmer)
201
+
202
+ On the **serving instance**, the fact asserted in §3 was then verified by the same agent:
203
+
204
+ ```
205
+ fact_verify({ fact_id: "fact_51218253447b6d8020d25a47", result: "pass", … })
206
+ → {"status":"rejected","code":"self_verification_forbidden",
207
+ "message":"Agent agt_d7f911ea2163f2151277b90e asserted this fact, so it cannot verify it.
208
+ Verification must come from a different agent (producer != confirmer): the task
209
+ reviewer, or an agent designated by the owning team manager for cross-team work."}
210
+ ```
211
+
212
+ Enforced at write time (`packages/org-manager/src/fact-service.ts:240` / `:410`), not by
213
+ convention in a prompt. The fact therefore stays `in_verification` until the reviewer
214
+ (CTO, `agt_b56cd620…`) rules on it — which is the intended outcome, not a gap.
215
+
216
+ ---
217
+
218
+ ## 7. Step 5 — laziness: what "facts off" can still mean, measured
219
+
220
+ ### 7.1 The premise in the card no longer exists
221
+
222
+ Plan §C10-0D step 5 and the card both say *"`FACTS_ENABLED=0` on a second instance"*.
223
+ Measured 2026-11-19 19:2x CST, HEAD `617e9fda`:
224
+
225
+ ```bash
226
+ grep -rn "FACTS_ENABLED" --include=*.ts packages/*/src # → 0 hits (no executable reader)
227
+ ```
228
+
229
+ `packages/core/src/agent-manager.ts:3768` and `:3785` state that the switch was **deleted
230
+ on 2026-11-15** (Owner decision): *"事实层是核心能力,不再提供关掉整层的运行形态;不接线的
231
+ 部署仍是合法的惰性状态"*. So `FACTS_ENABLED=0` cannot be executed — there is no reader left
232
+ to notice it.
233
+
234
+ The code names the surviving lazy form itself: **a deployment that never wires the facts
235
+ port**. That is what §7.2 measures. This substitution was reported to the CTO for a ruling
236
+ before being written up (see §10.2); no product code was changed to make the probe green.
237
+
238
+ ### 7.2 Two second instances, same build, one wiring difference
239
+
240
+ Both launched from the same worktree, `HOME` redirected so `~/.markus` is a throwaway data
241
+ dir, each on its own port. **The serving instance was not touched** (§9).
242
+
243
+ | | wired (`:8066`) | unwired (`:8067`) |
244
+ |---|---|---|
245
+ | pid / data dir | 11966 · `/tmp/mpw-w2/.markus` | 12133 · `/tmp/mpw-u2/.markus` |
246
+ | read at (CST) | 19:34:00 | 19:34:55 |
247
+ | `storage.factService` present | **true** | **false** |
248
+ | **`AgentManager.factService`** (injection point `api-server.ts:2099`) | object | **`null`** |
249
+ | **`TaskService.factService`** (injection point `api-server.ts:2101`) | object | **`null`** |
250
+ | work units still wired (`workUnits` + `TaskService.workUnitService`) | true | **true** |
251
+ | `work_status` tool present | true | **true** |
252
+ | agent tool count | **117** | **113** |
253
+ | `fact_*` tools registered | **`fact_assert`, `fact_supersede`, `fact_query`, `fact_verify`** | **`[]`** — all four absent |
254
+ | `submitForReview` with no fact | **REJECTED** (terminal hook active) | **ACCEPTED** → `status=review` |
255
+
256
+ The four-tool delta is exactly 117 − 113. The unwired instance keeps every other tool and
257
+ runs the identical `TaskService.submitForReview` code path — the only difference is that
258
+ neither consumer received a writer at assembly, which is the documented inert state.
259
+
260
+ The two port readings are the part that matters most: `api-server.ts:2099` and `:2101` are
261
+ **two independent injection points**, so "the tools are gone" alone would still be
262
+ consistent with a half-wired instance where `TaskService` kept its writer. Both read
263
+ `null`, and work units stayed wired in the same instance — so the laziness is scoped to the
264
+ facts dependency, not produced by a wiring call that returned early.
265
+
266
+ ### 7.3 How "unwired" was produced (and why this is not a product change)
267
+
268
+ The normal startup path cannot reach this state by configuration: `storage-bridge.ts:272`
269
+ constructs `SqliteFactService` unconditionally, and `wireWorkUnits()` then passes it to both
270
+ consumers at `api-server.ts:2099` / `:2101`. There is no flag left to skip either step
271
+ (§7.1). So the probe removes the **dependency**, not the call: `probe2-suite.mjs` drops
272
+ `storage.factService` immediately before the original `wireWorkUnits()` runs, in the probe
273
+ process only.
274
+
275
+ Two things this deliberately does *not* do:
276
+
277
+ - it does not take `wireWorkUnits()`'s `if (!units) return;` early exit — work units stay
278
+ wired and were measured wired (§7.2), so the inert facts layer cannot be an artefact of a
279
+ skipped wiring call;
280
+ - it does not touch any file under `packages/` — the product diff of this card is
281
+ documentation only.
282
+
283
+ ---
284
+
285
+ ## 8. Step 4 — disposable card: what actually happened
286
+
287
+ A disposable card was created under this requirement
288
+ (`tsk_fdf3828fbc7ebf40395e1092`, "【一次性探针卡·勿保留】C9 终态钩子真机探针"). It could not
289
+ be used, and the reason is a platform fact worth recording:
290
+
291
+ ```
292
+ task_update(tsk_fdf…, status="in_progress")
293
+ → Error: Task tsk_fdf… is pending approval. Use the approve or reject endpoint.
294
+ ```
295
+
296
+ `approveTask` (`packages/org-manager/src/task-service.ts:3159`) only accepts a `pending`
297
+ task and is reached from the human-authenticated REST route
298
+ (`packages/org-manager/src/routes/tasks.ts:435`). An agent therefore **cannot start a card
299
+ it created itself** — the probe recipe "create a disposable card, submit it" has no
300
+ self-service execution path. The card was taken off the board instead of being left asking a human for a decision nobody
301
+ needed; the negative/positive probes ran on a second instance (§4, §5) and on the serving
302
+ instance's own tool path (§3, §6).
303
+
304
+ **Its terminal status is `rejected`, not `cancelled`** — the first draft of this section said
305
+ "cancelled" and review caught it. Why the two words differ is a code fact, not a guess: the
306
+ task tool routes "cancel" on a **pending** card owned by its creator to
307
+ `ctx.cancelPendingTask` (`packages/core/src/tools/task-tools.ts:740-749`), and that port is
308
+ bound to `ts.rejectTask(taskId, id)` (`packages/core/src/agent-manager.ts:2047-2049`).
309
+ Cancelling a pending card therefore *is* rejecting it at the approval gate.
310
+
311
+ Board state after cleanup — read directly from `~/.markus/data.db`:
312
+
313
+ | object | status | authoritative timestamps |
314
+ |---|---|---|
315
+ | `tsk_fdf3828fbc7ebf40395e1092` (disposable probe card) | **rejected** | `status_changed_at` / `updated_at` = 2026-11-19T11:30:58.698Z / .700Z, `updated_by` = this agent |
316
+ | `tsk_df3169e699273f3d3ce31f31` (this card) | in_progress → review on submission | — |
317
+
318
+ The card note written at that moment says the card was cancelled, which is the **intent**; the
319
+ lifecycle row says `rejected`, which is the **state**. This record follows the row.
320
+
321
+ Facts are append-only by design (`docs/architecture/facts.md`), so the probe facts stay in
322
+ `facts` as history. They are attached to a rejected card and to this card, and none of
323
+ them pretends to be evidence for the requirement's acceptance.
324
+
325
+ ---
326
+
327
+ ## 9. The serving instance was never restarted
328
+
329
+ Two readings, bracketing the whole probe:
330
+
331
+ | reading | pid | started | elapsed |
332
+ |---|---|---|---|
333
+ | 19:17:05 CST | 90267 | 2026-11-19 14:09:30 | 05:07:35 |
334
+ | 19:29:5x CST | 90267 | 2026-11-19 14:09:30 | 05:20:15 |
335
+
336
+ Same pid, same start timestamp. All probe processes ran on `:8066` / `:8067` with their
337
+ own data dirs; nothing wrote to the serving `~/.markus/data.db` except the intended
338
+ `fact_assert` (through the platform) and the task lifecycle of this card.
339
+
340
+ ---
341
+
342
+ ## 10. Findings the probe produced (not all of them about C9)
343
+
344
+ ### 10.1 `docs/architecture/facts.md` still documents a deleted switch
345
+
346
+ The architecture doc still presented `FACTS_ENABLED=0` as the rollback path
347
+ (`:130`, `:243`, `:354`), while the code says the switch was removed on 2026-11-15. Filed
348
+ as an R2 fact (`fact_51218253447b6d8020d25a47`) when the probe was written; the CTO then
349
+ ruled (2026-11-19) that the fix rides on this same card and this same PR, so it was paid
350
+ off here rather than deferred — see §13.
351
+
352
+ ### 10.2 Step-5 wording is stale in two places
353
+
354
+ Both the plan (#466) and this card originally specified a switch that no longer exists. The
355
+ CTO ruled (2026-11-19 19:30 DM) that the switch was deleted on 2026-11-15 and that the
356
+ correct substitute is the code's own lazy form — a deployment whose facts dependency is
357
+ never wired. That is what §7 measures; no ruling is left open here.
358
+
359
+ ### 10.4 A probe process cannot assert a fact
360
+
361
+ `fact_assert` from a non-turn process returns `missing_provenance` (§4.1). That is the
362
+ identity contract working: no turn → no `work_unit_ref` → no fact. Replay must therefore
363
+ supply `workUnitRef: task_<taskId>_r<round>`, as §5 does.
364
+
365
+ ### 10.5 The `[FACTS:…]` prompt block stayed empty after a real assert (observation, not a claim)
366
+
367
+ Measured on the serving instance, 19:20–19:31 CST, inside the execution session whose
368
+ subject is this card:
369
+
370
+ | read | value |
371
+ |---|---|
372
+ | `fact_assert` on `tsk_df3169…` at 19:20:20 | `status: asserted`, row `fact_51218253447b6d8020d25a47` |
373
+ | `SELECT … FROM facts WHERE subject_id='tsk_df3169…'` | 1 row, `superseded_by = null` |
374
+ | `fact_query({subjectKind:'task', subjectId:'tsk_df3169…'})` at 19:31 | `count: 1` |
375
+ | the session's own `[FACTS:task_tsk_df3169…]` block, same turns | **`(no facts yet)`** |
376
+
377
+ So the subject was resolved (the header names this task) while its fact set rendered empty,
378
+ twelve minutes after the fact was committed, through eleven turns. Re-checked at 19:33 CST
379
+ with **two** active facts on the same subject: the block still read `(no facts yet)`.
380
+
381
+ And then, at 19:34 CST — immediately after a context checkpoint — the block rendered both
382
+ facts. So it is a **lag with an unknown boundary**, not a permanent outage: the same block
383
+ went from empty to populated without any new fact being written. Refined hypothesis: the
384
+ block is built from a snapshot refreshed at session/checkpoint boundaries rather than per
385
+ turn. Still not verified, and still not claimed as a defect — but the window (≈14 minutes,
386
+ ≈20 turns) is long enough to matter during a single task round, which is why it is here.
387
+
388
+ Two candidate causes, neither verified — this record does not pick one:
389
+
390
+ 1. the block is rendered from a snapshot taken at **session start** and is not recomputed
391
+ per turn;
392
+ 2. the provider is not wired for this session type even though the header renders.
393
+
394
+ Not fixed here: C10-0D is a probe, and "why is the injection empty" is a different root
395
+ cause from "do the terminal hooks bite". Recorded because the consequence is real — during
396
+ a task round, a fact asserted mid-round is exactly the one the agent should see.
397
+
398
+ ---
399
+
400
+ ## 11. Reproduce
401
+
402
+ ```bash
403
+ # 0. instance identity (read-only)
404
+ ps -p <pid> -o pid,lstart,etime,command
405
+ curl -s http://127.0.0.1:8056/api/health
406
+ LC_ALL=C grep -a -o 'self_verification_forbidden' \
407
+ packages/desktop/dist-electron/mac-arm64/Markus.app/Contents/Resources/app.asar | wc -l
408
+
409
+ # 7. second instance, wired → the terminal hook must reject, then accept after the fact
410
+ mkdir -p /tmp/mpw-wired
411
+ HOME=/tmp/mpw-wired PROBE_PORT=8066 PROBE_FACTS=wired \
412
+ node <workspace>/probe2-suite.mjs # prints PROBE {...} JSON lines
413
+
414
+ # 7. second instance, unwired → no fact tools, hooks inert
415
+ mkdir -p /tmp/mpw-unwired
416
+ HOME=/tmp/mpw-unwired PROBE_PORT=8067 PROBE_FACTS=unwired \
417
+ node <workspace>/probe2-suite.mjs
418
+
419
+ # 3/6. serving-instance reads (read-only)
420
+ node <workspace>/dbq.mjs \
421
+ "SELECT id,predicate,asserted_by,work_unit_ref FROM facts WHERE subject_id='<taskId>'"
422
+ ```
423
+
424
+ The probe scripts are `probe2-launch.mjs` (boot only) and `probe2-suite.mjs` (boot + drive)
425
+ in the executing agent's workspace; each run needs a **fresh** `HOME` because the second
426
+ instance self-initialises a database on first boot.
427
+
428
+ ---
429
+
430
+ ## 12. Conclusion — three-way, per the card discipline
431
+
432
+ **PASS on steps 0–6, with one substituted criterion (§7.1) and one platform limitation
433
+ (§8) named explicitly; step 7 (copy-only locale fix, §14) is included in this PR.**
434
+
435
+ - The running build is the C9 build (§2).
436
+ - The four fact tools are callable, not merely registered (§3).
437
+ - The terminal hook is red without evidence and green with it, on **one card in one
438
+ instance**, 2 ms apart (§5.2; the earlier cross-instance pairing is retracted in §5.1).
439
+ - The verifier refuses to confirm its own producer's claim (§6).
440
+ - With the facts port unwired, the four tools disappear and both hooks are inert; every
441
+ other tool and code path is unchanged (§7).
442
+ - The serving instance was never restarted (§9).
443
+
444
+ ### What is NOT residual
445
+
446
+ - The probe card ending `rejected` rather than `cancelled` (§8): the approval gate is human-only by
447
+ design; this is a recorded platform property, not unfinished work.
448
+ - Fact rows remaining in `facts` (§8): append-only is the design.
449
+ - `docs/architecture/facts.md` naming `FACTS_ENABLED` (§10.1) and the three web-ui locale
450
+ strings naming the dead flag: both are paid off inside this PR (§13, §14).
451
+ - Requirement `req_dcbf7ddf997c6346e0ee1ba2` status: the reviewer closes it. The worker
452
+ asserting acceptance would be self-verification wearing a different hat.
453
+
454
+ ---
455
+
456
+ ## 13. Step 6 — documentation close-out (ordered by CTO, same card, same PR)
457
+
458
+ The R2 fact in §10.1 was paid off inside this PR rather than deferred. `docs/architecture/facts.md`
459
+ no longer documents the deleted switch as a live mechanism:
460
+
461
+ | Location | Before | After |
462
+ |---|---|---|
463
+ | §6 (was `### 6. \`FACTS_ENABLED\``) | the flag restores old behaviour; read once in `isFactsEnabled()` | the flag appears **only** inside an explicitly marked *historical note: was deleted on 2026-11-15*; the section states that an unwired facts dependency is the only legal lazy form, and why the switch was removed |
464
+ | §9 rollback line | "with `FACTS_ENABLED=0` (or a `TaskService` built without a fact service) both hooks are inert" | "the only rollback is the dependency (§6)" + pointer to §7 of this record |
465
+ | §12 | "`FACTS_ENABLED=0` now covers five surfaces" | "the lazy form is an unwired facts dependency", five surfaces re-stated against the dependency, plus the two-port criterion |
466
+
467
+ Gate readings, 2026-11-19 19:38 CST:
468
+
469
+ ```bash
470
+ grep -rn "FACTS_ENABLED" --include=*.ts packages/*/src | grep -v "已于 2026-11-15 删除|was deleted" → 0
471
+ grep -n "FACTS_ENABLED" docs/architecture/facts.md
472
+ ```
473
+
474
+ Three hits remain, all explainable and none of them a live-mechanism claim:
475
+
476
+ | line | what it is |
477
+ |---|---|
478
+ | 132 | the explicitly marked *historical, deleted* note in §6 |
479
+ | 261 | the §9 rollback line, which says the flag "was deleted on 2026-11-15 and cannot be executed" |
480
+ | 389 | the gate command itself, inside the §12 code fence |
481
+
482
+ Reported rather than "cleaned": deleting the literal from the gate command would make the
483
+ check look greener while checking less. The one related item that is product copy rather
484
+ than documentation — three UI locale strings that still named the dead flag — was authorized
485
+ by the CTO as a copy-only exception on this same card and is closed in §14.
486
+
487
+ ---
488
+
489
+ ## 14. Step 7 — locale copy (CTO-authorized copy-only exception, same card, same PR)
490
+
491
+ The three facts-page `disabled` strings named `FACTS_ENABLED=0` as the cause. That cause no
492
+ longer exists (the switch was deleted on 2026-11-15); the state the copy describes does
493
+ exist and is the one this record measures — **a deployment whose facts dependency is never
494
+ wired** (`§7`). So the copy is corrected in place: same key, same meaning ("unavailable is
495
+ not the same as no facts"), attribution moved from the dead flag to the unwired deployment.
496
+
497
+ | file | before | after |
498
+ |---|---|---|
499
+ | `locales/zh-CN/common.json` | 事实层当前已关闭(FACTS_ENABLED=0),因此这里没有可展示的数据;这不是“没有事实”。 | 事实层在当前部署中未接线,因此这里没有可展示的数据;这不是“没有事实”。 |
500
+ | `locales/en/common.json` | The facts layer is disabled (FACTS_ENABLED=0), so there is nothing to show here — this is not the same as "no facts". | The facts layer is not wired in this deployment, so there is nothing to show here — this is not the same as "no facts". |
501
+ | `locales/es/common.json` | La capa de hechos está desactivada (FACTS_ENABLED=0), así que no hay nada que mostrar aquí; no es lo mismo que "no hay hechos". | La capa de hechos no está conectada en este despliegue, así que no hay nada que mostrar aquí; no es lo mismo que "no hay hechos". |
502
+
503
+ Key names unchanged (`factsAudit.disabled`, consumed at `packages/web-ui/src/pages/AuditFacts.tsx:465`);
504
+ three locales changed together so parity is preserved by construction, not by a later patch.
505
+
506
+ Gate readings (below, §14.1) are the acceptance criterion, not the diff:
507
+
508
+ ### 14.1 Gate readings
509
+
510
+ ```bash
511
+ git grep -n "FACTS_ENABLED" -- packages/web-ui # → 0 hits (both index and worktree)
512
+ node -e "JSON.parse(...)" xs 3 # → zh-CN/en/es parse
513
+ npx vitest run test/localeParity.test.ts test/integrationLocaleKeys.test.ts
514
+ # → 2 files passed, 20 tests passed (2026-11-19 19:50:12 CST)
515
+ ```
516
+
517
+ No test was added for this: the strings are prose, and the parity suite already fails if one
518
+ locale drifts from the others or loses a key — it is the right gate for a copy-only change.
519
+ `grep FACTS_ENABLED -- packages/web-ui` returning 0 is the direct criterion: the dead flag is
520
+ no longer named anywhere the product can render.
@@ -1,7 +1,8 @@
1
1
  # Deliverable Sharing to Hub — Design Proposal
2
2
 
3
- > Author: CTO | Date: 2026-08-12 | **Status: partially implemented** — the Markus client side
4
- > shipped; the Hub (cloud) side is still pending. See the As-built note below.
3
+ > Author: CTO | Date: 2026-08-12 | **Status: implemented, both ends** — Hub side verified 2026-11-15.
4
+ > Moved here from `docs/design/` on 2026-11-15: `design/` is for work that is not settled yet, and
5
+ > this one is settled. See the As-built note below.
5
6
  > Scope: joint work across both ends — the Markus client (desktop) + Markus Hub (cloud)
6
7
 
7
8
  > **As built:** the client side shipped. `DeliverableShareService` (`packages/core/src/deliverable-share.ts`) plus the
@@ -11,7 +12,13 @@
11
12
  > `GET /api/hub/deliverables/mine` via `listMine()`) through the client's **generic** `/api/hub/*` proxy in
12
13
  > `packages/org-manager/src/api-server.ts`, not a deliverables-specific route. The Hub-side items (§4.2 `DeliverableShare`
13
14
  > table, R2 object storage, `/deliverable/{slug}` page, sitemap/search, review queue) live in the separate markus.global
14
- > service and are not verifiable from this repo.
15
+ > service.
16
+ >
17
+ > **Hub side verified 2026-11-15 — this note used to say "still pending, not verifiable from this
18
+ > repo", and that was stale.** The `markus-hub` repo implements `/api/deliverables/publish|status|mine|revoke|media`
19
+ > plus the public-page read, and ships `deliverables.integration.test.ts`,
20
+ > `deliverable-public-page.integration.test.ts`, `deliverable-seo.integration.test.ts` and
21
+ > `deliverable-share.test.ts`. Nothing in this design is pending on the Hub.
15
22
 
16
23
  ---
17
24