@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.
- package/dist/bin/backfill-conversations.js +359 -267
- package/dist/bin/backfill-responses.js +357 -265
- package/dist/bin/backfill-vectors.js +339 -264
- package/dist/bin/cleanup-stale-review-tasks.js +315 -256
- package/dist/bin/cli.js +494 -240
- package/dist/bin/exe-agent.js +141 -46
- package/dist/bin/exe-assign.js +151 -63
- package/dist/bin/exe-boot.js +294 -115
- package/dist/bin/exe-call.js +76 -51
- package/dist/bin/exe-cloud.js +58 -45
- package/dist/bin/exe-dispatch.js +434 -277
- package/dist/bin/exe-doctor.js +317 -246
- package/dist/bin/exe-export-behaviors.js +328 -248
- package/dist/bin/exe-forget.js +314 -231
- package/dist/bin/exe-gateway.js +2676 -1402
- package/dist/bin/exe-heartbeat.js +329 -264
- package/dist/bin/exe-kill.js +324 -244
- package/dist/bin/exe-launch-agent.js +574 -463
- package/dist/bin/exe-link.js +1055 -95
- package/dist/bin/exe-new-employee.js +49 -54
- package/dist/bin/exe-pending-messages.js +310 -253
- package/dist/bin/exe-pending-notifications.js +299 -228
- package/dist/bin/exe-pending-reviews.js +314 -245
- package/dist/bin/exe-rename.js +259 -195
- package/dist/bin/exe-review.js +140 -64
- package/dist/bin/exe-search.js +543 -356
- package/dist/bin/exe-session-cleanup.js +463 -382
- package/dist/bin/exe-settings.js +129 -99
- package/dist/bin/exe-start.sh +6 -6
- package/dist/bin/exe-status.js +95 -36
- package/dist/bin/exe-team.js +116 -51
- package/dist/bin/git-sweep.js +482 -307
- package/dist/bin/graph-backfill.js +357 -245
- package/dist/bin/graph-export.js +324 -244
- package/dist/bin/install.js +33 -10
- package/dist/bin/scan-tasks.js +481 -307
- package/dist/bin/setup.js +1147 -140
- package/dist/bin/shard-migrate.js +321 -241
- package/dist/bin/update.js +1 -7
- package/dist/bin/wiki-sync.js +318 -238
- package/dist/gateway/index.js +2656 -1383
- package/dist/hooks/bug-report-worker.js +641 -472
- package/dist/hooks/commit-complete.js +482 -307
- package/dist/hooks/error-recall.js +363 -135
- package/dist/hooks/exe-heartbeat-hook.js +97 -27
- package/dist/hooks/ingest-worker.js +584 -397
- package/dist/hooks/ingest.js +123 -58
- package/dist/hooks/instructions-loaded.js +212 -82
- package/dist/hooks/notification.js +200 -70
- package/dist/hooks/post-compact.js +199 -81
- package/dist/hooks/pre-compact.js +352 -140
- package/dist/hooks/pre-tool-use.js +416 -278
- package/dist/hooks/prompt-ingest-worker.js +376 -299
- package/dist/hooks/prompt-submit.js +414 -188
- package/dist/hooks/response-ingest-worker.js +408 -338
- package/dist/hooks/session-end.js +209 -83
- package/dist/hooks/session-start.js +382 -158
- package/dist/hooks/stop.js +209 -83
- package/dist/hooks/subagent-stop.js +209 -85
- package/dist/hooks/summary-worker.js +606 -510
- package/dist/index.js +2133 -855
- package/dist/lib/cloud-sync.js +1175 -184
- package/dist/lib/config.js +1 -9
- package/dist/lib/consolidation.js +71 -34
- package/dist/lib/database.js +166 -14
- package/dist/lib/device-registry.js +189 -117
- package/dist/lib/embedder.js +6 -10
- package/dist/lib/employee-templates.js +134 -39
- package/dist/lib/employees.js +30 -7
- package/dist/lib/exe-daemon-client.js +5 -7
- package/dist/lib/exe-daemon.js +514 -152
- package/dist/lib/hybrid-search.js +543 -356
- package/dist/lib/identity-templates.js +15 -15
- package/dist/lib/identity.js +19 -15
- package/dist/lib/license.js +1 -7
- package/dist/lib/messaging.js +157 -135
- package/dist/lib/reminders.js +97 -0
- package/dist/lib/schedules.js +302 -231
- package/dist/lib/skill-learning.js +33 -27
- package/dist/lib/status-brief.js +11 -14
- package/dist/lib/store.js +326 -237
- package/dist/lib/task-router.js +105 -1
- package/dist/lib/tasks.js +233 -116
- package/dist/lib/tmux-routing.js +173 -56
- package/dist/lib/ws-client.js +13 -3
- package/dist/mcp/server.js +2009 -1015
- package/dist/mcp/tools/complete-reminder.js +97 -0
- package/dist/mcp/tools/create-reminder.js +97 -0
- package/dist/mcp/tools/create-task.js +426 -262
- package/dist/mcp/tools/deactivate-behavior.js +119 -44
- package/dist/mcp/tools/list-reminders.js +97 -0
- package/dist/mcp/tools/list-tasks.js +56 -57
- package/dist/mcp/tools/send-message.js +206 -143
- package/dist/mcp/tools/update-task.js +259 -85
- package/dist/runtime/index.js +495 -316
- package/dist/tui/App.js +1128 -919
- package/package.json +2 -10
- package/src/commands/exe/afk.md +8 -8
- package/src/commands/exe/assign.md +1 -1
- package/src/commands/exe/build-adv.md +1 -1
- package/src/commands/exe/call.md +10 -10
- package/src/commands/exe/employee-heartbeat.md +9 -6
- package/src/commands/exe/heartbeat.md +5 -5
- package/src/commands/exe/intercom.md +26 -15
- package/src/commands/exe/launch.md +2 -2
- package/src/commands/exe/new-employee.md +1 -1
- package/src/commands/exe/review.md +2 -2
- package/src/commands/exe/schedule.md +1 -1
- package/src/commands/exe/sessions.md +2 -2
- package/src/commands/exe.md +22 -20
package/dist/bin/exe-rename.js
CHANGED
|
@@ -9,6 +9,204 @@ var __export = (target, all) => {
|
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
// src/lib/config.ts
|
|
13
|
+
import { readFile, writeFile, mkdir, chmod } from "fs/promises";
|
|
14
|
+
import { readFileSync, existsSync, renameSync } from "fs";
|
|
15
|
+
import path from "path";
|
|
16
|
+
import os from "os";
|
|
17
|
+
function resolveDataDir() {
|
|
18
|
+
if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
|
|
19
|
+
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
20
|
+
const newDir = path.join(os.homedir(), ".exe-os");
|
|
21
|
+
const legacyDir = path.join(os.homedir(), ".exe-mem");
|
|
22
|
+
if (!existsSync(newDir) && existsSync(legacyDir)) {
|
|
23
|
+
try {
|
|
24
|
+
renameSync(legacyDir, newDir);
|
|
25
|
+
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
26
|
+
`);
|
|
27
|
+
} catch {
|
|
28
|
+
return legacyDir;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return newDir;
|
|
32
|
+
}
|
|
33
|
+
var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG;
|
|
34
|
+
var init_config = __esm({
|
|
35
|
+
"src/lib/config.ts"() {
|
|
36
|
+
"use strict";
|
|
37
|
+
EXE_AI_DIR = resolveDataDir();
|
|
38
|
+
DB_PATH = path.join(EXE_AI_DIR, "memories.db");
|
|
39
|
+
MODELS_DIR = path.join(EXE_AI_DIR, "models");
|
|
40
|
+
CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
|
|
41
|
+
LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
|
|
42
|
+
CURRENT_CONFIG_VERSION = 1;
|
|
43
|
+
DEFAULT_CONFIG = {
|
|
44
|
+
config_version: CURRENT_CONFIG_VERSION,
|
|
45
|
+
dbPath: DB_PATH,
|
|
46
|
+
modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
|
|
47
|
+
embeddingDim: 1024,
|
|
48
|
+
batchSize: 20,
|
|
49
|
+
flushIntervalMs: 1e4,
|
|
50
|
+
autoIngestion: true,
|
|
51
|
+
autoRetrieval: true,
|
|
52
|
+
searchMode: "hybrid",
|
|
53
|
+
hookSearchMode: "hybrid",
|
|
54
|
+
fileGrepEnabled: true,
|
|
55
|
+
splashEffect: true,
|
|
56
|
+
consolidationEnabled: true,
|
|
57
|
+
consolidationIntervalMs: 6 * 60 * 60 * 1e3,
|
|
58
|
+
consolidationModel: "claude-haiku-4-5-20251001",
|
|
59
|
+
consolidationMaxCallsPerRun: 20,
|
|
60
|
+
selfQueryRouter: true,
|
|
61
|
+
selfQueryModel: "claude-haiku-4-5-20251001",
|
|
62
|
+
rerankerEnabled: true,
|
|
63
|
+
scalingRoadmap: {
|
|
64
|
+
rerankerAutoTrigger: {
|
|
65
|
+
enabled: true,
|
|
66
|
+
broadQueryMinCardinality: 5e4,
|
|
67
|
+
fetchTopK: 150,
|
|
68
|
+
returnTopK: 5
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
graphRagEnabled: true,
|
|
72
|
+
wikiEnabled: false,
|
|
73
|
+
wikiUrl: "",
|
|
74
|
+
wikiApiKey: "",
|
|
75
|
+
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
76
|
+
wikiWorkspaceMapping: {},
|
|
77
|
+
wikiAutoUpdate: true,
|
|
78
|
+
wikiAutoUpdateThreshold: 0.5,
|
|
79
|
+
wikiAutoUpdateCreateNew: true,
|
|
80
|
+
skillLearning: true,
|
|
81
|
+
skillThreshold: 3,
|
|
82
|
+
skillModel: "claude-haiku-4-5-20251001",
|
|
83
|
+
exeHeartbeat: {
|
|
84
|
+
enabled: true,
|
|
85
|
+
intervalSeconds: 60,
|
|
86
|
+
staleInProgressThresholdHours: 2
|
|
87
|
+
},
|
|
88
|
+
sessionLifecycle: {
|
|
89
|
+
idleKillEnabled: true,
|
|
90
|
+
idleKillTicksRequired: 3,
|
|
91
|
+
idleKillIntercomAckWindowMs: 1e4,
|
|
92
|
+
maxAutoInstances: 10
|
|
93
|
+
},
|
|
94
|
+
autoUpdate: {
|
|
95
|
+
checkOnBoot: true,
|
|
96
|
+
autoInstall: false,
|
|
97
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// src/lib/employees.ts
|
|
104
|
+
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
105
|
+
import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
106
|
+
import { execSync } from "child_process";
|
|
107
|
+
import path2 from "path";
|
|
108
|
+
import os2 from "os";
|
|
109
|
+
function normalizeRole(role) {
|
|
110
|
+
return (role ?? "").trim().toLowerCase();
|
|
111
|
+
}
|
|
112
|
+
function isCoordinatorRole(role) {
|
|
113
|
+
return normalizeRole(role) === normalizeRole(COORDINATOR_ROLE);
|
|
114
|
+
}
|
|
115
|
+
function getCoordinatorEmployee(employees) {
|
|
116
|
+
return employees.find((e) => isCoordinatorRole(e.role));
|
|
117
|
+
}
|
|
118
|
+
function getCoordinatorName(employees = loadEmployeesSync()) {
|
|
119
|
+
return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
|
|
120
|
+
}
|
|
121
|
+
function validateEmployeeName(name) {
|
|
122
|
+
if (!name) {
|
|
123
|
+
return { valid: false, error: "Name is required" };
|
|
124
|
+
}
|
|
125
|
+
if (name.length > 32) {
|
|
126
|
+
return { valid: false, error: "Name must be 32 characters or fewer" };
|
|
127
|
+
}
|
|
128
|
+
if (!/^[a-z][a-z0-9]*$/.test(name)) {
|
|
129
|
+
return {
|
|
130
|
+
valid: false,
|
|
131
|
+
error: "Name must start with a letter and contain only lowercase alphanumeric characters"
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return { valid: true };
|
|
135
|
+
}
|
|
136
|
+
async function loadEmployees(employeesPath = EMPLOYEES_PATH) {
|
|
137
|
+
if (!existsSync2(employeesPath)) {
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
const raw = await readFile2(employeesPath, "utf-8");
|
|
141
|
+
try {
|
|
142
|
+
return JSON.parse(raw);
|
|
143
|
+
} catch {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async function saveEmployees(employees, employeesPath = EMPLOYEES_PATH) {
|
|
148
|
+
await mkdir2(path2.dirname(employeesPath), { recursive: true });
|
|
149
|
+
await writeFile2(employeesPath, JSON.stringify(employees, null, 2) + "\n", "utf-8");
|
|
150
|
+
}
|
|
151
|
+
function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
|
|
152
|
+
if (!existsSync2(employeesPath)) return [];
|
|
153
|
+
try {
|
|
154
|
+
return JSON.parse(readFileSync2(employeesPath, "utf-8"));
|
|
155
|
+
} catch {
|
|
156
|
+
return [];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function findExeBin() {
|
|
160
|
+
try {
|
|
161
|
+
return execSync(process.platform === "win32" ? "where exe-os" : "which exe-os", { encoding: "utf8" }).trim();
|
|
162
|
+
} catch {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function registerBinSymlinks(name) {
|
|
167
|
+
const created = [];
|
|
168
|
+
const skipped = [];
|
|
169
|
+
const errors = [];
|
|
170
|
+
const exeBinPath = findExeBin();
|
|
171
|
+
if (!exeBinPath) {
|
|
172
|
+
errors.push("Could not find 'exe-os' in PATH");
|
|
173
|
+
return { created, skipped, errors };
|
|
174
|
+
}
|
|
175
|
+
const binDir = path2.dirname(exeBinPath);
|
|
176
|
+
let target;
|
|
177
|
+
try {
|
|
178
|
+
target = readlinkSync(exeBinPath);
|
|
179
|
+
} catch {
|
|
180
|
+
errors.push("Could not read 'exe' symlink");
|
|
181
|
+
return { created, skipped, errors };
|
|
182
|
+
}
|
|
183
|
+
for (const suffix of ["", "-opencode"]) {
|
|
184
|
+
const linkName = `${name}${suffix}`;
|
|
185
|
+
const linkPath = path2.join(binDir, linkName);
|
|
186
|
+
if (existsSync2(linkPath)) {
|
|
187
|
+
skipped.push(linkName);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
symlinkSync(target, linkPath);
|
|
192
|
+
created.push(linkName);
|
|
193
|
+
} catch (err) {
|
|
194
|
+
errors.push(`${linkName}: ${err instanceof Error ? err.message : String(err)}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return { created, skipped, errors };
|
|
198
|
+
}
|
|
199
|
+
var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE;
|
|
200
|
+
var init_employees = __esm({
|
|
201
|
+
"src/lib/employees.ts"() {
|
|
202
|
+
"use strict";
|
|
203
|
+
init_config();
|
|
204
|
+
EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
205
|
+
DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
|
|
206
|
+
COORDINATOR_ROLE = "COO";
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
12
210
|
// src/lib/db-retry.ts
|
|
13
211
|
function isBusyError(err) {
|
|
14
212
|
if (err instanceof Error) {
|
|
@@ -48,7 +246,7 @@ function wrapWithRetry(client) {
|
|
|
48
246
|
return (sql) => retryOnBusy(() => target.execute(sql), "execute");
|
|
49
247
|
}
|
|
50
248
|
if (prop === "batch") {
|
|
51
|
-
return (stmts) => retryOnBusy(() => target.batch(stmts), "batch");
|
|
249
|
+
return (stmts, mode) => retryOnBusy(() => target.batch(stmts, mode), "batch");
|
|
52
250
|
}
|
|
53
251
|
return Reflect.get(target, prop, receiver);
|
|
54
252
|
}
|
|
@@ -211,22 +409,24 @@ async function ensureSchema() {
|
|
|
211
409
|
ON behaviors(agent_id, active);
|
|
212
410
|
`);
|
|
213
411
|
try {
|
|
412
|
+
const coordinatorName = getCoordinatorName();
|
|
214
413
|
const existing = await client.execute({
|
|
215
|
-
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id =
|
|
216
|
-
args: []
|
|
414
|
+
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = ?",
|
|
415
|
+
args: [coordinatorName]
|
|
217
416
|
});
|
|
218
417
|
if (Number(existing.rows[0]?.cnt) === 0) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
418
|
+
const seededAt = "2026-03-25T00:00:00Z";
|
|
419
|
+
for (const [domain, content] of [
|
|
420
|
+
["workflow", `Don't ask "keep going?" \u2014 just keep executing phases/plans autonomously`],
|
|
421
|
+
["tool-use", "Always use create_task MCP tool, never write .md files directly for task creation"],
|
|
422
|
+
["workflow", "Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission"]
|
|
423
|
+
]) {
|
|
424
|
+
await client.execute({
|
|
425
|
+
sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
|
|
426
|
+
VALUES (hex(randomblob(16)), ?, NULL, ?, ?, 1, ?, ?)`,
|
|
427
|
+
args: [coordinatorName, domain, content, seededAt, seededAt]
|
|
428
|
+
});
|
|
429
|
+
}
|
|
230
430
|
}
|
|
231
431
|
} catch {
|
|
232
432
|
}
|
|
@@ -918,6 +1118,39 @@ async function ensureSchema() {
|
|
|
918
1118
|
} catch {
|
|
919
1119
|
}
|
|
920
1120
|
}
|
|
1121
|
+
try {
|
|
1122
|
+
await client.execute({
|
|
1123
|
+
sql: `ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0`,
|
|
1124
|
+
args: []
|
|
1125
|
+
});
|
|
1126
|
+
} catch {
|
|
1127
|
+
}
|
|
1128
|
+
try {
|
|
1129
|
+
await client.execute(
|
|
1130
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_draft ON memories(draft) WHERE draft = 1`
|
|
1131
|
+
);
|
|
1132
|
+
} catch {
|
|
1133
|
+
}
|
|
1134
|
+
try {
|
|
1135
|
+
await client.execute({
|
|
1136
|
+
sql: `ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'`,
|
|
1137
|
+
args: []
|
|
1138
|
+
});
|
|
1139
|
+
} catch {
|
|
1140
|
+
}
|
|
1141
|
+
try {
|
|
1142
|
+
await client.execute(
|
|
1143
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(memory_type)`
|
|
1144
|
+
);
|
|
1145
|
+
} catch {
|
|
1146
|
+
}
|
|
1147
|
+
try {
|
|
1148
|
+
await client.execute({
|
|
1149
|
+
sql: `ALTER TABLE memories ADD COLUMN trajectory TEXT`,
|
|
1150
|
+
args: []
|
|
1151
|
+
});
|
|
1152
|
+
} catch {
|
|
1153
|
+
}
|
|
921
1154
|
}
|
|
922
1155
|
async function disposeDatabase() {
|
|
923
1156
|
if (_client) {
|
|
@@ -931,6 +1164,7 @@ var init_database = __esm({
|
|
|
931
1164
|
"src/lib/database.ts"() {
|
|
932
1165
|
"use strict";
|
|
933
1166
|
init_db_retry();
|
|
1167
|
+
init_employees();
|
|
934
1168
|
_client = null;
|
|
935
1169
|
_resilientClient = null;
|
|
936
1170
|
initTurso = initDatabase;
|
|
@@ -939,182 +1173,12 @@ var init_database = __esm({
|
|
|
939
1173
|
});
|
|
940
1174
|
|
|
941
1175
|
// src/bin/exe-rename.ts
|
|
1176
|
+
init_employees();
|
|
942
1177
|
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, renameSync as renameSync3, unlinkSync as unlinkSync2, existsSync as existsSync3 } from "fs";
|
|
943
1178
|
import { execSync as execSync2 } from "child_process";
|
|
944
1179
|
import path3 from "path";
|
|
945
1180
|
import { homedir } from "os";
|
|
946
1181
|
|
|
947
|
-
// src/lib/employees.ts
|
|
948
|
-
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
949
|
-
import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
950
|
-
import { execSync } from "child_process";
|
|
951
|
-
import path2 from "path";
|
|
952
|
-
import os2 from "os";
|
|
953
|
-
|
|
954
|
-
// src/lib/config.ts
|
|
955
|
-
import { readFile, writeFile, mkdir, chmod } from "fs/promises";
|
|
956
|
-
import { readFileSync, existsSync, renameSync } from "fs";
|
|
957
|
-
import path from "path";
|
|
958
|
-
import os from "os";
|
|
959
|
-
function resolveDataDir() {
|
|
960
|
-
if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
|
|
961
|
-
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
962
|
-
const newDir = path.join(os.homedir(), ".exe-os");
|
|
963
|
-
const legacyDir = path.join(os.homedir(), ".exe-mem");
|
|
964
|
-
if (!existsSync(newDir) && existsSync(legacyDir)) {
|
|
965
|
-
try {
|
|
966
|
-
renameSync(legacyDir, newDir);
|
|
967
|
-
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
968
|
-
`);
|
|
969
|
-
} catch {
|
|
970
|
-
return legacyDir;
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
return newDir;
|
|
974
|
-
}
|
|
975
|
-
var EXE_AI_DIR = resolveDataDir();
|
|
976
|
-
var DB_PATH = path.join(EXE_AI_DIR, "memories.db");
|
|
977
|
-
var MODELS_DIR = path.join(EXE_AI_DIR, "models");
|
|
978
|
-
var CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
|
|
979
|
-
var LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
|
|
980
|
-
var CURRENT_CONFIG_VERSION = 1;
|
|
981
|
-
var DEFAULT_CONFIG = {
|
|
982
|
-
config_version: CURRENT_CONFIG_VERSION,
|
|
983
|
-
dbPath: DB_PATH,
|
|
984
|
-
modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
|
|
985
|
-
embeddingDim: 1024,
|
|
986
|
-
batchSize: 20,
|
|
987
|
-
flushIntervalMs: 1e4,
|
|
988
|
-
autoIngestion: true,
|
|
989
|
-
autoRetrieval: true,
|
|
990
|
-
searchMode: "hybrid",
|
|
991
|
-
hookSearchMode: "hybrid",
|
|
992
|
-
fileGrepEnabled: true,
|
|
993
|
-
splashEffect: true,
|
|
994
|
-
consolidationEnabled: true,
|
|
995
|
-
consolidationIntervalMs: 6 * 60 * 60 * 1e3,
|
|
996
|
-
consolidationModel: "claude-haiku-4-5-20251001",
|
|
997
|
-
consolidationMaxCallsPerRun: 20,
|
|
998
|
-
selfQueryRouter: true,
|
|
999
|
-
selfQueryModel: "claude-haiku-4-5-20251001",
|
|
1000
|
-
rerankerEnabled: true,
|
|
1001
|
-
scalingRoadmap: {
|
|
1002
|
-
rerankerAutoTrigger: {
|
|
1003
|
-
enabled: true,
|
|
1004
|
-
broadQueryMinCardinality: 5e4,
|
|
1005
|
-
fetchTopK: 150,
|
|
1006
|
-
returnTopK: 5
|
|
1007
|
-
}
|
|
1008
|
-
},
|
|
1009
|
-
graphRagEnabled: true,
|
|
1010
|
-
wikiEnabled: false,
|
|
1011
|
-
wikiUrl: "",
|
|
1012
|
-
wikiApiKey: "",
|
|
1013
|
-
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
1014
|
-
wikiWorkspaceMapping: {
|
|
1015
|
-
exe: "Executive",
|
|
1016
|
-
yoshi: "Engineering",
|
|
1017
|
-
mari: "Marketing",
|
|
1018
|
-
tom: "Engineering",
|
|
1019
|
-
sasha: "Production"
|
|
1020
|
-
},
|
|
1021
|
-
wikiAutoUpdate: true,
|
|
1022
|
-
wikiAutoUpdateThreshold: 0.5,
|
|
1023
|
-
wikiAutoUpdateCreateNew: true,
|
|
1024
|
-
skillLearning: true,
|
|
1025
|
-
skillThreshold: 3,
|
|
1026
|
-
skillModel: "claude-haiku-4-5-20251001",
|
|
1027
|
-
exeHeartbeat: {
|
|
1028
|
-
enabled: true,
|
|
1029
|
-
intervalSeconds: 60,
|
|
1030
|
-
staleInProgressThresholdHours: 2
|
|
1031
|
-
},
|
|
1032
|
-
sessionLifecycle: {
|
|
1033
|
-
idleKillEnabled: true,
|
|
1034
|
-
idleKillTicksRequired: 3,
|
|
1035
|
-
idleKillIntercomAckWindowMs: 1e4,
|
|
1036
|
-
maxAutoInstances: 10
|
|
1037
|
-
},
|
|
1038
|
-
autoUpdate: {
|
|
1039
|
-
checkOnBoot: true,
|
|
1040
|
-
autoInstall: false,
|
|
1041
|
-
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
1042
|
-
}
|
|
1043
|
-
};
|
|
1044
|
-
|
|
1045
|
-
// src/lib/employees.ts
|
|
1046
|
-
var EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
1047
|
-
function validateEmployeeName(name) {
|
|
1048
|
-
if (!name) {
|
|
1049
|
-
return { valid: false, error: "Name is required" };
|
|
1050
|
-
}
|
|
1051
|
-
if (name.length > 32) {
|
|
1052
|
-
return { valid: false, error: "Name must be 32 characters or fewer" };
|
|
1053
|
-
}
|
|
1054
|
-
if (!/^[a-z][a-z0-9]*$/.test(name)) {
|
|
1055
|
-
return {
|
|
1056
|
-
valid: false,
|
|
1057
|
-
error: "Name must start with a letter and contain only lowercase alphanumeric characters"
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
return { valid: true };
|
|
1061
|
-
}
|
|
1062
|
-
async function loadEmployees(employeesPath = EMPLOYEES_PATH) {
|
|
1063
|
-
if (!existsSync2(employeesPath)) {
|
|
1064
|
-
return [];
|
|
1065
|
-
}
|
|
1066
|
-
const raw = await readFile2(employeesPath, "utf-8");
|
|
1067
|
-
try {
|
|
1068
|
-
return JSON.parse(raw);
|
|
1069
|
-
} catch {
|
|
1070
|
-
return [];
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
async function saveEmployees(employees, employeesPath = EMPLOYEES_PATH) {
|
|
1074
|
-
await mkdir2(path2.dirname(employeesPath), { recursive: true });
|
|
1075
|
-
await writeFile2(employeesPath, JSON.stringify(employees, null, 2) + "\n", "utf-8");
|
|
1076
|
-
}
|
|
1077
|
-
function findExeBin() {
|
|
1078
|
-
try {
|
|
1079
|
-
return execSync(process.platform === "win32" ? "where exe-os" : "which exe-os", { encoding: "utf8" }).trim();
|
|
1080
|
-
} catch {
|
|
1081
|
-
return null;
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
function registerBinSymlinks(name) {
|
|
1085
|
-
const created = [];
|
|
1086
|
-
const skipped = [];
|
|
1087
|
-
const errors = [];
|
|
1088
|
-
const exeBinPath = findExeBin();
|
|
1089
|
-
if (!exeBinPath) {
|
|
1090
|
-
errors.push("Could not find 'exe-os' in PATH");
|
|
1091
|
-
return { created, skipped, errors };
|
|
1092
|
-
}
|
|
1093
|
-
const binDir = path2.dirname(exeBinPath);
|
|
1094
|
-
let target;
|
|
1095
|
-
try {
|
|
1096
|
-
target = readlinkSync(exeBinPath);
|
|
1097
|
-
} catch {
|
|
1098
|
-
errors.push("Could not read 'exe' symlink");
|
|
1099
|
-
return { created, skipped, errors };
|
|
1100
|
-
}
|
|
1101
|
-
for (const suffix of ["", "-opencode"]) {
|
|
1102
|
-
const linkName = `${name}${suffix}`;
|
|
1103
|
-
const linkPath = path2.join(binDir, linkName);
|
|
1104
|
-
if (existsSync2(linkPath)) {
|
|
1105
|
-
skipped.push(linkName);
|
|
1106
|
-
continue;
|
|
1107
|
-
}
|
|
1108
|
-
try {
|
|
1109
|
-
symlinkSync(target, linkPath);
|
|
1110
|
-
created.push(linkName);
|
|
1111
|
-
} catch (err) {
|
|
1112
|
-
errors.push(`${linkName}: ${err instanceof Error ? err.message : String(err)}`);
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
return { created, skipped, errors };
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
1182
|
// src/lib/global-procedures.ts
|
|
1119
1183
|
init_database();
|
|
1120
1184
|
import { randomUUID } from "crypto";
|
|
@@ -1126,26 +1190,26 @@ var PLATFORM_PROCEDURES = [
|
|
|
1126
1190
|
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1127
1191
|
domain: "architecture",
|
|
1128
1192
|
priority: "p0",
|
|
1129
|
-
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO
|
|
1193
|
+
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."
|
|
1130
1194
|
},
|
|
1131
1195
|
{
|
|
1132
1196
|
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1133
1197
|
domain: "architecture",
|
|
1134
1198
|
priority: "p0",
|
|
1135
|
-
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC
|
|
1199
|
+
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."
|
|
1136
1200
|
},
|
|
1137
1201
|
{
|
|
1138
|
-
title: "Sessions explained \u2014
|
|
1202
|
+
title: "Sessions explained \u2014 coordinator session names and projects",
|
|
1139
1203
|
domain: "architecture",
|
|
1140
1204
|
priority: "p0",
|
|
1141
|
-
content: "Each
|
|
1205
|
+
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."
|
|
1142
1206
|
},
|
|
1143
1207
|
// --- Hierarchy and dispatch ---
|
|
1144
1208
|
{
|
|
1145
1209
|
title: "Chain of command \u2014 who talks to whom",
|
|
1146
1210
|
domain: "workflow",
|
|
1147
1211
|
priority: "p0",
|
|
1148
|
-
content: "Founder
|
|
1212
|
+
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."
|
|
1149
1213
|
},
|
|
1150
1214
|
{
|
|
1151
1215
|
title: "Single dispatch path \u2014 create_task only",
|
|
@@ -1155,30 +1219,30 @@ var PLATFORM_PROCEDURES = [
|
|
|
1155
1219
|
},
|
|
1156
1220
|
// --- Session isolation ---
|
|
1157
1221
|
{
|
|
1158
|
-
title: "Session scoping \u2014 stay in your
|
|
1222
|
+
title: "Session scoping \u2014 stay in your coordinator boundary",
|
|
1159
1223
|
domain: "security",
|
|
1160
1224
|
priority: "p0",
|
|
1161
|
-
content: "Session scoping is mandatory. Managers dispatch to workers within their own
|
|
1225
|
+
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."
|
|
1162
1226
|
},
|
|
1163
1227
|
{
|
|
1164
1228
|
title: "Session isolation \u2014 never touch another session's work",
|
|
1165
1229
|
domain: "workflow",
|
|
1166
1230
|
priority: "p0",
|
|
1167
|
-
content:
|
|
1231
|
+
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."
|
|
1168
1232
|
},
|
|
1169
1233
|
// --- Engineering: session scoping in code ---
|
|
1170
1234
|
{
|
|
1171
1235
|
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1172
1236
|
domain: "architecture",
|
|
1173
1237
|
priority: "p0",
|
|
1174
|
-
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
|
|
1238
|
+
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."
|
|
1175
1239
|
},
|
|
1176
1240
|
// --- Hard constraints ---
|
|
1177
1241
|
{
|
|
1178
1242
|
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1179
1243
|
domain: "security",
|
|
1180
1244
|
priority: "p0",
|
|
1181
|
-
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
|
|
1245
|
+
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."
|
|
1182
1246
|
},
|
|
1183
1247
|
// --- Operations ---
|
|
1184
1248
|
{
|