@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
|
@@ -165,13 +165,7 @@ var init_config = __esm({
|
|
|
165
165
|
wikiUrl: "",
|
|
166
166
|
wikiApiKey: "",
|
|
167
167
|
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
168
|
-
wikiWorkspaceMapping: {
|
|
169
|
-
exe: "Executive",
|
|
170
|
-
yoshi: "Engineering",
|
|
171
|
-
mari: "Marketing",
|
|
172
|
-
tom: "Engineering",
|
|
173
|
-
sasha: "Production"
|
|
174
|
-
},
|
|
168
|
+
wikiWorkspaceMapping: {},
|
|
175
169
|
wikiAutoUpdate: true,
|
|
176
170
|
wikiAutoUpdateThreshold: 0.5,
|
|
177
171
|
wikiAutoUpdateCreateNew: true,
|
|
@@ -243,14 +237,54 @@ var init_session_key = __esm({
|
|
|
243
237
|
}
|
|
244
238
|
});
|
|
245
239
|
|
|
246
|
-
// src/lib/
|
|
247
|
-
import
|
|
240
|
+
// src/lib/employees.ts
|
|
241
|
+
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
242
|
+
import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
243
|
+
import { execSync as execSync2 } from "child_process";
|
|
244
|
+
import path2 from "path";
|
|
248
245
|
import os2 from "os";
|
|
246
|
+
function normalizeRole(role) {
|
|
247
|
+
return (role ?? "").trim().toLowerCase();
|
|
248
|
+
}
|
|
249
|
+
function isCoordinatorRole(role) {
|
|
250
|
+
return normalizeRole(role) === normalizeRole(COORDINATOR_ROLE);
|
|
251
|
+
}
|
|
252
|
+
function getCoordinatorEmployee(employees) {
|
|
253
|
+
return employees.find((e) => isCoordinatorRole(e.role));
|
|
254
|
+
}
|
|
255
|
+
function getCoordinatorName(employees = loadEmployeesSync()) {
|
|
256
|
+
return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
|
|
257
|
+
}
|
|
258
|
+
function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
|
|
259
|
+
if (!existsSync2(employeesPath)) return [];
|
|
260
|
+
try {
|
|
261
|
+
return JSON.parse(readFileSync2(employeesPath, "utf-8"));
|
|
262
|
+
} catch {
|
|
263
|
+
return [];
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function getEmployee(employees, name) {
|
|
267
|
+
return employees.find((e) => e.name.toLowerCase() === name.toLowerCase());
|
|
268
|
+
}
|
|
269
|
+
var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE;
|
|
270
|
+
var init_employees = __esm({
|
|
271
|
+
"src/lib/employees.ts"() {
|
|
272
|
+
"use strict";
|
|
273
|
+
init_config();
|
|
274
|
+
EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
275
|
+
DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
|
|
276
|
+
COORDINATOR_ROLE = "COO";
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
// src/lib/session-registry.ts
|
|
281
|
+
import path4 from "path";
|
|
282
|
+
import os3 from "os";
|
|
249
283
|
var REGISTRY_PATH;
|
|
250
284
|
var init_session_registry = __esm({
|
|
251
285
|
"src/lib/session-registry.ts"() {
|
|
252
286
|
"use strict";
|
|
253
|
-
REGISTRY_PATH =
|
|
287
|
+
REGISTRY_PATH = path4.join(os3.homedir(), ".exe-os", "session-registry.json");
|
|
254
288
|
}
|
|
255
289
|
});
|
|
256
290
|
|
|
@@ -362,7 +396,7 @@ var init_transport = __esm({
|
|
|
362
396
|
});
|
|
363
397
|
|
|
364
398
|
// src/lib/cc-agent-support.ts
|
|
365
|
-
import { execSync as
|
|
399
|
+
import { execSync as execSync4 } from "child_process";
|
|
366
400
|
var init_cc_agent_support = __esm({
|
|
367
401
|
"src/lib/cc-agent-support.ts"() {
|
|
368
402
|
"use strict";
|
|
@@ -391,16 +425,16 @@ var init_provider_table = __esm({
|
|
|
391
425
|
});
|
|
392
426
|
|
|
393
427
|
// src/lib/intercom-queue.ts
|
|
394
|
-
import { readFileSync as
|
|
395
|
-
import
|
|
396
|
-
import
|
|
428
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, renameSync as renameSync3, existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
|
|
429
|
+
import path5 from "path";
|
|
430
|
+
import os4 from "os";
|
|
397
431
|
var QUEUE_PATH, TTL_MS, INTERCOM_LOG;
|
|
398
432
|
var init_intercom_queue = __esm({
|
|
399
433
|
"src/lib/intercom-queue.ts"() {
|
|
400
434
|
"use strict";
|
|
401
|
-
QUEUE_PATH =
|
|
435
|
+
QUEUE_PATH = path5.join(os4.homedir(), ".exe-os", "intercom-queue.json");
|
|
402
436
|
TTL_MS = 60 * 60 * 1e3;
|
|
403
|
-
INTERCOM_LOG =
|
|
437
|
+
INTERCOM_LOG = path5.join(os4.homedir(), ".exe-os", "intercom.log");
|
|
404
438
|
}
|
|
405
439
|
});
|
|
406
440
|
|
|
@@ -443,7 +477,7 @@ function wrapWithRetry(client) {
|
|
|
443
477
|
return (sql) => retryOnBusy(() => target.execute(sql), "execute");
|
|
444
478
|
}
|
|
445
479
|
if (prop === "batch") {
|
|
446
|
-
return (stmts) => retryOnBusy(() => target.batch(stmts), "batch");
|
|
480
|
+
return (stmts, mode) => retryOnBusy(() => target.batch(stmts, mode), "batch");
|
|
447
481
|
}
|
|
448
482
|
return Reflect.get(target, prop, receiver);
|
|
449
483
|
}
|
|
@@ -606,22 +640,24 @@ async function ensureSchema() {
|
|
|
606
640
|
ON behaviors(agent_id, active);
|
|
607
641
|
`);
|
|
608
642
|
try {
|
|
643
|
+
const coordinatorName = getCoordinatorName();
|
|
609
644
|
const existing = await client.execute({
|
|
610
|
-
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id =
|
|
611
|
-
args: []
|
|
645
|
+
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = ?",
|
|
646
|
+
args: [coordinatorName]
|
|
612
647
|
});
|
|
613
648
|
if (Number(existing.rows[0]?.cnt) === 0) {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
649
|
+
const seededAt = "2026-03-25T00:00:00Z";
|
|
650
|
+
for (const [domain, content] of [
|
|
651
|
+
["workflow", `Don't ask "keep going?" \u2014 just keep executing phases/plans autonomously`],
|
|
652
|
+
["tool-use", "Always use create_task MCP tool, never write .md files directly for task creation"],
|
|
653
|
+
["workflow", "Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission"]
|
|
654
|
+
]) {
|
|
655
|
+
await client.execute({
|
|
656
|
+
sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
|
|
657
|
+
VALUES (hex(randomblob(16)), ?, NULL, ?, ?, 1, ?, ?)`,
|
|
658
|
+
args: [coordinatorName, domain, content, seededAt, seededAt]
|
|
659
|
+
});
|
|
660
|
+
}
|
|
625
661
|
}
|
|
626
662
|
} catch {
|
|
627
663
|
}
|
|
@@ -1313,6 +1349,39 @@ async function ensureSchema() {
|
|
|
1313
1349
|
} catch {
|
|
1314
1350
|
}
|
|
1315
1351
|
}
|
|
1352
|
+
try {
|
|
1353
|
+
await client.execute({
|
|
1354
|
+
sql: `ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0`,
|
|
1355
|
+
args: []
|
|
1356
|
+
});
|
|
1357
|
+
} catch {
|
|
1358
|
+
}
|
|
1359
|
+
try {
|
|
1360
|
+
await client.execute(
|
|
1361
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_draft ON memories(draft) WHERE draft = 1`
|
|
1362
|
+
);
|
|
1363
|
+
} catch {
|
|
1364
|
+
}
|
|
1365
|
+
try {
|
|
1366
|
+
await client.execute({
|
|
1367
|
+
sql: `ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'`,
|
|
1368
|
+
args: []
|
|
1369
|
+
});
|
|
1370
|
+
} catch {
|
|
1371
|
+
}
|
|
1372
|
+
try {
|
|
1373
|
+
await client.execute(
|
|
1374
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(memory_type)`
|
|
1375
|
+
);
|
|
1376
|
+
} catch {
|
|
1377
|
+
}
|
|
1378
|
+
try {
|
|
1379
|
+
await client.execute({
|
|
1380
|
+
sql: `ALTER TABLE memories ADD COLUMN trajectory TEXT`,
|
|
1381
|
+
args: []
|
|
1382
|
+
});
|
|
1383
|
+
} catch {
|
|
1384
|
+
}
|
|
1316
1385
|
}
|
|
1317
1386
|
async function disposeDatabase() {
|
|
1318
1387
|
if (_client) {
|
|
@@ -1326,6 +1395,7 @@ var init_database = __esm({
|
|
|
1326
1395
|
"src/lib/database.ts"() {
|
|
1327
1396
|
"use strict";
|
|
1328
1397
|
init_db_retry();
|
|
1398
|
+
init_employees();
|
|
1329
1399
|
_client = null;
|
|
1330
1400
|
_resilientClient = null;
|
|
1331
1401
|
initTurso = initDatabase;
|
|
@@ -1333,21 +1403,6 @@ var init_database = __esm({
|
|
|
1333
1403
|
}
|
|
1334
1404
|
});
|
|
1335
1405
|
|
|
1336
|
-
// src/lib/employees.ts
|
|
1337
|
-
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
1338
|
-
import { existsSync as existsSync3, symlinkSync, readlinkSync, readFileSync as readFileSync4, renameSync as renameSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
1339
|
-
import { execSync as execSync4 } from "child_process";
|
|
1340
|
-
import path5 from "path";
|
|
1341
|
-
import os4 from "os";
|
|
1342
|
-
var EMPLOYEES_PATH;
|
|
1343
|
-
var init_employees = __esm({
|
|
1344
|
-
"src/lib/employees.ts"() {
|
|
1345
|
-
"use strict";
|
|
1346
|
-
init_config();
|
|
1347
|
-
EMPLOYEES_PATH = path5.join(EXE_AI_DIR, "exe-employees.json");
|
|
1348
|
-
}
|
|
1349
|
-
});
|
|
1350
|
-
|
|
1351
1406
|
// src/lib/license.ts
|
|
1352
1407
|
import { readFileSync as readFileSync5, writeFileSync as writeFileSync4, existsSync as existsSync4, mkdirSync as mkdirSync3 } from "fs";
|
|
1353
1408
|
import { randomUUID } from "crypto";
|
|
@@ -1388,8 +1443,10 @@ function getMySession() {
|
|
|
1388
1443
|
return getTransport().getMySession();
|
|
1389
1444
|
}
|
|
1390
1445
|
function extractRootExe(name) {
|
|
1391
|
-
|
|
1392
|
-
|
|
1446
|
+
if (!name) return null;
|
|
1447
|
+
if (!name.includes("-")) return name;
|
|
1448
|
+
const parts = name.split("-").filter(Boolean);
|
|
1449
|
+
return parts.length > 0 ? parts[parts.length - 1] : null;
|
|
1393
1450
|
}
|
|
1394
1451
|
function getParentExe(sessionKey) {
|
|
1395
1452
|
try {
|
|
@@ -1424,6 +1481,7 @@ var init_tmux_routing = __esm({
|
|
|
1424
1481
|
init_provider_table();
|
|
1425
1482
|
init_intercom_queue();
|
|
1426
1483
|
init_plan_limits();
|
|
1484
|
+
init_employees();
|
|
1427
1485
|
SPAWN_LOCK_DIR = path8.join(os5.homedir(), ".exe-os", "spawn-locks");
|
|
1428
1486
|
SESSION_CACHE = path8.join(os5.homedir(), ".exe-os", "session-cache");
|
|
1429
1487
|
INTERCOM_LOG2 = path8.join(os5.homedir(), ".exe-os", "intercom.log");
|
|
@@ -1691,7 +1749,11 @@ async function ensureShardSchema(client) {
|
|
|
1691
1749
|
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
1692
1750
|
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
|
|
1693
1751
|
"ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
|
|
1694
|
-
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
|
|
1752
|
+
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT",
|
|
1753
|
+
// MS-11: draft staging, MS-6a: memory_type, MS-7: trajectory
|
|
1754
|
+
"ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0",
|
|
1755
|
+
"ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'",
|
|
1756
|
+
"ALTER TABLE memories ADD COLUMN trajectory TEXT"
|
|
1695
1757
|
]) {
|
|
1696
1758
|
try {
|
|
1697
1759
|
await client.execute(col);
|
|
@@ -1821,26 +1883,26 @@ var init_platform_procedures = __esm({
|
|
|
1821
1883
|
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1822
1884
|
domain: "architecture",
|
|
1823
1885
|
priority: "p0",
|
|
1824
|
-
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO
|
|
1886
|
+
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."
|
|
1825
1887
|
},
|
|
1826
1888
|
{
|
|
1827
1889
|
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1828
1890
|
domain: "architecture",
|
|
1829
1891
|
priority: "p0",
|
|
1830
|
-
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC
|
|
1892
|
+
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."
|
|
1831
1893
|
},
|
|
1832
1894
|
{
|
|
1833
|
-
title: "Sessions explained \u2014
|
|
1895
|
+
title: "Sessions explained \u2014 coordinator session names and projects",
|
|
1834
1896
|
domain: "architecture",
|
|
1835
1897
|
priority: "p0",
|
|
1836
|
-
content: "Each
|
|
1898
|
+
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."
|
|
1837
1899
|
},
|
|
1838
1900
|
// --- Hierarchy and dispatch ---
|
|
1839
1901
|
{
|
|
1840
1902
|
title: "Chain of command \u2014 who talks to whom",
|
|
1841
1903
|
domain: "workflow",
|
|
1842
1904
|
priority: "p0",
|
|
1843
|
-
content: "Founder
|
|
1905
|
+
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."
|
|
1844
1906
|
},
|
|
1845
1907
|
{
|
|
1846
1908
|
title: "Single dispatch path \u2014 create_task only",
|
|
@@ -1850,30 +1912,30 @@ var init_platform_procedures = __esm({
|
|
|
1850
1912
|
},
|
|
1851
1913
|
// --- Session isolation ---
|
|
1852
1914
|
{
|
|
1853
|
-
title: "Session scoping \u2014 stay in your
|
|
1915
|
+
title: "Session scoping \u2014 stay in your coordinator boundary",
|
|
1854
1916
|
domain: "security",
|
|
1855
1917
|
priority: "p0",
|
|
1856
|
-
content: "Session scoping is mandatory. Managers dispatch to workers within their own
|
|
1918
|
+
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."
|
|
1857
1919
|
},
|
|
1858
1920
|
{
|
|
1859
1921
|
title: "Session isolation \u2014 never touch another session's work",
|
|
1860
1922
|
domain: "workflow",
|
|
1861
1923
|
priority: "p0",
|
|
1862
|
-
content:
|
|
1924
|
+
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."
|
|
1863
1925
|
},
|
|
1864
1926
|
// --- Engineering: session scoping in code ---
|
|
1865
1927
|
{
|
|
1866
1928
|
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1867
1929
|
domain: "architecture",
|
|
1868
1930
|
priority: "p0",
|
|
1869
|
-
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
|
|
1931
|
+
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."
|
|
1870
1932
|
},
|
|
1871
1933
|
// --- Hard constraints ---
|
|
1872
1934
|
{
|
|
1873
1935
|
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1874
1936
|
domain: "security",
|
|
1875
1937
|
priority: "p0",
|
|
1876
|
-
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
|
|
1938
|
+
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."
|
|
1877
1939
|
},
|
|
1878
1940
|
// --- Operations ---
|
|
1879
1941
|
{
|
|
@@ -2113,7 +2175,10 @@ async function writeMemory(record) {
|
|
|
2113
2175
|
source_path: record.source_path ?? null,
|
|
2114
2176
|
source_type: record.source_type ?? null,
|
|
2115
2177
|
tier: record.tier ?? classifyTier(record),
|
|
2116
|
-
supersedes_id: record.supersedes_id ?? null
|
|
2178
|
+
supersedes_id: record.supersedes_id ?? null,
|
|
2179
|
+
draft: record.draft ? 1 : 0,
|
|
2180
|
+
memory_type: record.memory_type ?? "raw",
|
|
2181
|
+
trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null
|
|
2117
2182
|
};
|
|
2118
2183
|
_pendingRecords.push(dbRow);
|
|
2119
2184
|
orgBus.emit({
|
|
@@ -2168,6 +2233,9 @@ async function flushBatch() {
|
|
|
2168
2233
|
const sourceType = row.source_type ?? null;
|
|
2169
2234
|
const tier = row.tier ?? 3;
|
|
2170
2235
|
const supersedesId = row.supersedes_id ?? null;
|
|
2236
|
+
const draft = row.draft ? 1 : 0;
|
|
2237
|
+
const memoryType = row.memory_type ?? "raw";
|
|
2238
|
+
const trajectory = row.trajectory ?? null;
|
|
2171
2239
|
return {
|
|
2172
2240
|
sql: hasVector ? `INSERT OR IGNORE INTO memories
|
|
2173
2241
|
(id, agent_id, agent_role, session_id, timestamp,
|
|
@@ -2175,15 +2243,15 @@ async function flushBatch() {
|
|
|
2175
2243
|
has_error, raw_text, vector, version, task_id, importance, status,
|
|
2176
2244
|
confidence, last_accessed,
|
|
2177
2245
|
workspace_id, document_id, user_id, char_offset, page_number,
|
|
2178
|
-
source_path, source_type, tier, supersedes_id)
|
|
2179
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories
|
|
2246
|
+
source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
|
|
2247
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories
|
|
2180
2248
|
(id, agent_id, agent_role, session_id, timestamp,
|
|
2181
2249
|
tool_name, project_name,
|
|
2182
2250
|
has_error, raw_text, vector, version, task_id, importance, status,
|
|
2183
2251
|
confidence, last_accessed,
|
|
2184
2252
|
workspace_id, document_id, user_id, char_offset, page_number,
|
|
2185
|
-
source_path, source_type, tier, supersedes_id)
|
|
2186
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
2253
|
+
source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
|
|
2254
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
2187
2255
|
args: hasVector ? [
|
|
2188
2256
|
row.id,
|
|
2189
2257
|
row.agent_id,
|
|
@@ -2209,7 +2277,10 @@ async function flushBatch() {
|
|
|
2209
2277
|
sourcePath,
|
|
2210
2278
|
sourceType,
|
|
2211
2279
|
tier,
|
|
2212
|
-
supersedesId
|
|
2280
|
+
supersedesId,
|
|
2281
|
+
draft,
|
|
2282
|
+
memoryType,
|
|
2283
|
+
trajectory
|
|
2213
2284
|
] : [
|
|
2214
2285
|
row.id,
|
|
2215
2286
|
row.agent_id,
|
|
@@ -2234,7 +2305,10 @@ async function flushBatch() {
|
|
|
2234
2305
|
sourcePath,
|
|
2235
2306
|
sourceType,
|
|
2236
2307
|
tier,
|
|
2237
|
-
supersedesId
|
|
2308
|
+
supersedesId,
|
|
2309
|
+
draft,
|
|
2310
|
+
memoryType,
|
|
2311
|
+
trajectory
|
|
2238
2312
|
]
|
|
2239
2313
|
};
|
|
2240
2314
|
};
|
|
@@ -2303,6 +2377,8 @@ async function searchMemories(queryVector, agentId, options) {
|
|
|
2303
2377
|
const limit = options?.limit ?? 10;
|
|
2304
2378
|
const statusFilter = options?.includeArchived ? "" : `
|
|
2305
2379
|
AND COALESCE(status, 'active') = 'active'`;
|
|
2380
|
+
const draftFilter = options?.includeDrafts ? "" : `
|
|
2381
|
+
AND (draft = 0 OR draft IS NULL)`;
|
|
2306
2382
|
let sql = `SELECT id, agent_id, agent_role, session_id, timestamp,
|
|
2307
2383
|
tool_name, project_name,
|
|
2308
2384
|
has_error, raw_text, vector, importance, status,
|
|
@@ -2312,7 +2388,7 @@ async function searchMemories(queryVector, agentId, options) {
|
|
|
2312
2388
|
source_path, source_type
|
|
2313
2389
|
FROM memories
|
|
2314
2390
|
WHERE agent_id = ?
|
|
2315
|
-
AND vector IS NOT NULL${statusFilter}
|
|
2391
|
+
AND vector IS NOT NULL${statusFilter}${draftFilter}
|
|
2316
2392
|
AND COALESCE(confidence, 0.7) >= 0.3`;
|
|
2317
2393
|
const args = [agentId];
|
|
2318
2394
|
const scope = buildWikiScopeFilter(options, "");
|
|
@@ -2334,6 +2410,10 @@ async function searchMemories(queryVector, agentId, options) {
|
|
|
2334
2410
|
sql += ` AND timestamp >= ?`;
|
|
2335
2411
|
args.push(options.since);
|
|
2336
2412
|
}
|
|
2413
|
+
if (options?.memoryType) {
|
|
2414
|
+
sql += ` AND memory_type = ?`;
|
|
2415
|
+
args.push(options.memoryType);
|
|
2416
|
+
}
|
|
2337
2417
|
sql += ` ORDER BY vector_distance_cos(vector, vector32(?))`;
|
|
2338
2418
|
args.push(vectorToBlob(queryVector));
|
|
2339
2419
|
sql += ` LIMIT ?`;
|
|
@@ -2481,30 +2561,73 @@ var init_store = __esm({
|
|
|
2481
2561
|
|
|
2482
2562
|
// src/adapters/claude/active-agent.ts
|
|
2483
2563
|
init_config();
|
|
2484
|
-
import { readFileSync as
|
|
2485
|
-
import { execSync as
|
|
2486
|
-
import
|
|
2564
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync, unlinkSync as unlinkSync2, readdirSync } from "fs";
|
|
2565
|
+
import { execSync as execSync3 } from "child_process";
|
|
2566
|
+
import path3 from "path";
|
|
2487
2567
|
|
|
2488
2568
|
// src/adapters/claude/session-key.ts
|
|
2489
2569
|
init_session_key();
|
|
2490
2570
|
|
|
2491
2571
|
// src/adapters/claude/active-agent.ts
|
|
2492
|
-
|
|
2572
|
+
init_employees();
|
|
2573
|
+
var CACHE_DIR = path3.join(EXE_AI_DIR, "session-cache");
|
|
2493
2574
|
var STALE_MS = 24 * 60 * 60 * 1e3;
|
|
2575
|
+
function isNameWithOptionalInstance(candidate, baseName) {
|
|
2576
|
+
if (candidate === baseName) return true;
|
|
2577
|
+
if (!candidate.startsWith(baseName)) return false;
|
|
2578
|
+
return /^\d+$/.test(candidate.slice(baseName.length));
|
|
2579
|
+
}
|
|
2580
|
+
function resolveEmployeeFromSessionPrefix(prefix, employees) {
|
|
2581
|
+
const sorted = [...employees].sort((a, b) => b.name.length - a.name.length);
|
|
2582
|
+
for (const employee of sorted) {
|
|
2583
|
+
if (isNameWithOptionalInstance(prefix, employee.name)) {
|
|
2584
|
+
return { agentId: employee.name, agentRole: employee.role };
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
return null;
|
|
2588
|
+
}
|
|
2589
|
+
function resolveActiveAgentFromTmuxSession(sessionName) {
|
|
2590
|
+
const employees = loadEmployeesSync();
|
|
2591
|
+
const coordinator = getCoordinatorEmployee(employees);
|
|
2592
|
+
const coordinatorName = coordinator?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
|
|
2593
|
+
if (isNameWithOptionalInstance(sessionName, coordinatorName)) {
|
|
2594
|
+
return {
|
|
2595
|
+
agentId: coordinatorName,
|
|
2596
|
+
agentRole: coordinator?.role ?? "COO"
|
|
2597
|
+
};
|
|
2598
|
+
}
|
|
2599
|
+
if (isNameWithOptionalInstance(sessionName, DEFAULT_COORDINATOR_TEMPLATE_NAME)) {
|
|
2600
|
+
return {
|
|
2601
|
+
agentId: coordinator?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME,
|
|
2602
|
+
agentRole: coordinator?.role ?? "COO"
|
|
2603
|
+
};
|
|
2604
|
+
}
|
|
2605
|
+
if (sessionName.includes("-")) {
|
|
2606
|
+
const prefix = sessionName.split("-")[0] ?? "";
|
|
2607
|
+
const employee = resolveEmployeeFromSessionPrefix(prefix, employees);
|
|
2608
|
+
if (employee) return employee;
|
|
2609
|
+
const legacy = prefix.match(/^([a-zA-Z]+)\d*$/);
|
|
2610
|
+
if (legacy?.[1] && legacy[1] !== DEFAULT_COORDINATOR_TEMPLATE_NAME) {
|
|
2611
|
+
const emp = getEmployee(employees, legacy[1]);
|
|
2612
|
+
return { agentId: emp?.name ?? legacy[1], agentRole: emp?.role ?? "employee" };
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
return null;
|
|
2616
|
+
}
|
|
2494
2617
|
function getMarkerPath() {
|
|
2495
|
-
return
|
|
2618
|
+
return path3.join(CACHE_DIR, `active-agent-${getSessionKey()}.json`);
|
|
2496
2619
|
}
|
|
2497
2620
|
function getActiveAgent() {
|
|
2498
2621
|
try {
|
|
2499
2622
|
const markerPath = getMarkerPath();
|
|
2500
|
-
const raw =
|
|
2623
|
+
const raw = readFileSync3(markerPath, "utf8");
|
|
2501
2624
|
const data = JSON.parse(raw);
|
|
2502
2625
|
if (data.agentId) {
|
|
2503
2626
|
if (data.startedAt) {
|
|
2504
2627
|
const age = Date.now() - new Date(data.startedAt).getTime();
|
|
2505
2628
|
if (age > STALE_MS) {
|
|
2506
2629
|
try {
|
|
2507
|
-
|
|
2630
|
+
unlinkSync2(markerPath);
|
|
2508
2631
|
} catch {
|
|
2509
2632
|
}
|
|
2510
2633
|
} else {
|
|
@@ -2523,17 +2646,12 @@ function getActiveAgent() {
|
|
|
2523
2646
|
} catch {
|
|
2524
2647
|
}
|
|
2525
2648
|
try {
|
|
2526
|
-
const sessionName =
|
|
2649
|
+
const sessionName = execSync3(
|
|
2527
2650
|
"tmux display-message -p '#{session_name}' 2>/dev/null",
|
|
2528
2651
|
{ encoding: "utf8", timeout: 2e3 }
|
|
2529
2652
|
).trim();
|
|
2530
|
-
const
|
|
2531
|
-
if (
|
|
2532
|
-
return { agentId: empMatch[1], agentRole: "employee" };
|
|
2533
|
-
}
|
|
2534
|
-
if (/^exe\d+$/.test(sessionName)) {
|
|
2535
|
-
return { agentId: "exe", agentRole: "COO" };
|
|
2536
|
-
}
|
|
2653
|
+
const resolved = resolveActiveAgentFromTmuxSession(sessionName);
|
|
2654
|
+
if (resolved) return resolved;
|
|
2537
2655
|
} catch {
|
|
2538
2656
|
}
|
|
2539
2657
|
return {
|