Cut
Drop four npm dependencies and collapse the OpenRouter provider into the generic OpenAI-compatible route.
Findings
- native:
@anthropic-ai/sdk has one runtime import (src/_core/llm/providers/anthropic.ts:9, two messages.create calls); the other three tiers already speak the same request shape over fetch. Replace with a fetch POST to https://api.anthropic.com/v1/messages (headers x-api-key, anthropic-version), keep the tool-use response shape the extractors parse, and turn the three import type Anthropic sites into a local type. Removes the dependency and its tree.
- native:
graphology-components, graphology-shortest-path, graphology-traversal are in package.json but imported nowhere (rg graphology hits only src/graph/analyzer.ts, which uses graphology, graphology-communities-louvain and graphology-metrics). Remove the three.
- yagni:
src/_core/llm/providers/openrouter.ts:36 is one OpenAIRoute literal plus four wrappers that duplicate openai-compatible.ts verbatim, differing only in the tier string. Make the generic wrappers take a route and register OpenRouter as a route constant (~90 lines).
Verification
npm run build and npm run test:run green before and after. npm ls shows no orphaned packages. engram doctor still reports the anthropic and openrouter tiers correctly with and without their keys set. The *-factory tests that stub fetch for the OpenRouter tier keep passing.
Cut
Drop four npm dependencies and collapse the OpenRouter provider into the generic OpenAI-compatible route.
Findings
@anthropic-ai/sdkhas one runtime import (src/_core/llm/providers/anthropic.ts:9, twomessages.createcalls); the other three tiers already speak the same request shape overfetch. Replace with afetchPOST tohttps://api.anthropic.com/v1/messages(headersx-api-key,anthropic-version), keep the tool-use response shape the extractors parse, and turn the threeimport type Anthropicsites into a local type. Removes the dependency and its tree.graphology-components,graphology-shortest-path,graphology-traversalare inpackage.jsonbut imported nowhere (rg graphologyhits onlysrc/graph/analyzer.ts, which usesgraphology,graphology-communities-louvainandgraphology-metrics). Remove the three.src/_core/llm/providers/openrouter.ts:36is oneOpenAIRouteliteral plus four wrappers that duplicateopenai-compatible.tsverbatim, differing only in the tier string. Make the generic wrappers take a route and register OpenRouter as a route constant (~90 lines).Verification
npm run buildandnpm run test:rungreen before and after.npm lsshows no orphaned packages.engram doctorstill reports the anthropic and openrouter tiers correctly with and without their keys set. The*-factorytests that stubfetchfor the OpenRouter tier keep passing.