agentleFS
OpenAIKnown publisheropenai/openai-node/AGENTS.md

openai-node

AGENTS.md11k starsChanged 3 months agoApache-2.0View on GitHub

Most SDK source is generated from the OpenAI API schema. Follow .github/CONTRIBUTING.md before changing generated files. Handwritten policy, automation, tests, and examples should remain small and should not alter exported SDK APIs unless the change explicitly requires it. - For externally observable bug or behavior fixes, reproduce the reported issue against the current repository and public SDK entrypoint before proposing a fix. Check existing issues and pull requests; inspect the API schema and generated/upstream ownership only when relevant. Do not…

  • Reads credentials
  • Installs packages

Trending

More talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 1 mentionFeb 2026: 2 mentionsMar 2026: 1 mentionApr 2026: 2 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 4 mentionsOct 2026: 3 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the openai/openai-node repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about openai/openai-node

The biggest 5 of 32 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 32

Talked about on GitHub, Bluesky and Hacker News (32 times).

On GitHub · 25

20 more on GitHub

On Bluesky · 6

1 more on Bluesky

On Hacker News · 1

  • 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,773 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.

The file

Show its rules and text

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

19 rules. About 2 are common, 10 are distinctive, and 7 are very specific to this project.

  • ≈2

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Check existing issues and pull requests.

    line 14
  2. Distinctive:

    If successive edge cases keep appearing, reconsider the invariant and ownership rather than adding another special case.

    line 34
  3. Distinctive:

    Keep required public snapshot fields accurate before exposing them, or type fields unavailable until later truthfully.

    line 37
  4. Distinctive:

    Keep handwritten production and test files cohesive.

    line 42
  5. Distinctive:

    Avoid hand-maintained model, endpoint, capability, or schema lists unless the contract requires them.

    line 46
  6. Distinctive:

    Do not replace presence or nullish checks with truthiness checks.

    line 60
  7. Distinctive:

    Verify affected CJS/ESM entrypoints, the exact minimum supported Node version, affected policy-defined Node lines, supported TypeScript …

    line 64
  8. Common:

    Keep optional integrations isolated from the core SDK.

    line 68
  9. Distinctive:

    Update affected canonical docs, executable examples, or meaningful public JSDoc when the public contract changes.

    line 72
  10. Very specific:

    Follow the custom-code guidance.

    line 78
  11. Very specific:

    Never commit API keys, tokens, private keys, .env files, customer data, or other secrets.

    line 88
  12. Very specific:

    Never place secret API keys in browser bundles or enable dangerouslyAllowBrowser without explicit security review.

    line 91
  13. Distinctive:

    Treat provider endpoints, headers, filenames, schemas, and object properties as untrusted.

    line 98
  14. Distinctive:

    When validation and dispatch must agree, snapshot only the security-critical values or serialized representation, within bounded memory, …

    line 106
  15. Common:

    Keep workflow tokens, permissions, and secrets at the narrowest required scope.

    line 111
  16. Very specific:

    Treat large payloads as a normal API contract, not evidence of malformed or hostile input.

    line 124
  17. Very specific:

    Follow .github/CONTRIBUTING.md and the tool versions pinned by .nvmrc and package.json.

    line 146
  18. Very specific:

    Run the focused regression first, then the checks appropriate to the change: pnpm lint, pnpm exec tsc, pnpm build, and ./scripts/test.

    line 158
  19. Very specific:

    Keep Node.js policy changes focused and keep the consumer runtime floor separate from repository tooling requirements.

    line 172

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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

Repository Guidance

Generated SDK

Most SDK source is generated from the OpenAI API schema. Follow .github/CONTRIBUTING.md before changing generated files. Handwritten policy, automation, tests, and examples should remain small and should not alter exported SDK APIs unless the change explicitly requires it.

Start with the actual problem

  • For externally observable bug or behavior fixes, reproduce the reported issue against the current repository and public SDK entrypoint before proposing a fix. Check existing issues and pull requests; inspect the API schema and generated/upstream ownership only when relevant. Do not duplicate existing work, "fix" intended API behavior, or patch a generated symptom that belongs in the schema or generator.
  • For those behavior fixes, include a focused regression that fails before the change and passes afterward. Type errors need a compile-time reproduction; stream, transport, and packaging bugs need coverage at the actual affected boundary, not merely a passing internal mock.
  • For docs-only, dependency-only, generated, formatting, workflow, or policy changes without an observable bug, use the smallest artifact-appropriate validation, such as link, render, configuration, installation, or build checks.

