@askexenow/exe-os 0.9.69 → 0.9.70

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 (75) hide show
  1. package/deploy/stack-manifests/v0.9.json +96 -16
  2. package/dist/bin/agentic-ontology-backfill.js +6 -0
  3. package/dist/bin/agentic-reflection-backfill.js +6 -0
  4. package/dist/bin/agentic-semantic-label.js +6 -0
  5. package/dist/bin/backfill-conversations.js +6 -0
  6. package/dist/bin/backfill-responses.js +6 -0
  7. package/dist/bin/backfill-vectors.js +6 -0
  8. package/dist/bin/bulk-sync-postgres.js +6 -0
  9. package/dist/bin/cleanup-stale-review-tasks.js +6 -0
  10. package/dist/bin/cli.js +1257 -178
  11. package/dist/bin/exe-agent.js +6 -0
  12. package/dist/bin/exe-assign.js +6 -0
  13. package/dist/bin/exe-boot.js +6 -0
  14. package/dist/bin/exe-call.js +6 -0
  15. package/dist/bin/exe-cloud.js +6 -0
  16. package/dist/bin/exe-dispatch.js +6 -0
  17. package/dist/bin/exe-doctor.js +6 -0
  18. package/dist/bin/exe-export-behaviors.js +6 -0
  19. package/dist/bin/exe-forget.js +6 -0
  20. package/dist/bin/exe-gateway.js +151 -110
  21. package/dist/bin/exe-heartbeat.js +6 -0
  22. package/dist/bin/exe-kill.js +6 -0
  23. package/dist/bin/exe-launch-agent.js +6 -0
  24. package/dist/bin/exe-new-employee.js +6 -0
  25. package/dist/bin/exe-pending-messages.js +6 -0
  26. package/dist/bin/exe-pending-notifications.js +6 -0
  27. package/dist/bin/exe-pending-reviews.js +6 -0
  28. package/dist/bin/exe-rename.js +13 -4
  29. package/dist/bin/exe-review.js +6 -0
  30. package/dist/bin/exe-search.js +6 -0
  31. package/dist/bin/exe-session-cleanup.js +6 -0
  32. package/dist/bin/exe-start-codex.js +6 -0
  33. package/dist/bin/exe-start-opencode.js +6 -0
  34. package/dist/bin/exe-status.js +6 -0
  35. package/dist/bin/exe-team.js +6 -0
  36. package/dist/bin/git-sweep.js +6 -0
  37. package/dist/bin/graph-backfill.js +150 -110
  38. package/dist/bin/graph-export.js +6 -0
  39. package/dist/bin/intercom-check.js +6 -0
  40. package/dist/bin/registry-proxy.js +207 -0
  41. package/dist/bin/scan-tasks.js +6 -0
  42. package/dist/bin/setup.js +6 -0
  43. package/dist/bin/shard-migrate.js +6 -0
  44. package/dist/bin/stack-update.js +128 -0
  45. package/dist/gateway/index.js +151 -110
  46. package/dist/hooks/bug-report-worker.js +6 -0
  47. package/dist/hooks/codex-stop-task-finalizer.js +6 -0
  48. package/dist/hooks/commit-complete.js +6 -0
  49. package/dist/hooks/error-recall.js +6 -0
  50. package/dist/hooks/ingest.js +6 -0
  51. package/dist/hooks/instructions-loaded.js +6 -0
  52. package/dist/hooks/notification.js +6 -0
  53. package/dist/hooks/post-compact.js +6 -0
  54. package/dist/hooks/post-tool-combined.js +6 -0
  55. package/dist/hooks/pre-compact.js +6 -0
  56. package/dist/hooks/pre-tool-use.js +6 -0
  57. package/dist/hooks/prompt-submit.js +6 -0
  58. package/dist/hooks/session-end.js +6 -0
  59. package/dist/hooks/session-start.js +6 -0
  60. package/dist/hooks/stop.js +6 -0
  61. package/dist/hooks/subagent-stop.js +6 -0
  62. package/dist/hooks/summary-worker.js +6 -0
  63. package/dist/index.js +151 -110
  64. package/dist/lib/employee-templates.js +6 -0
  65. package/dist/lib/exe-daemon.js +382 -234
  66. package/dist/lib/hybrid-search.js +6 -0
  67. package/dist/lib/registry-proxy.js +162 -0
  68. package/dist/lib/schedules.js +6 -0
  69. package/dist/lib/store.js +6 -0
  70. package/dist/mcp/server.js +318 -222
  71. package/dist/runtime/index.js +6 -0
  72. package/dist/tui/App.js +6 -0
  73. package/package.json +3 -2
  74. package/stack.release.json +6 -4
  75. package/stack.release.schema.json +89 -18
