Skip to content

[ponytail] Drop @anthropic-ai/sdk and three unused graphology packages; collapse openrouter into a route #118

Description

@devinmlowe

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.

Activity

  1. added
    sub-issueChild task of a parent issue
    ponytailOver-engineering audit cut (2026-09-20)
    on Sep 21, 2026
  2. devinmlowe commented on Sep 21, 2026

    @devinmlowe
    OwnerAuthor

    PR #130 (#130) on branch ponytail/deps. Tests before: 137 files / 1798 passed; after: 138 files / 1803 passed (new tests/core/llm-anthropic.test.ts, nothing removed). All three findings done, none skipped. Anthropic tier now honours ENGRAM_LLM_TIMEOUT_MS via AbortSignal.timeout (the SDK used its own 10-minute default); engram doctor reports the anthropic and openrouter tiers correctly with and without keys; npm ls shows no orphans from the four removals.

  3. added a commit that references this issue on Sep 21, 2026
  4. devinmlowe commented on Sep 21, 2026

    @devinmlowe
    OwnerAuthor

    Merged PR #130 into main with --no-ff (commit bedd734). Post-merge on main: npm install removed 9 packages, build clean, 134 test files / 1750 tests passing (was 133 / 1745; +5 from the new Anthropic wire-contract test). npm ls shows only graphology, graphology-communities-louvain and graphology-metrics remaining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ponytailOver-engineering audit cut (2026-09-20)sub-issueChild task of a parent issue

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions