agentleFS
adalineadaline/gateway/CLAUDE.md

gateway

CLAUDE.md608 starsChanged 8 months agoMITView on GitHub

Adaline Gateway is a production-grade unified SDK ("Super SDK") for calling 300+ LLMs through a single TypeScript interface. It is fully local (not a proxy), strongly typed, and isomorphic. It supports batching, retries, caching, callbacks, OpenTelemetry, and tool calling. Repository: https://github.com/adaline/gateway Per-package (run from package directory): When adding a new provider, follow existing providers (e.g., core/providers/openai/) as the template. Internal dependencies use workspace:* protocol. Commits follow conventional commits enforced by commitlint: - Format: type(scope): description - Types: feat, fix, chore,…

  • Installs packages

The file

We split this CLAUDE.md into the rules it gives an agent

8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every LLM provider follows the same structure under core/providers/<name>/:

    line 61
  2. Very specific:

    When adding a new provider, follow existing providers (e.g., core/providers/openai/) as the template.

    line 66
  3. Very specific:

    All types are defined as Zod schemas in packages/types/

    line 69
  4. Distinctive:

    Always export both the Zod schema and the inferred TypeScript type

    line 70
  5. Very specific:

    Never use any — use unknown with Zod validation at boundaries

    line 71
  6. Very specific:

    Use custom error classes extending GatewayError in core/gateway/src/errors/

    line 74
  7. Distinctive:

    Always provide meaningful error messages with provider context

    line 75
  8. Very specific:

    All packages use: { root: true, extends: ["adaline"] } in .eslintrc.js

    line 104

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md - Adaline Gateway

Project Overview

Adaline Gateway is a production-grade unified SDK ("Super SDK") for calling 300+ LLMs through a single TypeScript interface. It is fully local (not a proxy), strongly typed, and isomorphic. It supports batching, retries, caching, callbacks, OpenTelemetry, and tool calling.

Repository: https://github.com/adaline/gateway

Tech Stack

  • Language: TypeScript 5.6
  • Runtime: Node.js >=18
  • Package Manager: pnpm >=9 (strictly enforced — never use npm or yarn)
  • Build: tsup (ESM + CJS dual output)
  • Monorepo: Turborepo
  • Testing: Vitest
  • Linting: ESLint (extends eslint-config-adaline)
  • Formatting: Prettier (140 char width, double quotes, ES5 trailing commas)
  • Validation: Zod schemas for all runtime types
  • Git Hooks: Husky (pre-commit runs lint + test)
  • Releases: Changesets

Repository Structure

core/
  gateway/          — Main @adaline/gateway package (orchestrator, plugins, handlers)
  providers/        — 12 LLM provider implementations (openai, anthropic, google, etc.)
packages/
  types/            — @adaline/types — shared Zod schemas (Config, Message, Tool, Content)
  provider/         — @adaline/provider — base provider interface and abstract classes
tools/
  tsconfig/         — @adaline/tsconfig — shared TypeScript config
  eslint-config/    — eslint-config-adaline — shared ESLint config
  gateway-experiments/ — experimental tools

Common Commands

pnpm install              # Install all dependencies
pnpm run build            # Build all packages (turbo)
pnpm run test             # Run all tests (vitest)
pnpm run lint             # Lint all packages
pnpm run format           # Format with Prettier
pnpm run clean            # Remove node_modules, dist, .turbo
pnpm run dev              # Start dev mode (watch)

Per-package (run from package directory):

pnpm run test             # vitest run
pnpm run test:watch       # vitest watch
pnpm run build            # tsup
pnpm run lint             # eslint

Architecture & Patterns

Provider Pattern

Every LLM provider follows the same structure under core/providers/<name>/:

  • src/configs/ — model configuration objects
  • src/models/ — model schema definitions with Zod
  • src/provider/ — provider class implementing the base interface from @adaline/provider

When adding a new provider, follow existing providers (e.g., core/providers/openai/) as the template.

Type System

  • All types are defined as Zod schemas in packages/types/
  • Always export both the Zod schema and the inferred TypeScript type
  • Never use any — use unknown with Zod validation at boundaries

Error Handling

  • Use custom error classes extending GatewayError in core/gateway/src/errors/
  • Always provide meaningful error messages with provider context

Plugin System

The gateway supports plugins in core/gateway/src/plugins/:

  • Cache plugins (custom cache implementations)
  • Logger plugins (custom logging)
  • Telemetry (OpenTelemetry integration)

Build Output

Each package compiles via tsup to:

  • dist/index.js (CJS)
  • dist/index.mjs (ESM)
  • dist/index.d.ts (types)

Dependencies Between Packages

All providers → @adaline/types + @adaline/provider
@adaline/gateway → @adaline/types + @adaline/provider
All packages → @adaline/tsconfig (build config)

Internal dependencies use workspace:* protocol.

Code Style

  • Prettier: 140 char width, double quotes, 2-space indent, ES5 trailing commas, LF line endings
  • Import order (enforced by prettier plugin): third-party → @adaline/* → relative imports
  • ESLint: extends turbo + TypeScript + Prettier
  • All packages use: { root: true, extends: ["adaline"] } in .eslintrc.js

Commit Convention

Commits follow conventional commits enforced by commitlint:

  • Format: type(scope): description
  • Types: feat, fix, chore, docs, refactor, test, perf, ci, build, style, revert

Release Process

Releases are managed via Changesets + GitHub Actions:

  1. Create changeset: pnpm run changeset
  2. Version packages: pnpm run version
  3. Release is triggered manually via GitHub Actions workflow on main

Environment Variables

  • HTTP_PROXY, HTTPS_PROXY, NO_PROXY — proxy configuration
  • ADX_NODE_ENV — environment mode
  • ADX_ANALYTICS_ENABLED — analytics toggle
  • Provider-specific API keys are passed at runtime, not via env vars

Important Notes

  • This is an npm-distributed library, not a deployed service — no Docker
  • Pre-commit hooks run pnpm run lint and pnpm run test — ensure both pass
  • Turbo caches build outputs in dist/** — run pnpm run clean if you see stale artifacts
  • The .changeset/ directory manages release versioning — don't modify manually

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.