@askexenow/exe-os 0.9.35 → 0.9.36

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 (66) hide show
  1. package/dist/bin/backfill-conversations.js +2 -1
  2. package/dist/bin/backfill-responses.js +2 -1
  3. package/dist/bin/backfill-vectors.js +1 -1
  4. package/dist/bin/cleanup-stale-review-tasks.js +7 -2
  5. package/dist/bin/cli.js +45 -14
  6. package/dist/bin/exe-agent.js +1 -1
  7. package/dist/bin/exe-assign.js +7 -2
  8. package/dist/bin/exe-boot.js +1 -1
  9. package/dist/bin/exe-call.js +7 -5
  10. package/dist/bin/exe-dispatch.js +7 -2
  11. package/dist/bin/exe-doctor.js +1 -1
  12. package/dist/bin/exe-export-behaviors.js +84 -4
  13. package/dist/bin/exe-forget.js +28 -11
  14. package/dist/bin/exe-gateway.js +7 -2
  15. package/dist/bin/exe-heartbeat.js +7 -2
  16. package/dist/bin/exe-kill.js +7 -2
  17. package/dist/bin/exe-launch-agent.js +85 -7
  18. package/dist/bin/exe-new-employee.js +26 -2
  19. package/dist/bin/exe-pending-messages.js +7 -2
  20. package/dist/bin/exe-pending-notifications.js +7 -2
  21. package/dist/bin/exe-pending-reviews.js +7 -2
  22. package/dist/bin/exe-rename.js +1 -1
  23. package/dist/bin/exe-review.js +7 -2
  24. package/dist/bin/exe-search.js +29 -11
  25. package/dist/bin/exe-session-cleanup.js +7 -2
  26. package/dist/bin/exe-start-codex.js +69 -3
  27. package/dist/bin/exe-start-opencode.js +80 -3
  28. package/dist/bin/exe-status.js +7 -2
  29. package/dist/bin/exe-team.js +7 -2
  30. package/dist/bin/git-sweep.js +7 -2
  31. package/dist/bin/graph-backfill.js +2 -1
  32. package/dist/bin/graph-export.js +7 -2
  33. package/dist/bin/install.js +25 -1
  34. package/dist/bin/intercom-check.js +7 -2
  35. package/dist/bin/scan-tasks.js +7 -2
  36. package/dist/bin/setup.js +7 -5
  37. package/dist/bin/shard-migrate.js +2 -1
  38. package/dist/gateway/index.js +7 -2
  39. package/dist/hooks/bug-report-worker.js +7 -2
  40. package/dist/hooks/codex-stop-task-finalizer.js +7 -2
  41. package/dist/hooks/commit-complete.js +7 -2
  42. package/dist/hooks/error-recall.js +29 -11
  43. package/dist/hooks/ingest.js +7 -2
  44. package/dist/hooks/instructions-loaded.js +7 -2
  45. package/dist/hooks/notification.js +7 -2
  46. package/dist/hooks/post-compact.js +7 -2
  47. package/dist/hooks/post-tool-combined.js +29 -11
  48. package/dist/hooks/pre-compact.js +7 -2
  49. package/dist/hooks/pre-tool-use.js +17 -8
  50. package/dist/hooks/prompt-submit.js +124 -12
  51. package/dist/hooks/session-end.js +7 -2
  52. package/dist/hooks/session-start.js +207 -38
  53. package/dist/hooks/stop.js +7 -2
  54. package/dist/hooks/subagent-stop.js +7 -2
  55. package/dist/hooks/summary-worker.js +1 -1
  56. package/dist/index.js +7 -2
  57. package/dist/lib/employee-templates.js +7 -5
  58. package/dist/lib/exe-daemon.js +115 -26
  59. package/dist/lib/hybrid-search.js +29 -11
  60. package/dist/lib/schedules.js +1 -1
  61. package/dist/lib/store.js +7 -2
  62. package/dist/mcp/server.js +109 -26
  63. package/dist/runtime/index.js +7 -2
  64. package/dist/tui/App.js +7 -2
  65. package/package.json +1 -1
  66. package/src/commands/exe/save.md +48 -0
@@ -3279,6 +3279,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
3279
3279
  }
3280
3280
  }