Keep changes small and coherent

  • Solve the narrow problem with the simplest implementation. Avoid unrelated refactors, reformatting, dependency or lockfile churn, generated-file edits, speculative abstractions, compatibility shims, and capabilities not requested.
  • Establish an invariant once at its owning boundary instead of compensating in every caller. Reuse existing parsers, registries, helpers, and compiler/runtime facilities instead of creating parallel infrastructure or a hand-written parser. If successive edge cases keep appearing, reconsider the invariant and ownership rather than adding another special case.
  • Model incomplete API/SSE wire shapes separately from enriched public SDK types. Keep required public snapshot fields accurate before exposing them, or type fields unavailable until later truthfully. Normalize incomplete items at their owning boundary instead of patching downstream consumers. Prefer TypeScript narrowing and inference over broad any, assertions, @ts-ignore, or casts that disguise an unproven contract.
  • Keep handwritten production and test files cohesive. Extract a well-defined owner only when the current change materially grows a file and reveals a coherent, distinct responsibility. Keep unrelated cleanup separate, and do not inflate fixtures or suites to justify an overly complicated implementation.
  • Avoid hand-maintained model, endpoint, capability, or schema lists unless the contract requires them. Prefer the documented API/schema and server-side validation over brittle client-side guesses.

Preserve SDK contracts and compatibility

  • Compare behavior with the base revision across existing public exports and import subpaths, provider and legacy clients, stable and beta surfaces, and equivalent streaming/non-streaming paths. Preserve published TypeScript declarations, overloads, optional fields, discriminators, object identity, protected hooks, request-option/header precedence, client cloning, and documented defaults unless the task explicitly authorizes a breaking change.
  • Preserve meaningful 0, false, and empty-string values, and distinguish explicit null from an omitted or undefined value where the contract does. Do not replace presence or nullish checks with truthiness checks.
  • For schema helpers, check supported Zod v3/v4 and Standard Schema integrations, inferred output types, escaped JSON Pointer references, and the actual serialized schema rather than trusting an idealized intermediate TypeScript shape.
  • Verify affected CJS/ESM entrypoints, the exact minimum supported Node version, affected policy-defined Node lines, supported TypeScript versions, and relevant browser, worker, Bun, Deno, bundler, or serverless integrations. The newest CI version passing does not prove compatibility with the minimum supported version.
  • Keep optional integrations isolated from the core SDK. Do not make a provider's optional dependency, environment, credential, or runtime requirement mandatory for unrelated clients; test both installed and absent optional dependencies when the import boundary changes.
  • Update affected canonical docs, executable examples, or meaningful public JSDoc when the public contract changes. Preserve existing documentation URLs and import paths, and make examples runnable with the documented environment and dependencies.

Custom-code budget

