@askexenow/exe-os 0.9.69 → 0.9.71

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 (79) hide show
  1. package/deploy/stack-manifests/v0.9.json +96 -16
  2. package/dist/bin/agentic-ontology-backfill.js +33 -0
  3. package/dist/bin/agentic-reflection-backfill.js +33 -0
  4. package/dist/bin/agentic-semantic-label.js +33 -0
  5. package/dist/bin/backfill-conversations.js +33 -0
  6. package/dist/bin/backfill-responses.js +33 -0
  7. package/dist/bin/backfill-vectors.js +33 -0
  8. package/dist/bin/bulk-sync-postgres.js +33 -0
  9. package/dist/bin/cleanup-stale-review-tasks.js +33 -0
  10. package/dist/bin/cli.js +1284 -178
  11. package/dist/bin/exe-agent.js +6 -0
  12. package/dist/bin/exe-assign.js +33 -0
  13. package/dist/bin/exe-boot.js +33 -0
  14. package/dist/bin/exe-call.js +6 -0
  15. package/dist/bin/exe-cloud.js +33 -0
  16. package/dist/bin/exe-dispatch.js +33 -0
  17. package/dist/bin/exe-doctor.js +33 -0
  18. package/dist/bin/exe-export-behaviors.js +33 -0
  19. package/dist/bin/exe-forget.js +33 -0
  20. package/dist/bin/exe-gateway.js +178 -110
  21. package/dist/bin/exe-heartbeat.js +33 -0
  22. package/dist/bin/exe-kill.js +33 -0
  23. package/dist/bin/exe-launch-agent.js +33 -0
  24. package/dist/bin/exe-new-employee.js +6 -0
  25. package/dist/bin/exe-pending-messages.js +33 -0
  26. package/dist/bin/exe-pending-notifications.js +33 -0
  27. package/dist/bin/exe-pending-reviews.js +33 -0
  28. package/dist/bin/exe-rename.js +40 -4
  29. package/dist/bin/exe-review.js +33 -0
  30. package/dist/bin/exe-search.js +33 -0
  31. package/dist/bin/exe-session-cleanup.js +33 -0
  32. package/dist/bin/exe-start-codex.js +33 -0
  33. package/dist/bin/exe-start-opencode.js +33 -0
  34. package/dist/bin/exe-status.js +33 -0
  35. package/dist/bin/exe-team.js +33 -0
  36. package/dist/bin/git-sweep.js +33 -0
  37. package/dist/bin/graph-backfill.js +177 -110
  38. package/dist/bin/graph-export.js +33 -0
  39. package/dist/bin/intercom-check.js +33 -0
  40. package/dist/bin/registry-proxy.js +207 -0
  41. package/dist/bin/scan-tasks.js +33 -0
  42. package/dist/bin/setup.js +33 -0
  43. package/dist/bin/shard-migrate.js +33 -0
  44. package/dist/bin/stack-update.js +128 -0
  45. package/dist/gateway/index.js +178 -110
  46. package/dist/hooks/bug-report-worker.js +33 -0
  47. package/dist/hooks/codex-stop-task-finalizer.js +33 -0
  48. package/dist/hooks/commit-complete.js +33 -0
  49. package/dist/hooks/error-recall.js +33 -0
  50. package/dist/hooks/ingest.js +33 -0
  51. package/dist/hooks/instructions-loaded.js +33 -0
  52. package/dist/hooks/notification.js +33 -0
  53. package/dist/hooks/post-compact.js +33 -0
  54. package/dist/hooks/post-tool-combined.js +698 -17
  55. package/dist/hooks/pre-compact.js +33 -0
  56. package/dist/hooks/pre-tool-use.js +33 -0
  57. package/dist/hooks/prompt-submit.js +314 -0
  58. package/dist/hooks/session-end.js +33 -0
  59. package/dist/hooks/session-start.js +33 -0
  60. package/dist/hooks/stop.js +279 -12
  61. package/dist/hooks/subagent-stop.js +33 -0
  62. package/dist/hooks/summary-worker.js +33 -0
  63. package/dist/index.js +178 -110
  64. package/dist/lib/cloud-sync.js +27 -0
  65. package/dist/lib/database.js +27 -0
  66. package/dist/lib/db.js +27 -0
  67. package/dist/lib/device-registry.js +27 -0
  68. package/dist/lib/employee-templates.js +6 -0
  69. package/dist/lib/exe-daemon.js +639 -259
  70. package/dist/lib/hybrid-search.js +33 -0
  71. package/dist/lib/registry-proxy.js +162 -0
  72. package/dist/lib/schedules.js +33 -0
  73. package/dist/lib/store.js +33 -0
  74. package/dist/mcp/server.js +561 -244
  75. package/dist/runtime/index.js +33 -0
  76. package/dist/tui/App.js +33 -0
  77. package/package.json +3 -2
  78. package/stack.release.json +6 -4
  79. package/stack.release.schema.json +89 -18
