@askexenow/exe-os 0.9.16 → 0.9.18

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 (97) hide show
  1. package/dist/bin/backfill-conversations.js +1242 -909
  2. package/dist/bin/backfill-responses.js +1245 -912
  3. package/dist/bin/backfill-vectors.js +1244 -906
  4. package/dist/bin/cleanup-stale-review-tasks.js +1870 -417
  5. package/dist/bin/cli.js +217 -107
  6. package/dist/bin/exe-agent-config.js +2 -2
  7. package/dist/bin/exe-agent.js +62 -0
  8. package/dist/bin/exe-assign.js +346 -10
  9. package/dist/bin/exe-boot.js +387 -32
  10. package/dist/bin/exe-call.js +72 -2
  11. package/dist/bin/exe-cloud.js +8 -0
  12. package/dist/bin/exe-dispatch.js +1821 -225
  13. package/dist/bin/exe-doctor.js +720 -52
  14. package/dist/bin/exe-export-behaviors.js +1429 -148
  15. package/dist/bin/exe-forget.js +1408 -34
  16. package/dist/bin/exe-gateway.js +1629 -1295
  17. package/dist/bin/exe-heartbeat.js +1899 -448
  18. package/dist/bin/exe-kill.js +1624 -346
  19. package/dist/bin/exe-launch-agent.js +726 -90
  20. package/dist/bin/exe-link.js +27 -8
  21. package/dist/bin/exe-new-employee.js +75 -9
  22. package/dist/bin/exe-pending-messages.js +2769 -1316
  23. package/dist/bin/exe-pending-notifications.js +2829 -1376
  24. package/dist/bin/exe-pending-reviews.js +2847 -1392
  25. package/dist/bin/exe-rename.js +89 -8
  26. package/dist/bin/exe-review.js +1494 -312
  27. package/dist/bin/exe-search.js +1608 -1300
  28. package/dist/bin/exe-session-cleanup.js +194 -91
  29. package/dist/bin/exe-settings.js +10 -2
  30. package/dist/bin/exe-start-codex.js +769 -120
  31. package/dist/bin/exe-start-opencode.js +763 -108
  32. package/dist/bin/exe-status.js +1887 -434
  33. package/dist/bin/exe-team.js +1782 -324
  34. package/dist/bin/git-sweep.js +408 -33
  35. package/dist/bin/graph-backfill.js +681 -27
  36. package/dist/bin/graph-export.js +1419 -141
  37. package/dist/bin/install.js +4 -8
  38. package/dist/bin/intercom-check.js +8641 -0
  39. package/dist/bin/scan-tasks.js +553 -38
  40. package/dist/bin/setup.js +82 -10
  41. package/dist/bin/shard-migrate.js +682 -28
  42. package/dist/gateway/index.js +1629 -1295
  43. package/dist/hooks/bug-report-worker.js +1136 -183
  44. package/dist/hooks/codex-stop-task-finalizer.js +1060 -107
  45. package/dist/hooks/commit-complete.js +408 -33
  46. package/dist/hooks/error-recall.js +1608 -1300
  47. package/dist/hooks/ingest-worker.js +250 -7966
  48. package/dist/hooks/ingest.js +707 -119
  49. package/dist/hooks/instructions-loaded.js +383 -20
  50. package/dist/hooks/notification.js +383 -20
  51. package/dist/hooks/post-compact.js +384 -21
  52. package/dist/hooks/{response-ingest-worker.js → post-tool-combined.js} +4157 -1716
  53. package/dist/hooks/pre-compact.js +486 -45
  54. package/dist/hooks/pre-tool-use.js +385 -22
  55. package/dist/hooks/prompt-submit.js +291 -96
  56. package/dist/hooks/session-end.js +490 -48
  57. package/dist/hooks/session-start.js +236 -22
  58. package/dist/hooks/stop.js +192 -50
  59. package/dist/hooks/subagent-stop.js +95 -18
  60. package/dist/hooks/summary-worker.js +205 -361
  61. package/dist/index.js +221 -105
  62. package/dist/lib/agent-config.js +2 -2
  63. package/dist/lib/cloud-sync.js +27 -8
  64. package/dist/lib/consolidation.js +437 -41
  65. package/dist/lib/database.js +20 -8
  66. package/dist/lib/db-daemon-client.js +2 -2
  67. package/dist/lib/db.js +20 -8
  68. package/dist/lib/device-registry.js +27 -8
  69. package/dist/lib/employee-templates.js +62 -0
  70. package/dist/lib/employees.js +2 -2
  71. package/dist/lib/exe-daemon.js +6703 -6259
  72. package/dist/lib/hybrid-search.js +1608 -1300
  73. package/dist/lib/identity.js +1 -1
  74. package/dist/lib/messaging.js +11 -3
  75. package/dist/lib/reminders.js +1 -1
  76. package/dist/lib/schedules.js +718 -26
  77. package/dist/lib/session-registry.js +11 -0
  78. package/dist/lib/skill-learning.js +639 -9
  79. package/dist/lib/store.js +676 -27
  80. package/dist/lib/tasks.js +665 -27
  81. package/dist/lib/tmux-routing.js +732 -94
  82. package/dist/lib/token-spend.js +1 -1
  83. package/dist/mcp/server.js +856 -383
  84. package/dist/mcp/tools/complete-reminder.js +1 -1
  85. package/dist/mcp/tools/create-reminder.js +1 -1
  86. package/dist/mcp/tools/create-task.js +616 -46
  87. package/dist/mcp/tools/deactivate-behavior.js +9 -1
  88. package/dist/mcp/tools/list-reminders.js +1 -1
  89. package/dist/mcp/tools/list-tasks.js +10 -2
  90. package/dist/mcp/tools/send-message.js +11 -3
  91. package/dist/mcp/tools/update-task.js +677 -39
  92. package/dist/runtime/index.js +425 -37
  93. package/dist/tui/App.js +365 -34
  94. package/package.json +5 -2
  95. package/src/commands/exe/intercom.md +6 -17
  96. package/dist/bin/wiki-sync.js +0 -2991
  97. package/dist/hooks/prompt-ingest-worker.js +0 -3979
@@ -84,9 +84,9 @@ var MAX_RETRIES, BASE_DELAY_MS, MAX_JITTER_MS;
84
84
  var init_db_retry = __esm({
85
85
  "src/lib/db-retry.ts"() {
86
86
  "use strict";
87
- MAX_RETRIES = 3;
88
- BASE_DELAY_MS = 200;
89
- MAX_JITTER_MS = 300;
87
+ MAX_RETRIES = 5;
88
+ BASE_DELAY_MS = 250;
89
+ MAX_JITTER_MS = 400;
90
90
  }
91
91
  });
92
92
 
@@ -1594,7 +1594,7 @@ function createDaemonDbClient(fallbackClient) {
1594
1594
  });
1595
1595
  if (response.error) {
1596
1596
  const errMsg = String(response.error);
1597
- if (errMsg === "Not connected" || errMsg === "Request timeout" || errMsg === "Write failed") {
1597
+ if (errMsg === "Not connected" || errMsg === "Request timeout" || errMsg === "Write failed" || errMsg === "DB not initialized") {
1598
1598
  process.stderr.write(`[db-daemon] Transport error (${errMsg}), falling back to direct
1599
1599
  `);
1600
1600
  return fallbackClient.execute(stmt);
@@ -1619,7 +1619,7 @@ function createDaemonDbClient(fallbackClient) {
1619
1619
  });
1620
1620
  if (response.error) {
1621
1621
  const errMsg = String(response.error);
1622
- if (errMsg === "Not connected" || errMsg === "Request timeout" || errMsg === "Write failed") {
1622
+ if (errMsg === "Not connected" || errMsg === "Request timeout" || errMsg === "Write failed" || errMsg === "DB not initialized") {
1623
1623
  process.stderr.write(`[db-daemon] Batch transport error (${errMsg}), falling back to direct
1624
1624
  `);
1625
1625
  return fallbackClient.batch(stmts, mode);
@@ -1742,7 +1742,7 @@ async function initDatabase(config) {
1742
1742
  });
1743
1743
  }, 3e4);
1744
1744
  _walCheckpointTimer.unref();
1745
- if (process.env.DATABASE_URL) {
1745
+ if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
1746
1746
  _adapterClient = await createPrismaDbAdapter(_resilientClient);
1747
1747
  }
1748
1748
  }
@@ -1753,7 +1753,7 @@ function getClient() {
1753
1753
  if (!_adapterClient) {
1754
1754
  throw new Error("Database client not initialized. Call initDatabase() first.");
1755
1755
  }
1756
- if (process.env.DATABASE_URL) {
1756
+ if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") {
1757
1757
  return _adapterClient;
1758
1758
  }
1759
1759
  if (process.env.EXE_IS_DAEMON === "1") {
@@ -1765,9 +1765,11 @@ function getClient() {
1765
1765
  return _resilientClient;
1766
1766
  }
1767
1767
  async function initDaemonClient() {
1768
- if (process.env.DATABASE_URL) return;
1768
+ if (process.env.DATABASE_URL && process.env.EXE_USE_POSTGRES === "1") return;
1769
1769
  if (process.env.EXE_IS_DAEMON === "1") return;
1770
+ if (process.env.VITEST) return;
1770
1771
  if (!_resilientClient) return;
1772
+ if (_daemonClient) return;
1771
1773
  try {
1772
1774
  const { initDaemonDbClient: initDaemonDbClient2 } = await Promise.resolve().then(() => (init_db_daemon_client(), db_daemon_client_exports));
1773
1775
  _daemonClient = await initDaemonDbClient2(_resilientClient);
@@ -1916,6 +1918,13 @@ async function ensureSchema() {
1916
1918
  });
1917
1919
  } catch {
1918
1920
  }
1921
+ try {
1922
+ await client.execute({
1923
+ sql: `ALTER TABLE behaviors ADD COLUMN vector F32_BLOB(${EMBEDDING_DIM})`,
1924
+ args: []
1925
+ });
1926
+ } catch {
1927
+ }
1919
1928
  try {
1920
1929
  await client.execute({
1921
1930
  sql: `ALTER TABLE tasks ADD COLUMN blocked_by TEXT`,
@@ -2786,6 +2795,7 @@ var init_database = __esm({
2786
2795
  init_db_retry();
2787
2796
  init_employees();
2788
2797
  init_database_adapter();
2798
+ init_memory();
2789
2799
  _client = null;
2790
2800
  _resilientClient = null;
2791
2801
  _walCheckpointTimer = null;
@@ -3338,6 +3348,68 @@ var init_platform_procedures = __esm({
3338
3348
  domain: "architecture",
3339
3349
  priority: "p0",
3340
3350
  content: "Tasks live in the DB. Intercom (tmux send-keys) is fire-and-forget \u2014 it may fail, get garbled, or arrive mid-work. Never rely on intercom for task delivery. The UserPromptSubmit hook checks the DB for new tasks on every prompt. Your operating procedures step 7 says check for next work. The daemon nudges idle agents as a speedup. If you have no tasks, you found them all."
3351
+ },
3352
+ // --- MCP is the ONLY data interface ---
3353
+ {
3354
+ title: "MCP disconnect \u2014 ask the user, never work around it",
3355
+ domain: "workflow",
3356
+ priority: "p0",
3357
+ content: "If MCP tools are unavailable, disconnected, or returning connection errors: STOP. Tell the user clearly: 'MCP server is disconnected. Please run /mcp to reconnect.' Do NOT attempt workarounds \u2014 no raw Node imports, no direct DB access, no CLI hacks, no daemon socket calls. MCP is the ONLY data interface. Working around it wastes time, hits bundling issues, and bypasses the contract boundary. Ask once, wait, proceed when reconnected."
3358
+ },
3359
+ // --- MCP Tool Catalog (Layer 0 — every agent knows what tools exist) ---
3360
+ {
3361
+ title: "MCP tools \u2014 memory and search",
3362
+ domain: "tool-use",
3363
+ priority: "p1",
3364
+ content: "recall_my_memory: search your own memories (semantic + FTS). ask_team_memory: search a colleague's memories by agent name. store_memory: persist a memory (decisions, summaries, context). commit_memory: high-importance memory that survives consolidation. search_everything: unified search across memories, tasks, entities, conversations. get_session_context: temporal window of memories around a timestamp. consolidate_memories: merge duplicate/related memories into insights. get_memory_cardinality: count memories per agent (health check)."
3365
+ },
3366
+ {
3367
+ title: "MCP tools \u2014 task orchestration",
3368
+ domain: "tool-use",
3369
+ priority: "p1",
3370
+ content: "create_task: dispatch work to an employee (auto-spawns session). The ONLY dispatch path. list_tasks: query tasks by status, assignee, project. get_task: fetch full task details by ID. update_task: change status (in_progress, done, blocked, cancelled) + add result summary. close_task: finalize a reviewed task (COO only). checkpoint_task: save progress state for crash recovery. resume_employee: re-spawn an employee session for an existing task."
3371
+ },
3372
+ {
3373
+ title: "MCP tools \u2014 knowledge graph (GraphRAG)",
3374
+ domain: "tool-use",
3375
+ priority: "p1",
3376
+ content: "query_relationships: find connections between entities in the knowledge graph. get_entity_neighbors: explore an entity's direct connections. get_hot_entities: find most-referenced entities (trending topics). get_graph_stats: graph health \u2014 entity/relationship counts, density. export_graph: export graph data for visualization. merge_entities: deduplicate entities (alias resolution). find_similar_trajectories: match tool-call patterns to past task solutions."
3377
+ },
3378
+ {
3379
+ title: "MCP tools \u2014 identity, behavior, and decisions",
3380
+ domain: "tool-use",
3381
+ priority: "p1",
3382
+ content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query."
3383
+ },
3384
+ {
3385
+ title: "MCP tools \u2014 communication and messaging",
3386
+ domain: "tool-use",
3387
+ priority: "p1",
3388
+ content: "send_message: send supplementary context to another agent (NOT for actionable work \u2014 use create_task). acknowledge_messages: mark messages as read. send_whatsapp: send WhatsApp message via gateway (customer-facing alerts). query_conversations: search ingested conversations across all channels (WhatsApp, email, etc.)."
3389
+ },
3390
+ {
3391
+ title: "MCP tools \u2014 wiki, documents, and content",
3392
+ domain: "tool-use",
3393
+ priority: "p1",
3394
+ content: "create_wiki_page: create a wiki page in exe-wiki. list_wiki_pages: browse wiki pages. get_wiki_page: read a wiki page. update_wiki_page: edit a wiki page. ingest_document: import a file (PDF, MD, etc.) into memory as chunks. list_documents: browse ingested documents by workspace. purge_document: remove a document and its memory chunks. set_document_importance: adjust chunk importance scores. rerank_documents: re-score document relevance for a query."
3395
+ },
3396
+ {
3397
+ title: "MCP tools \u2014 system, operations, and admin",
3398
+ domain: "tool-use",
3399
+ priority: "p1",
3400
+ content: "get_agent_spend: token usage per agent/session (cost tracking). list_agent_sessions: view agent session history. get_session_kills: audit log of killed sessions. get_daemon_health: check exed daemon status. get_auto_wake_status: daemon auto-wake configuration. get_worker_gate: check worker deployment gates. run_memory_audit: health check \u2014 duplicates, null vectors, orphaned rows. run_consolidation: trigger sleep-time memory consolidation. cloud_sync: force a cloud sync cycle. backup_vps: trigger VPS backup."
3401
+ },
3402
+ {
3403
+ title: "MCP tools \u2014 config, licensing, and team",
3404
+ domain: "tool-use",
3405
+ priority: "p1",
3406
+ content: "set_agent_config: view/change per-agent runtime and model settings. list_employees: view the employee roster. add_person: add a person to the CRM contacts roster. list_people: browse CRM contacts. get_person: fetch contact details. get_license_status: check license validity. create_license: generate a new license key (admin). list_licenses: view all issued licenses. activate_license: activate a license on a device."
3407
+ },
3408
+ {
3409
+ title: "MCP tools \u2014 advanced (triggers, skills, orchestration)",
3410
+ domain: "tool-use",
3411
+ priority: "p1",
3412
+ content: "create_trigger: set up a scheduled recurring agent job (cron). list_triggers: view active triggers. load_skill: load a slash-command skill dynamically. apply_starter_pack: import a pre-built behavior + identity pack for a role. export_orchestration: export full org state (tasks, behaviors, identities) as portable JSON. import_orchestration: import org state into a new instance. deploy_client: deploy a customer client instance. query_company_brain: unified RAG query across all company knowledge. create_reminder: set a text reminder (shown in boot brief). list_reminders: view pending reminders. complete_reminder: mark a reminder done. global_procedure: manage Layer 0 procedures (actions: store, list, deactivate). Legacy aliases: store_global_procedure, list_global_procedures, deactivate_global_procedure."
3341
3413
  }
3342
3414
  ];
3343
3415
  PLATFORM_PROCEDURE_TITLES = new Set(
@@ -3487,6 +3559,11 @@ async function initStore(options) {
3487
3559
  encryptionKey: hexKey
3488
3560
  });
3489
3561
  await retryOnBusy2(() => ensureSchema(), "ensureSchema");
3562
+ try {
3563
+ const { initDaemonClient: initDaemonClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
3564
+ await initDaemonClient2();
3565
+ } catch {
3566
+ }
3490
3567
  if (!options?.lightweight) {
3491
3568
  try {
3492
3569
  const { initShardManager: initShardManager2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
@@ -4347,7 +4424,7 @@ var init_agent_config = __esm({
4347
4424
  init_secure_files();
4348
4425
  AGENT_CONFIG_PATH = path9.join(EXE_AI_DIR, "agent-config.json");
4349
4426
  DEFAULT_MODELS = {
4350
- claude: "claude-opus-4",
4427
+ claude: "claude-opus-4.6",
4351
4428
  codex: RUNTIME_TABLE.codex?.defaultModel ?? "gpt-5.4",
4352
4429
  opencode: RUNTIME_TABLE.opencode?.defaultModel ?? "anthropic/claude-sonnet-4-6"
4353
4430
  };
@@ -4926,15 +5003,20 @@ async function createTaskCore(input) {
4926
5003
  const { resolveExeSession: resolveExeSession2 } = await Promise.resolve().then(() => (init_tmux_routing(), tmux_routing_exports));
4927
5004
  const resolved = resolveExeSession2();
4928
5005
  if (resolved && input.projectName) {
4929
- const { getSessionProject: getSessionProject2 } = await Promise.resolve().then(() => (init_session_scope(), session_scope_exports));
4930
- const sessionProject = getSessionProject2(resolved);
4931
- if (sessionProject && sessionProject !== input.projectName) {
4932
- scopeMismatchWarning = `session/project mismatch: session "${resolved}" owns "${sessionProject}" but task targets "${input.projectName}". Routed to default scope.`;
4933
- process.stderr.write(`[create_task] ${scopeMismatchWarning}
4934
- `);
4935
- earlySessionScope = null;
4936
- } else {
5006
+ const isCoordinatorSession = !resolved.includes("-");
5007
+ if (isCoordinatorSession) {
4937
5008
  earlySessionScope = resolved;
5009
+ } else {
5010
+ const { getSessionProject: getSessionProject2 } = await Promise.resolve().then(() => (init_session_scope(), session_scope_exports));
5011
+ const sessionProject = getSessionProject2(resolved);
5012
+ if (sessionProject && sessionProject !== input.projectName) {
5013
+ scopeMismatchWarning = `session/project mismatch: session "${resolved}" owns "${sessionProject}" but task targets "${input.projectName}". Routed to default scope.`;
5014
+ process.stderr.write(`[create_task] ${scopeMismatchWarning}
5015
+ `);
5016
+ earlySessionScope = null;
5017
+ } else {
5018
+ earlySessionScope = resolved;
5019
+ }
4938
5020
  }
4939
5021
  } else {
4940
5022
  earlySessionScope = resolved;
@@ -5819,6 +5901,10 @@ async function dispatchTaskToEmployee(input) {
5819
5901
  if (transport.isAlive(sessionName)) {
5820
5902
  const result = sendIntercom(sessionName);
5821
5903
  const dispatched = result === "acknowledged" || result === "debounced" || result === "queued" ? "verified" : result === "delivered" ? "sent_unverified" : "session_dead";
5904
+ process.stderr.write(
5905
+ `[dispatch-audit] intercom \u2192 ${sessionName} | task="${input.title}" [${input.priority}] | result=${dispatched} (sendIntercom=${result})
5906
+ `
5907
+ );
5822
5908
  return { dispatched, session: sessionName, crossProject };
5823
5909
  } else {
5824
5910
  const projectDir = input.projectDir ?? process.cwd();
@@ -5827,11 +5913,15 @@ async function dispatchTaskToEmployee(input) {
5827
5913
  });
5828
5914
  if (result.status === "failed") {
5829
5915
  process.stderr.write(
5830
- `[dispatch] Failed to spawn ${input.assignedTo}: ${result.error}
5916
+ `[dispatch-audit] SPAWN FAILED \u2192 ${input.assignedTo} | task="${input.title}" [${input.priority}] | error=${result.error}
5831
5917
  `
5832
5918
  );
5833
5919
  return { dispatched: "session_missing" };
5834
5920
  }
5921
+ process.stderr.write(
5922
+ `[dispatch-audit] SPAWNED \u2192 ${result.sessionName} | task="${input.title}" [${input.priority}]
5923
+ `
5924
+ );
5835
5925
  return { dispatched: "spawned", session: result.sessionName, crossProject };
5836
5926
  }
5837
5927
  } catch {
@@ -5841,7 +5931,13 @@ async function dispatchTaskToEmployee(input) {
5841
5931
  function notifyTaskDone() {
5842
5932
  try {
5843
5933
  const key = getSessionKey();
5844
- if (key && !process.env.VITEST) notifyParentExe(key);
5934
+ if (key && !process.env.VITEST) {
5935
+ notifyParentExe(key);
5936
+ process.stderr.write(
5937
+ `[dispatch-audit] notifyTaskDone \u2192 parent coordinator (session=${key})
5938
+ `
5939
+ );
5940
+ }
5845
5941
  } catch {
5846
5942
  }
5847
5943
  }
@@ -5862,16 +5958,91 @@ var init_tasks_notify = __esm({
5862
5958
  }
5863
5959
  });
5864
5960
 
5961
+ // src/lib/embedder.ts
5962
+ var embedder_exports = {};
5963
+ __export(embedder_exports, {
5964
+ disposeEmbedder: () => disposeEmbedder,
5965
+ embed: () => embed,
5966
+ embedDirect: () => embedDirect,
5967
+ getEmbedder: () => getEmbedder
5968
+ });
5969
+ async function getEmbedder() {
5970
+ const ok = await connectEmbedDaemon();
5971
+ if (!ok) {
5972
+ throw new Error(
5973
+ "Could not connect to embedding daemon. Ensure the model is installed (run /exe-setup)."
5974
+ );
5975
+ }
5976
+ }
5977
+ async function embed(text) {
5978
+ const priority = process.env.EXE_EMBED_PRIORITY === "low" ? "low" : "high";
5979
+ const vector = await embedViaClient(text, priority);
5980
+ if (!vector) {
5981
+ throw new Error(
5982
+ "Embedding failed: daemon unavailable. Run /exe-setup to verify model installation."
5983
+ );
5984
+ }
5985
+ if (vector.length !== EMBEDDING_DIM) {
5986
+ throw new Error(
5987
+ `Embedding dimension mismatch: expected ${EMBEDDING_DIM}, got ${vector.length}. Ensure the correct Jina v5-small Q4_K_M GGUF model is installed.`
5988
+ );
5989
+ }
5990
+ return vector;
5991
+ }
5992
+ async function disposeEmbedder() {
5993
+ disconnectClient();
5994
+ }
5995
+ async function embedDirect(text) {
5996
+ const llamaCpp = await import("node-llama-cpp");
5997
+ const { MODELS_DIR: MODELS_DIR2 } = await Promise.resolve().then(() => (init_config(), config_exports));
5998
+ const { existsSync: existsSync18 } = await import("fs");
5999
+ const path21 = await import("path");
6000
+ const modelPath = path21.join(MODELS_DIR2, "jina-embeddings-v5-small-q4_k_m.gguf");
6001
+ if (!existsSync18(modelPath)) {
6002
+ throw new Error(`Embedding model not found at ${modelPath}. Run '/exe-setup' to download it.`);
6003
+ }
6004
+ const llama = await llamaCpp.getLlama();
6005
+ const model = await llama.loadModel({ modelPath });
6006
+ const context = await model.createEmbeddingContext();
6007
+ try {
6008
+ const embedding = await context.getEmbeddingFor(text);
6009
+ const vector = Array.from(embedding.vector);
6010
+ if (vector.length !== EMBEDDING_DIM) {
6011
+ throw new Error(
6012
+ `Embedding dimension mismatch: expected ${EMBEDDING_DIM}, got ${vector.length}.`
6013
+ );
6014
+ }
6015
+ return vector;
6016
+ } finally {
6017
+ await context.dispose();
6018
+ await model.dispose();
6019
+ }
6020
+ }
6021
+ var init_embedder = __esm({
6022
+ "src/lib/embedder.ts"() {
6023
+ "use strict";
6024
+ init_memory();
6025
+ init_exe_daemon_client();
6026
+ }
6027
+ });
6028
+
5865
6029
  // src/lib/behaviors.ts
5866
6030
  import crypto5 from "crypto";
5867
6031
  async function storeBehavior(opts) {
5868
6032
  const client = getClient();
5869
6033
  const id = crypto5.randomUUID();
5870
6034
  const now = (/* @__PURE__ */ new Date()).toISOString();
6035
+ let vector = null;
6036
+ try {
6037
+ const { embed: embed2 } = await Promise.resolve().then(() => (init_embedder(), embedder_exports));
6038
+ const vec = await embed2(opts.content);
6039
+ vector = new Float32Array(vec);
6040
+ } catch {
6041
+ }
5871
6042
  await client.execute({
5872
- sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, priority, content, active, created_at, updated_at)
5873
- VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?)`,
5874
- args: [id, opts.agentId, opts.projectName ?? null, opts.domain ?? null, opts.priority ?? "p1", opts.content, now, now]
6043
+ sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, priority, content, active, created_at, updated_at, vector)
6044
+ VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?, ?)`,
6045
+ args: [id, opts.agentId, opts.projectName ?? null, opts.domain ?? null, opts.priority ?? "p1", opts.content, now, now, vector ? vector.buffer : null]
5875
6046
  });
5876
6047
  return id;
5877
6048
  }
@@ -6974,7 +7145,7 @@ function isSessionBusy(sessionName) {
6974
7145
  function isExeSession(sessionName) {
6975
7146
  const matchesBaseWithInstance = (baseName) => sessionName === baseName || sessionName.startsWith(baseName) && /^\d+$/.test(sessionName.slice(baseName.length));
6976
7147
  const coordinatorName = getCoordinatorName();
6977
- return matchesBaseWithInstance(coordinatorName) || matchesBaseWithInstance("exe");
7148
+ return matchesBaseWithInstance(coordinatorName);
6978
7149
  }
6979
7150
  function sendIntercom(targetSession) {
6980
7151
  const transport = getTransport();
@@ -7511,74 +7682,6 @@ var init_task_scope = __esm({
7511
7682
  }
7512
7683
  });
7513
7684
 
7514
- // src/lib/embedder.ts
7515
- var embedder_exports = {};
7516
- __export(embedder_exports, {
7517
- disposeEmbedder: () => disposeEmbedder,
7518
- embed: () => embed,
7519
- embedDirect: () => embedDirect,
7520
- getEmbedder: () => getEmbedder
7521
- });
7522
- async function getEmbedder() {
7523
- const ok = await connectEmbedDaemon();
7524
- if (!ok) {
7525
- throw new Error(
7526
- "Could not connect to embedding daemon. Ensure the model is installed (run /exe-setup)."
7527
- );
7528
- }
7529
- }
7530
- async function embed(text) {
7531
- const priority = process.env.EXE_EMBED_PRIORITY === "low" ? "low" : "high";
7532
- const vector = await embedViaClient(text, priority);
7533
- if (!vector) {
7534
- throw new Error(
7535
- "Embedding failed: daemon unavailable. Run /exe-setup to verify model installation."
7536
- );
7537
- }
7538
- if (vector.length !== EMBEDDING_DIM) {
7539
- throw new Error(
7540
- `Embedding dimension mismatch: expected ${EMBEDDING_DIM}, got ${vector.length}. Ensure the correct Jina v5-small Q4_K_M GGUF model is installed.`
7541
- );
7542
- }
7543
- return vector;
7544
- }
7545
- async function disposeEmbedder() {
7546
- disconnectClient();
7547
- }
7548
- async function embedDirect(text) {
7549
- const llamaCpp = await import("node-llama-cpp");
7550
- const { MODELS_DIR: MODELS_DIR2 } = await Promise.resolve().then(() => (init_config(), config_exports));
7551
- const { existsSync: existsSync18 } = await import("fs");
7552
- const path21 = await import("path");
7553
- const modelPath = path21.join(MODELS_DIR2, "jina-embeddings-v5-small-q4_k_m.gguf");
7554
- if (!existsSync18(modelPath)) {
7555
- throw new Error(`Embedding model not found at ${modelPath}. Run '/exe-setup' to download it.`);
7556
- }
7557
- const llama = await llamaCpp.getLlama();
7558
- const model = await llama.loadModel({ modelPath });
7559
- const context = await model.createEmbeddingContext();
7560
- try {
7561
- const embedding = await context.getEmbeddingFor(text);
7562
- const vector = Array.from(embedding.vector);
7563
- if (vector.length !== EMBEDDING_DIM) {
7564
- throw new Error(
7565
- `Embedding dimension mismatch: expected ${EMBEDDING_DIM}, got ${vector.length}.`
7566
- );
7567
- }
7568
- return vector;
7569
- } finally {
7570
- await context.dispose();
7571
- await model.dispose();
7572
- }
7573
- }
7574
- var init_embedder = __esm({
7575
- "src/lib/embedder.ts"() {
7576
- "use strict";
7577
- init_memory();
7578
- init_exe_daemon_client();
7579
- }
7580
- });
7581
-
7582
7685
  // src/lib/git-task-sweep.ts
7583
7686
  var git_task_sweep_exports = {};
7584
7687
  __export(git_task_sweep_exports, {
@@ -285,6 +285,13 @@ var init_database_adapter = __esm({
285
285
  }
286
286
  });
287
287
 
288
+ // src/types/memory.ts
289
+ var init_memory = __esm({
290
+ "src/types/memory.ts"() {
291
+ "use strict";
292
+ }
293
+ });
294
+
288
295
  // src/lib/database.ts
289
296
  import { createClient } from "@libsql/client";
290
297
  var init_database = __esm({
@@ -293,6 +300,7 @@ var init_database = __esm({
293
300
  init_db_retry();
294
301
  init_employees();
295
302
  init_database_adapter();
303
+ init_memory();
296
304
  }
297
305
  });
298
306
 
@@ -388,7 +396,7 @@ var init_agent_config = __esm({
388
396
  init_secure_files();
389
397
  AGENT_CONFIG_PATH = path7.join(EXE_AI_DIR, "agent-config.json");
390
398
  KNOWN_RUNTIMES = {
391
- claude: ["claude-opus-4", "claude-sonnet-4", "claude-haiku-4.5"],
399
+ claude: ["claude-opus-4.6", "claude-opus-4", "claude-sonnet-4.6", "claude-sonnet-4", "claude-haiku-4.5"],
392
400
  codex: ["gpt-5.4", "gpt-5.5", "gpt-5.3-codex-spark", "o3", "o4-mini"],
393
401
  opencode: ["anthropic/claude-sonnet-4-6", "openai/gpt-5.4", "google/gemini-2.5-pro", "deepseek/deepseek-r3", "minimax/minimax-m2.5"]
394
402
  };
@@ -398,7 +406,7 @@ var init_agent_config = __esm({
398
406
  opencode: "OpenCode (open source)"
399
407
  };
400
408
  DEFAULT_MODELS = {
401
- claude: "claude-opus-4",
409
+ claude: "claude-opus-4.6",
402
410
  codex: RUNTIME_TABLE.codex?.defaultModel ?? "gpt-5.4",
403
411
  opencode: RUNTIME_TABLE.opencode?.defaultModel ?? "anthropic/claude-sonnet-4-6"
404
412
  };