@askexenow/exe-os 0.9.340 → 0.9.342

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 (417) hide show
  1. package/README.md +159 -196
  2. package/deploy/compose/.env.customer.example +1 -0
  3. package/deploy/compose/.env.example +1 -0
  4. package/deploy/compose/docker-compose.yml +13 -4
  5. package/deploy/compose/generate-env.ts +4 -0
  6. package/dist/{active-agent-EC6M7KTX.js → active-agent-PVGE57FY.js} +5 -5
  7. package/dist/{active-agent-WHIUCHLA.js → active-agent-TNIO6IY3.js} +5 -5
  8. package/dist/{agentic-ontology-RNSXGXW4.js → agentic-ontology-3FXYMHKW.js} +1 -1
  9. package/dist/{backfill-gate-J7UXFNXU.js → backfill-gate-65LSYVE5.js} +3 -3
  10. package/dist/{backfill-metadata-MFY6BHKE.js → backfill-metadata-ZSMZC45J.js} +8 -8
  11. package/dist/{background-jobs-STURKDCS.js → background-jobs-EXR5RVGG.js} +3 -3
  12. package/dist/backup-verify-3Y2FHGZU.js +425 -0
  13. package/dist/{behaviors-HLZUJSMP.js → behaviors-KYRB3NGJ.js} +9 -9
  14. package/dist/bin/age-ontology-load.js +3 -3
  15. package/dist/bin/agentic-ontology-backfill.js +10 -10
  16. package/dist/bin/agentic-reflection-backfill.js +11 -11
  17. package/dist/bin/agentic-semantic-label.js +10 -10
  18. package/dist/bin/backfill-conversations.js +10 -10
  19. package/dist/bin/backfill-responses.js +10 -10
  20. package/dist/bin/backfill-vectors.js +14 -14
  21. package/dist/bin/bulk-sync-postgres.js +19 -19
  22. package/dist/bin/cc-doctor.js +10 -8
  23. package/dist/bin/cleanup-stale-review-tasks.js +26 -24
  24. package/dist/bin/cli.js +111 -25
  25. package/dist/bin/customer-readiness.js +1 -1
  26. package/dist/bin/deferred-daemon-restart.js +97 -90
  27. package/dist/bin/exe-agent-config.js +9 -8
  28. package/dist/bin/exe-agent.js +20 -20
  29. package/dist/bin/exe-assign.js +12 -12
  30. package/dist/bin/exe-boot.js +201 -68
  31. package/dist/bin/exe-call.js +7 -7
  32. package/dist/bin/exe-cloud.js +20 -20
  33. package/dist/bin/exe-config-dump.js +9 -8
  34. package/dist/bin/exe-dispatch.js +26 -24
  35. package/dist/bin/exe-doctor.js +10 -6
  36. package/dist/bin/exe-export-behaviors.js +11 -11
  37. package/dist/bin/exe-forget.js +12 -10
  38. package/dist/bin/exe-gateway.js +15 -10
  39. package/dist/bin/exe-grant.js +5 -5
  40. package/dist/bin/exe-healthcheck.js +14 -8
  41. package/dist/bin/exe-heartbeat.js +29 -28
  42. package/dist/bin/exe-kill.js +31 -29
  43. package/dist/bin/exe-launch-agent.js +129 -68
  44. package/dist/bin/exe-memory-reads.js +257 -0
  45. package/dist/bin/exe-new-employee.js +12 -11
  46. package/dist/bin/exe-pending-messages.js +27 -25
  47. package/dist/bin/exe-pending-notifications.js +26 -24
  48. package/dist/bin/exe-pending-reviews.js +26 -24
  49. package/dist/bin/exe-rename.js +7 -7
  50. package/dist/bin/exe-review.js +30 -28
  51. package/dist/bin/exe-search.js +11 -9
  52. package/dist/bin/exe-session-cleanup.js +116 -86
  53. package/dist/bin/exe-settings.js +24 -23
  54. package/dist/bin/exe-start-codex.js +163 -41
  55. package/dist/bin/exe-start-opencode.js +15 -15
  56. package/dist/bin/exe-status.js +27 -25
  57. package/dist/bin/exe-support.js +5 -5
  58. package/dist/bin/exe-team.js +5 -5
  59. package/dist/bin/exe-timers.js +32 -213
  60. package/dist/bin/exe-watchdog.js +6 -5
  61. package/dist/bin/git-sweep.js +27 -25
  62. package/dist/bin/graph-backfill.js +9 -9
  63. package/dist/bin/graph-export.js +9 -9
  64. package/dist/bin/import-history.js +11 -11
  65. package/dist/bin/install.js +102 -95
  66. package/dist/bin/intercom-check.js +4 -4
  67. package/dist/bin/mcp-sessions.js +2 -2
  68. package/dist/bin/orchestration-metrics.js +6 -6
  69. package/dist/bin/postgres-agentic-reflection-backfill.js +5 -5
  70. package/dist/bin/postgres-agentic-semantic-backfill.js +7 -7
  71. package/dist/bin/pre-publish.js +5 -3
  72. package/dist/bin/reconcile-backlog.js +484 -0
  73. package/dist/bin/registry-proxy.js +1 -1
  74. package/dist/bin/scan-tasks.js +26 -24
  75. package/dist/bin/setup.js +6 -5
  76. package/dist/bin/shard-migrate.js +9 -9
  77. package/dist/bin/stack-update.js +15 -9
  78. package/dist/bin/update.js +1 -1
  79. package/dist/bin/vps-health-gate.js +1 -1
  80. package/dist/boot-generation-BL2ISK4U.js +22 -0
  81. package/dist/boot-review-sections-DBMQJT5N.js +107 -0
  82. package/dist/branch-hygiene-TZWK6QCF.js +224 -0
  83. package/dist/{branding-JTEOF4ZV.js → branding-DVXBGVDH.js} +3 -3
  84. package/dist/{browser-session-store-CXQMOSEC.js → browser-session-store-B2NR3LIX.js} +2 -1
  85. package/dist/{capability-cards-YOKVMMOL.js → capability-cards-DN5UIKVN.js} +4 -4
  86. package/dist/{capacity-monitor-S54IOWRL.js → capacity-monitor-ZG5GGFR2.js} +27 -25
  87. package/dist/{catchup-brief-DRRQCMKA.js → catchup-brief-D6HH6DWS.js} +32 -29
  88. package/dist/{support-outbox-MGUVVGHT.js → chunk-25X4JD2V.js} +28 -12
  89. package/dist/{chunk-IYB2NIW3.js → chunk-2KZNGDSW.js} +1 -1
  90. package/dist/{chunk-FUIIVSW6.js → chunk-2WAVZ5UJ.js} +1 -1
  91. package/dist/{chunk-K5WFKEXQ.js → chunk-2ZYO73KO.js} +4 -3
  92. package/dist/{chunk-CLAYNAXC.js → chunk-3EUMUSLE.js} +1 -1
  93. package/dist/{chunk-BVV6NHKQ.js → chunk-3SW4OEHB.js} +5 -5
  94. package/dist/{task-enforcement-VI7L43DC.js → chunk-4CMVFVFC.js} +173 -69
  95. package/dist/{chunk-BU2QQWBQ.js → chunk-4J4PMPXZ.js} +3 -2
  96. package/dist/{chunk-JD5S5AAV.js → chunk-4N2NRGCM.js} +2 -2
  97. package/dist/chunk-4QCFFW2H.js +378 -0
  98. package/dist/{chunk-7EA7LYW4.js → chunk-4VSV5P4D.js} +4 -4
  99. package/dist/{chunk-52KNOQMK.js → chunk-4ZCD2UWW.js} +39 -10
  100. package/dist/{chunk-DZ6OQM67.js → chunk-5ERDIOV3.js} +2 -2
  101. package/dist/chunk-5H47VHB7.js +30 -0
  102. package/dist/{chunk-UCQITDLM.js → chunk-5TY4FPH6.js} +1 -1
  103. package/dist/{chunk-R44Z32O2.js → chunk-6CH3TPHR.js} +2 -2
  104. package/dist/{chunk-WYLV4S6A.js → chunk-6WQ3NNCE.js} +3 -3
  105. package/dist/{chunk-HHIBOU3P.js → chunk-6XWTQUO4.js} +1 -1
  106. package/dist/chunk-76CJBM36.js +88 -0
  107. package/dist/{chunk-H2L4PHGH.js → chunk-7CTRGNLW.js} +2 -2
  108. package/dist/{chunk-XUKPALWT.js → chunk-7V4JADD6.js} +2 -2
  109. package/dist/{chunk-RMOBQ6A5.js → chunk-AD2VCHSS.js} +1 -1
  110. package/dist/{chunk-QXSBB26A.js → chunk-AJYCFKJR.js} +1 -1
  111. package/dist/chunk-AM7S2TY6.js +54 -0
  112. package/dist/{chunk-HEPR6QTL.js → chunk-AOHXREB7.js} +334 -66
  113. package/dist/{chunk-FNZR3B7U.js → chunk-ASAFVDVR.js} +1 -1
  114. package/dist/{chunk-TALWBVZE.js → chunk-BUCXNV32.js} +1 -1
  115. package/dist/{chunk-SHIICYJW.js → chunk-BYTDMAGB.js} +4 -2
  116. package/dist/{chunk-32SXNM3G.js → chunk-C5QAPURN.js} +1 -1
  117. package/dist/{chunk-XCTGRD4S.js → chunk-CE7F6RHG.js} +587 -77
  118. package/dist/{chunk-7WPOJDTA.js → chunk-CNVBKDEY.js} +21 -15
  119. package/dist/{chunk-KPIN44GZ.js → chunk-CWXVH7WV.js} +1 -1
  120. package/dist/chunk-D74XYSA3.js +621 -0
  121. package/dist/{chunk-A47MXY2I.js → chunk-EQHQF5IM.js} +50 -32
  122. package/dist/{chunk-AOO77BDE.js → chunk-EUS4QUKP.js} +1 -1
  123. package/dist/{chunk-RLRT2BVM.js → chunk-EV46QTD3.js} +1 -1
  124. package/dist/{chunk-PAEXYFMY.js → chunk-F27XXN6C.js} +1 -1
  125. package/dist/{chunk-XQNNB5GY.js → chunk-F55P3H4S.js} +37 -2
  126. package/dist/{chunk-MWZFF3Q7.js → chunk-F5O7V7UK.js} +1 -1
  127. package/dist/{chunk-LMZISHSJ.js → chunk-FPFPLPUY.js} +6 -6
  128. package/dist/{chunk-7TS64TBG.js → chunk-G4RGKBCA.js} +8 -3
  129. package/dist/{chunk-4IYSBPX3.js → chunk-G5T6KDG4.js} +1 -1
  130. package/dist/{chunk-7WDXEKUL.js → chunk-GBTTBXAF.js} +4 -4
  131. package/dist/{chunk-6MRWJMI5.js → chunk-GDIJE6D7.js} +1 -1
  132. package/dist/{chunk-AVKXCSBI.js → chunk-GG5NDQNN.js} +2 -2
  133. package/dist/{chunk-I3XKO3KQ.js → chunk-GJ26DULE.js} +2 -2
  134. package/dist/chunk-GL57PO3K.js +104 -0
  135. package/dist/chunk-GWDSB25T.js +6 -0
  136. package/dist/{chunk-F55JF43M.js → chunk-H6BV5TKD.js} +39 -24
  137. package/dist/{chunk-HCJCW7X4.js → chunk-H7I47RS5.js} +34 -1
  138. package/dist/{chunk-65SVQELL.js → chunk-HA5R6USD.js} +31 -5
  139. package/dist/{chunk-VJHUVFIW.js → chunk-HAF2DJYV.js} +3 -3
  140. package/dist/chunk-HJ447YER.js +224 -0
  141. package/dist/chunk-HV4KESRY.js +395 -0
  142. package/dist/{chunk-B76TSEP3.js → chunk-I26FWCSP.js} +216 -9
  143. package/dist/{chunk-X2FHTDIU.js → chunk-IBYL4DHM.js} +1 -1
  144. package/dist/{chunk-JCBKARSK.js → chunk-IOEUAQWP.js} +1 -1
  145. package/dist/{chunk-MW2GJJ53.js → chunk-JGIPOUIK.js} +3 -3
  146. package/dist/{chunk-2233TQCA.js → chunk-JLZ4RYSD.js} +2 -2
  147. package/dist/{chunk-Q7L6G6KV.js → chunk-JMYHW3AL.js} +2 -2
  148. package/dist/{chunk-OJTJYEMX.js → chunk-JPUZPAAF.js} +4 -4
  149. package/dist/{chunk-XWHE4LZK.js → chunk-JTBIS4R5.js} +21 -2
  150. package/dist/{chunk-5Z5NATNS.js → chunk-K7KFGDWF.js} +1 -1
  151. package/dist/{chunk-UIV2WPBT.js → chunk-KGWRTRKC.js} +2 -2
  152. package/dist/{chunk-KTPG4XKI.js → chunk-KP3U5QGJ.js} +1 -1
  153. package/dist/{chunk-TLYAEISW.js → chunk-KW2SD2FL.js} +2 -2
  154. package/dist/{chunk-X7H3HMFH.js → chunk-KWZMQACA.js} +11 -7
  155. package/dist/{chunk-OFX5B2S7.js → chunk-L2R3LN2P.js} +1 -1
  156. package/dist/{chunk-T4KZ2Z2N.js → chunk-L4A5DL6Z.js} +3 -3
  157. package/dist/{chunk-X425OEYF.js → chunk-LU2FALL6.js} +3 -3
  158. package/dist/{chunk-6M36JFFD.js → chunk-MKYFAKDW.js} +4 -4
  159. package/dist/{chunk-I5RLNOFK.js → chunk-MOPUCPXK.js} +12 -4
  160. package/dist/{chunk-ZIVEA3NB.js → chunk-MR6LHP4F.js} +1 -1
  161. package/dist/chunk-MVYB76QG.js +341 -0
  162. package/dist/{chunk-2SG2UGCH.js → chunk-MZM6EJCU.js} +4 -4
  163. package/dist/{chunk-ZREGOV2Q.js → chunk-N7QJKQMX.js} +258 -14
  164. package/dist/{chunk-QLFRCA6I.js → chunk-NBZL5CGA.js} +93 -12
  165. package/dist/{chunk-QFPTDSY2.js → chunk-NN2B2QKU.js} +1 -1
  166. package/dist/chunk-NX5INHHG.js +40 -0
  167. package/dist/{chunk-B75BOKEI.js → chunk-NXUSDL37.js} +2 -2
  168. package/dist/{chunk-TPHCZDE3.js → chunk-O5V57XYE.js} +1 -1
  169. package/dist/chunk-O7LWR36Z.js +269 -0
  170. package/dist/{chunk-ATOU6CYR.js → chunk-OLMQ4UOF.js} +57 -11
  171. package/dist/{chunk-6HBURYON.js → chunk-OTF44GXL.js} +4 -4
  172. package/dist/{chunk-DILD54TU.js → chunk-OZEBAGKR.js} +277 -137
  173. package/dist/{chunk-DADMPMYX.js → chunk-P5HIWY2E.js} +1 -1
  174. package/dist/{chunk-EIF2LQHZ.js → chunk-PDWS3E22.js} +55 -4
  175. package/dist/{chunk-KTY7I7UH.js → chunk-PPCDBE6Z.js} +1 -1
  176. package/dist/{chunk-XACL67CS.js → chunk-PQIDGXSG.js} +13 -4
  177. package/dist/chunk-PWUFMX75.js +186 -0
  178. package/dist/{chunk-UPWE5NOG.js → chunk-QDGZJ653.js} +3 -3
  179. package/dist/{chunk-MQRFKSLI.js → chunk-QOO5RW3K.js} +6 -5
  180. package/dist/{chunk-KCC5A7YL.js → chunk-QQ4E2RYW.js} +95 -18
  181. package/dist/{chunk-BPC5LZ6Y.js → chunk-QRYVCDWS.js} +2 -2
  182. package/dist/{chunk-Z42MXYWW.js → chunk-QWVXN224.js} +110 -28
  183. package/dist/{chunk-542EWGY3.js → chunk-QYZJHTNE.js} +26 -27
  184. package/dist/{chunk-I7Z6KTGF.js → chunk-R2NN3JKH.js} +43 -6
  185. package/dist/{chunk-3OBWSCJN.js → chunk-RACAOE2Z.js} +14 -14
  186. package/dist/{chunk-5RACW3LX.js → chunk-RAXVPNMR.js} +1 -1
  187. package/dist/{chunk-2HZY3ECT.js → chunk-RHWZUUS4.js} +6 -6
  188. package/dist/{chunk-RNAYCUNM.js → chunk-S3THSOWV.js} +1 -1
  189. package/dist/{chunk-W7DHFGCB.js → chunk-S7QUM2UK.js} +2 -2
  190. package/dist/{chunk-SSTLTIF3.js → chunk-SKGMF2SO.js} +25 -2
  191. package/dist/{chunk-GN45PBWI.js → chunk-SQKXKV2Y.js} +2 -2
  192. package/dist/{chunk-QZLIZAS7.js → chunk-TLT7NZCW.js} +4 -4
  193. package/dist/chunk-TTCUG2CF.js +91 -0
  194. package/dist/chunk-UEA3LXOB.js +40 -0
  195. package/dist/{chunk-DRCRZIIJ.js → chunk-UNXQBELK.js} +1 -1
  196. package/dist/{chunk-PLRIJALF.js → chunk-UP75Z5X7.js} +921 -176
  197. package/dist/{chunk-TNJRWUCE.js → chunk-USSB56WK.js} +1 -1
  198. package/dist/{chunk-KMBEL7VB.js → chunk-UUEKJDK6.js} +90 -10
  199. package/dist/{chunk-XJI7Z6LZ.js → chunk-UUQBZPJJ.js} +1 -1
  200. package/dist/{chunk-RRWDYOQS.js → chunk-V3EEVY4L.js} +1 -1
  201. package/dist/{chunk-N5I7RL3I.js → chunk-VPZHJCKW.js} +2 -2
  202. package/dist/chunk-VRAQTFD6.js +265 -0
  203. package/dist/{chunk-H37HHX3E.js → chunk-VSRPS3J7.js} +14 -14
  204. package/dist/{chunk-5ZNY7IZI.js → chunk-WMESXBJM.js} +37 -3
  205. package/dist/{chunk-54QCG45Y.js → chunk-WOYADZF5.js} +56 -5
  206. package/dist/{chunk-7Y5UDEVM.js → chunk-WZHZCDDO.js} +6 -5
  207. package/dist/{chunk-3NGZ4PL7.js → chunk-X2Q5NLUL.js} +11 -2
  208. package/dist/{chunk-YE7NH53A.js → chunk-X33NYQYJ.js} +2 -2
  209. package/dist/{chunk-UXBD22CD.js → chunk-XHK3FS3W.js} +3 -2
  210. package/dist/{chunk-3QDSCJ3F.js → chunk-XZXBB3TN.js} +2 -2
  211. package/dist/{chunk-JSKBHUR7.js → chunk-YCANDMI2.js} +2 -2
  212. package/dist/{chunk-JBSCL2XT.js → chunk-YLXTKI6M.js} +1 -1
  213. package/dist/{chunk-G7WO77Z2.js → chunk-YTCFACP4.js} +812 -896
  214. package/dist/{chunk-LTVCRHHD.js → chunk-Z6RSN7KS.js} +7 -6
  215. package/dist/{cleanup-graph-garbage-KUABW6LS.js → cleanup-graph-garbage-XWUFAMFO.js} +6 -6
  216. package/dist/{co-activation-XMPHKGHR.js → co-activation-ZCHPLLP6.js} +4 -4
  217. package/dist/{co-occurrence-SHKSJ6CV.js → co-occurrence-KG3LKALN.js} +4 -4
  218. package/dist/{code-context-index-EXXDY3QZ.js → code-context-index-WSOJQ72R.js} +5 -5
  219. package/dist/{content-extractor-RHITF2KM.js → content-extractor-NXYNEF5K.js} +2 -2
  220. package/dist/{conversation-wiki-populator-WU4HEQ7C.js → conversation-wiki-populator-WQN3IUU6.js} +1 -1
  221. package/dist/{crdt-sync-UJELKSNX.js → crdt-sync-4PFGPZXV.js} +8 -1
  222. package/dist/{crm-webhook-HHNBS7LY.js → crm-webhook-II7Z45Q6.js} +2 -2
  223. package/dist/cto-delegation-gate-JWWOJPNC.js +669 -0
  224. package/dist/{daemon-auth-7IFSV5FG.js → daemon-auth-3FEAHFWC.js} +5 -3
  225. package/dist/{daemon-orchestration-7QB6QOXT.js → daemon-orchestration-FX4XZDR5.js} +46 -27
  226. package/dist/{daemon-ready-5XI5BIJD.js → daemon-ready-4JTSFKAY.js} +1 -1
  227. package/dist/{daemon-ready-signal-E7VMIQ6I.js → daemon-ready-signal-LPAZWQOV.js} +5 -1
  228. package/dist/daemon-restart-circuit-breaker-PEGEIP6H.js +35 -0
  229. package/dist/daemon-timer-report-NM44WQRH.js +25 -0
  230. package/dist/{db-backup-DLD4QZBO.js → db-backup-W2QFSYQC.js} +15 -5
  231. package/dist/{db-restore-events-JVEEP52Z.js → db-restore-events-MQ2DBGEQ.js} +2 -2
  232. package/dist/dispatch-ack-VYH3ONSS.js +27 -0
  233. package/dist/{doc-graph-extractor-3TRLGD7M.js → doc-graph-extractor-F6ODFIID.js} +4 -4
  234. package/dist/{documents-FHIBU7KJ.js → documents-23WX2FPQ.js} +12 -12
  235. package/dist/dreaming-NWD22UQ5.js +46 -0
  236. package/dist/{exe-drift-KY2KHZEL.js → exe-drift-CW72FBGE.js} +5 -5
  237. package/dist/{exe-export-SP6G3QF6.js → exe-export-AUJ7CV7G.js} +11 -11
  238. package/dist/{exe-import-KJU7FBVQ.js → exe-import-JX4I52VE.js} +11 -11
  239. package/dist/{exe-key-M6TYHNUW.js → exe-key-2N6LY2BU.js} +241 -226
  240. package/dist/{exe-org-BGZNNE4H.js → exe-org-X4CSNCKS.js} +3 -3
  241. package/dist/{exe-snapshot-ZNPGUKRZ.js → exe-snapshot-XZ7FVCYZ.js} +31 -29
  242. package/dist/{fast-db-init-QQB6IVWV.js → fast-db-init-4CWHSOOR.js} +1 -1
  243. package/dist/{founder-context-PQR3BUS7.js → founder-context-7L3CFPYN.js} +4 -4
  244. package/dist/gateway/index.js +14 -14
  245. package/dist/{gateway-client-GRBOJQYC.js → gateway-client-7LMZKHTH.js} +1 -1
  246. package/dist/git-main-guard-UZP3KXYI.js +39 -0
  247. package/dist/{git-staleness-UGB5J3K7.js → git-staleness-CI2R4QOJ.js} +4 -4
  248. package/dist/{global-procedures-R7KRREEK.js → global-procedures-XQX3LUH6.js} +6 -6
  249. package/dist/{graph-auto-extract-LKIQ57PL.js → graph-auto-extract-OURWMGBS.js} +4 -4
  250. package/dist/{hook-integrity-WURH6DS3.js → hook-integrity-XY47IM7G.js} +1 -1
  251. package/dist/hook-prefetch-PHRRKY4C.js +137 -0
  252. package/dist/hooks/bug-report-worker.js +32 -28
  253. package/dist/hooks/codex-stop-task-finalizer.js +32 -28
  254. package/dist/hooks/commit-complete.js +29 -27
  255. package/dist/hooks/error-recall.js +12 -11
  256. package/dist/hooks/exe-heartbeat-hook.js +6 -6
  257. package/dist/hooks/ingest-worker.js +11 -11
  258. package/dist/hooks/ingest.js +18 -18
  259. package/dist/hooks/instructions-loaded.js +7 -7
  260. package/dist/hooks/manifest.json +20 -20
  261. package/dist/hooks/notification.js +7 -7
  262. package/dist/hooks/post-compact.js +28 -26
  263. package/dist/hooks/post-tool-combined.js +12 -12
  264. package/dist/hooks/pre-compact.js +29 -27
  265. package/dist/hooks/pre-tool-use.js +180 -47
  266. package/dist/hooks/prompt-submit.js +324 -273
  267. package/dist/hooks/session-end.js +35 -33
  268. package/dist/hooks/session-start.js +28 -21
  269. package/dist/hooks/stop.js +35 -33
  270. package/dist/hooks/subagent-stop.js +28 -26
  271. package/dist/hooks/summary-worker.js +36 -34
  272. package/dist/index.js +39 -37
  273. package/dist/{installer-SB2N5NKH.js → installer-G3JAO3NT.js} +9 -9
  274. package/dist/{installer-MZWWBXM6.js → installer-JND3RJ6Q.js} +9 -9
  275. package/dist/{installer-MNPXDLGG.js → installer-L7EVH5U5.js} +9 -9
  276. package/dist/{intercom-queue-VU2G6F5R.js → intercom-queue-ZFEQALR3.js} +25 -23
  277. package/dist/{key-backup-status-TNEHXA2X.js → key-backup-status-LOSMVATJ.js} +2 -2
  278. package/dist/lib/agent-config.js +4 -3
  279. package/dist/lib/cloud-sync.js +19 -19
  280. package/dist/lib/config.js +2 -2
  281. package/dist/lib/consolidation.js +9 -9
  282. package/dist/lib/crypto.js +3 -3
  283. package/dist/lib/database.js +6 -4
  284. package/dist/lib/db-daemon-client.js +5 -5
  285. package/dist/lib/db-read-worker-client.js +9 -3
  286. package/dist/lib/db.js +6 -4
  287. package/dist/lib/device-registry.js +3 -3
  288. package/dist/lib/embed-worker.js +2 -2
  289. package/dist/lib/embedder.js +5 -5
  290. package/dist/lib/employee-templates.js +7 -7
  291. package/dist/lib/employees.js +10 -4
  292. package/dist/lib/exe-daemon-client.js +4 -4
  293. package/dist/lib/exe-daemon.js +651 -158
  294. package/dist/lib/hybrid-search.js +11 -9
  295. package/dist/lib/identity.js +4 -4
  296. package/dist/lib/keychain.js +1 -1
  297. package/dist/lib/license.js +4 -4
  298. package/dist/lib/messaging.js +28 -24
  299. package/dist/lib/post-tool-memory.js +3 -3
  300. package/dist/lib/registry-proxy.js +1 -1
  301. package/dist/lib/reminders.js +15 -7
  302. package/dist/lib/schedules.js +9 -9
  303. package/dist/lib/session-registry.js +6 -6
  304. package/dist/lib/skill-learning.js +10 -10
  305. package/dist/lib/status-brief.js +4 -4
  306. package/dist/lib/store.js +8 -8
  307. package/dist/lib/task-router.js +5 -5
  308. package/dist/lib/tasks.js +29 -25
  309. package/dist/lib/tmux-routing.js +56 -25
  310. package/dist/lib/tmux-status.js +9 -3
  311. package/dist/lib/tmux-transport.js +1 -1
  312. package/dist/lib/token-spend.js +5 -5
  313. package/dist/lib/transport.js +2 -2
  314. package/dist/lib/ws-client.js +1 -1
  315. package/dist/{license-gate-BYDMFMFT.js → license-gate-QTRQHV4F.js} +5 -5
  316. package/dist/{license-sync-N3RNYVP2.js → license-sync-N3UJFWAW.js} +4 -4
  317. package/dist/mcp/register-tools.js +96 -89
  318. package/dist/mcp/server.js +98 -91
  319. package/dist/mcp/tools/complete-reminder.js +6 -6
  320. package/dist/mcp/tools/create-reminder.js +6 -6
  321. package/dist/mcp/tools/create-task.js +37 -28
  322. package/dist/mcp/tools/deactivate-behavior.js +11 -11
  323. package/dist/mcp/tools/list-reminders.js +6 -6
  324. package/dist/mcp/tools/list-tasks.js +35 -29
  325. package/dist/mcp/tools/send-message.js +28 -26
  326. package/dist/mcp/tools/update-task.js +34 -28
  327. package/dist/{mcp-http-config-EMAVS2JI.js → mcp-http-config-BDL36JZ3.js} +6 -6
  328. package/dist/{mcp-port-config-FFAMMLLE.js → mcp-port-config-6HYY6J7K.js} +2 -2
  329. package/dist/mcp-session-identity-T7H2EKFQ.js +177 -0
  330. package/dist/{memory-cards-TQRLZI4D.js → memory-cards-ZRDW7QBX.js} +8 -8
  331. package/dist/{memory-graph-extractor-IWGNVAFU.js → memory-graph-extractor-QLXDMHRS.js} +5 -5
  332. package/dist/{memory-poisoning-defense-T4ITBGSG.js → memory-poisoning-defense-HJTXYCWH.js} +4 -4
  333. package/dist/{memory-pressure-watchdog-RRIAXPXQ.js → memory-pressure-watchdog-HN5X7AVN.js} +76 -37
  334. package/dist/{memory-queue-X2CSEAKE.js → memory-queue-2UOOF27L.js} +5 -3
  335. package/dist/{memory-queue-client-BKQHTYTH.js → memory-queue-client-O5U6F6XP.js} +6 -6
  336. package/dist/{memory-reflection-6N4J2FL7.js → memory-reflection-WVNFBJAA.js} +4 -4
  337. package/dist/{monitor-grants-RZOVSYVO.js → monitor-grants-E3ELDEWD.js} +5 -5
  338. package/dist/{monitor-identity-MOXISYNG.js → monitor-identity-GLFZSEAH.js} +2 -2
  339. package/dist/notification-ledger-SZEPGJQ7.js +409 -0
  340. package/dist/{notifications-KONB3C62.js → notifications-4UT53CDG.js} +25 -23
  341. package/dist/{orchestration-events-5SIJOE4H.js → orchestration-events-WV4NWKZH.js} +5 -5
  342. package/dist/{orchestration-phase-CXRCBCK7.js → orchestration-phase-AWBXPO52.js} +3 -3
  343. package/dist/orchestrator-UAC3RW2T.js +47 -0
  344. package/dist/{pipeline-router-O6HU7DKH.js → pipeline-router-LM53NMWJ.js} +5 -5
  345. package/dist/{plan-limits-GRNBOBB3.js → plan-limits-2FEY2GOS.js} +7 -7
  346. package/dist/platform-procedures-X5DFJFV7.js +13 -0
  347. package/dist/{preferences-TYTGDXQZ.js → preferences-TWIXZBKS.js} +2 -2
  348. package/dist/{project-boot-SD7GM24K.js → project-boot-4NUH5FRU.js} +2 -2
  349. package/dist/{projection-worker-ZVOFHTXT.js → projection-worker-FZ7YSN3G.js} +5 -5
  350. package/dist/{prospective-memory-W6S67LZZ.js → prospective-memory-6D2ASWM3.js} +4 -4
  351. package/dist/{push-notifications-W5JRXLKJ.js → push-notifications-U6FIBQRW.js} +3 -3
  352. package/dist/{reranker-QATGTAPC.js → reranker-GYYRPANK.js} +3 -3
  353. package/dist/{retrieval-health-TWHKYCRK.js → retrieval-health-4Z242P3B.js} +1 -1
  354. package/dist/{review-polling-PCMD5BFN.js → review-polling-HXAFJZDA.js} +26 -24
  355. package/dist/runtime/index.js +37 -35
  356. package/dist/{session-events-3LCVQEL7.js → session-events-O3BV56ZX.js} +26 -24
  357. package/dist/{session-kill-telemetry-CZSPN5V6.js → session-kill-telemetry-AELE4JDK.js} +26 -24
  358. package/dist/session-mcp-config-YKNXG5DW.js +50 -0
  359. package/dist/{session-scope-CFHVSVAQ.js → session-scope-5EAPUT45.js} +25 -23
  360. package/dist/setup-wizard-NB6R4QVS.js +14 -0
  361. package/dist/{shard-manager-MBWQEYNG.js → shard-manager-35PWFR3B.js} +3 -3
  362. package/dist/{skill-refinement-74T6VDFM.js → skill-refinement-DVSYXBBP.js} +5 -5
  363. package/dist/stack-promote-RSOWO6EY.js +130 -0
  364. package/dist/{stack-release-XXMV7SPX.js → stack-release-HGFFFCGC.js} +112 -22
  365. package/dist/{stack-update-E2TKHHSQ.js → stack-update-ATCJFOEK.js} +7 -5
  366. package/dist/{steward-gate-WT7WXQIE.js → steward-gate-3GQ5XKMJ.js} +5 -5
  367. package/dist/support-inbox-4L62P4EP.js +33 -0
  368. package/dist/support-outbox-WHGPUYL2.js +16 -0
  369. package/dist/task-enforcement-IPIZX2MM.js +90 -0
  370. package/dist/{task-scope-CQEG5SSJ.js → task-scope-FOIW25HR.js} +27 -23
  371. package/dist/{tasks-crud-UGK5A25L.js → tasks-crud-HBDKE6C5.js} +35 -23
  372. package/dist/tasks-notify-G2U2U2YA.js +53 -0
  373. package/dist/{tasks-review-JKBRACII.js → tasks-review-27SFX5XN.js} +27 -23
  374. package/dist/{telemetry-upload-7LBYGPCB.js → telemetry-upload-ZOXHRWR5.js} +9 -9
  375. package/dist/tmux-command-guard-KSJKIX3C.js +117 -0
  376. package/dist/{token-budget-QBRJR4M5.js → token-budget-5Y4YPDO3.js} +5 -5
  377. package/dist/{tool-capability-index-Q6YQDL7I.js → tool-capability-index-VYF5GNJ2.js} +1 -1
  378. package/dist/{tool-telemetry-ULIDUK3P.js → tool-telemetry-KBXSBDTK.js} +1 -1
  379. package/dist/tui/App.js +40 -38
  380. package/dist/{tui-data-NPTGKT37.js → tui-data-NLFMBIQI.js} +25 -23
  381. package/dist/{update-check-HFO4VHO4.js → update-check-3FHAWIG2.js} +7 -3
  382. package/dist/update-support-UVUSZG7R.js +355 -0
  383. package/dist/{whatsapp-accounts-BWRZUY23.js → whatsapp-accounts-BFIOXYW5.js} +1 -1
  384. package/dist/{whatsapp-config-GOSELKTE.js → whatsapp-config-FAX6EA5K.js} +20 -13
  385. package/dist/{worker-gate-MXUQUG4M.js → worker-gate-3KUBAU32.js} +3 -3
  386. package/dist/{workflow-engine-EWCOLD47.js → workflow-engine-YITHXZR5.js} +2 -2
  387. package/dist/{working-memory-PY4AG577.js → working-memory-NUVB5SFV.js} +1 -1
  388. package/dist/worktree-LL62PLQB.js +47 -0
  389. package/dist/{worktree-sweep-ZAG3V24E.js → worktree-sweep-WTK3MTKH.js} +7 -7
  390. package/package.json +3 -2
  391. package/release-notes.json +86 -76
  392. package/dist/branch-hygiene-R5NVTRAY.js +0 -138
  393. package/dist/chunk-6IRVGOUL.js +0 -30
  394. package/dist/chunk-HMP5VT6A.js +0 -118
  395. package/dist/chunk-PVYR4FCQ.js +0 -113
  396. package/dist/chunk-UFAXZ2PY.js +0 -138
  397. package/dist/chunk-Y25OJWOQ.js +0 -45
  398. package/dist/chunk-YGAAZN3E.js +0 -47
  399. package/dist/cto-delegation-gate-DXNF5HVW.js +0 -290
  400. package/dist/dispatch-ack-4S44HBWB.js +0 -15
  401. package/dist/dreaming-OMFUEUCQ.js +0 -44
  402. package/dist/orchestrator-DUUX7FQV.js +0 -45
  403. package/dist/setup-wizard-TOFEJPLF.js +0 -13
  404. package/dist/tasks-notify-SMLDFBWM.js +0 -50
  405. package/dist/worktree-GVF2I5FP.js +0 -31
  406. /package/dist/{chunk-FLNSJ2TC.js → chunk-GIBYNT6W.js} +0 -0
  407. /package/dist/{chunk-NQBRGXYR.js → chunk-JRM4TAGS.js} +0 -0
  408. /package/dist/{chunk-WHRTDN5J.js → chunk-MGGOSFCR.js} +0 -0
  409. /package/dist/{chunk-D3QASX2W.js → chunk-QIFYLIUF.js} +0 -0
  410. /package/dist/{chunk-OADURIIN.js → chunk-WTH4CSAP.js} +0 -0
  411. /package/dist/{core-memory-VO5ZIBKH.js → core-memory-GAC6EWOQ.js} +0 -0
  412. /package/dist/{entity-boost-DNI4A5I7.js → entity-boost-NT6UO2Z3.js} +0 -0
  413. /package/dist/{message-queue-client-Q5BW3O5W.js → message-queue-client-4EOQRUXW.js} +0 -0
  414. /package/dist/{oauth-server-ROQFOEMM.js → oauth-server-67YBDP32.js} +0 -0
  415. /package/dist/{webhook-pipe-FZYLO6RR.js → webhook-pipe-LEXMUQ5B.js} +0 -0
  416. /package/dist/{wiki-acl-JA5UCQZ4.js → wiki-acl-74BLWG6J.js} +0 -0
  417. /package/dist/{wiki-client-VNDOBK63.js → wiki-client-EAN7F5LV.js} +0 -0
@@ -1,3 +1,10 @@
1
+ import {
2
+ daemonReadyPath,
3
+ eventLoopHeartbeatPath
4
+ } from "../chunk-MOPUCPXK.js";
5
+ import {
6
+ isSidechainTranscript
7
+ } from "../chunk-6IWLAQ7O.js";
1
8
  import {
2
9
  isCacheCold
3
10
  } from "../chunk-6A7P74QV.js";
@@ -6,80 +13,139 @@ import "../chunk-SH45SJQW.js";
6
13
  import {
7
14
  hybridSearch,
8
15
  lightweightSearch
9
- } from "../chunk-ZREGOV2Q.js";
16
+ } from "../chunk-N7QJKQMX.js";
10
17
  import "../chunk-AB4PAQYK.js";
11
18
  import {
12
19
  resolveHookSearchEnabled
13
20
  } from "../chunk-KWOAM7TA.js";
14
- import "../chunk-H37HHX3E.js";
21
+ import "../chunk-VSRPS3J7.js";
15
22
  import "../chunk-CHCA3ZM2.js";
16
23
  import "../chunk-OTVEIJUQ.js";
17
- import "../chunk-HHIBOU3P.js";
24
+ import "../chunk-6XWTQUO4.js";
25
+ import "../chunk-76CJBM36.js";
18
26
  import {
19
27
  getActiveAgent
20
- } from "../chunk-DZ6OQM67.js";
21
- import "../chunk-Y25OJWOQ.js";
28
+ } from "../chunk-5ERDIOV3.js";
29
+ import "../chunk-4QCFFW2H.js";
22
30
  import {
23
- countScopedPendingReviews,
24
31
  decideQueuedNudgeDrain,
32
+ getSessionState,
25
33
  isExeSession
26
- } from "../chunk-PLRIJALF.js";
27
- import "../chunk-OFX5B2S7.js";
28
- import "../chunk-B76TSEP3.js";
29
- import "../chunk-RLRT2BVM.js";
34
+ } from "../chunk-UP75Z5X7.js";
35
+ import "../chunk-L2R3LN2P.js";
36
+ import "../chunk-I26FWCSP.js";
37
+ import "../chunk-EV46QTD3.js";
38
+ import "../chunk-E23LNUWJ.js";
30
39
  import "../chunk-4JERP7NT.js";
31
40
  import "../chunk-EIKATSE4.js";
32
- import "../chunk-E23LNUWJ.js";
33
- import "../chunk-UIV2WPBT.js";
34
- import "../chunk-SSTLTIF3.js";
35
- import "../chunk-RMOBQ6A5.js";
36
- import "../chunk-54QCG45Y.js";
37
- import "../chunk-FUIIVSW6.js";
38
- import "../chunk-65SVQELL.js";
39
- import "../chunk-NGP6LSV2.js";
40
- import "../chunk-MW2GJJ53.js";
41
+ import "../chunk-KGWRTRKC.js";
42
+ import "../chunk-AD2VCHSS.js";
43
+ import "../chunk-WOYADZF5.js";
44
+ import "../chunk-SKGMF2SO.js";
45
+ import "../chunk-2WAVZ5UJ.js";
46
+ import "../chunk-HA5R6USD.js";
47
+ import "../chunk-AM7S2TY6.js";
48
+ import "../chunk-JGIPOUIK.js";
49
+ import "../chunk-GWDSB25T.js";
41
50
  import {
42
51
  getSessionKey
43
52
  } from "../chunk-CVYC6DUW.js";
44
- import "../chunk-2233TQCA.js";
45
- import "../chunk-HCJCW7X4.js";
53
+ import "../chunk-JLZ4RYSD.js";
54
+ import "../chunk-H7I47RS5.js";
46
55
  import {
47
56
  getProjectName
48
57
  } from "../chunk-OPU3NYOO.js";
