github-router 0.3.321 → 0.3.323

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 (105) hide show
  1. package/dist/{aic-ledger-BrDqsuge.js → aic-ledger-DRU89gJg.js} +20 -3
  2. package/dist/aic-ledger-DRU89gJg.js.map +1 -0
  3. package/dist/{attribution-settings-DHWo0lyG.js → attribution-settings-CX-kIrT8.js} +292 -101
  4. package/dist/attribution-settings-CX-kIrT8.js.map +1 -0
  5. package/dist/{auth-Iun7ftd8.js → auth-DSLN1arH.js} +3 -3
  6. package/dist/{auth-Iun7ftd8.js.map → auth-DSLN1arH.js.map} +1 -1
  7. package/dist/browser-ext/manifest.json +1 -1
  8. package/dist/{check-usage-1c-0z3iy.js → check-usage-B_12ALvf.js} +4 -4
  9. package/dist/{check-usage-1c-0z3iy.js.map → check-usage-B_12ALvf.js.map} +1 -1
  10. package/dist/{claude-uAFPKvuS.js → claude-Cq1xGzbI.js} +61 -49
  11. package/dist/claude-Cq1xGzbI.js.map +1 -0
  12. package/dist/{codex-CVHdye0h.js → codex-INt1hc_5.js} +5 -5
  13. package/dist/{codex-CVHdye0h.js.map → codex-INt1hc_5.js.map} +1 -1
  14. package/dist/{copilot-discount-BnJkEojk.js → copilot-discount-D8t7Q3Tp.js} +2 -2
  15. package/dist/{copilot-discount-BnJkEojk.js.map → copilot-discount-D8t7Q3Tp.js.map} +1 -1
  16. package/dist/{debug-CDyXUPcC.js → debug-D8iD6G4O.js} +2 -2
  17. package/dist/{debug-CDyXUPcC.js.map → debug-D8iD6G4O.js.map} +1 -1
  18. package/dist/engine-4uuaURb0.js +2 -0
  19. package/dist/{fast-profile-contract-_DhIWank.js → fast-profile-contract-DmsyQQrw.js} +6 -11
  20. package/dist/fast-profile-contract-DmsyQQrw.js.map +1 -0
  21. package/dist/{gate-discovery-DUBuxiLb.js → gate-discovery-Z0QyjqM7.js} +5 -5
  22. package/dist/{gate-discovery-DUBuxiLb.js.map → gate-discovery-Z0QyjqM7.js.map} +1 -1
  23. package/dist/{get-copilot-usage-BWCAzmSc.js → get-copilot-usage-Bs-FEPMf.js} +2 -2
  24. package/dist/{get-copilot-usage-BWCAzmSc.js.map → get-copilot-usage-Bs-FEPMf.js.map} +1 -1
  25. package/dist/hooks.mjs +6 -12
  26. package/dist/hooks.sha256 +1 -1
  27. package/dist/{internal-aic-status-Dc2JQDsX.js → internal-aic-status-BaUKlisM.js} +3 -3
  28. package/dist/{internal-aic-status-Dc2JQDsX.js.map → internal-aic-status-BaUKlisM.js.map} +1 -1
  29. package/dist/{internal-artifact-open-CA1trJ15.js → internal-artifact-open-U-Ht7R-O.js} +2 -2
  30. package/dist/{internal-artifact-open-CA1trJ15.js.map → internal-artifact-open-U-Ht7R-O.js.map} +1 -1
  31. package/dist/{internal-fast-dispatch-guard-CZ4BZuAG.js → internal-fast-dispatch-guard-Dnjoj0pV.js} +4 -5
  32. package/dist/internal-fast-dispatch-guard-Dnjoj0pV.js.map +1 -0
  33. package/dist/{internal-fast-dispatch-guard-D5kozMpo.js → internal-fast-dispatch-guard-uztSu0c8.js} +1 -1
  34. package/dist/{internal-first-mate-guard-B_or0eN3.js → internal-first-mate-guard-Dvd1vZ4l.js} +1 -1
  35. package/dist/{internal-first-mate-guard-CiFH6X1H.js → internal-first-mate-guard-mvfZal_M.js} +3 -3
  36. package/dist/{internal-first-mate-guard-CiFH6X1H.js.map → internal-first-mate-guard-mvfZal_M.js.map} +1 -1
  37. package/dist/{internal-max-dispatch-guard-BGOHRYRt.js → internal-max-dispatch-guard-CxG_c3cc.js} +1 -1
  38. package/dist/{internal-max-dispatch-guard-CnBZxo5l.js → internal-max-dispatch-guard-Sp_rCYk_.js} +2 -2
  39. package/dist/{internal-max-dispatch-guard-CnBZxo5l.js.map → internal-max-dispatch-guard-Sp_rCYk_.js.map} +1 -1
  40. package/dist/{internal-plan-review-C73snnD8.js → internal-plan-review-Co01iHOW.js} +3 -3
  41. package/dist/{internal-plan-review-C73snnD8.js.map → internal-plan-review-Co01iHOW.js.map} +1 -1
  42. package/dist/{internal-prompt-submit-dov4UvBo.js → internal-prompt-submit-dflz0bqH.js} +4 -4
  43. package/dist/{internal-prompt-submit-dov4UvBo.js.map → internal-prompt-submit-dflz0bqH.js.map} +1 -1
  44. package/dist/{internal-session-bind-C3hrb9rP.js → internal-session-bind-BVQy7Vd4.js} +2 -2
  45. package/dist/{internal-session-bind-C3hrb9rP.js.map → internal-session-bind-BVQy7Vd4.js.map} +1 -1
  46. package/dist/{internal-stop-hook-DCjYE2x0.js → internal-stop-hook-DihBVzn2.js} +5 -5
  47. package/dist/{internal-stop-hook-DCjYE2x0.js.map → internal-stop-hook-DihBVzn2.js.map} +1 -1
  48. package/dist/{internal-stop-review-MBVYtrYS.js → internal-stop-review-CrnG4IJo.js} +2 -2
  49. package/dist/{internal-stop-review-MBVYtrYS.js.map → internal-stop-review-CrnG4IJo.js.map} +1 -1
  50. package/dist/{internal-worker-guard-dxGawAY3.js → internal-worker-guard-BSoS4wzV.js} +2 -2
  51. package/dist/{internal-worker-guard-dxGawAY3.js.map → internal-worker-guard-BSoS4wzV.js.map} +1 -1
  52. package/dist/{internal-workspace-header-_aEXOz5q.js → internal-workspace-header-booLOzwD.js} +2 -2
  53. package/dist/{internal-workspace-header-_aEXOz5q.js.map → internal-workspace-header-booLOzwD.js.map} +1 -1
  54. package/dist/{lifecycle-CJB2BwSJ.js → lifecycle-BYPEqFdV.js} +2 -2
  55. package/dist/{lifecycle-CJB2BwSJ.js.map → lifecycle-BYPEqFdV.js.map} +1 -1
  56. package/dist/{lifecycle-_BE0SnNs.js → lifecycle-C1LDvDD6.js} +2 -2
  57. package/dist/{lifecycle-_BE0SnNs.js.map → lifecycle-C1LDvDD6.js.map} +1 -1
  58. package/dist/lifecycle-Cz99P30h.js +2 -0
  59. package/dist/lifecycle-DqTFEJpS.js +2 -0
  60. package/dist/main.js +20 -20
  61. package/dist/{mcp-workspace-header-mXRLE8kg.js → mcp-workspace-header-BIW0SRgs.js} +2 -2
  62. package/dist/{mcp-workspace-header-mXRLE8kg.js.map → mcp-workspace-header-BIW0SRgs.js.map} +1 -1
  63. package/dist/{models-CSFIVxAH.js → models-B9tdaM6B.js} +3 -3
  64. package/dist/{models-CSFIVxAH.js.map → models-B9tdaM6B.js.map} +1 -1
  65. package/dist/{orchestration-B8kypXcZ.js → orchestration-DvsdorFq.js} +2 -2
  66. package/dist/{orchestration-B8kypXcZ.js.map → orchestration-DvsdorFq.js.map} +1 -1
  67. package/dist/{paths-CHBAj_t9.js → paths-BnZwolac.js} +4 -4
  68. package/dist/{paths-CHBAj_t9.js.map → paths-BnZwolac.js.map} +1 -1
  69. package/dist/paths-BzM6uxmd.js +2 -0
  70. package/dist/{peer-mcp-personas-BerVEkZ9.js → peer-mcp-personas-DcAErb_d.js} +209 -71
  71. package/dist/peer-mcp-personas-DcAErb_d.js.map +1 -0
  72. package/dist/{plan-review-hook-BMmw7wxR.js → plan-review-hook-BlsGnG02.js} +3 -3
  73. package/dist/{plan-review-hook-BMmw7wxR.js.map → plan-review-hook-BlsGnG02.js.map} +1 -1
  74. package/dist/{prompt-submit-hook-CGgT5m4Q.js → prompt-submit-hook-BJFLzCaT.js} +3 -3
  75. package/dist/{prompt-submit-hook-CGgT5m4Q.js.map → prompt-submit-hook-BJFLzCaT.js.map} +1 -1
  76. package/dist/{provision-o4bXbsvB.js → provision-B-a5KUCL.js} +4 -4
  77. package/dist/{provision-o4bXbsvB.js.map → provision-B-a5KUCL.js.map} +1 -1
  78. package/dist/{self-invocation-DahN1gw9.js → self-invocation-opSXHEs0.js} +2 -2
  79. package/dist/{self-invocation-DahN1gw9.js.map → self-invocation-opSXHEs0.js.map} +1 -1
  80. package/dist/{serve-DSL2Fcnc.js → serve-TiUhvpVp.js} +12 -12
  81. package/dist/{serve-DSL2Fcnc.js.map → serve-TiUhvpVp.js.map} +1 -1
  82. package/dist/{server-setup-CXXKmPIE.js → server-setup-CgbHmupe.js} +205 -57
  83. package/dist/server-setup-CgbHmupe.js.map +1 -0
  84. package/dist/{start-Cl_1UMg_.js → start-DNzOFabp.js} +3 -3
  85. package/dist/{start-Cl_1UMg_.js.map → start-DNzOFabp.js.map} +1 -1
  86. package/dist/{stop-gate-hook-D7N759TG.js → stop-gate-hook-DvNM8zFf.js} +3 -3
  87. package/dist/{stop-gate-hook-D7N759TG.js.map → stop-gate-hook-DvNM8zFf.js.map} +1 -1
  88. package/dist/{stop-gate-policy-C0gt04R0.js → stop-gate-policy-C5pXbY59.js} +2 -2
  89. package/dist/{stop-gate-policy-C0gt04R0.js.map → stop-gate-policy-C5pXbY59.js.map} +1 -1
  90. package/dist/{token-86uk6y4P.js → token-Css-ARGL.js} +2 -2
  91. package/dist/{token-86uk6y4P.js.map → token-Css-ARGL.js.map} +1 -1
  92. package/dist/{worker-dispatch-B-OA7tvU.js → worker-dispatch-DwS99DXz.js} +2 -2
  93. package/dist/{worker-dispatch-B-OA7tvU.js.map → worker-dispatch-DwS99DXz.js.map} +1 -1
  94. package/package.json +1 -1
  95. package/dist/aic-ledger-BrDqsuge.js.map +0 -1
  96. package/dist/attribution-settings-DHWo0lyG.js.map +0 -1
  97. package/dist/claude-uAFPKvuS.js.map +0 -1
  98. package/dist/engine-57iIqICe.js +0 -2
  99. package/dist/fast-profile-contract-_DhIWank.js.map +0 -1
  100. package/dist/internal-fast-dispatch-guard-CZ4BZuAG.js.map +0 -1
  101. package/dist/lifecycle-D0KsoSqz.js +0 -2
  102. package/dist/lifecycle-DimEguJO.js +0 -2
  103. package/dist/paths-eHoOwFzZ.js +0 -2
  104. package/dist/peer-mcp-personas-BerVEkZ9.js.map +0 -1
  105. package/dist/server-setup-CXXKmPIE.js.map +0 -1
@@ -1,12 +1,12 @@
1
- import { An as oneMContextDisabled, Fn as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, Hn as CHEAP_PROFILE_NATIVE_EFFORTS, In as CHEAPEST_PROFILE_NATIVE_EFFORTS, Vn as CHEAP_PROFILE_NATIVE_AGENT_NAMES, a as buildAgentPrompt, jn as withOneMSuffix, l as maxPersonasFor, ln as CONDENSED_OPERATING_SEQUENCE, n as MCP_GROUPS, t as GROUP_META, u as personasFor, un as DEFINITION_OF_GREATNESS } from "./peer-mcp-personas-BerVEkZ9.js";
2
- import { a as isUnderClaudeConfigMirror, f as writeRuntimeFileSecure, t as PATHS } from "./paths-CHBAj_t9.js";
3
- import { S as LUNA_SCOUT_ALIAS_ID, _ as CHEAP_EXPLORE_ALIAS_ID, b as CHEAP_PLAN_ALIAS_ID, f as CHEAPEST_EXPLORE_ALIAS_ID, g as CHEAPEST_REVIEWER_ALIAS_ID, h as CHEAPEST_PLAN_ALIAS_ID, m as CHEAPEST_IMPLEMENTER_ALIAS_ID, p as CHEAPEST_GENERAL_PURPOSE_ALIAS_ID, v as CHEAP_GENERAL_PURPOSE_ALIAS_ID, x as CHEAP_REVIEWER_ALIAS_ID, y as CHEAP_IMPLEMENTER_ALIAS_ID } from "./server-setup-CXXKmPIE.js";
4
- import { c as FAST_PROFILE_MODELS, d as FAST_PROFILE_NATIVE_MODELS, l as FAST_PROFILE_NATIVE_AGENT_NAMES, u as FAST_PROFILE_NATIVE_EFFORTS } from "./fast-profile-contract-_DhIWank.js";
1
+ import { Ln as BALANCED_PROFILE_NATIVE_AGENT_NAMES, Nn as oneMContextDisabled, Pn as withOneMSuffix, Rn as BALANCED_PROFILE_NATIVE_EFFORTS, Un as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, Wn as CHEAPEST_PROFILE_NATIVE_EFFORTS, Xn as CHEAP_PROFILE_NATIVE_EFFORTS, Yn as CHEAP_PROFILE_NATIVE_AGENT_NAMES, a as buildAgentPrompt, fn as CONDENSED_OPERATING_SEQUENCE, l as maxPersonasFor, n as MCP_GROUPS, pn as DEFINITION_OF_GREATNESS, t as GROUP_META, u as personasFor } from "./peer-mcp-personas-DcAErb_d.js";
2
+ import { a as isUnderClaudeConfigMirror, f as writeRuntimeFileSecure, t as PATHS } from "./paths-BnZwolac.js";
3
+ import { C as CHEAP_REVIEWER_ALIAS_ID, S as CHEAP_PLAN_ALIAS_ID, _ as CHEAPEST_GENERAL_PURPOSE_ALIAS_ID, b as CHEAP_EXPLORE_ALIAS_ID, f as BALANCED_EXPLORE_ALIAS_ID, g as CHEAPEST_EXPLORE_ALIAS_ID, h as BALANCED_REVIEWER_ALIAS_ID, m as BALANCED_PLAN_ALIAS_ID, p as BALANCED_GENERAL_PURPOSE_ALIAS_ID, v as CHEAPEST_PLAN_ALIAS_ID, w as LUNA_SCOUT_ALIAS_ID, x as CHEAP_GENERAL_PURPOSE_ALIAS_ID, y as CHEAPEST_REVIEWER_ALIAS_ID } from "./server-setup-CgbHmupe.js";
4
+ import { c as FAST_PROFILE_MODELS, d as FAST_PROFILE_NATIVE_MODELS, l as FAST_PROFILE_NATIVE_AGENT_NAMES, u as FAST_PROFILE_NATIVE_EFFORTS } from "./fast-profile-contract-DmsyQQrw.js";
5
5
  import { C as MAX_PARALLELISM_RULE, S as MAX_COORDINATOR_PROMPT, T as maxNativePrompt, a as MAX_PROFILE_NATIVE_AGENT_NAMES, i as MAX_PROFILE_MODELS, o as MAX_PROFILE_NATIVE_EFFORTS, s as MAX_PROFILE_NATIVE_MODELS, w as maxNativeDescription, x as MAX_COORDINATOR_DESCRIPTION } from "./max-profile-contract-Bl7I_EOC.js";
