@askexenow/exe-os 0.8.80 → 0.8.82

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 (110) hide show
  1. package/dist/bin/backfill-conversations.js +359 -267
  2. package/dist/bin/backfill-responses.js +357 -265
  3. package/dist/bin/backfill-vectors.js +339 -264
  4. package/dist/bin/cleanup-stale-review-tasks.js +315 -256
  5. package/dist/bin/cli.js +494 -240
  6. package/dist/bin/exe-agent.js +141 -46
  7. package/dist/bin/exe-assign.js +151 -63
  8. package/dist/bin/exe-boot.js +294 -115
  9. package/dist/bin/exe-call.js +76 -51
  10. package/dist/bin/exe-cloud.js +58 -45
  11. package/dist/bin/exe-dispatch.js +434 -277
  12. package/dist/bin/exe-doctor.js +317 -246
  13. package/dist/bin/exe-export-behaviors.js +328 -248
  14. package/dist/bin/exe-forget.js +314 -231
  15. package/dist/bin/exe-gateway.js +2676 -1402
  16. package/dist/bin/exe-heartbeat.js +329 -264
  17. package/dist/bin/exe-kill.js +324 -244
  18. package/dist/bin/exe-launch-agent.js +574 -463
  19. package/dist/bin/exe-link.js +1055 -95
  20. package/dist/bin/exe-new-employee.js +49 -54
  21. package/dist/bin/exe-pending-messages.js +310 -253
  22. package/dist/bin/exe-pending-notifications.js +299 -228
  23. package/dist/bin/exe-pending-reviews.js +314 -245
  24. package/dist/bin/exe-rename.js +259 -195
  25. package/dist/bin/exe-review.js +140 -64
  26. package/dist/bin/exe-search.js +543 -356
  27. package/dist/bin/exe-session-cleanup.js +463 -382
  28. package/dist/bin/exe-settings.js +129 -99
  29. package/dist/bin/exe-start.sh +6 -6
  30. package/dist/bin/exe-status.js +95 -36
  31. package/dist/bin/exe-team.js +116 -51
  32. package/dist/bin/git-sweep.js +482 -307
  33. package/dist/bin/graph-backfill.js +357 -245
  34. package/dist/bin/graph-export.js +324 -244
  35. package/dist/bin/install.js +33 -10
  36. package/dist/bin/scan-tasks.js +481 -307
  37. package/dist/bin/setup.js +1147 -140
  38. package/dist/bin/shard-migrate.js +321 -241
  39. package/dist/bin/update.js +1 -7
  40. package/dist/bin/wiki-sync.js +318 -238
  41. package/dist/gateway/index.js +2656 -1383
  42. package/dist/hooks/bug-report-worker.js +641 -472
  43. package/dist/hooks/commit-complete.js +482 -307
  44. package/dist/hooks/error-recall.js +363 -135
  45. package/dist/hooks/exe-heartbeat-hook.js +97 -27
  46. package/dist/hooks/ingest-worker.js +584 -397
  47. package/dist/hooks/ingest.js +123 -58
  48. package/dist/hooks/instructions-loaded.js +212 -82
  49. package/dist/hooks/notification.js +200 -70
  50. package/dist/hooks/post-compact.js +199 -81
  51. package/dist/hooks/pre-compact.js +352 -140
  52. package/dist/hooks/pre-tool-use.js +416 -278
  53. package/dist/hooks/prompt-ingest-worker.js +376 -299
  54. package/dist/hooks/prompt-submit.js +414 -188
  55. package/dist/hooks/response-ingest-worker.js +408 -338
  56. package/dist/hooks/session-end.js +209 -83
  57. package/dist/hooks/session-start.js +382 -158
  58. package/dist/hooks/stop.js +209 -83
  59. package/dist/hooks/subagent-stop.js +209 -85
  60. package/dist/hooks/summary-worker.js +606 -510
  61. package/dist/index.js +2133 -855
  62. package/dist/lib/cloud-sync.js +1175 -184
  63. package/dist/lib/config.js +1 -9
  64. package/dist/lib/consolidation.js +71 -34
  65. package/dist/lib/database.js +166 -14
  66. package/dist/lib/device-registry.js +189 -117
  67. package/dist/lib/embedder.js +6 -10
  68. package/dist/lib/employee-templates.js +134 -39
  69. package/dist/lib/employees.js +30 -7
  70. package/dist/lib/exe-daemon-client.js +5 -7
  71. package/dist/lib/exe-daemon.js +514 -152
  72. package/dist/lib/hybrid-search.js +543 -356
  73. package/dist/lib/identity-templates.js +15 -15
  74. package/dist/lib/identity.js +19 -15
  75. package/dist/lib/license.js +1 -7
  76. package/dist/lib/messaging.js +157 -135
  77. package/dist/lib/reminders.js +97 -0
  78. package/dist/lib/schedules.js +302 -231
  79. package/dist/lib/skill-learning.js +33 -27
  80. package/dist/lib/status-brief.js +11 -14
  81. package/dist/lib/store.js +326 -237
  82. package/dist/lib/task-router.js +105 -1
  83. package/dist/lib/tasks.js +233 -116
  84. package/dist/lib/tmux-routing.js +173 -56
  85. package/dist/lib/ws-client.js +13 -3
  86. package/dist/mcp/server.js +2009 -1015
  87. package/dist/mcp/tools/complete-reminder.js +97 -0
  88. package/dist/mcp/tools/create-reminder.js +97 -0
  89. package/dist/mcp/tools/create-task.js +426 -262
  90. package/dist/mcp/tools/deactivate-behavior.js +119 -44
  91. package/dist/mcp/tools/list-reminders.js +97 -0
  92. package/dist/mcp/tools/list-tasks.js +56 -57
  93. package/dist/mcp/tools/send-message.js +206 -143
  94. package/dist/mcp/tools/update-task.js +259 -85
  95. package/dist/runtime/index.js +495 -316
  96. package/dist/tui/App.js +1128 -919
  97. package/package.json +2 -10
  98. package/src/commands/exe/afk.md +8 -8
  99. package/src/commands/exe/assign.md +1 -1
  100. package/src/commands/exe/build-adv.md +1 -1
  101. package/src/commands/exe/call.md +10 -10
  102. package/src/commands/exe/employee-heartbeat.md +9 -6
  103. package/src/commands/exe/heartbeat.md +5 -5
  104. package/src/commands/exe/intercom.md +26 -15
  105. package/src/commands/exe/launch.md +2 -2
  106. package/src/commands/exe/new-employee.md +1 -1
  107. package/src/commands/exe/review.md +2 -2
  108. package/src/commands/exe/schedule.md +1 -1
  109. package/src/commands/exe/sessions.md +2 -2
  110. package/src/commands/exe.md +22 -20
@@ -155,13 +155,7 @@ var init_config = __esm({
155
155
  wikiUrl: "",
156
156
  wikiApiKey: "",
157
157
  wikiSyncIntervalMs: 30 * 60 * 1e3,
158
- wikiWorkspaceMapping: {
159
- exe: "Executive",
160
- yoshi: "Engineering",
161
- mari: "Marketing",
162
- tom: "Engineering",
163
- sasha: "Production"
164
- },
158
+ wikiWorkspaceMapping: {},
165
159
  wikiAutoUpdate: true,
166
160
  wikiAutoUpdateThreshold: 0.5,
167
161
  wikiAutoUpdateCreateNew: true,
@@ -198,6 +192,57 @@ var init_config = __esm({
198
192
  }
199
193
  });
200
194
 
195
+ // src/lib/employees.ts
196
+ import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
197
+ import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
198
+ import { execSync } from "child_process";
199
+ import path2 from "path";
200
+ import os2 from "os";
201
+ function normalizeRole(role) {
202
+ return (role ?? "").trim().toLowerCase();
203
+ }
204
+ function isCoordinatorRole(role) {
205
+ return normalizeRole(role) === normalizeRole(COORDINATOR_ROLE);
206
+ }
207
+ function getCoordinatorEmployee(employees) {
208
+ return employees.find((e) => isCoordinatorRole(e.role));
209
+ }
210
+ function getCoordinatorName(employees = loadEmployeesSync()) {
211
+ return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
212
+ }
213
+ async function loadEmployees(employeesPath = EMPLOYEES_PATH) {
214
+ if (!existsSync2(employeesPath)) {
215
+ return [];
216
+ }
217
+ const raw = await readFile2(employeesPath, "utf-8");
218
+ try {
219
+ return JSON.parse(raw);
220
+ } catch {
221
+ return [];
222
+ }
223
+ }
224
+ function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
225
+ if (!existsSync2(employeesPath)) return [];
226
+ try {
227
+ return JSON.parse(readFileSync2(employeesPath, "utf-8"));
228
+ } catch {
229
+ return [];
230
+ }
231
+ }
232
+ function getEmployee(employees, name) {
233
+ return employees.find((e) => e.name.toLowerCase() === name.toLowerCase());
234
+ }
235
+ var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE;
236
+ var init_employees = __esm({
237
+ "src/lib/employees.ts"() {
238
+ "use strict";
239
+ init_config();
240
+ EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
241
+ DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
242
+ COORDINATOR_ROLE = "COO";
243
+ }
244
+ });
245
+
201
246
  // src/lib/db-retry.ts
202
247
  function isBusyError(err) {
203
248
  if (err instanceof Error) {
@@ -237,7 +282,7 @@ function wrapWithRetry(client) {
237
282
  return (sql) => retryOnBusy(() => target.execute(sql), "execute");
238
283
  }
239
284
  if (prop === "batch") {
240
- return (stmts) => retryOnBusy(() => target.batch(stmts), "batch");
285
+ return (stmts, mode) => retryOnBusy(() => target.batch(stmts, mode), "batch");
241
286
  }
242
287
  return Reflect.get(target, prop, receiver);
243
288
  }
@@ -386,22 +431,24 @@ async function ensureSchema() {
386
431
  ON behaviors(agent_id, active);
387
432
  `);
388
433
  try {
434
+ const coordinatorName = getCoordinatorName();
389
435
  const existing = await client.execute({
390
- sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = 'exe'",
391
- args: []
436
+ sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = ?",
437
+ args: [coordinatorName]
392
438
  });
393
439
  if (Number(existing.rows[0]?.cnt) === 0) {
394
- await client.executeMultiple(`
395
- INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
396
- VALUES
397
- (hex(randomblob(16)), 'exe', NULL, 'workflow', 'Don''t ask "keep going?" \u2014 just keep executing phases/plans autonomously', 1, '2026-03-25T00:00:00Z', '2026-03-25T00:00:00Z');
398
- INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
399
- VALUES
400
- (hex(randomblob(16)), 'exe', NULL, 'tool-use', 'Always use create_task MCP tool, never write .md files directly for task creation', 1, '2026-03-25T00:00:00Z', '2026-03-25T00:00:00Z');
401
- INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
402
- VALUES
403
- (hex(randomblob(16)), 'exe', NULL, 'workflow', 'Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission', 1, '2026-03-25T00:00:00Z', '2026-03-25T00:00:00Z');
404
- `);
440
+ const seededAt = "2026-03-25T00:00:00Z";
441
+ for (const [domain, content] of [
442
+ ["workflow", `Don't ask "keep going?" \u2014 just keep executing phases/plans autonomously`],
443
+ ["tool-use", "Always use create_task MCP tool, never write .md files directly for task creation"],
444
+ ["workflow", "Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission"]
445
+ ]) {
446
+ await client.execute({
447
+ sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
448
+ VALUES (hex(randomblob(16)), ?, NULL, ?, ?, 1, ?, ?)`,
449
+ args: [coordinatorName, domain, content, seededAt, seededAt]
450
+ });
451
+ }
405
452
  }
406
453
  } catch {
407
454
  }
@@ -1093,12 +1140,46 @@ async function ensureSchema() {
1093
1140
  } catch {
1094
1141
  }
1095
1142
  }
1143
+ try {
1144
+ await client.execute({
1145
+ sql: `ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0`,
1146
+ args: []
1147
+ });
1148
+ } catch {
1149
+ }
1150
+ try {
1151
+ await client.execute(
1152
+ `CREATE INDEX IF NOT EXISTS idx_memories_draft ON memories(draft) WHERE draft = 1`
1153
+ );
1154
+ } catch {
1155
+ }
1156
+ try {
1157
+ await client.execute({
1158
+ sql: `ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'`,
1159
+ args: []
1160
+ });
1161
+ } catch {
1162
+ }
1163
+ try {
1164
+ await client.execute(
1165
+ `CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(memory_type)`
1166
+ );
1167
+ } catch {
1168
+ }
1169
+ try {
1170
+ await client.execute({
1171
+ sql: `ALTER TABLE memories ADD COLUMN trajectory TEXT`,
1172
+ args: []
1173
+ });
1174
+ } catch {
1175
+ }
1096
1176
  }
