@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
@@ -3625,6 +3625,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
3625
3625
  }
3626
3626
  }
3627
3627
  function schedulePostWriteMemoryHygiene(memoryIds) {
3628
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
3628
3629
  if (memoryIds.length === 0) return;
3629
3630
  const run = () => {
3630
3631
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -4019,7 +4020,7 @@ var init_platform_procedures = __esm({
4019
4020
  title: "Chain of command \u2014 who talks to whom",
4020
4021
  domain: "workflow",
4021
4022
  priority: "p0",
4022
- 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."
4023
+ 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."
4023
4024
  },
4024
4025
  {
4025
4026
  title: "Single dispatch path \u2014 create_task only",
@@ -4691,7 +4692,11 @@ async function searchMemories(queryVector, agentId, options) {
4691
4692
  sql += ` AND timestamp >= ?`;
4692
4693
  args.push(options.since);
4693
4694
  }
4694
- if (options?.memoryType) {
4695
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
4696
+ const uniqueTypes = [...new Set(options.memoryTypes)];
4697
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
4698
+ args.push(...uniqueTypes);
4699
+ } else if (options?.memoryType) {
4695
4700
  sql += ` AND memory_type = ?`;
4696
4701
  args.push(options.memoryType);
4697
4702
  }
@@ -3576,7 +3576,7 @@ var init_platform_procedures = __esm({
3576
3576
  title: "Chain of command \u2014 who talks to whom",
3577
3577
  domain: "workflow",
3578
3578
  priority: "p0",
3579
- 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."
3579
+ 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."
3580
3580
  },
3581
3581
  {
3582
3582
  title: "Single dispatch path \u2014 create_task only",
package/dist/index.js CHANGED
@@ -7169,6 +7169,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
7169
7169
  }
7170
7170
  }
7171
7171
  function schedulePostWriteMemoryHygiene(memoryIds) {
7172
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
7172
7173
  if (memoryIds.length === 0) return;
7173
7174
  const run = () => {
7174
7175
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -7563,7 +7564,7 @@ var init_platform_procedures = __esm({
7563
7564
  title: "Chain of command \u2014 who talks to whom",
7564
7565
  domain: "workflow",
7565
7566
  priority: "p0",
7566
- 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."
7567
+ 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."
7567
7568
  },
7568
7569
  {
7569
7570
  title: "Single dispatch path \u2014 create_task only",
@@ -8235,7 +8236,11 @@ async function searchMemories(queryVector, agentId, options) {
8235
8236
  sql += ` AND timestamp >= ?`;
8236
8237
  args.push(options.since);
8237
8238
  }
8238
- if (options?.memoryType) {
8239
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
8240
+ const uniqueTypes = [...new Set(options.memoryTypes)];
8241
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
8242
+ args.push(...uniqueTypes);
8243
+ } else if (options?.memoryType) {
8239
8244
  sql += ` AND memory_type = ?`;
8240
8245
  args.push(options.memoryType);
8241
8246
  }
@@ -167,7 +167,7 @@ var PLATFORM_PROCEDURES = [
167
167
  title: "Chain of command \u2014 who talks to whom",
168
168
  domain: "workflow",
169
169
  priority: "p0",
170
- 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."
170
+ 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."
171
171
  },
172
172
  {
173
173
  title: "Single dispatch path \u2014 create_task only",
@@ -811,7 +811,7 @@ created_by: system
811
811
  ---
812
812
  ## Identity
813
813
 
814
- You are {{agent_name}}, the Chief Operating Officer at {{company_name}}.
814
+ You are {{agent_name}}, the {{title}} at {{company_name}}.
815
815
 
816
816
  You are {{founder_name}}'s most reliable teammate in business \u2014 the knowledgeable older sibling who has been through it all. You have seen projects succeed and fail. You know what matters and what is noise. You do not get anxious about problems; you see them coming, stay calm, and handle them.
817
817
 
@@ -898,11 +898,13 @@ All memory, tasks, behaviors, documents, and wiki content belonging to {{company
898
898
  var CLIENT_COO_PLACEHOLDERS = [
899
899
  "agent_name",
900
900
  "company_name",
901
- "founder_name"
901
+ "founder_name",
902
+ "title"
902
903
  ];
903
904
  function renderClientCOOTemplate(vars) {
905
+ const resolved = { ...vars, title: vars.title || "Chief Operating Officer" };
904
906
  for (const key of CLIENT_COO_PLACEHOLDERS) {
905
- const value = vars[key];
907
+ const value = resolved[key];
906
908
  if (typeof value !== "string" || value.length === 0) {
907
909
  throw new Error(
908
910
  `renderClientCOOTemplate: missing required variable "${key}"`
@@ -911,7 +913,7 @@ function renderClientCOOTemplate(vars) {
911
913
  }
912
914
  let out = CLIENT_COO_TEMPLATE;
913
915
  for (const key of CLIENT_COO_PLACEHOLDERS) {
914
- out = out.split(`{{${key}}}`).join(vars[key]);
916
+ out = out.split(`{{${key}}}`).join(resolved[key]);
915
917
  }
916
918
  if (vars.industry_context) {
917
919
  out += "\n" + vars.industry_context;
@@ -3343,6 +3343,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
3343
3343
  }
3344
3344
  }
3345
3345
  function schedulePostWriteMemoryHygiene(memoryIds) {
3346
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
3346
3347
  if (memoryIds.length === 0) return;
3347
3348
  const run = () => {
3348
3349
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -4341,7 +4342,7 @@ var init_platform_procedures = __esm({
4341
4342
  title: "Chain of command \u2014 who talks to whom",
4342
4343
  domain: "workflow",
4343
4344
  priority: "p0",
4344
- 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."
4345
+ 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."
4345
4346
  },
4346
4347
  {
4347
4348
  title: "Single dispatch path \u2014 create_task only",
@@ -5013,7 +5014,11 @@ async function searchMemories(queryVector, agentId, options) {
5013
5014
  sql += ` AND timestamp >= ?`;
5014
5015
  args.push(options.since);
5015
5016
  }
5016
- if (options?.memoryType) {
5017
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
5018
+ const uniqueTypes = [...new Set(options.memoryTypes)];
5019
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
5020
+ args.push(...uniqueTypes);
5021
+ } else if (options?.memoryType) {
5017
5022
  sql += ` AND memory_type = ?`;
5018
5023
  args.push(options.memoryType);
5019
5024
  }
@@ -6397,6 +6402,17 @@ __export(hybrid_search_exports, {
6397
6402
  rrfMerge: () => rrfMerge,
6398
6403
  rrfMergeMulti: () => rrfMergeMulti
6399
6404
  });
6405
+ function appendMemoryTypeFilter(sql, args, column, options) {
6406
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
6407
+ const uniqueTypes = [...new Set(options.memoryTypes)];
6408
+ sql += ` AND ${column} IN (${uniqueTypes.map(() => "?").join(",")})`;
6409
+ args.push(...uniqueTypes);
6410
+ } else if (options?.memoryType) {
6411
+ sql += ` AND ${column} = ?`;
6412
+ args.push(options.memoryType);
6413
+ }
6414
+ return sql;
6415
+ }
6400
6416
  async function hybridSearch(queryText, agentId, options) {
6401
6417
  const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
6402
6418
  const config2 = await loadConfig2();
@@ -6625,6 +6641,7 @@ async function estimateCardinality(agentId, options) {
6625
6641
  sql += ` AND timestamp >= ?`;
6626
6642
  args.push(options.since);
6627
6643
  }
6644
+ sql = appendMemoryTypeFilter(sql, args, "memory_type", options);
6628
6645
  try {
6629
6646
  const result = await client.execute({ sql, args });
6630
6647
  return Number(result.rows[0]?.cnt) || 0;
@@ -6746,10 +6763,7 @@ async function ftsQuery(client, matchExpr, agentId, options, limit) {
6746
6763
  sql += ` AND m.timestamp >= ?`;
6747
6764
  args.push(options.since);
6748
6765
  }
6749
- if (options?.memoryType) {
6750
- sql += ` AND m.memory_type = ?`;
6751
- args.push(options.memoryType);
6752
- }
6766
+ sql = appendMemoryTypeFilter(sql, args, "m.memory_type", options);
6753
6767
  sql += ` ORDER BY rank LIMIT ?`;
6754
6768
  args.push(limit);
6755
6769
  const result = await client.execute({ sql, args });
@@ -6806,9 +6820,16 @@ async function recentRecords(agentId, options, limit, textFilter) {
6806
6820
  AND timestamp >= ? AND timestamp <= ?
6807
6821
  AND COALESCE(status, 'active') = 'active'
6808
6822
  AND ${options?.includeRaw === false ? "COALESCE(memory_type, 'raw') != 'raw'" : "1 = 1"}
6823
+ ${options?.memoryTypes?.length ? `AND memory_type IN (${options.memoryTypes.map(() => "?").join(",")})` : options?.memoryType ? "AND memory_type = ?" : ""}
6809
6824
  AND COALESCE(confidence, 0.7) >= 0.3
6810
6825
  ORDER BY timestamp DESC LIMIT ?`,
6811
- args: [agentId, windowStart, killedAt, boundarySlots]
6826
+ args: [
6827
+ agentId,
6828
+ windowStart,
6829
+ killedAt,
6830
+ ...options?.memoryTypes?.length ? [...new Set(options.memoryTypes)] : options?.memoryType ? [options.memoryType] : [],
6831
+ boundarySlots
6832
+ ]
6812
6833
  });
6813
6834
  for (const row of boundaryResult.rows) {
6814
6835
  sessionBoundaryMemories.push(rowToMemoryRecord(row));
@@ -6854,10 +6875,7 @@ async function recentRecords(agentId, options, limit, textFilter) {
6854
6875
  sql += ` AND timestamp >= ?`;
6855
6876
  args.push(options.since);
6856
6877
  }
6857
- if (options?.memoryType) {
6858
- sql += ` AND memory_type = ?`;
6859
- args.push(options.memoryType);
6860
- }
6878
+ sql = appendMemoryTypeFilter(sql, args, "memory_type", options);
6861
6879
  if (textFilter) {
6862
6880
  sql += ` AND raw_text LIKE '%' || ? || '%'`;
6863
6881
  args.push(textFilter);
@@ -7267,6 +7285,67 @@ var init_active_agent = __esm({
7267
7285
  }
7268
7286
  });
7269
7287
 
7288
+ // src/lib/memory-retrieval-modes.ts
7289
+ function applyRetrievalMode(base, mode) {
7290
+ if (!mode || mode === "all") return base;
7291
+ const next = { ...base };
7292
+ switch (mode) {
7293
+ case "decisions_only":
7294
+ next.memoryTypes = ["decision", "adr"];
7295
+ next.includeRaw = false;
7296
+ break;
7297
+ case "behaviors_only":
7298
+ next.memoryTypes = ["behavior"];
7299
+ next.includeRaw = false;
7300
+ break;
7301
+ case "procedures_only":
7302
+ next.memoryTypes = ["procedure"];
7303
+ next.includeRaw = false;
7304
+ break;
7305
+ case "operational":
7306
+ next.memoryTypes = ["raw", "observation"];
7307
+ next.includeRaw = true;
7308
+ break;
7309
+ case "no_raw":
7310
+ next.includeRaw = false;
7311
+ break;
7312
+ case "recent_high_value":
7313
+ next.memoryTypes = ["decision", "adr", "behavior", "procedure"];
7314
+ next.includeRaw = false;
7315
+ break;
7316
+ default:
7317
+ return next;
7318
+ }
7319
+ return next;
7320
+ }
7321
+ function formatRetrievalModes() {
7322
+ return RETRIEVAL_MODES.map((mode) => `${mode}: ${RETRIEVAL_MODE_DESCRIPTIONS[mode]}`).join("; ");
7323
+ }
7324
+ var RETRIEVAL_MODES, RETRIEVAL_MODE_DESCRIPTIONS;
7325
+ var init_memory_retrieval_modes = __esm({
7326
+ "src/lib/memory-retrieval-modes.ts"() {
7327
+ "use strict";
7328
+ RETRIEVAL_MODES = [
7329
+ "all",
7330
+ "decisions_only",
7331
+ "behaviors_only",
7332
+ "procedures_only",
7333
+ "operational",
7334
+ "no_raw",
7335
+ "recent_high_value"
7336
+ ];
7337
+ RETRIEVAL_MODE_DESCRIPTIONS = {
7338
+ all: "All visible memory types.",
7339
+ decisions_only: "Only decisions and ADRs.",
7340
+ behaviors_only: "Only durable behavior/correction memories.",
7341
+ procedures_only: "Only procedures/runbooks.",
7342
+ operational: "Raw operational/debug/tool output.",
7343
+ no_raw: "All non-raw memory types.",
7344
+ recent_high_value: "High-value durable memory types, intended for recency recovery."
7345
+ };
7346
+ }
7347
+ });
7348
+
7270
7349
  // src/mcp/tools/recall-my-memory.ts
7271
7350
  import { z } from "zod";
7272
7351
  function formatSourceLine(record) {
@@ -7304,7 +7383,8 @@ function registerRecallMyMemory(server) {
7304
7383
  ),
7305
7384
  include_source: z.boolean().optional().default(false).describe(
7306
7385
  "When true, attach parent document metadata (filename, mime, source_type) to each result. Default false."
7307
- )
7386
+ ),
7387
+ retrieval_mode: z.enum(RETRIEVAL_MODES).optional().default("all").describe(`Typed retrieval mode. ${formatRetrievalModes()}`)
7308
7388
  }
7309
7389
  },
7310
7390
  async ({
@@ -7318,7 +7398,8 @@ function registerRecallMyMemory(server) {
7318
7398
  include_archived,
7319
7399
  workspace_id,
7320
7400
  user_id,
7321
- include_source
7401
+ include_source,
7402
+ retrieval_mode
7322
7403
  }) => {
7323
7404
  try {
7324
7405
  if (!recent && !query) {
@@ -7328,7 +7409,7 @@ function registerRecallMyMemory(server) {
7328
7409
  };
7329
7410
  }
7330
7411
  const { agentId } = getActiveAgent();
7331
- const searchOptions = {
7412
+ const searchOptions = applyRetrievalMode({
7332
7413
  projectName: project_name,
7333
7414
  hasError: has_error,
7334
7415
  toolName: tool_name,
@@ -7339,7 +7420,7 @@ function registerRecallMyMemory(server) {
7339
7420
  includeSource: include_source,
7340
7421
  includeDrafts: true,
7341
7422
  ...user_id !== void 0 ? { userId: user_id } : {}
7342
- };
7423
+ }, retrieval_mode);
7343
7424
  let results;
7344
7425
  if (recent) {
7345
7426
  results = await recentRecords(agentId, searchOptions, limit, query);
@@ -7397,6 +7478,7 @@ var init_recall_my_memory = __esm({
7397
7478
  init_hybrid_search();
7398
7479
  init_store();
7399
7480
  init_active_agent();
7481
+ init_memory_retrieval_modes();
7400
7482
  }
7401
7483
  });
7402
7484
 
@@ -7432,10 +7514,11 @@ function registerAskTeamMemory(server) {
7432
7514
  ),
7433
7515
  include_raw: z2.boolean().optional().default(false).describe(
7434
7516
  "Include raw technical memories when ACL allows it (default: non-raw memories only for cross-agent reads)"
7435
- )
7517
+ ),
7518
+ retrieval_mode: z2.enum(RETRIEVAL_MODES).optional().default("all").describe(`Typed retrieval mode. Raw visibility is still ACL-gated. ${formatRetrievalModes()}`)
7436
7519
  }
7437
7520
  },
7438
- async ({ team_member, query, project_name, limit, since, include_archived, include_raw: _include_raw }) => {
7521
+ async ({ team_member, query, project_name, limit, since, include_archived, include_raw: _include_raw, retrieval_mode }) => {
7439
7522
  try {
7440
7523
  const { agentId: queryingAgentId, agentRole: queryingAgentRole } = getActiveAgent();
7441
7524
  const employees = loadEmployeesSync();
@@ -7444,16 +7527,18 @@ function registerAskTeamMemory(server) {
7444
7527
  const targetRole = targetEmployee?.role ?? "";
7445
7528
  const hasRawAccess = canSeeRaw(queryingRole, targetRole);
7446
7529
  const effectiveIncludeRaw = _include_raw && hasRawAccess;
7447
- const results = await hybridSearch(query, team_member, {
7530
+ const requestedMode = retrieval_mode ?? "all";
7531
+ const safeMode = !effectiveIncludeRaw && ["all", "operational"].includes(requestedMode) ? "no_raw" : requestedMode;
7532
+ const searchOptions = applyRetrievalMode({
7448
7533
  projectName: project_name,
7449
7534
  limit,
7450
7535
  since,
7451
7536
  includeArchived: include_archived,
7452
7537
  includeDrafts: false,
7453
- includeRaw: effectiveIncludeRaw,
7454
- memoryType: void 0
7455
- // Show all memory types — privacy enforced by draft filter + ACL, not type filter
7456
- });
7538
+ includeRaw: effectiveIncludeRaw
7539
+ }, safeMode);
7540
+ if (!effectiveIncludeRaw) searchOptions.includeRaw = false;
7541
+ const results = await hybridSearch(query, team_member, searchOptions);
7457
7542
  if (results.length === 0) {
7458
7543
  return {
7459
7544
  content: [
@@ -7495,6 +7580,7 @@ var init_ask_team_memory = __esm({
7495
7580
  init_hybrid_search();
7496
7581
  init_active_agent();
7497
7582
  init_employees();
7583
+ init_memory_retrieval_modes();
7498
7584
  }
7499
7585
  });
7500
7586
 
@@ -15306,8 +15392,9 @@ var init_starter_packs = __esm({
15306
15392
 
15307
15393
  // src/lib/employee-templates.ts
15308
15394
  function renderClientCOOTemplate(vars) {
15395
+ const resolved = { ...vars, title: vars.title || "Chief Operating Officer" };
15309
15396
  for (const key of CLIENT_COO_PLACEHOLDERS) {
15310
- const value = vars[key];
15397
+ const value = resolved[key];
15311
15398
  if (typeof value !== "string" || value.length === 0) {
15312
15399
  throw new Error(
15313
15400
  `renderClientCOOTemplate: missing required variable "${key}"`
@@ -15316,7 +15403,7 @@ function renderClientCOOTemplate(vars) {
15316
15403
  }
15317
15404
  let out = CLIENT_COO_TEMPLATE;
15318
15405
  for (const key of CLIENT_COO_PLACEHOLDERS) {
15319
- out = out.split(`{{${key}}}`).join(vars[key]);
15406
+ out = out.split(`{{${key}}}`).join(resolved[key]);
15320
15407
  }
15321
15408
  if (vars.industry_context) {
15322
15409
  out += "\n" + vars.industry_context;
@@ -15337,7 +15424,7 @@ created_by: system
15337
15424
  ---
15338
15425
  ## Identity
15339
15426
 
15340
- You are {{agent_name}}, the Chief Operating Officer at {{company_name}}.
15427
+ You are {{agent_name}}, the {{title}} at {{company_name}}.
15341
15428
 
15342
15429
  You are {{founder_name}}'s most reliable teammate in business \u2014 the knowledgeable older sibling who has been through it all. You have seen projects succeed and fail. You know what matters and what is noise. You do not get anxious about problems; you see them coming, stay calm, and handle them.
15343
15430
 
@@ -15424,7 +15511,8 @@ All memory, tasks, behaviors, documents, and wiki content belonging to {{company
15424
15511
  CLIENT_COO_PLACEHOLDERS = [
15425
15512
  "agent_name",
15426
15513
  "company_name",
15427
- "founder_name"
15514
+ "founder_name",
15515
+ "title"
15428
15516
  ];
15429
15517
  }
15430
15518
  });
@@ -15598,6 +15686,7 @@ ${vars}`);
15598
15686
  agent_name,
15599
15687
  company_name,
15600
15688
  founder_name,
15689
+ title: "Chief Operating Officer",
15601
15690
  industry_context: pack.identityContext ?? void 0
15602
15691
  });
15603
15692
  cooSummaryLines = [
@@ -3184,6 +3184,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
3184
3184
  }
3185
3185
  }
3186
3186
  function schedulePostWriteMemoryHygiene(memoryIds) {
3187
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
3187
3188
  if (memoryIds.length === 0) return;
3188
3189
  const run = () => {
3189
3190
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -3578,7 +3579,7 @@ var init_platform_procedures = __esm({
3578
3579
  title: "Chain of command \u2014 who talks to whom",
3579
3580
  domain: "workflow",
3580
3581
  priority: "p0",
3581
- 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."
3582
+ 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."
3582
3583
  },
3583
3584
  {
3584
3585
  title: "Single dispatch path \u2014 create_task only",
@@ -4250,7 +4251,11 @@ async function searchMemories(queryVector, agentId, options) {
4250
4251
  sql += ` AND timestamp >= ?`;
4251
4252
  args.push(options.since);
4252
4253
  }
4253
- if (options?.memoryType) {
4254
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
4255
+ const uniqueTypes = [...new Set(options.memoryTypes)];
4256
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
4257
+ args.push(...uniqueTypes);
4258
+ } else if (options?.memoryType) {
4254
4259
  sql += ` AND memory_type = ?`;
4255
4260
  args.push(options.memoryType);
4256
4261
  }
@@ -5542,6 +5547,17 @@ var init_entity_boost = __esm({
5542
5547
  init_store();
5543
5548
  init_database();
5544
5549
  var RRF_K = 60;
5550
+ function appendMemoryTypeFilter(sql, args, column, options) {
5551
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
5552
+ const uniqueTypes = [...new Set(options.memoryTypes)];
5553
+ sql += ` AND ${column} IN (${uniqueTypes.map(() => "?").join(",")})`;
5554
+ args.push(...uniqueTypes);
5555
+ } else if (options?.memoryType) {
5556
+ sql += ` AND ${column} = ?`;
5557
+ args.push(options.memoryType);
5558
+ }
5559
+ return sql;
5560
+ }
5545
5561
  async function hybridSearch(queryText, agentId, options) {
5546
5562
  const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
5547
5563
  const config = await loadConfig2();
@@ -5770,6 +5786,7 @@ async function estimateCardinality(agentId, options) {
5770
5786
  sql += ` AND timestamp >= ?`;
5771
5787
  args.push(options.since);
5772
5788
  }
5789
+ sql = appendMemoryTypeFilter(sql, args, "memory_type", options);
5773
5790
  try {
5774
5791
  const result = await client.execute({ sql, args });
5775
5792
  return Number(result.rows[0]?.cnt) || 0;
@@ -5891,10 +5908,7 @@ async function ftsQuery(client, matchExpr, agentId, options, limit) {
5891
5908
  sql += ` AND m.timestamp >= ?`;
5892
5909
  args.push(options.since);
5893
5910
  }
5894
- if (options?.memoryType) {
5895
- sql += ` AND m.memory_type = ?`;
5896
- args.push(options.memoryType);
5897
- }
5911
+ sql = appendMemoryTypeFilter(sql, args, "m.memory_type", options);
5898
5912
  sql += ` ORDER BY rank LIMIT ?`;
5899
5913
  args.push(limit);
5900
5914
  const result = await client.execute({ sql, args });
@@ -5951,9 +5965,16 @@ async function recentRecords(agentId, options, limit, textFilter) {
5951
5965
  AND timestamp >= ? AND timestamp <= ?
5952
5966
  AND COALESCE(status, 'active') = 'active'
5953
5967
  AND ${options?.includeRaw === false ? "COALESCE(memory_type, 'raw') != 'raw'" : "1 = 1"}
5968
+ ${options?.memoryTypes?.length ? `AND memory_type IN (${options.memoryTypes.map(() => "?").join(",")})` : options?.memoryType ? "AND memory_type = ?" : ""}
5954
5969
  AND COALESCE(confidence, 0.7) >= 0.3
5955
5970
  ORDER BY timestamp DESC LIMIT ?`,
5956
- args: [agentId, windowStart, killedAt, boundarySlots]
5971
+ args: [
5972
+ agentId,
5973
+ windowStart,
5974
+ killedAt,
5975
+ ...options?.memoryTypes?.length ? [...new Set(options.memoryTypes)] : options?.memoryType ? [options.memoryType] : [],
5976
+ boundarySlots
5977
+ ]
5957
5978
  });
5958
5979
  for (const row of boundaryResult.rows) {
5959
5980
  sessionBoundaryMemories.push(rowToMemoryRecord(row));
@@ -5999,10 +6020,7 @@ async function recentRecords(agentId, options, limit, textFilter) {
5999
6020
  sql += ` AND timestamp >= ?`;
6000
6021
  args.push(options.since);
6001
6022
  }
6002
- if (options?.memoryType) {
6003
- sql += ` AND memory_type = ?`;
6004
- args.push(options.memoryType);
6005
- }
6023
+ sql = appendMemoryTypeFilter(sql, args, "memory_type", options);
6006
6024
  if (textFilter) {
6007
6025
  sql += ` AND raw_text LIKE '%' || ? || '%'`;
6008
6026
  args.push(textFilter);
@@ -2944,7 +2944,7 @@ var init_platform_procedures = __esm({
2944
2944
  title: "Chain of command \u2014 who talks to whom",
2945
2945
  domain: "workflow",
2946
2946
  priority: "p0",
2947
- 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."
2947
+ 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."
2948
2948
  },
2949
2949
  {
2950
2950
  title: "Single dispatch path \u2014 create_task only",
package/dist/lib/store.js CHANGED
@@ -2944,7 +2944,7 @@ var init_platform_procedures = __esm({
2944
2944
  title: "Chain of command \u2014 who talks to whom",
2945
2945
  domain: "workflow",
2946
2946
  priority: "p0",
2947
- 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."
2947
+ 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."
2948
2948
  },
2949
2949
  {
2950
2950
  title: "Single dispatch path \u2014 create_task only",
@@ -3568,6 +3568,7 @@ async function runPostWriteMemoryHygiene(memoryId) {
3568
3568
  }
3569
3569
  }
3570
3570
  function schedulePostWriteMemoryHygiene(memoryIds) {
3571
+ if (process.env.EXE_SKIP_MEMORY_HYGIENE === "1") return;
3571
3572
  if (memoryIds.length === 0) return;
3572
3573
  const run = () => {
3573
3574
  void Promise.all(memoryIds.map((id) => runPostWriteMemoryHygiene(id)));
@@ -4026,7 +4027,11 @@ async function searchMemories(queryVector, agentId, options) {
4026
4027
  sql += ` AND timestamp >= ?`;
4027
4028
  args.push(options.since);
4028
4029
  }
4029
- if (options?.memoryType) {
4030
+ if (options?.memoryTypes && options.memoryTypes.length > 0) {
4031
+ const uniqueTypes = [...new Set(options.memoryTypes)];
4032
+ sql += ` AND memory_type IN (${uniqueTypes.map(() => "?").join(",")})`;
4033
+ args.push(...uniqueTypes);
4034
+ } else if (options?.memoryType) {
4030
4035
  sql += ` AND memory_type = ?`;
4031
4036
  args.push(options.memoryType);
4032
4037
  }