Follow the custom-code guidance. Budget changes belong in a separate PR containing only .castiron-ratchet.json, with an explicit justification in the PR description. Increases require a human approving review before merging. Agents may investigate and draft proposals, but must not approve budget increases (including through a human's credentials) or bypass the gate. Do not weaken counting, broaden exclusions, or alter generation metadata to make a change pass. The checker and effective budget come from main, not the PR. Keep default CODEOWNERS.

Security and lifecycle correctness

  • Never commit API keys, tokens, private keys, .env files, customer data, or other secrets. Read OPENAI_API_KEY from the environment and keep examples, fixtures, recordings, and snapshots synthetic.
  • Never place secret API keys in browser bundles or enable dangerouslyAllowBrowser without explicit security review. Always redact credentials, authorization headers, cookies, and webhook secrets. Keep real customer-sensitive request or response data out of default or uncontrolled logs, errors, test output, snapshots, and CI artifacts. Preserve documented opt-in OPENAI_LOG=debug or logLevel: 'debug' logging and APIError.error diagnostics with clear sensitive-data warnings; redact them before forwarding to untrusted sinks.
  • Treat provider endpoints, headers, filenames, schemas, and object properties as untrusted. At JSON object-record boundaries, validate the own properties and values actually emitted, accounting for serialization hooks and omitted values; reject or safely preserve dangerous prototype keys. Preserve supported inherited protocols and validate the final request, including normalized host/origin, redirects, protected hooks, custom fetch transports, and both current and legacy entrypoints. Never leak bearer tokens, API keys, certificates, request bodies, or other credentials across trust boundaries.
  • When validation and dispatch must agree, snapshot only the security-critical values or serialized representation, within bounded memory, before irreversible network or request-body side effects. Preserve request-options object identity and protected-hook mutations; never validate one mutable representation and serialize another.
  • Keep workflow tokens, permissions, and secrets at the narrowest required scope. Bind privileged checkout, release, and publication operations to the validated, immutable commit; do not trust floating refs, mutable tags, optional checks, or assumptions about repository settings and app permissions.
  • Pin third-party GitHub Actions to full, immutable commit SHAs. Publish npm packages only through protected GitHub Actions OIDC trusted publishing; never add token-based release paths. Expose GitHub App private keys, OIDC credentials, and permissions only to trusted release jobs; never expose them to unreviewed scripts or untrusted code.
  • For streaming, uploads, authentication, retries, timeouts, and cancellation, exercise the complete request/response lifetime: headers, JSON/error/binary/SSE bodies, raw responses, async iterators, redirect handling, abort reasons, retry budgets, concurrent refresh, cleanup, and reader/listener/lock ownership as applicable. Avoid new retained state and accidental quadratic hot paths.
  • Treat large payloads as a normal API contract, not evidence of malformed or hostile input. Responses, Chat Completions, and other APIs can legitimately return large application/json bodies, streaming events, and WebSocket messages. Do not introduce arbitrary fixed limits on bodies, frames, events, or lines as a security or efficiency fix. Prefer incremental processing, amortized-linear buffering, timely cleanup, and caller cancellation. Any new rejection limit needs an explicit, owner-approved API contract and a review of existing supported payloads and transports. Protect this behavior with deterministic public-entrypoint tests that construct large synthetic payloads in memory; do not commit large captures or require slow live image generation.
  • Give every cache an explicit owner, complete identity key, lifetime, and invalidation policy. Do not trust caller-mutable snapshots, conflate changed transport/certificate identities, or leak request/client-specific state or credentials across clients, transports, retries, or authentication contexts.
  • Require focused security review and relevant regression tests for authentication, network destinations or headers, browser credentials, files and uploads, webhook signatures, parsing, serialization, dependencies, and release automation. Report suspected vulnerabilities privately via .github/SECURITY.md; never disclose them in public issues or pull requests.

Tooling, dependencies, and verification

  • Follow .github/CONTRIBUTING.md and the tool versions pinned by .nvmrc and package.json. Keep ./scripts/test, ./scripts/lint, and ./scripts/format as the canonical script entrypoints, with package-manager aliases and CI routing through them; preserve both generated and handwritten suite coverage.
  • For dependency changes, update only the requested package and its dependency closure. Check pnpm install --frozen-lockfile, module format, supported runtime and TypeScript floors, minimum-release-age/trust policy, and audited lifecycle build permissions; do not hide unrelated transitive upgrades in the lockfile.
  • Make changed files pass the actual pinned formatter and linter. Do not disguise code or weaken a fixture to evade a lint rule. When an intentional public type, compatibility requirement, or regression fixture genuinely conflicts with a rule, use the narrowest documented exception; avoid unnecessary suppressions.
  • Run the focused regression first, then the checks appropriate to the change: pnpm lint, pnpm exec tsc, pnpm build, and ./scripts/test. Exercise generated tests, packed-package/export checks, supported runtime versions, ecosystem integrations, benchmarks, or workflows when their boundaries change. Report exactly what ran and distinguish verified results from infrastructure failures or checks that could not be run.

Node.js version policy

NODE_VERSION_POLICY.md is the sole authority for lifecycle, deprecation, exception, and release rules. Read and apply it rather than copying its rules into agent instructions. package.json#engines.node, .nvmrc, and the README are enforcement projections; CI derives its runtime matrix from the policy.

Keep Node.js policy changes focused and keep the consumer runtime floor separate from repository tooling requirements. After changing a policy projection, run:

node --experimental-strip-types scripts/check-node-version-policy.ts

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.