@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-forget.js
CHANGED
|
@@ -55,7 +55,7 @@ function wrapWithRetry(client) {
|
|
|
55
55
|
return (sql) => retryOnBusy(() => target.execute(sql), "execute");
|
|
56
56
|
}
|
|
57
57
|
if (prop === "batch") {
|
|
58
|
-
return (stmts) => retryOnBusy(() => target.batch(stmts), "batch");
|
|
58
|
+
return (stmts, mode) => retryOnBusy(() => target.batch(stmts, mode), "batch");
|
|
59
59
|
}
|
|
60
60
|
return Reflect.get(target, prop, receiver);
|
|
61
61
|
}
|
|
@@ -71,6 +71,226 @@ var init_db_retry = __esm({
|
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
+
// src/lib/config.ts
|
|
75
|
+
import { readFile, writeFile, mkdir, chmod } from "fs/promises";
|
|
76
|
+
import { readFileSync, existsSync, renameSync } from "fs";
|
|
77
|
+
import path from "path";
|
|
78
|
+
import os from "os";
|
|
79
|
+
function resolveDataDir() {
|
|
80
|
+
if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
|
|
81
|
+
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
82
|
+
const newDir = path.join(os.homedir(), ".exe-os");
|
|
83
|
+
const legacyDir = path.join(os.homedir(), ".exe-mem");
|
|
84
|
+
if (!existsSync(newDir) && existsSync(legacyDir)) {
|
|
85
|
+
try {
|
|
86
|
+
renameSync(legacyDir, newDir);
|
|
87
|
+
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
88
|
+
`);
|
|
89
|
+
} catch {
|
|
90
|
+
return legacyDir;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return newDir;
|
|
94
|
+
}
|
|
95
|
+
function migrateLegacyConfig(raw) {
|
|
96
|
+
if ("r2" in raw) {
|
|
97
|
+
process.stderr.write(
|
|
98
|
+
"[exe-os] Warning: config.json contains deprecated 'r2' field from v1.0. R2 sync has been replaced in v1.1. The 'r2' field will be ignored.\n"
|
|
99
|
+
);
|
|
100
|
+
delete raw.r2;
|
|
101
|
+
}
|
|
102
|
+
if ("syncIntervalMs" in raw) {
|
|
103
|
+
delete raw.syncIntervalMs;
|
|
104
|
+
}
|
|
105
|
+
return raw;
|
|
106
|
+
}
|
|
107
|
+
function migrateConfig(raw) {
|
|
108
|
+
const fromVersion = typeof raw.config_version === "number" ? raw.config_version : 0;
|
|
109
|
+
let currentVersion = fromVersion;
|
|
110
|
+
let migrated = false;
|
|
111
|
+
if (currentVersion > CURRENT_CONFIG_VERSION) {
|
|
112
|
+
return { config: raw, migrated: false, fromVersion };
|
|
113
|
+
}
|
|
114
|
+
for (const migration of CONFIG_MIGRATIONS) {
|
|
115
|
+
if (currentVersion === migration.from && migration.to <= CURRENT_CONFIG_VERSION) {
|
|
116
|
+
raw = migration.migrate(raw);
|
|
117
|
+
currentVersion = migration.to;
|
|
118
|
+
migrated = true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return { config: raw, migrated, fromVersion };
|
|
122
|
+
}
|
|
123
|
+
function normalizeScalingRoadmap(raw) {
|
|
124
|
+
const defaultAuto = DEFAULT_CONFIG.scalingRoadmap.rerankerAutoTrigger;
|
|
125
|
+
const userRoadmap = raw.scalingRoadmap ?? {};
|
|
126
|
+
const userAuto = userRoadmap.rerankerAutoTrigger ?? {};
|
|
127
|
+
if (userAuto.enabled === void 0 && raw.rerankerEnabled !== void 0) {
|
|
128
|
+
userAuto.enabled = raw.rerankerEnabled;
|
|
129
|
+
}
|
|
130
|
+
raw.scalingRoadmap = {
|
|
131
|
+
...userRoadmap,
|
|
132
|
+
rerankerAutoTrigger: { ...defaultAuto, ...userAuto }
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function normalizeSessionLifecycle(raw) {
|
|
136
|
+
const defaultSL = DEFAULT_CONFIG.sessionLifecycle;
|
|
137
|
+
const userSL = raw.sessionLifecycle ?? {};
|
|
138
|
+
raw.sessionLifecycle = { ...defaultSL, ...userSL };
|
|
139
|
+
}
|
|
140
|
+
function normalizeAutoUpdate(raw) {
|
|
141
|
+
const defaultAU = DEFAULT_CONFIG.autoUpdate;
|
|
142
|
+
const userAU = raw.autoUpdate ?? {};
|
|
143
|
+
raw.autoUpdate = { ...defaultAU, ...userAU };
|
|
144
|
+
}
|
|
145
|
+
async function loadConfig() {
|
|
146
|
+
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
147
|
+
await mkdir(dir, { recursive: true });
|
|
148
|
+
const configPath = path.join(dir, "config.json");
|
|
149
|
+
if (!existsSync(configPath)) {
|
|
150
|
+
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
151
|
+
}
|
|
152
|
+
const raw = await readFile(configPath, "utf-8");
|
|
153
|
+
try {
|
|
154
|
+
let parsed = JSON.parse(raw);
|
|
155
|
+
parsed = migrateLegacyConfig(parsed);
|
|
156
|
+
const { config: migratedCfg, migrated, fromVersion } = migrateConfig(parsed);
|
|
157
|
+
if (migrated) {
|
|
158
|
+
process.stderr.write(`[exe-os] Config migrated from v${fromVersion} to v${migratedCfg.config_version}
|
|
159
|
+
`);
|
|
160
|
+
try {
|
|
161
|
+
await writeFile(configPath, JSON.stringify(migratedCfg, null, 2) + "\n");
|
|
162
|
+
} catch {
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
normalizeScalingRoadmap(migratedCfg);
|
|
166
|
+
normalizeSessionLifecycle(migratedCfg);
|
|
167
|
+
normalizeAutoUpdate(migratedCfg);
|
|
168
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
|
|
169
|
+
if (config.dbPath.startsWith("~")) {
|
|
170
|
+
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
171
|
+
}
|
|
172
|
+
return config;
|
|
173
|
+
} catch {
|
|
174
|
+
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG, CONFIG_MIGRATIONS;
|
|
178
|
+
var init_config = __esm({
|
|
179
|
+
"src/lib/config.ts"() {
|
|
180
|
+
"use strict";
|
|
181
|
+
EXE_AI_DIR = resolveDataDir();
|
|
182
|
+
DB_PATH = path.join(EXE_AI_DIR, "memories.db");
|
|
183
|
+
MODELS_DIR = path.join(EXE_AI_DIR, "models");
|
|
184
|
+
CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
|
|
185
|
+
LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
|
|
186
|
+
CURRENT_CONFIG_VERSION = 1;
|
|
187
|
+
DEFAULT_CONFIG = {
|
|
188
|
+
config_version: CURRENT_CONFIG_VERSION,
|
|
189
|
+
dbPath: DB_PATH,
|
|
190
|
+
modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
|
|
191
|
+
embeddingDim: 1024,
|
|
192
|
+
batchSize: 20,
|
|
193
|
+
flushIntervalMs: 1e4,
|
|
194
|
+
autoIngestion: true,
|
|
195
|
+
autoRetrieval: true,
|
|
196
|
+
searchMode: "hybrid",
|
|
197
|
+
hookSearchMode: "hybrid",
|
|
198
|
+
fileGrepEnabled: true,
|
|
199
|
+
splashEffect: true,
|
|
200
|
+
consolidationEnabled: true,
|
|
201
|
+
consolidationIntervalMs: 6 * 60 * 60 * 1e3,
|
|
202
|
+
consolidationModel: "claude-haiku-4-5-20251001",
|
|
203
|
+
consolidationMaxCallsPerRun: 20,
|
|
204
|
+
selfQueryRouter: true,
|
|
205
|
+
selfQueryModel: "claude-haiku-4-5-20251001",
|
|
206
|
+
rerankerEnabled: true,
|
|
207
|
+
scalingRoadmap: {
|
|
208
|
+
rerankerAutoTrigger: {
|
|
209
|
+
enabled: true,
|
|
210
|
+
broadQueryMinCardinality: 5e4,
|
|
211
|
+
fetchTopK: 150,
|
|
212
|
+
returnTopK: 5
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
graphRagEnabled: true,
|
|
216
|
+
wikiEnabled: false,
|
|
217
|
+
wikiUrl: "",
|
|
218
|
+
wikiApiKey: "",
|
|
219
|
+
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
220
|
+
wikiWorkspaceMapping: {},
|
|
221
|
+
wikiAutoUpdate: true,
|
|
222
|
+
wikiAutoUpdateThreshold: 0.5,
|
|
223
|
+
wikiAutoUpdateCreateNew: true,
|
|
224
|
+
skillLearning: true,
|
|
225
|
+
skillThreshold: 3,
|
|
226
|
+
skillModel: "claude-haiku-4-5-20251001",
|
|
227
|
+
exeHeartbeat: {
|
|
228
|
+
enabled: true,
|
|
229
|
+
intervalSeconds: 60,
|
|
230
|
+
staleInProgressThresholdHours: 2
|
|
231
|
+
},
|
|
232
|
+
sessionLifecycle: {
|
|
233
|
+
idleKillEnabled: true,
|
|
234
|
+
idleKillTicksRequired: 3,
|
|
235
|
+
idleKillIntercomAckWindowMs: 1e4,
|
|
236
|
+
maxAutoInstances: 10
|
|
237
|
+
},
|
|
238
|
+
autoUpdate: {
|
|
239
|
+
checkOnBoot: true,
|
|
240
|
+
autoInstall: false,
|
|
241
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
CONFIG_MIGRATIONS = [
|
|
245
|
+
{
|
|
246
|
+
from: 0,
|
|
247
|
+
to: 1,
|
|
248
|
+
migrate: (cfg) => {
|
|
249
|
+
cfg.config_version = 1;
|
|
250
|
+
return cfg;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
];
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
// src/lib/employees.ts
|
|
258
|
+
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
259
|
+
import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
260
|
+
import { execSync } from "child_process";
|
|
261
|
+
import path2 from "path";
|
|
262
|
+
import os2 from "os";
|
|
263
|
+
function normalizeRole(role) {
|
|
264
|
+
return (role ?? "").trim().toLowerCase();
|
|
265
|
+
}
|
|
266
|
+
function isCoordinatorRole(role) {
|
|
267
|
+
return normalizeRole(role) === normalizeRole(COORDINATOR_ROLE);
|
|
268
|
+
}
|
|
269
|
+
function getCoordinatorEmployee(employees) {
|
|
270
|
+
return employees.find((e) => isCoordinatorRole(e.role));
|
|
271
|
+
}
|
|
272
|
+
function getCoordinatorName(employees = loadEmployeesSync()) {
|
|
273
|
+
return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
|
|
274
|
+
}
|
|
275
|
+
function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
|
|
276
|
+
if (!existsSync2(employeesPath)) return [];
|
|
277
|
+
try {
|
|
278
|
+
return JSON.parse(readFileSync2(employeesPath, "utf-8"));
|
|
279
|
+
} catch {
|
|
280
|
+
return [];
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE;
|
|
284
|
+
var init_employees = __esm({
|
|
285
|
+
"src/lib/employees.ts"() {
|
|
286
|
+
"use strict";
|
|
287
|
+
init_config();
|
|
288
|
+
EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
289
|
+
DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
|
|
290
|
+
COORDINATOR_ROLE = "COO";
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
|
|
74
294
|
// src/lib/database.ts
|
|
75
295
|
import { createClient } from "@libsql/client";
|
|
76
296
|
async function initDatabase(config) {
|
|
@@ -204,22 +424,24 @@ async function ensureSchema() {
|
|
|
204
424
|
ON behaviors(agent_id, active);
|
|
205
425
|
`);
|
|
206
426
|
try {
|
|
427
|
+
const coordinatorName = getCoordinatorName();
|
|
207
428
|
const existing = await client.execute({
|
|
208
|
-
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id =
|
|
209
|
-
args: []
|
|
429
|
+
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = ?",
|
|
430
|
+
args: [coordinatorName]
|
|
210
431
|
});
|
|
211
432
|
if (Number(existing.rows[0]?.cnt) === 0) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
433
|
+
const seededAt = "2026-03-25T00:00:00Z";
|
|
434
|
+
for (const [domain, content] of [
|
|
435
|
+
["workflow", `Don't ask "keep going?" \u2014 just keep executing phases/plans autonomously`],
|
|
436
|
+
["tool-use", "Always use create_task MCP tool, never write .md files directly for task creation"],
|
|
437
|
+
["workflow", "Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission"]
|
|
438
|
+
]) {
|
|
439
|
+
await client.execute({
|
|
440
|
+
sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
|
|
441
|
+
VALUES (hex(randomblob(16)), ?, NULL, ?, ?, 1, ?, ?)`,
|
|
442
|
+
args: [coordinatorName, domain, content, seededAt, seededAt]
|
|
443
|
+
});
|
|
444
|
+
}
|
|
223
445
|
}
|
|
224
446
|
} catch {
|
|
225
447
|
}
|
|
@@ -911,12 +1133,46 @@ async function ensureSchema() {
|
|
|
911
1133
|
} catch {
|
|
912
1134
|
}
|
|
913
1135
|
}
|
|
1136
|
+
try {
|
|
1137
|
+
await client.execute({
|
|
1138
|
+
sql: `ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0`,
|
|
1139
|
+
args: []
|
|
1140
|
+
});
|
|
1141
|
+
} catch {
|
|
1142
|
+
}
|
|
1143
|
+
try {
|
|
1144
|
+
await client.execute(
|
|
1145
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_draft ON memories(draft) WHERE draft = 1`
|
|
1146
|
+
);
|
|
1147
|
+
} catch {
|
|
1148
|
+
}
|
|
1149
|
+
try {
|
|
1150
|
+
await client.execute({
|
|
1151
|
+
sql: `ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'`,
|
|
1152
|
+
args: []
|
|
1153
|
+
});
|
|
1154
|
+
} catch {
|
|
1155
|
+
}
|
|
1156
|
+
try {
|
|
1157
|
+
await client.execute(
|
|
1158
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(memory_type)`
|
|
1159
|
+
);
|
|
1160
|
+
} catch {
|
|
1161
|
+
}
|
|
1162
|
+
try {
|
|
1163
|
+
await client.execute({
|
|
1164
|
+
sql: `ALTER TABLE memories ADD COLUMN trajectory TEXT`,
|
|
1165
|
+
args: []
|
|
1166
|
+
});
|
|
1167
|
+
} catch {
|
|
1168
|
+
}
|
|
914
1169
|
}
|
|
915
1170
|
var _client, _resilientClient, initTurso;
|
|
916
1171
|
var init_database = __esm({
|
|
917
1172
|
"src/lib/database.ts"() {
|
|
918
1173
|
"use strict";
|
|
919
1174
|
init_db_retry();
|
|
1175
|
+
init_employees();
|
|
920
1176
|
_client = null;
|
|
921
1177
|
_resilientClient = null;
|
|
922
1178
|
initTurso = initDatabase;
|
|
@@ -924,15 +1180,15 @@ var init_database = __esm({
|
|
|
924
1180
|
});
|
|
925
1181
|
|
|
926
1182
|
// src/lib/keychain.ts
|
|
927
|
-
import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
928
|
-
import { existsSync } from "fs";
|
|
929
|
-
import
|
|
930
|
-
import
|
|
1183
|
+
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
1184
|
+
import { existsSync as existsSync3 } from "fs";
|
|
1185
|
+
import path3 from "path";
|
|
1186
|
+
import os3 from "os";
|
|
931
1187
|
function getKeyDir() {
|
|
932
|
-
return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ??
|
|
1188
|
+
return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path3.join(os3.homedir(), ".exe-os");
|
|
933
1189
|
}
|
|
934
1190
|
function getKeyPath() {
|
|
935
|
-
return
|
|
1191
|
+
return path3.join(getKeyDir(), "master.key");
|
|
936
1192
|
}
|
|
937
1193
|
async function tryKeytar() {
|
|
938
1194
|
try {
|
|
@@ -953,11 +1209,11 @@ async function getMasterKey() {
|
|
|
953
1209
|
}
|
|
954
1210
|
}
|
|
955
1211
|
const keyPath = getKeyPath();
|
|
956
|
-
if (!
|
|
1212
|
+
if (!existsSync3(keyPath)) {
|
|
957
1213
|
return null;
|
|
958
1214
|
}
|
|
959
1215
|
try {
|
|
960
|
-
const content = await
|
|
1216
|
+
const content = await readFile3(keyPath, "utf-8");
|
|
961
1217
|
return Buffer.from(content.trim(), "base64");
|
|
962
1218
|
} catch {
|
|
963
1219
|
return null;
|
|
@@ -972,195 +1228,6 @@ var init_keychain = __esm({
|
|
|
972
1228
|
}
|
|
973
1229
|
});
|
|
974
1230
|
|
|
975
|
-
// src/lib/config.ts
|
|
976
|
-
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, chmod as chmod2 } from "fs/promises";
|
|
977
|
-
import { readFileSync, existsSync as existsSync2, renameSync } from "fs";
|
|
978
|
-
import path2 from "path";
|
|
979
|
-
import os2 from "os";
|
|
980
|
-
function resolveDataDir() {
|
|
981
|
-
if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
|
|
982
|
-
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
983
|
-
const newDir = path2.join(os2.homedir(), ".exe-os");
|
|
984
|
-
const legacyDir = path2.join(os2.homedir(), ".exe-mem");
|
|
985
|
-
if (!existsSync2(newDir) && existsSync2(legacyDir)) {
|
|
986
|
-
try {
|
|
987
|
-
renameSync(legacyDir, newDir);
|
|
988
|
-
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
989
|
-
`);
|
|
990
|
-
} catch {
|
|
991
|
-
return legacyDir;
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
return newDir;
|
|
995
|
-
}
|
|
996
|
-
function migrateLegacyConfig(raw) {
|
|
997
|
-
if ("r2" in raw) {
|
|
998
|
-
process.stderr.write(
|
|
999
|
-
"[exe-os] Warning: config.json contains deprecated 'r2' field from v1.0. R2 sync has been replaced in v1.1. The 'r2' field will be ignored.\n"
|
|
1000
|
-
);
|
|
1001
|
-
delete raw.r2;
|
|
1002
|
-
}
|
|
1003
|
-
if ("syncIntervalMs" in raw) {
|
|
1004
|
-
delete raw.syncIntervalMs;
|
|
1005
|
-
}
|
|
1006
|
-
return raw;
|
|
1007
|
-
}
|
|
1008
|
-
function migrateConfig(raw) {
|
|
1009
|
-
const fromVersion = typeof raw.config_version === "number" ? raw.config_version : 0;
|
|
1010
|
-
let currentVersion = fromVersion;
|
|
1011
|
-
let migrated = false;
|
|
1012
|
-
if (currentVersion > CURRENT_CONFIG_VERSION) {
|
|
1013
|
-
return { config: raw, migrated: false, fromVersion };
|
|
1014
|
-
}
|
|
1015
|
-
for (const migration of CONFIG_MIGRATIONS) {
|
|
1016
|
-
if (currentVersion === migration.from && migration.to <= CURRENT_CONFIG_VERSION) {
|
|
1017
|
-
raw = migration.migrate(raw);
|
|
1018
|
-
currentVersion = migration.to;
|
|
1019
|
-
migrated = true;
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
return { config: raw, migrated, fromVersion };
|
|
1023
|
-
}
|
|
1024
|
-
function normalizeScalingRoadmap(raw) {
|
|
1025
|
-
const defaultAuto = DEFAULT_CONFIG.scalingRoadmap.rerankerAutoTrigger;
|
|
1026
|
-
const userRoadmap = raw.scalingRoadmap ?? {};
|
|
1027
|
-
const userAuto = userRoadmap.rerankerAutoTrigger ?? {};
|
|
1028
|
-
if (userAuto.enabled === void 0 && raw.rerankerEnabled !== void 0) {
|
|
1029
|
-
userAuto.enabled = raw.rerankerEnabled;
|
|
1030
|
-
}
|
|
1031
|
-
raw.scalingRoadmap = {
|
|
1032
|
-
...userRoadmap,
|
|
1033
|
-
rerankerAutoTrigger: { ...defaultAuto, ...userAuto }
|
|
1034
|
-
};
|
|
1035
|
-
}
|
|
1036
|
-
function normalizeSessionLifecycle(raw) {
|
|
1037
|
-
const defaultSL = DEFAULT_CONFIG.sessionLifecycle;
|
|
1038
|
-
const userSL = raw.sessionLifecycle ?? {};
|
|
1039
|
-
raw.sessionLifecycle = { ...defaultSL, ...userSL };
|
|
1040
|
-
}
|
|
1041
|
-
function normalizeAutoUpdate(raw) {
|
|
1042
|
-
const defaultAU = DEFAULT_CONFIG.autoUpdate;
|
|
1043
|
-
const userAU = raw.autoUpdate ?? {};
|
|
1044
|
-
raw.autoUpdate = { ...defaultAU, ...userAU };
|
|
1045
|
-
}
|
|
1046
|
-
async function loadConfig() {
|
|
1047
|
-
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
1048
|
-
await mkdir2(dir, { recursive: true });
|
|
1049
|
-
const configPath = path2.join(dir, "config.json");
|
|
1050
|
-
if (!existsSync2(configPath)) {
|
|
1051
|
-
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
1052
|
-
}
|
|
1053
|
-
const raw = await readFile2(configPath, "utf-8");
|
|
1054
|
-
try {
|
|
1055
|
-
let parsed = JSON.parse(raw);
|
|
1056
|
-
parsed = migrateLegacyConfig(parsed);
|
|
1057
|
-
const { config: migratedCfg, migrated, fromVersion } = migrateConfig(parsed);
|
|
1058
|
-
if (migrated) {
|
|
1059
|
-
process.stderr.write(`[exe-os] Config migrated from v${fromVersion} to v${migratedCfg.config_version}
|
|
1060
|
-
`);
|
|
1061
|
-
try {
|
|
1062
|
-
await writeFile2(configPath, JSON.stringify(migratedCfg, null, 2) + "\n");
|
|
1063
|
-
} catch {
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
normalizeScalingRoadmap(migratedCfg);
|
|
1067
|
-
normalizeSessionLifecycle(migratedCfg);
|
|
1068
|
-
normalizeAutoUpdate(migratedCfg);
|
|
1069
|
-
const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
1070
|
-
if (config.dbPath.startsWith("~")) {
|
|
1071
|
-
config.dbPath = config.dbPath.replace(/^~/, os2.homedir());
|
|
1072
|
-
}
|
|
1073
|
-
return config;
|
|
1074
|
-
} catch {
|
|
1075
|
-
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG, CONFIG_MIGRATIONS;
|
|
1079
|
-
var init_config = __esm({
|
|
1080
|
-
"src/lib/config.ts"() {
|
|
1081
|
-
"use strict";
|
|
1082
|
-
EXE_AI_DIR = resolveDataDir();
|
|
1083
|
-
DB_PATH = path2.join(EXE_AI_DIR, "memories.db");
|
|
1084
|
-
MODELS_DIR = path2.join(EXE_AI_DIR, "models");
|
|
1085
|
-
CONFIG_PATH = path2.join(EXE_AI_DIR, "config.json");
|
|
1086
|
-
LEGACY_LANCE_PATH = path2.join(EXE_AI_DIR, "local.lance");
|
|
1087
|
-
CURRENT_CONFIG_VERSION = 1;
|
|
1088
|
-
DEFAULT_CONFIG = {
|
|
1089
|
-
config_version: CURRENT_CONFIG_VERSION,
|
|
1090
|
-
dbPath: DB_PATH,
|
|
1091
|
-
modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
|
|
1092
|
-
embeddingDim: 1024,
|
|
1093
|
-
batchSize: 20,
|
|
1094
|
-
flushIntervalMs: 1e4,
|
|
1095
|
-
autoIngestion: true,
|
|
1096
|
-
autoRetrieval: true,
|
|
1097
|
-
searchMode: "hybrid",
|
|
1098
|
-
hookSearchMode: "hybrid",
|
|
1099
|
-
fileGrepEnabled: true,
|
|
1100
|
-
splashEffect: true,
|
|
1101
|
-
consolidationEnabled: true,
|
|
1102
|
-
consolidationIntervalMs: 6 * 60 * 60 * 1e3,
|
|
1103
|
-
consolidationModel: "claude-haiku-4-5-20251001",
|
|
1104
|
-
consolidationMaxCallsPerRun: 20,
|
|
1105
|
-
selfQueryRouter: true,
|
|
1106
|
-
selfQueryModel: "claude-haiku-4-5-20251001",
|
|
1107
|
-
rerankerEnabled: true,
|
|
1108
|
-
scalingRoadmap: {
|
|
1109
|
-
rerankerAutoTrigger: {
|
|
1110
|
-
enabled: true,
|
|
1111
|
-
broadQueryMinCardinality: 5e4,
|
|
1112
|
-
fetchTopK: 150,
|
|
1113
|
-
returnTopK: 5
|
|
1114
|
-
}
|
|
1115
|
-
},
|
|
1116
|
-
graphRagEnabled: true,
|
|
1117
|
-
wikiEnabled: false,
|
|
1118
|
-
wikiUrl: "",
|
|
1119
|
-
wikiApiKey: "",
|
|
1120
|
-
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
1121
|
-
wikiWorkspaceMapping: {
|
|
1122
|
-
exe: "Executive",
|
|
1123
|
-
yoshi: "Engineering",
|
|
1124
|
-
mari: "Marketing",
|
|
1125
|
-
tom: "Engineering",
|
|
1126
|
-
sasha: "Production"
|
|
1127
|
-
},
|
|
1128
|
-
wikiAutoUpdate: true,
|
|
1129
|
-
wikiAutoUpdateThreshold: 0.5,
|
|
1130
|
-
wikiAutoUpdateCreateNew: true,
|
|
1131
|
-
skillLearning: true,
|
|
1132
|
-
skillThreshold: 3,
|
|
1133
|
-
skillModel: "claude-haiku-4-5-20251001",
|
|
1134
|
-
exeHeartbeat: {
|
|
1135
|
-
enabled: true,
|
|
1136
|
-
intervalSeconds: 60,
|
|
1137
|
-
staleInProgressThresholdHours: 2
|
|
1138
|
-
},
|
|
1139
|
-
sessionLifecycle: {
|
|
1140
|
-
idleKillEnabled: true,
|
|
1141
|
-
idleKillTicksRequired: 3,
|
|
1142
|
-
idleKillIntercomAckWindowMs: 1e4,
|
|
1143
|
-
maxAutoInstances: 10
|
|
1144
|
-
},
|
|
1145
|
-
autoUpdate: {
|
|
1146
|
-
checkOnBoot: true,
|
|
1147
|
-
autoInstall: false,
|
|
1148
|
-
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
1149
|
-
}
|
|
1150
|
-
};
|
|
1151
|
-
CONFIG_MIGRATIONS = [
|
|
1152
|
-
{
|
|
1153
|
-
from: 0,
|
|
1154
|
-
to: 1,
|
|
1155
|
-
migrate: (cfg) => {
|
|
1156
|
-
cfg.config_version = 1;
|
|
1157
|
-
return cfg;
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
];
|
|
1161
|
-
}
|
|
1162
|
-
});
|
|
1163
|
-
|
|
1164
1231
|
// src/lib/state-bus.ts
|
|
1165
1232
|
var StateBus, orgBus;
|
|
1166
1233
|
var init_state_bus = __esm({
|
|
@@ -1229,12 +1296,12 @@ __export(shard_manager_exports, {
|
|
|
1229
1296
|
listShards: () => listShards,
|
|
1230
1297
|
shardExists: () => shardExists
|
|
1231
1298
|
});
|
|
1232
|
-
import
|
|
1233
|
-
import { existsSync as
|
|
1299
|
+
import path4 from "path";
|
|
1300
|
+
import { existsSync as existsSync4, mkdirSync, readdirSync } from "fs";
|
|
1234
1301
|
import { createClient as createClient2 } from "@libsql/client";
|
|
1235
1302
|
function initShardManager(encryptionKey) {
|
|
1236
1303
|
_encryptionKey = encryptionKey;
|
|
1237
|
-
if (!
|
|
1304
|
+
if (!existsSync4(SHARDS_DIR)) {
|
|
1238
1305
|
mkdirSync(SHARDS_DIR, { recursive: true });
|
|
1239
1306
|
}
|
|
1240
1307
|
_shardingEnabled = true;
|
|
@@ -1255,7 +1322,7 @@ function getShardClient(projectName) {
|
|
|
1255
1322
|
}
|
|
1256
1323
|
const cached = _shards.get(safeName);
|
|
1257
1324
|
if (cached) return cached;
|
|
1258
|
-
const dbPath =
|
|
1325
|
+
const dbPath = path4.join(SHARDS_DIR, `${safeName}.db`);
|
|
1259
1326
|
const client = createClient2({
|
|
1260
1327
|
url: `file:${dbPath}`,
|
|
1261
1328
|
encryptionKey: _encryptionKey
|
|
@@ -1265,10 +1332,10 @@ function getShardClient(projectName) {
|
|
|
1265
1332
|
}
|
|
1266
1333
|
function shardExists(projectName) {
|
|
1267
1334
|
const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
1268
|
-
return
|
|
1335
|
+
return existsSync4(path4.join(SHARDS_DIR, `${safeName}.db`));
|
|
1269
1336
|
}
|
|
1270
1337
|
function listShards() {
|
|
1271
|
-
if (!
|
|
1338
|
+
if (!existsSync4(SHARDS_DIR)) return [];
|
|
1272
1339
|
return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
1273
1340
|
}
|
|
1274
1341
|
async function ensureShardSchema(client) {
|
|
@@ -1338,7 +1405,11 @@ async function ensureShardSchema(client) {
|
|
|
1338
1405
|
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
1339
1406
|
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
|
|
1340
1407
|
"ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
|
|
1341
|
-
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
|
|
1408
|
+
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT",
|
|
1409
|
+
// MS-11: draft staging, MS-6a: memory_type, MS-7: trajectory
|
|
1410
|
+
"ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0",
|
|
1411
|
+
"ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'",
|
|
1412
|
+
"ALTER TABLE memories ADD COLUMN trajectory TEXT"
|
|
1342
1413
|
]) {
|
|
1343
1414
|
try {
|
|
1344
1415
|
await client.execute(col);
|
|
@@ -1450,7 +1521,7 @@ var init_shard_manager = __esm({
|
|
|
1450
1521
|
"src/lib/shard-manager.ts"() {
|
|
1451
1522
|
"use strict";
|
|
1452
1523
|
init_config();
|
|
1453
|
-
SHARDS_DIR =
|
|
1524
|
+
SHARDS_DIR = path4.join(EXE_AI_DIR, "shards");
|
|
1454
1525
|
_shards = /* @__PURE__ */ new Map();
|
|
1455
1526
|
_encryptionKey = null;
|
|
1456
1527
|
_shardingEnabled = false;
|
|
@@ -1468,26 +1539,26 @@ var init_platform_procedures = __esm({
|
|
|
1468
1539
|
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1469
1540
|
domain: "architecture",
|
|
1470
1541
|
priority: "p0",
|
|
1471
|
-
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO
|
|
1542
|
+
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."
|
|
1472
1543
|
},
|
|
1473
1544
|
{
|
|
1474
1545
|
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1475
1546
|
domain: "architecture",
|
|
1476
1547
|
priority: "p0",
|
|
1477
|
-
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC
|
|
1548
|
+
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."
|
|
1478
1549
|
},
|
|
1479
1550
|
{
|
|
1480
|
-
title: "Sessions explained \u2014
|
|
1551
|
+
title: "Sessions explained \u2014 coordinator session names and projects",
|
|
1481
1552
|
domain: "architecture",
|
|
1482
1553
|
priority: "p0",
|
|
1483
|
-
content: "Each
|
|
1554
|
+
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."
|
|
1484
1555
|
},
|
|
1485
1556
|
// --- Hierarchy and dispatch ---
|
|
1486
1557
|
{
|
|
1487
1558
|
title: "Chain of command \u2014 who talks to whom",
|
|
1488
1559
|
domain: "workflow",
|
|
1489
1560
|
priority: "p0",
|
|
1490
|
-
content: "Founder
|
|
1561
|
+
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."
|
|
1491
1562
|
},
|
|
1492
1563
|
{
|
|
1493
1564
|
title: "Single dispatch path \u2014 create_task only",
|
|
@@ -1497,30 +1568,30 @@ var init_platform_procedures = __esm({
|
|
|
1497
1568
|
},
|
|
1498
1569
|
// --- Session isolation ---
|
|
1499
1570
|
{
|
|
1500
|
-
title: "Session scoping \u2014 stay in your
|
|
1571
|
+
title: "Session scoping \u2014 stay in your coordinator boundary",
|
|
1501
1572
|
domain: "security",
|
|
1502
1573
|
priority: "p0",
|
|
1503
|
-
content: "Session scoping is mandatory. Managers dispatch to workers within their own
|
|
1574
|
+
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."
|
|
1504
1575
|
},
|
|
1505
1576
|
{
|
|
1506
1577
|
title: "Session isolation \u2014 never touch another session's work",
|
|
1507
1578
|
domain: "workflow",
|
|
1508
1579
|
priority: "p0",
|
|
1509
|
-
content:
|
|
1580
|
+
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."
|
|
1510
1581
|
},
|
|
1511
1582
|
// --- Engineering: session scoping in code ---
|
|
1512
1583
|
{
|
|
1513
1584
|
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1514
1585
|
domain: "architecture",
|
|
1515
1586
|
priority: "p0",
|
|
1516
|
-
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
|
|
1587
|
+
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."
|
|
1517
1588
|
},
|
|
1518
1589
|
// --- Hard constraints ---
|
|
1519
1590
|
{
|
|
1520
1591
|
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1521
1592
|
domain: "security",
|
|
1522
1593
|
priority: "p0",
|
|
1523
|
-
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
|
|
1594
|
+
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."
|
|
1524
1595
|
},
|
|
1525
1596
|
// --- Operations ---
|
|
1526
1597
|
{
|
|
@@ -1817,6 +1888,8 @@ async function lightweightSearch(queryText, agentId, options) {
|
|
|
1817
1888
|
async function ftsQuery(client, matchExpr, agentId, options, limit) {
|
|
1818
1889
|
const statusFilter = options?.includeArchived ? "" : `
|
|
1819
1890
|
AND COALESCE(m.status, 'active') = 'active'`;
|
|
1891
|
+
const draftFilter = options?.includeDrafts ? "" : `
|
|
1892
|
+
AND (m.draft = 0 OR m.draft IS NULL)`;
|
|
1820
1893
|
let sql = `SELECT m.id, m.agent_id, m.agent_role, m.session_id, m.timestamp,
|
|
1821
1894
|
m.tool_name, m.project_name,
|
|
1822
1895
|
m.has_error, m.raw_text, m.vector, m.task_id,
|
|
@@ -1827,7 +1900,7 @@ async function ftsQuery(client, matchExpr, agentId, options, limit) {
|
|
|
1827
1900
|
FROM memories m
|
|
1828
1901
|
JOIN memories_fts fts ON m.rowid = fts.rowid
|
|
1829
1902
|
WHERE memories_fts MATCH ?
|
|
1830
|
-
AND m.agent_id = ?${statusFilter}
|
|
1903
|
+
AND m.agent_id = ?${statusFilter}${draftFilter}
|
|
1831
1904
|
AND COALESCE(m.confidence, 0.7) >= 0.3`;
|
|
1832
1905
|
const args = [matchExpr, agentId];
|
|
1833
1906
|
const scope = buildWikiScopeFilter(options, "m.");
|
|
@@ -1849,6 +1922,10 @@ async function ftsQuery(client, matchExpr, agentId, options, limit) {
|
|
|
1849
1922
|
sql += ` AND m.timestamp >= ?`;
|
|
1850
1923
|
args.push(options.since);
|
|
1851
1924
|
}
|
|
1925
|
+
if (options?.memoryType) {
|
|
1926
|
+
sql += ` AND m.memory_type = ?`;
|
|
1927
|
+
args.push(options.memoryType);
|
|
1928
|
+
}
|
|
1852
1929
|
sql += ` ORDER BY rank LIMIT ?`;
|
|
1853
1930
|
args.push(limit);
|
|
1854
1931
|
const result = await client.execute({ sql, args });
|
|
@@ -1881,6 +1958,8 @@ async function recentRecords(agentId, options, limit) {
|
|
|
1881
1958
|
const client = getClient();
|
|
1882
1959
|
const statusFilter = options?.includeArchived ? "" : `
|
|
1883
1960
|
AND COALESCE(status, 'active') = 'active'`;
|
|
1961
|
+
const draftFilter = options?.includeDrafts ? "" : `
|
|
1962
|
+
AND (draft = 0 OR draft IS NULL)`;
|
|
1884
1963
|
let sql = `SELECT id, agent_id, agent_role, session_id, timestamp,
|
|
1885
1964
|
tool_name, project_name,
|
|
1886
1965
|
has_error, raw_text, vector, task_id,
|
|
@@ -1889,7 +1968,7 @@ async function recentRecords(agentId, options, limit) {
|
|
|
1889
1968
|
char_offset, page_number,
|
|
1890
1969
|
source_path, source_type
|
|
1891
1970
|
FROM memories
|
|
1892
|
-
WHERE agent_id = ?${statusFilter}
|
|
1971
|
+
WHERE agent_id = ?${statusFilter}${draftFilter}
|
|
1893
1972
|
AND COALESCE(confidence, 0.7) >= 0.3`;
|
|
1894
1973
|
const args = [agentId];
|
|
1895
1974
|
const scope = buildWikiScopeFilter(options, "");
|
|
@@ -1911,6 +1990,10 @@ async function recentRecords(agentId, options, limit) {
|
|
|
1911
1990
|
sql += ` AND timestamp >= ?`;
|
|
1912
1991
|
args.push(options.since);
|
|
1913
1992
|
}
|
|
1993
|
+
if (options?.memoryType) {
|
|
1994
|
+
sql += ` AND memory_type = ?`;
|
|
1995
|
+
args.push(options.memoryType);
|
|
1996
|
+
}
|
|
1914
1997
|
sql += ` ORDER BY timestamp DESC LIMIT ?`;
|
|
1915
1998
|
args.push(limit);
|
|
1916
1999
|
const result = await client.execute({ sql, args });
|