1097
1177
  var _client, _resilientClient, initTurso;
1098
1178
  var init_database = __esm({
1099
1179
  "src/lib/database.ts"() {
1100
1180
  "use strict";
1101
1181
  init_db_retry();
1182
+ init_employees();
1102
1183
  _client = null;
1103
1184
  _resilientClient = null;
1104
1185
  initTurso = initDatabase;
@@ -1227,7 +1308,11 @@ async function ensureShardSchema(client) {
1227
1308
  "ALTER TABLE memories ADD COLUMN source_path TEXT",
1228
1309
  "ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
1229
1310
  "ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
1230
- "ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
1311
+ "ALTER TABLE memories ADD COLUMN supersedes_id TEXT",
1312
+ // MS-11: draft staging, MS-6a: memory_type, MS-7: trajectory
1313
+ "ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0",
1314
+ "ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'",
1315
+ "ALTER TABLE memories ADD COLUMN trajectory TEXT"
1231
1316
  ]) {
1232
1317
  try {
1233
1318
  await client.execute(col);
@@ -1357,26 +1442,26 @@ var init_platform_procedures = __esm({
1357
1442
  title: "What is exe-os \u2014 the operating model every agent must understand",
1358
1443
  domain: "architecture",
1359
1444
  priority: "p0",
1360
- content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO (exe), CTO (yoshi), CMO (mari), engineers (tom), content (sasha). Each agent has identity, expertise, and experience layers \u2014 persistent memory that makes them better over time. All data is local-first, E2EE, owned by the user. The MCP server is the ONLY data interface \u2014 never access the DB directly."
1445
+ content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO, CTO, CMO, engineers, and content production specialists. Each agent has identity, expertise, and experience layers \u2014 persistent memory that makes them better over time. All data is local-first, E2EE, owned by the user. The MCP server is the ONLY data interface \u2014 never access the DB directly."
1361
1446
  },
1362
1447
  {
1363
1448
  title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
1364
1449
  domain: "architecture",
1365
1450
  priority: "p0",
1366
- content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC, runs /exe to boot the COO. exe manages employees in tmux sessions. Each exeN is a separate CC window/project. Employees (yoshi, tom, mari) run in their own tmux panes via create_task auto-spawn. The founder talks to exe; exe orchestrates the team. CC is the shell, exe-os is the brain."
1451
+ content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC and boots the COO. The COO manages employees in tmux sessions. Each coordinator session is a separate CC window/project. Employees run in their own tmux panes via create_task auto-spawn. The founder talks to the COO; the COO orchestrates the team. CC is the shell, exe-os is the brain."
1367
1452
  },
1368
1453
  {
1369
- title: "Sessions explained \u2014 what exeN means and how projects work",
1454
+ title: "Sessions explained \u2014 coordinator session names and projects",
1370
1455
  domain: "architecture",
1371
1456
  priority: "p0",
1372
- content: "Each exeN (exe1, exe2, exe3) is an isolated project session. exe1 might be exe-os development, exe2 might be exe-wiki. Each session spawns its own employees: exe1\u2192yoshi-exe1\u2192tom-exe1. Sessions share the same memory DB but tasks are scoped to the session that created them. A founder can run multiple projects simultaneously. Sessions never interfere with each other."
1457
+ content: "Each coordinator session is an isolated project session. One might be exe-os development, another might be exe-wiki. Each session spawns its own employees using {employee}-{coordinatorSession}. Sessions share the same memory DB but tasks are scoped to the session that created them. A founder can run multiple projects simultaneously. Sessions never interfere with each other."
1373
1458
  },
1374
1459
  // --- Hierarchy and dispatch ---
1375
1460
  {
1376
1461
  title: "Chain of command \u2014 who talks to whom",
1377
1462
  domain: "workflow",
1378
1463
  priority: "p0",
1379
- content: "Founder \u2192 exe (COO) \u2192 yoshi (CTO) / mari (CMO). Yoshi \u2192 tom (engineer). Mari \u2192 sasha (content). Never skip levels: exe never assigns directly to tom. Tom never reports directly to exe. 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."
1464
+ 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."
1380
1465
  },
1381
1466
  {
1382
1467
  title: "Single dispatch path \u2014 create_task only",
@@ -1386,30 +1471,30 @@ var init_platform_procedures = __esm({
1386
1471
  },
1387
1472
  // --- Session isolation ---
1388
1473
  {
1389
- title: "Session scoping \u2014 stay in your exe boundary",
1474
+ title: "Session scoping \u2014 stay in your coordinator boundary",
1390
1475
  domain: "security",
1391
1476
  priority: "p0",
1392
- content: "Session scoping is mandatory. Managers dispatch to workers within their own exe session ONLY. exe1\u2192yoshi-exe1\u2192tom-exe1. exe2\u2192yoshi-exe2\u2192tom2-exe2. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating exe session."
1477
+ content: "Session scoping is mandatory. Managers dispatch to workers within their own coordinator session ONLY. Employee sessions use {employee}-{coordinatorSession}. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating coordinator session."
1393
1478
  },
1394
1479
  {
1395
1480
  title: "Session isolation \u2014 never touch another session's work",
1396
1481
  domain: "workflow",
1397
1482
  priority: "p0",
1398
- content: `Sessions are isolated. exeN owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another exe session. (2) Never review work from a different session \u2014 report "belongs to exeN" and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: yoshi-exe1 works ONLY on exe1 tasks. Cross-session work is a system violation.`
1483
+ content: "Sessions are isolated. A coordinator session owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another coordinator session. (2) Never review work from a different session \u2014 report that it belongs to another session and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: employee sessions work ONLY on their parent coordinator session's tasks. Cross-session work is a system violation."
1399
1484
  },
1400
1485
  // --- Engineering: session scoping in code ---
1401
1486
  {
1402
1487
  title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
1403
1488
  domain: "architecture",
1404
1489
  priority: "p0",
1405
- content: "Every DB query, notification, review count, and task operation MUST be scoped on 3 dimensions: (1) Session \u2014 filter by session_scope matching current exeN. (2) Project \u2014 filter by project_name. (3) Role \u2014 agents only see data at their hierarchy level. When writing ANY function that touches tasks, reviews, messages, or notifications: always accept a sessionScope parameter and pass it to the SQL WHERE clause. Unscoped queries are bugs. Test by running 2+ exe sessions simultaneously."
1490
+ content: "Every DB query, notification, review count, and task operation MUST be scoped on 3 dimensions: (1) Session \u2014 filter by session_scope matching the current coordinator session. (2) Project \u2014 filter by project_name. (3) Role \u2014 agents only see data at their hierarchy level. When writing ANY function that touches tasks, reviews, messages, or notifications: always accept a sessionScope parameter and pass it to the SQL WHERE clause. Unscoped queries are bugs. Test by running 2+ coordinator sessions simultaneously."
1406
1491
  },
1407
1492
  // --- Hard constraints ---
1408
1493
  {
1409
1494
  title: "What you CANNOT do in exe-os \u2014 hard constraints",
1410
1495
  domain: "security",
1411
1496
  priority: "p0",
1412
- content: "NEVER: (1) Access the database directly \u2014 it's SQLCipher encrypted, always fails. Use MCP tools only. (2) Manually spawn tmux sessions \u2014 create_task handles it. (3) Run git checkout main \u2014 agents work in worktrees. (4) Modify another agent's in-progress task. (5) Push to remote \u2014 exe reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
1497
+ content: "NEVER: (1) Access the database directly \u2014 it's SQLCipher encrypted, always fails. Use MCP tools only. (2) Manually spawn tmux sessions \u2014 create_task handles it. (3) Run git checkout main \u2014 agents work in worktrees. (4) Modify another agent's in-progress task. (5) Push to remote \u2014 the COO reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
1413
1498
  },
1414
1499
  // --- Operations ---
1415
1500
  {
@@ -1527,30 +1612,11 @@ ${p.content}`).join("\n\n");
1527
1612
  }
1528
1613
  });
1529
1614
 
1530
- // src/lib/employees.ts
1531
- init_config();
1532
- import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
1533
- import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
1534
- import { execSync } from "child_process";
1535
- import path2 from "path";
1536
- import os2 from "os";
1537
- var EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
1538
- async function loadEmployees(employeesPath = EMPLOYEES_PATH) {
1539
- if (!existsSync2(employeesPath)) {
1540
- return [];
1541
- }
1542
- const raw = await readFile2(employeesPath, "utf-8");
1543
- try {
1544
- return JSON.parse(raw);
1545
- } catch {
1546
- return [];
1547
- }
1548
- }
1549
- function getEmployee(employees, name) {
1550
- return employees.find((e) => e.name.toLowerCase() === name.toLowerCase());
1551
- }
1615
+ // src/bin/exe-assign.ts
1616
+ init_employees();
1552
1617
 
1553
1618
  // src/lib/task-router.ts
1619
+ init_employees();
1554
1620
  import { randomUUID } from "crypto";
1555
1621
  var DEFAULT_BLOOM_CONFIG = {
1556
1622
  complexityToTier: {
@@ -1608,7 +1674,7 @@ async function scoreEmployee(taskVector, agentId, searchFn) {
1608
1674
  return { agentId, score: results.length / 5 };
1609
1675
  }
1610
1676
  async function routeTask(taskDescription, employees, embedFn, searchFn, options) {
1611
- let specialists = employees.filter((e) => e.name !== "exe");
1677
+ let specialists = employees.filter((e) => !isCoordinatorRole(e.role));
1612
1678
  if (specialists.length === 0) {
1613
1679
  throw new Error(
1614
1680
  "No specialist employees available. Create one with /exe-new-employee."
@@ -1778,6 +1844,10 @@ function spawnDaemon() {
1778
1844
  stdio: ["ignore", "ignore", stderrFd],
1779
1845
  env: {
1780
1846
  ...process.env,
1847
+ TMUX: void 0,
1848
+ // Daemon is global — must not inherit session scope
1849
+ TMUX_PANE: void 0,
1850
+ // Prevents resolveExeSession() from scoping to one session
1781
1851
  EXE_DAEMON_SOCK: SOCKET_PATH,
1782
1852
  EXE_DAEMON_PID: PID_PATH
1783
1853
  }
@@ -2227,7 +2297,10 @@ async function writeMemory(record) {
2227
2297
  source_path: record.source_path ?? null,
2228
2298
  source_type: record.source_type ?? null,
2229
2299
  tier: record.tier ?? classifyTier(record),
2230
- supersedes_id: record.supersedes_id ?? null
2300
+ supersedes_id: record.supersedes_id ?? null,
2301
+ draft: record.draft ? 1 : 0,
2302
+ memory_type: record.memory_type ?? "raw",
2303
+ trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null
2231
2304
  };
2232
2305
  _pendingRecords.push(dbRow);
2233
2306
  orgBus.emit({
@@ -2282,6 +2355,9 @@ async function flushBatch() {
2282
2355
  const sourceType = row.source_type ?? null;
2283
2356
  const tier = row.tier ?? 3;
2284
2357
  const supersedesId = row.supersedes_id ?? null;
2358
+ const draft = row.draft ? 1 : 0;
2359
+ const memoryType = row.memory_type ?? "raw";
2360
+ const trajectory = row.trajectory ?? null;
2285
2361
  return {
2286
2362
  sql: hasVector ? `INSERT OR IGNORE INTO memories
2287
2363
  (id, agent_id, agent_role, session_id, timestamp,
@@ -2289,15 +2365,15 @@ async function flushBatch() {
2289
2365
  has_error, raw_text, vector, version, task_id, importance, status,
2290
2366
  confidence, last_accessed,
2291
2367
  workspace_id, document_id, user_id, char_offset, page_number,
2292
- source_path, source_type, tier, supersedes_id)
2293
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories
2368
+ source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
2369
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories
2294
2370
  (id, agent_id, agent_role, session_id, timestamp,
2295
2371
  tool_name, project_name,
2296
2372
  has_error, raw_text, vector, version, task_id, importance, status,
2297
2373
  confidence, last_accessed,
2298
2374
  workspace_id, document_id, user_id, char_offset, page_number,
2299
- source_path, source_type, tier, supersedes_id)
2300
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
2375
+ source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
2376
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
2301
2377
  args: hasVector ? [
2302
2378
  row.id,
2303
2379
  row.agent_id,
@@ -2323,7 +2399,10 @@ async function flushBatch() {
2323
2399
  sourcePath,
2324
2400
  sourceType,
2325
2401
  tier,
2326
- supersedesId
2402
+ supersedesId,
2403
+ draft,
2404
+ memoryType,
2405
+ trajectory
2327
2406
  ] : [
2328
2407
  row.id,
2329
2408
  row.agent_id,
@@ -2348,7 +2427,10 @@ async function flushBatch() {
2348
2427
  sourcePath,
2349
2428
  sourceType,
2350
2429
  tier,
2351
- supersedesId
2430
+ supersedesId,
2431
+ draft,
2432
+ memoryType,
2433
+ trajectory
2352
2434
  ]
2353
2435
  };
2354
2436
  };
@@ -2417,6 +2499,8 @@ async function searchMemories(queryVector, agentId, options) {
2417
2499
  const limit = options?.limit ?? 10;
2418
2500
  const statusFilter = options?.includeArchived ? "" : `
2419
2501
  AND COALESCE(status, 'active') = 'active'`;
2502
+ const draftFilter = options?.includeDrafts ? "" : `
2503
+ AND (draft = 0 OR draft IS NULL)`;
2420
2504
  let sql = `SELECT id, agent_id, agent_role, session_id, timestamp,
2421
2505
  tool_name, project_name,
2422
2506
  has_error, raw_text, vector, importance, status,
@@ -2426,7 +2510,7 @@ async function searchMemories(queryVector, agentId, options) {
2426
2510
  source_path, source_type
2427
2511
  FROM memories
2428
2512
  WHERE agent_id = ?
2429
- AND vector IS NOT NULL${statusFilter}
2513
+ AND vector IS NOT NULL${statusFilter}${draftFilter}
2430
2514
  AND COALESCE(confidence, 0.7) >= 0.3`;
2431
2515
  const args = [agentId];
2432
2516
  const scope = buildWikiScopeFilter(options, "");
@@ -2448,6 +2532,10 @@ async function searchMemories(queryVector, agentId, options) {
2448
2532
  sql += ` AND timestamp >= ?`;
2449
2533
  args.push(options.since);
2450
2534
  }
2535
+ if (options?.memoryType) {
2536
+ sql += ` AND memory_type = ?`;
2537
+ args.push(options.memoryType);
2538
+ }
2451
2539
  sql += ` ORDER BY vector_distance_cos(vector, vector32(?))`;
2452
2540
  args.push(vectorToBlob(queryVector));
2453
2541
  sql += ` LIMIT ?`;