@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.
Files changed (67) hide show
  1. package/dist/bin/backfill-conversations.js +113 -10
  2. package/dist/bin/backfill-responses.js +113 -10
  3. package/dist/bin/backfill-vectors.js +147 -13
  4. package/dist/bin/cleanup-stale-review-tasks.js +113 -10
  5. package/dist/bin/cli.js +337 -211
  6. package/dist/bin/exe-agent.js +99 -4
  7. package/dist/bin/exe-assign.js +113 -10
  8. package/dist/bin/exe-boot.js +276 -85
  9. package/dist/bin/exe-call.js +107 -5
  10. package/dist/bin/exe-doctor.js +183 -13
  11. package/dist/bin/exe-export-behaviors.js +113 -10
  12. package/dist/bin/exe-forget.js +113 -10
  13. package/dist/bin/exe-gateway.js +131 -12
  14. package/dist/bin/exe-heartbeat.js +121 -11
  15. package/dist/bin/exe-kill.js +113 -10
  16. package/dist/bin/exe-launch-agent.js +113 -10
  17. package/dist/bin/exe-link.js +10 -2
  18. package/dist/bin/exe-new-employee.js +95 -0
  19. package/dist/bin/exe-pending-messages.js +113 -10
  20. package/dist/bin/exe-pending-notifications.js +113 -10
  21. package/dist/bin/exe-pending-reviews.js +122 -11
  22. package/dist/bin/exe-rename.js +95 -0
  23. package/dist/bin/exe-review.js +113 -10
  24. package/dist/bin/exe-search.js +113 -10
  25. package/dist/bin/exe-session-cleanup.js +131 -12
  26. package/dist/bin/exe-status.js +113 -10
  27. package/dist/bin/exe-team.js +113 -10
  28. package/dist/bin/git-sweep.js +131 -12
  29. package/dist/bin/graph-backfill.js +113 -10
  30. package/dist/bin/graph-export.js +113 -10
  31. package/dist/bin/scan-tasks.js +131 -12
  32. package/dist/bin/setup.js +107 -5
  33. package/dist/bin/shard-migrate.js +113 -10
  34. package/dist/bin/wiki-sync.js +113 -10
  35. package/dist/gateway/index.js +131 -12
  36. package/dist/hooks/bug-report-worker.js +131 -12
  37. package/dist/hooks/commit-complete.js +131 -12
  38. package/dist/hooks/error-recall.js +113 -10
  39. package/dist/hooks/ingest-worker.js +131 -12
  40. package/dist/hooks/instructions-loaded.js +113 -10
  41. package/dist/hooks/notification.js +113 -10
  42. package/dist/hooks/post-compact.js +113 -10
  43. package/dist/hooks/pre-compact.js +131 -12
  44. package/dist/hooks/pre-tool-use.js +113 -10
  45. package/dist/hooks/prompt-ingest-worker.js +113 -10
  46. package/dist/hooks/prompt-submit.js +140 -14
  47. package/dist/hooks/response-ingest-worker.js +113 -10
  48. package/dist/hooks/session-end.js +113 -10
  49. package/dist/hooks/session-start.js +113 -10
  50. package/dist/hooks/stop.js +113 -10
  51. package/dist/hooks/subagent-stop.js +113 -10
  52. package/dist/hooks/summary-worker.js +231 -114
  53. package/dist/index.js +131 -12
  54. package/dist/lib/cloud-sync.js +10 -2
  55. package/dist/lib/employee-templates.js +99 -4
  56. package/dist/lib/exe-daemon.js +4859 -4706
  57. package/dist/lib/hybrid-search.js +113 -10
  58. package/dist/lib/schedules.js +113 -10
  59. package/dist/lib/store.js +113 -10
  60. package/dist/lib/tasks.js +18 -2
  61. package/dist/lib/tmux-routing.js +18 -2
  62. package/dist/mcp/server.js +214 -28
  63. package/dist/mcp/tools/create-task.js +18 -2
  64. package/dist/mcp/tools/list-tasks.js +18 -2
  65. package/dist/runtime/index.js +131 -12
  66. package/dist/tui/App.js +337 -211
  67. package/package.json +2 -2
@@ -1526,6 +1526,103 @@ var init_shard_manager = __esm({
1526
1526
  }
1527
1527
  });
1528
1528
 
