@askexenow/exe-os 0.9.150 → 0.9.154

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 (215) hide show
  1. package/dist/{active-agent-HDUT3T3I.js → active-agent-IVY5D7DJ.js} +2 -2
  2. package/dist/{active-agent-XHERKXH6.js → active-agent-JN7A2D2E.js} +2 -2
  3. package/dist/{agentic-ontology-GMK3MB3U.js → agentic-ontology-NU5FACOX.js} +1 -1
  4. package/dist/{backfill-metadata-7IANPCAL.js → backfill-metadata-XBWBPBN2.js} +3 -3
  5. package/dist/{behaviors-JG75DNG3.js → behaviors-4USTCRU7.js} +2 -2
  6. package/dist/bin/agentic-ontology-backfill.js +4 -4
  7. package/dist/bin/agentic-reflection-backfill.js +5 -5
  8. package/dist/bin/agentic-semantic-label.js +4 -4
  9. package/dist/bin/backfill-conversations.js +3 -3
  10. package/dist/bin/backfill-responses.js +3 -3
  11. package/dist/bin/backfill-vectors.js +4 -4
  12. package/dist/bin/bulk-sync-postgres.js +8 -7
  13. package/dist/bin/cc-doctor.js +1 -1
  14. package/dist/bin/cleanup-stale-review-tasks.js +7 -7
  15. package/dist/bin/cli.js +12 -12
  16. package/dist/bin/exe-agent-config.js +1 -1
  17. package/dist/bin/exe-agent.js +8 -8
  18. package/dist/bin/exe-assign.js +4 -4
  19. package/dist/bin/exe-boot.js +15 -15
  20. package/dist/bin/exe-call.js +4 -4
  21. package/dist/bin/exe-cloud.js +3 -3
  22. package/dist/bin/exe-dispatch.js +7 -7
  23. package/dist/bin/exe-doctor.js +1 -1
  24. package/dist/bin/exe-export-behaviors.js +6 -6
  25. package/dist/bin/exe-forget.js +5 -5
  26. package/dist/bin/exe-gateway.js +5 -5
  27. package/dist/bin/exe-healthcheck.js +1 -1
  28. package/dist/bin/exe-heartbeat.js +7 -7
  29. package/dist/bin/exe-kill.js +10 -10
  30. package/dist/bin/exe-launch-agent.js +10 -10
  31. package/dist/bin/exe-new-employee.js +6 -6
  32. package/dist/bin/exe-pending-messages.js +8 -8
  33. package/dist/bin/exe-pending-notifications.js +7 -7
  34. package/dist/bin/exe-pending-reviews.js +7 -7
  35. package/dist/bin/exe-rename.js +4 -4
  36. package/dist/bin/exe-review.js +9 -9
  37. package/dist/bin/exe-search.js +4 -4
  38. package/dist/bin/exe-session-cleanup.js +14 -14
  39. package/dist/bin/exe-settings.js +3 -3
  40. package/dist/bin/exe-start-codex.js +10 -10
  41. package/dist/bin/exe-start-opencode.js +7 -7
  42. package/dist/bin/exe-status.js +8 -8
  43. package/dist/bin/exe-team.js +2 -2
  44. package/dist/bin/git-sweep.js +7 -7
  45. package/dist/bin/graph-backfill.js +3 -3
  46. package/dist/bin/graph-export.js +4 -4
  47. package/dist/bin/install.js +5 -5
  48. package/dist/bin/intercom-check.js +4 -4
  49. package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
  50. package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
  51. package/dist/bin/pre-publish.js +1 -1
  52. package/dist/bin/scan-tasks.js +7 -7
  53. package/dist/bin/setup.js +1 -1
  54. package/dist/bin/shard-migrate.js +3 -3
  55. package/dist/{capacity-monitor-J3SVO7LJ.js → capacity-monitor-VJLRBE7S.js} +8 -8
  56. package/dist/{catchup-brief-AIFZT456.js → catchup-brief-T2RPTOTZ.js} +9 -9
  57. package/dist/{chunk-DMBFPZOP.js → chunk-23H5ZURC.js} +8 -8
  58. package/dist/{chunk-DJVXUJIR.js → chunk-2BTXFKAV.js} +73 -74
  59. package/dist/{chunk-MBYJEE3B.js → chunk-2G2KOWBI.js} +12 -0
  60. package/dist/{chunk-WLSSSDAR.js → chunk-2GUTGEFX.js} +1 -1
  61. package/dist/{chunk-FSH4VWSL.js → chunk-3CZBCOYI.js} +2 -2
  62. package/dist/{chunk-GPHURFBS.js → chunk-3I44JXWH.js} +2 -2
  63. package/dist/{chunk-5NSTNICM.js → chunk-3OGN523Z.js} +1 -1
  64. package/dist/{chunk-3VHX5XFJ.js → chunk-3RJBXMWJ.js} +1 -1
  65. package/dist/{chunk-3JR37K7C.js → chunk-3S2HQUP6.js} +12 -8
  66. package/dist/{chunk-Z43CJQ7T.js → chunk-45APPAB2.js} +61 -22
  67. package/dist/{chunk-IGYF67K3.js → chunk-5KUJDZ3J.js} +3 -3
  68. package/dist/{chunk-LJX5SV6L.js → chunk-66RYFM6Z.js} +5 -5
  69. package/dist/{chunk-26VUCVSE.js → chunk-6M65LFNM.js} +2 -2
  70. package/dist/{chunk-3TXOH3SJ.js → chunk-A7KEWR6S.js} +1 -1
  71. package/dist/{chunk-GIAAHYMW.js → chunk-ABVCJBON.js} +2 -2
  72. package/dist/{chunk-SFV2XRPY.js → chunk-AL7JZARP.js} +1 -1
  73. package/dist/{chunk-7JTZNHA4.js → chunk-DMUNYW65.js} +25 -17
  74. package/dist/{chunk-BQ3KXWA7.js → chunk-DTT4TRFR.js} +1 -1
  75. package/dist/{chunk-72XIEBYJ.js → chunk-DWLDYEGO.js} +6 -6
  76. package/dist/{chunk-MNIJA5BL.js → chunk-F2WGMIFZ.js} +1 -1
  77. package/dist/{chunk-XEH3USTI.js → chunk-G7IQNOSY.js} +1 -1
  78. package/dist/{chunk-EOU4ZLRZ.js → chunk-GCB4MHTG.js} +1 -1
  79. package/dist/{chunk-X2XE65WV.js → chunk-H5STRY47.js} +9 -4
  80. package/dist/{chunk-WR45FP7O.js → chunk-HYRYMZRT.js} +2 -2
  81. package/dist/{chunk-LM7TQYLW.js → chunk-IWSXQKSB.js} +1 -1
  82. package/dist/{chunk-ODEGQCWW.js → chunk-K23KJITV.js} +3 -3
  83. package/dist/{chunk-O2Y4WJYW.js → chunk-KSOPUPQX.js} +196 -9
  84. package/dist/{chunk-EEXG4ZJS.js → chunk-KUPUTWQX.js} +9 -9
  85. package/dist/{chunk-5NQKE3X4.js → chunk-L3JRSHHU.js} +2 -2
  86. package/dist/{chunk-4WIWYUU2.js → chunk-LHMOPUZE.js} +2 -2
  87. package/dist/{chunk-UHL4QL5E.js → chunk-LVEOCWPL.js} +1 -1
  88. package/dist/{chunk-IT2JDL5L.js → chunk-MLL5ICNL.js} +17 -12
  89. package/dist/{chunk-XWQKCCCO.js → chunk-MWRHXGAB.js} +7 -0
  90. package/dist/{chunk-JM4A2E5A.js → chunk-NL4YO6I2.js} +1 -1
  91. package/dist/{chunk-EYTMNAU7.js → chunk-OC7Q4LOK.js} +19 -9
  92. package/dist/{chunk-DSKUPORS.js → chunk-OHYMA6C3.js} +2 -2
  93. package/dist/{chunk-7HONLLJ2.js → chunk-OSPZOCPU.js} +3 -3
  94. package/dist/{chunk-LLDY5HPV.js → chunk-PE6NCL7A.js} +1 -1
  95. package/dist/{chunk-GJMHN45Z.js → chunk-Q7TTJD4A.js} +1 -1
  96. package/dist/{chunk-RAMU6E5T.js → chunk-SE2DYYVB.js} +1 -1
  97. package/dist/{chunk-CRS6YTBM.js → chunk-SFZUC72J.js} +2 -2
  98. package/dist/{chunk-OEPEY47B.js → chunk-T2B7637C.js} +1 -1
  99. package/dist/{chunk-BR5UVRA2.js → chunk-TH2OFEQH.js} +1 -1
  100. package/dist/{chunk-ZGKU4PMY.js → chunk-TME75K53.js} +2 -2
  101. package/dist/{chunk-XQSGAG2G.js → chunk-UIAYIZNR.js} +2 -2
  102. package/dist/{chunk-BV2JVO2U.js → chunk-ULFBLCIP.js} +1 -1
  103. package/dist/{chunk-UPAEAL6K.js → chunk-UREIHGOQ.js} +3 -3
  104. package/dist/{chunk-Q7GVSS2J.js → chunk-VRKPBY6D.js} +1 -1
  105. package/dist/{chunk-4K7HJL37.js → chunk-VZDPV32D.js} +3 -3
  106. package/dist/{chunk-RLCZBSUB.js → chunk-X347L57O.js} +12 -0
  107. package/dist/{chunk-CO2SF5SB.js → chunk-XEN5RMGU.js} +1 -1
  108. package/dist/{chunk-TCKZYGC5.js → chunk-XYFPCAA2.js} +2 -2
  109. package/dist/{chunk-LBX2VQCC.js → chunk-Y3Z6QHUR.js} +2 -2
  110. package/dist/{crdt-sync-3VQP2ISB.js → crdt-sync-B7IUR3BR.js} +1 -1
  111. package/dist/{crm-webhook-AJYXEFZD.js → crm-webhook-YU7PDS7U.js} +2 -2
  112. package/dist/{cto-delegation-gate-7OIN66NU.js → cto-delegation-gate-JDDOHVQL.js} +6 -6
  113. package/dist/{daemon-orchestration-EHONVEHN.js → daemon-orchestration-5OYKXYSR.js} +9 -9
  114. package/dist/{exe-drift-L5ZHO3CZ.js → exe-drift-DXRU4SXJ.js} +2 -2
  115. package/dist/{exe-export-IVFME5VN.js → exe-export-X3AWJONG.js} +5 -5
  116. package/dist/{exe-import-O76AYBUE.js → exe-import-GC5HO3TD.js} +5 -5
  117. package/dist/{exe-key-6HV5GYHH.js → exe-key-R3ER4MYY.js} +1 -1
  118. package/dist/{fast-db-init-NCOIEAM6.js → fast-db-init-5DTYG5FZ.js} +1 -1
  119. package/dist/gateway/index.js +9 -9
  120. package/dist/{git-staleness-MSTOMG55.js → git-staleness-SVUTMS2F.js} +1 -1
  121. package/dist/{git-task-sweep-NOXCELFQ.js → git-task-sweep-EQHX4LXT.js} +7 -7
  122. package/dist/{global-procedures-FXWQ35RU.js → global-procedures-P7VOE476.js} +3 -3
  123. package/dist/{graph-auto-extract-D4I7DF2S.js → graph-auto-extract-UI374EYL.js} +1 -1
  124. package/dist/{hook-integrity-PR4BPZBT.js → hook-integrity-SA7S2SNI.js} +1 -1
  125. package/dist/hooks/bug-report-worker.js +8 -8
  126. package/dist/hooks/codex-stop-task-finalizer.js +8 -8
  127. package/dist/hooks/commit-complete.js +9 -9
  128. package/dist/hooks/error-recall.js +5 -5
  129. package/dist/hooks/exe-heartbeat-hook.js +2 -2
  130. package/dist/hooks/ingest.js +9 -9
  131. package/dist/hooks/instructions-loaded.js +3 -3
  132. package/dist/hooks/notification.js +3 -3
  133. package/dist/hooks/post-compact.js +8 -8
  134. package/dist/hooks/post-tool-combined.js +4 -4
  135. package/dist/hooks/pre-compact.js +9 -9
  136. package/dist/hooks/pre-tool-use.js +34 -12
  137. package/dist/hooks/prompt-submit.js +111 -47
  138. package/dist/hooks/session-end.js +13 -13
  139. package/dist/hooks/session-start.js +7 -7
  140. package/dist/hooks/stop.js +12 -12
  141. package/dist/hooks/subagent-stop.js +8 -8
  142. package/dist/hooks/summary-worker.js +12 -12
  143. package/dist/index.js +16 -16
  144. package/dist/{installer-Q4IWV2GB.js → installer-L72MRJPI.js} +4 -4
  145. package/dist/{installer-5NAISFMT.js → installer-LX2TU7RS.js} +4 -4
  146. package/dist/{installer-FTGXXYRA.js → installer-SLJ3YCHB.js} +4 -4
  147. package/dist/lib/cloud-sync.js +3 -3
  148. package/dist/lib/consolidation.js +4 -4
  149. package/dist/lib/database.js +1 -1
  150. package/dist/lib/db.js +1 -1
  151. package/dist/lib/employee-templates.js +4 -4
  152. package/dist/lib/employees.js +1 -1
  153. package/dist/lib/exe-daemon.js +86 -44
  154. package/dist/lib/hybrid-search.js +4 -4
  155. package/dist/lib/identity.js +1 -1
  156. package/dist/lib/messaging.js +7 -7
  157. package/dist/lib/reminders.js +2 -2
  158. package/dist/lib/schedules.js +4 -4
  159. package/dist/lib/skill-learning.js +3 -3
  160. package/dist/lib/store.js +3 -3
  161. package/dist/lib/task-router.js +2 -2
  162. package/dist/lib/tasks.js +7 -7
  163. package/dist/lib/tmux-routing.js +6 -6
  164. package/dist/lib/tmux-transport.js +1 -1
  165. package/dist/lib/token-spend.js +2 -2
  166. package/dist/lib/transport.js +2 -2
  167. package/dist/mcp/register-tools.js +46 -46
  168. package/dist/mcp/server.js +47 -47
  169. package/dist/mcp/tools/complete-reminder.js +3 -3
  170. package/dist/mcp/tools/create-reminder.js +3 -3
  171. package/dist/mcp/tools/create-task.js +9 -9
  172. package/dist/mcp/tools/deactivate-behavior.js +4 -4
  173. package/dist/mcp/tools/list-reminders.js +3 -3
  174. package/dist/mcp/tools/list-tasks.js +9 -9
  175. package/dist/mcp/tools/send-message.js +9 -9
  176. package/dist/mcp/tools/update-task.js +8 -8
  177. package/dist/{mcp-http-config-PSQCITKG.js → mcp-http-config-T76QB243.js} +2 -2
  178. package/dist/{memory-cards-SYVGSLXW.js → memory-cards-NTRYLVOU.js} +1 -1
  179. package/dist/{memory-poisoning-defense-T7AC4LZN.js → memory-poisoning-defense-OJ2DEGBA.js} +1 -1
  180. package/dist/{memory-reflection-FNJU7VFC.js → memory-reflection-4YOUTIMO.js} +1 -1
  181. package/dist/{notifications-LD563XOM.js → notifications-SF2XN5JE.js} +6 -6
  182. package/dist/{orchestrator-WQGPXMLN.js → orchestrator-2W3VNAKG.js} +8 -8
  183. package/dist/{plan-limits-IAUNTZUW.js → plan-limits-LEM76SOQ.js} +2 -2
  184. package/dist/{projection-worker-S6LYSY22.js → projection-worker-RQHV4VIR.js} +1 -1
  185. package/dist/{push-notifications-KDYFOJRI.js → push-notifications-NSYLKFXR.js} +1 -1
  186. package/dist/{review-polling-J3R7MLT4.js → review-polling-HD26LRW2.js} +7 -7
  187. package/dist/runtime/index.js +13 -13
  188. package/dist/{session-events-XDDQ3M4A.js → session-events-NYMENC3B.js} +7 -7
  189. package/dist/{session-kill-telemetry-TX5NCPUV.js → session-kill-telemetry-LJU2MMZC.js} +2 -2
  190. package/dist/{session-scope-6MAGVHBA.js → session-scope-QIDIKKFB.js} +6 -6
  191. package/dist/{setup-wizard-WJ73A2FY.js → setup-wizard-ANL7CVWX.js} +1 -1
  192. package/dist/signal-paths-4GOIRLGH.js +19 -0
  193. package/dist/skill-refinement-3W3CIIG3.js +156 -0
  194. package/dist/{task-enforcement-3RV64YVR.js → task-enforcement-YXEOTTUG.js} +6 -6
  195. package/dist/{task-scope-2T3WIQQY.js → task-scope-XXPTORGS.js} +6 -6
  196. package/dist/{tasks-crud-B2BGA44L.js → tasks-crud-3UCNTXKQ.js} +6 -6
  197. package/dist/{tasks-review-ZO3QDMT7.js → tasks-review-IPOWGI4L.js} +6 -6
  198. package/dist/{token-budget-LJC7HHKB.js → token-budget-NP22DW2M.js} +1 -1
  199. package/dist/{tool-telemetry-L3WQDRMH.js → tool-telemetry-5JF2OAHG.js} +1 -1
  200. package/dist/tui/App.js +15 -15
  201. package/dist/{tui-data-UAPARPDX.js → tui-data-Z7FCER3K.js} +6 -6
  202. package/dist/{worker-gate-TG6PR2S5.js → worker-gate-PJYHXNUB.js} +1 -1
  203. package/dist/{workflow-engine-VIFLD5IV.js → workflow-engine-GA7JS7X2.js} +2 -2
  204. package/package.json +1 -1
  205. package/release-notes.json +194 -194
  206. /package/dist/{chunk-34XNU32S.js → chunk-7E6ZBXO7.js} +0 -0
  207. /package/dist/{chunk-PJCTBGWN.js → chunk-7U664OM4.js} +0 -0
  208. /package/dist/{chunk-BRXDLJBU.js → chunk-LYMBXTEO.js} +0 -0
  209. /package/dist/{chunk-VN6UUZNO.js → chunk-NQND3GFO.js} +0 -0
  210. /package/dist/{chunk-OU7SLHNA.js → chunk-PBBIAKN5.js} +0 -0
  211. /package/dist/{chunk-II3NQJGV.js → chunk-UJ2KUF4C.js} +0 -0
  212. /package/dist/{chunk-OLVZBBVO.js → chunk-Z6UYJ7HZ.js} +0 -0
  213. /package/dist/{chunk-BF4W2VDS.js → chunk-ZYETFCDX.js} +0 -0
  214. /package/dist/{core-memory-MT7P34HU.js → core-memory-KL5BOUXU.js} +0 -0
  215. /package/dist/{wiki-acl-UE3CRAPQ.js → wiki-acl-ZRCU7XYC.js} +0 -0