49
- import "../chunk-7TS64TBG.js";
58
+ import "../chunk-G4RGKBCA.js";
50
59
  import "../chunk-AFNRE2RV.js";
51
- import "../chunk-3NGZ4PL7.js";
60
+ import "../chunk-X2Q5NLUL.js";
52
61
  import "../chunk-NLEW62VC.js";
53
62
  import "../chunk-HYZV25LY.js";
54
63
  import "../chunk-GJV3WDWM.js";
55
64
  import "../chunk-MP2AFCGL.js";
56
65
  import {
57
66
  canCoordinate
58
- } from "../chunk-HEPR6QTL.js";
67
+ } from "../chunk-AOHXREB7.js";
59
68
  import "../chunk-2I23RPSI.js";
60
- import "../chunk-ATOU6CYR.js";
69
+ import "../chunk-OLMQ4UOF.js";
61
70
  import "../chunk-PNQDP3OA.js";
62
71
  import "../chunk-H73TUI4Y.js";
63
72
  import "../chunk-7HLWBYH7.js";
64
73
  import "../chunk-FXU7JOXK.js";
65
- import "../chunk-Z42MXYWW.js";
66
- import "../chunk-XACL67CS.js";
67
- import "../chunk-5Z5NATNS.js";
74
+ import "../chunk-QWVXN224.js";
75
+ import "../chunk-NGP6LSV2.js";
76
+ import "../chunk-PQIDGXSG.js";
77
+ import "../chunk-K7KFGDWF.js";
68
78
  import {
69
79
  EXE_AI_DIR,
70
80
  loadConfig,
71
81
  loadConfigSync
72
- } from "../chunk-7Y5UDEVM.js";
82
+ } from "../chunk-WZHZCDDO.js";
73
83
  import {
74
84
  atomicWriteJsonSync,
75
85
  atomicWriteSync
76
- } from "../chunk-SHIICYJW.js";
86
+ } from "../chunk-BYTDMAGB.js";
77
87
  import "../chunk-MLKGABMK.js";
