github-router 0.3.347 → 0.3.349

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 (63) hide show
  1. package/dist/{aic-statusline-settings-YoDG20pq.js → aic-statusline-settings-DCFywz3N.js} +2 -2
  2. package/dist/aic-statusline-settings-DCFywz3N.js.map +1 -0
  3. package/dist/{attribution-settings-50S3mk4N.js → attribution-settings-BgYkynRc.js} +30 -18
  4. package/dist/attribution-settings-BgYkynRc.js.map +1 -0
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/{claude-D0rojAcX.js → claude-Chtd07VA.js} +32 -16
  7. package/dist/claude-Chtd07VA.js.map +1 -0
  8. package/dist/{codex-kcdKpoOe.js → codex-DayPQ8t5.js} +4 -4
  9. package/dist/{codex-kcdKpoOe.js.map → codex-DayPQ8t5.js.map} +1 -1
  10. package/dist/engine-T81FYVwK.js +2 -0
  11. package/dist/{gate-discovery-CzZ5Oc3H.js → gate-discovery-CBOPoK9-.js} +4 -4
  12. package/dist/{gate-discovery-CzZ5Oc3H.js.map → gate-discovery-CBOPoK9-.js.map} +1 -1
  13. package/dist/hooks.mjs +684 -14
  14. package/dist/hooks.sha256 +1 -1
  15. package/dist/{internal-aic-status-CCvU7zhC.js → internal-aic-status-lM0YNDaH.js} +52 -11
  16. package/dist/internal-aic-status-lM0YNDaH.js.map +1 -0
  17. package/dist/{internal-artifact-open-lta2UPnE.js → internal-artifact-open-CXJbMXpq.js} +2 -2
  18. package/dist/{internal-artifact-open-lta2UPnE.js.map → internal-artifact-open-CXJbMXpq.js.map} +1 -1
  19. package/dist/{internal-plan-review-B4f0dpss.js → internal-plan-review-F-WbltsT.js} +3 -3
  20. package/dist/{internal-plan-review-B4f0dpss.js.map → internal-plan-review-F-WbltsT.js.map} +1 -1
  21. package/dist/internal-prompt-submit-DRCJ5kWC.js +559 -0
  22. package/dist/internal-prompt-submit-DRCJ5kWC.js.map +1 -0
  23. package/dist/{internal-session-bind-IpZ5hJzR.js → internal-session-bind-LrYEo-kg.js} +2 -2
  24. package/dist/{internal-session-bind-IpZ5hJzR.js.map → internal-session-bind-LrYEo-kg.js.map} +1 -1
  25. package/dist/{internal-stop-hook-BdVV3NyD.js → internal-stop-hook-CIe2kVss.js} +5 -5
  26. package/dist/{internal-stop-hook-BdVV3NyD.js.map → internal-stop-hook-CIe2kVss.js.map} +1 -1
  27. package/dist/{internal-stop-review-C7bOxX1q.js → internal-stop-review-nL003JIj.js} +2 -2
  28. package/dist/{internal-stop-review-C7bOxX1q.js.map → internal-stop-review-nL003JIj.js.map} +1 -1
  29. package/dist/main.js +12 -12
  30. package/dist/{orchestration-Ccmfslh4.js → orchestration-DjuJRhXn.js} +2 -2
  31. package/dist/{orchestration-Ccmfslh4.js.map → orchestration-DjuJRhXn.js.map} +1 -1
  32. package/dist/{peer-mcp-personas-DlmmbpD6.js → peer-mcp-personas-agpBeTgS.js} +258 -52
  33. package/dist/peer-mcp-personas-agpBeTgS.js.map +1 -0
  34. package/dist/{pi-07uTIAcP.js → pi-BLDBFXg3.js} +5 -5
  35. package/dist/{pi-07uTIAcP.js.map → pi-BLDBFXg3.js.map} +1 -1
  36. package/dist/{plan-review-hook-BTvxvCCo.js → plan-review-hook-DMqPHBBN.js} +2 -2
  37. package/dist/{plan-review-hook-BTvxvCCo.js.map → plan-review-hook-DMqPHBBN.js.map} +1 -1
  38. package/dist/prompt-submit-hook-CBGlhEpU.js +411 -0
  39. package/dist/prompt-submit-hook-CBGlhEpU.js.map +1 -0
  40. package/dist/{provision-D_rmmqTq.js → provision-BKdrO1Sv.js} +2 -2
  41. package/dist/{provision-D_rmmqTq.js.map → provision-BKdrO1Sv.js.map} +1 -1
  42. package/dist/{serve-DbrYa6zo.js → serve-p_58sDJK.js} +8 -8
  43. package/dist/{serve-DbrYa6zo.js.map → serve-p_58sDJK.js.map} +1 -1
  44. package/dist/{server-setup-CKhj8I0W.js → server-setup-PAHohZ-u.js} +86 -33
  45. package/dist/server-setup-PAHohZ-u.js.map +1 -0
  46. package/dist/{start-BXVrchgI.js → start-CTHcqkQL.js} +3 -3
  47. package/dist/{start-BXVrchgI.js.map → start-CTHcqkQL.js.map} +1 -1
  48. package/dist/{stop-gate-hook-DZVfKoSh.js → stop-gate-hook-DRcYQAtf.js} +2 -2
  49. package/dist/{stop-gate-hook-DZVfKoSh.js.map → stop-gate-hook-DRcYQAtf.js.map} +1 -1
  50. package/dist/{stop-gate-policy-Gd_cNT9-.js → stop-gate-policy-CbLklfV2.js} +21 -2
  51. package/dist/{stop-gate-policy-Gd_cNT9-.js.map → stop-gate-policy-CbLklfV2.js.map} +1 -1
  52. package/package.json +1 -1
  53. package/dist/aic-statusline-settings-YoDG20pq.js.map +0 -1
  54. package/dist/attribution-settings-50S3mk4N.js.map +0 -1
  55. package/dist/claude-D0rojAcX.js.map +0 -1
  56. package/dist/engine-BWxxbsSu.js +0 -2
  57. package/dist/internal-aic-status-CCvU7zhC.js.map +0 -1
  58. package/dist/internal-prompt-submit-DGxv_Vgl.js +0 -127
  59. package/dist/internal-prompt-submit-DGxv_Vgl.js.map +0 -1
  60. package/dist/peer-mcp-personas-DlmmbpD6.js.map +0 -1
  61. package/dist/prompt-submit-hook-BeLUDy_m.js +0 -173
  62. package/dist/prompt-submit-hook-BeLUDy_m.js.map +0 -1
  63. package/dist/server-setup-CKhj8I0W.js.map +0 -1
