instar 1.3.468 → 1.3.470

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 (104) hide show
  1. package/dist/commands/init.js +5 -0
  2. package/dist/commands/init.js.map +1 -1
  3. package/dist/commands/server.d.ts.map +1 -1
  4. package/dist/commands/server.js +76 -9
  5. package/dist/commands/server.js.map +1 -1
  6. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  7. package/dist/config/ConfigDefaults.js +40 -0
  8. package/dist/config/ConfigDefaults.js.map +1 -1
  9. package/dist/core/CartographerSweepEngine.d.ts +122 -0
  10. package/dist/core/CartographerSweepEngine.d.ts.map +1 -0
  11. package/dist/core/CartographerSweepEngine.js +454 -0
  12. package/dist/core/CartographerSweepEngine.js.map +1 -0
  13. package/dist/core/CartographerTree.d.ts +95 -0
  14. package/dist/core/CartographerTree.d.ts.map +1 -1
  15. package/dist/core/CartographerTree.js +147 -0
  16. package/dist/core/CartographerTree.js.map +1 -1
  17. package/dist/core/EscalationGovernor.d.ts +138 -0
  18. package/dist/core/EscalationGovernor.d.ts.map +1 -0
  19. package/dist/core/EscalationGovernor.js +308 -0
  20. package/dist/core/EscalationGovernor.js.map +1 -0
  21. package/dist/core/IntelligenceRouter.d.ts +7 -0
  22. package/dist/core/IntelligenceRouter.d.ts.map +1 -1
  23. package/dist/core/IntelligenceRouter.js +9 -0
  24. package/dist/core/IntelligenceRouter.js.map +1 -1
  25. package/dist/core/ModelSwapService.d.ts +116 -0
  26. package/dist/core/ModelSwapService.d.ts.map +1 -0
  27. package/dist/core/ModelSwapService.js +266 -0
  28. package/dist/core/ModelSwapService.js.map +1 -0
  29. package/dist/core/ModelTierEscalation.d.ts +128 -0
  30. package/dist/core/ModelTierEscalation.d.ts.map +1 -0
  31. package/dist/core/ModelTierEscalation.js +232 -0
  32. package/dist/core/ModelTierEscalation.js.map +1 -0
  33. package/dist/core/PostUpdateMigrator.d.ts +3 -1
  34. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  35. package/dist/core/PostUpdateMigrator.js +321 -1
  36. package/dist/core/PostUpdateMigrator.js.map +1 -1
  37. package/dist/core/SessionManager.d.ts +5 -0
  38. package/dist/core/SessionManager.d.ts.map +1 -1
  39. package/dist/core/SessionManager.js +9 -4
  40. package/dist/core/SessionManager.js.map +1 -1
  41. package/dist/core/cartographerSummary.d.ts +62 -0
  42. package/dist/core/cartographerSummary.d.ts.map +1 -0
  43. package/dist/core/cartographerSummary.js +0 -0
  44. package/dist/core/cartographerSummary.js.map +1 -0
  45. package/dist/core/componentCategories.d.ts.map +1 -1
  46. package/dist/core/componentCategories.js +7 -0
  47. package/dist/core/componentCategories.js.map +1 -1
  48. package/dist/core/types.d.ts +14 -0
  49. package/dist/core/types.d.ts.map +1 -1
  50. package/dist/core/types.js.map +1 -1
  51. package/dist/monitoring/BurnDetector.d.ts +10 -0
  52. package/dist/monitoring/BurnDetector.d.ts.map +1 -1
  53. package/dist/monitoring/BurnDetector.js +6 -0
  54. package/dist/monitoring/BurnDetector.js.map +1 -1
  55. package/dist/monitoring/CartographerSweepPoller.d.ts +61 -0
  56. package/dist/monitoring/CartographerSweepPoller.d.ts.map +1 -0
  57. package/dist/monitoring/CartographerSweepPoller.js +211 -0
  58. package/dist/monitoring/CartographerSweepPoller.js.map +1 -0
  59. package/dist/monitoring/GuardPostureTripwire.d.ts +3 -0
  60. package/dist/monitoring/GuardPostureTripwire.d.ts.map +1 -1
  61. package/dist/monitoring/GuardPostureTripwire.js +44 -0
  62. package/dist/monitoring/GuardPostureTripwire.js.map +1 -1
  63. package/dist/monitoring/HostPressureSampler.d.ts +21 -0
  64. package/dist/monitoring/HostPressureSampler.d.ts.map +1 -0
  65. package/dist/monitoring/HostPressureSampler.js +44 -0
  66. package/dist/monitoring/HostPressureSampler.js.map +1 -0
  67. package/dist/monitoring/TokenLedger.d.ts +7 -0
  68. package/dist/monitoring/TokenLedger.d.ts.map +1 -1
  69. package/dist/monitoring/TokenLedger.js +17 -0
  70. package/dist/monitoring/TokenLedger.js.map +1 -1
  71. package/dist/monitoring/UltraSessionCapMonitor.d.ts +61 -0
  72. package/dist/monitoring/UltraSessionCapMonitor.d.ts.map +1 -0
  73. package/dist/monitoring/UltraSessionCapMonitor.js +103 -0
  74. package/dist/monitoring/UltraSessionCapMonitor.js.map +1 -0
  75. package/dist/scaffold/templates.d.ts.map +1 -1
  76. package/dist/scaffold/templates.js +4 -0
  77. package/dist/scaffold/templates.js.map +1 -1
  78. package/dist/server/AgentServer.d.ts +2 -0
  79. package/dist/server/AgentServer.d.ts.map +1 -1
  80. package/dist/server/AgentServer.js +120 -1
  81. package/dist/server/AgentServer.js.map +1 -1
  82. package/dist/server/CapabilityIndex.d.ts.map +1 -1
  83. package/dist/server/CapabilityIndex.js +2 -1
  84. package/dist/server/CapabilityIndex.js.map +1 -1
  85. package/dist/server/routes.d.ts +5 -0
  86. package/dist/server/routes.d.ts.map +1 -1
  87. package/dist/server/routes.js +152 -7
  88. package/dist/server/routes.js.map +1 -1
  89. package/package.json +1 -1
  90. package/scripts/cartographer-freshness.mjs +209 -0
  91. package/scripts/lint-no-direct-destructive.js +6 -0
  92. package/src/data/builtin-manifest.json +83 -67
  93. package/src/scaffold/templates.ts +4 -0
  94. package/src/templates/hooks/model-tier-reconciler.js +137 -0
  95. package/src/templates/hooks/model-tier-skill-entry.sh +72 -0
  96. package/src/templates/hooks/settings-template.json +15 -0
  97. package/upgrades/1.3.469.md +71 -0
  98. package/upgrades/1.3.470.md +27 -0
  99. package/upgrades/session-mgmt-buildctx-race.eli16.md +9 -0
  100. package/upgrades/side-effects/cartographer-doc-freshness.md +112 -0
  101. package/upgrades/side-effects/model-tier-escalation.md +267 -0
  102. package/upgrades/side-effects/session-mgmt-buildctx-race.md +48 -0
  103. package/upgrades/side-effects/watchdog-launchctl-test-guard.md +84 -0
  104. package/upgrades/watchdog-launchctl-test-guard.eli16.md +9 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mod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dateMigrator {
668
668
  * Get the content of a named hook template.
669
669
  * Used by init.ts to share canonical hook content without duplication.
670
670
  */
671
- getHookContent(name: 'session-start' | 'mcp-health-autorefresh' | 'compaction-recovery' | 'external-operation-gate' | 'deferral-detector' | 'self-stop-guard' | 'slopcheck-guard' | 'post-action-reflection' | 'external-communication-guard' | 'scope-coherence-collector' | 'scope-coherence-checkpoint' | 'claim-intercept' | 'claim-intercept-response' | 'telegram-topic-context' | 'response-review' | 'stop-gate-router' | 'auto-approve-permissions' | 'skill-usage-telemetry' | 'build-stop-hook'): string;
671
+ getHookContent(name: 'session-start' | 'mcp-health-autorefresh' | 'compaction-recovery' | 'external-operation-gate' | 'deferral-detector' | 'self-stop-guard' | 'slopcheck-guard' | 'post-action-reflection' | 'external-communication-guard' | 'scope-coherence-collector' | 'scope-coherence-checkpoint' | 'claim-intercept' | 'claim-intercept-response' | 'telegram-topic-context' | 'response-review' | 'stop-gate-router' | 'auto-approve-permissions' | 'skill-usage-telemetry' | 'build-stop-hook' | 'model-tier-skill-entry' | 'model-tier-reconciler'): string;
672
672
  /** Public accessor for grounding-before-messaging hook content (used by init.ts) */
673
673
  getGroundingBeforeMessagingPublic(): string;
674
674
  /** Public accessor for convergence-check script content (used by init.ts) */
@@ -762,6 +762,8 @@ export declare class PostUpdateMigrator {
762
762
  private getStopGateRouterHook;
763
763
  private getClaimInterceptResponseHook;
764
764
  private getSkillUsageTelemetryHook;
765
+ private getModelTierSkillEntryHook;
766
+ private getModelTierReconcilerHook;
765
767
  private getBuildStopHook;
766
768
  private getAutoApprovePermissionsHook;
767
769
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PostUpdateMigrator.d.ts","sourceRoot":"","sources":["../../src/core/PostUpdateMigrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAwCH,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAyBjC,MAAM,WAAW,eAAe;I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,CAAC,MAAM,CAAC,CAgC1E;IAEH;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,8BAA8B;IAiHtC,OAAO,CAAC,uBAAuB;IAwD/B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,sBAAsB;IAwC9B,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,8BAA8B;IA6HtC,OAAO,CAAC,+BAA+B;IAuKvC,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,qBAAqB;IAqO7B,OAAO,CAAC,qBAAqB;IAwI7B,OAAO,CAAC,qBAAqB;IAyN7B,OAAO,CAAC,6BAA6B;IAkLrC,OAAO,CAAC,0BAA0B;IAiClC,OAAO,CAAC,0BAA0B;IA8ElC,OAAO,CAAC,0BAA0B;IA8IlC,OAAO,CAAC,gBAAgB;IAmJxB,OAAO,CAAC,6BAA6B;CAoCtC"}
@@ -1322,7 +1322,18 @@ export class PostUpdateMigrator {
1322
1322
  return;
1323
1323
  }
1324
1324
  // Reload only if plist changed (script-only changes don't need launchd touch).
1325
- if (plistChanged) {
1325
+ //
1326
+ // NEVER under a test harness: launchd is a MACHINE-GLOBAL registry that a
1327
+ // $HOME redirect does not scope. Before this guard, every darwin test that
1328
+ // ran migrate() with a redirected HOME booted out the REAL fleet watchdog
1329
+ // and bootstrapped one pointing at the test tmpdir — the RunAtLoad run then
1330
+ // wrote watchdog-launchd.{log,err} into the tmpdir mid-cleanup (the
1331
+ // worktree-spotlight-exclusion ENOTEMPTY flake, 2026-06-09), and after
1332
+ // cleanup the machine's watchdog service pointed at a DELETED plist (fleet
1333
+ // watchdog silently dead until the next real update). File writes above
1334
+ // stay active under tests (hermetic, HOME-scoped); only the launchd
1335
+ // mutation is skipped.
1336
+ if (plistChanged && !process.env.VITEST && process.env.NODE_ENV !== 'test') {
1326
1337
  const uid = process.getuid?.() ?? 501;
1327
1338
  try {
1328
1339
  execFileSync('launchctl', ['bootout', `gui/${uid}`, plistPath], { stdio: 'ignore' });
@@ -2226,6 +2237,23 @@ export class PostUpdateMigrator {
2226
2237
  catch (err) {
2227
2238
  result.errors.push(`skill-usage-telemetry.sh: ${err instanceof Error ? err.message : String(err)}`);
2228
2239
  }
2240
+ // Model-Tier Escalation §5.4 signal hooks (FABLE-MODEL-ESCALATION-SPEC
2241
+ // §10) — built-in instar/ hooks, ALWAYS overwritten on migration so no
2242
+ // agent can get stuck on a broken template.
2243
+ try {
2244
+ fs.writeFileSync(path.join(instarHooksDir, 'model-tier-skill-entry.sh'), this.getModelTierSkillEntryHook(), { mode: 0o755 });
2245
+ result.upgraded.push('hooks/instar/model-tier-skill-entry.sh (model-tier trigger signal)');
2246
+ }
2247
+ catch (err) {
2248
+ result.errors.push(`model-tier-skill-entry.sh: ${err instanceof Error ? err.message : String(err)}`);
2249
+ }
2250
+ try {
2251
+ fs.writeFileSync(path.join(instarHooksDir, 'model-tier-reconciler.js'), this.getModelTierReconcilerHook(), { mode: 0o755 });
2252
+ result.upgraded.push('hooks/instar/model-tier-reconciler.js (model-tier reconciler)');
2253
+ }
2254
+ catch (err) {
2255
+ result.errors.push(`model-tier-reconciler.js: ${err instanceof Error ? err.message : String(err)}`);
2256
+ }
2229
2257
  // Build stop hook — structural enforcement for /build pipeline.
2230
2258
  // Previously only installed once by init.ts, so existing agents that initialized
2231
2259
  // before it was added never received the file, yet settings.json references it
@@ -2838,6 +2866,14 @@ setTimeout(() => process.exit(0), 2000);
2838
2866
  patched = true;
2839
2867
  result.upgraded.push('CLAUDE.md: added Cartographer Doc-Tree section');
2840
2868
  }
2869
+ // Cartographer doc-freshness (spec #2) — the Tier-1 inline-refresh affordance.
2870
+ // Keyed on this spec's OWN marker ('Keep the map true') so it is independent of
2871
+ // spec #1's marker and idempotent (run twice → single block).
2872
+ if (!content.includes('Keep the map true')) {
2873
+ content += `\n### Cartographer Doc-Freshness — Keep the map true\n\nWhen the cartographer doc-tree + freshness sweep are enabled (\`cartographer.freshnessSweep.enabled\`), the map self-heals: a background sweep authors stale/never-authored node summaries on a LIGHT model routed OFF Claude (it never spends your Anthropic quota — it refuses to author rather than fall back to Claude), and a CI ratchet keeps aggregate freshness from backsliding.\n- **You can help keep it true:** when you finish editing a subsystem, refresh its node so the map reflects your change immediately — \`curl -X POST -H "Authorization: Bearer $AUTH" http://localhost:${port}/cartographer/node/refresh -H 'Content-Type: application/json' -d '{"path":"src/foo/Bar.ts","summary":"…"}'\` (503 unless the sweep is enabled; the summary must name a real symbol in the code).\n- **Freshness state:** \`GET /cartographer/health\` reports the fresh ratio + the un-authored/quarantined backlog. \`fresh\` means a summary is fingerprint-current, NOT verified-correct — always re-ground against the code.\n`;
2874
+ patched = true;
2875
+ result.upgraded.push('CLAUDE.md: added Cartographer Doc-Freshness section');
2876
+ }
2841
2877
  // Cross-Agent Communication Discipline (anti-confabulation) — codex-instar
2842
2878
  // audit Item 11. Existing agents need this section even if they were
2843
2879
  // initialized before it existed. The check uses a content-sniffing marker
@@ -2900,6 +2936,21 @@ Rule: I do not state that work landed inside another agent's state unless I have
2900
2936
  patched = true;
2901
2937
  result.upgraded.push('CLAUDE.md: added Threadline Conversation Coherence holder-view section');
2902
2938
  }
2939
+ // Model-Tier Escalation (FABLE-MODEL-ESCALATION-SPEC §10) — agent-facing
2940
+ // awareness in the proactive-trigger form, tagged EXPERIMENTAL per
2941
+ // maturity-honesty (dark on the fleet; never announced as a finished user
2942
+ // capability). Content MUST stay byte-identical to the generateClaudeMd()
2943
+ // section in src/scaffold/templates.ts — parity tests assert it.
2944
+ if (!content.includes('Model-Tier Escalation (EXPERIMENTAL')) {
2945
+ const modelTierSection = `
2946
+ **Model-Tier Escalation (EXPERIMENTAL — escalate the model for heavy work)** — A policy layer that can run my claude-code sessions on the ultra model (\`claude-fable-5\`) for the two heavy-work triggers — spec/project design (\`spec-converge\`) and implementation or long autonomous runs (\`build\`, \`autonomous\`, \`instar-dev\`) — and on the default tier (\`claude-opus-4-8\`) the rest of the time. EXPERIMENTAL and dark by default: \`models.tierEscalation\` in \`.instar/config.json\` ships \`enabled:false\` (and \`dryRun:true\`, which logs intended swaps without performing them). Frameworks with no escalated model configured (codex/gemini/pi) are never touched. Every escalation passes cost guards first (quota headroom, per-account concurrent-escalation cap, hourly budget, TTL + dwell hysteresis) and is audited.
2947
+ - Swap a session's tier (server-side authority — body carries a TIER ONLY, never a model id): \`curl -X POST -H "Authorization: Bearer $AUTH" http://localhost:${port}/sessions/SESSION_NAME/model-swap -H 'Content-Type: application/json' -d '{"tier":"escalated"}'\` (\`"default"\` to de-escalate). Refuses protected/non-idle sessions; honors enabled/dryRun; 202 = swap sent but unconfirmed.
2948
+ - Proactive: user asks "what model are you running?" / "why are you on Fable/Opus?" → \`GET /sessions\` reports each session's live \`model\`; name the trigger that escalated it (or say escalation is disabled/dry-run on this agent). User says "stop using the expensive model" → set \`models.tierEscalation.enabled:false\` and restart sessions to apply.
2949
+ `;
2950
+ content += '\n' + modelTierSection;
2951
+ patched = true;
2952
+ result.upgraded.push('CLAUDE.md: added Model-Tier Escalation awareness section');
2953
+ }
2903
2954
  // MTP Protocol — the two EXO 3.0 tests (refusal + endorsement) on ORG-INTENT.
2904
2955
  // Existing agents need to know the /intent/org/test-action endpoint + the
2905
2956
  // three-layer protocol exist. Content-sniffed on a distinctive marker.
@@ -4847,6 +4898,12 @@ Create worktrees for collaborator repos with \`instar worktree create <branch>\`
4847
4898
  // never learns the holder view will claim a thread held elsewhere
4848
4899
  // "doesn't exist" — the exact dishonesty P3 kills.
4849
4900
  '**Threadline Conversation Coherence (which machine holds each agent-to-agent thread)**',
4901
+ // Model-Tier Escalation (FABLE-MODEL-ESCALATION-SPEC §10): a Codex/
4902
+ // Gemini agent spawns claude-code sessions through the same spawn/swap
4903
+ // routes — without this awareness it would never escalate (or explain)
4904
+ // a heavy-work session's model tier. Mid-session swap remains
4905
+ // claude-code-only; other frameworks are honest no-ops.
4906
+ '**Model-Tier Escalation (EXPERIMENTAL — escalate the model for heavy work)**',
4850
4907
  // Session Boot Self-Knowledge (spec session-boot-self-knowledge): vault
4851
4908
  // secret NAMES + operational facts at boot. A Codex/Gemini agent that
4852
4909
  // never learns the facts writer + secret-get retrieval will re-ask the
@@ -5421,6 +5478,48 @@ Create worktrees for collaborator repos with \`instar worktree create <branch>\`
5421
5478
  result.upgraded.push('.claude/settings.json: added PostToolUse skill-usage-telemetry hook');
5422
5479
  }
5423
5480
  }
5481
+ // Model-Tier Escalation (FABLE-MODEL-ESCALATION-SPEC §10) — append-with-
5482
+ // dedup registration for the two §5.4 signal hooks. Idempotent: appends
5483
+ // only when missing, never reorders or removes.
5484
+ {
5485
+ const postToolUse = (hooks.PostToolUse || []);
5486
+ const hasSkillEntry = postToolUse.some(e => e.matcher === 'Skill' && e.hooks?.some(h => h.command?.includes('model-tier-skill-entry')));
5487
+ if (!hasSkillEntry) {
5488
+ const skillEntry = postToolUse.find(e => e.matcher === 'Skill');
5489
+ const hookDef = {
5490
+ type: 'command',
5491
+ command: 'bash ${CLAUDE_PROJECT_DIR}/.instar/hooks/instar/model-tier-skill-entry.sh',
5492
+ timeout: 3000,
5493
+ };
5494
+ if (skillEntry) {
5495
+ skillEntry.hooks = skillEntry.hooks ?? [];
5496
+ skillEntry.hooks.push(hookDef);
5497
+ }
5498
+ else {
5499
+ postToolUse.push({ matcher: 'Skill', hooks: [hookDef] });
5500
+ }
5501
+ hooks.PostToolUse = postToolUse;
5502
+ patched = true;
5503
+ result.upgraded.push('.claude/settings.json: added PostToolUse model-tier-skill-entry hook');
5504
+ }
5505
+ }
5506
+ {
5507
+ const userPromptSubmit = (hooks.UserPromptSubmit || []);
5508
+ const hasReconciler = userPromptSubmit.some(e => e.hooks?.some(h => h.command?.includes('model-tier-reconciler')));
5509
+ if (!hasReconciler) {
5510
+ userPromptSubmit.push({
5511
+ matcher: '',
5512
+ hooks: [{
5513
+ type: 'command',
5514
+ command: 'node ${CLAUDE_PROJECT_DIR}/.instar/hooks/instar/model-tier-reconciler.js',
5515
+ timeout: 5000,
5516
+ }],
5517
+ });
5518
+ hooks.UserPromptSubmit = userPromptSubmit;
5519
+ patched = true;
5520
+ result.upgraded.push('.claude/settings.json: added UserPromptSubmit model-tier-reconciler hook');
5521
+ }
5522
+ }
5424
5523
  // Migrate all hook paths from flat layout to instar/ subdirectory
5425
5524
  if (hooks.PostToolUse) {
5426
5525
  this.migrateSettingsHookPaths(hooks.PostToolUse, result);
@@ -6240,6 +6339,8 @@ Create worktrees for collaborator repos with \`instar worktree create <branch>\`
6240
6339
  case 'auto-approve-permissions': return this.getAutoApprovePermissionsHook();
6241
6340
  case 'skill-usage-telemetry': return this.getSkillUsageTelemetryHook();
6242
6341
  case 'build-stop-hook': return this.getBuildStopHook();
6342
+ case 'model-tier-skill-entry': return this.getModelTierSkillEntryHook();
6343
+ case 'model-tier-reconciler': return this.getModelTierReconcilerHook();
6243
6344
  }
6244
6345
  }
6245
6346
  /** Public accessor for grounding-before-messaging hook content (used by init.ts) */
@@ -9913,6 +10014,225 @@ SESSION_ID="\${INSTAR_SESSION_ID:-}"
9913
10014
 
9914
10015
  mkdir -p "$INSTAR_DIR"
9915
10016
  echo "{\\"timestamp\\":\\"$TIMESTAMP\\",\\"skill\\":\\"$SKILL_NAME\\",\\"args\\":\\"$SKILL_ARGS\\",\\"session_id\\":\\"$SESSION_ID\\",\\"output_length\\":$OUTPUT_LEN}" >> "$TELEMETRY_FILE"
10017
+ `;
10018
+ }
10019
+ getModelTierSkillEntryHook() {
10020
+ // Canonical source: src/templates/hooks/model-tier-skill-entry.sh
10021
+ // If you edit either, keep them byte-identical — tests assert equality.
10022
+ return `#!/bin/bash
10023
+ # Model-Tier Skill Entry — PostToolUse hook for the Skill tool.
10024
+ #
10025
+ # FABLE-MODEL-ESCALATION-SPEC §5.4: records that a trigger skill STARTED by
10026
+ # writing the per-instance mode-state — ONLY on a tier transition (§6
10027
+ # write-on-transition; never on every PostToolUse). This is a SIGNAL writer:
10028
+ # it never swaps anything and never carries a model id; the reconciler +
10029
+ # server-side swap service (the single authority) decide what happens.
10030
+ #
10031
+ # Instance key: INSTAR_SESSION_ID — the spawn-generated session id. A
10032
+ # resume/respawn gets a fresh id, so a predecessor's mode-state can never be
10033
+ # inherited (§5.5). Fail-closed: any missing input exits 0 silently.
10034
+
10035
+ INPUT=$(cat)
10036
+
10037
+ TOOL_NAME=$(echo "$INPUT" | python3 -c "import json,sys; print(json.load(sys.stdin).get('tool_name',''))" 2>/dev/null)
10038
+ if [ "$TOOL_NAME" != "Skill" ]; then
10039
+ exit 0
10040
+ fi
10041
+
10042
+ if [ -z "\${INSTAR_SESSION_ID:-}" ]; then
10043
+ exit 0
10044
+ fi
10045
+
10046
+ INSTAR_DIR="\${CLAUDE_PROJECT_DIR:-.}/.instar"
10047
+ CONFIG_FILE="$INSTAR_DIR/config.json"
10048
+ if [ ! -f "$CONFIG_FILE" ]; then
10049
+ exit 0
10050
+ fi
10051
+
10052
+ SKILL_NAME=$(echo "$INPUT" | python3 -c "import json,sys; print(json.load(sys.stdin).get('tool_input',{}).get('skill',''))" 2>/dev/null)
10053
+ if [ -z "$SKILL_NAME" ]; then
10054
+ exit 0
10055
+ fi
10056
+
10057
+ MODE_FILE="$INSTAR_DIR/state/model-tier-escalation/mode-state-\${INSTAR_SESSION_ID}.json"
10058
+
10059
+ python3 - "$CONFIG_FILE" "$SKILL_NAME" "$MODE_FILE" "\${INSTAR_SESSION_ID}" "\${INSTAR_SESSION_NAME:-}" <<'PYEOF' 2>/dev/null
10060
+ import json, os, sys, datetime
10061
+ config_file, skill, mode_file, instance_id, session_name = sys.argv[1:6]
10062
+ try:
10063
+ cfg = json.load(open(config_file))
10064
+ except Exception:
10065
+ sys.exit(0)
10066
+ te = ((cfg.get('models') or {}).get('tierEscalation') or {})
10067
+ if te.get('enabled') is not True:
10068
+ sys.exit(0)
10069
+ triggers = ((te.get('triggers') or {}).get('skills')) or ['build', 'autonomous', 'instar-dev', 'spec-converge']
10070
+ if skill not in triggers:
10071
+ sys.exit(0)
10072
+ # Write-on-transition only (spec section 6): an existing same-instance
10073
+ # escalated mode-state means no transition - never rewrite (no churn).
10074
+ try:
10075
+ existing = json.load(open(mode_file))
10076
+ if existing.get('instanceId') == instance_id and existing.get('tier') == 'escalated':
10077
+ sys.exit(0)
10078
+ except Exception:
10079
+ pass
10080
+ os.makedirs(os.path.dirname(mode_file), exist_ok=True)
10081
+ state = {
10082
+ 'tier': 'escalated',
10083
+ 'trigger': skill,
10084
+ 'since': datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ'),
10085
+ 'instanceId': instance_id,
10086
+ 'sessionName': session_name,
10087
+ }
10088
+ tmp = mode_file + '.tmp'
10089
+ with open(tmp, 'w') as f:
10090
+ json.dump(state, f)
10091
+ os.replace(tmp, mode_file)
10092
+ PYEOF
10093
+ exit 0
10094
+ `;
10095
+ }
10096
+ getModelTierReconcilerHook() {
10097
+ // Canonical source: src/templates/hooks/model-tier-reconciler.js
10098
+ // If you edit either, keep them byte-identical — tests assert equality.
10099
+ return `#!/usr/bin/env node
10100
+ // Model-Tier Reconciler — UserPromptSubmit hook.
10101
+ //
10102
+ // FABLE-MODEL-ESCALATION-SPEC sections 5.3(1)/5.4/5.5/6: computes the desired
10103
+ // tier from durable signals and, ONLY on a transition, asks the server-side
10104
+ // swap endpoint to act. It never performs a swap itself, never blocks the
10105
+ // turn, and emits no prompt context. The common path is PURE FILESYSTEM with
10106
+ // an early-exit no-op when desired == last-applied (no HTTP, no tmux).
10107
+ // Fail-closed: anything missing or unparseable exits 0 and the session stays
10108
+ // on its default model.
10109
+ //
10110
+ // NOTE: dynamic import('node:...') so this works under both CJS and ESM
10111
+ // hosts (the hook-event-reporter lesson).
10112
+
10113
+ const sid = process.env.INSTAR_SESSION_ID || '';
10114
+ const sessionName = process.env.INSTAR_SESSION_NAME || '';
10115
+ const serverUrl = process.env.INSTAR_SERVER_URL || '';
10116
+ const authToken = process.env.INSTAR_AUTH_TOKEN || '';
10117
+ if (!sid || !sessionName || !serverUrl || !authToken) process.exit(0);
10118
+
10119
+ (async () => {
10120
+ const fs = await import('node:fs');
10121
+ const path = await import('node:path');
10122
+ const projectDir = process.env.CLAUDE_PROJECT_DIR || '.';
10123
+ const instarDir = path.join(projectDir, '.instar');
10124
+ const stateDir = path.join(instarDir, 'state', 'model-tier-escalation');
10125
+ const modeFile = path.join(stateDir, 'mode-state-' + sid + '.json');
10126
+ const markerFile = path.join(stateDir, 'last-applied-' + sid + '.json');
10127
+
10128
+ const readJson = (p) => {
10129
+ try { return JSON.parse(fs.readFileSync(p, 'utf-8')); } catch { return null; }
10130
+ };
10131
+
10132
+ const cfgAll = readJson(path.join(instarDir, 'config.json'));
10133
+ const te = (cfgAll && cfgAll.models && cfgAll.models.tierEscalation) || null;
10134
+ if (!te || te.enabled !== true) process.exit(0);
10135
+ const guards = te.costGuards || {};
10136
+ const ttlMs = typeof guards.maxEscalationTtlMs === 'number' ? guards.maxEscalationTtlMs : 21600000;
10137
+ const dwellMs = typeof guards.minTierDwellMs === 'number' ? guards.minTierDwellMs : 300000;
10138
+ const dwellTurns = typeof guards.minTierDwellTurns === 'number' ? guards.minTierDwellTurns : 1;
10139
+
10140
+ // Desired tier — re-derived LIVE each turn from the durable signal (never
10141
+ // a persisted "escalated" flag that must be cleared). The mode-state is
10142
+ // self-expiring on read (spec 5.5): past TTL it is QUARANTINED (renamed),
10143
+ // so re-escalation needs a FRESH trigger, not a clock reset.
10144
+ let desired = 'default';
10145
+ const mode = readJson(modeFile);
10146
+ if (mode && mode.instanceId === sid && mode.tier === 'escalated') {
10147
+ const since = Date.parse(mode.since || '');
10148
+ if (Number.isFinite(since) && Date.now() - since < ttlMs) {
10149
+ desired = 'escalated';
10150
+ } else {
10151
+ try { fs.renameSync(modeFile, modeFile + '.expired'); } catch { /* already gone */ }
10152
+ // One audit breadcrumb — a TTL firing means the primary path failed.
10153
+ try {
10154
+ fs.mkdirSync(stateDir, { recursive: true });
10155
+ fs.appendFileSync(
10156
+ path.join(stateDir, 'audit.jsonl'),
10157
+ JSON.stringify({ ts: new Date().toISOString(), source: 'reconciler', type: 'ttl-expired', instanceId: sid }) + '\\n',
10158
+ );
10159
+ } catch { /* best-effort */ }
10160
+ }
10161
+ }
10162
+
10163
+ const marker = readJson(markerFile) || { tier: 'default', at: 0, turnsClear: 0 };
10164
+
10165
+ // FAST PATH (spec section 6): desired == last applied. Pure read, zero
10166
+ // writes, no HTTP. (A stale turnsClear can survive an interrupted
10167
+ // de-escalation streak; worst case is a de-escalation one turn early,
10168
+ // still bounded by dwellMs here AND by the server-side dwell backstop.)
10169
+ if (marker.tier === desired) process.exit(0);
10170
+
10171
+ const writeMarker = (m) => {
10172
+ try {
10173
+ fs.mkdirSync(stateDir, { recursive: true });
10174
+ const tmp = markerFile + '.tmp';
10175
+ fs.writeFileSync(tmp, JSON.stringify(m));
10176
+ fs.renameSync(tmp, markerFile);
10177
+ } catch { /* a lost marker only costs one redundant no-op POST */ }
10178
+ };
10179
+
10180
+ // Asymmetric hysteresis (spec 5.5): escalate immediately; de-escalate only
10181
+ // after the condition has been clear for dwellTurns consecutive turns AND
10182
+ // dwellMs since the last swap. Suppressed flaps leave the marker counting.
10183
+ if (desired === 'default') {
10184
+ const turnsClear = (marker.turnsClear || 0) + 1;
10185
+ if (turnsClear < dwellTurns || (marker.at && Date.now() - marker.at < dwellMs)) {
10186
+ writeMarker({ ...marker, turnsClear });
10187
+ process.exit(0);
10188
+ }
10189
+ }
10190
+
10191
+ // Stable-refusal cooldown: 'disabled' / 'launch-time-only-framework' can't
10192
+ // change turn-to-turn — don't hammer the endpoint for 10 minutes.
10193
+ if (
10194
+ marker.refusedReason &&
10195
+ marker.refusedDesired === desired &&
10196
+ Date.now() - (marker.refusedAt || 0) < 600000
10197
+ ) {
10198
+ process.exit(0);
10199
+ }
10200
+
10201
+ // TRANSITION: ask the server — the single swap authority. Bounded (4s);
10202
+ // any failure leaves the marker untouched, so the next idle boundary
10203
+ // retries. The reconciler reconciles against the OBSERVED outcome
10204
+ // ('swapped' = canary-confirmed), never its own write-intent.
10205
+ try {
10206
+ const controller = new AbortController();
10207
+ const timer = setTimeout(() => controller.abort(), 4000);
10208
+ const res = await fetch(
10209
+ serverUrl + '/sessions/' + encodeURIComponent(sessionName) + '/model-swap',
10210
+ {
10211
+ method: 'POST',
10212
+ headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + authToken },
10213
+ body: JSON.stringify({ tier: desired }),
10214
+ signal: controller.signal,
10215
+ },
10216
+ );
10217
+ clearTimeout(timer);
10218
+ const body = await res.json().catch(() => ({}));
10219
+ const status = body && body.status;
10220
+ if (status === 'swapped' || status === 'dry-run' || status === 'noop') {
10221
+ // 'swapped': independent oracle confirmed. 'dry-run'/'noop': nothing
10222
+ // will change for this tier — marking prevents per-turn re-POSTs while
10223
+ // keeping exactly one audit line per transition.
10224
+ writeMarker({ tier: desired, at: Date.now(), turnsClear: 0 });
10225
+ } else if (
10226
+ status === 'refused' &&
10227
+ (body.reason === 'disabled' || body.reason === 'launch-time-only-framework')
10228
+ ) {
10229
+ writeMarker({ ...marker, refusedReason: body.reason, refusedDesired: desired, refusedAt: Date.now() });
10230
+ }
10231
+ // 'unconfirmed' and transient refusals (not-idle / dwell / cost-guard):
10232
+ // do NOT mark reconciled (spec 5.3) — behaviourally default; retry later.
10233
+ } catch { /* never blocks the turn */ }
10234
+ process.exit(0);
10235
+ })();
9916
10236
  `;
9917
10237
  }
9918
10238
  getBuildStopHook() {