6
- import "./self-invocation-DahN1gw9.js";
7
- import { a as STRIPPED_AUTH_ROUTING_ENV_KEYS, n as buildCodexProviderConfigFlags } from "./provision-o4bXbsvB.js";
8
- import { n as buildWorkspaceHeaderHelperCommand } from "./mcp-workspace-header-mXRLE8kg.js";
9
- import { a as dispatcherAgentName, c as dispatcherTools, n as activeDispatchModes, o as dispatcherDescription, s as dispatcherPrompt } from "./worker-dispatch-B-OA7tvU.js";
6
+ import "./self-invocation-opSXHEs0.js";
7
+ import { a as STRIPPED_AUTH_ROUTING_ENV_KEYS, n as buildCodexProviderConfigFlags } from "./provision-B-a5KUCL.js";
8
+ import { n as buildWorkspaceHeaderHelperCommand } from "./mcp-workspace-header-BIW0SRgs.js";
9
+ import { a as dispatcherAgentName, c as dispatcherTools, n as activeDispatchModes, o as dispatcherDescription, s as dispatcherPrompt } from "./worker-dispatch-DwS99DXz.js";
10
10
  import consola from "consola";
11
11
  import path from "node:path";
12
12
  import { randomBytes } from "node:crypto";
@@ -222,12 +222,15 @@ function nonEmptyModel(id) {
222
222
  function fileToolSteer(bashUses) {
223
223
  return `Use the dedicated Edit/Write/Read tools for file changes and Grep/Glob for search; reserve Bash for running ${bashUses}, tests, and git. Do not shell out (sed/awk/python/here-docs) to read or edit files.`;
224
224
  }
225
- /** The read-only half of `fileToolSteer`, for agents that never write. */
226
- function readOnlyToolSteer() {
227
- return "Use Read to read files and Grep/Glob plus the semantic code search tool to find them; Bash is for read-only inspection such as git log, git blame, and git show. Do not modify any file, and do not run mutating commands.";
225
+ /** The read-only half of `fileToolSteer`, for agents that never write.
226
+ * Names the semantic code-search tool only when the launch enabled it;
227
+ * otherwise the `code` tool is lexical-only and naming semantic search
228
+ * would send the agent at a mode that just degrades to lexical. */
229
+ function readOnlyToolSteer(semanticAvailable = true) {
230
+ return `Use Read to read files and ${semanticAvailable ? "Grep/Glob plus the semantic code search tool" : "Grep/Glob"} to find them; Bash is for read-only inspection such as git log, git blame, and git show. Do not modify any file, and do not run mutating commands.`;
228
231
  }
229
- function reviewerToolSteer() {
230
- return "Use Read to read files and Grep/Glob plus the semantic code search tool to find them. Use Bash for builds, tests, reproductions, and read-only git inspection; do not modify source-controlled files or use the shell to edit them.";
232
+ function reviewerToolSteer(semanticAvailable = true) {
233
+ return `Use Read to read files and ${semanticAvailable ? "Grep/Glob plus the semantic code search tool" : "Grep/Glob"} to find them. Use Bash for builds, tests, reproductions, and read-only git inspection; do not modify source-controlled files or use the shell to edit them.`;
231
234
  }
232
235
  /**
233
236
  * `tools:` allowlist for read-only natives (`scout`, fast `Explore`, `brainstorm`), modelled
@@ -375,15 +378,103 @@ function buildMaxProfileAgentDefinitions(opts) {
375
378
  for (const name of Object.keys(out)) if (name !== "worker-browse" && !roster.has(name)) delete out[name];
376
379
  return out;
377
380
  }
381
+ /**
382
+ * Shared prompt bodies for the pinned four-agent profiles
383
+ * (`fast`/`cheap`/`cheap1m`/`cheapest`/`balanced`).
384
+ *
385
+ * Cost doctrine, cheapest to most expensive:
386
+ * 1. LEXICAL code search (`mode:"lexical"`/`"exact"`) — zero model cost,
387
+ * exact symbols, filenames, errors, routes, config keys. Always first.
388
+ * 2. SEMANTIC code search (`mode:"semantic"`) — meaning-ranked via ColBERT,
389
+ * for concepts and intent questions. Mentioned ONLY when the launch
390
+ * enabled it (`semanticSearchAvailable`); otherwise the `code` tool is
391
+ * lexical-only and agents must not be told to reach for semantic.
392
+ * 3. `Explore` (budget model) — reads the narrowed files and synthesizes a
393
+ * file:line evidence report. Only the conclusion flows upward.
394
+ * 4. `Plan` (Sol) / `reviewer` (Sonnet/Luna/Gemini) / `oracle` — expensive
395
+ * models see ONLY the synthesized subset, never raw search output.
396
+ *
397
+ * Per-mode tuning:
398
+ * - `cheapest` (straightforward tasks): implicit delegation. The lead
399
+ * handles simple work inline; role descriptions carry no "use
400
+ * proactively" push and no fan-out instruction, so the lead does not pay
401
+ * handoff overhead for work it already holds context for.
402
+ * - `fast`/`cheap`/`cheap1m`/`balanced` (complex tasks): explicit
403
+ * delegation. Descriptions push proactive parallel `Explore` fan-out,
404
+ * `Plan`-first architecture, `General-Purpose` mixed execution, and
405
+ * post-integration `reviewer` verification.
406
+ */
407
+ function pinnedSearchGuidance(semanticAvailable, capitalize = true) {
408
+ const lexical = `${capitalize ? "Start with" : "start with"} exact lexical and symbol search (\`code\` with mode:"lexical" or "exact", plus Grep/Glob) for symbols, filenames, errors, routes, flags, and config keys — it costs no model call`;
409
+ if (!semanticAvailable) return `${lexical}. Pair it with surrounding context lines so callers, guards, and types are visible without a second round trip, and inspect the file whenever the surrounding logic determines the answer.`;
410
+ return `${lexical}; pair semantic search (meaning-ranked, best for intent/concept questions where literal keywords may not appear) with exact lexical and symbol search so that neither naming drift nor synonym mismatch hides a result. Include surrounding context lines in your search results so that callers, guards, and types are visible without a second round trip, and inspect the file whenever the surrounding logic determines the answer.`;
411
+ }
412
+ /**
413
+ * Implicit (cheapest) tuning is composed from the SAME shared remainder as
414
+ * the explicit base — only the proactive-delegation head sentences differ.
415
+ * The tails below are each written once and copied by both variants, so a
416
+ * fix to shared wording lands everywhere and the implicit/explicit diff
417
+ * stays exactly the few sentences that carry the tuning.
418
+ */
419
+ const EXPLORE_DESC_TAIL = "Use when the question spans more than a couple of files. Do not use for planning, edits, or single-file reads. Returns a structured evidence report with file:line citations. Never edits files.";
420
+ function pinnedExploreDescription(explicit) {
421
+ return (explicit ? "Read-only codebase exploration specialist. Use proactively, and launch several in parallel via `Task(subagent_type:\"Explore\")`, to map architecture, trace call chains, or locate the files and symbols a task will touch. " : "Read-only codebase exploration specialist for mapping architecture, tracing call chains, or locating the files and symbols a task touches. ") + EXPLORE_DESC_TAIL;
422
+ }
423
+ function pinnedExplorePrompt(opts) {
424
+ const searchGuidance = pinnedSearchGuidance(opts.semanticAvailable, !opts.explicit);
425
+ return `You are a codebase exploration specialist. Your mission is to map repository structure, discover implementation patterns, trace call chains, and locate the exact files, symbols, and declarations that are relevant to the request. This is read-only work. Do not modify files, do not propose diffs, and do not delegate to other agents. You cannot ask clarifying questions mid-run: ground every answer in repository evidence. If the request is ambiguous, explore the most probable interpretations and record the ambiguity in your report. Start broad, then converge. ${opts.explicit ? "Issue independent searches in parallel in one turn rather than one at a time, and " : ""}${searchGuidance} Confirm every claim at the source before you report it. Stop when further searching stops changing your answer. When you can name the exact files and lines a change would touch, you are done. Report what the repository contains, not what it ought to contain. Do not design a solution or recommend an approach. Return a self-contained result the lead can act on immediately without needing to re-run your discovery.
426
+
427
+ Return format:
428
+ Answer: a direct response to what was asked, in a few sentences.
429
+ Inventory: each relevant file and symbol as file:line, with a one-line description of its role.
430
+ Entry points: where control enters this area, as file:line.
431
+ Conventions in use: the patterns, idioms, error handling, and test style that any change here would be expected to follow, each with a file:line example.
432
+ Gaps and unknowns: what you could not confirm, and where you would look next.
433
+
434
+ ` + readOnlyToolSteer(opts.semanticAvailable);
435
+ }
436
+ const PLAN_DESC_HEAD = "Architecture and implementation planning specialist";
437
+ const PLAN_DESC_TAIL = " Returns a decision-complete, ordered implementation plan with runnable acceptance criteria. Never edits files.";
438
+ function pinnedPlanDescription(explicit) {
439
+ return PLAN_DESC_HEAD + (explicit ? ". Use proactively in plan mode, and whenever sequencing, cross-boundary interfaces, invariants, migration risk, or acceptance criteria deserve a dedicated pass before any code is written. Delegates repository discovery to `Explore` rather than reading broadly itself." : " for sequencing, cross-boundary interfaces, invariants, migration risk, and acceptance criteria before any code is written.") + PLAN_DESC_TAIL;
440
+ }
441
+ function pinnedPlanPrompt(opts) {
442
+ return `You are a software architect and planning specialist. Your mission is to turn a request into a decision-complete implementation plan: an ordered sequence of changes, the invariants that must hold throughout, and acceptance criteria a reviewer can actually run. This is read-only work. Do not modify repository files. Produce the architecture, sequencing, and acceptance criteria for the lead to synthesize and execute. Plan is an advisory planning capability, not an approval gate. Separate discoverable facts from genuine choices. ${opts.explicit ? "Do not sweep the repository yourself: delegate discovery to `Explore`, launching one or more `Explore` subagents in parallel with scoped evidence questions, then read directly only the files needed to resolve trade-offs and write executable steps. " : "Do not sweep the repository broadly yourself: keep discovery narrow, read directly only the files needed to resolve trade-offs and write executable steps, and record any repository fact you could not confirm as an explicit gap. "}Escalate only genuine product or architectural trade-offs, and escalate them as explicit options with consequences and a recommendation, never as an open question. For low-risk details, choose the reading most consistent with the codebase, proceed, and record it as an assumption. When a design trade-off has more than one viable answer and repository evidence cannot settle it, consult Oracle tool with one self-contained brief that states the constraints, the candidate designs, and the evidence you already gathered plus one precise question. If Oracle does not settle it, carry the options and the remaining gap into the plan rather than silently picking one. Delegation: you may invoke Explore and \`reviewer\` for discovery and verification; do not invoke any other subagent. Behavior and code verification belongs to post-implementation review. Write the plan for a General-Purpose execution agent who cannot see your reasoning. Every step must be executable without rediscovering what you already found: name the files, name the interfaces, and state the condition that means the step is done. Prefer the smallest design that satisfies the requirement and fits the conventions already in the codebase. Mark steps that are independent of each other and can run concurrently.
443
+
444
+ Return format:
445
+ Objective: what will be true when this is complete.
446
+ Architectural invariants: what must hold before, during, and after every step.
447
+ Interface contracts: signatures, types, error and edge-case behaviour at each boundary the change crosses.
448
+ Execution steps: ordered. Each names the files it touches, the change it makes, and its done condition. Mark steps that are independent of each other and can run concurrently.
449
+ Acceptance criteria: the exact commands to run and the observable result that counts as passing.
450
+ Critical files: the files an executor must read before starting, as file:line, with why each matters.
451
+ Open questions: any unresolved trade-off, as options with a recommendation. Omit this section if there are none.
452
+
453
+ ` + readOnlyToolSteer(opts.semanticAvailable);
454
+ }
455
+ const GENERAL_PURPOSE_DESC_TAIL = "Drives to a verified end state with changed files and evidence. Do not use for pure discovery (use Explore) or verification-only (use reviewer).";
456
+ function pinnedGeneralPurposeDescription(explicit) {
457
+ return (explicit ? "Autonomous multi-step execution agent. Use proactively for open-ended or mixed tasks combining investigation, tool workflows, and code changes where the approach emerges during work. Follows a Plan handoff when one exists and otherwise investigates before acting. " : "Autonomous multi-step execution agent for open-ended or mixed tasks combining investigation, tool workflows, and code changes where the approach emerges during work. ") + GENERAL_PURPOSE_DESC_TAIL;
458
+ }
459
+ function pinnedGeneralPurposePrompt() {
460
+ return "You are an autonomous execution specialist for mixed, multi-step work. Your mission is to take an open-ended task from investigation through implementation to a verified end state within this turn. Keep going until the task is genuinely done. Do not stop at a diagnosis, a partial fix, or a plan when the request asked for a change. Ground discovery in repository truth. For low-risk ambiguities, choose the interpretation most consistent with the repository, proceed, and record it as an assumption in your report. For material intent gaps that would alter product behavior or security, surface concrete options and a recommendation to the lead. When a Plan handoff exists, follow its ordered steps and acceptance criteria; do not rediscover what the plan already settled — read the critical files it names, execute each step's done condition, and report any step whose premise proves wrong instead of silently replanning. Investigate before you act. Confirm your assumptions against the actual code rather than against the request's description of it. After every command, read the real output and let it decide the next step. When something fails, diagnose the specific cause before trying again. If repeated attempts fail for the same reason and no new information has emerged, stop retrying: re-examine the underlying assumption and take a different path. Escalate rather than expand. If the task turns out to require a change the lead did not sanction, complete the sanctioned part and report the rest as a recommendation. If the task collapses to pure discovery or a single settled edit, do that slice and report the remainder as a recommendation. Do not expand scope. Match the conventions, structure, and test style already present in the files you touch. The lead owns final integration. Verify before you report. Run the builds, linters, or test commands relevant to what you changed. Quote the command run, exit status, and concise decisive output verbatim; if output is long, summarize the middle and quote the pass/fail lines. Report your changes and test output directly to the caller. Post-integration review is owned by the lead. Return a self-contained result the lead can act on immediately.\n\nReturn format:\nOutcome: what is now true, and whether the task is complete.\nActions taken: what you did, in order.\nChanged files: each as file:line, with a one-line description of the change.\nVerification: the commands you ran, exit status, and decisive output.\nAssumptions: every interpretation you had to choose.\nRemaining items: anything deliberately not done, and why.\n\n" + fileToolSteer("builds");
461
+ }
462
+ const REVIEWER_DESC_TAIL = "Runs builds/tests itself rather than assuming them. Returns SHIP / FIX / BLOCK with reproducible evidence. Never edits source.";
463
+ function pinnedReviewerDescription(explicit) {
464
+ return (explicit ? "Adversarial evidence-based reviewer. Use proactively post-integration after behavior-changing, cross-boundary, or risk-sensitive changes, before done. " : "Adversarial evidence-based reviewer for behavior-changing, cross-boundary, or risk-sensitive changes. ") + REVIEWER_DESC_TAIL;
465
+ }
466
+ function pinnedReviewerPrompt(semanticAvailable = true) {
467
+ return "You are an adversarial code reviewer. Your job is not to confirm that the change works. Your job is to find the conditions under which it does not. Think carefully about the plausible failure modes of this change before you start running commands, so that what you run is chosen to expose them. Read before you judge. Inspect the changed files and relevant surrounding context, callers of affected call sites, and tests that claim to cover the change, sized to the identified risks of the change. Then verify by execution. Run the builds, linters, or test suites relevant to what changed, and any command that would surface the specific failure you suspect. Verification means output you observed. Never state that something passes, compiles, or is covered unless you ran it and read the result; where you could not run something, say so explicitly rather than inferring the outcome. Probe deliberately: boundary and empty inputs, error and early-return paths, concurrency and ordering, resource acquisition and cleanup on the failure path, partial failure and retry, backward compatibility of any changed interface, handling of untrusted input, and whether the new tests would actually fail if the change were reverted. Judge against the bar the repository already holds itself to, not an abstract ideal. Do not soften a real finding, and do not manufacture findings to appear thorough. If the change is correct and verified, say so. Do not modify source code and do not delegate to other agents. You may run build, test, and read-only inspection commands; do not run commands that alter tracked source files or touch remote infrastructure (transient build cache or test runner side effects are expected). Return a self-contained result the lead can act on immediately.\n\nReturn format. Line one must be exactly one of:\nVERDICT: SHIP\nVERDICT: FIX\nVERDICT: BLOCK\n\nSHIP means you found no blocking defect and your verification ran clean. FIX means the approach is sound but specific defects must be corrected. BLOCK means the approach itself is wrong, or verification could not be run at all.\n\nThen, using the repository's severity taxonomy:\nCritical: blocking defects (correctness, security, data loss). Each with file:line, the concrete scenario in which it fails, and how you confirmed it.\nImportant: non-blocking issues that should be fixed before shipping. Each with file:line and impact.\nSuggestion: non-blocking improvements or stylistic suggestions.\nEvidence: the commands you ran, exit status, and decisive output.\nUnverified surface: what you could not exercise, and why.\n\n" + reviewerToolSteer(semanticAvailable);
468
+ }
378
469
  /** Build the literal `-m fast` native roster. This is intentionally separate
379
470
  * from the standard definitions: the names overlap, but their role bodies,
380
471
  * fixed model assignments, and efforts are profile contracts. */
381
472
  function buildFastProfileAgentDefinitions(opts) {
382
473
  const modelFor = (value, fallback) => nonEmptyModel(value) ?? fallback;
383
474
  const planModel = modelFor(opts.fastPlanModel, FAST_PROFILE_NATIVE_MODELS.Plan);
384
- const generalModel = modelFor(opts.fastGeneralPurposeModel, FAST_PROFILE_NATIVE_MODELS["general-purpose"]);
385
- const implementerModel = modelFor(opts.fastImplementerModel, FAST_PROFILE_NATIVE_MODELS.implementer);
475
+ const generalModel = modelFor(opts.fastGeneralPurposeModel, FAST_PROFILE_NATIVE_MODELS["General-Purpose"]);
386
476
  const reviewerModel = modelFor(opts.fastReviewerModel, FAST_PROFILE_NATIVE_MODELS.reviewer);
477
+ const semanticAvailable = opts.semanticSearchAvailable === true;
387
478
  const searchKey = opts.groupKeys.search ?? GROUP_META.search.preferredKey;
388
479
  const peersKey = peersKeyOf(opts.groupKeys);
389
480
  const searchMcpServers = opts.serverUrl ? { [searchKey]: httpEntryFor(opts.serverUrl, "search", opts.nonce, opts.workspaceHeaderCmd) } : void 0;
@@ -407,16 +498,22 @@ function buildFastProfileAgentDefinitions(opts) {
407
498
  const effort = (name) => FAST_PROFILE_NATIVE_EFFORTS[name];
408
499
  const out = {
409
500
  Explore: {
410
- description: "Read-only codebase exploration specialist. Use proactively, and launch several in parallel via `Task(subagent_type:\"Explore\")`, to map architecture, trace call chains, or locate the files and symbols a task will touch. Use when the question spans more than a couple of files. Do not use for planning, edits, or single-file reads. Returns a structured evidence report with file:line citations. Never edits files.",
411
- prompt: "You are a codebase exploration specialist. Your mission is to map repository structure, discover implementation patterns, trace call chains, and locate the exact files, symbols, and declarations that are relevant to the request. This is read-only work. Do not modify files, do not propose diffs, and do not delegate to other agents. You cannot ask clarifying questions mid-run: ground every answer in repository evidence. If the request is ambiguous, explore the most probable interpretations and record the ambiguity in your report. Start broad, then converge. Issue independent searches in parallel in one turn rather than one at a time, and pair semantic search with exact lexical and symbol search so that neither naming drift nor synonym mismatch hides a result. Include surrounding context lines in your search results so that callers, guards, and types are visible without a second round trip, and inspect the file whenever the surrounding logic determines the answer. Confirm every claim at the source before you report it. Stop when further searching stops changing your answer. When you can name the exact files and lines a change would touch, you are done. Report what the repository contains, not what it ought to contain. Do not design a solution or recommend an approach. Return a self-contained result the lead can act on immediately without needing to re-run your discovery.\n\nReturn format:\nAnswer: a direct response to what was asked, in a few sentences.\nInventory: each relevant file and symbol as file:line, with a one-line description of its role.\nEntry points: where control enters this area, as file:line.\nConventions in use: the patterns, idioms, error handling, and test style that any change here would be expected to follow, each with a file:line example.\nGaps and unknowns: what you could not confirm, and where you would look next.\n\n" + readOnlyToolSteer(),
501
+ description: pinnedExploreDescription(true),
502
+ prompt: pinnedExplorePrompt({
503
+ explicit: true,
504
+ semanticAvailable
505
+ }),
412
506
  tools: readSearchTools,
413
507
  model: decorateGuaranteedOneM(LUNA_SCOUT_ALIAS_ID),
414
508
  effort: effort("Explore"),
415
509
  ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
416
510
  },
417
511
  Plan: {
418
- description: "Architecture and implementation planning specialist. Use proactively in plan mode, and whenever sequencing, cross-boundary interfaces, invariants, migration risk, or acceptance criteria deserve a dedicated pass before any code is written. Delegates repository discovery to `Explore` rather than reading broadly itself. Returns a decision-complete, ordered implementation plan with runnable acceptance criteria. Never edits files.",
419
- prompt: "You are a software architect and planning specialist. Your mission is to turn a request into a decision-complete implementation plan: an ordered sequence of changes, the invariants that must hold throughout, and acceptance criteria a reviewer can actually run. This is read-only work. Do not modify repository files. Produce the architecture, sequencing, and acceptance criteria for the lead to synthesize and execute. Plan is an advisory planning capability, not an approval gate. Separate discoverable facts from genuine choices. Do not sweep the repository yourself: delegate discovery to `Explore`, launching one or more `Explore` subagents in parallel with scoped evidence questions, then read directly only the files needed to resolve trade-offs and write executable steps. Escalate only genuine product or architectural trade-offs, and escalate them as explicit options with consequences and a recommendation, never as an open question. For low-risk details, choose the reading most consistent with the codebase, proceed, and record it as an assumption. When a design trade-off has more than one viable answer and repository evidence cannot settle it, consult Oracle tool with one self-contained brief that states the constraints, the candidate designs, and the evidence you already gathered plus one precise question. If Oracle does not settle it, carry the options and the remaining gap into the plan rather than silently picking one. Delegation: you may invoke Explore and `reviewer` for discovery and verification; do not invoke any other subagent. Behavior and code verification belongs to post-implementation review. Write the plan for an implementer who cannot see your reasoning. Every step must be executable without rediscovering what you already found: name the files, name the interfaces, and state the condition that means the step is done. Prefer the smallest design that satisfies the requirement and fits the conventions already in the codebase. Mark steps that are independent of each other and can run concurrently.\n\nReturn format:\nObjective: what will be true when this is complete.\nArchitectural invariants: what must hold before, during, and after every step.\nInterface contracts: signatures, types, error and edge-case behaviour at each boundary the change crosses.\nExecution steps: ordered. Each names the files it touches, the change it makes, and its done condition. Mark steps that are independent of each other and can run concurrently.\nAcceptance criteria: the exact commands to run and the observable result that counts as passing.\nCritical files: the files an implementer must read before starting, as file:line, with why each matters.\nOpen questions: any unresolved trade-off, as options with a recommendation. Omit this section if there are none.\n\n" + readOnlyToolSteer(),
512
+ description: pinnedPlanDescription(true),
513
+ prompt: pinnedPlanPrompt({
514
+ explicit: true,
515
+ semanticAvailable
516
+ }),
420
517
  tools: planTools,
421
518
  model: oneM(planModel),
422
519
  effort: effort("Plan"),
@@ -425,23 +522,16 @@ function buildFastProfileAgentDefinitions(opts) {
425
522
  ...peersMcpServers ?? {}
426
523
  }
427
524
  },
428
- "general-purpose": {
429
- description: "Autonomous multi-step execution agent. Use proactively for open-ended or mixed tasks combining investigation, tool workflows, and code changes where the approach emerges during work. Drives to a verified end state with changed files and evidence. Do not use for pure discovery (use Explore), settled bounded edits (use implementer), or verification-only (use reviewer).",
430
- prompt: "You are an autonomous execution specialist for mixed, multi-step work. Your mission is to take an open-ended task from investigation through implementation to a verified end state within this turn. Keep going until the task is genuinely done. Do not stop at a diagnosis, a partial fix, or a plan when the request asked for a change. Ground discovery in repository truth. For low-risk ambiguities, choose the interpretation most consistent with the repository, proceed, and record it as an assumption in your report. For material intent gaps that would alter product behavior or security, surface concrete options and a recommendation to the lead. Investigate before you act. Confirm your assumptions against the actual code rather than against the request's description of it. After every command, read the real output and let it decide the next step. When something fails, diagnose the specific cause before trying again. If repeated attempts fail for the same reason and no new information has emerged, stop retrying: re-examine the underlying assumption and take a different path. Escalate rather than expand. If the task turns out to require a change the lead did not sanction, complete the sanctioned part and report the rest as a recommendation. If the task collapses to pure discovery or a single settled edit, do that slice and report the remainder as a recommendation. Do not expand scope. Match the conventions, structure, and test style already present in the files you touch. The lead owns final integration. Verify before you report. Run the builds, linters, or test commands relevant to what you changed. Quote the command run, exit status, and concise decisive output verbatim; if output is long, summarize the middle and quote the pass/fail lines. Report your changes and test output directly to the caller. Post-integration review is owned by the lead. Return a self-contained result the lead can act on immediately.\n\nReturn format:\nOutcome: what is now true, and whether the task is complete.\nActions taken: what you did, in order.\nChanged files: each as file:line, with a one-line description of the change.\nVerification: the commands you ran, exit status, and decisive output.\nAssumptions: every interpretation you had to choose.\nRemaining items: anything deliberately not done, and why.\n\n" + fileToolSteer("builds, tests, and git"),
525
+ "General-Purpose": {
526
+ description: pinnedGeneralPurposeDescription(true),
527
+ prompt: pinnedGeneralPurposePrompt(),
431
528
  model: oneM(generalModel),
432
- effort: effort("general-purpose"),
433
- ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
434
- },
435
- implementer: {
436
- description: "Surgical implementation specialist for bounded changes with settled scope. Use proactively when what and where are decided, to make the change cleanly, match conventions, and verify it. Use Plan first if the approach is still open. Returns modified files with verbatim verification. Keeps the diff tight.",
437
- prompt: "You are an implementation specialist. Your mission is to make bounded, surgical code changes that satisfy a settled requirement and look as though they were always part of the codebase. Before you edit, inspect the target files and relevant adjacent code, so that your change matches the existing idioms, error handling, logging, and test style. For a bug fix, reproduce the failure first and keep that reproduction as your success signal. While you edit, keep the change inside the requested scope and keep the diff tight and focused. Apply changes with the file editing tools; printing a patch in your response does not modify the file. Match the surrounding formatting, naming, and structure. Write a comment only where the reason for the code is non-obvious, and let well-named identifiers carry what the code does. If the requirement turns out to need work outside the agreed scope, implement the agreed change and report the additional work as a recommendation. For low-risk ambiguities, choose the interpretation most consistent with the surrounding code, proceed, and state the assumption in your report. For material intent gaps, surface concrete options and a recommendation to the lead. After you edit, run the builds, linters, or tests relevant to what you changed. Report the command, exit code, and decisive output verbatim. If a check fails, diagnose the cause before retrying; do not retry the same failing action without new information. Never claim something passes, compiles, or is covered unless you ran it and read the result. Report your changes and test output directly to the caller. Post-integration review is owned by the lead. Return a self-contained result the lead can act on immediately.\n\nReturn format:\nModified files: each as file:line, with a one-line description of the change.\nVerification: each command you ran, exit status, and decisive output.\nAssumptions and deferred work: interpretations you chose, and anything you deliberately left undone.\n\n" + fileToolSteer("builds, tests, and git"),
438
- model: oneM(implementerModel),
439
- effort: effort("implementer"),
529
+ effort: effort("General-Purpose"),
440
530
  ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
441
531
  },
442
532
  reviewer: {
443
- description: "Adversarial evidence-based reviewer. Use proactively post-integration after behavior-changing, cross-boundary, or risk-sensitive changes, and always after `implementer`, before done. Runs builds/tests itself rather than assuming them. Returns SHIP / FIX / BLOCK with reproducible evidence. Never edits source.",
444
- prompt: "You are an adversarial code reviewer. Your job is not to confirm that the change works. Your job is to find the conditions under which it does not. Think carefully about the plausible failure modes of this change before you start running commands, so that what you run is chosen to expose them. Read before you judge. Inspect the changed files and relevant surrounding context, callers of affected call sites, and tests that claim to cover the change, sized to the identified risks of the change. Then verify by execution. Run the builds, linters, or test suites relevant to what changed, and any command that would surface the specific failure you suspect. Verification means output you observed. Never state that something passes, compiles, or is covered unless you ran it and read the result; where you could not run something, say so explicitly rather than inferring the outcome. Probe deliberately: boundary and empty inputs, error and early-return paths, concurrency and ordering, resource acquisition and cleanup on the failure path, partial failure and retry, backward compatibility of any changed interface, handling of untrusted input, and whether the new tests would actually fail if the change were reverted. Judge against the bar the repository already holds itself to, not an abstract ideal. Do not soften a real finding, and do not manufacture findings to appear thorough. If the change is correct and verified, say so. Do not modify source code and do not delegate to other agents. You may run build, test, and read-only inspection commands; do not run commands that alter tracked source files or touch remote infrastructure (transient build cache or test runner side effects are expected). Return a self-contained result the lead can act on immediately.\n\nReturn format. Line one must be exactly one of:\nVERDICT: SHIP\nVERDICT: FIX\nVERDICT: BLOCK\n\nSHIP means you found no blocking defect and your verification ran clean. FIX means the approach is sound but specific defects must be corrected. BLOCK means the approach itself is wrong, or verification could not be run at all.\n\nThen, using the repository's severity taxonomy:\nCritical: blocking defects (correctness, security, data loss). Each with file:line, the concrete scenario in which it fails, and how you confirmed it.\nImportant: non-blocking issues that should be fixed before shipping. Each with file:line and impact.\nSuggestion: non-blocking improvements or stylistic suggestions.\nEvidence: the commands you ran, exit status, and decisive output.\nUnverified surface: what you could not exercise, and why.\n\n" + reviewerToolSteer(),
533
+ description: pinnedReviewerDescription(true),
534
+ prompt: pinnedReviewerPrompt(semanticAvailable),
445
535
  model: oneM(reviewerModel),
446
536
  effort: effort("reviewer"),
447
537
  tools: readSearchTools,
@@ -463,7 +553,7 @@ function buildFastProfileAgentDefinitions(opts) {
463
553
  for (const name of Object.keys(out)) if (name !== "worker-browse" && !roster.has(name)) delete out[name];
464
554
  return out;
465
555
  }
466
- /** Build the literal `-m cheap` native roster. Identical fixed five-agent
556
+ /** Build the literal `-m cheap` native roster. Identical fixed four-agent
467
557
  * surface and roles to `-m fast`, but every SUBAGENT model is a BARE
468
558
  * router-owned alias (`gh-router-cheap-*`, no `[1m]` bracket) rather than a
469
559
  * real catalog id. A bare real id is resolved by Claude Code against the live
@@ -477,8 +567,8 @@ function buildCheapProfileAgentDefinitions(opts) {
477
567
  const exploreModel = CHEAP_EXPLORE_ALIAS_ID;
478
568
  const planModel = CHEAP_PLAN_ALIAS_ID;
479
569
  const generalModel = CHEAP_GENERAL_PURPOSE_ALIAS_ID;
480
- const implementerModel = CHEAP_IMPLEMENTER_ALIAS_ID;
481
570
  const reviewerModel = CHEAP_REVIEWER_ALIAS_ID;
571
+ const semanticAvailable = opts.semanticSearchAvailable === true;
482
572
  const searchKey = opts.groupKeys.search ?? GROUP_META.search.preferredKey;
483
573
  const peersKey = peersKeyOf(opts.groupKeys);
484
574
  const searchMcpServers = opts.serverUrl ? { [searchKey]: httpEntryFor(opts.serverUrl, "search", opts.nonce, opts.workspaceHeaderCmd) } : void 0;
@@ -501,16 +591,22 @@ function buildCheapProfileAgentDefinitions(opts) {
501
591
  const effort = (name) => CHEAP_PROFILE_NATIVE_EFFORTS[name];
502
592
  const out = {
503
593
  Explore: {
504
- description: "Read-only codebase exploration specialist. Use proactively, and launch several in parallel via `Task(subagent_type:\"Explore\")`, to map architecture, trace call chains, or locate the files and symbols a task will touch. Use when the question spans more than a couple of files. Do not use for planning, edits, or single-file reads. Returns a structured evidence report with file:line citations. Never edits files.",
505
- prompt: "You are a codebase exploration specialist. Your mission is to map repository structure, discover implementation patterns, trace call chains, and locate the exact files, symbols, and declarations that are relevant to the request. This is read-only work. Do not modify files, do not propose diffs, and do not delegate to other agents. You cannot ask clarifying questions mid-run: ground every answer in repository evidence. If the request is ambiguous, explore the most probable interpretations and record the ambiguity in your report. Start broad, then converge. Issue independent searches in parallel in one turn rather than one at a time, and pair semantic search with exact lexical and symbol search so that neither naming drift nor synonym mismatch hides a result. Include surrounding context lines in your search results so that callers, guards, and types are visible without a second round trip, and inspect the file whenever the surrounding logic determines the answer. Confirm every claim at the source before you report it. Stop when further searching stops changing your answer. When you can name the exact files and lines a change would touch, you are done. Report what the repository contains, not what it ought to contain. Do not design a solution or recommend an approach. Return a self-contained result the lead can act on immediately without needing to re-run your discovery.\n\nReturn format:\nAnswer: a direct response to what was asked, in a few sentences.\nInventory: each relevant file and symbol as file:line, with a one-line description of its role.\nEntry points: where control enters this area, as file:line.\nConventions in use: the patterns, idioms, error handling, and test style that any change here would be expected to follow, each with a file:line example.\nGaps and unknowns: what you could not confirm, and where you would look next.\n\n" + readOnlyToolSteer(),
594
+ description: pinnedExploreDescription(true),
595
+ prompt: pinnedExplorePrompt({
596
+ explicit: true,
597
+ semanticAvailable
598
+ }),
506
599
  tools: readSearchTools,
507
600
  model: exploreModel,
508
601
  effort: effort("Explore"),
509
602
  ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
510
603
  },
511
604
  Plan: {
512
- description: "Architecture and implementation planning specialist. Use proactively in plan mode, and whenever sequencing, cross-boundary interfaces, invariants, migration risk, or acceptance criteria deserve a dedicated pass before any code is written. Delegates repository discovery to `Explore` rather than reading broadly itself. Returns a decision-complete, ordered implementation plan with runnable acceptance criteria. Never edits files.",
513
- prompt: "You are a software architect and planning specialist. Your mission is to turn a request into a decision-complete implementation plan: an ordered sequence of changes, the invariants that must hold throughout, and acceptance criteria a reviewer can actually run. This is read-only work. Do not modify repository files. Produce the architecture, sequencing, and acceptance criteria for the lead to synthesize and execute. Plan is an advisory planning capability, not an approval gate. Separate discoverable facts from genuine choices. Do not sweep the repository yourself: delegate discovery to `Explore`, launching one or more `Explore` subagents in parallel with scoped evidence questions, then read directly only the files needed to resolve trade-offs and write executable steps. Escalate only genuine product or architectural trade-offs, and escalate them as explicit options with consequences and a recommendation, never as an open question. For low-risk details, choose the reading most consistent with the codebase, proceed, and record it as an assumption. When a design trade-off has more than one viable answer and repository evidence cannot settle it, consult Oracle tool with one self-contained brief that states the constraints, the candidate designs, and the evidence you already gathered plus one precise question. If Oracle does not settle it, carry the options and the remaining gap into the plan rather than silently picking one. Delegation: you may invoke Explore and `reviewer` for discovery and verification; do not invoke any other subagent. Behavior and code verification belongs to post-implementation review. Write the plan for an implementer who cannot see your reasoning. Every step must be executable without rediscovering what you already found: name the files, name the interfaces, and state the condition that means the step is done. Prefer the smallest design that satisfies the requirement and fits the conventions already in the codebase. Mark steps that are independent of each other and can run concurrently.\n\nReturn format:\nObjective: what will be true when this is complete.\nArchitectural invariants: what must hold before, during, and after every step.\nInterface contracts: signatures, types, error and edge-case behaviour at each boundary the change crosses.\nExecution steps: ordered. Each names the files it touches, the change it makes, and its done condition. Mark steps that are independent of each other and can run concurrently.\nAcceptance criteria: the exact commands to run and the observable result that counts as passing.\nCritical files: the files an implementer must read before starting, as file:line, with why each matters.\nOpen questions: any unresolved trade-off, as options with a recommendation. Omit this section if there are none.\n\n" + readOnlyToolSteer(),
605
+ description: pinnedPlanDescription(true),
606
+ prompt: pinnedPlanPrompt({
607
+ explicit: true,
608
+ semanticAvailable
609
+ }),
514
610
  tools: planTools,
515
611
  model: planModel,
516
612
  effort: effort("Plan"),
@@ -519,23 +615,16 @@ function buildCheapProfileAgentDefinitions(opts) {
519
615
  ...peersMcpServers ?? {}
520
616
  }
521
617
  },
522
- "general-purpose": {
523
- description: "Autonomous multi-step execution agent. Use proactively for open-ended or mixed tasks combining investigation, tool workflows, and code changes where the approach emerges during work. Drives to a verified end state with changed files and evidence. Do not use for pure discovery (use Explore), settled bounded edits (use implementer), or verification-only (use reviewer).",
524
- prompt: "You are an autonomous execution specialist for mixed, multi-step work. Your mission is to take an open-ended task from investigation through implementation to a verified end state within this turn. Keep going until the task is genuinely done. Do not stop at a diagnosis, a partial fix, or a plan when the request asked for a change. Ground discovery in repository truth. For low-risk ambiguities, choose the interpretation most consistent with the repository, proceed, and record it as an assumption in your report. For material intent gaps that would alter product behavior or security, surface concrete options and a recommendation to the lead. Investigate before you act. Confirm your assumptions against the actual code rather than against the request's description of it. After every command, read the real output and let it decide the next step. When something fails, diagnose the specific cause before trying again. If repeated attempts fail for the same reason and no new information has emerged, stop retrying: re-examine the underlying assumption and take a different path. Escalate rather than expand. If the task turns out to require a change the lead did not sanction, complete the sanctioned part and report the rest as a recommendation. If the task collapses to pure discovery or a single settled edit, do that slice and report the remainder as a recommendation. Do not expand scope. Match the conventions, structure, and test style already present in the files you touch. The lead owns final integration. Verify before you report. Run the builds, linters, or test commands relevant to what you changed. Quote the command run, exit status, and concise decisive output verbatim; if output is long, summarize the middle and quote the pass/fail lines. Report your changes and test output directly to the caller. Post-integration review is owned by the lead. Return a self-contained result the lead can act on immediately.\n\nReturn format:\nOutcome: what is now true, and whether the task is complete.\nActions taken: what you did, in order.\nChanged files: each as file:line, with a one-line description of the change.\nVerification: the commands you ran, exit status, and decisive output.\nAssumptions: every interpretation you had to choose.\nRemaining items: anything deliberately not done, and why.\n\n" + fileToolSteer("builds, tests, and git"),
618
+ "General-Purpose": {
619
+ description: pinnedGeneralPurposeDescription(true),
620
+ prompt: pinnedGeneralPurposePrompt(),
525
621
  model: generalModel,
526
- effort: effort("general-purpose"),
527
- ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
528
- },
529
- implementer: {
530
- description: "Surgical implementation specialist for bounded changes with settled scope. Use proactively when what and where are decided, to make the change cleanly, match conventions, and verify it. Use Plan first if the approach is still open. Returns modified files with verbatim verification. Keeps the diff tight.",
531
- prompt: "You are an implementation specialist. Your mission is to make bounded, surgical code changes that satisfy a settled requirement and look as though they were always part of the codebase. Before you edit, inspect the target files and relevant adjacent code, so that your change matches the existing idioms, error handling, logging, and test style. For a bug fix, reproduce the failure first and keep that reproduction as your success signal. While you edit, keep the change inside the requested scope and keep the diff tight and focused. Apply changes with the file editing tools; printing a patch in your response does not modify the file. Match the surrounding formatting, naming, and structure. Write a comment only where the reason for the code is non-obvious, and let well-named identifiers carry what the code does. If the requirement turns out to need work outside the agreed scope, implement the agreed change and report the additional work as a recommendation. For low-risk ambiguities, choose the interpretation most consistent with the surrounding code, proceed, and state the assumption in your report. For material intent gaps, surface concrete options and a recommendation to the lead. After you edit, run the builds, linters, or tests relevant to what you changed. Report the command, exit code, and decisive output verbatim. If a check fails, diagnose the cause before retrying; do not retry the same failing action without new information. Never claim something passes, compiles, or is covered unless you ran it and read the result. Report your changes and test output directly to the caller. Post-integration review is owned by the lead. Return a self-contained result the lead can act on immediately.\n\nReturn format:\nModified files: each as file:line, with a one-line description of the change.\nVerification: each command you ran, exit status, and decisive output.\nAssumptions and deferred work: interpretations you chose, and anything you deliberately left undone.\n\n" + fileToolSteer("builds, tests, and git"),
532
- model: implementerModel,
533
- effort: effort("implementer"),
622
+ effort: effort("General-Purpose"),
534
623
  ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
535
624
  },
536
625
  reviewer: {
537
- description: "Adversarial evidence-based reviewer. Use proactively post-integration after behavior-changing, cross-boundary, or risk-sensitive changes, and always after `implementer`, before done. Runs builds/tests itself rather than assuming them. Returns SHIP / FIX / BLOCK with reproducible evidence. Never edits source.",
538
- prompt: "You are an adversarial code reviewer. Your job is not to confirm that the change works. Your job is to find the conditions under which it does not. Think carefully about the plausible failure modes of this change before you start running commands, so that what you run is chosen to expose them. Read before you judge. Inspect the changed files and relevant surrounding context, callers of affected call sites, and tests that claim to cover the change, sized to the identified risks of the change. Then verify by execution. Run the builds, linters, or test suites relevant to what changed, and any command that would surface the specific failure you suspect. Verification means output you observed. Never state that something passes, compiles, or is covered unless you ran it and read the result; where you could not run something, say so explicitly rather than inferring the outcome. Probe deliberately: boundary and empty inputs, error and early-return paths, concurrency and ordering, resource acquisition and cleanup on the failure path, partial failure and retry, backward compatibility of any changed interface, handling of untrusted input, and whether the new tests would actually fail if the change were reverted. Judge against the bar the repository already holds itself to, not an abstract ideal. Do not soften a real finding, and do not manufacture findings to appear thorough. If the change is correct and verified, say so. Do not modify source code and do not delegate to other agents. You may run build, test, and read-only inspection commands; do not run commands that alter tracked source files or touch remote infrastructure (transient build cache or test runner side effects are expected). Return a self-contained result the lead can act on immediately.\n\nReturn format. Line one must be exactly one of:\nVERDICT: SHIP\nVERDICT: FIX\nVERDICT: BLOCK\n\nSHIP means you found no blocking defect and your verification ran clean. FIX means the approach is sound but specific defects must be corrected. BLOCK means the approach itself is wrong, or verification could not be run at all.\n\nThen, using the repository's severity taxonomy:\nCritical: blocking defects (correctness, security, data loss). Each with file:line, the concrete scenario in which it fails, and how you confirmed it.\nImportant: non-blocking issues that should be fixed before shipping. Each with file:line and impact.\nSuggestion: non-blocking improvements or stylistic suggestions.\nEvidence: the commands you ran, exit status, and decisive output.\nUnverified surface: what you could not exercise, and why.\n\n" + reviewerToolSteer(),
626
+ description: pinnedReviewerDescription(true),
627
+ prompt: pinnedReviewerPrompt(semanticAvailable),
539
628
  model: reviewerModel,
540
629
  effort: effort("reviewer"),
541
630
  tools: readSearchTools,
@@ -557,22 +646,22 @@ function buildCheapProfileAgentDefinitions(opts) {
557
646
  for (const name of Object.keys(out)) if (name !== "worker-browse" && !roster.has(name)) delete out[name];
558
647
  return out;
559
648
  }
560
- /** Build the literal `-m cheapest` native roster. Same fixed five-agent
649
+ /** Build the literal `-m cheapest` native roster. Same fixed four-agent
561
650
  * surface and roles as `-m cheap`, but Luna-led with a Gemini reviewer —
562
651
  * every SUBAGENT model is a BARE router-owned alias
563
652
  * (`gh-router-cheapest-*`, no `[1m]`) rather than a real catalog id, for the
564
- * same client catalog-resolution reason as the cheap builder below: a bare
653
+ * same client catalog-resolution reason as the cheap builder above: a bare
565
654
  * real id is upgraded to `[1m]` accounting by Claude Code whenever the entry
566
655
  * advertises >=1M. Caller-supplied `opts.cheapest*Model` values are
567
- * deliberately ignored. The Plan prompt additionally directs the planner to
568
- * do the minimal synthesis itself and delegate discovery/execution heavily to
569
- * `Explore` and `general-purpose`. */
656
+ * deliberately ignored. Cheapest is tuned for straightforward tasks: role
657
+ * descriptions carry no proactive fan-out push, so the lead handles simple
658
+ * work inline instead of paying handoff overhead. */
570
659
  function buildCheapestProfileAgentDefinitions(opts) {
571
660
  const exploreModel = CHEAPEST_EXPLORE_ALIAS_ID;
572
661
  const planModel = CHEAPEST_PLAN_ALIAS_ID;
573
662
  const generalModel = CHEAPEST_GENERAL_PURPOSE_ALIAS_ID;
574
- const implementerModel = CHEAPEST_IMPLEMENTER_ALIAS_ID;
575
663
  const reviewerModel = CHEAPEST_REVIEWER_ALIAS_ID;
664
+ const semanticAvailable = opts.semanticSearchAvailable === true;
576
665
  const searchKey = opts.groupKeys.search ?? GROUP_META.search.preferredKey;
577
666
  const peersKey = peersKeyOf(opts.groupKeys);
578
667
  const searchMcpServers = opts.serverUrl ? { [searchKey]: httpEntryFor(opts.serverUrl, "search", opts.nonce, opts.workspaceHeaderCmd) } : void 0;
@@ -595,16 +684,22 @@ function buildCheapestProfileAgentDefinitions(opts) {
595
684
  const effort = (name) => CHEAPEST_PROFILE_NATIVE_EFFORTS[name];
596
685
  const out = {
597
686
  Explore: {
598
- description: "Read-only codebase exploration specialist. Use proactively, and launch several in parallel via `Task(subagent_type:\"Explore\")`, to map architecture, trace call chains, or locate the files and symbols a task will touch. Use when the question spans more than a couple of files. Do not use for planning, edits, or single-file reads. Returns a structured evidence report with file:line citations. Never edits files.",
599
- prompt: "You are a codebase exploration specialist. Your mission is to map repository structure, discover implementation patterns, trace call chains, and locate the exact files, symbols, and declarations that are relevant to the request. This is read-only work. Do not modify files, do not propose diffs, and do not delegate to other agents. You cannot ask clarifying questions mid-run: ground every answer in repository evidence. If the request is ambiguous, explore the most probable interpretations and record the ambiguity in your report. Start broad, then converge. Issue independent searches in parallel in one turn rather than one at a time, and pair semantic search with exact lexical and symbol search so that neither naming drift nor synonym mismatch hides a result. Include surrounding context lines in your search results so that callers, guards, and types are visible without a second round trip, and inspect the file whenever the surrounding logic determines the answer. Confirm every claim at the source before you report it. Stop when further searching stops changing your answer. When you can name the exact files and lines a change would touch, you are done. Report what the repository contains, not what it ought to contain. Do not design a solution or recommend an approach. Return a self-contained result the lead can act on immediately without needing to re-run your discovery.\n\nReturn format:\nAnswer: a direct response to what was asked, in a few sentences.\nInventory: each relevant file and symbol as file:line, with a one-line description of its role.\nEntry points: where control enters this area, as file:line.\nConventions in use: the patterns, idioms, error handling, and test style that any change here would be expected to follow, each with a file:line example.\nGaps and unknowns: what you could not confirm, and where you would look next.\n\n" + readOnlyToolSteer(),
687
+ description: pinnedExploreDescription(false),
688
+ prompt: pinnedExplorePrompt({
689
+ explicit: false,
690
+ semanticAvailable
691
+ }),
600
692
  tools: readSearchTools,
601
693
  model: exploreModel,
602
694
  effort: effort("Explore"),
603
695
  ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
604
696
  },
605
697
  Plan: {
606
- description: "Architecture and implementation planning specialist. Use proactively in plan mode, and whenever sequencing, cross-boundary interfaces, invariants, migration risk, or acceptance criteria deserve a dedicated pass before any code is written. Delegates repository discovery to `Explore` and mixed execution to `general-purpose` rather than doing that work itself; does the minimal synthesis to produce the plan. Returns a decision-complete, ordered implementation plan with runnable acceptance criteria. Never edits files.",
607
- prompt: "You are a software architect and planning specialist. Your mission is to turn a request into a decision-complete implementation plan: an ordered sequence of changes, the invariants that must hold throughout, and acceptance criteria a reviewer can actually run. This is read-only work. Do not modify repository files. Produce the architecture, sequencing, and acceptance criteria for the lead to synthesize and execute. Plan is an advisory planning capability, not an approval gate. Do the minimal planning work yourself and delegate heavily: launch one or more `Explore` subagents in parallel with scoped evidence questions for repository discovery, and lean on `general-purpose` for any mixed investigation/execution needed to settle a choice — then read directly only the files needed to resolve trade-offs and write executable steps. Do not sweep the repository yourself. Escalate only genuine product or architectural trade-offs, and escalate them as explicit options with consequences and a recommendation, never as an open question. For low-risk details, choose the reading most consistent with the codebase, proceed, and record it as an assumption. When a design trade-off has more than one viable answer and repository evidence cannot settle it, consult Oracle tool with one self-contained brief that states the constraints, the candidate designs, and the evidence you already gathered plus one precise question. If Oracle does not settle it, carry the options and the remaining gap into the plan rather than silently picking one. Delegation: you may invoke Explore and `reviewer` for discovery and verification; do not invoke any other subagent. Behavior and code verification belongs to post-implementation review. Write the plan for an implementer who cannot see your reasoning. Every step must be executable without rediscovering what you already found: name the files, name the interfaces, and state the condition that means the step is done. Prefer the smallest design that satisfies the requirement and fits the conventions already in the codebase. Mark steps that are independent of each other and can run concurrently.\n\nReturn format:\nObjective: what will be true when this is complete.\nArchitectural invariants: what must hold before, during, and after every step.\nInterface contracts: signatures, types, error and edge-case behaviour at each boundary the change crosses.\nExecution steps: ordered. Each names the files it touches, the change it makes, and its done condition. Mark steps that are independent of each other and can run concurrently.\nAcceptance criteria: the exact commands to run and the observable result that counts as passing.\nCritical files: the files an implementer must read before starting, as file:line, with why each matters.\nOpen questions: any unresolved trade-off, as options with a recommendation. Omit this section if there are none.\n\n" + readOnlyToolSteer(),
698
+ description: pinnedPlanDescription(false),
699
+ prompt: pinnedPlanPrompt({
700
+ explicit: false,
701
+ semanticAvailable
702
+ }),
608
703
  tools: planTools,
609
704
  model: planModel,
610
705
  effort: effort("Plan"),
@@ -613,23 +708,108 @@ function buildCheapestProfileAgentDefinitions(opts) {
613
708
  ...peersMcpServers ?? {}
614
709
  }
615
710
  },
616
- "general-purpose": {
617
- description: "Autonomous multi-step execution agent. Use proactively for open-ended or mixed tasks combining investigation, tool workflows, and code changes where the approach emerges during work. Drives to a verified end state with changed files and evidence. Do not use for pure discovery (use Explore), settled bounded edits (use implementer), or verification-only (use reviewer).",
618
- prompt: "You are an autonomous execution specialist for mixed, multi-step work. Your mission is to take an open-ended task from investigation through implementation to a verified end state within this turn. Keep going until the task is genuinely done. Do not stop at a diagnosis, a partial fix, or a plan when the request asked for a change. Ground discovery in repository truth. For low-risk ambiguities, choose the interpretation most consistent with the repository, proceed, and record it as an assumption in your report. For material intent gaps that would alter product behavior or security, surface concrete options and a recommendation to the lead. Investigate before you act. Confirm your assumptions against the actual code rather than against the request's description of it. After every command, read the real output and let it decide the next step. When something fails, diagnose the specific cause before trying again. If repeated attempts fail for the same reason and no new information has emerged, stop retrying: re-examine the underlying assumption and take a different path. Escalate rather than expand. If the task turns out to require a change the lead did not sanction, complete the sanctioned part and report the rest as a recommendation. If the task collapses to pure discovery or a single settled edit, do that slice and report the remainder as a recommendation. Do not expand scope. Match the conventions, structure, and test style already present in the files you touch. The lead owns final integration. Verify before you report. Run the builds, linters, or test commands relevant to what you changed. Quote the command run, exit status, and concise decisive output verbatim; if output is long, summarize the middle and quote the pass/fail lines. Report your changes and test output directly to the caller. Post-integration review is owned by the lead. Return a self-contained result the lead can act on immediately.\n\nReturn format:\nOutcome: what is now true, and whether the task is complete.\nActions taken: what you did, in order.\nChanged files: each as file:line, with a one-line description of the change.\nVerification: the commands you ran, exit status, and decisive output.\nAssumptions: every interpretation you had to choose.\nRemaining items: anything deliberately not done, and why.\n\n" + fileToolSteer("builds, tests, and git"),
711
+ "General-Purpose": {
712
+ description: pinnedGeneralPurposeDescription(false),
713
+ prompt: pinnedGeneralPurposePrompt(),
619
714
  model: generalModel,
620
- effort: effort("general-purpose"),
715
+ effort: effort("General-Purpose"),
621
716
  ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
622
717
  },
623
- implementer: {
624
- description: "Surgical implementation specialist for bounded changes with settled scope. Use proactively when what and where are decided, to make the change cleanly, match conventions, and verify it. Use Plan first if the approach is still open. Returns modified files with verbatim verification. Keeps the diff tight.",
625
- prompt: "You are an implementation specialist. Your mission is to make bounded, surgical code changes that satisfy a settled requirement and look as though they were always part of the codebase. Before you edit, inspect the target files and relevant adjacent code, so that your change matches the existing idioms, error handling, logging, and test style. For a bug fix, reproduce the failure first and keep that reproduction as your success signal. While you edit, keep the change inside the requested scope and keep the diff tight and focused. Apply changes with the file editing tools; printing a patch in your response does not modify the file. Match the surrounding formatting, naming, and structure. Write a comment only where the reason for the code is non-obvious, and let well-named identifiers carry what the code does. If the requirement turns out to need work outside the agreed scope, implement the agreed change and report the additional work as a recommendation. For low-risk ambiguities, choose the interpretation most consistent with the surrounding code, proceed, and state the assumption in your report. For material intent gaps, surface concrete options and a recommendation to the lead. After you edit, run the builds, linters, or tests relevant to what you changed. Report the command, exit code, and decisive output verbatim. If a check fails, diagnose the cause before retrying; do not retry the same failing action without new information. Never claim something passes, compiles, or is covered unless you ran it and read the result. Report your changes and test output directly to the caller. Post-integration review is owned by the lead. Return a self-contained result the lead can act on immediately.\n\nReturn format:\nModified files: each as file:line, with a one-line description of the change.\nVerification: each command you ran, exit status, and decisive output.\nAssumptions and deferred work: interpretations you chose, and anything you deliberately left undone.\n\n" + fileToolSteer("builds, tests, and git"),
626
- model: implementerModel,
627
- effort: effort("implementer"),
718
+ reviewer: {
719
+ description: pinnedReviewerDescription(false),
720
+ prompt: pinnedReviewerPrompt(semanticAvailable),
721
+ model: reviewerModel,
722
+ effort: effort("reviewer"),
723
+ tools: readSearchTools,
724
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
725
+ }
726
+ };
727
+ if (opts.browseAvailable && opts.groupKeys.workers) {
728
+ const workersKey = workersKeyOf(opts.groupKeys);
729
+ out["worker-browse"] = {
730
+ description: dispatcherDescription("browse"),
731
+ prompt: dispatcherPrompt("browse", workersKey),
732
+ model: exploreModel,
733
+ effort: "high",
734
+ tools: dispatcherTools("browse", workersKey),
735
+ ...opts.serverUrl ? { mcpServers: { [workersKey]: httpEntryFor(opts.serverUrl, "workers", opts.nonce, opts.workspaceHeaderCmd) } } : {}
736
+ };
737
+ }
738
+ const roster = opts.nativeRoster == null ? new Set(CHEAPEST_PROFILE_NATIVE_AGENT_NAMES) : opts.nativeRoster instanceof Set ? opts.nativeRoster : new Set(opts.nativeRoster);
739
+ for (const name of Object.keys(out)) if (name !== "worker-browse" && !roster.has(name)) delete out[name];
740
+ return out;
741
+ }
742
+ /** Build the literal `-m balanced` native roster. Same fixed four-agent
743
+ * surface and roles as `-m cheap`, but Sol-led at the 200K default window
744
+ * for the most complex tasks — every SUBAGENT model is a BARE router-owned
745
+ * alias (`gh-router-balanced-*`, no `[1m]`) rather than a real catalog id,
746
+ * for the same client catalog-resolution reason as the cheap builder above.
747
+ * Caller-supplied `opts.balanced*Model` values are deliberately ignored.
748
+ * Explicit delegation tuning matches cheap: proactive parallel `Explore`
749
+ * fan-out, `Plan`-first architecture, `General-Purpose` mixed execution, and
750
+ * post-integration `reviewer` verification. */
751
+ function buildBalancedProfileAgentDefinitions(opts) {
752
+ const exploreModel = BALANCED_EXPLORE_ALIAS_ID;
753
+ const planModel = BALANCED_PLAN_ALIAS_ID;
754
+ const generalModel = BALANCED_GENERAL_PURPOSE_ALIAS_ID;
755
+ const reviewerModel = BALANCED_REVIEWER_ALIAS_ID;
756
+ const semanticAvailable = opts.semanticSearchAvailable === true;
757
+ const searchKey = opts.groupKeys.search ?? GROUP_META.search.preferredKey;
758
+ const peersKey = peersKeyOf(opts.groupKeys);
759
+ const searchMcpServers = opts.serverUrl ? { [searchKey]: httpEntryFor(opts.serverUrl, "search", opts.nonce, opts.workspaceHeaderCmd) } : void 0;
760
+ const peersMcpServers = opts.serverUrl && opts.groupKeys.peers ? { [peersKey]: httpEntryFor(opts.serverUrl, "peers", opts.nonce, opts.workspaceHeaderCmd) } : void 0;
761
+ const oracleTool = opts.groupKeys.peers ? `mcp__${peersKey}__oracle` : void 0;
762
+ const readSearchTools = [
763
+ "Read",
764
+ "Grep",
765
+ "Glob",
766
+ "Bash",
767
+ "WebFetch",
768
+ "WebSearch",
769
+ `mcp__${searchKey}__*`
770
+ ];
771
+ const planTools = [
772
+ ...readSearchTools,
773
+ ...oracleTool ? [oracleTool] : [],
774
+ "Agent"
775
+ ];
776
+ const effort = (name) => BALANCED_PROFILE_NATIVE_EFFORTS[name];
777
+ const out = {
778
+ Explore: {
779
+ description: pinnedExploreDescription(true),
780
+ prompt: pinnedExplorePrompt({
781
+ explicit: true,
782
+ semanticAvailable
783
+ }),
784
+ tools: readSearchTools,
785
+ model: exploreModel,
786
+ effort: effort("Explore"),
787
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
788
+ },
789
+ Plan: {
790
+ description: pinnedPlanDescription(true),
791
+ prompt: pinnedPlanPrompt({
792
+ explicit: true,
793
+ semanticAvailable
794
+ }),
795
+ tools: planTools,
796
+ model: planModel,
797
+ effort: effort("Plan"),
798
+ mcpServers: {
799
+ ...searchMcpServers ?? {},
800
+ ...peersMcpServers ?? {}
801
+ }
802
+ },
803
+ "General-Purpose": {
804
+ description: pinnedGeneralPurposeDescription(true),
805
+ prompt: pinnedGeneralPurposePrompt(),
806
+ model: generalModel,
807
+ effort: effort("General-Purpose"),
628
808
  ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
629
809
  },
630
810
  reviewer: {
631
- description: "Adversarial evidence-based reviewer. Use proactively post-integration after behavior-changing, cross-boundary, or risk-sensitive changes, and always after `implementer`, before done. Runs builds/tests itself rather than assuming them. Returns SHIP / FIX / BLOCK with reproducible evidence. Never edits source.",
632
- prompt: "You are an adversarial code reviewer. Your job is not to confirm that the change works. Your job is to find the conditions under which it does not. Think carefully about the plausible failure modes of this change before you start running commands, so that what you run is chosen to expose them. Read before you judge. Inspect the changed files and relevant surrounding context, callers of affected call sites, and tests that claim to cover the change, sized to the identified risks of the change. Then verify by execution. Run the builds, linters, or test suites relevant to what changed, and any command that would surface the specific failure you suspect. Verification means output you observed. Never state that something passes, compiles, or is covered unless you ran it and read the result; where you could not run something, say so explicitly rather than inferring the outcome. Probe deliberately: boundary and empty inputs, error and early-return paths, concurrency and ordering, resource acquisition and cleanup on the failure path, partial failure and retry, backward compatibility of any changed interface, handling of untrusted input, and whether the new tests would actually fail if the change were reverted. Judge against the bar the repository already holds itself to, not an abstract ideal. Do not soften a real finding, and do not manufacture findings to appear thorough. If the change is correct and verified, say so. Do not modify source code and do not delegate to other agents. You may run build, test, and read-only inspection commands; do not run commands that alter tracked source files or touch remote infrastructure (transient build cache or test runner side effects are expected). Return a self-contained result the lead can act on immediately.\n\nReturn format. Line one must be exactly one of:\nVERDICT: SHIP\nVERDICT: FIX\nVERDICT: BLOCK\n\nSHIP means you found no blocking defect and your verification ran clean. FIX means the approach is sound but specific defects must be corrected. BLOCK means the approach itself is wrong, or verification could not be run at all.\n\nThen, using the repository's severity taxonomy:\nCritical: blocking defects (correctness, security, data loss). Each with file:line, the concrete scenario in which it fails, and how you confirmed it.\nImportant: non-blocking issues that should be fixed before shipping. Each with file:line and impact.\nSuggestion: non-blocking improvements or stylistic suggestions.\nEvidence: the commands you ran, exit status, and decisive output.\nUnverified surface: what you could not exercise, and why.\n\n" + reviewerToolSteer(),
811
+ description: pinnedReviewerDescription(true),
812
+ prompt: pinnedReviewerPrompt(semanticAvailable),
633
813
  model: reviewerModel,
634
814
  effort: effort("reviewer"),
635
815
  tools: readSearchTools,
@@ -647,7 +827,7 @@ function buildCheapestProfileAgentDefinitions(opts) {
647
827
  ...opts.serverUrl ? { mcpServers: { [workersKey]: httpEntryFor(opts.serverUrl, "workers", opts.nonce, opts.workspaceHeaderCmd) } } : {}
648
828
  };
649
829
  }
650
- const roster = opts.nativeRoster == null ? new Set(CHEAPEST_PROFILE_NATIVE_AGENT_NAMES) : opts.nativeRoster instanceof Set ? opts.nativeRoster : new Set(opts.nativeRoster);
830
+ const roster = opts.nativeRoster == null ? new Set(BALANCED_PROFILE_NATIVE_AGENT_NAMES) : opts.nativeRoster instanceof Set ? opts.nativeRoster : new Set(opts.nativeRoster);
651
831
  for (const name of Object.keys(out)) if (name !== "worker-browse" && !roster.has(name)) delete out[name];
652
832
  return out;
653
833
  }
@@ -665,6 +845,7 @@ function buildPeerAgentDefinitions(opts) {
665
845
  if (opts.fastProfile) return buildFastProfileAgentDefinitions(opts);
666
846
  if (opts.cheapProfile) return buildCheapProfileAgentDefinitions(opts);
667
847
  if (opts.cheapestProfile) return buildCheapestProfileAgentDefinitions(opts);
848
+ if (opts.balancedProfile) return buildBalancedProfileAgentDefinitions(opts);
668
849
  const out = {};
669
850
  const personas = personasFor({
670
851
  codexCli: opts.codexCli,
@@ -1119,6 +1300,11 @@ async function writePeerMcpRuntimeFiles(serverUrl, opts) {
1119
1300
  cheapestGeneralPurposeModel: opts.cheapestGeneralPurposeModel,
1120
1301
  cheapestImplementerModel: opts.cheapestImplementerModel,
1121
1302
  cheapestReviewerModel: opts.cheapestReviewerModel,
1303
+ balancedExploreModel: opts.balancedExploreModel,
1304
+ balancedPlanModel: opts.balancedPlanModel,
1305
+ balancedGeneralPurposeModel: opts.balancedGeneralPurposeModel,
1306
+ balancedReviewerModel: opts.balancedReviewerModel,
1307
+ semanticSearchAvailable: opts.semanticSearchAvailable,
1122
1308
  nativeRoster: opts.nativeRoster,
1123
1309
  personaAllowlist: opts.personaAllowlist,
1124
1310
  includeCoordinator: opts.includeCoordinator,
@@ -1128,6 +1314,7 @@ async function writePeerMcpRuntimeFiles(serverUrl, opts) {
1128
1314
  fastProfile: opts.fastProfile,
1129
1315
  cheapProfile: opts.cheapProfile,
1130
1316
  cheapestProfile: opts.cheapestProfile,
1317
+ balancedProfile: opts.balancedProfile,
1131
1318
  implementerEffort: opts.implementerEffort,
1132
1319
  reviewerEffort: opts.reviewerEffort,
1133
1320
  maxProfile: opts.maxProfile,
@@ -2329,13 +2516,20 @@ function joinClauses(parts) {
2329
2516
  * there is no quality-for-cost trade being hidden by leading with the cheap
2330
2517
  * tier; reserve `reviewer` for the higher-stakes assessment it is there for. */
2331
2518
  function buildNativeReachClauses(opts) {
2332
- if (opts.profile === "fast" || opts.profile === "cheap" || opts.profile === "cheap1m" || opts.profile === "cheapest") return joinClauses([
2333
- "`Explore` for broad repository discovery, dependency mapping, and convention tracking",
2334
- "`Plan` for architectural sequencing, interface contracts, migration risk, and runnable acceptance criteria",
2335
- "`general-purpose` for mixed, iterative, or multi-step execution tasks",
2336
- "`implementer` for surgical coding changes matching existing conventions",
2337
- "`reviewer` for independent adversarial verification, reproduction, and root-causing"
2338
- ]);
2519
+ if (opts.profile === "fast" || opts.profile === "cheap" || opts.profile === "cheap1m" || opts.profile === "cheapest" || opts.profile === "balanced") {
2520
+ if (opts.profile === "cheapest") return joinClauses([
2521
+ "`Explore` for broad repository discovery, dependency mapping, and convention tracking",
2522
+ "`Plan` for architectural sequencing, interface contracts, migration risk, and runnable acceptance criteria",
2523
+ "`General-Purpose` for mixed, iterative, or multi-step execution tasks",
2524
+ "`reviewer` for independent adversarial verification, reproduction, and root-causing"
2525
+ ]);
2526
+ return joinClauses([
2527
+ "`Explore` for broad repository discovery, dependency mapping, and convention tracking (launch in parallel)",
2528
+ "`Plan` for architectural sequencing, interface contracts, migration risk, and runnable acceptance criteria (delegates discovery to `Explore`)",
2529
+ "`General-Purpose` for mixed, iterative, or multi-step execution tasks (follows a Plan handoff when one exists)",
2530
+ "`reviewer` for independent adversarial verification, reproduction, and root-causing after non-trivial changes"
2531
+ ]);
2532
+ }
2339
2533
  const clauses = [];
2340
2534
  const implementerFast = opts.implementerFastAvailable !== false;
2341
2535
  const reviewerFast = opts.reviewerFastAvailable !== false;
@@ -2367,15 +2561,17 @@ function buildOperatingDefaultsDirective(opts = {}) {
2367
2561
  if (opts.profile === "max") {
2368
2562
  const peersKey = opts.peersKey ?? opts.groupKeys?.peers ?? "peers";
2369
2563
  const artifactClause = opts.artifactAvailable ? ` Live human review is available in the artifact panel via \`mcp__${peersKey}__artifact_*\`.` : "";
2370
- return "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nMax launch profile. The lead owns the outcome. Start with direct repository or runtime evidence. Handle narrow, obvious, surgical, and single-command work directly; delegate a bounded workstream when it is broad, slow, context-heavy, or benefits from a genuinely independent perspective. " + MAX_PARALLELISM_RULE + " Brief each role with the desired outcome, relevant context, constraints, expected evidence, and verification. Use the roster as complementary capabilities, never as a required Explore → Plan → implement → review sequence. Avoid overlapping assignments and do not ask several models the same generic question. Synthesize results against the repository and executable checks: model agreement is not verification. Use one fresh-context peer only when a consequential judgment remains after direct checks; use the coordinator only when several distinct lenses could change the decision. Advisor is optional, non-binding counsel for one focused consequential uncertainty that evidence and the appropriate roles cannot settle; it has no approval or workflow authority, and a further consultation requires materially new or conflicting evidence." + artifactClause;
2564
+ return "## Operating defaults (these layer with the user's explicit direction and the domain's own standards as addons, not replacements: follow all three together; on a direct conflict the user's direction wins, then the domain standard, then the default below)\n\nMax launch profile. The lead owns the outcome. Start with direct repository or runtime evidence. Handle narrow, obvious, surgical, and single-command work directly; delegate a bounded workstream when it is broad, slow, context-heavy, or benefits from a genuinely independent perspective. " + MAX_PARALLELISM_RULE + " Brief each role with the desired outcome, relevant context, constraints, expected evidence, and verification. Use the roster as complementary capabilities, never as a required Explore → Plan → implement → review sequence. Avoid overlapping assignments and do not ask several models the same generic question. Synthesize results against the repository and executable checks: model agreement is not verification. Use one fresh-context peer only when a consequential judgment remains after direct checks; use the coordinator only when several distinct lenses could change the decision. Advisor is optional, non-binding counsel for one focused consequential uncertainty that evidence and the appropriate roles cannot settle; it has no approval or workflow authority, and a further consultation requires materially new or conflicting evidence." + artifactClause;
2371
2565
  }
2372
- if (opts.profile === "fast" || opts.profile === "cheap" || opts.profile === "cheap1m" || opts.profile === "cheapest") {
2566
+ if (opts.profile === "fast" || opts.profile === "cheap" || opts.profile === "cheap1m" || opts.profile === "cheapest" || opts.profile === "balanced") {
2373
2567
  const isCheap = opts.profile === "cheap" || opts.profile === "cheap1m";
2374
2568
  const isCheapest = opts.profile === "cheapest";
2375
- const profileLabel = isCheapest ? "Cheapest" : isCheap ? "Cheap" : "Fast";
2376
- const oracleDescriptor = isCheapest ? "GPT-5.6 Sol (200K/high)" : isCheap ? "Grok 4.6 (200K/medium)" : "exact Opus 5 (1M/high)";
2569
+ const isBalanced = opts.profile === "balanced";
2570
+ const profileLabel = isCheapest ? "Cheapest" : isCheap ? "Cheap" : isBalanced ? "Balanced" : "Fast";
2571
+ const oracleDescriptor = isCheapest ? "GPT-5.6 Sol (200K/high)" : isCheap || isBalanced ? "Grok 4.6 (200K/medium)" : "exact Opus 5 (1M/high)";
2377
2572
  const astraDescriptor = isCheap && !isCheapest ? "200K/medium" : "200K/high";
2378
- if (opts.fastRuntimeAvailable === false) return `## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)
2573
+ const searchGuidance = opts.semanticSearchAvailable === true ? "Search strategy (cheapest first): (1) LEXICAL `code` search (mode:\"lexical\"/\"exact\", plus Grep/Glob) for symbols, filenames, errors, routes, flags, and config keys — zero model cost; (2) SEMANTIC `code` search for intent/concept questions where literal keywords may not appear; (3) `Explore` subagents read the narrowed files and return file:line conclusions — expensive models (Plan, reviewer, Oracle) see only the synthesized subset, never raw search output. " : "Search strategy (cheapest first): LEXICAL `code` search (mode:\"lexical\"/\"exact\", plus Grep/Glob) for symbols, filenames, errors, routes, flags, and config keys — zero model cost. `Explore` subagents read the narrowed files and return file:line conclusions — expensive models (Plan, reviewer, Oracle) see only the synthesized subset, never raw search output. ";
2574
+ if (opts.fastRuntimeAvailable === false) return `## Operating defaults (these layer with the user's explicit direction and the domain's own standards as addons, not replacements: follow all three together; on a direct conflict the user's direction wins, then the domain standard, then the default below)
2379
2575
 
2380
2576
  ${profileLabel} profile runtime wiring is unavailable. Work directly, use only tools actually listed in this session, verify with the repository's relevant build/tests before declaring done, report uncertainty, and do not invent unavailable capabilities.`;
2381
2577
  const peersKey = opts.peersKey ?? opts.groupKeys?.peers ?? "peers";
@@ -2386,32 +2582,27 @@ ${profileLabel} profile runtime wiring is unavailable. Work directly, use only t
2386
2582
  const workerBrowseClause = opts.browseAvailable ? ` \`worker-browse\` runs delegated autonomous browsing tasks through \`mcp__${workersKey}__browse\`.` : "";
2387
2583
  const artifactClause = opts.artifactAvailable ? ` \`mcp__${peersKey}__artifact_*\` provides human review in the artifact panel with auto-open on plan completion.` : "";
2388
2584
  const astraClause = opts.astraAvailable && (opts.profile === "fast" || opts.profile === "cheap1m") ? ` \`mcp__${peersKey}__astra\` (GPT-6 Astra ${astraDescriptor}) is the terminal escalation consultant for the lead only, reserved strictly for the hardest dead ends when direct evidence, Advisor, and Oracle have all failed to produce a defensible path (consulted at most 1-2 times per decision with concise context and specific questions).` : "";
2389
- return `## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)
2390
-
2391
- ${profileLabel} launch profile. The lead coordinates execution across specialized native roles: ` + buildNativeReachClauses(opts) + `. In plan mode or when designing changes with complex sequencing, interface contracts, or acceptance criteria, delegate architectural planning to \`Plan\` (in plan mode, produce the plan and acceptance criteria; do not edit files). Discovery rule: delegate to \`Explore\` instead of exploring yourself. For any question spanning more than a couple of files, launch one or more \`Explore\` subagents in parallel with scoped evidence questions and let them return file:line citations; read directly only the small subset you must touch to decide or edit. \`Plan\` follows the same rule when it needs repository facts. Implementation rule: delegate bounded implementation to \`implementer\` whenever a fresh context helps or lead-context pressure matters; brief with outcome, constraints, files in scope, and verification. Review rule: after behavior-changing, cross-boundary, or risk-sensitive implementation, and always after \`implementer\` completes, run relevant build/tests then invoke \`reviewer\` before declaring done. Handle trivial, surgical, single-file, or single-command tasks directly; you do not need to justify skipping delegation. \`Explore\` is cheap and may be launched in parallel across independent discovery questions. Send independent subagent calls in parallel within a single turn. Delegation graph: the lead may invoke all five; \`Plan\` may invoke \`Explore\` and \`reviewer\`; \`implementer\` and \`general-purpose\` may invoke \`reviewer\`; \`Explore\`, \`reviewer\`, and \`worker-browse\` cannot invoke native subagents.
2392
-
2393
- Consultation guidance: Follow an evidence-first escalation ladder. Direct empirical evidence (search, code, tests, builds) settles factual questions first. Advisor is an optional, non-binding, lead-only transcript-aware sounding board for trajectory guidance or framing checks (direction, not dictation), and never use it for routine progress, waiting, directly verifiable facts, or completion ritual. \`mcp__${peersKey}__oracle\` is ${oracleDescriptor}, an expert consultant available to the lead and \`Plan\`, preferred over advisor for difficult conceptual, algorithmic, spec/protocol, or architectural tradeoffs evaluated in a self-contained brief; \`reviewer\` and other subagents cannot call Oracle. \`Plan\` may consult Oracle on unresolved trade-offs, and reports any remaining tie-breaking gap to the lead.${astraClause} \`mcp__${searchKey}__code\` provides semantic-first code search and \`mcp__${searchKey}__web\` provides citable sources.${browserClause}${workerBrowseClause}${artifactClause}\n\nVerify claims with concrete repository evidence and tests before declaring work done. User instructions outrank delegation triggers. Stop named teammates when finished.`;
2585
+ return "## Operating defaults (these layer with the user's explicit direction and the domain's own standards as addons, not replacements: follow all three together; on a direct conflict the user's direction wins, then the domain standard, then the default below)\n\n" + (isCheapest ? `${profileLabel} launch profile. The lead owns the outcome and handles straightforward work directly. ` + buildNativeReachClauses(opts) + ". Handle trivial, surgical, single-file, or single-command tasks directly; you do not need to justify skipping delegation. `Explore` may be used for discovery spanning more than a couple of files; `Plan` for sequencing with complex interfaces or acceptance criteria; `General-Purpose` for mixed multi-step execution; `reviewer` for behavior-changing or risk-sensitive changes. Delegation graph: the lead may invoke all four; `Plan` may invoke `Explore` and `reviewer`; `General-Purpose` may invoke `reviewer`; `Explore`, `reviewer`, and `worker-browse` cannot invoke native subagents.\n\n" : `${profileLabel} launch profile. The lead coordinates execution across specialized native roles: ` + buildNativeReachClauses(opts) + ". In plan mode or when designing changes with complex sequencing, interface contracts, or acceptance criteria, delegate architectural planning to `Plan` (in plan mode, produce the plan and acceptance criteria; do not edit files). Phase pipeline (budget gather, expensive plan, budget execution, expensive verification). GATHER: delegate to `Explore` instead of exploring yourself. For any question spanning more than a couple of files, launch one or more `Explore` subagents in parallel with scoped evidence questions and let them return file:line citations; read directly only the small subset you must touch to decide or edit. `Plan` follows the same rule when it needs repository facts. PLAN: `Plan` produces handoff-ready steps (ordered, file:line, done conditions, acceptance criteria) for a `General-Purpose` executor that cannot see its reasoning; `Plan` may consult Oracle on unresolved trade-offs and reports any remaining gap to the lead. EXECUTE: delegate mixed multi-step work and Plan handoffs to `General-Purpose` in a fresh context to preserve lead context; brief with outcome, constraints, files in scope, and verification. VERIFY: after behavior-changing, cross-boundary, or risk-sensitive implementation, run relevant build/tests then invoke `reviewer` before declaring done. Handle trivial, surgical, single-file, or single-command tasks directly; you do not need to justify skipping delegation. `Explore` is cheap and may be launched in parallel across independent discovery questions. Send independent subagent calls in parallel within a single turn. Delegation graph: the lead may invoke all four; `Plan` may invoke `Explore` and `reviewer`; `General-Purpose` may invoke `reviewer`; `Explore`, `reviewer`, and `worker-browse` cannot invoke native subagents.\n\n") + `Consultation guidance: Follow an evidence-first escalation ladder. Direct empirical evidence (search, code, tests, builds) settles factual questions first. Advisor is an optional, non-binding, lead-only transcript-aware sounding board for trajectory guidance or framing checks (direction, not dictation), and never use it for routine progress, waiting, directly verifiable facts, or completion ritual. \`mcp__${peersKey}__oracle\` is ${oracleDescriptor}, an expert consultant available to the lead and \`Plan\`, preferred over advisor for difficult conceptual, algorithmic, spec/protocol, or architectural tradeoffs evaluated in a self-contained brief; \`reviewer\` and other subagents cannot call Oracle. \`Plan\` may consult Oracle on unresolved trade-offs, and reports any remaining tie-breaking gap to the lead.${astraClause} ` + searchGuidance + `\`mcp__${searchKey}__web\` provides citable sources.${browserClause}${workerBrowseClause}${artifactClause}\n\nVerify claims with concrete repository evidence and tests before declaring work done. User instructions outrank delegation triggers. Stop named teammates when finished.`;
2394
2586
  }
2395
- return "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nOrchestrate. Delegate research, implementation, review, and large reads to the right subagent, worker, or model. Reach for " + buildNativeReachClauses(opts) + "; worker-* agents for background non-blocking runs; Task subagents for parallel work; peer critics for review. That keeps your own context free to reason and collaborate with the user. Launch independent agents concurrently in a single message rather than serially. Delegation pays when the work is WIDE (many files or sources to sweep) or SLOW, and you need only the conclusion: the main thread is where you think with and respond to the user, and its context window is a finite shared resource. It does NOT pay merely because a sub-question is separable. A narrow, deep question whose whole value is file:line fidelity loses exactly that through a summarization layer, and a sub-question you could answer in one command is cheaper done directly than paying a subagent's startup. Do trivial, surgical, and last-mile work yourself. A named teammate persists after it reports so you can send it follow-ups, and nothing reaps it for you: its idle notice means available, not finished. Stop it once you are done with it.\n\nAdversarial review. The peer critics (`codex_critic` and `codex_reviewer`, `gemini_critic` and `gemini_reviewer`, `opus_critic`, and the `peer-review-coordinator` that fans out to several of them) are fresh-context models, so what they add is a blind spot that whoever produced the work cannot reach by thinking harder about it; prefer a critic from a different lab than the producer, since blind spots correlate within a lab. The `advisor` is a complement and not a substitute: it sees your transcript, so it catches your own drift and momentum, but it inherits your framing, which is exactly what a fresh-context critic does not. They earn their keep on consequential design choices, recommendations, and hard-to-reverse decisions: the cases where plausible alternatives remain and the conclusion rests on judgment rather than on something you can verify directly. That is where confabulation hides, so budget the wait even under delivery pressure. Always consult one when the change touches auth, user input, database queries, crypto, or serialization. They do NOT pay for read-only tracing, ordinary repository lookup, or a conclusion that a focused test, a direct reproduction, or unambiguous code evidence already settles. Asking a critic to re-derive a proven fact returns a confident answer either way, which is ritual skepticism rather than review, and skipping them there is the right call and not a shortcut. Match the lens to the artifact: a strategic critic for plans and trade-offs, a code reviewer for a concrete diff, the coordinator only when the risk warrants several independent lenses. Give whichever you pick the artifact and the constraints and not your rationale, since justification anchors the review and dulls it.\n\nAim high. Default to radical simplicity and a relentless focus on the user's real experience: design for the person and the job to be done, not the demo. Reason about the whole system from first principles, anticipating scale and the long arc rather than patching the surface. Work backwards from the outcome the user actually needs. Question every assumption and prefer what you can derive, reproduce, or test.\n\nEngineering excellence. When making technical decisions, give little weight to development cost; prefer quality, simplicity, robustness, scalability, and long-term maintainability. Fix a bug by first reproducing it end to end, as close to how a real user hits it as you can, so you solve the real problem and not a symptom. When testing a product end to end, be picky about the UI and obsessed with pixel perfection: if something clearly looks off, even when it is unrelated to your task, get it fixed along the way. Hold that same bar for the codebase itself: a lint error, a failing test, or a flaky test is worth fixing the moment you see it, whoever introduced it. Fold it into your current work rather than letting it derail the task the user actually asked for.";
2587
+ return "## Operating defaults (these layer with the user's explicit direction and the domain's own standards as addons, not replacements: follow all three together; on a direct conflict the user's direction wins, then the domain standard, then the default below)\n\nOrchestrate. Delegate research, implementation, review, and large reads to the right subagent, worker, or model. Reach for " + buildNativeReachClauses(opts) + "; worker-* agents for background non-blocking runs; Task subagents for parallel work; peer critics for review. That keeps your own context free to reason and collaborate with the user. Launch independent agents concurrently in a single message rather than serially. Delegation pays when the work is WIDE (many files or sources to sweep) or SLOW, and you need only the conclusion: the main thread is where you think with and respond to the user, and its context window is a finite shared resource. It does NOT pay merely because a sub-question is separable. A narrow, deep question whose whole value is file:line fidelity loses exactly that through a summarization layer, and a sub-question you could answer in one command is cheaper done directly than paying a subagent's startup. Do trivial, surgical, and last-mile work yourself. A named teammate persists after it reports so you can send it follow-ups, and nothing reaps it for you: its idle notice means available, not finished. Stop it once you are done with it.\n\nAdversarial review. The peer critics (`codex_critic` and `codex_reviewer`, `gemini_critic` and `gemini_reviewer`, `opus_critic`, and the `peer-review-coordinator` that fans out to several of them) are fresh-context models, so what they add is a blind spot that whoever produced the work cannot reach by thinking harder about it; prefer a critic from a different lab than the producer, since blind spots correlate within a lab. The `advisor` is a complement and not a substitute: it sees your transcript, so it catches your own drift and momentum, but it inherits your framing, which is exactly what a fresh-context critic does not. They earn their keep on consequential design choices, recommendations, and hard-to-reverse decisions: the cases where plausible alternatives remain and the conclusion rests on judgment rather than on something you can verify directly. That is where confabulation hides, so budget the wait even under delivery pressure. Always consult one when the change touches auth, user input, database queries, crypto, or serialization. They do NOT pay for read-only tracing, ordinary repository lookup, or a conclusion that a focused test, a direct reproduction, or unambiguous code evidence already settles. Asking a critic to re-derive a proven fact returns a confident answer either way, which is ritual skepticism rather than review, and skipping them there is the right call and not a shortcut. Match the lens to the artifact: a strategic critic for plans and trade-offs, a code reviewer for a concrete diff, the coordinator only when the risk warrants several independent lenses. Give whichever you pick the artifact and the constraints and not your rationale, since justification anchors the review and dulls it.\n\nAim high. Default to radical simplicity and a relentless focus on the user's real experience: design for the person and the job to be done, not the demo. Reason about the whole system from first principles, anticipating scale and the long arc rather than patching the surface. Work backwards from the outcome the user actually needs. Question every assumption and prefer what you can derive, reproduce, or test.\n\nEngineering excellence. When making technical decisions, give little weight to development cost; prefer quality, simplicity, robustness, scalability, and long-term maintainability. Fix a bug by first reproducing it end to end, as close to how a real user hits it as you can, so you solve the real problem and not a symptom. When testing a product end to end, be picky about the UI and obsessed with pixel perfection: if something clearly looks off, even when it is unrelated to your task, get it fixed along the way. Hold that same bar for the codebase itself: a lint error, a failing test, or a flaky test is worth fixing the moment you see it, whoever introduced it. Fold it into your current work rather than letting it derail the task the user actually asked for.";
2396
2588
  }
2397
2589
  /** The all-available form of the directive. Prefer
2398
2590
  * `buildOperatingDefaultsDirective` on any path that knows which natives
2399
2591
  * resolved; this const is the default for callers and tests that do not model
2400
2592
  * a thin catalog. */
2401
2593
  const OPERATING_DEFAULTS_DIRECTIVE = buildOperatingDefaultsDirective();
2402
- const STANDARD_OPERATING_DEFAULTS_DIGEST = "## Operating defaults (the user's explicit direction and the domain's standards always override)\n\nDelegate when the work is WIDE (many files or sources to sweep) or SLOW and you need only the conclusion, to protect the main thread's finite context and keep it free for reasoning and interacting with the user; prefer parallel delegation for independent work. Do NOT delegate merely because a sub-question is separable: a narrow, deep question whose value is file:line fidelity loses exactly that through a summarization layer, and one answerable in a single command is cheaper done directly. Do trivial, surgical, and last-mile work yourself. Stop a named teammate once you are done with it: it persists for follow-ups, its idle notice means available rather than finished, and nothing reaps it for you.\n\nVerify, do not assert. Run the code, read the file, check the exit code. A claim in prose is worth nothing against state you did not check, and a check that cannot fail proves nothing. Reproduce a bug end to end, the way a real user hits it, before fixing it. Fix a lint error, failing test, or flake the moment you see it, whoever introduced it, without letting it derail the task at hand. Prefer quality and long-term maintainability over development cost.\n\nVerification has a blind spot: a consequential recommendation, a design or trade-off call, or a hard-to-reverse decision that still turns on judgment among plausible alternatives once the direct evidence is in. That is where confabulation hides, so put it past a peer critic before you ship it and budget the wait even under delivery pressure. When a test, a run, a reproduction, or a search would settle the claim, settle it that way instead; a critic asked to re-derive what you can already prove is ritual, not review.\n\nThe agent roster, the tool surface, and the reasoning behind these defaults are in your CLAUDE.md project instructions. Read them when choosing HOW to work; the rules above apply without a lookup.";
2594
+ const STANDARD_OPERATING_DEFAULTS_DIGEST = "## Operating defaults (these layer with the user's direction and the domain's standards as addons: follow all three; on a direct conflict the user's direction wins, then the domain standard, then the default below)\n\nDelegate when the work is WIDE (many files or sources to sweep) or SLOW and you need only the conclusion, to protect the main thread's finite context and keep it free for reasoning and interacting with the user; prefer parallel delegation for independent work. Do NOT delegate merely because a sub-question is separable: a narrow, deep question whose value is file:line fidelity loses exactly that through a summarization layer, and one answerable in a single command is cheaper done directly. Do trivial, surgical, and last-mile work yourself. Stop a named teammate once you are done with it: it persists for follow-ups, its idle notice means available rather than finished, and nothing reaps it for you.\n\nVerify, do not assert. Run the code, read the file, check the exit code. A claim in prose is worth nothing against state you did not check, and a check that cannot fail proves nothing. Reproduce a bug end to end, the way a real user hits it, before fixing it. Fix a lint error, failing test, or flake the moment you see it, whoever introduced it, without letting it derail the task at hand. Prefer quality and long-term maintainability over development cost.\n\nVerification has a blind spot: a consequential recommendation, a design or trade-off call, or a hard-to-reverse decision that still turns on judgment among plausible alternatives once the direct evidence is in. That is where confabulation hides, so put it past a peer critic before you ship it and budget the wait even under delivery pressure. When a test, a run, a reproduction, or a search would settle the claim, settle it that way instead; a critic asked to re-derive what you can already prove is ritual, not review.\n\nThe agent roster, the tool surface, and the reasoning behind these defaults are in your CLAUDE.md project instructions. Read them when choosing HOW to work; the rules above apply without a lookup.";
2403
2595
  function buildOperatingDefaultsDigest(opts = {}) {
2404
- if (opts.profile === "max") return "## Operating defaults (the user's explicit direction and the domain's standards always override)\n\nMax launch profile. The lead owns the outcome. Start with direct repository or runtime evidence. Do narrow, obvious, surgical, and single-command work directly; delegate bounded work that is broad, slow, context-heavy, or independently valuable. " + MAX_PARALLELISM_RULE + " Give delegated workstreams non-overlapping scopes and state the outcome, constraints, evidence, and verification expected.\n\nSynthesize and verify: run the code, inspect outputs, and check tests. Agent count and agreement are not evidence. Use a fresh-context peer only for consequential judgment that remains after direct checks, and use the coordinator only when several distinct lenses could change the decision. Advisor is optional, non-binding, primary-lead-only counsel for one focused consequential uncertainty; it is not an approval or completion gate.";
2405
- if (opts.profile === "fast" || opts.profile === "cheap" || opts.profile === "cheap1m" || opts.profile === "cheapest") {
2596
+ if (opts.profile === "max") return "## Operating defaults (these layer with the user's direction and the domain's standards as addons: follow all three; on a direct conflict the user's direction wins, then the domain standard, then the default below)\n\nMax launch profile. The lead owns the outcome. Start with direct repository or runtime evidence. Do narrow, obvious, surgical, and single-command work directly; delegate bounded work that is broad, slow, context-heavy, or independently valuable. " + MAX_PARALLELISM_RULE + " Give delegated workstreams non-overlapping scopes and state the outcome, constraints, evidence, and verification expected.\n\nSynthesize and verify: run the code, inspect outputs, and check tests. Agent count and agreement are not evidence. Use a fresh-context peer only for consequential judgment that remains after direct checks, and use the coordinator only when several distinct lenses could change the decision. Advisor is optional, non-binding, primary-lead-only counsel for one focused consequential uncertainty; it is not an approval or completion gate.";
2597
+ if (opts.profile === "fast" || opts.profile === "cheap" || opts.profile === "cheap1m" || opts.profile === "cheapest" || opts.profile === "balanced") {
2406
2598
  const isCheap = opts.profile === "cheap" || opts.profile === "cheap1m";
2407
2599
  const isCheapest = opts.profile === "cheapest";
2408
- const profileLabel = isCheapest ? "Cheapest" : isCheap ? "Cheap" : "Fast";
2409
- const oracleDescriptor = isCheapest ? "(GPT-5.6 Sol 200K/high, lead and Plan)" : isCheap ? "(Grok 4.6 200K/medium, lead and Plan)" : "(Opus 5 1M/high, lead and Plan)";
2600
+ const isBalanced = opts.profile === "balanced";
2601
+ const profileLabel = isCheapest ? "Cheapest" : isCheap ? "Cheap" : isBalanced ? "Balanced" : "Fast";
2602
+ const oracleDescriptor = isCheapest ? "(GPT-5.6 Sol 200K/high, lead and Plan)" : isCheap || isBalanced ? "(Grok 4.6 200K/medium, lead and Plan)" : "(Opus 5 1M/high, lead and Plan)";
2410
2603
  const advisorDescriptor = isCheapest ? "(Gemini/high, lead-only)" : "(Sol/high, lead-only)";
2411
2604
  const astraStep = opts.astraAvailable && (opts.profile === "fast" || opts.profile === "cheap1m") ? `; (4) \`astra\` (GPT-6 Astra 200K/${isCheap ? "medium" : "high"}, lead-only) only as a last resort when direct evidence, Advisor, and Oracle cannot produce a defensible path (at most 1-2 calls per decision).` : ".";
2412
- return `## Operating defaults (the user's explicit direction and the domain's standards always override)
2413
-
2414
- ${profileLabel} launch profile. The lead coordinates execution across specialized roles: delegate broad discovery to \`Explore\` in parallel and do not sweep the repo yourself (read directly only files you will act on); delegate to \`Plan\` in plan mode or when structuring complex multi-step sequencing (\`Plan\` is an advisory planning capability, not an approval gate); delegate bounded implementation to \`implementer\` in a fresh context to preserve lead context (\`general-purpose\` for mixed multi-step execution); delegate to \`reviewer\` after behavior-changing or risk-sensitive implementation, and always after \`implementer\` completes, to verify correctness before declaring done; handle trivial and surgical edits directly. Send independent subagent calls in parallel within a single turn. Stop named teammates when finished.\n\nVerify claims against real evidence: run relevant commands and tests. Follow a disciplined consultation ladder for unresolved decisions: (1) direct code inspection, search, builds, and tests settle factual questions; (2) \`advisor\` ` + advisorDescriptor + " for transcript-aware framing checks or trajectory guidance; (3) `oracle` " + oracleDescriptor + " for self-contained technical/architectural trade-offs" + astraStep;
2605
+ return "## Operating defaults (these layer with the user's direction and the domain's standards as addons: follow all three; on a direct conflict the user's direction wins, then the domain standard, then the default below)\n\n" + (isCheapest ? `${profileLabel} launch profile. The lead owns the outcome and handles straightforward work directly: use \`Explore\` for discovery spanning more than a couple of files, \`Plan\` in plan mode or for complex sequencing, \`General-Purpose\` for mixed multi-step execution, and \`reviewer\` for behavior-changing or risk-sensitive changes. Handle trivial and surgical edits directly. Stop named teammates when finished.\n\n` : `${profileLabel} launch profile. The lead coordinates execution across specialized roles: delegate broad discovery to \`Explore\` in parallel and do not sweep the repo yourself (read directly only files you will act on); delegate to \`Plan\` in plan mode or when structuring complex multi-step sequencing (\`Plan\` is an advisory planning capability, not an approval gate, and writes handoff-ready steps for \`General-Purpose\`); delegate mixed multi-step execution and Plan handoffs to \`General-Purpose\` in a fresh context; delegate to \`reviewer\` after behavior-changing or risk-sensitive implementation to verify correctness before declaring done; handle trivial and surgical edits directly. Send independent subagent calls in parallel within a single turn. Stop named teammates when finished.\n\n`) + "Verify claims against real evidence: run relevant commands and tests. Follow a disciplined consultation ladder for unresolved decisions: (1) direct code inspection, search, builds, and tests settle factual questions; (2) `advisor` " + advisorDescriptor + " for transcript-aware framing checks or trajectory guidance; (3) `oracle` " + oracleDescriptor + " for self-contained technical/architectural trade-offs" + astraStep;
2415
2606
  }
2416
2607
  return STANDARD_OPERATING_DEFAULTS_DIGEST;
2417
2608
  }
@@ -2892,7 +3083,7 @@ const INJECTED_SKILLS = [
2892
3083
  FIRST_MATE_CONDUCT_SKILL
2893
3084
  ];
2894
3085
  function injectedSkillsForLaunch(selection) {
2895
- if (selection.profileId === "fast" || selection.profileId === "cheap" || selection.profileId === "cheap1m" || selection.profileId === "cheapest") return [];
3086
+ if (selection.profileId === "fast" || selection.profileId === "cheap" || selection.profileId === "cheap1m" || selection.profileId === "cheapest" || selection.profileId === "balanced") return [];
2896
3087
  if (selection.profileId === "max") return selection.firstMateEnabled ? INJECTED_SKILLS.filter((skill) => skill.name.startsWith("gh-first-mate")) : [];
2897
3088
  if (!selection.workerSkillsActive) return [];
2898
3089
  return INJECTED_SKILLS.filter((skill) => selection.firstMateEnabled || !skill.name.startsWith("gh-first-mate"));
@@ -2964,4 +3155,4 @@ async function injectAttributionSuppressionIntoSettingsFile(settingsPath) {
2964
3155
  //#endregion
2965
3156
  export { writePeerMcpRuntimeFiles as C, workersKeyOf as S, sanitizeServeSettingsEnv as _, appendPeerAwarenessToMirroredClaudeMd as a, resolveCodexCliBackend as b, buildOperatingDefaultsDirective as c, prependStyleDirectiveToMirroredClaudeMd as d, buildArtifactReviewSkill as f, planModeAllowRules as g, injectAllowRules as h, writeInjectedSkill as i, prependArtifactPanelDirectiveToMirroredClaudeMd as l, configureServeDefaultPermissionMode as m, INJECTED_SKILLS as n, appendToolbeltAwarenessToMirroredClaudeMd as o, SEAMLESS_BUILTIN_TOOLS as p, injectedSkillsForLaunch as r, buildOperatingDefaultsDigest as s, injectAttributionSuppressionIntoSettingsFile as t, prependOperatingDefaultsToMirroredClaudeMd as u, BUILTIN_SUBAGENT_DEFINITIONS as v, resolveGroupKeysFromMirror as x, injectPeerMcpIntoMirror as y };
2966
3157
 
2967
- //# sourceMappingURL=attribution-settings-DHWo0lyG.js.map
3158
+ //# sourceMappingURL=attribution-settings-CX-kIrT8.js.map