agentleFS
zaber-devzaber-dev/free-ai-gateway/AGENTS.md

free-ai-gateway

AGENTS.md16 starsChanged 4 months agoMITView on GitHub

Target Audience: AI Coding Assistants, Autonomous Agents, and Pair Programmers (Antigravity, Claude Code, Cursor, GitHub Copilot, Codex, Gemini). This repository is organized as an Enterprise TypeScript Monorepo using npm workspaces. Every agent working in this codebase MUST respect the strict architectural separation between layers: When an agent is tasked with adding a new provider adapter: 1. Create a new provider adapter in packages/core/src/providers/<provider-id>.ts extending BaseProvider. 2. Add the provider schema definition to packages/core/src/config/providers.json adhering to providers.schema.json. 3. Export the class…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,117 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository4 other files it gives its agents.

The file

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

7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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:

    All capabilities must use standardized lowercase snake_case tokens (text, code, reasoning, tool_calling, structured_output, vision, …

    line 45
  2. Distinctive:

    When an agent is tasked with adding a new provider adapter:

    line 79
  3. Very specific:

    Create a new provider adapter in packages/core/src/providers/<provider-id>.ts extending BaseProvider.

    line 80
  4. Very specific:

    Add the provider schema definition to packages/core/src/config/providers.json adhering to providers.schema.json.

    line 81
  5. Very specific:

    Run npm test to verify automatic registry discovery and execution.

    line 83
  6. Very specific:

    Use Node.js native test runner: import { describe, it } from "node:test".

    line 89
  7. Very specific:

    Use Node.js native assertions: import assert from "node:assert/strict".

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.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
AGENTS.md

🤖 Free-AI Gateway - Agentic Development Guidelines

Target Audience: AI Coding Assistants, Autonomous Agents, and Pair Programmers (Antigravity, Claude Code, Cursor, GitHub Copilot, Codex, Gemini).


🏛️ Monorepo Architecture & Package Boundaries

This repository is organized as an Enterprise TypeScript Monorepo using npm workspaces. Every agent working in this codebase MUST respect the strict architectural separation between layers:

free-ai-gateway/ (Monorepo Root)
├── packages/
│   ├── core/       → @free-ai-gateway/core (Pure, protocol-neutral AI orchestration engine)
│   ├── mcp/        → @free-ai-gateway/mcp (Model Context Protocol server for AI agents)
│   ├── skills/     → @free-ai-gateway/skills (Agentic IDE skills & installer CLI)
│   └── cli/        → @free-ai-gateway/cli (Developer CLI & terminal AI assistant)
├── apps/
│   └── gateway/    → @free-ai-gateway/gateway (Fastify HTTP server with OpenAI-compatible API)
└── tests/
    └── e2e/        → Cross-package end-to-end integration tests

🛑 Strict Architectural Rules for Agents

  1. Core HTTP Boundary:
    • @free-ai-gateway/core MUST NEVER import or depend on HTTP server frameworks (e.g. Fastify, Express, Koa).
    • Core only contains client transport (HttpClient) for upstream provider communication.
  2. No Background Timers in Core:
    • Core must remain synchronous, deterministic, and pure.
    • Background workers (like JobScheduler and reverify.ts) belong exclusively to apps/gateway.
  3. Single Public Entrypoint Imports:
    • Downstream packages (packages/mcp, packages/skills, apps/gateway) MUST ONLY import from @free-ai-gateway/core public exports (packages/core/src/index.ts).
    • Deep imports into internal files (e.g. @free-ai-gateway/core/src/resilience/circuit-breaker) are strictly prohibited.
  4. Protocol-Neutral Representations:
    • Core works exclusively with UnifiedRequest and UnifiedResponse.
    • Protocol-specific adaptations (e.g., OpenAI chat completion format) happen in apps/gateway/src/adapters/openai.ts.
  5. Capability Naming Conventions:
    • All capabilities must use standardized lowercase snake_case tokens (text, code, reasoning, tool_calling, structured_output, vision, embedding, rerank, speech_to_text, text_to_speech, translation, document_processing, web_search, content_moderation).

💻 Essential Developer Commands

# Build all packages across monorepo
npm run build

# Run TypeScript typechecks across all workspaces
npm run typecheck

# Run complete test suite (Core, MCP, Gateway, Skills, E2E)
npm test

# Start the Fastify HTTP Gateway in watch mode
npm run dev

# Run tests for a specific workspace
npm test --workspace=@free-ai-gateway/core
npm test --workspace=@free-ai-gateway/mcp
npm test --workspace=@free-ai-gateway/skills
npm test --workspace=@free-ai-gateway/cli
npm test --workspace=@free-ai-gateway/gateway

# Run single test file
npx tsx --test packages/core/tests/circuit-breaker.test.ts

🔌 How to Add a New Provider Adapter

When an agent is tasked with adding a new provider adapter:

  1. Create a new provider adapter in packages/core/src/providers/<provider-id>.ts extending BaseProvider.
  2. Add the provider schema definition to packages/core/src/config/providers.json adhering to providers.schema.json.
  3. Export the class in both packages/core/src/providers/index.ts and packages/core/src/index.ts.
  4. Run npm test to verify automatic registry discovery and execution.

🧪 Testing Standards

  • Use Node.js native test runner: import { describe, it } from "node:test";
  • Use Node.js native assertions: import assert from "node:assert/strict";
  • Execute with tsx --test.
  • Maintain 100% test pass rate on all pull requests.

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.