@@ -1393,6 +1393,12 @@ var PLATFORM_PROCEDURES = [
1393
1393
  priority: "p0",
1394
1394
  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."
1395
1395
  },
1396
+ {
1397
+ title: "Code context first for repository orientation",
1398
+ domain: "workflow",
1399
+ priority: "p1",
1400
+ 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."
1401
+ },
1396
1402
  {
1397
1403
  title: "Commit discipline \u2014 never leave verified work floating",
1398
1404
  domain: "workflow",
@@ -3503,6 +3503,12 @@ var init_platform_procedures = __esm({
3503
3503
  priority: "p0",
3504
3504
  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."
3505
3505
  },
3506
+ {
3507
+ title: "Code context first for repository orientation",
3508
+ domain: "workflow",
3509
+ priority: "p1",
3510
+ 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."
3511
+ },
3506
3512
  {
3507
3513
  title: "Commit discipline \u2014 never leave verified work floating",
3508
3514
  domain: "workflow",
@@ -3240,6 +3240,12 @@ var init_platform_procedures = __esm({
3240
3240
  priority: "p0",
3241
3241
  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."
3242
3242
  },
3243
+ {
3244
+ title: "Code context first for repository orientation",
3245
+ domain: "workflow",
3246
+ priority: "p1",
3247
+ 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."
3248
+ },
3243
3249
  {
3244
3250
  title: "Commit discipline \u2014 never leave verified work floating",
3245
3251
  domain: "workflow",
@@ -331,6 +331,12 @@ var init_platform_procedures = __esm({
331
331
  priority: "p0",
332
332
  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."
333
333
  },
334
+ {
335
+ title: "Code context first for repository orientation",
336
+ domain: "workflow",
337
+ priority: "p1",
338
+ 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."
339
+ },
334
340
  {
335
341
  title: "Commit discipline \u2014 never leave verified work floating",
336
342
  domain: "workflow",
@@ -6508,6 +6508,12 @@ var init_platform_procedures = __esm({
6508
6508
  priority: "p0",
6509
6509
  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."
6510
6510
  },
6511
+ {
6512
+ title: "Code context first for repository orientation",
6513
+ domain: "workflow",
6514
+ priority: "p1",
6515
+ 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."
6516
+ },
6511
6517
  {
6512
6518
  title: "Commit discipline \u2014 never leave verified work floating",
6513
6519
  domain: "workflow",
@@ -7891,6 +7891,12 @@ var init_platform_procedures = __esm({
7891
7891
  priority: "p0",
7892
7892
  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."
7893
7893
  },
7894
+ {
7895
+ title: "Code context first for repository orientation",
7896
+ domain: "workflow",
7897
+ priority: "p1",
7898
+ 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."
7899
+ },
7894
7900
  {
7895
7901
  title: "Commit discipline \u2014 never leave verified work floating",
7896
7902
  domain: "workflow",
@@ -4445,6 +4445,12 @@ var init_platform_procedures = __esm({
4445
4445
  priority: "p0",
4446
4446
  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."
4447
4447
  },
4448
+ {
4449
+ title: "Code context first for repository orientation",
4450
+ domain: "workflow",
4451
+ priority: "p1",
4452
+ 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."
4453
+ },
4448
4454
  {
4449
4455
  title: "Commit discipline \u2014 never leave verified work floating",
4450
4456
  domain: "workflow",
@@ -4201,6 +4201,12 @@ var init_platform_procedures = __esm({
4201
4201
  priority: "p0",
4202
4202
  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."
4203
4203
  },
4204
+ {
4205
+ title: "Code context first for repository orientation",
4206
+ domain: "workflow",
4207
+ priority: "p1",
4208
+ 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."
4209
+ },
4204
4210
  {
4205
4211
  title: "Commit discipline \u2014 never leave verified work floating",
4206
4212
  domain: "workflow",
@@ -4125,6 +4125,12 @@ var init_platform_procedures = __esm({
4125
4125
  priority: "p0",
4126
4126
  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
4127
  },
4128
+ {
4129
+ title: "Code context first for repository orientation",
4130
+ domain: "workflow",
4131
+ priority: "p1",
4132
+ 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."
4133
+ },
4128
4134
  {
4129
4135
  title: "Commit discipline \u2014 never leave verified work floating",
4130
4136
  domain: "workflow",
@@ -4794,6 +4794,12 @@ var init_platform_procedures = __esm({
4794
4794
  priority: "p0",
4795
4795
  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
4796
  },
4797
+ {
4798
+ title: "Code context first for repository orientation",
4799
+ domain: "workflow",
4800
+ priority: "p1",
4801
+ 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."
4802
+ },
4797
4803
  {
4798
4804
  title: "Commit discipline \u2014 never leave verified work floating",
4799
4805
  domain: "workflow",
@@ -6152,13 +6158,25 @@ var init_wiki_client = __esm({
6152
6158
 
6153
6159
  // src/lib/code-chunker.ts
6154
6160
  import ts from "typescript";
6161
+ function languageForFile(filePath) {
6162
+ const base = filePath.split(/[\\/]/).pop()?.toLowerCase() ?? "";
6163
+ if (["dockerfile", "makefile", "rakefile", "gemfile"].includes(base)) return base;
6164
+ const ext = base.includes(".") ? base.split(".").pop() : void 0;
6165
+ return ext ? LANGUAGE_BY_EXTENSION[ext] : void 0;
6166
+ }
6155
6167
  function chunkSourceFile(source, fileName = "file.ts") {
6168
+ const language = languageForFile(fileName);
6169
+ if (language === "typescript" || language === "javascript") {
6170
+ return chunkTypeScriptLike(source, fileName);
6171
+ }
6172
+ return chunkGenericSource(source, fileName, language);
6173
+ }
6174
+ function chunkTypeScriptLike(source, fileName) {
6156
6175
  const sourceFile = ts.createSourceFile(
6157
6176
  fileName,
6158
6177
  source,
6159
6178
  ts.ScriptTarget.Latest,
6160
6179
  true,
6161
- // setParentNodes
6162
6180
  fileName.endsWith(".tsx") || fileName.endsWith(".jsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS
6163
6181
  );
6164
6182
  const chunks = [];
@@ -6180,153 +6198,176 @@ function chunkSourceFile(source, fileName = "file.ts") {
6180
6198
  if (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node)) {
6181
6199
  return node.name?.getText(sourceFile) ?? "(anonymous)";
6182
6200
  }
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
- }
6201
+ if (ts.isClassDeclaration(node)) return node.name?.getText(sourceFile) ?? "(anonymous class)";
6202
+ if (ts.isInterfaceDeclaration(node)) return node.name.getText(sourceFile);
6203
+ if (ts.isTypeAliasDeclaration(node)) return node.name.getText(sourceFile);
6204
+ if (ts.isEnumDeclaration(node)) return node.name.getText(sourceFile);
6205
+ if (ts.isVariableStatement(node)) return node.declarationList.declarations.map((d) => d.name.getText(sourceFile)).join(", ");
6206
+ if (ts.isExportAssignment(node)) return "default export";
6202
6207
  return "(unknown)";
6203
6208
  }
6204
6209
  function visitTopLevel(node) {
6205
6210
  if (ts.isImportDeclaration(node)) {
6206
- importLines.push({
6207
- start: getLineNumber(node.getStart(sourceFile)),
6208
- end: getLineNumber(node.getEnd())
6209
- });
6211
+ importLines.push({ start: getLineNumber(node.getStart(sourceFile)), end: getLineNumber(node.getEnd()) });
6210
6212
  return;
6211
6213
  }
6212
6214
  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
- });
6215
+ chunks.push({ kind: "function", name: getName(node), text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
6221
6216
  return;
6222
6217
  }
6223
6218
  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
- });
6219
+ chunks.push({ kind: "class", name: getName(node), text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
6243
6220
  return;
6244
6221
  }
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
- });
6222
+ if (ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node) || ts.isEnumDeclaration(node)) {
6223
+ chunks.push({ kind: "type", name: getName(node), text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
6265
6224
  return;
6266
6225
  }
6267
6226
  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
- });
6227
+ const isFnLike = node.declarationList.declarations.some((d) => d.initializer && (ts.isArrowFunction(d.initializer) || ts.isFunctionExpression(d.initializer)));
6228
+ 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
6229
  return;
6281
6230
  }
6282
6231
  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
- });
6232
+ chunks.push({ kind: "export", name: "default export", text: getNodeText(node), startLine: getLineNumber(node.getStart(sourceFile)), endLine: getLineNumber(node.getEnd()), comment: getLeadingComment(node) });
6291
6233
  return;
6292
6234
  }
6293
6235
  if (ts.isExpressionStatement(node)) {
6294
6236
  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;
6237
+ 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
6238
  }
6306
6239
  }
6307
6240
  sourceFile.statements.forEach(visitTopLevel);
6308
6241
  if (importLines.length > 0) {
6309
6242
  const startLine = importLines[0].start;
6310
6243
  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,
6244
+ chunks.unshift({ kind: "import", name: `${importLines.length} imports`, text: lines.slice(startLine - 1, endLine).join("\n"), startLine, endLine });
6245
+ }
6246
+ chunks.sort((a, b) => a.startLine - b.startLine);
6247
+ return chunks.length > 0 ? chunks : chunkByWindows(source, 80);
6248
+ }
6249
+ function chunkGenericSource(source, _fileName, language) {
6250
+ const lines = source.split("\n");
6251
+ if (source.trim().length === 0) return [];
6252
+ if (language && TEXT_LIKE_LANGUAGES.has(language)) return chunkTextLike(lines, language);
6253
+ const chunks = [];
6254
+ const patterns = [
6255
+ { kind: "function", regex: /^\s*(?:async\s+)?def\s+([A-Za-z_][\w]*)\s*\(/, name: (m) => m[1] },
6256
+ { kind: "class", regex: /^\s*class\s+([A-Za-z_][\w]*)\b/, name: (m) => m[1] },
6257
+ { kind: "function", regex: /^\s*(?:pub\s+)?fn\s+([A-Za-z_][\w]*)\s*[<(]/, name: (m) => m[1] },
6258
+ { kind: "class", regex: /^\s*(?:pub\s+)?(?:struct|enum|trait)\s+([A-Za-z_][\w]*)\b/, name: (m) => m[1] },
6259
+ { kind: "function", regex: /^\s*func\s+(?:\([^)]*\)\s*)?([A-Za-z_][\w]*)\s*\(/, name: (m) => m[1] },
6260
+ { 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] },
6261
+ { kind: "function", regex: /^\s*function\s+([A-Za-z_][\w]*)\s*\(/, name: (m) => m[1] },
6262
+ { 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] },
6263
+ { kind: "section", regex: /^\s{0,3}#{1,6}\s+(.+)$/, name: (m) => m[1].trim() }
6264
+ ];
6265
+ const starts = [];
6266
+ for (let i = 0; i < lines.length; i++) {
6267
+ const line = lines[i];
6268
+ for (const pattern of patterns) {
6269
+ const match = line.match(pattern.regex);
6270
+ if (match) {
6271
+ starts.push({ line: i + 1, kind: pattern.kind, name: pattern.name(match) });
6272
+ break;
6273
+ }
6274
+ }
6275
+ }
6276
+ if (starts.length === 0) return chunkByWindows(source, 80);
6277
+ for (let i = 0; i < starts.length; i++) {
6278
+ const start = starts[i];
6279
+ const next = starts[i + 1]?.line ?? lines.length + 1;
6280
+ const endLine = Math.max(start.line, next - 1);
6281
+ chunks.push({
6282
+ kind: start.kind,
6283
+ name: start.name,
6284
+ text: lines.slice(start.line - 1, endLine).join("\n"),
6285
+ startLine: start.line,
6317
6286
  endLine
6318
6287
  });
6319
6288
  }
6320
- chunks.sort((a, b) => a.startLine - b.startLine);
6289
+ return chunks;
6290
+ }
6291
+ function chunkTextLike(lines, language) {
6292
+ if (language === "markdown" || language === "mdx") {
6293
+ const starts = lines.map((line, i) => ({ line, i })).filter(({ line }) => /^\s{0,3}#{1,6}\s+/.test(line));
6294
+ if (starts.length > 0) {
6295
+ return starts.map((start, idx) => {
6296
+ const end = starts[idx + 1]?.i ?? lines.length;
6297
+ const title = start.line.replace(/^\s{0,3}#{1,6}\s+/, "").trim();
6298
+ return { kind: "section", name: title, text: lines.slice(start.i, end).join("\n"), startLine: start.i + 1, endLine: end };
6299
+ });
6300
+ }
6301
+ }
6302
+ return chunkByWindows(lines.join("\n"), 80);
6303
+ }
6304
+ function chunkByWindows(source, windowLines) {
6305
+ const lines = source.split("\n");
6306
+ const chunks = [];
6307
+ for (let i = 0; i < lines.length; i += windowLines) {
6308
+ const end = Math.min(lines.length, i + windowLines);
6309
+ const text = lines.slice(i, end).join("\n");
6310
+ if (text.trim()) chunks.push({ kind: "other", name: `lines ${i + 1}-${end}`, text, startLine: i + 1, endLine: end });
6311
+ }
6321
6312
  return chunks;
6322
6313
  }
6323
6314
  function isChunkable(filePath) {
6324
- const ext = filePath.split(".").pop()?.toLowerCase();
6325
- return ext === "ts" || ext === "tsx" || ext === "js" || ext === "jsx";
6315
+ return Boolean(languageForFile(filePath));
6326
6316
  }
6317
+ var LANGUAGE_BY_EXTENSION, TEXT_LIKE_LANGUAGES;
6327
6318
  var init_code_chunker = __esm({
6328
6319
  "src/lib/code-chunker.ts"() {
6329
6320
  "use strict";
6321
+ LANGUAGE_BY_EXTENSION = {
6322
+ c: "c",
6323
+ cc: "cpp",
6324
+ cpp: "cpp",
6325
+ cxx: "cpp",
6326
+ h: "c",
6327
+ hh: "cpp",
6328
+ hpp: "cpp",
6329
+ cs: "csharp",
6330
+ css: "css",
6331
+ scss: "scss",
6332
+ f: "fortran",
6333
+ f90: "fortran",
6334
+ f95: "fortran",
6335
+ go: "go",
6336
+ html: "html",
6337
+ htm: "html",
6338
+ java: "java",
6339
+ js: "javascript",
6340
+ jsx: "javascript",
6341
+ json: "json",
6342
+ kt: "kotlin",
6343
+ kts: "kotlin",
6344
+ lua: "lua",
6345
+ md: "markdown",
6346
+ mdx: "mdx",
6347
+ pas: "pascal",
6348
+ php: "php",
6349
+ py: "python",
6350
+ r: "r",
6351
+ rb: "ruby",
6352
+ rs: "rust",
6353
+ scala: "scala",
6354
+ sc: "scala",
6355
+ sol: "solidity",
6356
+ sql: "sql",
6357
+ svelte: "svelte",
6358
+ swift: "swift",
6359
+ toml: "toml",
6360
+ ts: "typescript",
6361
+ tsx: "typescript",
6362
+ vue: "vue",
6363
+ xml: "xml",
6364
+ yaml: "yaml",
6365
+ yml: "yaml",
6366
+ sh: "shell",
6367
+ bash: "shell",
6368
+ zsh: "shell"
6369
+ };
6370
+ TEXT_LIKE_LANGUAGES = /* @__PURE__ */ new Set(["json", "markdown", "mdx", "toml", "yaml", "xml", "html", "css", "scss", "sql"]);
6330
6371
  }
6331
6372
  });
6332
6373
 
@@ -4164,6 +4164,12 @@ var init_platform_procedures = __esm({
4164
4164
  priority: "p0",
4165
4165
  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
4166
  },
4167
+ {
4168
+ title: "Code context first for repository orientation",
4169
+ domain: "workflow",
4170
+ priority: "p1",
4171
+ 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."
4172
+ },
4167
4173
  {
4168
4174
  title: "Commit discipline \u2014 never leave verified work floating",
4169
4175
  domain: "workflow",
@@ -4125,6 +4125,12 @@ var init_platform_procedures = __esm({
4125
4125
  priority: "p0",
4126
4126
  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
4127
  },
4128
+ {
4129
+ title: "Code context first for repository orientation",
4130
+ domain: "workflow",
4131
+ priority: "p1",
4132
+ 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."
4133
+ },
4128
4134
  {
4129
4135
  title: "Commit discipline \u2014 never leave verified work floating",
4130
4136
  domain: "workflow",
@@ -4223,6 +4223,12 @@ var init_platform_procedures = __esm({
4223
4223
  priority: "p0",
4224
4224
  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
4225
  },
4226
+ {
4227
+ title: "Code context first for repository orientation",
4228
+ domain: "workflow",
4229
+ priority: "p1",
4230
+ 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."
4231
+ },
4226
4232
  {
4227
4233
  title: "Commit discipline \u2014 never leave verified work floating",
4228
4234
  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",
@@ -4562,6 +4562,12 @@ var init_platform_procedures = __esm({
4562
4562
  priority: "p0",
4563
4563
  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
4564
  },
4565
+ {
4566
+ title: "Code context first for repository orientation",
4567
+ domain: "workflow",
4568
+ priority: "p1",
4569
+ 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."
4570
+ },
4565
4571
  {
4566
4572
  title: "Commit discipline \u2014 never leave verified work floating",
4567
4573
  domain: "workflow",
@@ -4628,6 +4628,12 @@ var init_platform_procedures = __esm({
4628
4628
  priority: "p0",
4629
4629
  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
4630
  },
4631
+ {
4632
+ title: "Code context first for repository orientation",
4633
+ domain: "workflow",
4634
+ priority: "p1",
4635
+ 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."
4636
+ },
4631
4637
  {
4632
4638
  title: "Commit discipline \u2014 never leave verified work floating",
4633
4639
  domain: "workflow",
@@ -4667,6 +4667,12 @@ var init_platform_procedures = __esm({
4667
4667
  priority: "p0",
4668
4668
  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
4669
  },
4670
+ {
4671
+ title: "Code context first for repository orientation",
4672
+ domain: "workflow",
4673
+ priority: "p1",
4674
+ 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."
4675
+ },
4670
4676
  {
4671
4677
  title: "Commit discipline \u2014 never leave verified work floating",
4672
4678
  domain: "workflow",
@@ -3008,6 +3008,12 @@ var init_platform_procedures = __esm({
3008
3008
  priority: "p0",
3009
3009
  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."
3010
3010
  },
3011
+ {
3012
+ title: "Code context first for repository orientation",
3013
+ domain: "workflow",
3014
+ priority: "p1",
3015
+ 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."
3016
+ },
3011
3017
  {
3012
3018
  title: "Commit discipline \u2014 never leave verified work floating",
3013
3019
  domain: "workflow",
@@ -5265,10 +5271,7 @@ async function renameEmployee(oldName, newName, opts = {}) {
5265
5271
  const newIdentityPath = path8.join(identityDir, `${newName}.md`);
5266
5272
  if (existsSync8(oldIdentityPath)) {
5267
5273
  const content = readFileSync5(oldIdentityPath, "utf-8");
5268
- const updatedContent = content.replace(
5269
- /^(agent_id:\s*)\S+/m,
5270
- `$1${newName}`
5271
- );
5274
+ const updatedContent = rewriteRenamedEmployeeContent(content, rosterOldName, newName);
5272
5275
  renameSync4(oldIdentityPath, newIdentityPath);
5273
5276
  writeFileSync3(newIdentityPath, updatedContent, "utf-8");
5274
5277
  rollbackStack.push({
@@ -5285,7 +5288,9 @@ async function renameEmployee(oldName, newName, opts = {}) {
5285
5288
  const newAgentPath = path8.join(agentsDir, `${newName}.md`);
5286
5289
  if (existsSync8(oldAgentPath)) {
5287
5290
  const agentContent = readFileSync5(oldAgentPath, "utf-8");
5291
+ const updatedAgentContent = rewriteRenamedEmployeeContent(agentContent, rosterOldName, newName);
5288
5292
  renameSync4(oldAgentPath, newAgentPath);
5293
+ writeFileSync3(newAgentPath, updatedAgentContent, "utf-8");
5289
5294
  rollbackStack.push({
5290
5295
  description: "restore agent file",
5291
5296
  undo: () => {
@@ -5358,6 +5363,10 @@ async function renameEmployee(oldName, newName, opts = {}) {
5358
5363
  return { success: false, error: err instanceof Error ? err.message : String(err) };
5359
5364
  }
5360
5365
  }
5366
+ function rewriteRenamedEmployeeContent(content, oldName, newName) {
5367
+ const withAgentId = content.replace(/^(agent_id:\s*)\S+/m, `$1${newName}`);
5368
+ return personalizePrompt(withAgentId, oldName, newName);
5369
+ }
5361
5370
  function findExeBin2() {
5362
5371
  try {
5363
5372
  return execSync3(process.platform === "win32" ? "where exe-os" : "which exe-os", { encoding: "utf8" }).trim();
@@ -4139,6 +4139,12 @@ var init_platform_procedures = __esm({
4139
4139
  priority: "p0",
4140
4140
  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."
4141
4141
  },
4142
+ {
4143
+ title: "Code context first for repository orientation",
4144
+ domain: "workflow",
4145
+ priority: "p1",
4146
+ 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."
4147
+ },
4142
4148
  {
4143
4149
  title: "Commit discipline \u2014 never leave verified work floating",
4144
4150
  domain: "workflow",