@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
@@ -1,5 +1,7 @@
1
- // src/bin/exe-settings.ts
2
- import { createInterface } from "readline";
1
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
+ var __esm = (fn, res) => function __init() {
3
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
4
+ };
3
5
 
4
6
  // src/lib/config.ts
5
7
  import { readFile, writeFile, mkdir, chmod } from "fs/promises";
@@ -22,75 +24,6 @@ function resolveDataDir() {
22
24
  }
23
25
  return newDir;
24
26
  }
25
- var EXE_AI_DIR = resolveDataDir();
26
- var DB_PATH = path.join(EXE_AI_DIR, "memories.db");
27
- var MODELS_DIR = path.join(EXE_AI_DIR, "models");
28
- var CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
29
- var LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
30
- var CURRENT_CONFIG_VERSION = 1;
31
- var DEFAULT_CONFIG = {
32
- config_version: CURRENT_CONFIG_VERSION,
33
- dbPath: DB_PATH,
34
- modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
35
- embeddingDim: 1024,
36
- batchSize: 20,
37
- flushIntervalMs: 1e4,
38
- autoIngestion: true,
39
- autoRetrieval: true,
40
- searchMode: "hybrid",
41
- hookSearchMode: "hybrid",
42
- fileGrepEnabled: true,
43
- splashEffect: true,
44
- consolidationEnabled: true,
45
- consolidationIntervalMs: 6 * 60 * 60 * 1e3,
46
- consolidationModel: "claude-haiku-4-5-20251001",
47
- consolidationMaxCallsPerRun: 20,
48
- selfQueryRouter: true,
49
- selfQueryModel: "claude-haiku-4-5-20251001",
50
- rerankerEnabled: true,
51
- scalingRoadmap: {
52
- rerankerAutoTrigger: {
53
- enabled: true,
54
- broadQueryMinCardinality: 5e4,
55
- fetchTopK: 150,
56
- returnTopK: 5
57
- }
58
- },
59
- graphRagEnabled: true,
60
- wikiEnabled: false,
61
- wikiUrl: "",
62
- wikiApiKey: "",
63
- wikiSyncIntervalMs: 30 * 60 * 1e3,
64
- wikiWorkspaceMapping: {
65
- exe: "Executive",
66
- yoshi: "Engineering",
67
- mari: "Marketing",
68
- tom: "Engineering",
69
- sasha: "Production"
70
- },
71
- wikiAutoUpdate: true,
72
- wikiAutoUpdateThreshold: 0.5,
73
- wikiAutoUpdateCreateNew: true,
74
- skillLearning: true,
75
- skillThreshold: 3,
76
- skillModel: "claude-haiku-4-5-20251001",
77
- exeHeartbeat: {
78
- enabled: true,
79
- intervalSeconds: 60,
80
- staleInProgressThresholdHours: 2
81
- },
82
- sessionLifecycle: {
83
- idleKillEnabled: true,
84
- idleKillTicksRequired: 3,
85
- idleKillIntercomAckWindowMs: 1e4,
86
- maxAutoInstances: 10
87
- },
88
- autoUpdate: {
89
- checkOnBoot: true,
90
- autoInstall: false,
91
- checkIntervalMs: 24 * 60 * 60 * 1e3
92
- }
93
- };
94
27
  function migrateLegacyConfig(raw) {
95
28
  if ("r2" in raw) {
96
29
  process.stderr.write(
@@ -103,16 +36,6 @@ function migrateLegacyConfig(raw) {
103
36
  }
104
37
  return raw;
105
38
  }
106
- var CONFIG_MIGRATIONS = [
107
- {
108
- from: 0,
109
- to: 1,
110
- migrate: (cfg) => {
111
- cfg.config_version = 1;
112
- return cfg;
113
- }
114
- }
115
- ];
116
39
  function migrateConfig(raw) {
117
40
  const fromVersion = typeof raw.config_version === "number" ? raw.config_version : 0;
118
41
  let currentVersion = fromVersion;
@@ -192,6 +115,121 @@ async function saveConfig(config) {
192
115
  await chmod(configPath, 384);
193
116
  }
194
117
  }
118
+ var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG, CONFIG_MIGRATIONS;
119
+ var init_config = __esm({
120
+ "src/lib/config.ts"() {
121
+ "use strict";
122
+ EXE_AI_DIR = resolveDataDir();
123
+ DB_PATH = path.join(EXE_AI_DIR, "memories.db");
124
+ MODELS_DIR = path.join(EXE_AI_DIR, "models");
125
+ CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
126
+ LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
127
+ CURRENT_CONFIG_VERSION = 1;
128
+ DEFAULT_CONFIG = {
129
+ config_version: CURRENT_CONFIG_VERSION,
130
+ dbPath: DB_PATH,
131
+ modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
132
+ embeddingDim: 1024,
133
+ batchSize: 20,
134
+ flushIntervalMs: 1e4,
135
+ autoIngestion: true,
136
+ autoRetrieval: true,
137
+ searchMode: "hybrid",
138
+ hookSearchMode: "hybrid",
139
+ fileGrepEnabled: true,
140
+ splashEffect: true,
141
+ consolidationEnabled: true,
142
+ consolidationIntervalMs: 6 * 60 * 60 * 1e3,
143
+ consolidationModel: "claude-haiku-4-5-20251001",
144
+ consolidationMaxCallsPerRun: 20,
145
+ selfQueryRouter: true,
146
+ selfQueryModel: "claude-haiku-4-5-20251001",
147
+ rerankerEnabled: true,
148
+ scalingRoadmap: {
149
+ rerankerAutoTrigger: {
150
+ enabled: true,
151
+ broadQueryMinCardinality: 5e4,
152
+ fetchTopK: 150,
153
+ returnTopK: 5
154
+ }
155
+ },
156
+ graphRagEnabled: true,
157
+ wikiEnabled: false,
158
+ wikiUrl: "",
159
+ wikiApiKey: "",
160
+ wikiSyncIntervalMs: 30 * 60 * 1e3,
161
+ wikiWorkspaceMapping: {},
162
+ wikiAutoUpdate: true,
163
+ wikiAutoUpdateThreshold: 0.5,
164
+ wikiAutoUpdateCreateNew: true,
165
+ skillLearning: true,
166
+ skillThreshold: 3,
167
+ skillModel: "claude-haiku-4-5-20251001",
168
+ exeHeartbeat: {
169
+ enabled: true,
170
+ intervalSeconds: 60,
171
+ staleInProgressThresholdHours: 2
172
+ },
173
+ sessionLifecycle: {
174
+ idleKillEnabled: true,
175
+ idleKillTicksRequired: 3,
176
+ idleKillIntercomAckWindowMs: 1e4,
177
+ maxAutoInstances: 10
178
+ },
179
+ autoUpdate: {
180
+ checkOnBoot: true,
181
+ autoInstall: false,
182
+ checkIntervalMs: 24 * 60 * 60 * 1e3
183
+ }
184
+ };
185
+ CONFIG_MIGRATIONS = [
186
+ {
187
+ from: 0,
188
+ to: 1,
189
+ migrate: (cfg) => {
190
+ cfg.config_version = 1;
191
+ return cfg;
192
+ }
193
+ }
194
+ ];
195
+ }
196
+ });
197
+
198
+ // src/lib/db-retry.ts
199
+ var init_db_retry = __esm({
200
+ "src/lib/db-retry.ts"() {
201
+ "use strict";
202
+ }
203
+ });
204
+
205
+ // src/lib/employees.ts
206
+ import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
207
+ import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
208
+ import { execSync } from "child_process";
209
+ import path2 from "path";
210
+ import os2 from "os";
211
+ var EMPLOYEES_PATH;
212
+ var init_employees = __esm({
213
+ "src/lib/employees.ts"() {
214
+ "use strict";
215
+ init_config();
216
+ EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
217
+ }
218
+ });
219
+
220
+ // src/lib/database.ts
221
+ import { createClient } from "@libsql/client";
222
+ var init_database = __esm({
223
+ "src/lib/database.ts"() {
224
+ "use strict";
225
+ init_db_retry();
226
+ init_employees();
227
+ }
228
+ });
229
+
230
+ // src/bin/exe-settings.ts
231
+ init_config();
232
+ import { createInterface } from "readline";
195
233
 
196
234
  // src/lib/is-main.ts
197
235
  import { realpathSync } from "fs";
@@ -208,14 +246,12 @@ function isMainModule(importMetaUrl) {
208
246
  }
209
247
 
210
248
  // src/lib/cloud-sync.ts
249
+ init_database();
211
250
  import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, existsSync as existsSync4, readdirSync, mkdirSync as mkdirSync2, appendFileSync, unlinkSync as unlinkSync2, openSync, closeSync } from "fs";
212
251
  import crypto2 from "crypto";
213
252
  import path4 from "path";
214
253
  import { homedir } from "os";
215
254
 
216
- // src/lib/database.ts
217
- import { createClient } from "@libsql/client";
218
-
219
255
  // src/lib/crypto.ts
220
256
  import crypto from "crypto";
221
257
 
@@ -223,23 +259,18 @@ import crypto from "crypto";
223
259
  import { brotliCompressSync, brotliDecompressSync, constants } from "zlib";
224
260
 
225
261
  // src/lib/license.ts
226
- import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync2, mkdirSync } from "fs";
262
+ init_config();
263
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, existsSync as existsSync3, mkdirSync } from "fs";
227
264
  import { randomUUID } from "crypto";
