free-ai-gateway
AGENTS.md17 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 checking a change actually works.
Of the AGENTS.md files we read, the 11,638 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.
- CLAUDE.mdCLAUDE.md
- free-ai-gatewaySkill
- mcp-integrationSkill
- provider-scaffoldingSkill
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
- Very specific: line 45
All capabilities must use standardized lowercase snake_case tokens (text, code, reasoning, tool_calling, structured_output, vision, …
- Distinctive: line 79
When an agent is tasked with adding a new provider adapter:
- Very specific: line 80
Create a new provider adapter in packages/core/src/providers/<provider-id>.ts extending BaseProvider.
- Very specific: line 81
Add the provider schema definition to packages/core/src/config/providers.json adhering to providers.schema.json.
- Very specific: line 83
Run npm test to verify automatic registry discovery and execution.
- Very specific: line 89
Use Node.js native test runner: import { describe, it } from "node:test".
- Very specific: line 90
Use Node.js native assertions: import assert from "node:assert/strict".
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 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.
Files
🤖 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
- Core HTTP Boundary:
@free-ai-gateway/coreMUST NEVER import or depend on HTTP server frameworks (e.g. Fastify, Express, Koa).- Core only contains client transport (
HttpClient) for upstream provider communication.
- No Background Timers in Core:
- Core must remain synchronous, deterministic, and pure.
- Background workers (like
JobSchedulerandreverify.ts) belong exclusively toapps/gateway.
- Single Public Entrypoint Imports:
- Downstream packages (
packages/mcp,packages/skills,apps/gateway) MUST ONLY import from@free-ai-gateway/corepublic exports (packages/core/src/index.ts). - Deep imports into internal files (e.g.
@free-ai-gateway/core/src/resilience/circuit-breaker) are strictly prohibited.
- Downstream packages (
- Protocol-Neutral Representations:
- Core works exclusively with
UnifiedRequestandUnifiedResponse. - Protocol-specific adaptations (e.g., OpenAI chat completion format) happen in
apps/gateway/src/adapters/openai.ts.
- Core works exclusively with
- 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).
- All capabilities must use standardized lowercase snake_case tokens (
💻 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:
- Create a new provider adapter in
packages/core/src/providers/<provider-id>.tsextendingBaseProvider. - Add the provider schema definition to
packages/core/src/config/providers.jsonadhering toproviders.schema.json. - Export the class in both
packages/core/src/providers/index.tsandpackages/core/src/index.ts. - Run
npm testto 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.
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
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.