3281
3281
  function schedulePostWriteMemoryHygiene(memoryIds) {
3282
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
3282
3283
  if (memoryIds.length === 0) return;
3283
3284
  const run = () => {
3284
3285
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -3673,7 +3674,7 @@ var init_platform_procedures = __esm({
3673
3674
  title: "Chain of command \u2014 who talks to whom",
3674
3675
  domain: "workflow",
3675
3676
  priority: "p0",
3676
- content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3677
+ content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3677
3678
  },
3678
3679
  {
3679
3680
  title: "Single dispatch path \u2014 create_task only",
@@ -4345,7 +4346,11 @@ async function searchMemories(queryVector, agentId, options) {
4345
4346
  sql += ` AND timestamp >= ?`;
4346
4347
  args.push(options.since);
4347
4348
  }
4348
- if (options?.memoryType) {
4349
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
4350
+ const uniqueTypes = [...new Set(options.memoryTypes)];
4351
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
4352
+ args.push(...uniqueTypes);
4353
+ } else if (options?.memoryType) {
4349
4354
  sql += ` AND memory_type = ?`;
4350
4355
  args.push(options.memoryType);
4351
4356
  }
@@ -6895,6 +6895,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
6895
6895
  }
6896
6896
  }
6897
6897
  function schedulePostWriteMemoryHygiene(memoryIds) {
6898
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
6898
6899
  if (memoryIds.length === 0) return;
6899
6900
  const run = () => {
6900
6901
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -7289,7 +7290,7 @@ var init_platform_procedures = __esm({
7289
7290
  title: "Chain of command \u2014 who talks to whom",
7290
7291
  domain: "workflow",
7291
7292
  priority: "p0",
7292
- content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
7293
+ content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
7293
7294
  },
7294
7295
  {
7295
7296
  title: "Single dispatch path \u2014 create_task only",
@@ -7961,7 +7962,11 @@ async function searchMemories(queryVector, agentId, options) {
7961
7962
  sql += ` AND timestamp >= ?`;
7962
7963
  args.push(options.since);
7963
7964
  }
7964
- if (options?.memoryType) {
7965
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
7966
+ const uniqueTypes = [...new Set(options.memoryTypes)];
7967
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
7968
+ args.push(...uniqueTypes);
7969
+ } else if (options?.memoryType) {
7965
7970
  sql += ` AND memory_type = ?`;
7966
7971
  args.push(options.memoryType);
7967
7972
  }
@@ -3187,6 +3187,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
3187
3187
  }
3188
3188
  }
3189
3189
  function schedulePostWriteMemoryHygiene(memoryIds) {
3190
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
3190
3191
  if (memoryIds.length === 0) return;
3191
3192
  const run = () => {
3192
3193
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -3581,7 +3582,7 @@ var init_platform_procedures = __esm({
3581
3582
  title: "Chain of command \u2014 who talks to whom",
3582
3583
  domain: "workflow",
3583
3584
  priority: "p0",
3584
- content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3585
+ content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3585
3586
  },
3586
3587
  {
3587
3588
  title: "Single dispatch path \u2014 create_task only",
@@ -4253,7 +4254,11 @@ async function searchMemories(queryVector, agentId, options) {
4253
4254
  sql += ` AND timestamp >= ?`;
4254
4255
  args.push(options.since);
4255
4256
  }
4256
- if (options?.memoryType) {
4257
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
4258
+ const uniqueTypes = [...new Set(options.memoryTypes)];
4259
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
4260
+ args.push(...uniqueTypes);
4261
+ } else if (options?.memoryType) {
4257
4262
  sql += ` AND memory_type = ?`;
4258
4263
  args.push(options.memoryType);
4259
4264
  }
@@ -5655,6 +5660,17 @@ init_store();
5655
5660
  init_store();
5656
5661
  init_database();
5657
5662
  var RRF_K = 60;
5663
+ function appendMemoryTypeFilter(sql, args, column, options) {
5664
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
5665
+ const uniqueTypes = [...new Set(options.memoryTypes)];
5666
+ sql += ` AND ${column} IN (${uniqueTypes.map(() => "?").join(",")})`;
5667
+ args.push(...uniqueTypes);
5668
+ } else if (options?.memoryType) {
5669
+ sql += ` AND ${column} = ?`;
5670
+ args.push(options.memoryType);
5671
+ }
5672
+ return sql;
5673
+ }
5658
5674
  async function hybridSearch(queryText, agentId, options) {
5659
5675
  const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
5660
5676
  const config = await loadConfig2();
@@ -5883,6 +5899,7 @@ async function estimateCardinality(agentId, options) {
5883
5899
  sql += ` AND timestamp >= ?`;
5884
5900
  args.push(options.since);
5885
5901
  }
5902
+ sql = appendMemoryTypeFilter(sql, args, "memory_type", options);
5886
5903
  try {
5887
5904
  const result = await client.execute({ sql, args });
5888
5905
  return Number(result.rows[0]?.cnt) || 0;
@@ -6001,10 +6018,7 @@ async function ftsQuery(client, matchExpr, agentId, options, limit) {
6001
6018
  sql += ` AND m.timestamp >= ?`;
6002
6019
  args.push(options.since);
6003
6020
  }
6004
- if (options?.memoryType) {
6005
- sql += ` AND m.memory_type = ?`;
6006
- args.push(options.memoryType);
6007
- }
6021
+ sql = appendMemoryTypeFilter(sql, args, "m.memory_type", options);
6008
6022
  sql += ` ORDER BY rank LIMIT ?`;
6009
6023
  args.push(limit);
6010
6024
  const result = await client.execute({ sql, args });
@@ -6061,9 +6075,16 @@ async function recentRecords(agentId, options, limit, textFilter) {
6061
6075
  AND timestamp >= ? AND timestamp <= ?
6062
6076
  AND COALESCE(status, 'active') = 'active'
6063
6077
  AND ${options?.includeRaw === false ? "COALESCE(memory_type, 'raw') != 'raw'" : "1 = 1"}
6078
+ ${options?.memoryTypes?.length ? `AND memory_type IN (${options.memoryTypes.map(() => "?").join(",")})` : options?.memoryType ? "AND memory_type = ?" : ""}
6064
6079
  AND COALESCE(confidence, 0.7) >= 0.3
6065
6080
  ORDER BY timestamp DESC LIMIT ?`,
6066
- args: [agentId, windowStart, killedAt, boundarySlots]
6081
+ args: [
6082
+ agentId,
6083
+ windowStart,
6084
+ killedAt,
6085
+ ...options?.memoryTypes?.length ? [...new Set(options.memoryTypes)] : options?.memoryType ? [options.memoryType] : [],
6086
+ boundarySlots
6087
+ ]
6067
6088
  });
6068
6089
  for (const row of boundaryResult.rows) {
6069
6090
  sessionBoundaryMemories.push(rowToMemoryRecord(row));
@@ -6109,10 +6130,7 @@ async function recentRecords(agentId, options, limit, textFilter) {
6109
6130
  sql += ` AND timestamp >= ?`;
6110
6131
  args.push(options.since);
6111
6132
  }
6112
- if (options?.memoryType) {
6113
- sql += ` AND memory_type = ?`;
6114
- args.push(options.memoryType);
6115
- }
6133
+ sql = appendMemoryTypeFilter(sql, args, "memory_type", options);
6116
6134
  if (textFilter) {
6117
6135
  sql += ` AND raw_text LIKE '%' || ? || '%'`;
6118
6136
  args.push(textFilter);
@@ -3363,6 +3363,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
3363
3363
  }
3364
3364
  }
3365
3365
  function schedulePostWriteMemoryHygiene(memoryIds) {
3366
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
3366
3367
  if (memoryIds.length === 0) return;
3367
3368
  const run = () => {
3368
3369
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -3757,7 +3758,7 @@ var init_platform_procedures = __esm({
3757
3758
  title: "Chain of command \u2014 who talks to whom",
3758
3759
  domain: "workflow",
3759
3760
  priority: "p0",
3760
- content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3761
+ content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3761
3762
  },
3762
3763
  {
3763
3764
  title: "Single dispatch path \u2014 create_task only",
@@ -4429,7 +4430,11 @@ async function searchMemories(queryVector, agentId, options) {
4429
4430
  sql += ` AND timestamp >= ?`;
4430
4431
  args.push(options.since);
4431
4432
  }
4432
- if (options?.memoryType) {
4433
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
4434
+ const uniqueTypes = [...new Set(options.memoryTypes)];
4435
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
4436
+ args.push(...uniqueTypes);
4437
+ } else if (options?.memoryType) {
4433
4438
  sql += ` AND memory_type = ?`;
4434
4439
  args.push(options.memoryType);
4435
4440
  }
@@ -3198,6 +3198,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
3198
3198
  }
3199
3199
  }
3200
3200
  function schedulePostWriteMemoryHygiene(memoryIds) {
3201
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
3201
3202
  if (memoryIds.length === 0) return;
3202
3203
  const run = () => {
3203
3204
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -3592,7 +3593,7 @@ var init_platform_procedures = __esm({
3592
3593
  title: "Chain of command \u2014 who talks to whom",
3593
3594
  domain: "workflow",
3594
3595
  priority: "p0",
3595
- content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3596
+ content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3596
3597
  },
3597
3598
  {
3598
3599
  title: "Single dispatch path \u2014 create_task only",
@@ -4264,7 +4265,11 @@ async function searchMemories(queryVector, agentId, options) {
4264
4265
  sql += ` AND timestamp >= ?`;
4265
4266
  args.push(options.since);
4266
4267
  }
4267
- if (options?.memoryType) {
4268
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
4269
+ const uniqueTypes = [...new Set(options.memoryTypes)];
4270
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
4271
+ args.push(...uniqueTypes);
4272
+ } else if (options?.memoryType) {
4268
4273
  sql += ` AND memory_type = ?`;
4269
4274
  args.push(options.memoryType);
4270
4275
  }
@@ -3198,6 +3198,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
3198
3198
  }
3199
3199
  }
3200
3200
  function schedulePostWriteMemoryHygiene(memoryIds) {
3201
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
3201
3202
  if (memoryIds.length === 0) return;
3202
3203
  const run = () => {
3203
3204
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -3592,7 +3593,7 @@ var init_platform_procedures = __esm({
3592
3593
  title: "Chain of command \u2014 who talks to whom",
3593
3594
  domain: "workflow",
3594
3595
  priority: "p0",
3595
- content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3596
+ content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3596
3597
  },
3597
3598
  {
3598
3599
  title: "Single dispatch path \u2014 create_task only",
@@ -4264,7 +4265,11 @@ async function searchMemories(queryVector, agentId, options) {
4264
4265
  sql += ` AND timestamp >= ?`;
4265
4266
  args.push(options.since);
4266
4267
  }
4267
- if (options?.memoryType) {
4268
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
4269
+ const uniqueTypes = [...new Set(options.memoryTypes)];
4270
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
4271
+ args.push(...uniqueTypes);
4272
+ } else if (options?.memoryType) {
4268
4273
  sql += ` AND memory_type = ?`;
4269
4274
  args.push(options.memoryType);
4270
4275
  }
@@ -3618,6 +3618,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
3618
3618
  }
3619
3619
  }
3620
3620
  function schedulePostWriteMemoryHygiene(memoryIds) {
3621
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
3621
3622
  if (memoryIds.length === 0) return;
3622
3623
  const run = () => {
3623
3624
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -4012,7 +4013,7 @@ var init_platform_procedures = __esm({
4012
4013
  title: "Chain of command \u2014 who talks to whom",
4013
4014
  domain: "workflow",
4014
4015
  priority: "p0",
4015
- content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
4016
+ content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
4016
4017
  },
4017
4018
  {
4018
4019
  title: "Single dispatch path \u2014 create_task only",
@@ -4684,7 +4685,11 @@ async function searchMemories(queryVector, agentId, options) {
4684
4685
  sql += ` AND timestamp >= ?`;
4685
4686
  args.push(options.since);
4686
4687
  }
4687
- if (options?.memoryType) {
4688
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
4689
+ const uniqueTypes = [...new Set(options.memoryTypes)];
4690
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
4691
+ args.push(...uniqueTypes);
4692
+ } else if (options?.memoryType) {
4688
4693
  sql += ` AND memory_type = ?`;
4689
4694
  args.push(options.memoryType);
4690
4695
  }
@@ -3362,6 +3362,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
3362
3362
  }
3363
3363
  }
3364
3364
  function schedulePostWriteMemoryHygiene(memoryIds) {
3365
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
3365
3366
  if (memoryIds.length === 0) return;
3366
3367
  const run = () => {
3367
3368
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -3756,7 +3757,7 @@ var init_platform_procedures = __esm({
3756
3757
  title: "Chain of command \u2014 who talks to whom",
3757
3758
  domain: "workflow",
3758
3759
  priority: "p0",
3759
- content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3760
+ content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
3760
3761
  },
3761
3762
  {
3762
3763
  title: "Single dispatch path \u2014 create_task only",
@@ -4428,7 +4429,11 @@ async function searchMemories(queryVector, agentId, options) {
4428
4429
  sql += ` AND timestamp >= ?`;
4429
4430
  args.push(options.since);
4430
4431
  }
4431
- if (options?.memoryType) {
4432
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
4433
+ const uniqueTypes = [...new Set(options.memoryTypes)];
4434
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
4435
+ args.push(...uniqueTypes);
4436
+ } else if (options?.memoryType) {
4432
4437
  sql += ` AND memory_type = ?`;
4433
4438
  args.push(options.memoryType);
4434
4439
  }
@@ -5726,6 +5731,17 @@ __export(hybrid_search_exports, {
5726
5731
  rrfMerge: () => rrfMerge,
5727
5732
  rrfMergeMulti: () => rrfMergeMulti
5728
5733
  });
5734
+ function appendMemoryTypeFilter(sql, args, column, options) {
5735
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
5736
+ const uniqueTypes = [...new Set(options.memoryTypes)];
5737
+ sql += ` AND ${column} IN (${uniqueTypes.map(() => "?").join(",")})`;
5738
+ args.push(...uniqueTypes);
5739
+ } else if (options?.memoryType) {
5740
+ sql += ` AND ${column} = ?`;
5741
+ args.push(options.memoryType);
5742
+ }
5743
+ return sql;
5744
+ }
5729
5745
  async function hybridSearch(queryText, agentId, options) {
5730
5746
  const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
5731
5747
  const config = await loadConfig2();
@@ -5954,6 +5970,7 @@ async function estimateCardinality(agentId, options) {
5954
5970
  sql += ` AND timestamp >= ?`;
5955
5971
  args.push(options.since);
5956
5972
  }
5973
+ sql = appendMemoryTypeFilter(sql, args, "memory_type", options);
5957
5974
  try {
5958
5975
  const result = await client.execute({ sql, args });
5959
5976
  return Number(result.rows[0]?.cnt) || 0;
@@ -6075,10 +6092,7 @@ async function ftsQuery(client, matchExpr, agentId, options, limit) {
6075
6092
  sql += ` AND m.timestamp >= ?`;
6076
6093
  args.push(options.since);
6077
6094
  }
6078
- if (options?.memoryType) {
6079
- sql += ` AND m.memory_type = ?`;
6080
- args.push(options.memoryType);
6081
- }
6095
+ sql = appendMemoryTypeFilter(sql, args, "m.memory_type", options);
6082
6096
  sql += ` ORDER BY rank LIMIT ?`;
6083
6097
  args.push(limit);
6084
6098
  const result = await client.execute({ sql, args });
@@ -6135,9 +6149,16 @@ async function recentRecords(agentId, options, limit, textFilter) {
6135
6149
  AND timestamp >= ? AND timestamp <= ?
6136
6150
  AND COALESCE(status, 'active') = 'active'
6137
6151
  AND ${options?.includeRaw === false ? "COALESCE(memory_type, 'raw') != 'raw'" : "1 = 1"}
6152
+ ${options?.memoryTypes?.length ? `AND memory_type IN (${options.memoryTypes.map(() => "?").join(",")})` : options?.memoryType ? "AND memory_type = ?" : ""}
6138
6153
  AND COALESCE(confidence, 0.7) >= 0.3
6139
6154
  ORDER BY timestamp DESC LIMIT ?`,
6140
- args: [agentId, windowStart, killedAt, boundarySlots]
6155
+ args: [
6156
+ agentId,
6157
+ windowStart,
6158
+ killedAt,
6159
+ ...options?.memoryTypes?.length ? [...new Set(options.memoryTypes)] : options?.memoryType ? [options.memoryType] : [],
6160
+ boundarySlots
6161
+ ]
6141
6162
  });
6142
6163
  for (const row of boundaryResult.rows) {
6143
6164
  sessionBoundaryMemories.push(rowToMemoryRecord(row));
@@ -6183,10 +6204,7 @@ async function recentRecords(agentId, options, limit, textFilter) {
6183
6204
  sql += ` AND timestamp >= ?`;
6184
6205
  args.push(options.since);
6185
6206
  }
6186
- if (options?.memoryType) {
6187
- sql += ` AND memory_type = ?`;
6188
- args.push(options.memoryType);
6189
- }
6207
+ sql = appendMemoryTypeFilter(sql, args, "memory_type", options);
6190
6208
  if (textFilter) {
6191
6209
  sql += ` AND raw_text LIKE '%' || ? || '%'`;
6192
6210
  args.push(textFilter);
@@ -6879,6 +6879,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
6879
6879
  }
6880
6880
  }
6881
6881
  function schedulePostWriteMemoryHygiene(memoryIds) {
6882
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
6882
6883
  if (memoryIds.length === 0) return;
6883
6884
  const run = () => {
6884
6885
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -7273,7 +7274,7 @@ var init_platform_procedures = __esm({
7273
7274
  title: "Chain of command \u2014 who talks to whom",
7274
7275
  domain: "workflow",
7275
7276
  priority: "p0",
7276
- content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
7277
+ content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
7277
7278
  },
7278
7279
  {
7279
7280
  title: "Single dispatch path \u2014 create_task only",
@@ -7945,7 +7946,11 @@ async function searchMemories(queryVector, agentId, options) {
7945
7946
  sql += ` AND timestamp >= ?`;
7946
7947
  args.push(options.since);
7947
7948
  }
7948
- if (options?.memoryType) {
7949
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
7950
+ const uniqueTypes = [...new Set(options.memoryTypes)];
7951
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
7952
+ args.push(...uniqueTypes);
7953
+ } else if (options?.memoryType) {
7949
7954
  sql += ` AND memory_type = ?`;
7950
7955
  args.push(options.memoryType);
7951
7956
  }
@@ -3683,9 +3683,12 @@ var init_cto_delegation_gate = __esm({
3683
3683
  SCRATCHPAD_MAX_AGE_MS = 10 * 60 * 1e3;
3684
3684
  SCRATCHPAD_ESCAPE_PATTERN = /^(?:ENGINEER|TOM)-CAPABLE:\s*NO\s*—\s*reason:\s*\S+/m;
3685
3685
  GATE_BLOCK_MESSAGE = [
3686
- "DELEGATE CHECK: this edit looks implementable by an engineer.",
3687
- "Dispatch create_task now OR mark ENGINEER-CAPABLE: NO with reason.",
3688
- "No code until decided."
3686
+ "ACTION BLOCKED by CTO delegation gate. Your Write/Edit was DENIED \u2014 it did NOT execute.",
3687
+ "This edit looks implementable by an engineer. You MUST either:",
3688
+ " 1. Dispatch create_task to an engineer, OR",
3689
+ " 2. Add ENGINEER-CAPABLE: NO with explicit reason to proceed yourself.",
3690
+ "Do NOT report this action as successful. It was blocked. No file was changed.",
3691
+ "If you are a sub-agent, report this FAILURE to your parent agent."
3689
3692
  ].join("\n");
3690
3693
  }
3691
3694
  });
@@ -4085,6 +4088,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
4085
4088
  }
4086
4089
  }
4087
4090
  function schedulePostWriteMemoryHygiene(memoryIds) {
4091
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
4088
4092
  if (memoryIds.length === 0) return;
4089
4093
  const run = () => {
4090
4094
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -4479,7 +4483,7 @@ var init_platform_procedures = __esm({
4479
4483
  title: "Chain of command \u2014 who talks to whom",
4480
4484
  domain: "workflow",
4481
4485
  priority: "p0",
4482
- content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
4486
+ content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
4483
4487
  },
4484
4488
  {
4485
4489
  title: "Single dispatch path \u2014 create_task only",
@@ -5151,7 +5155,11 @@ async function searchMemories(queryVector, agentId, options) {
5151
5155
  sql += ` AND timestamp >= ?`;
5152
5156
  args.push(options.since);
5153
5157
  }
5154
- if (options?.memoryType) {
5158
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
5159
+ const uniqueTypes = [...new Set(options.memoryTypes)];
5160
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
5161
+ args.push(...uniqueTypes);
5162
+ } else if (options?.memoryType) {
5155
5163
  sql += ` AND memory_type = ?`;
5156
5164
  args.push(options.memoryType);
5157
5165
  }
@@ -5690,9 +5698,10 @@ process.stdin.on("end", async () => {
5690
5698
  hookSpecificOutput: {
5691
5699
  permissionDecision: "deny"
5692
5700
  },
5693
- systemMessage: `BLOCKED: You attempted to write to exe/${target}/ \u2014 that is ${target}'s task folder.
5694
- Your tasks are in exe/${agent.agentId}/. Use ask_team_memory("${target}") for context.
5695
- This write was prevented. Do NOT retry.`
5701
+ systemMessage: `ACTION BLOCKED: Your Write/Edit to exe/${target}/ was DENIED \u2014 it did NOT execute.
5702
+ That is ${target}'s task folder, not yours. Your tasks are in exe/${agent.agentId}/.
5703
+ Use ask_team_memory("${target}") if you need context from ${target}.
5704
+ Do NOT report this as successful. No file was changed. If you are a sub-agent, report FAILURE.`
5696
5705
  });
5697
5706
  process.stdout.write(output);
5698
5707
  process.exit(0);