@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(input2) {
@@ -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
 
@@ -1500,6 +1500,103 @@ var init_shard_manager = __esm({
1500
1500
  }
1501
1501
  });
1502
1502
 
1503
+ // src/lib/platform-procedures.ts
1504
+ var PLATFORM_PROCEDURES, PLATFORM_PROCEDURE_TITLES;
1505
+ var init_platform_procedures = __esm({
1506
+ "src/lib/platform-procedures.ts"() {
1507
+ "use strict";
1508
+ PLATFORM_PROCEDURES = [
1509
+ // --- Foundation: what is exe-os ---
1510
+ {
1511
+ title: "What is exe-os \u2014 the operating model every agent must understand",
1512
+ domain: "architecture",
1513
+ priority: "p0",
1514
+ 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."
1515
+ },
1516
+ {
1517
+ title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
1518
+ domain: "architecture",
1519
+ priority: "p0",
1520
+ 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."
1521
+ },
1522
+ {
1523
+ title: "Sessions explained \u2014 what exeN means and how projects work",
1524
+ domain: "architecture",
1525
+ priority: "p0",
1526
+ 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."
1527
+ },
1528
+ // --- Hierarchy and dispatch ---
1529
+ {
1530
+ title: "Chain of command \u2014 who talks to whom",
1531
+ domain: "workflow",
1532
+ priority: "p0",
1533
+ 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."
1534
+ },
1535
+ {
1536
+ title: "Single dispatch path \u2014 create_task only",
1537
+ domain: "workflow",
1538
+ priority: "p0",
1539
+ 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."
1540
+ },
1541
+ // --- Session isolation ---
1542
+ {
1543
+ title: "Session scoping \u2014 stay in your exe boundary",
1544
+ domain: "security",
1545
+ priority: "p0",
1546
+ 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."
1547
+ },
1548
+ {
1549
+ title: "Session isolation \u2014 never touch another session's work",
1550
+ domain: "workflow",
1551
+ priority: "p0",
1552
+ 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.`
1553
+ },
1554
+ // --- Engineering: session scoping in code ---
1555
+ {
1556
+ title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
1557
+ domain: "architecture",
1558
+ priority: "p0",
1559
+ 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."
1560
+ },
1561
+ // --- Hard constraints ---
1562
+ {
1563
+ title: "What you CANNOT do in exe-os \u2014 hard constraints",
1564
+ domain: "security",
1565
+ priority: "p0",
1566
+ 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."
1567
+ },
1568
+ // --- Operations ---
1569
+ {
1570
+ title: "Managers must supervise deployed workers",
1571
+ domain: "workflow",
1572
+ priority: "p0",
1573
+ 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.`
1574
+ },
1575
+ {
1576
+ title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
1577
+ domain: "workflow",
1578
+ priority: "p0",
1579
+ 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."
1580
+ },
1581
+ {
1582
+ title: "exe-build-adv mandatory for 3+ files",
1583
+ domain: "workflow",
1584
+ priority: "p0",
1585
+ 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."
1586
+ },
1587
+ {
1588
+ title: "Desktop and TUI are the same product",
1589
+ domain: "architecture",
1590
+ priority: "p0",
1591
+ 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."
1592
+ }
1593
+ ];
1594
+ PLATFORM_PROCEDURE_TITLES = new Set(
1595
+ PLATFORM_PROCEDURES.map((p) => p.title)
1596
+ );
1597
+ }
1598
+ });
1599
+
1503
1600
  // src/lib/global-procedures.ts
1504
1601
  var global_procedures_exports = {};
