@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/hooks/stop.js
CHANGED
|
@@ -184,13 +184,7 @@ var init_config = __esm({
|
|
|
184
184
|
wikiUrl: "",
|
|
185
185
|
wikiApiKey: "",
|
|
186
186
|
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
187
|
-
wikiWorkspaceMapping: {
|
|
188
|
-
exe: "Executive",
|
|
189
|
-
yoshi: "Engineering",
|
|
190
|
-
mari: "Marketing",
|
|
191
|
-
tom: "Engineering",
|
|
192
|
-
sasha: "Production"
|
|
193
|
-
},
|
|
187
|
+
wikiWorkspaceMapping: {},
|
|
194
188
|
wikiAutoUpdate: true,
|
|
195
189
|
wikiAutoUpdateThreshold: 0.5,
|
|
196
190
|
wikiAutoUpdateCreateNew: true,
|
|
@@ -262,14 +256,61 @@ var init_session_key = __esm({
|
|
|
262
256
|
}
|
|
263
257
|
});
|
|
264
258
|
|
|
265
|
-
// src/lib/
|
|
266
|
-
import
|
|
259
|
+
// src/lib/employees.ts
|
|
260
|
+
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
261
|
+
import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
262
|
+
import { execSync as execSync2 } from "child_process";
|
|
263
|
+
import path2 from "path";
|
|
267
264
|
import os2 from "os";
|
|
265
|
+
function normalizeRole(role) {
|
|
266
|
+
return (role ?? "").trim().toLowerCase();
|
|
267
|
+
}
|
|
268
|
+
function isCoordinatorRole(role) {
|
|
269
|
+
return normalizeRole(role) === normalizeRole(COORDINATOR_ROLE);
|
|
270
|
+
}
|
|
271
|
+
function getCoordinatorEmployee(employees) {
|
|
272
|
+
return employees.find((e) => isCoordinatorRole(e.role));
|
|
273
|
+
}
|
|
274
|
+
function getCoordinatorName(employees = loadEmployeesSync()) {
|
|
275
|
+
return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
|
|
276
|
+
}
|
|
277
|
+
function isCoordinatorName(agentName, employees = loadEmployeesSync()) {
|
|
278
|
+
if (!agentName) return false;
|
|
279
|
+
return agentName.toLowerCase() === getCoordinatorName(employees).toLowerCase();
|
|
280
|
+
}
|
|
281
|
+
function canCoordinate(agentName, agentRole, employees = loadEmployeesSync()) {
|
|
282
|
+
return agentName === "default" || isCoordinatorRole(agentRole) || isCoordinatorName(agentName, employees);
|
|
283
|
+
}
|
|
284
|
+
function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
|
|
285
|
+
if (!existsSync2(employeesPath)) return [];
|
|
286
|
+
try {
|
|
287
|
+
return JSON.parse(readFileSync2(employeesPath, "utf-8"));
|
|
288
|
+
} catch {
|
|
289
|
+
return [];
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function getEmployee(employees, name) {
|
|
293
|
+
return employees.find((e) => e.name.toLowerCase() === name.toLowerCase());
|
|
294
|
+
}
|
|
295
|
+
var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE;
|
|
296
|
+
var init_employees = __esm({
|
|
297
|
+
"src/lib/employees.ts"() {
|
|
298
|
+
"use strict";
|
|
299
|
+
init_config();
|
|
300
|
+
EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
301
|
+
DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
|
|
302
|
+
COORDINATOR_ROLE = "COO";
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// src/lib/session-registry.ts
|
|
307
|
+
import path4 from "path";
|
|
308
|
+
import os3 from "os";
|
|
268
309
|
var REGISTRY_PATH;
|
|
269
310
|
var init_session_registry = __esm({
|
|
270
311
|
"src/lib/session-registry.ts"() {
|
|
271
312
|
"use strict";
|
|
272
|
-
REGISTRY_PATH =
|
|
313
|
+
REGISTRY_PATH = path4.join(os3.homedir(), ".exe-os", "session-registry.json");
|
|
273
314
|
}
|
|
274
315
|
});
|
|
275
316
|
|
|
@@ -381,7 +422,7 @@ var init_transport = __esm({
|
|
|
381
422
|
});
|
|
382
423
|
|
|
383
424
|
// src/lib/cc-agent-support.ts
|
|
384
|
-
import { execSync as
|
|
425
|
+
import { execSync as execSync4 } from "child_process";
|
|
385
426
|
var init_cc_agent_support = __esm({
|
|
386
427
|
"src/lib/cc-agent-support.ts"() {
|
|
387
428
|
"use strict";
|
|
@@ -410,16 +451,16 @@ var init_provider_table = __esm({
|
|
|
410
451
|
});
|
|
411
452
|
|
|
412
453
|
// src/lib/intercom-queue.ts
|
|
413
|
-
import { readFileSync as
|
|
414
|
-
import
|
|
415
|
-
import
|
|
454
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, renameSync as renameSync3, existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
|
|
455
|
+
import path5 from "path";
|
|
456
|
+
import os4 from "os";
|
|
416
457
|
var QUEUE_PATH, TTL_MS, INTERCOM_LOG;
|
|
417
458
|
var init_intercom_queue = __esm({
|
|
418
459
|
"src/lib/intercom-queue.ts"() {
|
|
419
460
|
"use strict";
|
|
420
|
-
QUEUE_PATH =
|
|
461
|
+
QUEUE_PATH = path5.join(os4.homedir(), ".exe-os", "intercom-queue.json");
|
|
421
462
|
TTL_MS = 60 * 60 * 1e3;
|
|
422
|
-
INTERCOM_LOG =
|
|
463
|
+
INTERCOM_LOG = path5.join(os4.homedir(), ".exe-os", "intercom.log");
|
|
423
464
|
}
|
|
424
465
|
});
|
|
425
466
|
|
|
@@ -462,7 +503,7 @@ function wrapWithRetry(client) {
|
|
|
462
503
|
return (sql) => retryOnBusy(() => target.execute(sql), "execute");
|
|
463
504
|
}
|
|
464
505
|
if (prop === "batch") {
|
|
465
|
-
return (stmts) => retryOnBusy(() => target.batch(stmts), "batch");
|
|
506
|
+
return (stmts, mode) => retryOnBusy(() => target.batch(stmts, mode), "batch");
|
|
466
507
|
}
|
|
467
508
|
return Reflect.get(target, prop, receiver);
|
|
468
509
|
}
|
|
@@ -625,22 +666,24 @@ async function ensureSchema() {
|
|
|
625
666
|
ON behaviors(agent_id, active);
|
|
626
667
|
`);
|
|
627
668
|
try {
|
|
669
|
+
const coordinatorName = getCoordinatorName();
|
|
628
670
|
const existing = await client.execute({
|
|
629
|
-
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id =
|
|
630
|
-
args: []
|
|
671
|
+
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = ?",
|
|
672
|
+
args: [coordinatorName]
|
|
631
673
|
});
|
|
632
674
|
if (Number(existing.rows[0]?.cnt) === 0) {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
675
|
+
const seededAt = "2026-03-25T00:00:00Z";
|
|
676
|
+
for (const [domain, content] of [
|
|
677
|
+
["workflow", `Don't ask "keep going?" \u2014 just keep executing phases/plans autonomously`],
|
|
678
|
+
["tool-use", "Always use create_task MCP tool, never write .md files directly for task creation"],
|
|
679
|
+
["workflow", "Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission"]
|
|
680
|
+
]) {
|
|
681
|
+
await client.execute({
|
|
682
|
+
sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
|
|
683
|
+
VALUES (hex(randomblob(16)), ?, NULL, ?, ?, 1, ?, ?)`,
|
|
684
|
+
args: [coordinatorName, domain, content, seededAt, seededAt]
|
|
685
|
+
});
|
|
686
|
+
}
|
|
644
687
|
}
|
|
645
688
|
} catch {
|
|
646
689
|
}
|
|
@@ -1332,6 +1375,39 @@ async function ensureSchema() {
|
|
|
1332
1375
|
} catch {
|
|
1333
1376
|
}
|
|
1334
1377
|
}
|
|
1378
|
+
try {
|
|
1379
|
+
await client.execute({
|
|
1380
|
+
sql: `ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0`,
|
|
1381
|
+
args: []
|
|
1382
|
+
});
|
|
1383
|
+
} catch {
|
|
1384
|
+
}
|
|
1385
|
+
try {
|
|
1386
|
+
await client.execute(
|
|
1387
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_draft ON memories(draft) WHERE draft = 1`
|
|
1388
|
+
);
|
|
1389
|
+
} catch {
|
|
1390
|
+
}
|
|
1391
|
+
try {
|
|
1392
|
+
await client.execute({
|
|
1393
|
+
sql: `ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'`,
|
|
1394
|
+
args: []
|
|
1395
|
+
});
|
|
1396
|
+
} catch {
|
|
1397
|
+
}
|
|
1398
|
+
try {
|
|
1399
|
+
await client.execute(
|
|
1400
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(memory_type)`
|
|
1401
|
+
);
|
|
1402
|
+
} catch {
|
|
1403
|
+
}
|
|
1404
|
+
try {
|
|
1405
|
+
await client.execute({
|
|
1406
|
+
sql: `ALTER TABLE memories ADD COLUMN trajectory TEXT`,
|
|
1407
|
+
args: []
|
|
1408
|
+
});
|
|
1409
|
+
} catch {
|
|
1410
|
+
}
|
|
1335
1411
|
}
|
|
1336
1412
|
async function disposeDatabase() {
|
|
1337
1413
|
if (_client) {
|
|
@@ -1345,6 +1421,7 @@ var init_database = __esm({
|
|
|
1345
1421
|
"src/lib/database.ts"() {
|
|
1346
1422
|
"use strict";
|
|
1347
1423
|
init_db_retry();
|
|
1424
|
+
init_employees();
|
|
1348
1425
|
_client = null;
|
|
1349
1426
|
_resilientClient = null;
|
|
1350
1427
|
initTurso = initDatabase;
|
|
@@ -1352,21 +1429,6 @@ var init_database = __esm({
|
|
|
1352
1429
|
}
|
|
1353
1430
|
});
|
|
1354
1431
|
|
|
1355
|
-
// src/lib/employees.ts
|
|
1356
|
-
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
1357
|
-
import { existsSync as existsSync3, symlinkSync, readlinkSync, readFileSync as readFileSync4, renameSync as renameSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
1358
|
-
import { execSync as execSync4 } from "child_process";
|
|
1359
|
-
import path5 from "path";
|
|
1360
|
-
import os4 from "os";
|
|
1361
|
-
var EMPLOYEES_PATH;
|
|
1362
|
-
var init_employees = __esm({
|
|
1363
|
-
"src/lib/employees.ts"() {
|
|
1364
|
-
"use strict";
|
|
1365
|
-
init_config();
|
|
1366
|
-
EMPLOYEES_PATH = path5.join(EXE_AI_DIR, "exe-employees.json");
|
|
1367
|
-
}
|
|
1368
|
-
});
|
|
1369
|
-
|
|
1370
1432
|
// src/lib/license.ts
|
|
1371
1433
|
import { readFileSync as readFileSync5, writeFileSync as writeFileSync4, existsSync as existsSync4, mkdirSync as mkdirSync3 } from "fs";
|
|
1372
1434
|
import { randomUUID } from "crypto";
|
|
@@ -1407,8 +1469,10 @@ function getMySession() {
|
|
|
1407
1469
|
return getTransport().getMySession();
|
|
1408
1470
|
}
|
|
1409
1471
|
function extractRootExe(name) {
|
|
1410
|
-
|
|
1411
|
-
|
|
1472
|
+
if (!name) return null;
|
|
1473
|
+
if (!name.includes("-")) return name;
|
|
1474
|
+
const parts = name.split("-").filter(Boolean);
|
|
1475
|
+
return parts.length > 0 ? parts[parts.length - 1] : null;
|
|
1412
1476
|
}
|
|
1413
1477
|
function getParentExe(sessionKey) {
|
|
1414
1478
|
try {
|
|
@@ -1443,6 +1507,7 @@ var init_tmux_routing = __esm({
|
|
|
1443
1507
|
init_provider_table();
|
|
1444
1508
|
init_intercom_queue();
|
|
1445
1509
|
init_plan_limits();
|
|
1510
|
+
init_employees();
|
|
1446
1511
|
SPAWN_LOCK_DIR = path8.join(os5.homedir(), ".exe-os", "spawn-locks");
|
|
1447
1512
|
SESSION_CACHE = path8.join(os5.homedir(), ".exe-os", "session-cache");
|
|
1448
1513
|
INTERCOM_LOG2 = path8.join(os5.homedir(), ".exe-os", "intercom.log");
|
|
@@ -1710,7 +1775,11 @@ async function ensureShardSchema(client) {
|
|
|
1710
1775
|
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
1711
1776
|
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
|
|
1712
1777
|
"ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
|
|
1713
|
-
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
|
|
1778
|
+
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT",
|
|
1779
|
+
// MS-11: draft staging, MS-6a: memory_type, MS-7: trajectory
|
|
1780
|
+
"ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0",
|
|
1781
|
+
"ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'",
|
|
1782
|
+
"ALTER TABLE memories ADD COLUMN trajectory TEXT"
|
|
1714
1783
|
]) {
|
|
1715
1784
|
try {
|
|
1716
1785
|
await client.execute(col);
|
|
@@ -1840,26 +1909,26 @@ var init_platform_procedures = __esm({
|
|
|
1840
1909
|
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1841
1910
|
domain: "architecture",
|
|
1842
1911
|
priority: "p0",
|
|
1843
|
-
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO
|
|
1912
|
+
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."
|
|
1844
1913
|
},
|
|
1845
1914
|
{
|
|
1846
1915
|
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1847
1916
|
domain: "architecture",
|
|
1848
1917
|
priority: "p0",
|
|
1849
|
-
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC
|
|
1918
|
+
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."
|
|
1850
1919
|
},
|
|
1851
1920
|
{
|
|
1852
|
-
title: "Sessions explained \u2014
|
|
1921
|
+
title: "Sessions explained \u2014 coordinator session names and projects",
|
|
1853
1922
|
domain: "architecture",
|
|
1854
1923
|
priority: "p0",
|
|
1855
|
-
content: "Each
|
|
1924
|
+
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."
|
|
1856
1925
|
},
|
|
1857
1926
|
// --- Hierarchy and dispatch ---
|
|
1858
1927
|
{
|
|
1859
1928
|
title: "Chain of command \u2014 who talks to whom",
|
|
1860
1929
|
domain: "workflow",
|
|
1861
1930
|
priority: "p0",
|
|
1862
|
-
content: "Founder
|
|
1931
|
+
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."
|
|
1863
1932
|
},
|
|
1864
1933
|
{
|
|
1865
1934
|
title: "Single dispatch path \u2014 create_task only",
|
|
@@ -1869,30 +1938,30 @@ var init_platform_procedures = __esm({
|
|
|
1869
1938
|
},
|
|
1870
1939
|
// --- Session isolation ---
|
|
1871
1940
|
{
|
|
1872
|
-
title: "Session scoping \u2014 stay in your
|
|
1941
|
+
title: "Session scoping \u2014 stay in your coordinator boundary",
|
|
1873
1942
|
domain: "security",
|
|
1874
1943
|
priority: "p0",
|
|
1875
|
-
content: "Session scoping is mandatory. Managers dispatch to workers within their own
|
|
1944
|
+
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."
|
|
1876
1945
|
},
|
|
1877
1946
|
{
|
|
1878
1947
|
title: "Session isolation \u2014 never touch another session's work",
|
|
1879
1948
|
domain: "workflow",
|
|
1880
1949
|
priority: "p0",
|
|
1881
|
-
content:
|
|
1950
|
+
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."
|
|
1882
1951
|
},
|
|
1883
1952
|
// --- Engineering: session scoping in code ---
|
|
1884
1953
|
{
|
|
1885
1954
|
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1886
1955
|
domain: "architecture",
|
|
1887
1956
|
priority: "p0",
|
|
1888
|
-
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
|
|
1957
|
+
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."
|
|
1889
1958
|
},
|
|
1890
1959
|
// --- Hard constraints ---
|
|
1891
1960
|
{
|
|
1892
1961
|
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1893
1962
|
domain: "security",
|
|
1894
1963
|
priority: "p0",
|
|
1895
|
-
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
|
|
1964
|
+
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."
|
|
1896
1965
|
},
|
|
1897
1966
|
// --- Operations ---
|
|
1898
1967
|
{
|
|
@@ -2132,7 +2201,10 @@ async function writeMemory(record) {
|
|
|
2132
2201
|
source_path: record.source_path ?? null,
|
|
2133
2202
|
source_type: record.source_type ?? null,
|
|
2134
2203
|
tier: record.tier ?? classifyTier(record),
|
|
2135
|
-
supersedes_id: record.supersedes_id ?? null
|
|
2204
|
+
supersedes_id: record.supersedes_id ?? null,
|
|
2205
|
+
draft: record.draft ? 1 : 0,
|
|
2206
|
+
memory_type: record.memory_type ?? "raw",
|
|
2207
|
+
trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null
|
|
2136
2208
|
};
|
|
2137
2209
|
_pendingRecords.push(dbRow);
|
|
2138
2210
|
orgBus.emit({
|
|
@@ -2187,6 +2259,9 @@ async function flushBatch() {
|
|
|
2187
2259
|
const sourceType = row.source_type ?? null;
|
|
2188
2260
|
const tier = row.tier ?? 3;
|
|
2189
2261
|
const supersedesId = row.supersedes_id ?? null;
|
|
2262
|
+
const draft = row.draft ? 1 : 0;
|
|
2263
|
+
const memoryType = row.memory_type ?? "raw";
|
|
2264
|
+
const trajectory = row.trajectory ?? null;
|
|
2190
2265
|
return {
|
|
2191
2266
|
sql: hasVector ? `INSERT OR IGNORE INTO memories
|
|
2192
2267
|
(id, agent_id, agent_role, session_id, timestamp,
|
|
@@ -2194,15 +2269,15 @@ async function flushBatch() {
|
|
|
2194
2269
|
has_error, raw_text, vector, version, task_id, importance, status,
|
|
2195
2270
|
confidence, last_accessed,
|
|
2196
2271
|
workspace_id, document_id, user_id, char_offset, page_number,
|
|
2197
|
-
source_path, source_type, tier, supersedes_id)
|
|
2198
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories
|
|
2272
|
+
source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
|
|
2273
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories
|
|
2199
2274
|
(id, agent_id, agent_role, session_id, timestamp,
|
|
2200
2275
|
tool_name, project_name,
|
|
2201
2276
|
has_error, raw_text, vector, version, task_id, importance, status,
|
|
2202
2277
|
confidence, last_accessed,
|
|
2203
2278
|
workspace_id, document_id, user_id, char_offset, page_number,
|
|
2204
|
-
source_path, source_type, tier, supersedes_id)
|
|
2205
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
2279
|
+
source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
|
|
2280
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
2206
2281
|
args: hasVector ? [
|
|
2207
2282
|
row.id,
|
|
2208
2283
|
row.agent_id,
|
|
@@ -2228,7 +2303,10 @@ async function flushBatch() {
|
|
|
2228
2303
|
sourcePath,
|
|
2229
2304
|
sourceType,
|
|
2230
2305
|
tier,
|
|
2231
|
-
supersedesId
|
|
2306
|
+
supersedesId,
|
|
2307
|
+
draft,
|
|
2308
|
+
memoryType,
|
|
2309
|
+
trajectory
|
|
2232
2310
|
] : [
|
|
2233
2311
|
row.id,
|
|
2234
2312
|
row.agent_id,
|
|
@@ -2253,7 +2331,10 @@ async function flushBatch() {
|
|
|
2253
2331
|
sourcePath,
|
|
2254
2332
|
sourceType,
|
|
2255
2333
|
tier,
|
|
2256
|
-
supersedesId
|
|
2334
|
+
supersedesId,
|
|
2335
|
+
draft,
|
|
2336
|
+
memoryType,
|
|
2337
|
+
trajectory
|
|
2257
2338
|
]
|
|
2258
2339
|
};
|
|
2259
2340
|
};
|
|
@@ -2322,6 +2403,8 @@ async function searchMemories(queryVector, agentId, options) {
|
|
|
2322
2403
|
const limit = options?.limit ?? 10;
|
|
2323
2404
|
const statusFilter = options?.includeArchived ? "" : `
|
|
2324
2405
|
AND COALESCE(status, 'active') = 'active'`;
|
|
2406
|
+
const draftFilter = options?.includeDrafts ? "" : `
|
|
2407
|
+
AND (draft = 0 OR draft IS NULL)`;
|
|
2325
2408
|
let sql = `SELECT id, agent_id, agent_role, session_id, timestamp,
|
|
2326
2409
|
tool_name, project_name,
|
|
2327
2410
|
has_error, raw_text, vector, importance, status,
|
|
@@ -2331,7 +2414,7 @@ async function searchMemories(queryVector, agentId, options) {
|
|
|
2331
2414
|
source_path, source_type
|
|
2332
2415
|
FROM memories
|
|
2333
2416
|
WHERE agent_id = ?
|
|
2334
|
-
AND vector IS NOT NULL${statusFilter}
|
|
2417
|
+
AND vector IS NOT NULL${statusFilter}${draftFilter}
|
|
2335
2418
|
AND COALESCE(confidence, 0.7) >= 0.3`;
|
|
2336
2419
|
const args = [agentId];
|
|
2337
2420
|
const scope = buildWikiScopeFilter(options, "");
|
|
@@ -2353,6 +2436,10 @@ async function searchMemories(queryVector, agentId, options) {
|
|
|
2353
2436
|
sql += ` AND timestamp >= ?`;
|
|
2354
2437
|
args.push(options.since);
|
|
2355
2438
|
}
|
|
2439
|
+
if (options?.memoryType) {
|
|
2440
|
+
sql += ` AND memory_type = ?`;
|
|
2441
|
+
args.push(options.memoryType);
|
|
2442
|
+
}
|
|
2356
2443
|
sql += ` ORDER BY vector_distance_cos(vector, vector32(?))`;
|
|
2357
2444
|
args.push(vectorToBlob(queryVector));
|
|
2358
2445
|
sql += ` LIMIT ?`;
|
|
@@ -2508,30 +2595,73 @@ import { fileURLToPath as fileURLToPath2 } from "url";
|
|
|
2508
2595
|
|
|
2509
2596
|
// src/adapters/claude/active-agent.ts
|
|
2510
2597
|
init_config();
|
|
2511
|
-
import { readFileSync as
|
|
2512
|
-
import { execSync as
|
|
2513
|
-
import
|
|
2598
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync, unlinkSync as unlinkSync2, readdirSync } from "fs";
|
|
2599
|
+
import { execSync as execSync3 } from "child_process";
|
|
2600
|
+
import path3 from "path";
|
|
2514
2601
|
|
|
2515
2602
|
// src/adapters/claude/session-key.ts
|
|
2516
2603
|
init_session_key();
|
|
2517
2604
|
|
|
2518
2605
|
// src/adapters/claude/active-agent.ts
|
|
2519
|
-
|
|
2606
|
+
init_employees();
|
|
2607
|
+
var CACHE_DIR = path3.join(EXE_AI_DIR, "session-cache");
|
|
2520
2608
|
var STALE_MS = 24 * 60 * 60 * 1e3;
|
|
2609
|
+
function isNameWithOptionalInstance(candidate, baseName) {
|
|
2610
|
+
if (candidate === baseName) return true;
|
|
2611
|
+
if (!candidate.startsWith(baseName)) return false;
|
|
2612
|
+
return /^\d+$/.test(candidate.slice(baseName.length));
|
|
2613
|
+
}
|
|
2614
|
+
function resolveEmployeeFromSessionPrefix(prefix, employees) {
|
|
2615
|
+
const sorted = [...employees].sort((a, b) => b.name.length - a.name.length);
|
|
2616
|
+
for (const employee of sorted) {
|
|
2617
|
+
if (isNameWithOptionalInstance(prefix, employee.name)) {
|
|
2618
|
+
return { agentId: employee.name, agentRole: employee.role };
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
return null;
|
|
2622
|
+
}
|
|
2623
|
+
function resolveActiveAgentFromTmuxSession(sessionName) {
|
|
2624
|
+
const employees = loadEmployeesSync();
|
|
2625
|
+
const coordinator = getCoordinatorEmployee(employees);
|
|
2626
|
+
const coordinatorName = coordinator?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
|
|
2627
|
+
if (isNameWithOptionalInstance(sessionName, coordinatorName)) {
|
|
2628
|
+
return {
|
|
2629
|
+
agentId: coordinatorName,
|
|
2630
|
+
agentRole: coordinator?.role ?? "COO"
|
|
2631
|
+
};
|
|
2632
|
+
}
|
|
2633
|
+
if (isNameWithOptionalInstance(sessionName, DEFAULT_COORDINATOR_TEMPLATE_NAME)) {
|
|
2634
|
+
return {
|
|
2635
|
+
agentId: coordinator?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME,
|
|
2636
|
+
agentRole: coordinator?.role ?? "COO"
|
|
2637
|
+
};
|
|
2638
|
+
}
|
|
2639
|
+
if (sessionName.includes("-")) {
|
|
2640
|
+
const prefix = sessionName.split("-")[0] ?? "";
|
|
2641
|
+
const employee = resolveEmployeeFromSessionPrefix(prefix, employees);
|
|
2642
|
+
if (employee) return employee;
|
|
2643
|
+
const legacy = prefix.match(/^([a-zA-Z]+)\d*$/);
|
|
2644
|
+
if (legacy?.[1] && legacy[1] !== DEFAULT_COORDINATOR_TEMPLATE_NAME) {
|
|
2645
|
+
const emp = getEmployee(employees, legacy[1]);
|
|
2646
|
+
return { agentId: emp?.name ?? legacy[1], agentRole: emp?.role ?? "employee" };
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
return null;
|
|
2650
|
+
}
|
|
2521
2651
|
function getMarkerPath() {
|
|
2522
|
-
return
|
|
2652
|
+
return path3.join(CACHE_DIR, `active-agent-${getSessionKey()}.json`);
|
|
2523
2653
|
}
|
|
2524
2654
|
function getActiveAgent() {
|
|
2525
2655
|
try {
|
|
2526
2656
|
const markerPath = getMarkerPath();
|
|
2527
|
-
const raw =
|
|
2657
|
+
const raw = readFileSync3(markerPath, "utf8");
|
|
2528
2658
|
const data = JSON.parse(raw);
|
|
2529
2659
|
if (data.agentId) {
|
|
2530
2660
|
if (data.startedAt) {
|
|
2531
2661
|
const age = Date.now() - new Date(data.startedAt).getTime();
|
|
2532
2662
|
if (age > STALE_MS) {
|
|
2533
2663
|
try {
|
|
2534
|
-
|
|
2664
|
+
unlinkSync2(markerPath);
|
|
2535
2665
|
} catch {
|
|
2536
2666
|
}
|
|
2537
2667
|
} else {
|
|
@@ -2550,17 +2680,12 @@ function getActiveAgent() {
|
|
|
2550
2680
|
} catch {
|
|
2551
2681
|
}
|
|
2552
2682
|
try {
|
|
2553
|
-
const sessionName =
|
|
2683
|
+
const sessionName = execSync3(
|
|
2554
2684
|
"tmux display-message -p '#{session_name}' 2>/dev/null",
|
|
2555
2685
|
{ encoding: "utf8", timeout: 2e3 }
|
|
2556
2686
|
).trim();
|
|
2557
|
-
const
|
|
2558
|
-
if (
|
|
2559
|
-
return { agentId: empMatch[1], agentRole: "employee" };
|
|
2560
|
-
}
|
|
2561
|
-
if (/^exe\d+$/.test(sessionName)) {
|
|
2562
|
-
return { agentId: "exe", agentRole: "COO" };
|
|
2563
|
-
}
|
|
2687
|
+
const resolved = resolveActiveAgentFromTmuxSession(sessionName);
|
|
2688
|
+
if (resolved) return resolved;
|
|
2564
2689
|
} catch {
|
|
2565
2690
|
}
|
|
2566
2691
|
return {
|
|
@@ -2571,6 +2696,7 @@ function getActiveAgent() {
|
|
|
2571
2696
|
|
|
2572
2697
|
// src/adapters/claude/hooks/stop.ts
|
|
2573
2698
|
init_task_scope();
|
|
2699
|
+
init_employees();
|
|
2574
2700
|
if (!process.env.AGENT_ID) {
|
|
2575
2701
|
process.env.AGENT_ID = "default";
|
|
2576
2702
|
process.env.AGENT_ROLE = "employee";
|
|
@@ -2606,7 +2732,7 @@ process.stdin.on("end", () => {
|
|
|
2606
2732
|
}
|
|
2607
2733
|
const agent = getActiveAgent();
|
|
2608
2734
|
const CAPACITY_SIGNALS = /context[- ]?full|hit capacity|conversation is too long|maximum context length|context window.*(?:limit|exceed|full)/i;
|
|
2609
|
-
if (agent.agentId
|
|
2735
|
+
if (!canCoordinate(agent.agentId, agent.agentRole) && CAPACITY_SIGNALS.test(message)) {
|
|
2610
2736
|
Promise.resolve().then(() => (init_store(), store_exports)).then(({ initStore: initStore2 }) => initStore2()).then(() => Promise.all([
|
|
2611
2737
|
Promise.resolve().then(() => (init_database(), database_exports)),
|
|
2612
2738
|
Promise.resolve().then(() => (init_store(), store_exports))
|
|
@@ -2649,7 +2775,7 @@ process.stdin.on("end", () => {
|
|
|
2649
2775
|
}).catch(() => {
|
|
2650
2776
|
});
|
|
2651
2777
|
}
|
|
2652
|
-
if (agent.agentId
|
|
2778
|
+
if (!canCoordinate(agent.agentId, agent.agentRole)) {
|
|
2653
2779
|
Promise.resolve().then(() => (init_store(), store_exports)).then(({ initStore: initStore2 }) => initStore2()).then(() => Promise.resolve().then(() => (init_database(), database_exports))).then(({ getClient: getClient2 }) => {
|
|
2654
2780
|
const client = getClient2();
|
|
2655
2781
|
const orScope = sessionScopeFilter();
|