Summary
src/agents/model-selection.ts (170 LOC) has live H9-attested functions but should be gutted per the Middleware Boundary Principle: model selection is owned by CLI runtimes (Claude, Gemini, Codex, OpenCode), not by RemoteClaw middleware.
Evidence
- File header:
// Gutted in RemoteClaw fork (Middleware Boundary Principle) — gutting intent declared
- File body: Full implementations of
resolveConfiguredModelRef, resolveDefaultModelForAgent, buildModelAliasIndex, resolveModelRefFromString (functional, not stubs)
- H9 attestations:
MODULE_ATTESTATIONS declares these as "live" — matching reality
- Zombie-import gate (post-H3): flags 13 callsites across
src/auto-reply/, src/commands/, src/config/, src/cron/, src/gateway/, src/telegram/
Live callsites (13 tracked in #2355 allowlist)
src/auto-reply/reply/agent-runner.ts:5
src/auto-reply/reply/directive-handling.model-picker.ts:1
src/auto-reply/reply/directive-handling.ts:9
src/commands/agent.test.ts:6
src/commands/agent/session-store.ts:4
src/commands/status.summary.ts:3
src/config/defaults.ts:2
src/cron/isolated-agent/run.test-harness.ts:71
src/gateway/gateway-cli-backend.live.test.ts:7
src/gateway/server-methods/chat.ts:4
src/gateway/session-utils.ts:16
src/telegram/sticker-cache.ts:4
src/plugin-sdk/mattermost.ts (verify)
Gutting plan
- For each caller: migrate to CLI-runtime model resolution OR eliminate the model reference entirely
- Once all 13 callers are migrated: delete
src/agents/model-selection.ts (and re-export file src/agents/provider-utils.ts if appropriate)
- Remove
"agents/model-selection" from fallbackDeadModulePatterns in scripts/check-no-zombie-imports.mjs
- Remove 13 entries from
scripts/data/zombie-import-allowlist.json
- Decrement
.zombie-import-allowlist-baseline by 13
Context
Discovered during #2355 (H3 gate restoration). The broad agents/model-selection gate pattern was KEPT despite the file having live code, precisely because the functions are tracked-for-gutting — the allowlist is the explicit reminder to gut this file.
Acceptance criteria
References
Summary
src/agents/model-selection.ts(170 LOC) has live H9-attested functions but should be gutted per the Middleware Boundary Principle: model selection is owned by CLI runtimes (Claude, Gemini, Codex, OpenCode), not by RemoteClaw middleware.Evidence
// Gutted in RemoteClaw fork (Middleware Boundary Principle)— gutting intent declaredresolveConfiguredModelRef,resolveDefaultModelForAgent,buildModelAliasIndex,resolveModelRefFromString(functional, not stubs)MODULE_ATTESTATIONSdeclares these as"live"— matching realitysrc/auto-reply/,src/commands/,src/config/,src/cron/,src/gateway/,src/telegram/Live callsites (13 tracked in #2355 allowlist)
Gutting plan
src/agents/model-selection.ts(and re-export filesrc/agents/provider-utils.tsif appropriate)"agents/model-selection"fromfallbackDeadModulePatternsinscripts/check-no-zombie-imports.mjsscripts/data/zombie-import-allowlist.json.zombie-import-allowlist-baselineby 13Context
Discovered during #2355 (H3 gate restoration). The broad
agents/model-selectiongate pattern was KEPT despite the file having live code, precisely because the functions are tracked-for-gutting — the allowlist is the explicit reminder to gut this file.Acceptance criteria
src/agents/model-selection.tsdeletedagents/model-selectionremoved from fallback patternsReferences
product/strategy.md(HQ-internal)src/agents/model-selection.ts§MODULE_ATTESTATIONS