@askexenow/exe-os 0.8.0 → 0.8.2

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 (107) hide show
  1. package/README.md +178 -79
  2. package/package.json +1 -1
  3. package/dist/bin/backfill-responses.js +0 -1912
  4. package/dist/bin/backfill-vectors.js +0 -1642
  5. package/dist/bin/cleanup-stale-review-tasks.js +0 -1339
  6. package/dist/bin/cli.js +0 -18800
  7. package/dist/bin/exe-agent.js +0 -1858
  8. package/dist/bin/exe-assign.js +0 -1957
  9. package/dist/bin/exe-boot.js +0 -6460
  10. package/dist/bin/exe-call.js +0 -197
  11. package/dist/bin/exe-cloud.js +0 -850
  12. package/dist/bin/exe-dispatch.js +0 -1146
  13. package/dist/bin/exe-doctor.js +0 -1657
  14. package/dist/bin/exe-export-behaviors.js +0 -1494
  15. package/dist/bin/exe-forget.js +0 -1627
  16. package/dist/bin/exe-gateway.js +0 -7732
  17. package/dist/bin/exe-healthcheck.js +0 -207
  18. package/dist/bin/exe-heartbeat.js +0 -1647
  19. package/dist/bin/exe-kill.js +0 -1479
  20. package/dist/bin/exe-launch-agent.js +0 -1704
  21. package/dist/bin/exe-link.js +0 -192
  22. package/dist/bin/exe-new-employee.js +0 -852
  23. package/dist/bin/exe-pending-messages.js +0 -1446
  24. package/dist/bin/exe-pending-notifications.js +0 -1321
  25. package/dist/bin/exe-pending-reviews.js +0 -1468
  26. package/dist/bin/exe-repo-drift.js +0 -95
  27. package/dist/bin/exe-review.js +0 -1590
  28. package/dist/bin/exe-search.js +0 -2651
  29. package/dist/bin/exe-session-cleanup.js +0 -3173
  30. package/dist/bin/exe-settings.js +0 -354
  31. package/dist/bin/exe-status.js +0 -1532
  32. package/dist/bin/exe-team.js +0 -1324
  33. package/dist/bin/git-sweep.js +0 -2185
  34. package/dist/bin/graph-backfill.js +0 -1968
  35. package/dist/bin/graph-export.js +0 -1604
  36. package/dist/bin/install.js +0 -656
  37. package/dist/bin/list-providers.js +0 -140
  38. package/dist/bin/scan-tasks.js +0 -1820
  39. package/dist/bin/setup.js +0 -951
  40. package/dist/bin/shard-migrate.js +0 -1494
  41. package/dist/bin/update.js +0 -95
  42. package/dist/bin/wiki-sync.js +0 -1514
  43. package/dist/gateway/index.js +0 -8848
  44. package/dist/hooks/bug-report-worker.js +0 -2743
  45. package/dist/hooks/commit-complete.js +0 -2108
  46. package/dist/hooks/error-recall.js +0 -2861
  47. package/dist/hooks/exe-heartbeat-hook.js +0 -232
  48. package/dist/hooks/ingest-worker.js +0 -4793
  49. package/dist/hooks/ingest.js +0 -684
  50. package/dist/hooks/instructions-loaded.js +0 -1880
  51. package/dist/hooks/notification.js +0 -1726
  52. package/dist/hooks/post-compact.js +0 -1751
  53. package/dist/hooks/pre-compact.js +0 -1746
  54. package/dist/hooks/pre-tool-use.js +0 -2191
  55. package/dist/hooks/prompt-ingest-worker.js +0 -2126
  56. package/dist/hooks/prompt-submit.js +0 -4693
  57. package/dist/hooks/response-ingest-worker.js +0 -1936
  58. package/dist/hooks/session-end.js +0 -1752
  59. package/dist/hooks/session-start.js +0 -2795
  60. package/dist/hooks/stop.js +0 -1835
  61. package/dist/hooks/subagent-stop.js +0 -1726
  62. package/dist/hooks/summary-worker.js +0 -2661
  63. package/dist/index.js +0 -11834
  64. package/dist/lib/cloud-sync.js +0 -495
  65. package/dist/lib/config.js +0 -222
  66. package/dist/lib/consolidation.js +0 -476
  67. package/dist/lib/crypto.js +0 -51
  68. package/dist/lib/database.js +0 -730
  69. package/dist/lib/device-registry.js +0 -900
  70. package/dist/lib/embedder.js +0 -632
  71. package/dist/lib/employee-templates.js +0 -543
  72. package/dist/lib/employees.js +0 -177
  73. package/dist/lib/error-detector.js +0 -156
  74. package/dist/lib/exe-daemon-client.js +0 -451
  75. package/dist/lib/exe-daemon.js +0 -8285
  76. package/dist/lib/file-grep.js +0 -199
  77. package/dist/lib/hybrid-search.js +0 -1819
  78. package/dist/lib/identity-templates.js +0 -320
  79. package/dist/lib/identity.js +0 -223
  80. package/dist/lib/keychain.js +0 -145
  81. package/dist/lib/license.js +0 -377
  82. package/dist/lib/messaging.js +0 -1376
  83. package/dist/lib/reminders.js +0 -63
  84. package/dist/lib/schedules.js +0 -1396
  85. package/dist/lib/session-registry.js +0 -52
  86. package/dist/lib/skill-learning.js +0 -477
  87. package/dist/lib/status-brief.js +0 -235
  88. package/dist/lib/store.js +0 -1551
  89. package/dist/lib/task-router.js +0 -62
  90. package/dist/lib/tasks.js +0 -2456
  91. package/dist/lib/tmux-routing.js +0 -2836
  92. package/dist/lib/tmux-status.js +0 -261
  93. package/dist/lib/tmux-transport.js +0 -83
  94. package/dist/lib/transport.js +0 -128
  95. package/dist/lib/ws-auth.js +0 -19
  96. package/dist/lib/ws-client.js +0 -160
  97. package/dist/mcp/server.js +0 -10538
  98. package/dist/mcp/tools/complete-reminder.js +0 -67
  99. package/dist/mcp/tools/create-reminder.js +0 -52
  100. package/dist/mcp/tools/create-task.js +0 -1853
  101. package/dist/mcp/tools/deactivate-behavior.js +0 -263
  102. package/dist/mcp/tools/list-reminders.js +0 -62
  103. package/dist/mcp/tools/list-tasks.js +0 -463
  104. package/dist/mcp/tools/send-message.js +0 -1382
  105. package/dist/mcp/tools/update-task.js +0 -1692
  106. package/dist/runtime/index.js +0 -6809
  107. package/dist/tui/App.js +0 -17479