1505
1602
  __export(global_procedures_exports, {
@@ -1515,22 +1612,25 @@ async function loadGlobalProcedures() {
1515
1612
  sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
1516
1613
  args: []
1517
1614
  });
1518
- const procedures = result.rows;
1519
- if (procedures.length > 0) {
1520
- _cache = procedures.map((p) => `### ${p.title}
1615
+ const allRows = result.rows;
1616
+ const customerOnly = allRows.filter((p) => !PLATFORM_PROCEDURE_TITLES.has(p.title));
1617
+ if (customerOnly.length > 0) {
1618
+ _customerCache = customerOnly.map((p) => `### ${p.title}
1521
1619
  ${p.content}`).join("\n\n");
1522
1620
  } else {
1523
- _cache = "";
1621
+ _customerCache = "";
1524
1622
  }
1525
1623
  _cacheLoaded = true;
1526
- return procedures;
1624
+ return customerOnly;
1527
1625
  }
1528
1626
  function getGlobalProceduresBlock() {
1529
- if (!_cacheLoaded) return "";
1530
- if (!_cache) return "";
1627
+ const sections = [];
1628
+ if (_platformCache) sections.push(_platformCache);
1629
+ if (_cacheLoaded && _customerCache) sections.push(_customerCache);
1630
+ if (sections.length === 0) return "";
1531
1631
  return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
1532
1632
 
1533
- ${_cache}
1633
+ ${sections.join("\n\n")}
1534
1634
  `;
1535
1635
  }
1536
1636
  async function storeGlobalProcedure(input2) {
@@ -1555,13 +1655,16 @@ async function deactivateGlobalProcedure(id) {
1555
1655
  await loadGlobalProcedures();
1556
1656
  return result.rowsAffected > 0;
1557
1657
  }
1558
- var _cache, _cacheLoaded;
1658
+ var _customerCache, _cacheLoaded, _platformCache;
1559
1659
  var init_global_procedures = __esm({
1560
1660
  "src/lib/global-procedures.ts"() {
1561
1661
  "use strict";
1562
1662
  init_database();
1563
- _cache = "";
1663
+ init_platform_procedures();
1664
+ _customerCache = "";
1564
1665
  _cacheLoaded = false;
1666
+ _platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
1667
+ ${p.content}`).join("\n\n");
1565
1668
  }
1566
1669
  });
1567
1670
 
@@ -1482,6 +1482,103 @@ var init_shard_manager = __esm({
1482
1482
  }
1483
1483
  });
1484
1484
 
1485
+ // src/lib/platform-procedures.ts
1486
+ var PLATFORM_PROCEDURES, PLATFORM_PROCEDURE_TITLES;
1487
+ var init_platform_procedures = __esm({
1488
+ "src/lib/platform-procedures.ts"() {
1489
+ "use strict";
1490
+ PLATFORM_PROCEDURES = [
1491
+ // --- Foundation: what is exe-os ---
1492
+ {
1493
+ title: "What is exe-os \u2014 the operating model every agent must understand",
1494
+ domain: "architecture",
1495
+ priority: "p0",
1496
+ 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."
1497
+ },
1498
+ {
1499
+ title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
1500
+ domain: "architecture",
1501
+ priority: "p0",
1502
+ 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."
1503
+ },
1504
+ {
1505
+ title: "Sessions explained \u2014 what exeN means and how projects work",
1506
+ domain: "architecture",
1507
+ priority: "p0",
1508
+ 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."
1509
+ },
1510
+ // --- Hierarchy and dispatch ---
1511
+ {
1512
+ title: "Chain of command \u2014 who talks to whom",
1513
+ domain: "workflow",
1514
+ priority: "p0",
1515
+ 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."
1516
+ },
1517
+ {
1518
+ title: "Single dispatch path \u2014 create_task only",
1519
+ domain: "workflow",
1520
+ priority: "p0",
1521
+ 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."
1522
+ },
1523
+ // --- Session isolation ---
1524
+ {
1525
+ title: "Session scoping \u2014 stay in your exe boundary",
1526
+ domain: "security",
1527
+ priority: "p0",
1528
+ 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."
1529
+ },
1530
+ {
1531
+ title: "Session isolation \u2014 never touch another session's work",
1532
+ domain: "workflow",
1533
+ priority: "p0",
1534
+ 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.`
1535
+ },
1536
+ // --- Engineering: session scoping in code ---
1537
+ {
1538
+ title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
1539
+ domain: "architecture",
1540
+ priority: "p0",
1541
+ 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."
1542
+ },
1543
+ // --- Hard constraints ---
1544
+ {
1545
+ title: "What you CANNOT do in exe-os \u2014 hard constraints",
1546
+ domain: "security",
1547
+ priority: "p0",
1548
+ 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."
1549
+ },
1550
+ // --- Operations ---
1551
+ {
1552
+ title: "Managers must supervise deployed workers",
1553
+ domain: "workflow",
1554
+ priority: "p0",
1555
+ 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.`
1556
+ },
1557
+ {
1558
+ title: "COO boot health check \u2014 memory, cloud sync, daemon on every launch",
1559
+ domain: "workflow",
1560
+ priority: "p0",
1561
+ 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."
1562
+ },
1563
+ {
1564
+ title: "exe-build-adv mandatory for 3+ files",
1565
+ domain: "workflow",
1566
+ priority: "p0",
1567
+ 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."
1568
+ },
1569
+ {
1570
+ title: "Desktop and TUI are the same product",
1571
+ domain: "architecture",
1572
+ priority: "p0",
1573
+ 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."
1574
+ }
1575
+ ];
1576
+ PLATFORM_PROCEDURE_TITLES = new Set(
1577
+ PLATFORM_PROCEDURES.map((p) => p.title)
1578
+ );
1579
+ }
1580
+ });
1581
+
1485
1582
  // src/lib/global-procedures.ts
1486
1583
  var global_procedures_exports = {};
1487
1584
  __export(global_procedures_exports, {
@@ -1497,22 +1594,25 @@ async function loadGlobalProcedures() {
1497
1594
  sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
1498
1595
  args: []
1499
1596
  });
1500
- const procedures = result.rows;
1501
- if (procedures.length > 0) {
1502
- _cache = procedures.map((p) => `### ${p.title}
1597
+ const allRows = result.rows;
1598
+ const customerOnly = allRows.filter((p) => !PLATFORM_PROCEDURE_TITLES.has(p.title));
1599
+ if (customerOnly.length > 0) {
1600
+ _customerCache = customerOnly.map((p) => `### ${p.title}
1503
1601
  ${p.content}`).join("\n\n");
1504
1602
  } else {
1505
- _cache = "";
1603
+ _customerCache = "";
1506
1604
  }
1507
1605
  _cacheLoaded = true;
1508
- return procedures;
1606
+ return customerOnly;
1509
1607
  }
1510
1608
  function getGlobalProceduresBlock() {
1511
- if (!_cacheLoaded) return "";
1512
- if (!_cache) return "";
1609
+ const sections = [];
1610
+ if (_platformCache) sections.push(_platformCache);
1611
+ if (_cacheLoaded && _customerCache) sections.push(_customerCache);
1612
+ if (sections.length === 0) return "";
1513
1613
  return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
1514
1614
 
1515
- ${_cache}
1615
+ ${sections.join("\n\n")}
1516
1616
  `;
1517
1617
  }
1518
1618
  async function storeGlobalProcedure(input2) {
@@ -1537,13 +1637,16 @@ async function deactivateGlobalProcedure(id) {
1537
1637
  await loadGlobalProcedures();
1538
1638
  return result.rowsAffected > 0;
1539
1639
  }
1540
- var _cache, _cacheLoaded;
1640
+ var _customerCache, _cacheLoaded, _platformCache;
1541
1641
  var init_global_procedures = __esm({
1542
1642
  "src/lib/global-procedures.ts"() {
1543
1643
  "use strict";
1544
1644
  init_database();
1545
- _cache = "";
1645
+ init_platform_procedures();
1646
+ _customerCache = "";
1546
1647
  _cacheLoaded = false;
1648
+ _platformCache = PLATFORM_PROCEDURES.map((p) => `### ${p.title}
1649
+ ${p.content}`).join("\n\n");
1547
1650
  }
1548
1651
  });
1549
1652