@@ -7,7 +7,7 @@ import fs from "node:fs/promises";
7
7
  *
8
8
  * `github-router claude` writes `{ statusLine: { type: "command", command } }`
9
9
  * into the mirrored settings.json so the status bar shows
10
- * `[AIC 12.42] [####------] 42% | model | dir (branch) | ...`,
10
+ * `[AIC 12.42] [####------] 42%·200K | model | dir (branch) | ...`,
11
11
  * updating as the ledger file grows. The command itself
12
12
  * (`internal-aic-status`) reads the ledger path from `GH_ROUTER_AIC_LEDGER`
13
13
  * in the spawned child's env — never a path baked into settings — so the
@@ -136,4 +136,4 @@ async function writeBackupSidecar(settingsPath, previous) {
136
136
  //#endregion
137
137
  export { injectAicStatusLineIntoSettingsFile as a, buildAicStatusHookCommand as i, AIC_STATUSLINE_DISABLE_ENV as n, AIC_USER_STATUSLINE_ENV as r, AIC_LEDGER_ENV as t };
138
138
 
139
- //# sourceMappingURL=aic-statusline-settings-YoDG20pq.js.map
139
+ //# sourceMappingURL=aic-statusline-settings-DCFywz3N.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aic-statusline-settings-DCFywz3N.js","names":[],"sources":["../src/lib/aic-statusline-settings.ts"],"sourcesContent":["/**\n * Claude Code `statusLine` injection for the per-session AIC total + rich\n * default session line.\n *\n * `github-router claude` writes `{ statusLine: { type: \"command\", command } }`\n * into the mirrored settings.json so the status bar shows\n * `[AIC 12.42] [####------] 42%·200K | model | dir (branch) | ...`,\n * updating as the ledger file grows. The command itself\n * (`internal-aic-status`) reads the ledger path from `GH_ROUTER_AIC_LEDGER`\n * in the spawned child's env — never a path baked into settings — so the\n * same mirror mechanics work for concurrent launches. AIC is pinned: it\n * renders even when the terminal is too narrow for any other segment.\n *\n * Standard launches use wrap-don't-clobber: when the user's own config\n * already defines `statusLine` as a `{type:\"command\", command:string}`\n * shape, that command is preserved via `GH_ROUTER_AIC_USER_STATUSLINE`\n * (set by the caller from the returned `userCommand`) and the hook\n * composes one line: `[AIC x.xx] <user line>`. Any other pre-existing\n * `statusLine` shape is left untouched (`reason: \"unrecognized\"`) rather\n * than risk breaking an exotic config.\n *\n * Pinned launches (fast/cheap/cheap1m/cheapest, `routerWins: true`) run\n * router-provided surfaces only: ANY pre-existing `statusLine` is backed\n * up to a mirror sidecar and replaced with ours (`mode: \"forced\"`), so the\n * native rich line always renders and the user command never executes.\n *\n * Failure model matches the sibling settings writers: a transient read error\n * or a non-object settings.json throws (never clobber a file we don't\n * understand); the caller wraps this in warn-and-continue so a settings-write\n * hiccup never blocks launch. Writes use a same-directory temp file, mode\n * 0o600, then rename.\n */\n\nimport fs from \"node:fs/promises\"\n\nimport type { SelfInvocation } from \"./hook-launcher/self-invocation\"\nimport { buildSelfCommand } from \"./hook-launcher/self-invocation\"\n\n/** Env var carrying the ledger snapshot path into the spawned child. */\nexport const AIC_LEDGER_ENV = \"GH_ROUTER_AIC_LEDGER\"\n/** Env var carrying the user's own statusLine command (wrap mode only). */\nexport const AIC_USER_STATUSLINE_ENV = \"GH_ROUTER_AIC_USER_STATUSLINE\"\n/** Opt-out for the whole injection (mirrors GH_ROUTER_DISABLE_NO_ATTRIBUTION). */\nexport const AIC_STATUSLINE_DISABLE_ENV = \"GH_ROUTER_DISABLE_AIC_STATUSLINE\"\n\nexport function buildAicStatusHookCommand(invocation: SelfInvocation): string {\n return buildSelfCommand(invocation, \"internal-aic-status\")\n}\n\nexport type AicStatuslineInjectionResult =\n | { written: true; mode: \"injected\" | \"wrapped\" | \"forced\"; userCommand?: string; hadPrevious?: boolean }\n | { written: false; reason: \"already-set\" | \"unrecognized\" }\n\nfunction isCommandStatusLine(value: unknown): value is {\n type: string\n command: string\n} {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return false\n const record = value as Record<string, unknown>\n return (\n record.type === \"command\"\n && typeof record.command === \"string\"\n && record.command.length > 0\n )\n}\n\nexport async function injectAicStatusLineIntoSettingsFile(\n settingsPath: string,\n statusCommand: string,\n opts: { routerWins?: boolean } = {},\n): Promise<AicStatuslineInjectionResult> {\n let existing: Record<string, unknown> = {}\n let raw: string | undefined\n try {\n raw = await fs.readFile(settingsPath, \"utf8\")\n } catch (err) {\n // Never clobber on a transient read error; a missing file starts clean.\n if ((err as NodeJS.ErrnoException).code !== \"ENOENT\") throw err\n raw = undefined\n }\n if (raw !== undefined) {\n // A parse failure means a real file we don't understand: do NOT replace it.\n const parsed: unknown = JSON.parse(raw)\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n existing = parsed as Record<string, unknown>\n } else {\n throw new Error(\n `settings.json at ${settingsPath} is not a JSON object; refusing to overwrite`,\n )\n }\n }\n\n const current = existing.statusLine\n if (current !== undefined) {\n // Idempotency: a previous injection already points at our hook.\n if (\n isCommandStatusLine(current)\n && current.command.includes(\"internal-aic-status\")\n ) {\n return { written: false, reason: \"already-set\" }\n }\n // Pinned profiles run the router line only: back up whatever was\n // there (command or exotic shape) to a mirror sidecar for audit and\n // replace it. The user command is recorded but never executed.\n if (opts.routerWins) {\n const hadPrevious = true\n const merged = {\n ...existing,\n statusLine: { type: \"command\", command: statusCommand },\n }\n await writeSettingsAtomically(settingsPath, merged)\n await writeBackupSidecar(settingsPath, current)\n return { written: true, mode: \"forced\", hadPrevious }\n }\n // Wrap-don't-clobber: preserve the user's command via env.\n if (isCommandStatusLine(current)) {\n const userCommand = current.command\n const merged = {\n ...existing,\n statusLine: { type: \"command\", command: statusCommand },\n }\n await writeSettingsAtomically(settingsPath, merged)\n return { written: true, mode: \"wrapped\", userCommand }\n }\n return { written: false, reason: \"unrecognized\" }\n }\n\n const merged = {\n ...existing,\n statusLine: { type: \"command\", command: statusCommand },\n }\n await writeSettingsAtomically(settingsPath, merged)\n return { written: true, mode: \"injected\" }\n}\n\nasync function writeSettingsAtomically(\n settingsPath: string,\n merged: Record<string, unknown>,\n): Promise<void> {\n const tmp = `${settingsPath}.${process.pid}.aicstatus.tmp`\n await fs.writeFile(tmp, `${JSON.stringify(merged, null, 2)}\\n`, { mode: 0o600 })\n await fs.rename(tmp, settingsPath)\n}\n\n/**\n * Record a replaced `statusLine` value in a mirror sidecar for audit.\n * Mirror-only (same dir as the mirrored settings.json); the operator's\n * real settings are never touched. Best-effort: a backup failure must\n * not fail the injection that already succeeded.\n */\nasync function writeBackupSidecar(\n settingsPath: string,\n previous: unknown,\n): Promise<void> {\n const backupPath = `${settingsPath}.aic-statusline-backup.json`\n const payload = { replacedStatusLine: previous }\n try {\n await fs.writeFile(backupPath, `${JSON.stringify(payload, null, 2)}\\n`, { mode: 0o600 })\n } catch {\n // Audit-only; the injection itself already landed.\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAa,iBAAiB;;AAE9B,MAAa,0BAA0B;;AAEvC,MAAa,6BAA6B;AAE1C,SAAgB,0BAA0B,YAAoC;CAC5E,OAAO,iBAAiB,YAAY,qBAAqB;AAC3D;AAMA,SAAS,oBAAoB,OAG3B;CACA,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG,OAAO;CACxE,MAAM,SAAS;CACf,OACE,OAAO,SAAS,aACb,OAAO,OAAO,YAAY,YAC1B,OAAO,QAAQ,SAAS;AAE/B;AAEA,eAAsB,oCACpB,cACA,eACA,OAAiC,CAAC,GACK;CACvC,IAAI,WAAoC,CAAC;CACzC,IAAI;CACJ,IAAI;EACF,MAAM,MAAM,GAAG,SAAS,cAAc,MAAM;CAC9C,SAAS,KAAK;EAEZ,IAAK,IAA8B,SAAS,UAAU,MAAM;EAC5D,MAAM,KAAA;CACR;CACA,IAAI,QAAQ,KAAA,GAAW;EAErB,MAAM,SAAkB,KAAK,MAAM,GAAG;EACtC,IAAI,UAAU,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,GAC/D,WAAW;OAEX,MAAM,IAAI,MACR,oBAAoB,aAAa,6CACnC;CAEJ;CAEA,MAAM,UAAU,SAAS;CACzB,IAAI,YAAY,KAAA,GAAW;EAEzB,IACE,oBAAoB,OAAO,KACxB,QAAQ,QAAQ,SAAS,qBAAqB,GAEjD,OAAO;GAAE,SAAS;GAAO,QAAQ;EAAc;EAKjD,IAAI,KAAK,YAAY;GACnB,MAAM,cAAc;GAKpB,MAAM,wBAAwB,cAAc;IAH1C,GAAG;IACH,YAAY;KAAE,MAAM;KAAW,SAAS;IAAc;GAEP,CAAC;GAClD,MAAM,mBAAmB,cAAc,OAAO;GAC9C,OAAO;IAAE,SAAS;IAAM,MAAM;IAAU;GAAY;EACtD;EAEA,IAAI,oBAAoB,OAAO,GAAG;GAChC,MAAM,cAAc,QAAQ;GAK5B,MAAM,wBAAwB,cAAc;IAH1C,GAAG;IACH,YAAY;KAAE,MAAM;KAAW,SAAS;IAAc;GAEP,CAAC;GAClD,OAAO;IAAE,SAAS;IAAM,MAAM;IAAW;GAAY;EACvD;EACA,OAAO;GAAE,SAAS;GAAO,QAAQ;EAAe;CAClD;CAMA,MAAM,wBAAwB,cAAc;EAH1C,GAAG;EACH,YAAY;GAAE,MAAM;GAAW,SAAS;EAAc;CAEP,CAAC;CAClD,OAAO;EAAE,SAAS;EAAM,MAAM;CAAW;AAC3C;AAEA,eAAe,wBACb,cACA,QACe;CACf,MAAM,MAAM,GAAG,aAAa,GAAG,QAAQ,IAAI;CAC3C,MAAM,GAAG,UAAU,KAAK,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,IAAM,CAAC;CAC/E,MAAM,GAAG,OAAO,KAAK,YAAY;AACnC;;;;;;;AAQA,eAAe,mBACb,cACA,UACe;CACf,MAAM,aAAa,GAAG,aAAa;CACnC,MAAM,UAAU,EAAE,oBAAoB,SAAS;CAC/C,IAAI;EACF,MAAM,GAAG,UAAU,YAAY,GAAG,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,IAAM,CAAC;CACzF,QAAQ,CAER;AACF"}
@@ -1,10 +1,10 @@
1
1
  import { a as isUnderClaudeConfigMirror, f as writeRuntimeFileSecure, t as PATHS } from "./paths-CpbTHKeP.js";
2
- import { C as CHEAP_REVIEWER_ALIAS_ID, S as CHEAP_PLAN_ALIAS_ID, T as MAX_BROWSE_LOW_ALIAS_ID, _ as CHEAPEST_EXPLORE_ALIAS_ID, b as CHEAP_EXPLORE_ALIAS_ID, g as BROWSE_LOW_ALIAS_ID, h as BALANCED_REVIEWER_ALIAS_ID, m as BALANCED_GENERAL_PURPOSE_ALIAS_ID, p as BALANCED_EXPLORE_ALIAS_ID, v as CHEAPEST_GENERAL_PURPOSE_ALIAS_ID, w as LUNA_SCOUT_ALIAS_ID, x as CHEAP_GENERAL_PURPOSE_ALIAS_ID, y as CHEAPEST_REVIEWER_ALIAS_ID } from "./server-setup-CKhj8I0W.js";
2
+ import { C as CHEAP_REVIEWER_ALIAS_ID, S as CHEAP_PLAN_ALIAS_ID, T as MAX_BROWSE_LOW_ALIAS_ID, _ as CHEAPEST_EXPLORE_ALIAS_ID, b as CHEAP_EXPLORE_ALIAS_ID, g as BROWSE_LOW_ALIAS_ID, h as BALANCED_REVIEWER_ALIAS_ID, m as BALANCED_GENERAL_PURPOSE_ALIAS_ID, p as BALANCED_EXPLORE_ALIAS_ID, v as CHEAPEST_GENERAL_PURPOSE_ALIAS_ID, w as LUNA_SCOUT_ALIAS_ID, x as CHEAP_GENERAL_PURPOSE_ALIAS_ID, y as CHEAPEST_REVIEWER_ALIAS_ID } from "./server-setup-PAHohZ-u.js";
3
3
  import { _ as FAST_PROFILE_MODELS, a as BALANCED_PROFILE_NATIVE_EFFORTS, b as FAST_PROFILE_NATIVE_MODELS, i as BALANCED_PROFILE_NATIVE_AGENT_NAMES, v as FAST_PROFILE_NATIVE_AGENT_NAMES, y as FAST_PROFILE_NATIVE_EFFORTS } from "./balanced-profile-contract-XiIj4O1U.js";
4
- import { Fn as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, In as CHEAPEST_PROFILE_NATIVE_EFFORTS, On as oneMContextDisabled, Un as CHEAP_PROFILE_NATIVE_AGENT_NAMES, Wn as CHEAP_PROFILE_NATIVE_EFFORTS, a as buildAgentPrompt, cn as DEFINITION_OF_GREATNESS, kn as withOneMSuffix, l as maxPersonasFor, n as MCP_GROUPS, sn as CONDENSED_OPERATING_SEQUENCE, t as GROUP_META, u as personasFor } from "./peer-mcp-personas-DlmmbpD6.js";
4
+ import { An as oneMContextDisabled, Gn as CHEAP_PROFILE_NATIVE_AGENT_NAMES, Kn as CHEAP_PROFILE_NATIVE_EFFORTS, Ln as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, Rn as CHEAPEST_PROFILE_NATIVE_EFFORTS, 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-agpBeTgS.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--dAYkEG1.js";
6
6
  import "./self-invocation-DIUyoRgL.js";
7
- import { a as STRIPPED_AUTH_ROUTING_ENV_KEYS, n as buildCodexProviderConfigFlags } from "./provision-D_rmmqTq.js";
7
+ import { a as STRIPPED_AUTH_ROUTING_ENV_KEYS, n as buildCodexProviderConfigFlags } from "./provision-BKdrO1Sv.js";
8
8
  import { n as buildWorkspaceHeaderHelperCommand } from "./mcp-workspace-header-B77WqVFw.js";
9
9
  import { a as dispatcherAgentName, c as dispatcherTools, n as activeDispatchModes, o as dispatcherDescription, s as dispatcherPrompt } from "./worker-dispatch-lRhno09M.js";
10
10
  import consola from "consola";
@@ -468,11 +468,17 @@ function pinnedGeneralPurposePrompt(opts) {
468
468
  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" + (opts?.is200K ? PROMPT_200K_NOTE : "") + fileToolSteer("builds");
469
469
  }
470
470
  const REVIEWER_DESC_TAIL = "Runs builds/tests itself rather than assuming them. Returns SHIP / FIX / BLOCK with reproducible evidence. Never edits source.";
471
- function pinnedReviewerDescription(explicit, isBalanced = false, is200K = false) {
472
- return (explicit ? isBalanced ? "Adversarial evidence-based reviewer. Use proactively ONLY when the change is genuinely behavior-changing, cross-boundary, or risk-sensitive, before done. The lead owns verification by default. " : "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 + (is200K ? DESC_200K_NOTE : "");
471
+ function pinnedReviewerDescription(explicit, isBalanced = false, is200K = false, protegeAdvisor = false) {
472
+ return (explicit ? isBalanced ? "Adversarial evidence-based reviewer. Use proactively ONLY when the change is genuinely behavior-changing, cross-boundary, or risk-sensitive, before done. The lead owns verification by default. " : "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 + (is200K ? DESC_200K_NOTE : "") + (protegeAdvisor ? " May consult its Sol advisor (at most 5 advisor rounds per review) on consequential uncertainty it cannot settle by evidence." : "");
473
473
  }
474
+ /** Protege appendix for the cheapest Luna/max reviewer: the capped Sol-advisor
475
+ * protocol. Appended after the delegation paragraph so the adversarial core
476
+ * above stays byte-identical across profiles. */
477
+ const PROTEGE_ADVISOR_APPENDIX = "You have an `advisor` tool backed by Sol, a stronger cross-lab model that sees your full transcript. You own the verdict; the advisor is counsel, never authority — it never approves, vetoes, or decides for you. Budget: at most 5 advisor rounds per review (code-enforced; one round is one back-and-forth exchange). Spend them only on consequential uncertainty that repository evidence, builds, or tests cannot settle: a changed assumption, conflicting evidence, an approach that will not converge, or a severity call with merge-blocking consequences. Every consult must state the precise question, your evidence so far with file:line citations, the credible alternatives, and what evidence would change your verdict. Never consult for routine verification, progress narration, reassurance, or completion ritual — run the check yourself. If the advisor disagrees with you, evaluate on the merits: adopt what is right with a one-line reason, defend what is verified with evidence, and record the disagreement in your result. ";
474
478
  function pinnedReviewerPrompt(semanticAvailable = true, opts) {
475
- 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. " + (opts?.allowExploreDelegation === true ? "Do not modify source code. Scope first with search, then delegate: use code search (lexical, then semantic when available) and web search to narrow scope and rule out hypotheses before delegating — cheapest, always first. When search is insufficient, delegate targeted discovery to `Explore`: launch one or more `Explore` subagents in parallel with scoped evidence questions (call chains, config patterns, test conventions, boundary conditions) and let them return file:line conclusions; do not sweep the repository yourself. You may invoke only `Explore`; do not invoke any other subagent. 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). " : "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" + (opts?.is200K ? PROMPT_200K_NOTE : "") + reviewerToolSteer(semanticAvailable);
479
+ const delegation = opts?.allowExploreDelegation === true ? "Do not modify source code. Scope first with search, then delegate: use code search (lexical, then semantic when available) and web search to narrow scope and rule out hypotheses before delegating — cheapest, always first. When search is insufficient, delegate targeted discovery to `Explore`: launch one or more `Explore` subagents in parallel with scoped evidence questions (call chains, config patterns, test conventions, boundary conditions) and let them return file:line conclusions; do not sweep the repository yourself. You may invoke only `Explore`; do not invoke any other subagent. 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). " : "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). ";
480
+ const protege = opts?.protegeAdvisor === true ? PROTEGE_ADVISOR_APPENDIX : "";
481
+ 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. " + delegation + protege + "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" + (opts?.is200K ? PROMPT_200K_NOTE : "") + reviewerToolSteer(semanticAvailable);
476
482
  }
477
483
  /** Build the literal `-m fast` native roster. This is intentionally separate
478
484
  * from the standard definitions: the names overlap, but their role bodies,
@@ -661,7 +667,8 @@ function buildCheapProfileAgentDefinitions(opts) {
661
667
  /** Build the literal `-m cheapest` native roster. Three-agent surface
662
668
  * (`Explore`, `General-Purpose`, `reviewer` — no `Plan`: the lead plans
663
669
  * directly and reviews the final plan with the Advisor before presenting
664
- * it), Luna-led with a Sol reviewer — every SUBAGENT model is a BARE
670
+ * it), Luna-led with a Luna/max reviewer (protege of the Sol Advisor) —
671
+ * every SUBAGENT model is a BARE
665
672
  * router-owned alias (`gh-router-cheapest-*`, no `[1m]`) rather than a real
666
673
  * catalog id, for the same client catalog-resolution reason as the cheap
667
674
  * builder above: a bare real id is upgraded to `[1m]` accounting by Claude
@@ -710,8 +717,11 @@ function buildCheapestProfileAgentDefinitions(opts) {
710
717
  ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
711
718
  },
712
719
  reviewer: {
713
- description: pinnedReviewerDescription(false, false, true),
714
- prompt: pinnedReviewerPrompt(semanticAvailable, { is200K: true }),
720
+ description: pinnedReviewerDescription(false, false, true, true),
721
+ prompt: pinnedReviewerPrompt(semanticAvailable, {
722
+ is200K: true,
723
+ protegeAdvisor: true
724
+ }),
715
725
  model: reviewerModel,
716
726
  effort: effort("reviewer"),
717
727
  tools: readSearchTools,
@@ -3204,10 +3214,10 @@ function joinClauses(parts) {
3204
3214
  function buildNativeReachClauses(opts) {
3205
3215
  if (opts.profile === "fast" || opts.profile === "cheap" || opts.profile === "cheap1m" || opts.profile === "cheapest" || opts.profile === "balanced") {
3206
3216
  if (opts.profile === "cheapest") return joinClauses([
3207
- "`Explore` for broad repository discovery, dependency mapping, and convention tracking",
3208
- "`General-Purpose` for mixed, iterative, or multi-step execution tasks",
3209
- "`reviewer` for independent adversarial verification, reproduction, and root-causing"
3210
- ]) + ". All roles run at a 200K context window — prefer targeted reads (search, Grep, Read specific files) over full file reads";
3217
+ "`Explore` (Luna/high, cheap breadth) for discovery, dependency mapping, and convention tracking spanning more than a couple of files",
3218
+ "`General-Purpose` (Luna/max, the heavy execution tier) for mixed, iterative, or multi-step execution",
3219
+ "`reviewer` (Luna/max, the heavy verification tier) for independent adversarial verification, reproduction, and root-causing"
3220
+ ]) + ". Delegate by value — cheap breadth to `Explore`, heavy execution to `General-Purpose`, verification to `reviewer`. All roles run at a 200K context window — prefer targeted reads (search, Grep, Read specific files) over full file reads";
3211
3221
  if (opts.profile === "balanced") return joinClauses([
3212
3222
  "`Explore` for broad repository discovery, dependency mapping, and convention tracking (launch in parallel)",
3213
3223
  "`General-Purpose` for mixed, iterative, or multi-step execution tasks (delegate freely)",
@@ -3277,10 +3287,10 @@ ${profileLabel} profile runtime wiring is unavailable. Work directly, use only t
3277
3287
  const workerBrowseClause = opts.browseAvailable ? ` \`worker-browse\` runs delegated autonomous browsing tasks through \`mcp__${workersKey}__browse\`.` : "";
3278
3288
  const artifactClause = opts.artifactAvailable ? ` \`mcp__${peersKey}__artifact_*\` provides human review in the artifact panel with auto-open on plan completion.` : "";
3279
3289
  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).` : "";
3280
- const pipeline = 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; `General-Purpose` for mixed multi-step execution; `reviewer` for behavior-changing or risk-sensitive changes. In plan mode, produce the plan and acceptance criteria directly and do not edit files; before presenting the final plan to the user, consult `advisor` once for a framing check — it is non-binding counsel and you retain decision ownership. Delegation graph: the lead may invoke all three; `General-Purpose` may invoke `reviewer`; `Explore`, `reviewer`, and `worker-browse` cannot invoke native subagents.\n\n" : isBalanced ? `${profileLabel} launch profile. The lead coordinates execution across specialized native roles: ` + buildNativeReachClauses(opts) + ". Lead owns planning, implementation, and verification by default: in plan mode, produce the plan and acceptance criteria directly and do not edit files. Phase pipeline (budget gather, budget execution, expensive verification). GATHER: narrow scope first with `code_search` (lexical, then semantic when available) and `web` search to rule out hypotheses — cheapest, always first. Delegate to `Explore` only when search is insufficient: 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: lead owns planning: sequence interfaces, invariants, and acceptance criteria directly. EXECUTE: lead implements directly by default. Delegate to `General-Purpose` FREELY for multi-step work combining investigation, tool workflows, and code changes; brief with outcome, constraints, files in scope, and verification. VERIFY: lead owns verification: run relevant build/tests, read the code, and reproduce before declaring done. Invoke `reviewer` ONLY when the change is genuinely behavior-changing, cross-boundary, or risk-sensitive; `reviewer` narrows scope with search first and may invoke `Explore` for targeted discovery. 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 three; `General-Purpose` may invoke `reviewer`; `reviewer` may invoke `Explore` for targeted discovery; `Explore` 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";
3290
+ const pipeline = 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; `General-Purpose` for mixed multi-step execution; `reviewer` for behavior-changing or risk-sensitive changes. In plan mode, produce the plan and acceptance criteria directly and do not edit files; before presenting the final plan to the user, consult `advisor` once for a framing check. Work to your strengths as a fast, cost-efficient model: verify by execution rather than memory; before a non-trivial task, write a short plan (steps, files involved, the check settling each step) and execute it; persist through tool failures with a rephrased attempt before asking the user; stop searching when further results stop changing the answer; tag claims verified, inferred, or unverified — never state that something passes, compiles, or is covered without observed output. Delegation graph: the lead may invoke all three; `General-Purpose` may invoke `reviewer`; `Explore`, `reviewer`, and `worker-browse` cannot invoke native subagents.\n\nConsulting `advisor` and `oracle` (a small budget — choose wisely): you have roughly 8-10 advisor calls for this session, and each costs real time and money, so spend them only where direction changes the outcome. Advisor and Oracle give you COUNSEL on HOW — and sometimes WHAT — to do: the shortest path, what to consider or look at, planning, strategy, and direction. They never replace evidence you can gather yourself: anything a search, read, build, test, or run can settle, settle it yourself — never spend a consult on it. Spend a consult on: (1) a pre-commit framing check, after you have oriented but before you lock an approach on a non-trivial task; (2) an unresolvable judgment call — conflicting evidence, or a stale-knowledge / high-consequence risk or severity call; (3) a pre-presentation framing check on the final plan. Do NOT spend one on routine progress, reassurance, completion ritual, or a moment that belongs to `reviewer` (verify/reproduce a change) or `oracle` (a self-contained technical/algorithmic/spec/architectural trade-off). Discriminator: session-trajectory / framing / momentum questions and how-to-approach go to `advisor`; self-contained technical/architectural trade-offs go to `oracle`; verification and reproduction go to `reviewer`; facts go to direct evidence. How to call: Sol reads a curated view of this session — the user's original ask, your most recent message text, and a bounded transcript that keeps your reasoning but truncates raw tool output — so before you call, write a short self-contained brief as your own message: the objective, your current job, what you verified / suspect is missing / ruled irrelevant, your confidence and what being wrong would cost, and one neutral question phrased with any competing hypotheses. Never paste raw tool output or ask it to \"review the whole thing\". State your confidence after you have committed to a position, not before, and weigh the reply against verified repository evidence — counsel is direction, not dictation, and you own the decision.\n\n" : isBalanced ? `${profileLabel} launch profile. The lead coordinates execution across specialized native roles: ` + buildNativeReachClauses(opts) + ". Lead owns planning, implementation, and verification by default: in plan mode, produce the plan and acceptance criteria directly and do not edit files. Phase pipeline (budget gather, budget execution, expensive verification). GATHER: narrow scope first with `code_search` (lexical, then semantic when available) and `web` search to rule out hypotheses — cheapest, always first. Delegate to `Explore` only when search is insufficient: 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: lead owns planning: sequence interfaces, invariants, and acceptance criteria directly. EXECUTE: lead implements directly by default. Delegate to `General-Purpose` FREELY for multi-step work combining investigation, tool workflows, and code changes; brief with outcome, constraints, files in scope, and verification. VERIFY: lead owns verification: run relevant build/tests, read the code, and reproduce before declaring done. Invoke `reviewer` ONLY when the change is genuinely behavior-changing, cross-boundary, or risk-sensitive; `reviewer` narrows scope with search first and may invoke `Explore` for targeted discovery. 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 three; `General-Purpose` may invoke `reviewer`; `reviewer` may invoke `Explore` for targeted discovery; `Explore` 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";
3281
3291
  const windowNote = isCheapest || isBalanced ? "All roles run at a 200K context window — use targeted reads (search, Grep, Read specific files) over full file reads.\n\n" : isCheap ? "The lead runs at a 200K context window on `-m cheap` (1M on `-m cheap1m`) and every subagent runs at 200K — use targeted reads (search, Grep, Read specific files) over full file reads.\n\n" : "";
3282
3292
  const swePipelineClause = opts.sweEnabled === false ? "" : `${isCheapest || isBalanced ? PIPELINE_SKILLS_AWARENESS_NO_PLAN_AGENT : PIPELINE_SKILLS_AWARENESS}\n\n`;
3283
- const consultation = isBalanced ? `Consultation guidance: funnel unknowns cheapest-first. (1) \`code_search\` and \`web\` search narrow scope and rule out hypotheses — always first. (2) \`Explore\` subagents for targeted breadth only when search is insufficient. \`mcp__${peersKey}__oracle\` is ${oracleDescriptor}, a second opinion for precise, self-contained architectural/spec trade-offs that search and \`Explore\` cannot settle; available to the lead; \`reviewer\` and other subagents cannot call Oracle. Optimize for accuracy, intelligence, and correctness at the lowest cost — prefer direct evidence over delegation when the question is narrow. ` : `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 ${isCheapest || isBalanced ? "available to the lead" : "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.${isCheapest ? "" : " `Plan` may consult Oracle on unresolved trade-offs, and reports any remaining tie-breaking gap to the lead."}${astraClause} `;
3293
+ const consultation = isBalanced ? `Consultation guidance: funnel unknowns cheapest-first. (1) \`code_search\` and \`web\` search narrow scope and rule out hypotheses — always first. (2) \`Explore\` subagents for targeted breadth only when search is insufficient. \`mcp__${peersKey}__oracle\` is ${oracleDescriptor}, a second opinion for precise, self-contained architectural/spec trade-offs that search and \`Explore\` cannot settle; available to the lead; \`reviewer\` and other subagents cannot call Oracle. Optimize for accuracy, intelligence, and correctness at the lowest cost — prefer direct evidence over delegation when the question is narrow. ` : `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 ${isCheapest || isBalanced ? "available to the lead" : "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. Discriminator: transcript-aware trajectory/framing/momentum → advisor; a self-contained technical/architectural trade-off → Oracle.${isCheapest ? "" : " `Plan` may consult Oracle on unresolved trade-offs, and reports any remaining tie-breaking gap to the lead."}${astraClause} `;
3284
3294
  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" + pipeline + windowNote + consultation + searchGuidance + `\`mcp__${searchKey}__web\` provides citable sources.${browserClause}${workerBrowseClause}${artifactClause}\n\n` + swePipelineClause + "Verify claims with concrete repository evidence and tests before declaring work done. User instructions outrank delegation triggers. Stop named teammates when finished.";
3285
3295
  }
3286
3296
  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.";
@@ -3302,8 +3312,10 @@ function buildOperatingDefaultsDigest(opts = {}) {
3302
3312
  const oracleDescriptor = isCheapest ? "(GPT-6 Sol 200K/high, lead-only)" : isBalanced ? "(Grok 4.6 200K/medium, lead-only)" : isCheap ? "(Grok 4.6 200K/medium, lead and Plan)" : "(Opus 5 1M/high, lead and Plan)";
3303
3313
  const advisorDescriptor = isCheapest ? "(Sol/medium, lead-only)" : "(Sol/high, lead-only)";
3304
3314
  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).` : ".";
3305
- const delegation = 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, \`General-Purpose\` for mixed multi-step execution, and \`reviewer\` for behavior-changing or risk-sensitive changes. In plan mode, produce the plan and acceptance criteria directly; before presenting the final plan to the user, consult \`advisor\` once for a framing check — non-binding counsel, you retain decision ownership. Handle trivial and surgical edits directly. Stop named teammates when finished.\n\n` : isBalanced ? `${profileLabel} launch profile. The lead owns planning, implementation, and verification by default: narrow scope first with \`code_search\` and \`web\` search to rule out hypotheses (cheapest, always first); delegate to \`Explore\` in parallel only when search is insufficient (read directly only files you will act on); delegate to \`General-Purpose\` FREELY for multi-step work combining investigation, tool workflows, and code changes; invoke \`reviewer\` ONLY when the change is genuinely behavior-changing, cross-boundary, or risk-sensitive (\`reviewer\` narrows scope with search first and may invoke \`Explore\` for targeted discovery); handle trivial and surgical edits directly. Send independent subagent calls in parallel within a single turn. 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`;
3306
- const consultationLadder = isBalanced ? "Verify claims against real evidence: run relevant commands and tests. Funnel unknowns cheapest-first: (1) `code_search` + `web` search narrow scope and rule out hypotheses first; (2) `Explore` for targeted breadth when search is insufficient; (3) `oracle` " + oracleDescriptor + " as a second opinion for precise, self-contained technical/architectural trade-offs that search and `Explore` cannot settle. Optimize for accuracy, intelligence, and correctness at the lowest cost." : "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;
3315
+ const delegation = 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, \`General-Purpose\` for mixed multi-step execution, and \`reviewer\` for behavior-changing or risk-sensitive changes. In plan mode, produce the plan and acceptance criteria directly; before presenting the final plan to the user, consult \`advisor\` once for a framing check. Plan briefly before non-trivial acts, verify by execution, tag unverified claims, and stop searching when results stop changing the answer. Handle trivial and surgical edits directly. Stop named teammates when finished.\n\nConsulting \`advisor\`/\`oracle\` (small budget, ~8-10 calls — choose wisely): use them for how/what — shortest path, what to consider, planning, strategy, direction — never for anything a search, read, or run settles, nor for routine progress, reassurance, or completion ritual; do not spend one where \`reviewer\` (verification) or \`oracle\` (a self-contained technical trade-off) owns the moment. Full how-to (when to spend, the call brief, the discriminator) is in your CLAUDE.md project instructions.
3316
+
3317
+ ` : isBalanced ? `${profileLabel} launch profile. The lead owns planning, implementation, and verification by default: narrow scope first with \`code_search\` and \`web\` search to rule out hypotheses (cheapest, always first); delegate to \`Explore\` in parallel only when search is insufficient (read directly only files you will act on); delegate to \`General-Purpose\` FREELY for multi-step work combining investigation, tool workflows, and code changes; invoke \`reviewer\` ONLY when the change is genuinely behavior-changing, cross-boundary, or risk-sensitive (\`reviewer\` narrows scope with search first and may invoke \`Explore\` for targeted discovery); handle trivial and surgical edits directly. Send independent subagent calls in parallel within a single turn. 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`;
3318
+ const consultationLadder = isBalanced ? "Verify claims against real evidence: run relevant commands and tests. Funnel unknowns cheapest-first: (1) `code_search` + `web` search narrow scope and rule out hypotheses first; (2) `Explore` for targeted breadth when search is insufficient; (3) `oracle` " + oracleDescriptor + " as a second opinion for precise, self-contained technical/architectural trade-offs that search and `Explore` cannot settle. Optimize for accuracy, intelligence, and correctness at the lowest cost." : "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 (session momentum/trajectory); (3) `oracle` " + oracleDescriptor + " for self-contained technical/architectural trade-offs" + astraStep;
3307
3319
  const digestWindowNote = isCheapest || isBalanced ? "All roles run at a 200K context window — use targeted reads over full file reads.\n\n" : isCheap ? "The lead runs at 200K on `-m cheap` (1M on `-m cheap1m`) and every subagent runs at 200K — use targeted reads over full file reads.\n\n" : "";
3308
3320
  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" + delegation + digestPipelineSentence + digestWindowNote + consultationLadder;
3309
3321
  }
@@ -3898,4 +3910,4 @@ async function injectAttributionSuppressionIntoSettingsFile(settingsPath) {
3898
3910
  //#endregion
3899
3911
  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, getInjectedSkills 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 };
3900
3912
 
3901
- //# sourceMappingURL=attribution-settings-50S3mk4N.js.map
3913
+ //# sourceMappingURL=attribution-settings-BgYkynRc.js.map