228
- import path2 from "path";
229
- import { jwtVerify, importSPKI } from "jose";
230
- var LICENSE_PATH = path2.join(EXE_AI_DIR, "license.key");
231
- var CACHE_PATH = path2.join(EXE_AI_DIR, "license-cache.json");
232
- var DEVICE_ID_PATH = path2.join(EXE_AI_DIR, "device-id");
233
-
234
- // src/lib/employees.ts
235
- import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
236
- import { existsSync as existsSync3, symlinkSync, readlinkSync, readFileSync as readFileSync3, renameSync as renameSync2, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
237
- import { execSync } from "child_process";
238
265
  import path3 from "path";
239
- import os2 from "os";
240
- var EMPLOYEES_PATH = path3.join(EXE_AI_DIR, "exe-employees.json");
266
+ import { jwtVerify, importSPKI } from "jose";
267
+ var LICENSE_PATH = path3.join(EXE_AI_DIR, "license.key");
268
+ var CACHE_PATH = path3.join(EXE_AI_DIR, "license-cache.json");
269
+ var DEVICE_ID_PATH = path3.join(EXE_AI_DIR, "device-id");
241
270
 
242
271
  // src/lib/cloud-sync.ts
272
+ init_config();
273
+ init_employees();
243
274
  var LOCALHOST_PATTERNS = /^(localhost|127\.0\.0\.1|\[::1\])$/i;
244
275
  var ROSTER_LOCK_PATH = path4.join(EXE_AI_DIR, "roster-merge.lock");
245
276
  function assertSecureEndpoint(endpoint) {
@@ -371,8 +402,7 @@ async function main() {
371
402
  try {
372
403
  assertSecureEndpoint(endpoint);
373
404
  const resp = await fetch(`${endpoint}/auth/verify`, {
374
- method: "POST",
375
- headers: { "Authorization": `Bearer ${key}`, "Content-Type": "application/json" },
405
+ headers: { "Authorization": `Bearer ${key}` },
376
406
  signal: AbortSignal.timeout(3e4)
377
407
  });
378
408
  if (resp.ok) {
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env bash
2
2
  # exe-start — unified session launcher for exe-os Mode 1
3
3
  #
4
- # Invoked by thin wrappers (exe1, yoshi1, etc.) that pass their $0 as first arg.
4
+ # Invoked by thin wrappers ({agent}1, {agent}2, etc.) that pass their $0 as first arg.
5
5
  #
6
6
  # Usage (via wrapper):
7
- # exe1 → creates tmux session + boots COO
8
- # exe1 go → attaches to existing exe1 session
9
- # yoshi1 go → attaches to yoshi-exe1 session
7
+ # {coo}1 → creates tmux session + boots COO
8
+ # {coo}1 go → attaches to existing coordinator session
9
+ # {employee}1 go → attaches to {employee}-{coo}1 session
10
10
 
11
11
  set -euo pipefail
12
12
 
@@ -18,13 +18,13 @@ ROSTER_PATH="${HOME}/.exe-os/exe-employees.json"
18
18
  INVOKED_AS="$(basename "${1:-exe-start}")"
19
19
  shift # Remove $0 passthrough; remaining args are user's
20
20
 
21
- # Extract name + number: exe1 exe,1 / yoshi3 → yoshi,3
21
+ # Extract name + number: {agent}1 -> {agent},1
22
22
  NAME="$(echo "$INVOKED_AS" | sed 's/[0-9]*$//')"
23
23
  NUM="$(echo "$INVOKED_AS" | grep -oE '[0-9]+$' || true)"
24
24
 
25
25
  if [ -z "$NAME" ] || [ -z "$NUM" ]; then
26
26
  echo "Could not parse name and number from: $INVOKED_AS"
27
- echo " Expected format: exe1, yoshi3, etc."
27
+ echo " Expected format: {agent}1, {agent}2, etc."
28
28
  exit 1
29
29
  fi
30
30
 
@@ -166,13 +166,7 @@ var init_config = __esm({
166
166
  wikiUrl: "",
167
167
  wikiApiKey: "",
168
168
  wikiSyncIntervalMs: 30 * 60 * 1e3,
169
- wikiWorkspaceMapping: {
170
- exe: "Executive",
171
- yoshi: "Engineering",
172
- mari: "Marketing",
173
- tom: "Engineering",
174
- sasha: "Production"
175
- },
169
+ wikiWorkspaceMapping: {},
176
170
  wikiAutoUpdate: true,
177
171
  wikiAutoUpdateThreshold: 0.5,
178
172
  wikiAutoUpdateCreateNew: true,
@@ -215,6 +209,18 @@ import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as r
215
209
  import { execSync } from "child_process";
216
210
  import path2 from "path";
217
211
  import os2 from "os";
212
+ function normalizeRole(role) {
213
+ return (role ?? "").trim().toLowerCase();
214
+ }
215
+ function isCoordinatorRole(role) {
216
+ return normalizeRole(role) === normalizeRole(COORDINATOR_ROLE);
217
+ }
218
+ function getCoordinatorEmployee(employees) {
219
+ return employees.find((e) => isCoordinatorRole(e.role));
220
+ }
221
+ function getCoordinatorName(employees = loadEmployeesSync()) {
222
+ return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
223
+ }
218
224
  async function loadEmployees(employeesPath = EMPLOYEES_PATH) {
219
225
  if (!existsSync2(employeesPath)) {
220
226
  return [];
@@ -226,12 +232,22 @@ async function loadEmployees(employeesPath = EMPLOYEES_PATH) {
226
232
  return [];
227
233
  }
228
234
  }
229
- var EMPLOYEES_PATH;
235
+ function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
236
+ if (!existsSync2(employeesPath)) return [];
237
+ try {
238
+ return JSON.parse(readFileSync2(employeesPath, "utf-8"));
239
+ } catch {
240
+ return [];
241
+ }
242
+ }
243
+ var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE;
230
244
  var init_employees = __esm({
231
245
  "src/lib/employees.ts"() {
232
246
  "use strict";
233
247
  init_config();
234
248
  EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
249
+ DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
250
+ COORDINATOR_ROLE = "COO";
235
251
  }
236
252
  });
237
253
 
@@ -274,7 +290,7 @@ function wrapWithRetry(client) {
274
290
  return (sql) => retryOnBusy(() => target.execute(sql), "execute");
275
291
  }
276
292
  if (prop === "batch") {
277
- return (stmts) => retryOnBusy(() => target.batch(stmts), "batch");
293
+ return (stmts, mode) => retryOnBusy(() => target.batch(stmts, mode), "batch");
278
294
  }
279
295
  return Reflect.get(target, prop, receiver);
280
296
  }
@@ -423,22 +439,24 @@ async function ensureSchema() {
423
439
  ON behaviors(agent_id, active);
424
440
  `);
425
441
  try {
442
+ const coordinatorName = getCoordinatorName();
426
443
  const existing = await client.execute({
427
- sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = 'exe'",
428
- args: []
444
+ sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = ?",
445
+ args: [coordinatorName]
429
446
  });
430
447
  if (Number(existing.rows[0]?.cnt) === 0) {
431
- await client.executeMultiple(`
432
- INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
433
- VALUES
434
- (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');
435
- INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
436
- VALUES
437
- (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');
438
- INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
439
- VALUES
440
- (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');
441
- `);
448
+ const seededAt = "2026-03-25T00:00:00Z";
449
+ for (const [domain, content] of [
450
+ ["workflow", `Don't ask "keep going?" \u2014 just keep executing phases/plans autonomously`],
451
+ ["tool-use", "Always use create_task MCP tool, never write .md files directly for task creation"],
452
+ ["workflow", "Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission"]
453
+ ]) {
454
+ await client.execute({
455
+ sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
456
+ VALUES (hex(randomblob(16)), ?, NULL, ?, ?, 1, ?, ?)`,
457
+ args: [coordinatorName, domain, content, seededAt, seededAt]
458
+ });
459
+ }
442
460
  }
443
461
  } catch {
444
462
  }
@@ -1130,12 +1148,46 @@ async function ensureSchema() {
1130
1148
  } catch {
1131
1149
  }
1132
1150
  }
1151
+ try {
1152
+ await client.execute({
1153
+ sql: `ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0`,
1154
+ args: []
1155
+ });
1156
+ } catch {
1157
+ }
1158
+ try {
1159
+ await client.execute(
1160
+ `CREATE INDEX IF NOT EXISTS idx_memories_draft ON memories(draft) WHERE draft = 1`
1161
+ );
1162
+ } catch {
1163
+ }
1164
+ try {
1165
+ await client.execute({
1166
+ sql: `ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'`,
1167
+ args: []
1168
+ });
1169
+ } catch {
1170
+ }
1171
+ try {
1172
+ await client.execute(
1173
+ `CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(memory_type)`
1174
+ );
1175
+ } catch {
1176
+ }
1177
+ try {
1178
+ await client.execute({
1179
+ sql: `ALTER TABLE memories ADD COLUMN trajectory TEXT`,
1180
+ args: []
1181
+ });
1182
+ } catch {
1183
+ }
1133
1184
  }
1134
1185
  var _client, _resilientClient, initTurso;
1135
1186
  var init_database = __esm({
1136
1187
  "src/lib/database.ts"() {
1137
1188
  "use strict";
1138
1189
  init_db_retry();
1190
+ init_employees();
1139
1191
  _client = null;
1140
1192
  _resilientClient = null;
1141
1193
  initTurso = initDatabase;
@@ -1319,7 +1371,11 @@ async function ensureShardSchema(client) {
1319
1371
  "ALTER TABLE memories ADD COLUMN source_path TEXT",
1320
1372
  "ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
1321
1373
  "ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
1322
- "ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
1374
+ "ALTER TABLE memories ADD COLUMN supersedes_id TEXT",
1375
+ // MS-11: draft staging, MS-6a: memory_type, MS-7: trajectory
1376
+ "ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0",
1377
+ "ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'",
1378
+ "ALTER TABLE memories ADD COLUMN trajectory TEXT"
1323
1379
  ]) {
1324
1380
  try {
1325
1381
  await client.execute(col);
@@ -1449,26 +1505,26 @@ var init_platform_procedures = __esm({
1449
1505
  title: "What is exe-os \u2014 the operating model every agent must understand",
1450
1506
  domain: "architecture",
1451
1507
  priority: "p0",
1452
- 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."
1508
+ 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."
1453
1509
  },
1454
1510
  {
1455
1511
  title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
1456
1512
  domain: "architecture",
1457
1513
  priority: "p0",
1458
- 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."
1514
+ 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."
1459
1515
  },
1460
1516
  {
1461
- title: "Sessions explained \u2014 what exeN means and how projects work",
1517
+ title: "Sessions explained \u2014 coordinator session names and projects",
1462
1518
  domain: "architecture",
1463
1519
  priority: "p0",
1464
- 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."
1520
+ 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."
1465
1521
  },
1466
1522
  // --- Hierarchy and dispatch ---
1467
1523
  {
1468
1524
  title: "Chain of command \u2014 who talks to whom",
1469
1525
  domain: "workflow",
1470
1526
  priority: "p0",
1471
- 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."
1527
+ 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."
1472
1528
  },
1473
1529
  {
1474
1530
  title: "Single dispatch path \u2014 create_task only",
@@ -1478,30 +1534,30 @@ var init_platform_procedures = __esm({
1478
1534
  },
1479
1535
  // --- Session isolation ---
1480
1536
  {
1481
- title: "Session scoping \u2014 stay in your exe boundary",
1537
+ title: "Session scoping \u2014 stay in your coordinator boundary",
1482
1538
  domain: "security",
1483
1539
  priority: "p0",
1484
- 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."
1540
+ 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."
1485
1541
  },
1486
1542
  {
1487
1543
  title: "Session isolation \u2014 never touch another session's work",
1488
1544
  domain: "workflow",
1489
1545
  priority: "p0",
1490
- 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.`
1546
+ 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."
1491
1547
  },
1492
1548
  // --- Engineering: session scoping in code ---
1493
1549
  {
1494
1550
  title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
1495
1551
  domain: "architecture",
1496
1552
  priority: "p0",
1497
- 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."
1553
+ 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."
1498
1554
  },
1499
1555
  // --- Hard constraints ---
1500
1556
  {
1501
1557
  title: "What you CANNOT do in exe-os \u2014 hard constraints",
1502
1558
  domain: "security",
1503
1559
  priority: "p0",
1504
- 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."
1560
+ 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."
1505
1561
  },
1506
1562
  // --- Operations ---
1507
1563
  {
@@ -1855,8 +1911,10 @@ function getMySession() {
1855
1911
  return getTransport().getMySession();
1856
1912
  }
1857
1913
  function extractRootExe(name) {
1858
- const match = name.match(/(exe\d+)$/);
1859
- return match?.[1] ?? null;
1914
+ if (!name) return null;
1915
+ if (!name.includes("-")) return name;
1916
+ const parts = name.split("-").filter(Boolean);
1917
+ return parts.length > 0 ? parts[parts.length - 1] : null;
1860
1918
  }
1861
1919
  function getParentExe(sessionKey) {
1862
1920
  try {
@@ -1891,6 +1949,7 @@ var init_tmux_routing = __esm({
1891
1949
  init_provider_table();
1892
1950
  init_intercom_queue();
1893
1951
  init_plan_limits();
1952
+ init_employees();
1894
1953
  SPAWN_LOCK_DIR = path9.join(os6.homedir(), ".exe-os", "spawn-locks");
1895
1954
  SESSION_CACHE = path9.join(os6.homedir(), ".exe-os", "session-cache");
1896
1955
  INTERCOM_LOG2 = path9.join(os6.homedir(), ".exe-os", "intercom.log");
@@ -2297,7 +2356,7 @@ async function status(targetEmployee) {
2297
2356
  return "Not in a tmux session. Start tmux first: tmux new-session -s work";
2298
2357
  }
2299
2358
  const employees = await loadEmployees();
2300
- const names = employees.filter((e) => e.name !== "exe").map((e) => e.name);
2359
+ const names = employees.filter((e) => !isCoordinatorRole(e.role)).map((e) => e.name);
2301
2360
  const roles = new Map(employees.map((e) => [e.name, e.role ?? ""]));
2302
2361
  await initStore();
2303
2362
  const client = getClient();