@@ -3,13 +3,17 @@ import {
3
3
  buildRawVisibilityFilter,
4
4
  buildWikiScopeFilter,
5
5
  searchMemories
6
- } from "./chunk-72XIEBYJ.js";
6
+ } from "./chunk-DWLDYEGO.js";
7
7
  import {
8
8
  getClient
9
- } from "./chunk-MBYJEE3B.js";
9
+ } from "./chunk-2G2KOWBI.js";
10
10
 
11
11
  // src/lib/hybrid-search.ts
12
12
  var RRF_K = 60;
13
+ var ABSTENTION_THRESHOLD = parseFloat(
14
+ process.env.EXE_ABSTENTION_THRESHOLD ?? "0.015"
15
+ );
16
+ var CONTRADICTION_TEMPORAL_BOOST = 1.5;
13
17
  function buildTemporalFilter(options, columnPrefix) {
14
18
  const asOf = options?.asOf;
15
19
  if (asOf) {
@@ -34,6 +38,76 @@ function appendMemoryTypeFilter(sql, args, column, options) {
34
38
  }
35
39
  return sql;
36
40
  }
41
+ function extractEntitySubqueries(query) {
42
+ const subqueries = [];
43
+ const quoted = query.match(/"([^"]+)"/g);
44
+ if (quoted) {
45
+ for (const q of quoted) {
46
+ subqueries.push(q.replace(/"/g, ""));
47
+ }
48
+ }
49
+ const words = query.split(/\s+/);
50
+ const properNouns = [];
51
+ for (let i = 1; i < words.length; i++) {
52
+ const word = words[i].replace(/[^a-zA-Z]/g, "");
53
+ if (word.length >= 2 && /^[A-Z]/.test(word) && !/^(What|When|Where|Who|How|Why|Which|Does|Did|Is|Are|Was|Were|Has|Have|Had|Can|Could|Would|Should|Do|The|And|But|For|Not|You|Your|His|Her|Its|Our|Their|This|That|These|Those)$/.test(word)) {
54
+ properNouns.push(word);
55
+ }
56
+ }
57
+ if (properNouns.length > 0) {
58
+ subqueries.push(properNouns.join(" "));
59
+ }
60
+ const prepPatterns = /(?:about|regarding|concerning|towards?|with|for|against)\s+(.+?)(?:\?|$|,|\band\b)/gi;
61
+ let match;
62
+ while ((match = prepPatterns.exec(query)) !== null) {
63
+ const phrase = match[1].trim();
64
+ if (phrase.length >= 3 && phrase.split(/\s+/).length <= 5) {
65
+ subqueries.push(phrase);
66
+ }
67
+ }
68
+ return [...new Set(subqueries)].slice(0, 3);
69
+ }
70
+ function resolveContradictions(results) {
71
+ if (results.length < 2) return results;
72
+ const entityGroups = /* @__PURE__ */ new Map();
73
+ for (const r of results) {
74
+ const words = (r.raw_text ?? "").toLowerCase().replace(/[^a-z0-9\s]/g, "").split(/\s+/).filter((w) => w.length >= 4).slice(0, 3);
75
+ if (words.length < 2) continue;
76
+ const key = words.join("|");
77
+ for (const [existingKey, group] of entityGroups) {
78
+ const existingWords = new Set(existingKey.split("|"));
79
+ const overlapCount = words.filter((w) => existingWords.has(w)).length;
80
+ if (overlapCount >= 2) {
81
+ group.push(r);
82
+ entityGroups.set(existingKey, group);
83
+ break;
84
+ }
85
+ }
86
+ const existing = entityGroups.get(key) ?? [];
87
+ existing.push(r);
88
+ entityGroups.set(key, existing);
89
+ }
90
+ const temporalBoosts = /* @__PURE__ */ new Map();
91
+ for (const [, group] of entityGroups) {
92
+ if (group.length < 2) continue;
93
+ const sorted = [...group].sort(
94
+ (a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()
95
+ );
96
+ for (let i = 0; i < sorted.length; i++) {
97
+ const id = sorted[i].id;
98
+ const boost = i === 0 ? CONTRADICTION_TEMPORAL_BOOST : 1 / (1 + i * 0.3);
99
+ temporalBoosts.set(id, Math.max(temporalBoosts.get(id) ?? 0, boost));
100
+ }
101
+ }
102
+ if (temporalBoosts.size === 0) return results;
103
+ const scored = results.map((r, i) => {
104
+ const baseScore = 1 / (1 + i * 0.1);
105
+ const contradiction = temporalBoosts.get(r.id) ?? 1;
106
+ return { record: r, score: baseScore * contradiction };
107
+ });
108
+ scored.sort((a, b) => b.score - a.score);
109
+ return scored.map((s) => s.record);
110
+ }
37
111
  async function hybridSearch(queryText, agentId, options) {
38
112
  const { loadConfig } = await import("./lib/config.js");
39
113
  const config = await loadConfig();
@@ -112,13 +186,17 @@ async function hybridSearch(queryText, agentId, options) {
112
186
  } catch {
113
187
  }
114
188
  }
189
+ const entitySubqueries = extractEntitySubqueries(effectiveQuery);
190
+ const subqueryPromises = entitySubqueries.map(
191
+ (sq) => lightweightSearch(sq, agentId, { ...fetchOptions, limit: Math.min(fetchLimit, 20) }).catch(() => [])
192
+ );
115
193
  const includeStructuredCards = effectiveIsBroad || effectiveOptions.includeStructuredCards === true;
116
- const [ftsResults, vectorResults, cardResults, reflectionResults, grepResults] = await Promise.all([
194
+ const [ftsResults, vectorResults, cardResults, reflectionResults, grepResults, ...subqueryResults] = await Promise.all([
117
195
  lightweightSearch(effectiveQuery, agentId, fetchOptions),
118
196
  queryVector ? searchMemories(queryVector, agentId, fetchOptions) : Promise.resolve([]),
119
197
  includeStructuredCards ? (async () => {
120
198
  try {
121
- const { searchMemoryCards } = await import("./memory-cards-SYVGSLXW.js");
199
+ const { searchMemoryCards } = await import("./memory-cards-NTRYLVOU.js");
122
200
  return await searchMemoryCards(effectiveQuery, agentId, fetchOptions);
123
201
  } catch {
124
202
  return [];
@@ -127,7 +205,7 @@ async function hybridSearch(queryText, agentId, options) {
127
205
  // Reflection insights: patterns, contradictions, summaries across sessions
128
206
  includeStructuredCards ? (async () => {
129
207
  try {
130
- const { searchReflections } = await import("./memory-reflection-FNJU7VFC.js");
208
+ const { searchReflections } = await import("./memory-reflection-4YOUTIMO.js");
131
209
  const insights = await searchReflections(effectiveQuery, agentId, 5);
132
210
  return insights.map((ins) => ({
133
211
  id: ins.id,
@@ -142,7 +220,8 @@ async function hybridSearch(queryText, agentId, options) {
142
220
  return [];
143
221
  }
144
222
  })() : Promise.resolve([]),
145
- grepPromise
223
+ grepPromise,
224
+ ...subqueryPromises
146
225
  ]);
147
226
  const lists = [];
148
227
  const weights = [];
@@ -166,6 +245,12 @@ async function hybridSearch(queryText, agentId, options) {
166
245
  lists.push(grepResults);
167
246
  weights.push(0.5);
168
247
  }
248
+ for (const sqResult of subqueryResults) {
249
+ if (sqResult.length > 0) {
250
+ lists.push(sqResult);
251
+ weights.push(0.7);
252
+ }
253
+ }
169
254
  if (lists.length === 0) return [];
170
255
  if (lists.length === 1 && !effectiveIsBroad) return lists[0].slice(0, limit);
171
256
  const rrfLimit = effectiveIsBroad ? Math.max(limit * 5, broadFetchTopK) : limit;
@@ -182,6 +267,9 @@ async function hybridSearch(queryText, agentId, options) {
182
267
  } catch {
183
268
  }
184
269
  }
270
+ if (merged.length >= 2) {
271
+ merged = resolveContradictions(merged);
272
+ }
185
273
  const auto = config.scalingRoadmap?.rerankerAutoTrigger ?? {
186
274
  enabled: config.rerankerEnabled ?? true,
187
275
  broadQueryMinCardinality: 5e4,
@@ -217,6 +305,18 @@ async function hybridSearch(queryText, agentId, options) {
217
305
  }
218
306
  }
219
307
  const finalResults = (rerankedAndBlended ?? merged).slice(0, limit);
308
+ if (finalResults.length > 0) {
309
+ const topResult = finalResults[0];
310
+ const signalCount = lists.length;
311
+ const resultRatio = Math.min(1, finalResults.length / limit);
312
+ const retrievalConfidence = resultRatio * (signalCount >= 2 ? 1 : 0.7);
313
+ topResult._retrievalConfidence = retrievalConfidence;
314
+ if (retrievalConfidence < ABSTENTION_THRESHOLD) {
315
+ for (const r of finalResults) {
316
+ r._lowConfidence = true;
317
+ }
318
+ }
319
+ }
220
320
  if (options?.includeSource && finalResults.length > 0) {
221
321
  await attachDocumentMetadata(finalResults);
222
322
  }
@@ -231,9 +331,12 @@ async function hybridSearch(queryText, agentId, options) {
231
331
  cards: cardResults.length,
232
332
  reflections: reflectionResults.length,
233
333
  grep: grepResults.length,
334
+ entitySubqueries: subqueryResults.filter((r) => r.length > 0).length,
234
335
  entityBoost: entityBoostRan,
336
+ contradictionResolution: merged.length >= 2,
235
337
  reranker: rerankedAndBlended !== null,
236
- selfQueryRouter: effectiveQuery !== queryText
338
+ selfQueryRouter: effectiveQuery !== queryText,
339
+ lowConfidence: finalResults[0]?._lowConfidence ?? false
237
340
  },
238
341
  topResults: finalResults.slice(0, 10).map((r, i) => {
239
342
  const scored = r;
@@ -370,7 +473,91 @@ function rrfMergeMulti(lists, limit, k = RRF_K, weights) {
370
473
  async function lightweightSearch(queryText, agentId, options) {
371
474
  const client = getClient();
372
475
  const limit = options?.limit ?? 5;
373
- const terms = queryText.toLowerCase().split(/\s+/).filter((t) => t.length >= 3).map((t) => t.replace(/[^a-z0-9_]/g, "")).filter((t) => t.length >= 3);
476
+ const FTS_STOP_WORDS = /* @__PURE__ */ new Set([
477
+ "the",
478
+ "and",
479
+ "but",
480
+ "for",
481
+ "not",
482
+ "you",
483
+ "your",
484
+ "his",
485
+ "her",
486
+ "its",
487
+ "our",
488
+ "their",
489
+ "this",
490
+ "that",
491
+ "these",
492
+ "those",
493
+ "what",
494
+ "when",
495
+ "where",
496
+ "who",
497
+ "how",
498
+ "why",
499
+ "which",
500
+ "does",
501
+ "did",
502
+ "was",
503
+ "were",
504
+ "has",
505
+ "have",
506
+ "had",
507
+ "can",
508
+ "could",
509
+ "would",
510
+ "should",
511
+ "are",
512
+ "with",
513
+ "from",
514
+ "about",
515
+ "into",
516
+ "through",
517
+ "during",
518
+ "before",
519
+ "after",
520
+ "above",
521
+ "below",
522
+ "between",
523
+ "same",
524
+ "each",
525
+ "every",
526
+ "both",
527
+ "more",
528
+ "most",
529
+ "other",
530
+ "some",
531
+ "such",
532
+ "than",
533
+ "too",
534
+ "very",
535
+ "just",
536
+ "also",
537
+ "any",
538
+ "all",
539
+ "own",
540
+ "being",
541
+ "been",
542
+ "they",
543
+ "them",
544
+ "will",
545
+ "may",
546
+ "might",
547
+ "shall",
548
+ "must",
549
+ "need",
550
+ "like",
551
+ "only",
552
+ "then",
553
+ "here",
554
+ "there",
555
+ "once",
556
+ "over",
557
+ "much",
558
+ "many"
559
+ ]);
560
+ const terms = queryText.toLowerCase().split(/\s+/).filter((t) => t.length >= 3).map((t) => t.replace(/[^a-z0-9_]/g, "")).filter((t) => t.length >= 3 && !FTS_STOP_WORDS.has(t));
374
561
  if (terms.length === 0) {
375
562
  return recentRecords(agentId, options, limit);
376
563
  }
@@ -394,7 +581,7 @@ async function lightweightSearch(queryText, agentId, options) {
394
581
  }
395
582
  if (options?.includeStructuredCards !== true) return results;
396
583
  try {
397
- const { searchMemoryCards } = await import("./memory-cards-SYVGSLXW.js");
584
+ const { searchMemoryCards } = await import("./memory-cards-NTRYLVOU.js");
398
585
  const cardResults = await searchMemoryCards(queryText, agentId, options);
399
586
  if (cardResults.length > 0) {
400
587
  return rrfMergeMulti([results, cardResults], limit, RRF_K, [1, 0.85]);
@@ -11,10 +11,10 @@ import {
11
11
  sessionScopeFilter,
12
12
  updateTaskStatus,
13
13
  writeNotification
14
- } from "./chunk-EYTMNAU7.js";
14
+ } from "./chunk-OC7Q4LOK.js";
15
15
  import {
16
16
  getTransport
17
- } from "./chunk-3TXOH3SJ.js";
17
+ } from "./chunk-A7KEWR6S.js";
18
18
  import {
19
19
  getSessionKey
20
20
  } from "./chunk-CVYC6DUW.js";
@@ -27,7 +27,7 @@ import {
27
27
  isCoordinatorName,
28
28
  isMultiInstance,
29
29
  shouldAutoInstance
30
- } from "./chunk-MBYJEE3B.js";
30
+ } from "./chunk-2G2KOWBI.js";
31
31
  import {
32
32
  EXE_AI_DIR
33
33
  } from "./chunk-TOWAZ5IV.js";
@@ -136,7 +136,7 @@ async function dispatchTaskToEmployee(input) {
136
136
  let crossProject = false;
137
137
  if (input.projectName) {
138
138
  try {
139
- const { assertSessionScope } = await import("./session-scope-6MAGVHBA.js");
139
+ const { assertSessionScope } = await import("./session-scope-QIDIKKFB.js");
140
140
  const check = assertSessionScope("dispatch_task", input.projectName);
141
141
  if (check.reason === "cross_session_denied") {
142
142
  crossProject = true;
@@ -331,7 +331,7 @@ async function updateTask(input) {
331
331
  let delivered = false;
332
332
  try {
333
333
  const { sendIntercom: sendIntercom2, resolveExeSession: resolveExeSession2 } = await import("./lib/tmux-routing.js");
334
- const exeSession = resolveExeSession2();
334
+ const exeSession = row.session_scope ? String(row.session_scope) : resolveExeSession2();
335
335
  if (exeSession) {
336
336
  const reviewerSession = `${reviewer}-${exeSession}`;
337
337
  const result = sendIntercom2(reviewerSession);
@@ -358,7 +358,7 @@ async function updateTask(input) {
358
358
  `);
359
359
  const { queueIntercom } = await import("./intercom-queue-K3DVKSPJ.js");
360
360
  const { resolveExeSession: resolveExeSession2 } = await import("./lib/tmux-routing.js");
361
- const exeSession = resolveExeSession2();
361
+ const exeSession = row.session_scope ? String(row.session_scope) : resolveExeSession2();
362
362
  if (exeSession) {
363
363
  const reviewerSession = isCoordinatorName(reviewer) ? exeSession : `${reviewer}-${exeSession}`;
364
364
  queueIntercom(reviewerSession, `Review ready: "${taskTitle}" by ${String(row.assigned_to)}. Run /exe-review.`);
@@ -369,7 +369,7 @@ async function updateTask(input) {
369
369
  }
370
370
  }
371
371
  try {
372
- const { pushNotifyAsync } = await import("./push-notifications-KDYFOJRI.js");
372
+ const { pushNotifyAsync } = await import("./push-notifications-NSYLKFXR.js");
373
373
  pushNotifyAsync({
374
374
  event: "review_ready",
375
375
  title: `Review ready: ${taskTitle.slice(0, 50)}`,
@@ -381,7 +381,7 @@ async function updateTask(input) {
381
381
  }
382
382
  if (!isCoordinator) {
383
383
  try {
384
- const { pushNotifyAsync } = await import("./push-notifications-KDYFOJRI.js");
384
+ const { pushNotifyAsync } = await import("./push-notifications-NSYLKFXR.js");
385
385
  const event = input.status === "needs_review" ? "review_ready" : "task_complete";
386
386
  pushNotifyAsync({
387
387
  event,
@@ -396,7 +396,7 @@ async function updateTask(input) {
396
396
  await markTaskNotificationsRead(taskFile);
397
397
  if (input.status === "needs_review" && !isCoordinator) {
398
398
  try {
399
- const { writeNotification: writeNotification2 } = await import("./notifications-LD563XOM.js");
399
+ const { writeNotification: writeNotification2 } = await import("./notifications-SF2XN5JE.js");
400
400
  await writeNotification2({
401
401
  agentId: String(row.assigned_to),
402
402
  agentRole: String(row.assigned_to),
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  initStore
3
- } from "./chunk-72XIEBYJ.js";
3
+ } from "./chunk-DWLDYEGO.js";
4
4
  import {
5
5
  getClient,
6
6
  isInitialized
7
- } from "./chunk-MBYJEE3B.js";
7
+ } from "./chunk-2G2KOWBI.js";
8
8
 
9
9
  // src/lib/schedules.ts
10
10
  import crypto from "crypto";
@@ -830,7 +830,7 @@ function formatReport(report, flags) {
830
830
  return lines.join("\n");
831
831
  }
832
832
  async function fixNullVectors() {
833
- const { tryAcquireWorkerSlot, registerWorkerPid } = await import("./worker-gate-TG6PR2S5.js");
833
+ const { tryAcquireWorkerSlot, registerWorkerPid } = await import("./worker-gate-PJYHXNUB.js");
834
834
  if (!tryAcquireWorkerSlot()) {
835
835
  process.stderr.write("[exe-doctor] Worker gate full \u2014 waiting for existing backfill workers to finish\n");
836
836
  await new Promise((r) => setTimeout(r, 5e3));
@@ -951,7 +951,7 @@ function splitAtSentences(text, maxChunkSize) {
951
951
  }
952
952
  async function main(argv = process.argv.slice(2)) {
953
953
  const flags = parseFlags(argv);
954
- const { fastDbInit } = await import("./fast-db-init-NCOIEAM6.js");
954
+ const { fastDbInit } = await import("./fast-db-init-5DTYG5FZ.js");
955
955
  const client = await fastDbInit();
956
956
  const report = await runAudit(client, flags);
957
957
  console.log(formatReport(report, flags));
@@ -9,7 +9,7 @@ import {
9
9
  getCoordinatorEmployee,
10
10
  getEmployee,
11
11
  loadEmployeesSync
12
- } from "./chunk-MBYJEE3B.js";
12
+ } from "./chunk-2G2KOWBI.js";
13
13
  import {
14
14
  EXE_AI_DIR
15
15
  } from "./chunk-TOWAZ5IV.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isCrdtSyncEnabled
3
- } from "./chunk-VN6UUZNO.js";
3
+ } from "./chunk-NQND3GFO.js";
4
4
  import {
5
5
  decryptSyncBlob,
6
6
  encryptSyncBlob,
@@ -12,7 +12,7 @@ import {
12
12
  loadEmployees,
13
13
  registerBinSymlinks,
14
14
  saveEmployees
15
- } from "./chunk-MBYJEE3B.js";
15
+ } from "./chunk-2G2KOWBI.js";
16
16
  import {
17
17
  loadDeviceId
18
18
  } from "./chunk-NNT2ZNMC.js";
@@ -167,7 +167,10 @@ async function pushToPostgres(records) {
167
167
  const changed = await prisma.$executeRawUnsafe(
168
168
  `INSERT INTO raw.raw_events (id, source, source_id, event_type, payload, metadata, timestamp)
169
169
  VALUES (gen_random_uuid(), 'cloud_sync', $1, 'memory', $2::jsonb, $3::jsonb, $4)
170
- ON CONFLICT (source, source_id, event_type) DO NOTHING`,
170
+ ON CONFLICT (source, source_id, event_type) DO UPDATE SET
171
+ payload = EXCLUDED.payload,
172
+ metadata = EXCLUDED.metadata,
173
+ processed_at = NULL`,
171
174
  String(rec.id ?? ""),
172
175
  JSON.stringify(rec),
173
176
  JSON.stringify({ agent_id: rec.agent_id, project_name: rec.project_name, tool_name: rec.tool_name }),
@@ -482,7 +485,7 @@ async function cloudSync(config) {
482
485
  let pulled = 0;
483
486
  if (pullResult.records.length > 0) {
484
487
  if (isCrdtSyncEnabled()) {
485
- const { initCrdtDoc, importExistingMemories, readAllMemories } = await import("./crdt-sync-3VQP2ISB.js");
488
+ const { initCrdtDoc, importExistingMemories, readAllMemories } = await import("./crdt-sync-B7IUR3BR.js");
486
489
  initCrdtDoc();
487
490
  importExistingMemories(
488
491
  pullResult.records.map((rec) => ({
@@ -506,8 +509,8 @@ async function cloudSync(config) {
506
509
  sql: `INSERT INTO memories
507
510
  (id, agent_id, agent_role, session_id, timestamp,
508
511
  tool_name, project_name, has_error, raw_text, version,
509
- author_device_id, scope)
510
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
512
+ author_device_id, scope, memory_type)
513
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
511
514
  ON CONFLICT(id) DO UPDATE SET
512
515
  agent_id = excluded.agent_id,
513
516
  agent_role = excluded.agent_role,
@@ -520,10 +523,10 @@ async function cloudSync(config) {
520
523
  version = excluded.version,
521
524
  author_device_id = excluded.author_device_id,
522
525
  scope = excluded.scope,
526
+ memory_type = COALESCE(excluded.memory_type, memories.memory_type),
523
527
  vector = COALESCE(memories.vector, excluded.vector),
524
528
  importance = COALESCE(memories.importance, excluded.importance),
525
529
  confidence = COALESCE(memories.confidence, excluded.confidence),
526
- memory_type = COALESCE(memories.memory_type, excluded.memory_type),
527
530
  tier = COALESCE(memories.tier, excluded.tier),
528
531
  strength = COALESCE(memories.strength, excluded.strength)`,
529
532
  args: [
@@ -538,7 +541,8 @@ async function cloudSync(config) {
538
541
  sqlSafe(rec.raw_text ?? ""),
539
542
  sqlSafe(rec.version ?? 0),
540
543
  sqlSafe(rec.author_device_id),
541
- sqlSafe(rec.scope ?? "business")
544
+ sqlSafe(rec.scope ?? "business"),
545
+ sqlSafe(rec.memory_type)
542
546
  ]
543
547
  }));
544
548
  if (stmts.length > 0) await client.batch(stmts, "write");
@@ -587,8 +591,8 @@ async function cloudSync(config) {
587
591
  sql: `INSERT INTO memories
588
592
  (id, agent_id, agent_role, session_id, timestamp,
589
593
  tool_name, project_name, has_error, raw_text, version,
590
- author_device_id, scope)
591
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
594
+ author_device_id, scope, memory_type)
595
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
592
596
  ON CONFLICT(id) DO UPDATE SET
593
597
  agent_id = excluded.agent_id,
594
598
  agent_role = excluded.agent_role,
@@ -601,10 +605,10 @@ async function cloudSync(config) {
601
605
  version = excluded.version,
602
606
  author_device_id = excluded.author_device_id,
603
607
  scope = excluded.scope,
608
+ memory_type = COALESCE(excluded.memory_type, memories.memory_type),
604
609
  vector = COALESCE(memories.vector, excluded.vector),
605
610
  importance = COALESCE(memories.importance, excluded.importance),
606
611
  confidence = COALESCE(memories.confidence, excluded.confidence),
607
- memory_type = COALESCE(memories.memory_type, excluded.memory_type),
608
612
  tier = COALESCE(memories.tier, excluded.tier),
609
613
  strength = COALESCE(memories.strength, excluded.strength)`,
610
614
  args: [
@@ -619,7 +623,8 @@ async function cloudSync(config) {
619
623
  sqlSafe(rec.raw_text ?? ""),
620
624
  sqlSafe(rec.version ?? 0),
621
625
  sqlSafe(rec.author_device_id),
622
- sqlSafe(rec.scope ?? "business")
626
+ sqlSafe(rec.scope ?? "business"),
627
+ sqlSafe(rec.memory_type)
623
628
  ]
624
629
  }));
625
630
  await client.batch(stmts, "write");
@@ -161,6 +161,13 @@ var PLATFORM_PROCEDURES = [
161
161
  priority: "p0",
162
162
  content: "Behaviors (Layer 2) are corrections \u2014 'don't do X again.' They are NOT a dumping ground for rules. Best practice per agent per project: max 10-15 active p0 behaviors. Beyond that, noise drowns signal \u2014 agents can't follow 50 rules injected every session. Before storing a new behavior, check behavior(action='list') for duplicates \u2014 supersede, don't stack. If an agent follows a behavior consistently for 2+ weeks, promote it to identity (exe.md) and deactivate the behavior. If the agent keeps violating it, the behavior isn't working \u2014 enforce it in code (hook, gate, or system check) instead. One clear sentence per behavior, not paragraphs. Periodic cleanup: COO should audit each agent's behaviors monthly \u2014 deduplicate, remove test junk, merge overlapping entries. Priority tiers: p0 = always injected (limit 10), p1 = standard (injected when relevant), p2 = nice-to-have."
163
163
  },
164
+ // --- Skills ---
165
+ {
166
+ title: "Skills \u2014 reusable procedures from proven work patterns",
167
+ domain: "operations",
168
+ priority: "p1",
169
+ content: "Skills are stored as behaviors with domain='skill'. They capture multi-step procedures that worked. WHEN TO CAPTURE: after completing a complex task (5+ tool calls) that involved non-obvious steps, error recovery, or a workflow that would help future sessions. SKIP for simple one-offs. FORMAT: 'SKILL: [name] \u2014 Step 1: ... Step 2: ... Pitfalls: ...' HOW TO FIND SKILLS: behavior(action='list', domain='skill') shows all captured skills. Before starting complex work, check if a relevant skill exists. HOW TO USE: Load the skill, follow its steps. If you deviate and find a better path, update the skill via behavior(action='store') with the improved version and supersede the old one. SKILL LIFECYCLE: capture \u2192 track (use_count, success_count) \u2192 refine (merge corrections after 3+ uses) \u2192 promote (move to identity after 10+ successful uses) \u2192 deactivate old behavior. Skills are per-agent per-project. Shared skills use domain='skill' with no project filter. Goal: procedural memory \u2014 not just corrections, but proven approaches that get better over time."
170
+ },
164
171
  // --- Updates ---
165
172
  {
166
173
  title: "How to update exe-os \u2014 CLI first, then stack",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  processCRMEvent
3
- } from "./chunk-BF4W2VDS.js";
3
+ } from "./chunk-ZYETFCDX.js";
4
4
 
5
5
  // src/gateway/adapters/crm-webhook.ts
6
6
  function parseTwentyWebhook(payload) {
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-64WZEXXA.js";
10
10
  import {
11
11
  getTransport
12
- } from "./chunk-3TXOH3SJ.js";
12
+ } from "./chunk-A7KEWR6S.js";
13
13
  import {
14
14
  listTmuxSessions
15
15
  } from "./chunk-GZIAQYGI.js";
@@ -30,7 +30,7 @@ import {
30
30
  import {
31
31
  PlanLimitError,
32
32
  assertEmployeeLimitSync
33
- } from "./chunk-5NSTNICM.js";
33
+ } from "./chunk-3OGN523Z.js";
34
34
  import {
35
35
  getProjectName
36
36
  } from "./chunk-OPU3NYOO.js";
@@ -45,7 +45,7 @@ import {
45
45
  } from "./chunk-MP2AFCGL.js";
46
46
  import {
47
47
  ensureAgentSymlink
48
- } from "./chunk-LM7TQYLW.js";
48
+ } from "./chunk-IWSXQKSB.js";
49
49
  import {
50
50
  expandDualPrefixTools
51
51
  } from "./chunk-HYZV25LY.js";
@@ -58,7 +58,7 @@ import {
58
58
  isCoordinatorName,
59
59
  loadEmployees,
60
60
  loadEmployeesSync
61
- } from "./chunk-MBYJEE3B.js";
61
+ } from "./chunk-2G2KOWBI.js";
62
62
  import {
63
63
  loadDeviceId
64
64
  } from "./chunk-NNT2ZNMC.js";
@@ -359,7 +359,7 @@ async function createTaskCore(input) {
359
359
  if (isCoordinatorSession) {
360
360
  earlySessionScope = resolved;
361
361
  } else {
362
- const { getSessionProject } = await import("./session-scope-6MAGVHBA.js");
362
+ const { getSessionProject } = await import("./session-scope-QIDIKKFB.js");
363
363
  const sessionProject = getSessionProject(resolved);
364
364
  if (sessionProject && sessionProject !== input.projectName) {
365
365
  scopeMismatchWarning = `session/project mismatch: session "${resolved}" owns "${sessionProject}" but task targets "${input.projectName}". Routed to default scope.`;
@@ -724,7 +724,7 @@ async function updateTaskStatus(input) {
724
724
  const reviewer = String(row.reviewer);
725
725
  try {
726
726
  const { sendIntercom: sendIntercom2, employeeSessionName: employeeSessionName2, resolveExeSession: resolveExeSession2, isExeSession: isExeSession2 } = await import("./lib/tmux-routing.js");
727
- const exeSession = resolveExeSession2();
727
+ const exeSession = row.session_scope ? String(row.session_scope) : resolveExeSession2();
728
728
  if (exeSession) {
729
729
  if (isCoordinatorName(reviewer)) {
730
730
  if (isExeSession2(exeSession)) {
@@ -879,6 +879,16 @@ ${input.result}` : `\u26A0\uFE0F ${warning}`;
879
879
  await client.execute("PRAGMA wal_checkpoint(PASSIVE)");
880
880
  } catch {
881
881
  }
882
+ if (input.status === "done" || input.status === "needs_review") {
883
+ try {
884
+ const { incrementSkillSuccess } = await import("./skill-refinement-3W3CIIG3.js");
885
+ await incrementSkillSuccess(
886
+ String(row.assigned_to),
887
+ row.project_name ? String(row.project_name) : null
888
+ );
889
+ } catch {
890
+ }
891
+ }
882
892
  if (input.status === "done" || input.status === "needs_review" || input.status === "cancelled" || input.status === "closed") {
883
893
  try {
884
894
  const { clearQueueForAgent } = await import("./intercom-queue-K3DVKSPJ.js");
@@ -1437,8 +1447,8 @@ async function createReviewForCompletedTask(row, result, _baseDir, now) {
1437
1447
  const autoApprove = false;
1438
1448
  if (!autoApprove) {
1439
1449
  try {
1440
- const key = getSessionKey();
1441
- const exeSession = getParentExe(key);
1450
+ const taskScope = row.session_scope ? String(row.session_scope) : null;
1451
+ const exeSession = taskScope || getParentExe(getSessionKey());
1442
1452
  if (exeSession) {
1443
1453
  sendIntercom(exeSession, { force: true });
1444
1454
  }
@@ -1942,7 +1952,7 @@ async function verifyPaneAtCapacity(sessionName) {
1942
1952
  reason: `capture-pane failed: ${err instanceof Error ? err.message : String(err)}`
1943
1953
  };
1944
1954
  }
1945
- const { isAtCapacity } = await import("./capacity-monitor-J3SVO7LJ.js");
1955
+ const { isAtCapacity } = await import("./capacity-monitor-VJLRBE7S.js");
1946
1956
  if (!isAtCapacity(pane)) {
1947
1957
  return {
1948
1958
  atCapacity: false,
@@ -2,7 +2,7 @@ import {
2
2
  listWorkflowDefinitions,
3
3
  runWorkflow,
4
4
  startWorkflow
5
- } from "./chunk-BQ3KXWA7.js";
5
+ } from "./chunk-DTT4TRFR.js";
6
6
  import {
7
7
  initCRMBridge
8
8
  } from "./chunk-GCNWCYJI.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-MP2AFCGL.js";
12
12
  import {
13
13
  getClient
14
- } from "./chunk-MBYJEE3B.js";
14
+ } from "./chunk-2G2KOWBI.js";
15
15
 
16
16
  // src/gateway/router.ts
17
17
  function matchesPlatform(msgPlatform, matchPlatform) {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  updateTask
3
- } from "./chunk-EEXG4ZJS.js";
3
+ } from "./chunk-KUPUTWQX.js";
4
4
  import {
5
5
  TASK_ALREADY_CLAIMED_PREFIX
6
- } from "./chunk-EYTMNAU7.js";
6
+ } from "./chunk-OC7Q4LOK.js";
7
7
 
8
8
  // src/mcp/tools/update-task.ts
9
9
  import { z } from "zod";
@@ -23,7 +23,7 @@ function registerUpdateTask(server) {
23
23
  const status = rawStatus;
24
24
  let callerAgentId;
25
25
  try {
26
- const { getActiveAgent: getAgent } = await import("./active-agent-HDUT3T3I.js");
26
+ const { getActiveAgent: getAgent } = await import("./active-agent-IVY5D7DJ.js");
27
27
  callerAgentId = getAgent().agentId;
28
28
  } catch {
29
29
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getGlobalProceduresBlock
3
- } from "./chunk-LBX2VQCC.js";
3
+ } from "./chunk-Y3Z6QHUR.js";
4
4
 
5
5
  // src/lib/employee-templates.ts
6
6
  var BASE_OPERATING_PROCEDURES = `