@@ -1,656 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/adapters/claude/installer.ts
4
- import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3, readdir } from "fs/promises";
5
- import { existsSync as existsSync4, readFileSync as readFileSync2 } from "fs";
6
- import path4 from "path";
7
- import os3 from "os";
8
- import { fileURLToPath } from "url";
9
-
10
- // src/lib/agent-symlinks.ts
11
- import os2 from "os";
12
- import path3 from "path";
13
- import {
14
- existsSync as existsSync3,
15
- lstatSync,
16
- mkdirSync,
17
- readlinkSync as readlinkSync2,
18
- symlinkSync as symlinkSync2
19
- } from "fs";
20
-
21
- // src/lib/employees.ts
22
- import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
23
- import { existsSync as existsSync2, symlinkSync, readlinkSync } from "fs";
24
- import { execSync } from "child_process";
25
- import path2 from "path";
26
-
27
- // src/lib/config.ts
28
- import { readFile, writeFile, mkdir } from "fs/promises";
29
- import { readFileSync, existsSync, renameSync } from "fs";
30
- import path from "path";
31
- import os from "os";
32
- function resolveDataDir() {
33
- if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
34
- if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
35
- const newDir = path.join(os.homedir(), ".exe-os");
36
- const legacyDir = path.join(os.homedir(), ".exe-mem");
37
- if (!existsSync(newDir) && existsSync(legacyDir)) {
38
- try {
39
- renameSync(legacyDir, newDir);
40
- process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
41
- `);
42
- } catch {
43
- return legacyDir;
44
- }
45
- }
46
- return newDir;
47
- }
48
- var EXE_AI_DIR = resolveDataDir();
49
- var DB_PATH = path.join(EXE_AI_DIR, "memories.db");
50
- var MODELS_DIR = path.join(EXE_AI_DIR, "models");
51
- var CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
52
- var LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
53
- var CURRENT_CONFIG_VERSION = 1;
54
- var DEFAULT_CONFIG = {
55
- config_version: CURRENT_CONFIG_VERSION,
56
- dbPath: DB_PATH,
57
- modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
58
- embeddingDim: 1024,
59
- batchSize: 20,
60
- flushIntervalMs: 1e4,
61
- autoIngestion: true,
62
- autoRetrieval: true,
63
- searchMode: "hybrid",
64
- hookSearchMode: "hybrid",
65
- fileGrepEnabled: true,
66
- splashEffect: true,
67
- consolidationEnabled: true,
68
- consolidationIntervalMs: 6 * 60 * 60 * 1e3,
69
- consolidationModel: "claude-haiku-4-5-20251001",
70
- consolidationMaxCallsPerRun: 20,
71
- selfQueryRouter: true,
72
- selfQueryModel: "claude-haiku-4-5-20251001",
73
- rerankerEnabled: true,
74
- scalingRoadmap: {
75
- rerankerAutoTrigger: {
76
- enabled: true,
77
- broadQueryMinCardinality: 5e4,
78
- fetchTopK: 150,
79
- returnTopK: 5
80
- }
81
- },
82
- graphRagEnabled: true,
83
- wikiEnabled: false,
84
- wikiUrl: "",
85
- wikiApiKey: "",
86
- wikiSyncIntervalMs: 30 * 60 * 1e3,
87
- wikiWorkspaceMapping: {
88
- exe: "Executive",
89
- yoshi: "Engineering",
90
- mari: "Marketing",
91
- tom: "Engineering",
92
- sasha: "Production"
93
- },
94
- wikiAutoUpdate: true,
95
- wikiAutoUpdateThreshold: 0.5,
96
- wikiAutoUpdateCreateNew: true,
97
- skillLearning: true,
98
- skillThreshold: 3,
99
- skillModel: "claude-haiku-4-5-20251001",
100
- exeHeartbeat: {
101
- enabled: true,
102
- intervalSeconds: 60,
103
- staleInProgressThresholdHours: 2
104
- },
105
- sessionLifecycle: {
106
- idleKillEnabled: true,
107
- idleKillTicksRequired: 3,
108
- idleKillIntercomAckWindowMs: 1e4,
109
- maxAutoInstances: 10
110
- }
111
- };
112
-
113
- // src/lib/employees.ts
114
- var EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
115
- async function loadEmployees(employeesPath = EMPLOYEES_PATH) {
116
- if (!existsSync2(employeesPath)) {
117
- return [];
118
- }
119
- const raw = await readFile2(employeesPath, "utf-8");
120
- try {
121
- return JSON.parse(raw);
122
- } catch {
123
- return [];
124
- }
125
- }
126
-
127
- // src/lib/agent-symlinks.ts
128
- function claudeAgentsDir(homeDir) {
129
- return path3.join(homeDir, ".claude", "agents");
130
- }
131
- function identitySourcePath(homeDir, agentId) {
132
- return path3.join(homeDir, ".exe-os", "identity", `${agentId}.md`);
133
- }
134
- function claudeAgentLinkPath(homeDir, agentId) {
135
- return path3.join(claudeAgentsDir(homeDir), `${agentId}.md`);
136
- }
137
- function ensureAgentSymlink(agentId, homeDir = os2.homedir()) {
138
- const target = identitySourcePath(homeDir, agentId);
139
- const link = claudeAgentLinkPath(homeDir, agentId);
140
- mkdirSync(claudeAgentsDir(homeDir), { recursive: true });
141
- if (existsSync3(link)) {
142
- let stat;
143
- try {
144
- stat = lstatSync(link);
145
- } catch {
146
- return { agentId, action: "conflict", target, link, conflict: "stat_failed" };
147
- }
148
- if (!stat.isSymbolicLink()) {
149
- return { agentId, action: "conflict", target, link, conflict: "regular_file" };
150
- }
151
- let currentTarget;
152
- try {
153
- currentTarget = readlinkSync2(link);
154
- } catch {
155
- return { agentId, action: "conflict", target, link, conflict: "readlink_failed" };
156
- }
157
- if (currentTarget === target) {
158
- return { agentId, action: "already_correct", target, link };
159
- }
160
- return { agentId, action: "conflict", target, link, conflict: `points_to:${currentTarget}` };
161
- }
162
- try {
163
- symlinkSync2(target, link);
164
- } catch (err) {
165
- return {
166
- agentId,
167
- action: "conflict",
168
- target,
169
- link,
170
- conflict: err instanceof Error ? err.message : String(err)
171
- };
172
- }
173
- return { agentId, action: "created", target, link };
174
- }
175
- async function ensureAllAgentSymlinks(homeDir = os2.homedir()) {
176
- const employees = await loadEmployees();
177
- return employees.map((emp) => ensureAgentSymlink(emp.name, homeDir));
178
- }
179
-
180
- // src/lib/mcp-prefix.ts
181
- var MCP_PRIMARY_KEY = "exe-os";
182
- var MCP_LEGACY_KEY = "exe-mem";
183
- var MCP_TOOL_PREFIXES = [
184
- `mcp__${MCP_PRIMARY_KEY}__`,
185
- `mcp__${MCP_LEGACY_KEY}__`
186
- ];
187
- function expandDualPrefixTools(shortNames) {
188
- const out = [];
189
- for (const name of shortNames) {
190
- for (const prefix of MCP_TOOL_PREFIXES) {
191
- out.push(prefix + name);
192
- }
193
- }
194
- return out;
195
- }
196
-
197
- // src/adapters/claude/installer.ts
198
- function resolvePackageRoot() {
199
- const thisFile = fileURLToPath(import.meta.url);
200
- let dir = path4.dirname(thisFile);
201
- const root = path4.parse(dir).root;
202
- while (dir !== root) {
203
- const pkgPath = path4.join(dir, "package.json");
204
- if (existsSync4(pkgPath)) {
205
- try {
206
- const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
207
- if (pkg.name === "exe-os") return dir;
208
- } catch {
209
- }
210
- }
211
- dir = path4.dirname(dir);
212
- }
213
- return path4.resolve(path4.dirname(thisFile), "..", "..", "..");
214
- }
215
- async function copySlashCommands(packageRoot, homeDir = os3.homedir()) {
216
- let copied = 0;
217
- let skipped = 0;
218
- const skillsBase = path4.join(homeDir, ".claude", "skills");
219
- const exeDir = path4.join(packageRoot, "src", "commands", "exe");
220
- if (existsSync4(exeDir)) {
221
- const entries = await readdir(exeDir);
222
- const mdFiles = entries.filter((f) => f.endsWith(".md"));
223
- for (const file of mdFiles) {
224
- const name = file.replace(".md", "");
225
- const destDir = path4.join(skillsBase, `exe-${name}`);
226
- await mkdir3(destDir, { recursive: true });
227
- const srcPath = path4.join(exeDir, file);
228
- const destPath = path4.join(destDir, "SKILL.md");
229
- const result = await copyAsSkill(srcPath, destPath, `exe-${name}`);
230
- if (result) copied++;
231
- else skipped++;
232
- }
233
- }
234
- const topLevelSrc = path4.join(packageRoot, "src", "commands", "exe.md");
235
- if (existsSync4(topLevelSrc)) {
236
- const destDir = path4.join(skillsBase, "exe");
237
- await mkdir3(destDir, { recursive: true });
238
- const destPath = path4.join(destDir, "SKILL.md");
239
- const result = await copyAsSkill(topLevelSrc, destPath, "exe");
240
- if (result) copied++;
241
- else skipped++;
242
- }
243
- return { copied, skipped };
244
- }
245
- async function copyAsSkill(srcPath, destPath, skillName) {
246
- let content = await readFile3(srcPath, "utf-8");
247
- const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
248
- if (fmMatch?.[1]) {
249
- const fm = fmMatch[1];
250
- if (fm.includes("name:")) {
251
- content = content.replace(
252
- /^(---\n[\s\S]*?)name:\s*[^\n]+/,
253
- `$1name: ${skillName}`
254
- );
255
- } else {
256
- content = content.replace(/^---\n/, `---
257
- name: ${skillName}
258
- `);
259
- }
260
- }
261
- if (existsSync4(destPath)) {
262
- const existing = await readFile3(destPath, "utf-8");
263
- if (existing === content) return false;
264
- }
265
- await writeFile3(destPath, content);
266
- return true;
267
- }
268
- async function registerMcpServer(packageRoot, homeDir = os3.homedir()) {
269
- const claudeJsonPath = path4.join(homeDir, ".claude.json");
270
- let claudeJson = {};
271
- if (existsSync4(claudeJsonPath)) {
272
- try {
273
- claudeJson = JSON.parse(await readFile3(claudeJsonPath, "utf-8"));
274
- } catch {
275
- claudeJson = {};
276
- }
277
- }
278
- if (!claudeJson.mcpServers) {
279
- claudeJson.mcpServers = {};
280
- }
281
- const newEntry = {
282
- type: "stdio",
283
- command: "node",
284
- args: [path4.join(packageRoot, "dist", "mcp", "server.js")],
285
- env: {}
286
- };
287
- const legacy = claudeJson.mcpServers[MCP_LEGACY_KEY];
288
- const current = claudeJson.mcpServers[MCP_PRIMARY_KEY];
289
- const currentMatches = current && JSON.stringify(current) === JSON.stringify(newEntry);
290
- if (currentMatches && !legacy) {
291
- return false;
292
- }
293
- claudeJson.mcpServers[MCP_PRIMARY_KEY] = newEntry;
294
- if (legacy) {
295
- delete claudeJson.mcpServers[MCP_LEGACY_KEY];
296
- }
297
- await writeFile3(claudeJsonPath, JSON.stringify(claudeJson, null, 2) + "\n");
298
- return true;
299
- }
300
- async function mergeHooks(packageRoot, homeDir = os3.homedir()) {
301
- const settingsPath = path4.join(homeDir, ".claude", "settings.json");
302
- let settings = {};
303
- if (existsSync4(settingsPath)) {
304
- try {
305
- settings = JSON.parse(await readFile3(settingsPath, "utf-8"));
306
- } catch {
307
- settings = {};
308
- }
309
- }
310
- if (!settings.hooks) {
311
- settings.hooks = {};
312
- }
313
- const hooksToRegister = [
314
- {
315
- event: "PostToolUse",
316
- group: {
317
- matcher: "Bash|Edit|Write|Read|Glob|Grep|Agent|mcp__.*",
318
- hooks: [
319
- {
320
- type: "command",
321
- command: `node "${path4.join(packageRoot, "dist", "hooks", "ingest.js")}"`
322
- },
323
- {
324
- type: "command",
325
- command: `node "${path4.join(packageRoot, "dist", "hooks", "error-recall.js")}"`
326
- }
327
- ]
328
- },
329
- marker: "dist/hooks/ingest.js"
330
- },
331
- {
332
- event: "SessionStart",
333
- group: {
334
- hooks: [
335
- {
336
- type: "command",
337
- command: `node "${path4.join(packageRoot, "dist", "hooks", "session-start.js")}"`,
338
- timeout: 1e4
339
- }
340
- ]
341
- },
342
- marker: "dist/hooks/session-start.js"
343
- },
344
- {
345
- event: "UserPromptSubmit",
346
- group: {
347
- hooks: [
348
- {
349
- type: "command",
350
- command: `node "${path4.join(packageRoot, "dist", "hooks", "prompt-submit.js")}"`
351
- }
352
- ]
353
- },
354
- marker: "dist/hooks/prompt-submit.js"
355
- },
356
- {
357
- event: "UserPromptSubmit",
358
- group: {
359
- hooks: [
360
- {
361
- type: "command",
362
- command: `node "${path4.join(packageRoot, "dist", "hooks", "exe-heartbeat-hook.js")}"`,
363
- timeout: 5e3
364
- }
365
- ]
366
- },
367
- marker: "dist/hooks/exe-heartbeat-hook.js"
368
- },
369
- {
370
- event: "Stop",
371
- group: {
372
- hooks: [
373
- {
374
- type: "command",
375
- command: `node "${path4.join(packageRoot, "dist", "hooks", "stop.js")}"`
376
- }
377
- ]
378
- },
379
- marker: "dist/hooks/stop.js"
380
- },
381
- {
382
- event: "PreToolUse",
383
- group: {
384
- matcher: "Write|Edit|Read|Bash",
385
- hooks: [
386
- {
387
- type: "command",
388
- command: `node "${path4.join(packageRoot, "dist", "hooks", "pre-tool-use.js")}"`
389
- }
390
- ]
391
- },
392
- marker: "dist/hooks/pre-tool-use.js"
393
- },
394
- {
395
- event: "SubagentStop",
396
- group: {
397
- hooks: [
398
- {
399
- type: "command",
400
- command: `node "${path4.join(packageRoot, "dist", "hooks", "subagent-stop.js")}"`
401
- }
402
- ]
403
- },
404
- marker: "dist/hooks/subagent-stop.js"
405
- },
406
- {
407
- event: "PreCompact",
408
- group: {
409
- hooks: [
410
- {
411
- type: "command",
412
- command: `node "${path4.join(packageRoot, "dist", "hooks", "pre-compact.js")}"`,
413
- timeout: 1e4
414
- }
415
- ]
416
- },
417
- marker: "dist/hooks/pre-compact.js"
418
- },
419
- {
420
- event: "SessionEnd",
421
- group: {
422
- hooks: [
423
- {
424
- type: "command",
425
- command: `node "${path4.join(packageRoot, "dist", "hooks", "session-end.js")}"`
426
- }
427
- ]
428
- },
429
- marker: "dist/hooks/session-end.js"
430
- },
431
- {
432
- event: "Notification",
433
- group: {
434
- hooks: [
435
- {
436
- type: "command",
437
- command: `node "${path4.join(packageRoot, "dist", "hooks", "notification.js")}"`
438
- }
439
- ]
440
- },
441
- marker: "dist/hooks/notification.js"
442
- },
443
- {
444
- event: "PostCompact",
445
- group: {
446
- hooks: [
447
- {
448
- type: "command",
449
- command: `node "${path4.join(packageRoot, "dist", "hooks", "post-compact.js")}"`,
450
- timeout: 1e4
451
- }
452
- ]
453
- },
454
- marker: "dist/hooks/post-compact.js"
455
- },
456
- {
457
- event: "InstructionsLoaded",
458
- group: {
459
- hooks: [
460
- {
461
- type: "command",
462
- command: `node "${path4.join(packageRoot, "dist", "hooks", "instructions-loaded.js")}"`
463
- }
464
- ]
465
- },
466
- marker: "dist/hooks/instructions-loaded.js"
467
- }
468
- ];
469
- let added = 0;
470
- let skipped = 0;
471
- for (const { event, group, marker } of hooksToRegister) {
472
- if (!settings.hooks[event]) {
473
- settings.hooks[event] = [];
474
- }
475
- const existing = settings.hooks[event];
476
- const alreadyExists = existing.some(
477
- (g) => g.hooks.some((h) => h.command.includes(marker))
478
- );
479
- if (alreadyExists) {
480
- skipped++;
481
- } else {
482
- existing.push(group);
483
- added++;
484
- }
485
- }
486
- const perms = settings.permissions;
487
- if (!perms) {
488
- settings.permissions = {};
489
- }
490
- const permissions = settings.permissions;
491
- if (!Array.isArray(permissions.allow)) {
492
- permissions.allow = [];
493
- }
494
- const toolNames = [
495
- "store_memory",
496
- "recall_my_memory",
497
- "create_task",
498
- "list_tasks",
499
- "get_task",
500
- "update_task",
501
- "close_task",
502
- "store_behavior",
503
- "deactivate_behavior",
504
- "send_message",
505
- "get_identity",
506
- "update_identity",
507
- "ask_team_memory",
508
- "get_session_context",
509
- "create_reminder",
510
- "complete_reminder",
511
- "list_reminders",
512
- "list_behaviors",
513
- "query_relationships",
514
- "commit_to_long_term_memory"
515
- ];
516
- const allowList = permissions.allow;
517
- for (const tool of expandDualPrefixTools(toolNames)) {
518
- if (!allowList.includes(tool)) {
519
- allowList.push(tool);
520
- }
521
- }
522
- await mkdir3(path4.dirname(settingsPath), { recursive: true });
523
- await writeFile3(settingsPath, JSON.stringify(settings, null, 2) + "\n");
524
- return { added, skipped };
525
- }
526
- var EXE_SECTION_START = "<!-- exe-os:orchestration-start -->";
527
- var EXE_SECTION_END = "<!-- exe-os:orchestration-end -->";
528
- var ORCHESTRATION_RULES = `${EXE_SECTION_START}
529
- ## exe-os Multi-Agent Orchestration (auto-managed \u2014 do not edit)
530
-
531
- These rules are injected by exe-os and override default behavior for multi-agent coordination.
532
-
533
- - **Session routing is deterministic.** When working in exeN (e.g. exe1), ALL employee sessions use the same number: yoshi-exe1, tom-exe1, mari-exe1. NEVER reference, consider, or dispatch to employee sessions from other project numbers. This is not a choice \u2014 it is a hard constraint.
534
- - **Always use create_task to assign work.** Never use messages, tmux send-keys, or ad-hoc instructions as a substitute for tasks.
535
- - **Never modify another agent's in-progress task.** Create a new task instead. Modifying active tasks causes race conditions.
536
- - **Chain of command:** founder \u2192 exe \u2192 yoshi \u2192 engineers. Exe does not assign directly to tom or other engineers below yoshi.
537
- - **Verify dispatch.** After every create_task, confirm the employee received and started the task via tmux capture-pane.
538
- ${EXE_SECTION_END}`;
539
- async function injectOrchestrationRules(homeDir) {
540
- const claudeDir = path4.join(homeDir, ".claude");
541
- const claudeMdPath = path4.join(claudeDir, "CLAUDE.md");
542
- await mkdir3(claudeDir, { recursive: true });
543
- let existing = "";
544
- try {
545
- existing = await readFile3(claudeMdPath, "utf-8");
546
- } catch {
547
- }
548
- const startIdx = existing.indexOf(EXE_SECTION_START);
549
- const endIdx = existing.indexOf(EXE_SECTION_END);
550
- if (startIdx !== -1 && endIdx !== -1) {
551
- const currentSection = existing.slice(startIdx, endIdx + EXE_SECTION_END.length);
552
- if (currentSection === ORCHESTRATION_RULES) {
553
- return "unchanged";
554
- }
555
- const updated = existing.slice(0, startIdx) + ORCHESTRATION_RULES + existing.slice(endIdx + EXE_SECTION_END.length);
556
- await writeFile3(claudeMdPath, updated, "utf-8");
557
- return "updated";
558
- }
559
- const separator = existing.length > 0 && !existing.endsWith("\n\n") ? "\n\n" : "";
560
- await writeFile3(claudeMdPath, existing + separator + ORCHESTRATION_RULES + "\n", "utf-8");
561
- return "injected";
562
- }
563
- async function runInstaller(homeDir) {
564
- const packageRoot = resolvePackageRoot();
565
- process.stderr.write(`exe-os installer v1.3.0
566
- `);
567
- process.stderr.write(`Package root: ${packageRoot}
568
-
569
- `);
570
- const cmdResult = await copySlashCommands(packageRoot, homeDir);
571
- process.stderr.write(
572
- `Slash commands: ${cmdResult.copied} copied, ${cmdResult.skipped} unchanged
573
- `
574
- );
575
- const mcpChanged = await registerMcpServer(packageRoot, homeDir);
576
- process.stderr.write(
577
- `MCP server: ${mcpChanged ? "registered" : "already registered"}
578
- `
579
- );
580
- const hookResult = await mergeHooks(packageRoot, homeDir);
581
- process.stderr.write(
582
- `Hooks: ${hookResult.added} added, ${hookResult.skipped} unchanged
583
- `
584
- );
585
- const resolvedHome = homeDir ?? os3.homedir();
586
- const exeWorkspace = path4.join(resolvedHome, "exe");
587
- if (!existsSync4(exeWorkspace)) {
588
- try {
589
- await mkdir3(path4.join(exeWorkspace, "content"), { recursive: true });
590
- await mkdir3(path4.join(exeWorkspace, "operations"), { recursive: true });
591
- await mkdir3(path4.join(exeWorkspace, "output"), { recursive: true });
592
- process.stderr.write(
593
- `Created ~/exe/ \u2014 your automation workspace for non-code projects
594
- `
595
- );
596
- } catch {
597
- }
598
- }
599
- const claudeMdResult = await injectOrchestrationRules(resolvedHome);
600
- process.stderr.write(
601
- `CLAUDE.md orchestration: ${claudeMdResult}
602
- `
603
- );
604
- const symlinkResults = await ensureAllAgentSymlinks(resolvedHome);
605
- process.stderr.write(
606
- `Agent symlinks: ${summarizeSymlinkResults(symlinkResults)}
607
- `
608
- );
609
- process.stderr.write(`
610
- exe-os installed successfully.
611
- `);
612
- }
613
- function summarizeSymlinkResults(results) {
614
- if (results.length === 0) return "no employees in roster";
615
- const created = results.filter((r) => r.action === "created").length;
616
- const already = results.filter((r) => r.action === "already_correct").length;
617
- const conflicts = results.filter((r) => r.action === "conflict");
618
- let summary = `${created} created, ${already} already linked`;
619
- if (conflicts.length > 0) {
620
- const details = conflicts.map((r) => `${r.agentId} (${r.conflict ?? "unknown"})`).join(", ");
621
- summary += `, ${conflicts.length} conflict(s): ${details}`;
622
- }
623
- return summary;
624
- }
625
-
626
- // src/bin/install.ts
627
- var args = process.argv.slice(2);
628
- if (args.includes("--commands-only")) {
629
- try {
630
- const packageRoot = resolvePackageRoot();
631
- const result = await copySlashCommands(packageRoot);
632
- if (result.copied > 0) {
633
- process.stderr.write(
634
- `exe-os: ${result.copied} slash command(s) updated
635
- `
636
- );
637
- }
638
- } catch {
639
- }
640
- } else if (args.includes("--global")) {
641
- try {
642
- await runInstaller();
643
- } catch (err) {
644
- console.error(
645
- "Installation failed:",
646
- err instanceof Error ? err.message : String(err)
647
- );
648
- process.exit(1);
649
- }
650
- } else {
651
- console.error("Usage: npx exe-os --global");
652
- console.error(
653
- " Installs exe-os commands, MCP server, and hooks into ~/.claude/"
654
- );
655
- process.exit(1);
656
- }