78
88
 
79
89
  // src/adapters/claude/hooks/prompt-submit.ts
80
- import { readFileSync, mkdirSync, existsSync, unlinkSync, statSync } from "fs";
90
+ import { readFileSync, mkdirSync, existsSync, unlinkSync, statSync as statSync2 } from "fs";
81
91
  import path from "path";
82
92
  import os from "os";
93
+
94
+ // src/lib/task-nudge-suppression.ts
95
+ var TASK_NUDGE_SUPPRESSED_AGENT_TYPES = [
96
+ "explore",
97
+ "plan",
98
+ "senior-architect-reviewer",
99
+ "code-reviewer"
100
+ ];
101
+ function isTaskNudgeSuppressedAgentType(agentType) {
102
+ const type = (agentType ?? "").trim().toLowerCase();
103
+ return type.length > 0 && TASK_NUDGE_SUPPRESSED_AGENT_TYPES.some((t) => type.includes(t));
104
+ }
105
+ function shouldSuppressTaskLifecycleNudges(input2) {
106
+ if (input2.isSidechain) return true;
107
+ return isTaskNudgeSuppressedAgentType(input2.agentType);
108
+ }
109
+
110
+ // src/lib/hook-daemon-liveness.ts
111
+ import { statSync } from "fs";
112
+ var DAEMON_ALIVE_FRESH_MS = 15e3;
113
+ var DAEMON_DEAD_MS = 6e4;
114
+ var CLOCK_SKEW_TOLERANCE_MS = 2e3;
115
+ function daemonLivenessPaths() {
116
+ return [eventLoopHeartbeatPath(), daemonReadyPath()];
117
+ }
118
+ function daemonLivenessAgeMs(nowMs = Date.now(), statFn = statSync) {
119
+ let freshest = null;
120
+ for (const p of daemonLivenessPaths()) {
121
+ try {
122
+ const age = nowMs - statFn(p).mtimeMs;
123
+ if (freshest === null || age < freshest) freshest = age;
124
+ } catch {
125
+ }
126
+ }
127
+ return freshest;
128
+ }
129
+ function classifyDaemonLiveness(ageMs) {
130
+ if (ageMs === null) return "down";
131
+ if (ageMs < CLOCK_SKEW_TOLERANCE_MS) return "alive";
132
+ if (ageMs < DAEMON_ALIVE_FRESH_MS) return "alive";
133
+ if (ageMs < DAEMON_DEAD_MS) return "busy";
134
+ return "down";
135
+ }
136
+ function daemonLivenessNotice(liveness, opts) {
137
+ if (liveness === "alive") return "";
138
+ if (liveness === "busy") {
139
+ const secs = Math.round((opts.ageMs ?? 0) / 1e3);
140
+ return `
141
+ \u23F3 Daemon busy (event loop lagging ~${secs}s) \u2014 MCP calls may be slow. The daemon is alive and recovers on its own; reconnecting will not help.
142
+ `;
143
+ }
144
+ if (opts.autoReconnecting) return "";
145
+ return "\n\u26A0\uFE0F MCP unreachable (daemon not running). Run /mcp to reconnect.\n";
146
+ }
147
+
148
+ // src/adapters/claude/hooks/prompt-submit.ts
83
149
  process.on("uncaughtException", (err) => {
84
150
  console.error(`[exe-os:hook:prompt-submit] FATAL: ${err instanceof Error ? err.stack ?? err.message : String(err)}`);
85
151
  process.exit(1);
@@ -90,7 +156,7 @@ process.on("unhandledRejection", (err) => {
90
156
  });
91
157
  process.env.EXE_HOOK_FAIL_OPEN = "1";
92
158
  try {
93
- const { verifyOrBlock } = await import("../hook-integrity-WURH6DS3.js");
159
+ const { verifyOrBlock } = await import("../hook-integrity-XY47IM7G.js");
94
160
  if (!await verifyOrBlock(new URL(import.meta.url).pathname)) process.exit(2);
95
161
  } catch (err) {
96
162
  const code = err?.code;
@@ -115,7 +181,14 @@ var CACHE_DIR = path.join(EXE_AI_DIR, "session-cache");
115
181
  var IS_CODEX_RUNTIME = process.env.EXE_RUNTIME?.toLowerCase() === "codex";
116
182
  var HOOK_FAIL_OPEN_MS = 4500;
117
183
  var HOOK_MEMORY_SEARCH_TIMEOUT_MS = 1200;
118
- var HOOK_DAEMON_INIT_TIMEOUT_MS = 500;
184
+ var HOOK_DAEMON_INIT_TIMEOUT_MS = 1500;
185
+ var HOOK_PREFETCH_TIMEOUT_MS = 800;
186
+ var NO_PREFETCH = {
187
+ unreadMessages: null,
188
+ pendingReviews: null,
189
+ openTasks: null,
190
+ remindersDue: null
191
+ };
119
192
  function withHookTimeout(promise, ms, fallback) {
120
193
  return new Promise((resolve) => {
121
194
  const timer = setTimeout(() => resolve(fallback), ms);
@@ -132,28 +205,60 @@ function withHookTimeout(promise, ms, fallback) {
132
205
  );
133
206
  });
134
207
  }
208
+ var OUTPUT_RESERVE_MS = 700;
209
+ var CONTEXT_DEADLINE_MS = HOOK_FAIL_OPEN_MS - OUTPUT_RESERVE_MS;
210
+ var HOOK_STARTED_AT = Date.now();
211
+ function remainingBudgetMs() {
212
+ return Math.max(0, CONTEXT_DEADLINE_MS - (Date.now() - HOOK_STARTED_AT));
213
+ }
214
+ function withBudget(promise, fallback) {
215
+ return withHookTimeout(promise, remainingBudgetMs(), fallback);
216
+ }
217
+ var _hookDbPromise = null;
218
+ function hookDb() {
219
+ _hookDbPromise ??= (async () => {
220
+ const { fastDbInit } = await import("../fast-db-init-4CWHSOOR.js");
221
+ return fastDbInit({ daemonOnly: true });
222
+ })();
223
+ return _hookDbPromise;
224
+ }
225
+ async function resolveHookDbClient() {
226
+ const client = await hookDb();
227
+ const { isInitialized } = await import("../lib/database.js");
228
+ return isInitialized() ? client : null;
229
+ }
135
230
  function agentTaskIds(agentId) {
136
231
  const baseId = agentId.replace(/\d+$/, "");
137
232
  return baseId !== agentId ? [agentId, baseId] : [agentId];
138
233
  }
139
- async function countOpenTasksForPromptHook(client, agentId, sessionScope, projectName) {
140
- if (!sessionScope || !projectName) return 0;
141
- const ids = agentTaskIds(agentId);
142
- const placeholders = ids.map(() => "?").join(", ");
143
- try {
144
- const result = await client.execute({
145
- sql: `SELECT COUNT(*) as cnt
146
- FROM tasks
147
- WHERE assigned_to IN (${placeholders})
148
- AND status = 'open'
149
- AND session_scope = ?
150
- AND project_name = ?`,
151
- args: [...ids, sessionScope, projectName]
152
- });
153
- return Number(result.rows[0]?.cnt ?? 0);
154
- } catch {
155
- return null;
234
+ function computeDiscoveryHints(prompt) {
235
+ const hints = [];
236
+ if (/\b(remind|deadline|schedule|due date|follow[- ]?up|tomorrow|next week)\b/i.test(prompt)) {
237
+ hints.push("task(action='reminder_create', text='...', due_date='YYYY-MM-DD') to set a reminder");
238
+ }
239
+ if (/\b(decision|decided|choosing|architecture|trade[- ]?off|we should|let'?s go with)\b/i.test(prompt)) {
240
+ hints.push("memory(action='decision_store', text='...', domain='...') to record this decision");
241
+ }
242
+ if (/\b(what did \w+ (do|work|build|fix)|ask \w+ about|check with \w+|has \w+ (done|finished|started))\b/i.test(prompt)) {
243
+ hints.push("memory(action='ask_team', team_member='...', query='...') to search a teammate's memory");
244
+ }
245
+ if (/\b(relationship|connected to|depends on|related to|linked|graph|entity|who (works|owns|manages))\b/i.test(prompt)) {
246
+ hints.push("graph(action='query_relationships', query='...') to explore knowledge graph connections");
247
+ }
248
+ if (/\b(where is .+ defined|who calls|blast radius|code search|find.*function|trace.*symbol|refactor)\b/i.test(prompt)) {
249
+ hints.push("code_context(action='search', query='...') for semantic code search");
250
+ }
251
+ if (/\b(from now on|never|always|rule:|when you|stop doing|start doing|remember to)\b/i.test(prompt)) {
252
+ hints.push("behavior(action='store', content='...', domain='workflow') to persist this as a behavioral rule");
253
+ }
254
+ if (/\b(wiki|documentation|knowledge base|how do we|onboarding|runbook|playbook)\b/i.test(prompt)) {
255
+ hints.push("wiki(action='search', query='...') to search the knowledge base");
256
+ }
257
+ if (/\b(bug report|found a bug|feature request|would be nice if|should we add)\b/i.test(prompt)) {
258
+ const isBug = /\bbug\b/i.test(prompt);
259
+ hints.push(isBug ? "support(action='create_bug', title='...', description='...') to file a bug report" : "support(action='create_feature', title='...', description='...') to file a feature request");
156
260
  }
261
+ return hints;
157
262
  }
158
263
  async function taskSignalStillOpenForPromptHook(client, taskId, agentId, sessionScope, projectName) {
159
264
  if (!taskId || !sessionScope || !projectName) return false;
@@ -206,7 +311,12 @@ process.stdin.on("end", async () => {
206
311
  try {
207
312
  const data = JSON.parse(input);
208
313
  const prompt = data.prompt;
314
+ const transcriptPath = data.transcript_path;
209
315
  const agent = getActiveAgent();
316
+ const suppressTaskLifecycleNudges = shouldSuppressTaskLifecycleNudges({
317
+ isSidechain: isSidechainTranscript(transcriptPath),
318
+ agentType: process.env.EXE_AGENT_TYPE ?? process.env.CLAUDE_SUBAGENT_TYPE ?? process.env.AGENT_TYPE
319
+ });
210
320
  const inTmux = !!(process.env.TMUX || process.env.TMUX_PANE);
211
321
  let _cachedSessionName = null;
212
322
  const getCurrentSessionName = () => {
@@ -238,11 +348,18 @@ process.stdin.on("end", async () => {
238
348
  }
239
349
  process.exit(0);
240
350
  }
241
- try {
242
- const { fastDbInit } = await import("../fast-db-init-QQB6IVWV.js");
243
- await withHookTimeout(fastDbInit(), HOOK_DAEMON_INIT_TIMEOUT_MS, null);
244
- } catch {
245
- }
351
+ void hookDb().catch(() => null);
352
+ let _dbClient = null;
353
+ const db = async () => {
354
+ if (_dbClient) return _dbClient;
355
+ const client = await withHookTimeout(
356
+ resolveHookDbClient().catch(() => null),
357
+ Math.min(HOOK_DAEMON_INIT_TIMEOUT_MS, remainingBudgetMs()),
358
+ null
359
+ );
360
+ if (client) _dbClient = client;
361
+ return client;
362
+ };
246
363
  if (!canCoordinate(agent.agentId, agent.agentRole)) {
247
364
  try {
248
365
  const { getReadMessages, markAcknowledged } = await import("../lib/messaging.js");
@@ -253,82 +370,6 @@ process.stdin.on("end", async () => {
253
370
  } catch {
254
371
  }
255
372
  }
256
- let drainedNudgeContext = "";
257
- if (inTmux) try {
258
- const currentSession = getCurrentSessionName();
259
- if (currentSession) {
260
- const { drainForSession, readQueue } = await import("../intercom-queue-VU2G6F5R.js");
261
- const { baseAgentName } = await import("../lib/employees.js");
262
- const queuedForMe = readQueue().filter((q) => q.targetSession === currentSession);
263
- if (queuedForMe.length > 0) {
264
- const MARKER_STALE_MS = 4 * 60 * 60 * 1e3;
265
- const hasInProgressTask = (agentName) => {
266
- try {
267
- const markerPath = path.join(os.homedir(), ".exe-os", "session-cache", `current-task-${agentName}.json`);
268
- if (!existsSync(markerPath)) return false;
269
- const stat = statSync(markerPath);
270
- if (Date.now() - stat.mtimeMs > MARKER_STALE_MS) {
271
- try {
272
- unlinkSync(markerPath);
273
- } catch {
274
- }
275
- return false;
276
- }
277
- return true;
278
- } catch {
279
- return false;
280
- }
281
- };
282
- let hasUnreadMessages = false;
283
- if (queuedForMe.some((q) => q.intercomReason === "message")) {
284
- try {
285
- const { countUnreadMessages } = await import("../lib/messaging.js");
286
- const count = await countUnreadMessages(agent.agentId);
287
- hasUnreadMessages = count > 0;
288
- } catch {
289
- }
290
- }
291
- let pendingReviewCount = null;
292
- if (queuedForMe.some((q) => q.intercomReason === "completion" || q.intercomReason === "notification")) {
293
- pendingReviewCount = await countScopedPendingReviews(currentSession, agent.agentId);
294
- }
295
- let openTaskCount = null;
296
- if (queuedForMe.some((q) => q.intercomReason === "nudge" || q.intercomReason === "signal" || !q.intercomReason)) {
297
- try {
298
- const { fastDbInit } = await import("../fast-db-init-QQB6IVWV.js");
299
- const client = await fastDbInit();
300
- const sessionScope = currentSession.includes("-") ? currentSession.split("-").pop() ?? "" : currentSession;
301
- openTaskCount = await countOpenTasksForPromptHook(client, agent.agentId, sessionScope || null, getProjectName());
302
- } catch {
303
- openTaskCount = null;
304
- }
305
- }
306
- drainForSession(currentSession, (session, item) => {
307
- try {
308
- const agentName = baseAgentName(session.split("-")[0] ?? session);
309
- const decision = decideQueuedNudgeDrain(item.intercomReason, {
310
- hasUnreadMessages,
311
- pendingReviewCount,
312
- openTaskCount,
313
- hasInProgressTask: hasInProgressTask(agentName)
314
- });
315
- if (decision.action === "drop") {
316
- console.error(
317
- `[exe-os:hook:prompt-submit] dropped stale ${item.intercomReason ?? "nudge"} intercom for ${session} (${decision.reason})`
318
- );
319
- return true;
320
- }
321
- drainedNudgeContext = `
322
- [\u{1F514} QUEUED NUDGE] ${decision.context}`;
323
- return true;
324
- } catch {
325
- return false;
326
- }
327
- });
328
- }
329
- }
330
- } catch {
331
- }
332
373
  const config = await loadConfig();
333
374
  let mcpStaleNotice = "";
334
375
  try {
@@ -363,66 +404,119 @@ process.stdin.on("end", async () => {
363
404
  } catch {
364
405
  daemonUp = false;
365
406
  }
366
- if (daemonUp && !mcpStaleNotice) {
407
+ const livenessAgeMs = daemonLivenessAgeMs();
408
+ const liveness = classifyDaemonLiveness(livenessAgeMs);
409
+ if (!mcpStaleNotice) {
410
+ mcpStaleNotice = daemonLivenessNotice(liveness, {
411
+ ageMs: livenessAgeMs,
412
+ autoReconnecting: daemonAutoReconnecting
413
+ });
414
+ }
415
+ if (liveness === "down") daemonUp = false;
416
+ const hookHybrid = resolveHookSearchEnabled(process.env.EXE_EMBEDDINGS, config);
417
+ const search = hookHybrid && daemonUp ? hybridSearch : lightweightSearch;
418
+ const currentSession = inTmux ? getCurrentSessionName() : "";
419
+ let queuedForMe = [];
420
+ if (currentSession && !suppressTaskLifecycleNudges) {
367
421
  try {
368
- const controller = new AbortController();
369
- const timeout2 = setTimeout(() => controller.abort(), 200);
370
- try {
371
- const resp = await fetch(`http://127.0.0.1:48739/health`, {
372
- method: "GET",
373
- signal: controller.signal
374
- });
375
- clearTimeout(timeout2);
376
- if (resp.ok) {
377
- let healthy = true;
378
- try {
379
- const body = await resp.json();
380
- if (body?.status && body.status !== "ok" && body.status !== "starting") {
381
- healthy = false;
382
- }
383
- } catch {
384
- }
385
- if (!healthy) {
386
- mcpStaleNotice = "\n\u26A0\uFE0F MCP degraded (daemon unresponsive). Run /mcp to reconnect.\n";
387
- }
388
- } else if (resp.status >= 500) {
389
- mcpStaleNotice = "\n\u26A0\uFE0F MCP degraded (daemon unresponsive). Run /mcp to reconnect.\n";
390
- }
391
- } catch {
392
- clearTimeout(timeout2);
393
- if (daemonAutoReconnecting) {
394
- } else {
395
- mcpStaleNotice = "\n\u26A0\uFE0F MCP unreachable (daemon may be overloaded). Run /mcp to reconnect.\n";
396
- }
397
- }
422
+ const { readQueue } = await import("../intercom-queue-ZFEQALR3.js");
423
+ queuedForMe = readQueue().filter((q) => q.targetSession === currentSession);
398
424
  } catch {
399
425
  }
400
426
  }
401
- const hookHybrid = resolveHookSearchEnabled(process.env.EXE_EMBEDDINGS, config);
402
- const search = hookHybrid && daemonUp ? hybridSearch : lightweightSearch;
403
427
  let cacheContext = "";
428
+ let cacheColdSessionUuid = null;
404
429
  try {
405
- const sessionKey = getSessionKey();
406
- const cacheStatus = isCacheCold(sessionKey);
430
+ const cacheStatus = isCacheCold(getSessionKey());
407
431
  if (cacheStatus.cold) {
408
432
  const idleMinutes = Number.isFinite(cacheStatus.idleMs) ? `${Math.max(1, Math.floor(cacheStatus.idleMs / 6e4))}m` : "5m+";
409
433
  if (!IS_CODEX_RUNTIME) {
410
434
  cacheContext = `## Cache Status
411
435
  \u26A0\uFE0F Cache cold (idle ${idleMinutes}). Next response will re-process the full context (higher cost). This is informational \u2014 no action needed.`;
412
436
  }
437
+ cacheColdSessionUuid = data.session_id;
438
+ }
439
+ } catch {
440
+ }
441
+ const hintsEnabled = !IS_CODEX_RUNTIME && agent.agentId !== "default" && daemonUp;
442
+ const discoveryHints = hintsEnabled ? computeDiscoveryHints(prompt) : [];
443
+ const promptSessionScope = currentSession.includes("-") ? currentSession.split("-").pop() ?? "" : currentSession;
444
+ let prefetch = { ...NO_PREFETCH };
445
+ const prefetchClient = await db();
446
+ if (prefetchClient) {
447
+ prefetch = await withHookTimeout(
448
+ (async () => {
449
+ const { prefetchPromptHookCounts } = await import("../hook-prefetch-PHRRKY4C.js");
450
+ return prefetchPromptHookCounts(prefetchClient, {
451
+ agentIds: agentTaskIds(agent.agentId),
452
+ agentId: agent.agentId,
453
+ targetSession: currentSession,
454
+ sessionScope: promptSessionScope || null,
455
+ projectName: getProjectName(),
456
+ needUnreadMessages: queuedForMe.some((q) => q.intercomReason === "message"),
457
+ needPendingReviews: queuedForMe.some(
458
+ (q) => q.intercomReason === "completion" || q.intercomReason === "notification"
459
+ ),
460
+ needOpenTasks: queuedForMe.some(
461
+ (q) => q.intercomReason === "nudge" || q.intercomReason === "signal" || !q.intercomReason
462
+ ),
463
+ needRemindersDue: hintsEnabled && discoveryHints.length === 0,
464
+ cacheColdSessionUuid
465
+ });
466
+ })(),
467
+ Math.min(HOOK_PREFETCH_TIMEOUT_MS, remainingBudgetMs()),
468
+ { ...NO_PREFETCH }
469
+ );
470
+ }
471
+ let drainedNudgeContext = "";
472
+ if (currentSession && queuedForMe.length > 0 && !suppressTaskLifecycleNudges) try {
473
+ const { drainForSession } = await import("../intercom-queue-ZFEQALR3.js");
474
+ const { baseAgentName } = await import("../lib/employees.js");
475
+ const MARKER_STALE_MS = 4 * 60 * 60 * 1e3;
476
+ const hasInProgressTask = (agentName) => {
413
477
  try {
414
- const { getClient } = await import("../lib/database.js");
415
- const client = getClient();
416
- void client.execute({
417
- sql: `UPDATE session_agent_map
418
- SET cache_cold_count = COALESCE(cache_cold_count, 0) + 1
419
- WHERE session_uuid = ?`,
420
- args: [data.session_id]
421
- }).catch(() => {
478
+ const markerPath = path.join(os.homedir(), ".exe-os", "session-cache", `current-task-${agentName}.json`);
479
+ if (!existsSync(markerPath)) return false;
480
+ const stat = statSync2(markerPath);
481
+ if (Date.now() - stat.mtimeMs > MARKER_STALE_MS) {
482
+ try {
483
+ unlinkSync(markerPath);
484
+ } catch {
485
+ }
486
+ return false;
487
+ }
488
+ return true;
489
+ } catch {
490
+ return false;
491
+ }
492
+ };
493
+ const hasUnreadMessages = (prefetch.unreadMessages ?? 0) > 0;
494
+ const pendingReviewCount = prefetch.pendingReviews;
495
+ const openTaskCount = prefetch.openTasks;
496
+ const currentSessionIdle = getSessionState(currentSession) === "idle";
497
+ drainForSession(currentSession, (session, item) => {
498
+ try {
499
+ const agentName = baseAgentName(session.split("-")[0] ?? session);
500
+ const decision = decideQueuedNudgeDrain(item.intercomReason, {
501
+ hasUnreadMessages,
502
+ pendingReviewCount,
503
+ openTaskCount,
504
+ hasInProgressTask: hasInProgressTask(agentName),
505
+ isIdle: currentSessionIdle
422
506
  });
507
+ if (decision.action === "drop") {
508
+ console.error(
509
+ `[exe-os:hook:prompt-submit] dropped stale ${item.intercomReason ?? "nudge"} intercom for ${session} (${decision.reason})`
510
+ );
511
+ return true;
512
+ }
513
+ drainedNudgeContext = `
514
+ [\u{1F514} QUEUED NUDGE] ${decision.context}`;
515
+ return true;
423
516
  } catch {
517
+ return false;
424
518
  }
425
- }
519
+ });
426
520
  } catch {
427
521
  }
428
522
  let memoryContext = "";
@@ -433,7 +527,7 @@ process.stdin.on("end", async () => {
433
527
  agent.agentId,
434
528
  { limit: 5 }
435
529
  ),
436
- HOOK_MEMORY_SEARCH_TIMEOUT_MS,
530
+ Math.min(HOOK_MEMORY_SEARCH_TIMEOUT_MS, remainingBudgetMs()),
437
531
  []
438
532
  );
439
533
  if (memories.length > 0) {
@@ -462,8 +556,8 @@ ${fresh.map(
462
556
  atomicWriteSync(counterPath, String(count));
463
557
  const BEHAVIOR_REINJECT_INTERVAL = 50;
464
558
  if (count === 1 || count % BEHAVIOR_REINJECT_INTERVAL === 0) {
465
- const { listBehaviors } = await import("../behaviors-HLZUJSMP.js");
466
- const behaviors = await listBehaviors(agent.agentId);
559
+ const { listBehaviors } = await import("../behaviors-KYRB3NGJ.js");
560
+ const behaviors = await withBudget(listBehaviors(agent.agentId), []);
467
561
  const active = behaviors.filter((b) => b.active !== 0).sort((a, b) => (a.priority === "p0" ? -1 : 1) - (b.priority === "p0" ? -1 : 1)).slice(0, 15);
468
562
  if (active.length > 0) {
469
563
  const reflexBehaviors = active.filter((b) => b.domain === "reflex");
@@ -502,8 +596,8 @@ ${parts.join("\n\n")}`;
502
596
  if (!lastCheckedAt) {
503
597
  lastCheckedAt = "1970-01-01T00:00:00.000Z";
504
598
  }
505
- const { listBehaviorsSince } = await import("../behaviors-HLZUJSMP.js");
506
- const newBehaviors = await listBehaviorsSince(agent.agentId, lastCheckedAt);
599
+ const { listBehaviorsSince } = await import("../behaviors-KYRB3NGJ.js");
600
+ const newBehaviors = await withBudget(listBehaviorsSince(agent.agentId, lastCheckedAt), []);
507
601
  if (newBehaviors.length > 0) {
508
602
  const newReflex = newBehaviors.filter((b) => b.domain === "reflex");
509
603
  const newRegular = newBehaviors.filter((b) => b.domain !== "reflex");
@@ -570,7 +664,7 @@ ${body}`;
570
664
  let reviewContext = "";
571
665
  if (canCoordinate(agent.agentId, agent.agentRole)) {
572
666
  try {
573
- const { countPendingReviews, countNewPendingReviewsSince } = await import("../tasks-review-JKBRACII.js");
667
+ const { countPendingReviews, countNewPendingReviewsSince } = await import("../tasks-review-27SFX5XN.js");
574
668
  const sessionKey = getSessionKey();
575
669
  const lastCheckPath = path.join(CACHE_DIR, `review-lastcheck-${sessionKey}.json`);
576
670
  let sessionScope;
@@ -587,9 +681,9 @@ ${body}`;
587
681
  lastCheckedAt = readFileSync(lastCheckPath, "utf8").trim();
588
682
  } catch {
589
683
  }
590
- const totalCount = tmuxDetectionFailed ? 0 : await countPendingReviews(sessionScope, agent.agentId);
684
+ const totalCount = tmuxDetectionFailed ? 0 : await withBudget(countPendingReviews(sessionScope, agent.agentId), 0);
591
685
  if (totalCount > 0) {
592
- const newCount = lastCheckedAt ? await countNewPendingReviewsSince(lastCheckedAt, sessionScope, agent.agentId) : totalCount;
686
+ const newCount = lastCheckedAt ? await withBudget(countNewPendingReviewsSince(lastCheckedAt, sessionScope, agent.agentId), totalCount) : totalCount;
593
687
  const trimmedPrompt = prompt.trim().toLowerCase();
594
688
  const idleCommands = /* @__PURE__ */ new Set([
595
689
  "c",
@@ -627,15 +721,15 @@ IMPORTANT: After completing your current task, you MUST address the pending revi
627
721
  let coreMemoryContext = "";
628
722
  if (!IS_CODEX_RUNTIME && agent.agentId !== "default") {
629
723
  try {
630
- const { getCoreMemory, formatCoreMemoryBlock } = await import("../core-memory-VO5ZIBKH.js");
631
- const entries = await getCoreMemory(agent.agentId);
724
+ const { getCoreMemory, formatCoreMemoryBlock } = await import("../core-memory-GAC6EWOQ.js");
725
+ const entries = await withBudget(getCoreMemory(agent.agentId), []);
632
726
  const block = formatCoreMemoryBlock(entries);
633
727
  if (block) coreMemoryContext = block;
634
728
  } catch {
635
729
  }
636
730
  }
637
731
  let taskSignalContext = "";
638
- try {
732
+ if (!suppressTaskLifecycleNudges) try {
639
733
  const { readdirSync } = await import("fs");
640
734
  const agentPrefix = `${agent.agentId}.`;
641
735
  const priorityRank = { p0: 0, p1: 1, p2: 2 };
@@ -656,13 +750,7 @@ IMPORTANT: After completing your current task, you MUST address the pending revi
656
750
  const signalBase = path.join(os.homedir(), ".exe-os", "task-signals");
657
751
  const dirsToCheck = [];
658
752
  const signalProjectName = getProjectName();
659
- let signalDbClient = null;
660
- try {
661
- const { fastDbInit } = await import("../fast-db-init-QQB6IVWV.js");
662
- signalDbClient = await fastDbInit();
663
- } catch {
664
- signalDbClient = null;
665
- }
753
+ const signalDbClient = await db();
666
754
  if (signalSessionScope) {
667
755
  const scopedDir = path.join(signalBase, signalSessionScope);
668
756
  if (existsSync(scopedDir)) dirsToCheck.push(scopedDir);
@@ -683,12 +771,15 @@ IMPORTANT: After completing your current task, you MUST address the pending revi
683
771
  if (!signalDbClient) {
684
772
  continue;
685
773
  }
686
- const stillOpen = await taskSignalStillOpenForPromptHook(
687
- signalDbClient,
688
- sig.task_id,
689
- agent.agentId,
690
- signalSessionScope || null,
691
- signalProjectName
774
+ const stillOpen = await withBudget(
775
+ taskSignalStillOpenForPromptHook(
776
+ signalDbClient,
777
+ sig.task_id,
778
+ agent.agentId,
779
+ signalSessionScope || null,
780
+ signalProjectName
781
+ ),
782
+ null
692
783
  );
693
784
  if (stillOpen !== true) {
694
785
  if (stillOpen === false) {
@@ -718,7 +809,7 @@ IMPORTANT: After completing your current task, you MUST address the pending revi
718
809
 
719
810
  IMPORTANT: After completing your current task, you MUST address the new task above. Do not ignore it.`;
720
811
  try {
721
- const { writeDispatchAck } = await import("../dispatch-ack-4S44HBWB.js");
812
+ const { writeDispatchAck } = await import("../dispatch-ack-VYH3ONSS.js");
722
813
  writeDispatchAck(bestSignal.task_id, agent.agentId);
723
814
  } catch {
724
815
  }
@@ -727,7 +818,7 @@ IMPORTANT: After completing your current task, you MUST address the new task abo
727
818
  } catch {
728
819
  }
729
820
  try {
730
- const { recordOrchestrationEventBestEffort: recordOE } = await import("../orchestration-events-5SIJOE4H.js");
821
+ const { recordOrchestrationEventBestEffort: recordOE } = await import("../orchestration-events-WV4NWKZH.js");
731
822
  recordOE({
732
823
  eventType: "signal.consumed",
733
824
  source: "prompt-submit.hook",
@@ -741,7 +832,7 @@ IMPORTANT: After completing your current task, you MUST address the new task abo
741
832
  } catch {
742
833
  }
743
834
  let reviewSignalContext = "";
744
- try {
835
+ if (!suppressTaskLifecycleNudges) try {
745
836
  const signalBase = path.join(os.homedir(), ".exe-os", "task-signals");
746
837
  const reviewDirs = [];
747
838
  let reviewSessionScope = "";
@@ -794,10 +885,10 @@ IMPORTANT: After completing your current task, you MUST address the new task abo
794
885
  } catch {
795
886
  }
796
887
  let idleTaskContext = "";
797
- if (!taskSignalContext && agent.agentId !== "default" && !IS_CODEX_RUNTIME) {
888
+ if (!taskSignalContext && agent.agentId !== "default" && !IS_CODEX_RUNTIME && !suppressTaskLifecycleNudges) {
798
889
  try {
799
- const { fastDbInit } = await import("../fast-db-init-QQB6IVWV.js");
800
- const client = await fastDbInit();
890
+ const idleDb = await db();
891
+ if (!idleDb) throw new Error("no live daemon \u2014 idle task check skipped");
801
892
  let taskSessionScope = null;
802
893
  if (inTmux) {
803
894
  try {
@@ -810,78 +901,39 @@ IMPORTANT: After completing your current task, you MUST address the new task abo
810
901
  if (!taskSessionScope || !taskProjectName) throw new Error("unscoped idle task check skipped");
811
902
  const agentIds = agentTaskIds(agent.agentId);
812
903
  const agentPlaceholders = agentIds.map(() => "?").join(", ");
813
- const inProgressResult = await client.execute({
814
- sql: `SELECT COUNT(*) as cnt FROM tasks WHERE assigned_to IN (${agentPlaceholders}) AND status = 'in_progress' AND session_scope = ? AND project_name = ? LIMIT 1`,
815
- args: [...agentIds, taskSessionScope, taskProjectName]
816
- });
817
- const inProgressCount = Number(inProgressResult.rows[0]?.cnt ?? 0);
818
- if (inProgressCount === 0) {
819
- const openResult = await client.execute({
904
+ const [inProgressResult, openResult] = await withBudget(idleDb.batch([
905
+ {
906
+ sql: `SELECT COUNT(*) as cnt FROM tasks WHERE assigned_to IN (${agentPlaceholders}) AND status = 'in_progress' AND session_scope = ? AND project_name = ? LIMIT 1`,
907
+ args: [...agentIds, taskSessionScope, taskProjectName]
908
+ },
909
+ {
820
910
  sql: `SELECT id, title, priority FROM tasks WHERE assigned_to IN (${agentPlaceholders}) AND status = 'open' AND session_scope = ? AND project_name = ? ORDER BY priority ASC, created_at ASC LIMIT 1`,
821
911
  args: [...agentIds, taskSessionScope, taskProjectName]
822
- });
823
- if (openResult.rows.length > 0) {
824
- const nextTask = openResult.rows[0];
825
- const taskId = String(nextTask.id);
826
- const title = String(nextTask.title);
827
- const priority = String(nextTask.priority);
828
- idleTaskContext = `
912
+ }
913
+ ]), []);
914
+ const inProgressCount = Number(inProgressResult?.rows[0]?.cnt ?? 0);
915
+ if (inProgressCount === 0 && openResult && openResult.rows.length > 0) {
916
+ const nextTask = openResult.rows[0];
917
+ const taskId = String(nextTask.id);
918
+ const title = String(nextTask.title);
919
+ const priority = String(nextTask.priority);
920
+ idleTaskContext = `
829
921
  [IDLE TASK CHECK] You have open tasks but nothing in_progress. Next: "${title}" [${priority}]. Run get_task(task_id="${taskId}") and START WORKING NOW. Do not say "queue empty" or "waiting" \u2014 you have work.
830
922
  `;
831
- }
832
923
  }
833
924
  } catch {
834
925
  }
835
926
  }
836
927
  let discoveryHintsContext = "";
837
- if (!IS_CODEX_RUNTIME && agent.agentId !== "default" && daemonUp) {
838
- try {
839
- const hints = [];
840
- if (/\b(remind|deadline|schedule|due date|follow[- ]?up|tomorrow|next week)\b/i.test(prompt)) {
841
- hints.push("task(action='reminder_create', text='...', due_date='YYYY-MM-DD') to set a reminder");
842
- }
843
- if (/\b(decision|decided|choosing|architecture|trade[- ]?off|we should|let'?s go with)\b/i.test(prompt)) {
844
- hints.push("memory(action='decision_store', text='...', domain='...') to record this decision");
845
- }
846
- if (/\b(what did \w+ (do|work|build|fix)|ask \w+ about|check with \w+|has \w+ (done|finished|started))\b/i.test(prompt)) {
847
- hints.push("memory(action='ask_team', team_member='...', query='...') to search a teammate's memory");
848
- }
849
- if (/\b(relationship|connected to|depends on|related to|linked|graph|entity|who (works|owns|manages))\b/i.test(prompt)) {
850
- hints.push("graph(action='query_relationships', query='...') to explore knowledge graph connections");
851
- }
852
- if (/\b(where is .+ defined|who calls|blast radius|code search|find.*function|trace.*symbol|refactor)\b/i.test(prompt)) {
853
- hints.push("code_context(action='search', query='...') for semantic code search");
854
- }
855
- if (/\b(from now on|never|always|rule:|when you|stop doing|start doing|remember to)\b/i.test(prompt)) {
856
- hints.push("behavior(action='store', content='...', domain='workflow') to persist this as a behavioral rule");
857
- }
858
- if (/\b(wiki|documentation|knowledge base|how do we|onboarding|runbook|playbook)\b/i.test(prompt)) {
859
- hints.push("wiki(action='search', query='...') to search the knowledge base");
860
- }
861
- if (/\b(bug report|found a bug|feature request|would be nice if|should we add)\b/i.test(prompt)) {
862
- const isBug = /\bbug\b/i.test(prompt);
863
- hints.push(isBug ? "support(action='create_bug', title='...', description='...') to file a bug report" : "support(action='create_feature', title='...', description='...') to file a feature request");
864
- }
865
- if (hints.length === 0) {
866
- try {
867
- const { fastDbInit } = await import("../fast-db-init-QQB6IVWV.js");
868
- const client = await fastDbInit();
869
- const reminderResult = await client.execute({
870
- sql: `SELECT COUNT(*) as cnt FROM reminders WHERE completed_at IS NULL AND due_date IS NOT NULL AND due_date <= date('now', '+1 day')`,
871
- args: []
872
- });
873
- const dueCount = Number(reminderResult.rows[0]?.cnt ?? 0);
874
- if (dueCount > 0) {
875
- hints.push(`You have ${dueCount} reminder${dueCount === 1 ? "" : "s"} due soon. Use task(action='reminder_list') to see them.`);
876
- }
877
- } catch {
878
- }
879
- }
880
- if (hints.length > 0) {
881
- discoveryHintsContext = `
928
+ if (hintsEnabled) {
929
+ const hints = [...discoveryHints];
930
+ if (hints.length === 0 && (prefetch.remindersDue ?? 0) > 0) {
931
+ const dueCount = prefetch.remindersDue;
932
+ hints.push(`You have ${dueCount} reminder${dueCount === 1 ? "" : "s"} due soon. Use task(action='reminder_list') to see them.`);
933
+ }
934
+ if (hints.length > 0) {
935
+ discoveryHintsContext = `
882
936
  [Tool hints] ${hints.slice(0, 3).join(" | ")}`;
883
- }
884
- } catch {
885
937
  }
886
938
  }
887
939
  let typedMessageContext = "";
@@ -889,7 +941,7 @@ IMPORTANT: After completing your current task, you MUST address the new task abo
889
941
  try {
890
942
  const { getPendingMessages } = await import("../lib/messaging.js");
891
943
  const { parseMessage, isTypedMessage, formatTypedMessage } = await import("../typed-messages-TKDGVPHS.js");
892
- const pending = await getPendingMessages(agent.agentId);
944
+ const pending = await withBudget(getPendingMessages(agent.agentId), []);
893
945
  const typedSummaries = [];
894
946
  for (const msg of pending.slice(0, 5)) {
895
947
  const parsed = parseMessage(msg.content);
@@ -923,7 +975,7 @@ ${typedSummaries.join("\n---\n")}`;
923
975
  failed = true;
924
976
  }
925
977
  try {
926
- const { flushSupportOutbox } = await import("../support-outbox-MGUVVGHT.js");
978
+ const { flushSupportOutbox } = await import("../support-outbox-WHGPUYL2.js");
927
979
  void flushSupportOutbox();
928
980
  } catch {
929
981
  }
@@ -943,9 +995,8 @@ async function writePromptMemory(prompt, sessionId, agent) {
943
995
  return;
944
996
  }
945
997
  try {
946
- const { fastDbInit } = await import("../fast-db-init-QQB6IVWV.js");
947
- const { recordSessionEvent } = await import("../session-events-3LCVQEL7.js");
948
- const client = await fastDbInit();
998
+ const { recordSessionEvent } = await import("../session-events-O3BV56ZX.js");
999
+ const client = await hookDb();
949
1000
  await recordSessionEvent(client, {
950
1001
  agentId: agent.agentId,
951
1002
  agentRole: agent.agentRole,
@@ -959,7 +1010,7 @@ async function writePromptMemory(prompt, sessionId, agent) {
959
1010
  }
960
1011
  if (!loadConfigSync().autoIngestion) return;
961
1012
  try {
962
- const { writeMemoryViaDaemon } = await import("../memory-queue-client-BKQHTYTH.js");
1013
+ const { writeMemoryViaDaemon } = await import("../memory-queue-client-O5U6F6XP.js");
963
1014
  const trimmed = prompt.trim();
964
1015
  const isSlashCommand = trimmed.startsWith("/");
965
1016
  const isDirective = /\b(from now on|never|always|rule:|decision:|policy:)\b/i.test(trimmed);