@askexenow/exe-os 0.8.53 → 0.8.55
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 +113 -10
- package/dist/bin/backfill-responses.js +113 -10
- package/dist/bin/backfill-vectors.js +147 -13
- package/dist/bin/cleanup-stale-review-tasks.js +113 -10
- package/dist/bin/cli.js +337 -211
- package/dist/bin/exe-agent.js +99 -4
- package/dist/bin/exe-assign.js +113 -10
- package/dist/bin/exe-boot.js +276 -85
- package/dist/bin/exe-call.js +107 -5
- package/dist/bin/exe-doctor.js +183 -13
- package/dist/bin/exe-export-behaviors.js +113 -10
- package/dist/bin/exe-forget.js +113 -10
- package/dist/bin/exe-gateway.js +131 -12
- package/dist/bin/exe-heartbeat.js +121 -11
- package/dist/bin/exe-kill.js +113 -10
- package/dist/bin/exe-launch-agent.js +113 -10
- package/dist/bin/exe-link.js +10 -2
- package/dist/bin/exe-new-employee.js +95 -0
- package/dist/bin/exe-pending-messages.js +113 -10
- package/dist/bin/exe-pending-notifications.js +113 -10
- package/dist/bin/exe-pending-reviews.js +122 -11
- package/dist/bin/exe-rename.js +95 -0
- package/dist/bin/exe-review.js +113 -10
- package/dist/bin/exe-search.js +113 -10
- package/dist/bin/exe-session-cleanup.js +131 -12
- package/dist/bin/exe-status.js +113 -10
- package/dist/bin/exe-team.js +113 -10
- package/dist/bin/git-sweep.js +131 -12
- package/dist/bin/graph-backfill.js +113 -10
- package/dist/bin/graph-export.js +113 -10
- package/dist/bin/scan-tasks.js +131 -12
- package/dist/bin/setup.js +107 -5
- package/dist/bin/shard-migrate.js +113 -10
- package/dist/bin/wiki-sync.js +113 -10
- package/dist/gateway/index.js +131 -12
- package/dist/hooks/bug-report-worker.js +131 -12
- package/dist/hooks/commit-complete.js +131 -12
- package/dist/hooks/error-recall.js +113 -10
- package/dist/hooks/ingest-worker.js +131 -12
- package/dist/hooks/instructions-loaded.js +113 -10
- package/dist/hooks/notification.js +113 -10
- package/dist/hooks/post-compact.js +113 -10
- package/dist/hooks/pre-compact.js +131 -12
- package/dist/hooks/pre-tool-use.js +113 -10
- package/dist/hooks/prompt-ingest-worker.js +113 -10
- package/dist/hooks/prompt-submit.js +140 -14
- package/dist/hooks/response-ingest-worker.js +113 -10
- package/dist/hooks/session-end.js +113 -10
- package/dist/hooks/session-start.js +113 -10
- package/dist/hooks/stop.js +113 -10
- package/dist/hooks/subagent-stop.js +113 -10
- package/dist/hooks/summary-worker.js +231 -114
- package/dist/index.js +131 -12
- package/dist/lib/cloud-sync.js +10 -2
- package/dist/lib/employee-templates.js +99 -4
- package/dist/lib/exe-daemon.js +4859 -4706
- package/dist/lib/hybrid-search.js +113 -10
- package/dist/lib/schedules.js +113 -10
- package/dist/lib/store.js +113 -10
- package/dist/lib/tasks.js +18 -2
- package/dist/lib/tmux-routing.js +18 -2
- package/dist/mcp/server.js +214 -28
- package/dist/mcp/tools/create-task.js +18 -2
- package/dist/mcp/tools/list-tasks.js +18 -2
- package/dist/runtime/index.js +131 -12
- package/dist/tui/App.js +337 -211
- package/package.json +2 -2
package/dist/bin/exe-call.js
CHANGED
|
@@ -259,23 +259,125 @@ var init_database = __esm({
|
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
261
|
|
|
262
|
+
// src/lib/platform-procedures.ts
|
|
263
|
+
var PLATFORM_PROCEDURES, PLATFORM_PROCEDURE_TITLES;
|
|
264
|
+
var init_platform_procedures = __esm({
|
|
265
|
+
"src/lib/platform-procedures.ts"() {
|
|
266
|
+
"use strict";
|
|
267
|
+
PLATFORM_PROCEDURES = [
|
|
268
|
+
// --- Foundation: what is exe-os ---
|
|
269
|
+
{
|
|
270
|
+
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
271
|
+
domain: "architecture",
|
|
272
|
+
priority: "p0",
|
|
273
|
+
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO (exe), CTO (yoshi), CMO (mari), engineers (tom), content (sasha). 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."
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
277
|
+
domain: "architecture",
|
|
278
|
+
priority: "p0",
|
|
279
|
+
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC, runs /exe to boot the COO. exe manages employees in tmux sessions. Each exeN is a separate CC window/project. Employees (yoshi, tom, mari) run in their own tmux panes via create_task auto-spawn. The founder talks to exe; exe orchestrates the team. CC is the shell, exe-os is the brain."
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
title: "Sessions explained \u2014 what exeN means and how projects work",
|
|
283
|
+
domain: "architecture",
|
|
284
|
+
priority: "p0",
|
|
285
|
+
content: "Each exeN (exe1, exe2, exe3) is an isolated project session. exe1 might be exe-os development, exe2 might be exe-wiki. Each session spawns its own employees: exe1\u2192yoshi-exe1\u2192tom-exe1. 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."
|
|
286
|
+
},
|
|
287
|
+
// --- Hierarchy and dispatch ---
|
|
288
|
+
{
|
|
289
|
+
title: "Chain of command \u2014 who talks to whom",
|
|
290
|
+
domain: "workflow",
|
|
291
|
+
priority: "p0",
|
|
292
|
+
content: "Founder \u2192 exe (COO) \u2192 yoshi (CTO) / mari (CMO). Yoshi \u2192 tom (engineer). Mari \u2192 sasha (content). Never skip levels: exe never assigns directly to tom. Tom never reports directly to exe. 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."
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
title: "Single dispatch path \u2014 create_task only",
|
|
296
|
+
domain: "workflow",
|
|
297
|
+
priority: "p0",
|
|
298
|
+
content: "create_task is the ONLY way to dispatch work to another agent. No direct ensureEmployee calls, no manual tmux spawns, no send_message for actionable work. create_task \u2192 system auto-spawns \u2192 session correctly named. ONE PATH. No backdoors. No exceptions."
|
|
299
|
+
},
|
|
300
|
+
// --- Session isolation ---
|
|
301
|
+
{
|
|
302
|
+
title: "Session scoping \u2014 stay in your exe boundary",
|
|
303
|
+
domain: "security",
|
|
304
|
+
priority: "p0",
|
|
305
|
+
content: "Session scoping is mandatory. Managers dispatch to workers within their own exe session ONLY. exe1\u2192yoshi-exe1\u2192tom-exe1. exe2\u2192yoshi-exe2\u2192tom2-exe2. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating exe session."
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
title: "Session isolation \u2014 never touch another session's work",
|
|
309
|
+
domain: "workflow",
|
|
310
|
+
priority: "p0",
|
|
311
|
+
content: `Sessions are isolated. exeN owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another exe session. (2) Never review work from a different session \u2014 report "belongs to exeN" and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: yoshi-exe1 works ONLY on exe1 tasks. Cross-session work is a system violation.`
|
|
312
|
+
},
|
|
313
|
+
// --- Engineering: session scoping in code ---
|
|
314
|
+
{
|
|
315
|
+
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
316
|
+
domain: "architecture",
|
|
317
|
+
priority: "p0",
|
|
318
|
+
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 exeN. (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+ exe sessions simultaneously."
|
|
319
|
+
},
|
|
320
|
+
// --- Hard constraints ---
|
|
321
|
+
{
|
|
322
|
+
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
323
|
+
domain: "security",
|
|
324
|
+
priority: "p0",
|
|
325
|
+
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 exe reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
|
|
326
|
+
},
|
|
327
|
+
// --- Operations ---
|
|
328
|
+
{
|
|
329
|
+
title: "Managers must supervise deployed workers",
|
|
330
|
+
domain: "workflow",
|
|
331
|
+
priority: "p0",
|
|
332
|
+
content: `Every manager (COO/CTO/CMO) who dispatches work to a worker MUST actively monitor them. Check tmux capture-pane every 10 minutes. Verify they're working, not stuck. If idle at prompt with in_progress task \u2192 send intercom. If stuck \u2192 unblock or escalate. "Standing by" without checking is negligence.`
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
|
|
336
|
+
domain: "workflow",
|
|
337
|
+
priority: "p0",
|
|
338
|
+
content: "On every /exe boot, COO MUST check system health BEFORE other work: (1) daemon \u2014 is exed PID alive, (2) cloud sync \u2014 grep workers.log for recent cloud-sync errors, (3) memory count \u2014 total in DB, (4) sync delta \u2014 local vs cloud storage_bytes. Report as 4-line status table. If ANY check fails, surface to founder immediately. Do not proceed to tasks until health confirmed."
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
title: "exe-build-adv mandatory for 3+ files",
|
|
342
|
+
domain: "workflow",
|
|
343
|
+
priority: "p0",
|
|
344
|
+
content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
title: "Desktop and TUI are the same product",
|
|
348
|
+
domain: "architecture",
|
|
349
|
+
priority: "p0",
|
|
350
|
+
content: "Desktop and TUI are the SAME product in different renderers. Same data contracts, same interactions, same acceptance criteria. Desktop tab specs in ARCHITECTURE.md ARE the TUI specs. When building TUI, cross-reference Desktop spec. Different tab names, identical behavior. Never treat them as separate products."
|
|
351
|
+
}
|
|
352
|
+
];
|
|
353
|
+
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
354
|
+
PLATFORM_PROCEDURES.map((p) => p.title)
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
|
|
262
359
|
// src/lib/global-procedures.ts
|
|
263
360
|
import { randomUUID } from "crypto";
|
|
264
361
|
function getGlobalProceduresBlock() {
|
|
265
|
-
|
|
266
|
-
if (
|
|
362
|
+
const sections = [];
|
|
363
|
+
if (_platformCache) sections.push(_platformCache);
|
|
364
|
+
if (_cacheLoaded && _customerCache) sections.push(_customerCache);
|
|
365
|
+
if (sections.length === 0) return "";
|
|
267
366
|
return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
|
|
268
367
|
|
|
269
|
-
${
|
|
368
|
+
${sections.join("\n\n")}
|
|
270
369
|
`;
|
|
271
370
|
}
|
|
272
|
-
var
|
|
371
|
+
var _customerCache, _cacheLoaded, _platformCache;
|
|
273
372
|
var init_global_procedures = __esm({
|
|
274
373
|
"src/lib/global-procedures.ts"() {
|
|
275
374
|
"use strict";
|
|
276
375
|
init_database();
|
|
277
|
-
|
|
376
|
+
init_platform_procedures();
|
|
377
|
+
_customerCache = "";
|
|
278
378
|
_cacheLoaded = false;
|
|
379
|
+
_platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
|
|
380
|
+
${p.content}`).join("\n\n");
|
|
279
381
|
}
|
|
280
382
|
});
|
|
281
383
|
|
package/dist/bin/exe-doctor.js
CHANGED
|
@@ -1346,6 +1346,103 @@ var init_shard_manager = __esm({
|
|
|
1346
1346
|
}
|
|
1347
1347
|
});
|
|
1348
1348
|
|
|
1349
|
+
// src/lib/platform-procedures.ts
|
|
1350
|
+
var PLATFORM_PROCEDURES, PLATFORM_PROCEDURE_TITLES;
|
|
1351
|
+
var init_platform_procedures = __esm({
|
|
1352
|
+
"src/lib/platform-procedures.ts"() {
|
|
1353
|
+
"use strict";
|
|
1354
|
+
PLATFORM_PROCEDURES = [
|
|
1355
|
+
// --- Foundation: what is exe-os ---
|
|
1356
|
+
{
|
|
1357
|
+
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1358
|
+
domain: "architecture",
|
|
1359
|
+
priority: "p0",
|
|
1360
|
+
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO (exe), CTO (yoshi), CMO (mari), engineers (tom), content (sasha). 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."
|
|
1361
|
+
},
|
|
1362
|
+
{
|
|
1363
|
+
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1364
|
+
domain: "architecture",
|
|
1365
|
+
priority: "p0",
|
|
1366
|
+
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC, runs /exe to boot the COO. exe manages employees in tmux sessions. Each exeN is a separate CC window/project. Employees (yoshi, tom, mari) run in their own tmux panes via create_task auto-spawn. The founder talks to exe; exe orchestrates the team. CC is the shell, exe-os is the brain."
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
title: "Sessions explained \u2014 what exeN means and how projects work",
|
|
1370
|
+
domain: "architecture",
|
|
1371
|
+
priority: "p0",
|
|
1372
|
+
content: "Each exeN (exe1, exe2, exe3) is an isolated project session. exe1 might be exe-os development, exe2 might be exe-wiki. Each session spawns its own employees: exe1\u2192yoshi-exe1\u2192tom-exe1. 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."
|
|
1373
|
+
},
|
|
1374
|
+
// --- Hierarchy and dispatch ---
|
|
1375
|
+
{
|
|
1376
|
+
title: "Chain of command \u2014 who talks to whom",
|
|
1377
|
+
domain: "workflow",
|
|
1378
|
+
priority: "p0",
|
|
1379
|
+
content: "Founder \u2192 exe (COO) \u2192 yoshi (CTO) / mari (CMO). Yoshi \u2192 tom (engineer). Mari \u2192 sasha (content). Never skip levels: exe never assigns directly to tom. Tom never reports directly to exe. 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."
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
title: "Single dispatch path \u2014 create_task only",
|
|
1383
|
+
domain: "workflow",
|
|
1384
|
+
priority: "p0",
|
|
1385
|
+
content: "create_task is the ONLY way to dispatch work to another agent. No direct ensureEmployee calls, no manual tmux spawns, no send_message for actionable work. create_task \u2192 system auto-spawns \u2192 session correctly named. ONE PATH. No backdoors. No exceptions."
|
|
1386
|
+
},
|
|
1387
|
+
// --- Session isolation ---
|
|
1388
|
+
{
|
|
1389
|
+
title: "Session scoping \u2014 stay in your exe boundary",
|
|
1390
|
+
domain: "security",
|
|
1391
|
+
priority: "p0",
|
|
1392
|
+
content: "Session scoping is mandatory. Managers dispatch to workers within their own exe session ONLY. exe1\u2192yoshi-exe1\u2192tom-exe1. exe2\u2192yoshi-exe2\u2192tom2-exe2. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating exe session."
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
title: "Session isolation \u2014 never touch another session's work",
|
|
1396
|
+
domain: "workflow",
|
|
1397
|
+
priority: "p0",
|
|
1398
|
+
content: `Sessions are isolated. exeN owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another exe session. (2) Never review work from a different session \u2014 report "belongs to exeN" and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: yoshi-exe1 works ONLY on exe1 tasks. Cross-session work is a system violation.`
|
|
1399
|
+
},
|
|
1400
|
+
// --- Engineering: session scoping in code ---
|
|
1401
|
+
{
|
|
1402
|
+
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1403
|
+
domain: "architecture",
|
|
1404
|
+
priority: "p0",
|
|
1405
|
+
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 exeN. (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+ exe sessions simultaneously."
|
|
1406
|
+
},
|
|
1407
|
+
// --- Hard constraints ---
|
|
1408
|
+
{
|
|
1409
|
+
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1410
|
+
domain: "security",
|
|
1411
|
+
priority: "p0",
|
|
1412
|
+
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 exe reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
|
|
1413
|
+
},
|
|
1414
|
+
// --- Operations ---
|
|
1415
|
+
{
|
|
1416
|
+
title: "Managers must supervise deployed workers",
|
|
1417
|
+
domain: "workflow",
|
|
1418
|
+
priority: "p0",
|
|
1419
|
+
content: `Every manager (COO/CTO/CMO) who dispatches work to a worker MUST actively monitor them. Check tmux capture-pane every 10 minutes. Verify they're working, not stuck. If idle at prompt with in_progress task \u2192 send intercom. If stuck \u2192 unblock or escalate. "Standing by" without checking is negligence.`
|
|
1420
|
+
},
|
|
1421
|
+
{
|
|
1422
|
+
title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
|
|
1423
|
+
domain: "workflow",
|
|
1424
|
+
priority: "p0",
|
|
1425
|
+
content: "On every /exe boot, COO MUST check system health BEFORE other work: (1) daemon \u2014 is exed PID alive, (2) cloud sync \u2014 grep workers.log for recent cloud-sync errors, (3) memory count \u2014 total in DB, (4) sync delta \u2014 local vs cloud storage_bytes. Report as 4-line status table. If ANY check fails, surface to founder immediately. Do not proceed to tasks until health confirmed."
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
title: "exe-build-adv mandatory for 3+ files",
|
|
1429
|
+
domain: "workflow",
|
|
1430
|
+
priority: "p0",
|
|
1431
|
+
content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
title: "Desktop and TUI are the same product",
|
|
1435
|
+
domain: "architecture",
|
|
1436
|
+
priority: "p0",
|
|
1437
|
+
content: "Desktop and TUI are the SAME product in different renderers. Same data contracts, same interactions, same acceptance criteria. Desktop tab specs in ARCHITECTURE.md ARE the TUI specs. When building TUI, cross-reference Desktop spec. Different tab names, identical behavior. Never treat them as separate products."
|
|
1438
|
+
}
|
|
1439
|
+
];
|
|
1440
|
+
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
1441
|
+
PLATFORM_PROCEDURES.map((p) => p.title)
|
|
1442
|
+
);
|
|
1443
|
+
}
|
|
1444
|
+
});
|
|
1445
|
+
|
|
1349
1446
|
// src/lib/global-procedures.ts
|
|
1350
1447
|
var global_procedures_exports = {};
|
|
1351
1448
|
__export(global_procedures_exports, {
|
|
@@ -1361,22 +1458,25 @@ async function loadGlobalProcedures() {
|
|
|
1361
1458
|
sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
1362
1459
|
args: []
|
|
1363
1460
|
});
|
|
1364
|
-
const
|
|
1365
|
-
|
|
1366
|
-
|
|
1461
|
+
const allRows = result.rows;
|
|
1462
|
+
const customerOnly = allRows.filter((p) => !PLATFORM_PROCEDURE_TITLES.has(p.title));
|
|
1463
|
+
if (customerOnly.length > 0) {
|
|
1464
|
+
_customerCache = customerOnly.map((p) => `### ${p.title}
|
|
1367
1465
|
${p.content}`).join("\n\n");
|
|
1368
1466
|
} else {
|
|
1369
|
-
|
|
1467
|
+
_customerCache = "";
|
|
1370
1468
|
}
|
|
1371
1469
|
_cacheLoaded = true;
|
|
1372
|
-
return
|
|
1470
|
+
return customerOnly;
|
|
1373
1471
|
}
|
|
1374
1472
|
function getGlobalProceduresBlock() {
|
|
1375
|
-
|
|
1376
|
-
if (
|
|
1473
|
+
const sections = [];
|
|
1474
|
+
if (_platformCache) sections.push(_platformCache);
|
|
1475
|
+
if (_cacheLoaded && _customerCache) sections.push(_customerCache);
|
|
1476
|
+
if (sections.length === 0) return "";
|
|
1377
1477
|
return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
|
|
1378
1478
|
|
|
1379
|
-
${
|
|
1479
|
+
${sections.join("\n\n")}
|
|
1380
1480
|
`;
|
|
1381
1481
|
}
|
|
1382
1482
|
async function storeGlobalProcedure(input) {
|
|
@@ -1401,13 +1501,74 @@ async function deactivateGlobalProcedure(id) {
|
|
|
1401
1501
|
await loadGlobalProcedures();
|
|
1402
1502
|
return result.rowsAffected > 0;
|
|
1403
1503
|
}
|
|
1404
|
-
var
|
|
1504
|
+
var _customerCache, _cacheLoaded, _platformCache;
|
|
1405
1505
|
var init_global_procedures = __esm({
|
|
1406
1506
|
"src/lib/global-procedures.ts"() {
|
|
1407
1507
|
"use strict";
|
|
1408
1508
|
init_database();
|
|
1409
|
-
|
|
1509
|
+
init_platform_procedures();
|
|
1510
|
+
_customerCache = "";
|
|
1410
1511
|
_cacheLoaded = false;
|
|
1512
|
+
_platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
|
|
1513
|
+
${p.content}`).join("\n\n");
|
|
1514
|
+
}
|
|
1515
|
+
});
|
|
1516
|
+
|
|
1517
|
+
// src/lib/worker-gate.ts
|
|
1518
|
+
var worker_gate_exports = {};
|
|
1519
|
+
__export(worker_gate_exports, {
|
|
1520
|
+
MAX_CONCURRENT_WORKERS: () => MAX_CONCURRENT_WORKERS,
|
|
1521
|
+
cleanupWorkerPid: () => cleanupWorkerPid,
|
|
1522
|
+
registerWorkerPid: () => registerWorkerPid,
|
|
1523
|
+
tryAcquireWorkerSlot: () => tryAcquireWorkerSlot
|
|
1524
|
+
});
|
|
1525
|
+
import { readdirSync as readdirSync2, writeFileSync, unlinkSync, mkdirSync as mkdirSync2 } from "fs";
|
|
1526
|
+
import path4 from "path";
|
|
1527
|
+
function tryAcquireWorkerSlot() {
|
|
1528
|
+
try {
|
|
1529
|
+
mkdirSync2(WORKER_PID_DIR, { recursive: true });
|
|
1530
|
+
const files = readdirSync2(WORKER_PID_DIR);
|
|
1531
|
+
let alive = 0;
|
|
1532
|
+
for (const f of files) {
|
|
1533
|
+
if (!f.endsWith(".pid")) continue;
|
|
1534
|
+
const dashIdx = f.lastIndexOf("-");
|
|
1535
|
+
const pid = parseInt(f.slice(dashIdx + 1).replace(".pid", ""), 10);
|
|
1536
|
+
if (isNaN(pid)) continue;
|
|
1537
|
+
try {
|
|
1538
|
+
process.kill(pid, 0);
|
|
1539
|
+
alive++;
|
|
1540
|
+
} catch {
|
|
1541
|
+
try {
|
|
1542
|
+
unlinkSync(path4.join(WORKER_PID_DIR, f));
|
|
1543
|
+
} catch {
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
return alive < MAX_CONCURRENT_WORKERS;
|
|
1548
|
+
} catch {
|
|
1549
|
+
return true;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
function registerWorkerPid(pid) {
|
|
1553
|
+
try {
|
|
1554
|
+
mkdirSync2(WORKER_PID_DIR, { recursive: true });
|
|
1555
|
+
writeFileSync(path4.join(WORKER_PID_DIR, `worker-${pid}.pid`), String(pid));
|
|
1556
|
+
} catch {
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
function cleanupWorkerPid() {
|
|
1560
|
+
try {
|
|
1561
|
+
unlinkSync(path4.join(WORKER_PID_DIR, `worker-${process.pid}.pid`));
|
|
1562
|
+
} catch {
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
var WORKER_PID_DIR, MAX_CONCURRENT_WORKERS;
|
|
1566
|
+
var init_worker_gate = __esm({
|
|
1567
|
+
"src/lib/worker-gate.ts"() {
|
|
1568
|
+
"use strict";
|
|
1569
|
+
init_config();
|
|
1570
|
+
WORKER_PID_DIR = path4.join(EXE_AI_DIR, "worker-pids");
|
|
1571
|
+
MAX_CONCURRENT_WORKERS = 3;
|
|
1411
1572
|
}
|
|
1412
1573
|
});
|
|
1413
1574
|
|
|
@@ -1608,7 +1769,7 @@ function isMainModule(importMetaUrl) {
|
|
|
1608
1769
|
// src/bin/exe-doctor.ts
|
|
1609
1770
|
import { existsSync as existsSync4 } from "fs";
|
|
1610
1771
|
import { spawn } from "child_process";
|
|
1611
|
-
import
|
|
1772
|
+
import path5 from "path";
|
|
1612
1773
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
1613
1774
|
function parseFlags(argv) {
|
|
1614
1775
|
const flags = { fix: false, dryRun: false, verbose: false };
|
|
@@ -1749,7 +1910,7 @@ async function auditOrphanedProjects(client) {
|
|
|
1749
1910
|
for (const row of result.rows) {
|
|
1750
1911
|
const name = row.project_name;
|
|
1751
1912
|
const count = Number(row.cnt);
|
|
1752
|
-
const exists = existsSync4(
|
|
1913
|
+
const exists = existsSync4(path5.join(home, name)) || existsSync4(path5.join(home, "..", name)) || existsSync4(path5.join(process.cwd(), "..", name));
|
|
1753
1914
|
if (!exists) {
|
|
1754
1915
|
orphans.push({ project_name: name, count });
|
|
1755
1916
|
}
|
|
@@ -1858,10 +2019,19 @@ function formatReport(report, flags) {
|
|
|
1858
2019
|
return lines.join("\n");
|
|
1859
2020
|
}
|
|
1860
2021
|
async function fixNullVectors() {
|
|
2022
|
+
const { tryAcquireWorkerSlot: tryAcquireWorkerSlot2, registerWorkerPid: registerWorkerPid2 } = await Promise.resolve().then(() => (init_worker_gate(), worker_gate_exports));
|
|
2023
|
+
if (!tryAcquireWorkerSlot2()) {
|
|
2024
|
+
process.stderr.write("[exe-doctor] Worker gate full \u2014 waiting for existing backfill workers to finish\n");
|
|
2025
|
+
await new Promise((r) => setTimeout(r, 5e3));
|
|
2026
|
+
if (!tryAcquireWorkerSlot2()) {
|
|
2027
|
+
throw new Error("Worker gate still full after 5s \u2014 try again later or kill stale workers");
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
1861
2030
|
const npmRoot = (await import("child_process")).execSync("npm root -g", { encoding: "utf8" }).trim();
|
|
1862
|
-
const backfillPath =
|
|
2031
|
+
const backfillPath = path5.join(npmRoot, "exe-os", "dist", "bin", "backfill-vectors.js");
|
|
1863
2032
|
return new Promise((resolve, reject) => {
|
|
1864
2033
|
const child = spawn("node", [backfillPath], { stdio: "inherit" });
|
|
2034
|
+
if (child.pid) registerWorkerPid2(child.pid);
|
|
1865
2035
|
child.on("close", (code) => {
|
|
1866
2036
|
if (code === 0) resolve();
|
|
1867
2037
|
else reject(new Error(`backfill-vectors exited with code ${code}`));
|
|
@@ -1354,6 +1354,103 @@ var init_shard_manager = __esm({
|
|
|
1354
1354
|
}
|
|
1355
1355
|
});
|
|
1356
1356
|
|
|
1357
|
+
// src/lib/platform-procedures.ts
|
|
1358
|
+
var PLATFORM_PROCEDURES, PLATFORM_PROCEDURE_TITLES;
|
|
1359
|
+
var init_platform_procedures = __esm({
|
|
1360
|
+
"src/lib/platform-procedures.ts"() {
|
|
1361
|
+
"use strict";
|
|
1362
|
+
PLATFORM_PROCEDURES = [
|
|
1363
|
+
// --- Foundation: what is exe-os ---
|
|
1364
|
+
{
|
|
1365
|
+
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1366
|
+
domain: "architecture",
|
|
1367
|
+
priority: "p0",
|
|
1368
|
+
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO (exe), CTO (yoshi), CMO (mari), engineers (tom), content (sasha). 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."
|
|
1369
|
+
},
|
|
1370
|
+
{
|
|
1371
|
+
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1372
|
+
domain: "architecture",
|
|
1373
|
+
priority: "p0",
|
|
1374
|
+
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC, runs /exe to boot the COO. exe manages employees in tmux sessions. Each exeN is a separate CC window/project. Employees (yoshi, tom, mari) run in their own tmux panes via create_task auto-spawn. The founder talks to exe; exe orchestrates the team. CC is the shell, exe-os is the brain."
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
title: "Sessions explained \u2014 what exeN means and how projects work",
|
|
1378
|
+
domain: "architecture",
|
|
1379
|
+
priority: "p0",
|
|
1380
|
+
content: "Each exeN (exe1, exe2, exe3) is an isolated project session. exe1 might be exe-os development, exe2 might be exe-wiki. Each session spawns its own employees: exe1\u2192yoshi-exe1\u2192tom-exe1. 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."
|
|
1381
|
+
},
|
|
1382
|
+
// --- Hierarchy and dispatch ---
|
|
1383
|
+
{
|
|
1384
|
+
title: "Chain of command \u2014 who talks to whom",
|
|
1385
|
+
domain: "workflow",
|
|
1386
|
+
priority: "p0",
|
|
1387
|
+
content: "Founder \u2192 exe (COO) \u2192 yoshi (CTO) / mari (CMO). Yoshi \u2192 tom (engineer). Mari \u2192 sasha (content). Never skip levels: exe never assigns directly to tom. Tom never reports directly to exe. 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."
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
title: "Single dispatch path \u2014 create_task only",
|
|
1391
|
+
domain: "workflow",
|
|
1392
|
+
priority: "p0",
|
|
1393
|
+
content: "create_task is the ONLY way to dispatch work to another agent. No direct ensureEmployee calls, no manual tmux spawns, no send_message for actionable work. create_task \u2192 system auto-spawns \u2192 session correctly named. ONE PATH. No backdoors. No exceptions."
|
|
1394
|
+
},
|
|
1395
|
+
// --- Session isolation ---
|
|
1396
|
+
{
|
|
1397
|
+
title: "Session scoping \u2014 stay in your exe boundary",
|
|
1398
|
+
domain: "security",
|
|
1399
|
+
priority: "p0",
|
|
1400
|
+
content: "Session scoping is mandatory. Managers dispatch to workers within their own exe session ONLY. exe1\u2192yoshi-exe1\u2192tom-exe1. exe2\u2192yoshi-exe2\u2192tom2-exe2. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating exe session."
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
title: "Session isolation \u2014 never touch another session's work",
|
|
1404
|
+
domain: "workflow",
|
|
1405
|
+
priority: "p0",
|
|
1406
|
+
content: `Sessions are isolated. exeN owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another exe session. (2) Never review work from a different session \u2014 report "belongs to exeN" and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: yoshi-exe1 works ONLY on exe1 tasks. Cross-session work is a system violation.`
|
|
1407
|
+
},
|
|
1408
|
+
// --- Engineering: session scoping in code ---
|
|
1409
|
+
{
|
|
1410
|
+
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1411
|
+
domain: "architecture",
|
|
1412
|
+
priority: "p0",
|
|
1413
|
+
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 exeN. (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+ exe sessions simultaneously."
|
|
1414
|
+
},
|
|
1415
|
+
// --- Hard constraints ---
|
|
1416
|
+
{
|
|
1417
|
+
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1418
|
+
domain: "security",
|
|
1419
|
+
priority: "p0",
|
|
1420
|
+
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 exe reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
|
|
1421
|
+
},
|
|
1422
|
+
// --- Operations ---
|
|
1423
|
+
{
|
|
1424
|
+
title: "Managers must supervise deployed workers",
|
|
1425
|
+
domain: "workflow",
|
|
1426
|
+
priority: "p0",
|
|
1427
|
+
content: `Every manager (COO/CTO/CMO) who dispatches work to a worker MUST actively monitor them. Check tmux capture-pane every 10 minutes. Verify they're working, not stuck. If idle at prompt with in_progress task \u2192 send intercom. If stuck \u2192 unblock or escalate. "Standing by" without checking is negligence.`
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
|
|
1431
|
+
domain: "workflow",
|
|
1432
|
+
priority: "p0",
|
|
1433
|
+
content: "On every /exe boot, COO MUST check system health BEFORE other work: (1) daemon \u2014 is exed PID alive, (2) cloud sync \u2014 grep workers.log for recent cloud-sync errors, (3) memory count \u2014 total in DB, (4) sync delta \u2014 local vs cloud storage_bytes. Report as 4-line status table. If ANY check fails, surface to founder immediately. Do not proceed to tasks until health confirmed."
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
title: "exe-build-adv mandatory for 3+ files",
|
|
1437
|
+
domain: "workflow",
|
|
1438
|
+
priority: "p0",
|
|
1439
|
+
content: "exe-build-adv is MANDATORY for ALL work touching 3+ files. Run /exe-build-adv --auto BEFORE implementation. Pipeline: Spec \u2192 AC \u2192 Tests \u2192 Evaluate \u2192 Fix. No multi-file feature ships without pipeline artifacts. No exceptions \u2014 managers reject work without them."
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
title: "Desktop and TUI are the same product",
|
|
1443
|
+
domain: "architecture",
|
|
1444
|
+
priority: "p0",
|
|
1445
|
+
content: "Desktop and TUI are the SAME product in different renderers. Same data contracts, same interactions, same acceptance criteria. Desktop tab specs in ARCHITECTURE.md ARE the TUI specs. When building TUI, cross-reference Desktop spec. Different tab names, identical behavior. Never treat them as separate products."
|
|
1446
|
+
}
|
|
1447
|
+
];
|
|
1448
|
+
PLATFORM_PROCEDURE_TITLES = new Set(
|
|
1449
|
+
PLATFORM_PROCEDURES.map((p) => p.title)
|
|
1450
|
+
);
|
|
1451
|
+
}
|
|
1452
|
+
});
|
|
1453
|
+
|
|
1357
1454
|
// src/lib/global-procedures.ts
|
|
1358
1455
|
var global_procedures_exports = {};
|
|
1359
1456
|
__export(global_procedures_exports, {
|
|
@@ -1369,22 +1466,25 @@ async function loadGlobalProcedures() {
|
|
|
1369
1466
|
sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
|
|
1370
1467
|
args: []
|
|
1371
1468
|
});
|
|
1372
|
-
const
|
|
1373
|
-
|
|
1374
|
-
|
|
1469
|
+
const allRows = result.rows;
|
|
1470
|
+
const customerOnly = allRows.filter((p) => !PLATFORM_PROCEDURE_TITLES.has(p.title));
|
|
1471
|
+
if (customerOnly.length > 0) {
|
|
1472
|
+
_customerCache = customerOnly.map((p) => `### ${p.title}
|
|
1375
1473
|
${p.content}`).join("\n\n");
|
|
1376
1474
|
} else {
|
|
1377
|
-
|
|
1475
|
+
_customerCache = "";
|
|
1378
1476
|
}
|
|
1379
1477
|
_cacheLoaded = true;
|
|
1380
|
-
return
|
|
1478
|
+
return customerOnly;
|
|
1381
1479
|
}
|
|
1382
1480
|
function getGlobalProceduresBlock() {
|
|
1383
|
-
|
|
1384
|
-
if (
|
|
1481
|
+
const sections = [];
|
|
1482
|
+
if (_platformCache) sections.push(_platformCache);
|
|
1483
|
+
if (_cacheLoaded && _customerCache) sections.push(_customerCache);
|
|
1484
|
+
if (sections.length === 0) return "";
|
|
1385
1485
|
return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
|
|
1386
1486
|
|
|
1387
|
-
${
|
|
1487
|
+
${sections.join("\n\n")}
|
|
1388
1488
|
`;
|
|
1389
1489
|
}
|
|
1390
1490
|
async function storeGlobalProcedure(input) {
|
|
@@ -1409,13 +1509,16 @@ async function deactivateGlobalProcedure(id) {
|
|
|
1409
1509
|
await loadGlobalProcedures();
|
|
1410
1510
|
return result.rowsAffected > 0;
|
|
1411
1511
|
}
|
|
1412
|
-
var
|
|
1512
|
+
var _customerCache, _cacheLoaded, _platformCache;
|
|
1413
1513
|
var init_global_procedures = __esm({
|
|
1414
1514
|
"src/lib/global-procedures.ts"() {
|
|
1415
1515
|
"use strict";
|
|
1416
1516
|
init_database();
|
|
1417
|
-
|
|
1517
|
+
init_platform_procedures();
|
|
1518
|
+
_customerCache = "";
|
|
1418
1519
|
_cacheLoaded = false;
|
|
1520
|
+
_platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
|
|
1521
|
+
${p.content}`).join("\n\n");
|
|
1419
1522
|
}
|
|
1420
1523
|
});
|
|
1421
1524
|
|