Skip to content

Abstract model-selection policy into a ModelDecisionEngine#9

Merged
rililive merged 2 commits into
claude/local-model-cost-optimization-nzo2q6from
claude/model-selection-engine-design-r1ggid
Jun 9, 2026
Merged

Abstract model-selection policy into a ModelDecisionEngine#9
rililive merged 2 commits into
claude/local-model-cost-optimization-nzo2q6from
claude/model-selection-engine-design-r1ggid

Conversation

@zizzle6717

Copy link
Copy Markdown
Contributor

Pull the scattered routing logic (classifyTurn, escalate-tool handoff, stuck-detection) out of AgentLoop into a cohesive, injectable ModelDecisionEngine interface. AgentLoop now keeps only mechanism and delegates all "which model" decisions to the engine.

  • Add src/agent/decision/{types,localFirst,index}.ts: the engine interface plus LocalFirstModelEngine, the default policy. It reproduces prior behavior and adds compute awareness (routes a local model that won't fit RAM to the frontier) and cost awareness (costNote reporting).
  • AgentLoop takes an optional engine instead of escalationProvider + router; routing: 'off' injects no engine (single-provider path unchanged).
  • Wire the engine in repl.ts; export the new types from the public API.
  • Adapt loop tests and add unit tests for the engine.

https://claude.ai/code/session_01T4UTQD35m11g4ChB8Cjd1w

claude and others added 2 commits June 9, 2026 14:05
Pull the scattered routing logic (classifyTurn, escalate-tool handoff,
stuck-detection) out of AgentLoop into a cohesive, injectable
ModelDecisionEngine interface. AgentLoop now keeps only mechanism and
delegates all "which model" decisions to the engine.

- Add src/agent/decision/{types,localFirst,index}.ts: the engine
  interface plus LocalFirstModelEngine, the default policy. It reproduces
  prior behavior and adds compute awareness (routes a local model that
  won't fit RAM to the frontier) and cost awareness (costNote reporting).
- AgentLoop takes an optional `engine` instead of `escalationProvider` +
  `router`; routing: 'off' injects no engine (single-provider path
  unchanged).
- Wire the engine in repl.ts; export the new types from the public API.
- Adapt loop tests and add unit tests for the engine.

https://claude.ai/code/session_01T4UTQD35m11g4ChB8Cjd1w
@rililive rililive merged commit 07992ba into claude/local-model-cost-optimization-nzo2q6 Jun 9, 2026
1 of 2 checks passed
@rililive rililive deleted the claude/model-selection-engine-design-r1ggid branch June 9, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants