Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/adaline/gateway/maingit clone --depth 1 https://github.com/adaline/gatewayWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.03683 | $0.03683 |
| Opus 5 | $0.01842 | $0.01842 |
| Sonnet 5 | $0.00737 | $0.00737 |
| Haiku 4.5 | $0.00368 | $0.00368 |
Grade A, and why
main scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 558 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Adaline Gateway Repository - Main Rules
Repository Overview
This is a TypeScript-based AI gateway service that provides unified interfaces for multiple AI providers (OpenAI, Anthropic, Google, etc.) with features like caching, queuing, analytics, and telemetry.
Core Architecture Principles
1. Type Safety & Schema Validation
Rules
- ALWAYS use Zod schemas for runtime validation
- ALWAYS export both the schema and inferred types
- NEVER use
anytype - use proper generic constraints - ALWAYS validate input/output at runtime using schemas
Instructions
// ✅ CORRECT: Define schema first, then type
import { z } from 'zod';
const UserConfig = z.object({
apiKey: z.string().min(1),
model: z.string().min(1),
temperature: z.number().min(0).max(2).default(1.0),
});
type UserConfigType = z.infer<typeof UserConfig>;
// Export both schema and type
export { UserConfig, type UserConfigType };
// ❌ INCORRECT: Using any type
function processData(data: any): any {
return data; // Unsafe and loses type information
}
// ✅ CORRECT: Proper typing with validation
function processData(data: unknown): UserConfigType {
return UserConfig.parse(data); // Validates at runtime
}
Implementation Steps
- Install Zod:
npm install zod - Define Schema: Create Zod schema with proper constraints
- Infer Type: Use
z.infer<typeof SchemaName>for TypeScript types - Export Both: Export schema for runtime validation, type for compile-time checking
- Validate Input: Use
schema.parse()orschema.safeParse()for validation
2. Error Handling
Rules
- ALWAYS use custom error classes extending
GatewayError - ALWAYS provide meaningful error messages with context
- ALWAYS handle errors gracefully with proper logging
- NEVER let unhandled errors bubble up
Instructions
// ✅ CORRECT: Custom error class with context
import { GatewayError } from "./errors";
export class ProviderConnectionError extends GatewayError {
constructor(
message: string,
public readonly provider: string,
public readonly statusCode: number,
public readonly originalError?: Error
) {
super(`Failed to connect to ${provider}: ${message} (Status: ${statusCode})`, "PROVIDER_CONNECTION_ERROR");
}
}
// Usage in code
try {
await provider.makeRequest();
} catch (error) {
if (error instanceof HttpError) {
throw new ProviderConnectionError("API request failed", "anthropic", error.status, error);
}
throw error;
}
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 558 lines · 3,683 tokens per session scan A 7ce2d14e8b11
main is a cursor rule published in the GitHub repository adaline/gateway (605 stars, last pushed 1mo ago), licensed MIT. It adds 3,683 tokens to every session, about $0.0184 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
js-sdk-genai-framework-instrumentation
Guide for implementing JS SDK agent and framework instrumentations, such as LangChain, LangGraph, OpenAI Agents, Claude Agent SDK, Google ADK, and Vercel AI.
coding-agents-hook
Authoring and testing coding-agent hook adapters, including payload probing, session state, capture modes, and plugin manifests. Consult the telemetry convention when changing canonical attributes.
coding-agents-convention
Canonical coding-agent telemetry schema, inbound mappings, and data contracts. Applies to semantic conventions, emission, processing, and readers—not hook implementation mechanics.
security-testing
Authorization, input validation, CE boundary, secrets, and test guidance for OpenLIT server code.
documentation
Standards for OpenLIT documentation, MDX structure, navigation, examples, and terminology.
js-sdk-genai-instrumentation
Guide for aligning JS SDK GenAI provider instrumentations with OTel semantic conventions and the Python SDK reference implementation.