@@ -3093,6 +3093,33 @@ async function ensureSchema() {
3093
3093
  CREATE INDEX IF NOT EXISTS idx_chat_history_session
3094
3094
  ON chat_history(session_id, id);
3095
3095
  `);
3096
+ await client.executeMultiple(`
3097
+ CREATE TABLE IF NOT EXISTS session_events (
3098
+ id TEXT PRIMARY KEY,
3099
+ agent_id TEXT NOT NULL,
3100
+ agent_role TEXT NOT NULL,
3101
+ session_id TEXT NOT NULL,
3102
+ session_scope TEXT,
3103
+ project_name TEXT NOT NULL,
3104
+ event_index INTEGER NOT NULL,
3105
+ event_type TEXT NOT NULL,
3106
+ tool_name TEXT,
3107
+ tool_use_id TEXT,
3108
+ content TEXT NOT NULL,
3109
+ payload_json TEXT,
3110
+ has_error INTEGER NOT NULL DEFAULT 0,
3111
+ created_at TEXT NOT NULL
3112
+ );
3113
+
3114
+ CREATE INDEX IF NOT EXISTS idx_session_events_agent_time
3115
+ ON session_events(agent_id, created_at DESC);
3116
+
3117
+ CREATE INDEX IF NOT EXISTS idx_session_events_session_index
3118
+ ON session_events(session_id, event_index);
3119
+
3120
+ CREATE INDEX IF NOT EXISTS idx_session_events_scope_agent_time
3121
+ ON session_events(session_scope, agent_id, created_at DESC);
3122
+ `);
3096
3123
  await client.executeMultiple(`
3097
3124
  CREATE TABLE IF NOT EXISTS workspaces (
3098
3125
  id TEXT PRIMARY KEY,
@@ -4794,6 +4821,12 @@ var init_platform_procedures = __esm({
4794
4821
  priority: "p0",
4795
4822
  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."
4796
4823
  },
4824
+ {
4825
+ title: "Code context first for repository orientation",
4826
+ domain: "workflow",
4827
+ priority: "p1",
4828
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4829
+ },
4797
4830
  {
4798
4831
  title: "Commit discipline \u2014 never leave verified work floating",
4799
4832
  domain: "workflow",
@@ -6152,13 +6185,25 @@ var init_wiki_client = __esm({
6152
6185
 
6153
6186
  // src/lib/code-chunker.ts
6154
6187
  import ts from "typescript";
6188
+ function languageForFile(filePath) {
6189
+ const base = filePath.split(/[\\/]/).pop()?.toLowerCase() ?? "";
6190
+ if (["dockerfile", "makefile", "rakefile", "gemfile"].includes(base)) return base;
6191
+ const ext = base.includes(".") ? base.split(".").pop() : void 0;
6192
+ return ext ? LANGUAGE_BY_EXTENSION[ext] : void 0;
6193
+ }
6155
6194
  function chunkSourceFile(source, fileName = "file.ts") {
6195
+ const language = languageForFile(fileName);
6196
+ if (language === "typescript" || language === "javascript") {
6197
+ return chunkTypeScriptLike(source, fileName);
6198
+ }
6199
+ return chunkGenericSource(source, fileName, language);
6200
+ }
6201
+ function chunkTypeScriptLike(source, fileName) {
6156
6202
  const sourceFile = ts.createSourceFile(
6157
6203
  fileName,
6158
6204
  source,
6159
6205
  ts.ScriptTarget.Latest,
6160
6206
  true,
6161
- // setParentNodes
6162
6207
  fileName.endsWith(".tsx") || fileName.endsWith(".jsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS
6163
6208
  );
6164
6209
  const chunks = [];
@@ -6180,153 +6225,176 @@ function chunkSourceFile(source, fileName = "file.ts") {
6180
6225
  if (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node)) {
6181
6226
  return node.name?.getText(sourceFile) ?? "(anonymous)";
6182
6227
  }
6183
- if (ts.isClassDeclaration(node)) {
6184
- return node.name?.getText(sourceFile) ?? "(anonymous class)";
6185
- }
6186
- if (ts.isInterfaceDeclaration(node)) {
6187
- return node.name.getText(sourceFile);
6188
- }
6189
- if (ts.isTypeAliasDeclaration(node)) {
6190
- return node.name.getText(sourceFile);
6191
- }
6192
- if (ts.isEnumDeclaration(node)) {
6193
- return node.name.getText(sourceFile);
6194
- }
6195
- if (ts.isVariableStatement(node)) {
6196
- const decls = node.declarationList.declarations;
6197
- return decls.map((d) => d.name.getText(sourceFile)).join(", ");
6198
- }
6199
- if (ts.isExportAssignment(node)) {
6200
- return "default export";
6201
- }
6228
+ if (ts.isClassDeclaration(node)) return node.name?.getText(sourceFile) ?? "(anonymous class)";
6229
+ if (ts.isInterfaceDeclaration(node)) return node.name.getText(sourceFile);
6230
+ if (ts.isTypeAliasDeclaration(node)) return node.name.getText(sourceFile);
6231
+ if (ts.isEnumDeclaration(node)) return node.name.getText(sourceFile);
6232
+ if (ts.isVariableStatement(node)) return node.declarationList.declarations.map((d) => d.name.getText(sourceFile)).join(", ");
6233
+ if (ts.isExportAssignment(node)) return "default export";
6202
6234
  return "(unknown)";
6203
6235
  }
6204
6236
  function visitTopLevel(node) {
6205
6237
  if (ts.isImportDeclaration(node)) {
6206
- importLines.push({
6207
- start: getLineNumber(node.getStart(sourceFile)),
6208
- end: getLineNumber(node.getEnd())
6209
- });
6238
+ importLines.push({ start: getLineNumber(node.getStart(sourceFile)), end: getLineNumber(node.getEnd()) });
6210
6239
  return;
6211
6240
  }
6212
6241
  if (ts.isFunctionDeclaration(node)) {
6213
- chunks.push({
6214
- kind: "function",
6215
- name: getName(node),
6216
- text: getNodeText(node),
6217
- startLine: getLineNumber(node.getStart(sourceFile)),
6218
- endLine: getLineNumber(node.getEnd()),
6219
- comment: getLeadingComment(node)
6220
- });
6242
+ chunks.push({ kind: "function", name: getName(node), text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
6221
6243
  return;
6222
6244
  }
6223
6245
  if (ts.isClassDeclaration(node)) {
6224
- chunks.push({
6225
- kind: "class",
6226
- name: getName(node),
6227
- text: getNodeText(node),
6228
- startLine: getLineNumber(node.getStart(sourceFile)),
6229
- endLine: getLineNumber(node.getEnd()),
6230
- comment: getLeadingComment(node)
6231
- });
6232
- return;
6233
- }
6234
- if (ts.isInterfaceDeclaration(node)) {
6235
- chunks.push({
6236
- kind: "type",
6237
- name: getName(node),
6238
- text: getNodeText(node),
6239
- startLine: getLineNumber(node.getStart(sourceFile)),
6240
- endLine: getLineNumber(node.getEnd()),
6241
- comment: getLeadingComment(node)
6242
- });
6246
+ chunks.push({ kind: "class", name: getName(node), text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
6243
6247
  return;
6244
6248
  }
6245
- if (ts.isTypeAliasDeclaration(node)) {
6246
- chunks.push({
6247
- kind: "type",
6248
- name: getName(node),
6249
- text: getNodeText(node),
6250
- startLine: getLineNumber(node.getStart(sourceFile)),
6251
- endLine: getLineNumber(node.getEnd()),
6252
- comment: getLeadingComment(node)
6253
- });
6254
- return;
6255
- }
6256
- if (ts.isEnumDeclaration(node)) {
6257
- chunks.push({
6258
- kind: "type",
6259
- name: getName(node),
6260
- text: getNodeText(node),
6261
- startLine: getLineNumber(node.getStart(sourceFile)),
6262
- endLine: getLineNumber(node.getEnd()),
6263
- comment: getLeadingComment(node)
6264
- });
6249
+ if (ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node) || ts.isEnumDeclaration(node)) {
6250
+ chunks.push({ kind: "type", name: getName(node), text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
6265
6251
  return;
6266
6252
  }
6267
6253
  if (ts.isVariableStatement(node)) {
6268
- const decls = node.declarationList.declarations;
6269
- const isFnLike = decls.some(
6270
- (d) => d.initializer && (ts.isArrowFunction(d.initializer) || ts.isFunctionExpression(d.initializer))
6271
- );
6272
- chunks.push({
6273
- kind: isFnLike ? "function" : "variable",
6274
- name: getName(node),
6275
- text: getNodeText(node),
6276
- startLine: getLineNumber(node.getStart(sourceFile)),
6277
- endLine: getLineNumber(node.getEnd()),
6278
- comment: getLeadingComment(node)
6279
- });
6254
+ const isFnLike = node.declarationList.declarations.some((d) => d.initializer && (ts.isArrowFunction(d.initializer) || ts.isFunctionExpression(d.initializer)));
6255
+ chunks.push({ kind: isFnLike ? "function" : "variable", name: getName(node), text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
6280
6256
  return;
6281
6257
  }
6282
6258
  if (ts.isExportAssignment(node)) {
6283
- chunks.push({
6284
- kind: "export",
6285
- name: "default export",
6286
- text: getNodeText(node),
6287
- startLine: getLineNumber(node.getStart(sourceFile)),
6288
- endLine: getLineNumber(node.getEnd()),
6289
- comment: getLeadingComment(node)
6290
- });
6259
+ chunks.push({ kind: "export", name: "default export", text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
6291
6260
  return;
6292
6261
  }
6293
6262
  if (ts.isExpressionStatement(node)) {
6294
6263
  const text = getNodeText(node);
6295
- if (text.length > 10) {
6296
- chunks.push({
6297
- kind: "other",
6298
- name: text.slice(0, 40).replace(/\n/g, " "),
6299
- text,
6300
- startLine: getLineNumber(node.getStart(sourceFile)),
6301
- endLine: getLineNumber(node.getEnd())
6302
- });
6303
- }
6304
- return;
6264
+ if (text.length > 10) chunks.push({ kind: "other", name: text.slice(0, 40).replace(/\n/g, " "), text, startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()) });
6305
6265
  }
6306
6266
  }
6307
6267
  sourceFile.statements.forEach(visitTopLevel);
6308
6268
  if (importLines.length > 0) {
6309
6269
  const startLine = importLines[0].start;
6310
6270
  const endLine = importLines[importLines.length - 1].end;
6311
- const importText = lines.slice(startLine - 1, endLine).join("\n");
6312
- chunks.unshift({
6313
- kind: "import",
6314
- name: `${importLines.length} imports`,
6315
- text: importText,
6316
- startLine,
6271
+ chunks.unshift({ kind: "import", name: `${importLines.length} imports`, text: lines.slice(startLine - 1, endLine).join("\n"), startLine, endLine });
6272
+ }
6273
+ chunks.sort((a, b) => a.startLine - b.startLine);
6274
+ return chunks.length > 0 ? chunks : chunkByWindows(source, 80);
6275
+ }
6276
+ function chunkGenericSource(source, _fileName, language) {
6277
+ const lines = source.split("\n");
6278
+ if (source.trim().length === 0) return [];
6279
+ if (language && TEXT_LIKE_LANGUAGES.has(language)) return chunkTextLike(lines, language);
6280
+ const chunks = [];
6281
+ const patterns = [
6282
+ { kind: "function", regex: /^\s*(?:async\s+)?def\s+([A-Za-z_][\w]*)\s*\(/, name: (m) => m[1] },
6283
+ { kind: "class", regex: /^\s*class\s+([A-Za-z_][\w]*)\b/, name: (m) => m[1] },
6284
+ { kind: "function", regex: /^\s*(?:pub\s+)?fn\s+([A-Za-z_][\w]*)\s*[<(]/, name: (m) => m[1] },
6285
+ { kind: "class", regex: /^\s*(?:pub\s+)?(?:struct|enum|trait)\s+([A-Za-z_][\w]*)\b/, name: (m) => m[1] },
6286
+ { kind: "function", regex: /^\s*func\s+(?:\([^)]*\)\s*)?([A-Za-z_][\w]*)\s*\(/, name: (m) => m[1] },
6287
+ { kind: "function", regex: /^\s*(?:public|private|protected|static|final|suspend|fun|override|open|internal|export|async|func|function|subroutine)\s+.*?([A-Za-z_][\w]*)\s*\(/, name: (m) => m[1] },
6288
+ { kind: "function", regex: /^\s*function\s+([A-Za-z_][\w]*)\s*\(/, name: (m) => m[1] },
6289
+ { kind: "type", regex: /^\s*(?:interface|type|enum|record|data\s+class|case\s+class|contract|library)\s+([A-Za-z_][\w]*)\b/, name: (m) => m[1] },
6290
+ { kind: "section", regex: /^\s{0,3}#{1,6}\s+(.+)$/, name: (m) => m[1].trim() }
6291
+ ];
6292
+ const starts = [];
6293
+ for (let i = 0; i < lines.length; i++) {
6294
+ const line = lines[i];
6295
+ for (const pattern of patterns) {
6296
+ const match = line.match(pattern.regex);
6297
+ if (match) {
6298
+ starts.push({ line: i + 1, kind: pattern.kind, name: pattern.name(match) });
6299
+ break;
6300
+ }
6301
+ }
6302
+ }
6303
+ if (starts.length === 0) return chunkByWindows(source, 80);
6304
+ for (let i = 0; i < starts.length; i++) {
6305
+ const start = starts[i];
6306
+ const next = starts[i + 1]?.line ?? lines.length + 1;
6307
+ const endLine = Math.max(start.line, next - 1);
6308
+ chunks.push({
6309
+ kind: start.kind,
6310
+ name: start.name,
6311
+ text: lines.slice(start.line - 1, endLine).join("\n"),
6312
+ startLine: start.line,
6317
6313
  endLine
6318
6314
  });
6319
6315
  }
6320
- chunks.sort((a, b) => a.startLine - b.startLine);
6316
+ return chunks;
6317
+ }
6318
+ function chunkTextLike(lines, language) {
6319
+ if (language === "markdown" || language === "mdx") {
6320
+ const starts = lines.map((line, i) => ({ line, i })).filter(({ line }) => /^\s{0,3}#{1,6}\s+/.test(line));
6321
+ if (starts.length > 0) {
6322
+ return starts.map((start, idx) => {
6323
+ const end = starts[idx + 1]?.i ?? lines.length;
6324
+ const title = start.line.replace(/^\s{0,3}#{1,6}\s+/, "").trim();
6325
+ return { kind: "section", name: title, text: lines.slice(start.i, end).join("\n"), startLine: start.i + 1, endLine: end };
6326
+ });
6327
+ }
6328
+ }
6329
+ return chunkByWindows(lines.join("\n"), 80);
6330
+ }
6331
+ function chunkByWindows(source, windowLines) {
6332
+ const lines = source.split("\n");
6333
+ const chunks = [];
6334
+ for (let i = 0; i < lines.length; i += windowLines) {
6335
+ const end = Math.min(lines.length, i + windowLines);
6336
+ const text = lines.slice(i, end).join("\n");
6337
+ if (text.trim()) chunks.push({ kind: "other", name: `lines ${i + 1}-${end}`, text, startLine: i + 1, endLine: end });
6338
+ }
6321
6339
  return chunks;
6322
6340
  }
6323
6341
  function isChunkable(filePath) {
6324
- const ext = filePath.split(".").pop()?.toLowerCase();
6325
- return ext === "ts" || ext === "tsx" || ext === "js" || ext === "jsx";
6342
+ return Boolean(languageForFile(filePath));
6326
6343
  }
6344
+ var LANGUAGE_BY_EXTENSION, TEXT_LIKE_LANGUAGES;
6327
6345
  var init_code_chunker = __esm({
6328
6346
  "src/lib/code-chunker.ts"() {
6329
6347
  "use strict";
6348
+ LANGUAGE_BY_EXTENSION = {
6349
+ c: "c",
6350
+ cc: "cpp",
6351
+ cpp: "cpp",
6352
+ cxx: "cpp",
6353
+ h: "c",
6354
+ hh: "cpp",
6355
+ hpp: "cpp",
6356
+ cs: "csharp",
6357
+ css: "css",
6358
+ scss: "scss",
6359
+ f: "fortran",
6360
+ f90: "fortran",
6361
+ f95: "fortran",
6362
+ go: "go",
6363
+ html: "html",
6364
+ htm: "html",
6365
+ java: "java",
6366
+ js: "javascript",
6367
+ jsx: "javascript",
6368
+ json: "json",
6369
+ kt: "kotlin",
6370
+ kts: "kotlin",
6371
+ lua: "lua",
6372
+ md: "markdown",
6373
+ mdx: "mdx",
6374
+ pas: "pascal",
6375
+ php: "php",
6376
+ py: "python",
6377
+ r: "r",
6378
+ rb: "ruby",
6379
+ rs: "rust",
6380
+ scala: "scala",
6381
+ sc: "scala",
6382
+ sol: "solidity",
6383
+ sql: "sql",
6384
+ svelte: "svelte",
6385
+ swift: "swift",
6386
+ toml: "toml",
6387
+ ts: "typescript",
6388
+ tsx: "typescript",
6389
+ vue: "vue",
6390
+ xml: "xml",
6391
+ yaml: "yaml",
6392
+ yml: "yaml",
6393
+ sh: "shell",
6394
+ bash: "shell",
6395
+ zsh: "shell"
6396
+ };
6397
+ TEXT_LIKE_LANGUAGES = /* @__PURE__ */ new Set(["json", "markdown", "mdx", "toml", "yaml", "xml", "html", "css", "scss", "sql"]);
6330
6398
  }
6331
6399
  });
6332
6400
 
@@ -2476,6 +2476,33 @@ async function ensureSchema() {
2476
2476
  CREATE INDEX IF NOT EXISTS idx_chat_history_session
2477
2477
  ON chat_history(session_id, id);
2478
2478
  `);
2479
+ await client.executeMultiple(`
2480
+ CREATE TABLE IF NOT EXISTS session_events (
2481
+ id TEXT PRIMARY KEY,
2482
+ agent_id TEXT NOT NULL,
2483
+ agent_role TEXT NOT NULL,
2484
+ session_id TEXT NOT NULL,
2485
+ session_scope TEXT,
2486
+ project_name TEXT NOT NULL,
2487
+ event_index INTEGER NOT NULL,
2488
+ event_type TEXT NOT NULL,
2489
+ tool_name TEXT,
2490
+ tool_use_id TEXT,
2491
+ content TEXT NOT NULL,
2492
+ payload_json TEXT,
2493
+ has_error INTEGER NOT NULL DEFAULT 0,
2494
+ created_at TEXT NOT NULL
2495
+ );
2496
+
2497
+ CREATE INDEX IF NOT EXISTS idx_session_events_agent_time
2498
+ ON session_events(agent_id, created_at DESC);
2499
+
2500
+ CREATE INDEX IF NOT EXISTS idx_session_events_session_index
2501
+ ON session_events(session_id, event_index);
2502
+
2503
+ CREATE INDEX IF NOT EXISTS idx_session_events_scope_agent_time
2504
+ ON session_events(session_scope, agent_id, created_at DESC);
2505
+ `);
2479
2506
  await client.executeMultiple(`
2480
2507
  CREATE TABLE IF NOT EXISTS workspaces (
2481
2508
  id TEXT PRIMARY KEY,
@@ -4164,6 +4191,12 @@ var init_platform_procedures = __esm({
4164
4191
  priority: "p0",
4165
4192
  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."
4166
4193
  },
4194
+ {
4195
+ title: "Code context first for repository orientation",
4196
+ domain: "workflow",
4197
+ priority: "p1",
4198
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4199
+ },
4167
4200
  {
4168
4201
  title: "Commit discipline \u2014 never leave verified work floating",
4169
4202
  domain: "workflow",
@@ -2437,6 +2437,33 @@ async function ensureSchema() {
2437
2437
  CREATE INDEX IF NOT EXISTS idx_chat_history_session
2438
2438
  ON chat_history(session_id, id);
2439
2439
  `);
2440
+ await client.executeMultiple(`
2441
+ CREATE TABLE IF NOT EXISTS session_events (
2442
+ id TEXT PRIMARY KEY,
2443
+ agent_id TEXT NOT NULL,
2444
+ agent_role TEXT NOT NULL,
2445
+ session_id TEXT NOT NULL,
2446
+ session_scope TEXT,
2447
+ project_name TEXT NOT NULL,
2448
+ event_index INTEGER NOT NULL,
2449
+ event_type TEXT NOT NULL,
2450
+ tool_name TEXT,
2451
+ tool_use_id TEXT,
2452
+ content TEXT NOT NULL,
2453
+ payload_json TEXT,
2454
+ has_error INTEGER NOT NULL DEFAULT 0,
2455
+ created_at TEXT NOT NULL
2456
+ );
2457
+
2458
+ CREATE INDEX IF NOT EXISTS idx_session_events_agent_time
2459
+ ON session_events(agent_id, created_at DESC);
2460
+
2461
+ CREATE INDEX IF NOT EXISTS idx_session_events_session_index
2462
+ ON session_events(session_id, event_index);
2463
+
2464
+ CREATE INDEX IF NOT EXISTS idx_session_events_scope_agent_time
2465
+ ON session_events(session_scope, agent_id, created_at DESC);
2466
+ `);
2440
2467
  await client.executeMultiple(`
2441
2468
  CREATE TABLE IF NOT EXISTS workspaces (
2442
2469
  id TEXT PRIMARY KEY,
@@ -4125,6 +4152,12 @@ var init_platform_procedures = __esm({
4125
4152
  priority: "p0",
4126
4153
  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."
4127
4154
  },
4155
+ {
4156
+ title: "Code context first for repository orientation",
4157
+ domain: "workflow",
4158
+ priority: "p1",
4159
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4160
+ },
4128
4161
  {
4129
4162
  title: "Commit discipline \u2014 never leave verified work floating",
4130
4163
  domain: "workflow",
@@ -2535,6 +2535,33 @@ async function ensureSchema() {
2535
2535
  CREATE INDEX IF NOT EXISTS idx_chat_history_session
2536
2536
  ON chat_history(session_id, id);
2537
2537
  `);
2538
+ await client.executeMultiple(`
2539
+ CREATE TABLE IF NOT EXISTS session_events (
2540
+ id TEXT PRIMARY KEY,
2541
+ agent_id TEXT NOT NULL,
2542
+ agent_role TEXT NOT NULL,
2543
+ session_id TEXT NOT NULL,
2544
+ session_scope TEXT,
2545
+ project_name TEXT NOT NULL,
2546
+ event_index INTEGER NOT NULL,
2547
+ event_type TEXT NOT NULL,
2548
+ tool_name TEXT,
2549
+ tool_use_id TEXT,
2550
+ content TEXT NOT NULL,
2551
+ payload_json TEXT,
2552
+ has_error INTEGER NOT NULL DEFAULT 0,
2553
+ created_at TEXT NOT NULL
2554
+ );
2555
+
2556
+ CREATE INDEX IF NOT EXISTS idx_session_events_agent_time
2557
+ ON session_events(agent_id, created_at DESC);
2558
+
2559
+ CREATE INDEX IF NOT EXISTS idx_session_events_session_index
2560
+ ON session_events(session_id, event_index);
2561
+
2562
+ CREATE INDEX IF NOT EXISTS idx_session_events_scope_agent_time
2563
+ ON session_events(session_scope, agent_id, created_at DESC);
2564
+ `);
2538
2565
  await client.executeMultiple(`
2539
2566
  CREATE TABLE IF NOT EXISTS workspaces (
2540
2567
  id TEXT PRIMARY KEY,
@@ -4223,6 +4250,12 @@ var init_platform_procedures = __esm({
4223
4250
  priority: "p0",
4224
4251
  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."
4225
4252
  },
4253
+ {
4254
+ title: "Code context first for repository orientation",
4255
+ domain: "workflow",
4256
+ priority: "p1",
4257
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4258
+ },
4226
4259
  {
4227
4260
  title: "Commit discipline \u2014 never leave verified work floating",
4228
4261
  domain: "workflow",
@@ -2638,6 +2638,12 @@ var PLATFORM_PROCEDURES = [
2638
2638
  priority: "p0",
2639
2639
  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."
2640
2640
  },
2641
+ {
2642
+ title: "Code context first for repository orientation",
2643
+ domain: "workflow",
2644
+ priority: "p1",
2645
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
2646
+ },
2641
2647
  {
2642
2648
  title: "Commit discipline \u2014 never leave verified work floating",
2643
2649
  domain: "workflow",
@@ -2447,6 +2447,33 @@ async function ensureSchema() {
2447
2447
  CREATE INDEX IF NOT EXISTS idx_chat_history_session
2448
2448
  ON chat_history(session_id, id);
2449
2449
  `);
2450
+ await client.executeMultiple(`
2451
+ CREATE TABLE IF NOT EXISTS session_events (
2452
+ id TEXT PRIMARY KEY,
2453
+ agent_id TEXT NOT NULL,
2454
+ agent_role TEXT NOT NULL,
2455
+ session_id TEXT NOT NULL,
2456
+ session_scope TEXT,
2457
+ project_name TEXT NOT NULL,
2458
+ event_index INTEGER NOT NULL,
2459
+ event_type TEXT NOT NULL,
2460
+ tool_name TEXT,
2461
+ tool_use_id TEXT,
2462
+ content TEXT NOT NULL,
2463
+ payload_json TEXT,
2464
+ has_error INTEGER NOT NULL DEFAULT 0,
2465
+ created_at TEXT NOT NULL
2466
+ );
2467
+
2468
+ CREATE INDEX IF NOT EXISTS idx_session_events_agent_time
2469
+ ON session_events(agent_id, created_at DESC);
2470
+
2471
+ CREATE INDEX IF NOT EXISTS idx_session_events_session_index
2472
+ ON session_events(session_id, event_index);
2473
+
2474
+ CREATE INDEX IF NOT EXISTS idx_session_events_scope_agent_time
2475
+ ON session_events(session_scope, agent_id, created_at DESC);
2476
+ `);
2450
2477
  await client.executeMultiple(`
2451
2478
  CREATE TABLE IF NOT EXISTS workspaces (
2452
2479
  id TEXT PRIMARY KEY,
@@ -4562,6 +4589,12 @@ var init_platform_procedures = __esm({
4562
4589
  priority: "p0",
4563
4590
  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."
4564
4591
  },
4592
+ {
4593
+ title: "Code context first for repository orientation",
4594
+ domain: "workflow",
4595
+ priority: "p1",
4596
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4597
+ },
4565
4598
  {
4566
4599
  title: "Commit discipline \u2014 never leave verified work floating",
4567
4600
  domain: "workflow",
@@ -2448,6 +2448,33 @@ async function ensureSchema() {
2448
2448
  CREATE INDEX IF NOT EXISTS idx_chat_history_session
2449
2449
  ON chat_history(session_id, id);
2450
2450
  `);
2451
+ await client.executeMultiple(`
2452
+ CREATE TABLE IF NOT EXISTS session_events (
2453
+ id TEXT PRIMARY KEY,
2454
+ agent_id TEXT NOT NULL,
2455
+ agent_role TEXT NOT NULL,
2456
+ session_id TEXT NOT NULL,
2457
+ session_scope TEXT,
2458
+ project_name TEXT NOT NULL,
2459
+ event_index INTEGER NOT NULL,
2460
+ event_type TEXT NOT NULL,
2461
+ tool_name TEXT,
2462
+ tool_use_id TEXT,
2463
+ content TEXT NOT NULL,
2464
+ payload_json TEXT,
2465
+ has_error INTEGER NOT NULL DEFAULT 0,
2466
+ created_at TEXT NOT NULL
2467
+ );
2468
+
2469
+ CREATE INDEX IF NOT EXISTS idx_session_events_agent_time
2470
+ ON session_events(agent_id, created_at DESC);
2471
+
2472
+ CREATE INDEX IF NOT EXISTS idx_session_events_session_index
2473
+ ON session_events(session_id, event_index);
2474
+
2475
+ CREATE INDEX IF NOT EXISTS idx_session_events_scope_agent_time
2476
+ ON session_events(session_scope, agent_id, created_at DESC);
2477
+ `);
2451
2478
  await client.executeMultiple(`
2452
2479
  CREATE TABLE IF NOT EXISTS workspaces (
2453
2480
  id TEXT PRIMARY KEY,
@@ -4628,6 +4655,12 @@ var init_platform_procedures = __esm({
4628
4655
  priority: "p0",
4629
4656
  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."
4630
4657
  },
4658
+ {
4659
+ title: "Code context first for repository orientation",
4660
+ domain: "workflow",
4661
+ priority: "p1",
4662
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4663
+ },
4631
4664
  {
4632
4665
  title: "Commit discipline \u2014 never leave verified work floating",
4633
4666
  domain: "workflow",
@@ -2448,6 +2448,33 @@ async function ensureSchema() {
2448
2448
  CREATE INDEX IF NOT EXISTS idx_chat_history_session
2449
2449
  ON chat_history(session_id, id);
2450
2450
  `);
2451
+ await client.executeMultiple(`
2452
+ CREATE TABLE IF NOT EXISTS session_events (
2453
+ id TEXT PRIMARY KEY,
2454
+ agent_id TEXT NOT NULL,
2455
+ agent_role TEXT NOT NULL,
2456
+ session_id TEXT NOT NULL,
2457
+ session_scope TEXT,
2458
+ project_name TEXT NOT NULL,
2459
+ event_index INTEGER NOT NULL,
2460
+ event_type TEXT NOT NULL,
2461
+ tool_name TEXT,
2462
+ tool_use_id TEXT,
2463
+ content TEXT NOT NULL,
2464
+ payload_json TEXT,
2465
+ has_error INTEGER NOT NULL DEFAULT 0,
2466
+ created_at TEXT NOT NULL
2467
+ );
2468
+
2469
+ CREATE INDEX IF NOT EXISTS idx_session_events_agent_time
2470
+ ON session_events(agent_id, created_at DESC);
2471
+
2472
+ CREATE INDEX IF NOT EXISTS idx_session_events_session_index
2473
+ ON session_events(session_id, event_index);
2474
+
2475
+ CREATE INDEX IF NOT EXISTS idx_session_events_scope_agent_time
2476
+ ON session_events(session_scope, agent_id, created_at DESC);
2477
+ `);
2451
2478
  await client.executeMultiple(`
2452
2479
  CREATE TABLE IF NOT EXISTS workspaces (
2453
2480
  id TEXT PRIMARY KEY,
@@ -4667,6 +4694,12 @@ var init_platform_procedures = __esm({
4667
4694
  priority: "p0",
4668
4695
  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."
4669
4696
  },
4697
+ {
4698
+ title: "Code context first for repository orientation",
4699
+ domain: "workflow",
4700
+ priority: "p1",
4701
+ content: "Before broad repo exploration, symbol tracing, blast-radius review, or codebase Q&A, agents should use the consolidated code_context MCP tool instead of manual grep/read loops. Use action=index or stats to refresh/check the index; action=search with query, limit, offset, languages, paths, refresh_index for fresh multi-language code/doc search; action=trace for symbol imports/dependents; action=blast_radius for impact analysis before edits. CLI parity exists via exe-os code-context init|index|status|stats|search|doctor. Keep code_context separate from durable employee memory: promote only validated decisions, procedures, or lessons into store_memory/commit_memory."
4702
+ },
4670
4703
  {
4671
4704
  title: "Commit discipline \u2014 never leave verified work floating",
4672
4705
  domain: "workflow",