1529
+ // src/lib/platform-procedures.ts
1530
+ var PLATFORM_PROCEDURES, PLATFORM_PROCEDURE_TITLES;
1531
+ var init_platform_procedures = __esm({
1532
+ "src/lib/platform-procedures.ts"() {
1533
+ "use strict";
1534
+ PLATFORM_PROCEDURES = [
1535
+ // --- Foundation: what is exe-os ---
1536
+ {
1537
+ title: "What is exe-os \u2014 the operating model every agent must understand",
1538
+ domain: "architecture",
1539
+ priority: "p0",
1540
+ 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."
1541
+ },
1542
+ {
1543
+ title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
1544
+ domain: "architecture",
1545
+ priority: "p0",
1546
+ 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."
1547
+ },
1548
+ {
1549
+ title: "Sessions explained \u2014 what exeN means and how projects work",
1550
+ domain: "architecture",
1551
+ priority: "p0",
1552
+ 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."
1553
+ },
1554
+ // --- Hierarchy and dispatch ---
1555
+ {
1556
+ title: "Chain of command \u2014 who talks to whom",
1557
+ domain: "workflow",
1558
+ priority: "p0",
1559
+ 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."
1560
+ },
1561
+ {
1562
+ title: "Single dispatch path \u2014 create_task only",
1563
+ domain: "workflow",
1564
+ priority: "p0",
1565
+ 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."
1566
+ },
1567
+ // --- Session isolation ---
1568
+ {
1569
+ title: "Session scoping \u2014 stay in your exe boundary",
1570
+ domain: "security",
1571
+ priority: "p0",
1572
+ 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."
1573
+ },
1574
+ {
1575
+ title: "Session isolation \u2014 never touch another session's work",
1576
+ domain: "workflow",
1577
+ priority: "p0",
1578
+ 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.`
1579
+ },
1580
+ // --- Engineering: session scoping in code ---
1581
+ {
1582
+ title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
1583
+ domain: "architecture",
1584
+ priority: "p0",
1585
+ 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."
1586
+ },
1587
+ // --- Hard constraints ---
1588
+ {
1589
+ title: "What you CANNOT do in exe-os \u2014 hard constraints",
1590
+ domain: "security",
1591
+ priority: "p0",
1592
+ 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."
1593
+ },
1594
+ // --- Operations ---
1595
+ {
1596
+ title: "Managers must supervise deployed workers",
1597
+ domain: "workflow",
1598
+ priority: "p0",
1599
+ 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.`
1600
+ },
1601
+ {
1602
+ title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
1603
+ domain: "workflow",
1604
+ priority: "p0",
1605
+ 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."
1606
+ },
1607
+ {
1608
+ title: "exe-build-adv mandatory for 3+ files",
1609
+ domain: "workflow",
1610
+ priority: "p0",
1611
+ 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."
1612
+ },
1613
+ {
1614
+ title: "Desktop and TUI are the same product",
1615
+ domain: "architecture",
1616
+ priority: "p0",
1617
+ 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."
1618
+ }
1619
+ ];
1620
+ PLATFORM_PROCEDURE_TITLES = new Set(
1621
+ PLATFORM_PROCEDURES.map((p) => p.title)
1622
+ );
1623
+ }
1624
+ });
1625
+
1529
1626
  // src/lib/global-procedures.ts
1530
1627
  var global_procedures_exports = {};
1531
1628
  __export(global_procedures_exports, {
@@ -1541,22 +1638,25 @@ async function loadGlobalProcedures() {
1541
1638
  sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
1542
1639
  args: []
1543
1640
  });
1544
- const procedures = result.rows;
1545
- if (procedures.length > 0) {
1546
- _cache = procedures.map((p) => `### ${p.title}
1641
+ const allRows = result.rows;
1642
+ const customerOnly = allRows.filter((p) => !PLATFORM_PROCEDURE_TITLES.has(p.title));
1643
+ if (customerOnly.length > 0) {
1644
+ _customerCache = customerOnly.map((p) => `### ${p.title}
1547
1645
  ${p.content}`).join("\n\n");
1548
1646
  } else {
1549
- _cache = "";
1647
+ _customerCache = "";
1550
1648
  }
1551
1649
  _cacheLoaded = true;
1552
- return procedures;
1650
+ return customerOnly;
1553
1651
  }
1554
1652
  function getGlobalProceduresBlock() {
1555
- if (!_cacheLoaded) return "";
1556
- if (!_cache) return "";
1653
+ const sections = [];
1654
+ if (_platformCache) sections.push(_platformCache);
1655
+ if (_cacheLoaded && _customerCache) sections.push(_customerCache);
1656
+ if (sections.length === 0) return "";
1557
1657
  return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
1558
1658
 
1559
- ${_cache}
1659
+ ${sections.join("\n\n")}
1560
1660
  `;
1561
1661
  }
1562
1662
  async function storeGlobalProcedure(input) {
@@ -1581,13 +1681,16 @@ async function deactivateGlobalProcedure(id) {
1581
1681
  await loadGlobalProcedures();
1582
1682
  return result.rowsAffected > 0;
1583
1683
  }
1584
- var _cache, _cacheLoaded;
1684
+ var _customerCache, _cacheLoaded, _platformCache;
1585
1685
  var init_global_procedures = __esm({
1586
1686
  "src/lib/global-procedures.ts"() {
1587
1687
  "use strict";
1588
1688
  init_database();
1589
- _cache = "";
1689
+ init_platform_procedures();
1690
+ _customerCache = "";
1590
1691
  _cacheLoaded = false;
1692
+ _platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
1693
+ ${p.content}`).join("\n\n");
1591
1694
  }
1592
1695
  });
1593
1696
 
@@ -1348,6 +1348,103 @@ var init_shard_manager = __esm({
1348
1348
  }
1349
1349
  });
1350
1350
 
1351
+ // src/lib/platform-procedures.ts
1352
+ var PLATFORM_PROCEDURES, PLATFORM_PROCEDURE_TITLES;
1353
+ var init_platform_procedures = __esm({
1354
+ "src/lib/platform-procedures.ts"() {
1355
+ "use strict";
1356
+ PLATFORM_PROCEDURES = [
1357
+ // --- Foundation: what is exe-os ---
1358
+ {
1359
+ title: "What is exe-os \u2014 the operating model every agent must understand",
1360
+ domain: "architecture",
1361
+ priority: "p0",
1362
+ 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."
1363
+ },
1364
+ {
1365
+ title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
1366
+ domain: "architecture",
1367
+ priority: "p0",
1368
+ 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."
1369
+ },
1370
+ {
1371
+ title: "Sessions explained \u2014 what exeN means and how projects work",
1372
+ domain: "architecture",
1373
+ priority: "p0",
1374
+ 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."
1375
+ },
1376
+ // --- Hierarchy and dispatch ---
1377
+ {
1378
+ title: "Chain of command \u2014 who talks to whom",
1379
+ domain: "workflow",
1380
+ priority: "p0",
1381
+ 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."
1382
+ },
1383
+ {
1384
+ title: "Single dispatch path \u2014 create_task only",
1385
+ domain: "workflow",
1386
+ priority: "p0",
1387
+ 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."
1388
+ },
1389
+ // --- Session isolation ---
1390
+ {
1391
+ title: "Session scoping \u2014 stay in your exe boundary",
1392
+ domain: "security",
1393
+ priority: "p0",
1394
+ 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."
1395
+ },
1396
+ {
1397
+ title: "Session isolation \u2014 never touch another session's work",
1398
+ domain: "workflow",
1399
+ priority: "p0",
1400
+ 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.`
1401
+ },
1402
+ // --- Engineering: session scoping in code ---
1403
+ {
1404
+ title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
1405
+ domain: "architecture",
1406
+ priority: "p0",
1407
+ 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."
1408
+ },
1409
+ // --- Hard constraints ---
1410
+ {
1411
+ title: "What you CANNOT do in exe-os \u2014 hard constraints",
1412
+ domain: "security",
1413
+ priority: "p0",
1414
+ 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."
1415
+ },
1416
+ // --- Operations ---
1417
+ {
1418
+ title: "Managers must supervise deployed workers",
1419
+ domain: "workflow",
1420
+ priority: "p0",
1421
+ 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.`
1422
+ },
1423
+ {
1424
+ title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
1425
+ domain: "workflow",
1426
+ priority: "p0",
1427
+ 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."
1428
+ },
1429
+ {
1430
+ title: "exe-build-adv mandatory for 3+ files",
1431
+ domain: "workflow",
1432
+ priority: "p0",
1433
+ 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."
1434
+ },
1435
+ {
1436
+ title: "Desktop and TUI are the same product",
1437
+ domain: "architecture",
1438
+ priority: "p0",
1439
+ 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."
1440
+ }
1441
+ ];
1442
+ PLATFORM_PROCEDURE_TITLES = new Set(
1443
+ PLATFORM_PROCEDURES.map((p) => p.title)
1444
+ );
1445
+ }
1446
+ });
1447
+
1351
1448
  // src/lib/global-procedures.ts
1352
1449
  var global_procedures_exports = {};
1353
1450
  __export(global_procedures_exports, {
@@ -1363,22 +1460,25 @@ async function loadGlobalProcedures() {
1363
1460
  sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
1364
1461
  args: []
1365
1462
  });
1366
- const procedures = result.rows;
1367
- if (procedures.length > 0) {
1368
- _cache = procedures.map((p) => `### ${p.title}
1463
+ const allRows = result.rows;
1464
+ const customerOnly = allRows.filter((p) => !PLATFORM_PROCEDURE_TITLES.has(p.title));
1465
+ if (customerOnly.length > 0) {
1466
+ _customerCache = customerOnly.map((p) => `### ${p.title}
1369
1467
  ${p.content}`).join("\n\n");
1370
1468
  } else {
1371
- _cache = "";
1469
+ _customerCache = "";
1372
1470
  }
1373
1471
  _cacheLoaded = true;
1374
- return procedures;
1472
+ return customerOnly;
1375
1473
  }
1376
1474
  function getGlobalProceduresBlock() {
1377
- if (!_cacheLoaded) return "";
1378
- if (!_cache) return "";
1475
+ const sections = [];
1476
+ if (_platformCache) sections.push(_platformCache);
1477
+ if (_cacheLoaded && _customerCache) sections.push(_customerCache);
1478
+ if (sections.length === 0) return "";
1379
1479
  return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
1380
1480
 
1381
- ${_cache}
1481
+ ${sections.join("\n\n")}
1382
1482
  `;
1383
1483
  }
1384
1484
  async function storeGlobalProcedure(input) {
@@ -1403,13 +1503,16 @@ async function deactivateGlobalProcedure(id) {
1403
1503
  await loadGlobalProcedures();
1404
1504
  return result.rowsAffected > 0;
1405
1505
  }
1406
- var _cache, _cacheLoaded;
1506
+ var _customerCache, _cacheLoaded, _platformCache;
1407
1507
  var init_global_procedures = __esm({
1408
1508
  "src/lib/global-procedures.ts"() {
1409
1509
  "use strict";
1410
1510
  init_database();
1411
- _cache = "";
1511
+ init_platform_procedures();
1512
+ _customerCache = "";
1412
1513
  _cacheLoaded = false;
1514
+ _platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
1515
+ ${p.content}`).join("\n\n");
1413
1516
  }
1414
1517
  });
1415
1518
 
package/dist/lib/store.js CHANGED
@@ -1353,6 +1353,103 @@ var init_shard_manager = __esm({
1353
1353
  }
1354
1354
  });
1355
1355
 
1356
+ // src/lib/platform-procedures.ts
1357
+ var PLATFORM_PROCEDURES, PLATFORM_PROCEDURE_TITLES;
1358
+ var init_platform_procedures = __esm({
1359
+ "src/lib/platform-procedures.ts"() {
1360
+ "use strict";
1361
+ PLATFORM_PROCEDURES = [
1362
+ // --- Foundation: what is exe-os ---
1363
+ {
1364
+ title: "What is exe-os \u2014 the operating model every agent must understand",
1365
+ domain: "architecture",
1366
+ priority: "p0",
1367
+ 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."
1368
+ },
1369
+ {
1370
+ title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
1371
+ domain: "architecture",
1372
+ priority: "p0",
1373
+ 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."
1374
+ },
1375
+ {
1376
+ title: "Sessions explained \u2014 what exeN means and how projects work",
1377
+ domain: "architecture",
1378
+ priority: "p0",
1379
+ 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."
1380
+ },
1381
+ // --- Hierarchy and dispatch ---
1382
+ {
1383
+ title: "Chain of command \u2014 who talks to whom",
1384
+ domain: "workflow",
1385
+ priority: "p0",
1386
+ 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."
1387
+ },
1388
+ {
1389
+ title: "Single dispatch path \u2014 create_task only",
1390
+ domain: "workflow",
1391
+ priority: "p0",
1392
+ 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."
1393
+ },
1394
+ // --- Session isolation ---
1395
+ {
1396
+ title: "Session scoping \u2014 stay in your exe boundary",
1397
+ domain: "security",
1398
+ priority: "p0",
1399
+ 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."
1400
+ },
1401
+ {
1402
+ title: "Session isolation \u2014 never touch another session's work",
1403
+ domain: "workflow",
1404
+ priority: "p0",
1405
+ 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.`
1406
+ },
1407
+ // --- Engineering: session scoping in code ---
1408
+ {
1409
+ title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
1410
+ domain: "architecture",
1411
+ priority: "p0",
1412
+ 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."
1413
+ },
1414
+ // --- Hard constraints ---
1415
+ {
1416
+ title: "What you CANNOT do in exe-os \u2014 hard constraints",
1417
+ domain: "security",
1418
+ priority: "p0",
1419
+ 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."
1420
+ },
1421
+ // --- Operations ---
1422
+ {
1423
+ title: "Managers must supervise deployed workers",
1424
+ domain: "workflow",
1425
+ priority: "p0",
1426
+ 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.`
1427
+ },
1428
+ {
1429
+ title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
1430
+ domain: "workflow",
1431
+ priority: "p0",
1432
+ 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."
1433
+ },
1434
+ {
1435
+ title: "exe-build-adv mandatory for 3+ files",
1436
+ domain: "workflow",
1437
+ priority: "p0",
1438
+ 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."
1439
+ },
1440
+ {
1441
+ title: "Desktop and TUI are the same product",
1442
+ domain: "architecture",
1443
+ priority: "p0",
1444
+ 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."
1445
+ }
1446
+ ];
1447
+ PLATFORM_PROCEDURE_TITLES = new Set(
1448
+ PLATFORM_PROCEDURES.map((p) => p.title)
1449
+ );
1450
+ }
1451
+ });
1452
+
1356
1453
  // src/lib/global-procedures.ts
1357
1454
  var global_procedures_exports = {};
1358
1455
  __export(global_procedures_exports, {
@@ -1368,22 +1465,25 @@ async function loadGlobalProcedures() {
1368
1465
  sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
1369
1466
  args: []
1370
1467
  });
1371
- const procedures = result.rows;
1372
- if (procedures.length > 0) {
1373
- _cache = procedures.map((p) => `### ${p.title}
1468
+ const allRows = result.rows;
1469
+ const customerOnly = allRows.filter((p) => !PLATFORM_PROCEDURE_TITLES.has(p.title));
1470
+ if (customerOnly.length > 0) {
1471
+ _customerCache = customerOnly.map((p) => `### ${p.title}
1374
1472
  ${p.content}`).join("\n\n");
1375
1473
  } else {
1376
- _cache = "";
1474
+ _customerCache = "";
1377
1475
  }
1378
1476
  _cacheLoaded = true;
1379
- return procedures;
1477
+ return customerOnly;
1380
1478
  }
1381
1479
  function getGlobalProceduresBlock() {
1382
- if (!_cacheLoaded) return "";
1383
- if (!_cache) return "";
1480
+ const sections = [];
1481
+ if (_platformCache) sections.push(_platformCache);
1482
+ if (_cacheLoaded && _customerCache) sections.push(_customerCache);
1483
+ if (sections.length === 0) return "";
1384
1484
  return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
1385
1485
 
1386
- ${_cache}
1486
+ ${sections.join("\n\n")}
1387
1487
  `;
1388
1488
  }
1389
1489
  async function storeGlobalProcedure(input) {
@@ -1408,13 +1508,16 @@ async function deactivateGlobalProcedure(id) {
1408
1508
  await loadGlobalProcedures();
1409
1509
  return result.rowsAffected > 0;
1410
1510
  }
1411
- var _cache, _cacheLoaded;
1511
+ var _customerCache, _cacheLoaded, _platformCache;
1412
1512
  var init_global_procedures = __esm({
1413
1513
  "src/lib/global-procedures.ts"() {
1414
1514
  "use strict";
1415
1515
  init_database();
1416
- _cache = "";
1516
+ init_platform_procedures();
1517
+ _customerCache = "";
1417
1518
  _cacheLoaded = false;
1519
+ _platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
1520
+ ${p.content}`).join("\n\n");
1418
1521
  }
1419
1522
  });
1420
1523
 
package/dist/lib/tasks.js CHANGED
@@ -2153,16 +2153,32 @@ var init_tasks_crud = __esm({
2153
2153
  // src/lib/tasks-review.ts
2154
2154
  import path10 from "path";
2155
2155
  import { existsSync as existsSync10, readdirSync as readdirSync2, unlinkSync as unlinkSync3 } from "fs";
2156
- async function countPendingReviews() {
2156
+ async function countPendingReviews(sessionScope) {
2157
2157
  const client = getClient();
2158
+ if (sessionScope) {
2159
+ const result2 = await client.execute({
2160
+ sql: "SELECT COUNT(*) as cnt FROM tasks WHERE status = 'needs_review' AND (session_scope = ? OR session_scope IS NULL)",
2161
+ args: [sessionScope]
2162
+ });
2163
+ return Number(result2.rows[0]?.cnt) || 0;
2164
+ }
2158
2165
  const result = await client.execute({
2159
2166
  sql: "SELECT COUNT(*) as cnt FROM tasks WHERE status = 'needs_review'",
2160
2167
  args: []
2161
2168
  });
2162
2169
  return Number(result.rows[0]?.cnt) || 0;
2163
2170
  }
2164
- async function countNewPendingReviewsSince(sinceIso) {
2171
+ async function countNewPendingReviewsSince(sinceIso, sessionScope) {
2165
2172
  const client = getClient();
2173
+ if (sessionScope) {
2174
+ const result2 = await client.execute({
2175
+ sql: `SELECT COUNT(*) as cnt FROM tasks
2176
+ WHERE status = 'needs_review' AND updated_at > ?
2177
+ AND (session_scope = ? OR session_scope IS NULL)`,
2178
+ args: [sinceIso, sessionScope]
2179
+ });
2180
+ return Number(result2.rows[0]?.cnt) || 0;
2181
+ }
2166
2182
  const result = await client.execute({
2167
2183
  sql: `SELECT COUNT(*) as cnt FROM tasks
2168
2184
  WHERE status = 'needs_review' AND updated_at > ?`,
@@ -1224,16 +1224,32 @@ var init_tasks_crud = __esm({
1224
1224
  // src/lib/tasks-review.ts
1225
1225
  import path9 from "path";
1226
1226
  import { existsSync as existsSync9, readdirSync as readdirSync2, unlinkSync as unlinkSync2 } from "fs";
1227
- async function countPendingReviews() {
1227
+ async function countPendingReviews(sessionScope) {
1228
1228
  const client = getClient();
1229
+ if (sessionScope) {
1230
+ const result2 = await client.execute({
1231
+ sql: "SELECT COUNT(*) as cnt FROM tasks WHERE status = 'needs_review' AND (session_scope = ? OR session_scope IS NULL)",
1232
+ args: [sessionScope]
1233
+ });
1234
+ return Number(result2.rows[0]?.cnt) || 0;
1235
+ }
1229
1236
  const result = await client.execute({
1230
1237
  sql: "SELECT COUNT(*) as cnt FROM tasks WHERE status = 'needs_review'",
1231
1238
  args: []
1232
1239
  });
1233
1240
  return Number(result.rows[0]?.cnt) || 0;
1234
1241
  }
1235
- async function countNewPendingReviewsSince(sinceIso) {
1242
+ async function countNewPendingReviewsSince(sinceIso, sessionScope) {
1236
1243
  const client = getClient();
1244
+ if (sessionScope) {
1245
+ const result2 = await client.execute({
1246
+ sql: `SELECT COUNT(*) as cnt FROM tasks
1247
+ WHERE status = 'needs_review' AND updated_at > ?
1248
+ AND (session_scope = ? OR session_scope IS NULL)`,
1249
+ args: [sinceIso, sessionScope]
1250
+ });
1251
+ return Number(result2.rows[0]?.cnt) || 0;
1252
+ }
1237
1253
  const result = await client.execute({
1238
1254
  sql: `SELECT COUNT(*) as cnt FROM tasks
1239
1255
  WHERE status = 'needs_review' AND updated_at > ?`,