openiap
AGENTS.md166 starsChanged 5 months agoMITView on GitHub
Instructions for AI agents working in the OpenIAP monorepo. Detailed rules live in knowledge/internal/, the Single Source of Truth (SSOT); this file routes to them. Human contributors start at CONTRIBUTING.md.
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 31,700 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 repository15 other files it gives its agents.
- .cursor/rules/openiap-ssot.mdcCursor rule
- add-showcase-appSkill
- e2e-matrix-runner-appleSkill
- e2e-matrix-runner-googleSkill
- e2e-matrix-runnerSkill
- generate-docSkill
- github-labelsSkill
- iapkit-e2e-martieSkill
- iapkit-e2e-petguSkill
- loop-reviewSkill
- opencollective-stewardSkill
- openiap-workflowsSkill
- rebase-mainSkill
- review-selfSkill
- ship-releaseSkill
The file
We split this AGENTS.md into the rules it gives an agent
12 rules. About 0 are common, 5 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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
- Distinctive: line 63
CRITICAL: Before writing or editing anything in a package or library:
- Very specific: line 66
When the GraphQL schema adds or changes an API, follow the SDK Parity Checklist in knowledge/internal/04-platform-packages.md to avoid
- Distinctive: line 123
Write like a maintainer explaining the change to a colleague: what changed and why, short sentences, no preamble or investigation narrative.
- Very specific: line 144
iOS functions: Must end with IOS suffix (e.g., syncIOS, getReceiptDataIOS)
- Distinctive: line 146
Cross-platform functions: NO suffix
- Very specific: line 150
Do not use iPhone Mirroring for debugging, purchases, or E2E tests.
- Very specific: line 157
Never write to a production deployment: no mutation or action from the Convex dashboard runner or npx convex run --prod, and no HTTP call …
- Distinctive: line 162
Never edit, insert, or delete documents in the production data browser.
- Distinctive: line 164
Read production only when asked (tables, counts, logs, health), report aggregates, and never copy customer emails or other personal data …
- Very specific: line 183
Never edit these by hand. cd specs/client && bun run generate regenerates them and syncs every target in …
- Very specific: line 214
Commit format: feat: add new feature with a tag (lowercase after it), Add new feature without one.
- Very specific: line 228
After editing knowledge/, run cd scripts/agent && bun run compile:ai.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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
OpenIAP Monorepo - Agent Guidelines
Instructions for AI agents working in the OpenIAP monorepo. Detailed rules live
in knowledge/internal/, the Single Source of Truth (SSOT); this file routes to
them. Human contributors start at CONTRIBUTING.md.
Quick Reference
| Topic | File |
| Naming Conventions | knowledge/internal/01-naming-conventions.md |
| Architecture | knowledge/internal/02-architecture.md |
| Coding Style | knowledge/internal/03-coding-style.md |
| Platform Packages | knowledge/internal/04-platform-packages.md (run bun audit:parity before commits; CI runs the same SDK parity job) |
| Docs Patterns | knowledge/internal/05-docs-patterns.md |
| Git & Deployment | knowledge/internal/06-git-deployment.md |
| Docs Consistency / SSOT | knowledge/internal/07-docs-consistency.md (run bun audit:docs before pushing API/Type doc edits) |
| Community Touchpoints | knowledge/internal/09-community-touchpoints.md (first-purchase notice, assistant note, README section; one source of truth) |
| Agent Tooling | knowledge/internal/10-agent-tooling.md (per-tool setup, compiled context, skills and slash commands) |
| Research References | knowledge/research/README.md (paper registry and evidence-backed engineering backlog) |
Monorepo Structure
openiap/
├── packages/
│ ├── cli/ # `openiap init` + `doctor` CLI (npm)
│ ├── conformance/ # Behavioral conformance spec, runner, and reports
│ ├── docs/ # Documentation site (React/Vite/Vercel)
│ ├── google/ # Android library
│ ├── apple/ # iOS/macOS library
│ ├── kit/ # Purchase validation + entitlement infrastructure (Fly.io app)
│ └── mcp-server/ # IAPKit MCP server (hosted at kit.openiap.dev/mcp)
├── specs/ # Publishable specifications; never deployed services
│ ├── client/ # Client GraphQL contract + multiplatform code generation
│ └── commerce-protocol/ # Vendor-neutral server-side commerce contract
├── plugins/
│ └── openiap/ # Codex + Claude Code plugin (skills + MCP config)
├── libraries/ # Framework SDK implementations
│ ├── react-native-iap/ # React Native (npm)
│ ├── expo-iap/ # Expo (npm)
│ ├── flutter_inapp_purchase/ # Flutter (pub.dev)
│ ├── godot-iap/ # Godot 4.x (GitHub Release)
│ ├── kmp-iap/ # Kotlin Multiplatform (Maven Central)
│ └── maui-iap/ # .NET MAUI / C# (NuGet)
├── knowledge/ # Shared knowledge base (SSOT)
│ ├── internal/ # Project philosophy (HIGHEST PRIORITY)
│ ├── external/ # External API reference
│ ├── _agent-context/ # Compiled context shared by AI assistants
│ └── _claude-context/ # Compatibility link to _agent-context
├── scripts/ # Monorepo-wide automation
└── .github/workflows/ # CI/CD workflowsRequired Pre-Work
Public API or specification design requires Hyo's explicit review before implementation, including exported helpers, defaults, deprecations, and removals. Follow the Public Contract Design Gate. IAPKit is one third-party service; shared contracts must work for independent providers through the same public interface.
CRITICAL: Before writing or editing anything in a package or library:
- Read the relevant knowledge files from
knowledge/internal/- When the GraphQL schema adds or changes an API, follow the SDK Parity Checklist in
knowledge/internal/04-platform-packages.mdto avoid phantom interfaces (declared in types but never wired end-to-end — the class of bug behind GitHub issue #104).
- When the GraphQL schema adds or changes an API, follow the SDK Parity Checklist in
- Check the package-specific CONVENTION.md:
specs/client/CONVENTION.mdpackages/google/CONVENTION.mdpackages/apple/CONVENTION.mdpackages/docs/CONVENTION.mdspecs/commerce-protocol/CONVENTION.md— the server-side commerce specification; its GraphQL contract is the authoring SSOT, JSON Schemas are generated validator artifacts, and IAPKit conforms to the spec, never the reversepackages/kit/CONVENTION.md— kit is a deployable SaaS (not a library); has its own Convex schema and isn't part of the GQL type-sync chain. Its/v1responses are still a published contract that shipped SDKs decode: read the/v1response contract section and runbun audit:kit-contractbefore changing a response enum,isValidState, or a purchase-state mapping
- For framework libraries, read the library-specific AGENTS.md:
libraries/react-native-iap/AGENTS.md— Yarn 3, Nitro Modules, useIAP hook semantics, error handlinglibraries/expo-iap/AGENTS.md— Bun, Expo Modules, iOS podspec 13.4 workaround, tvOS 16.0 requirementlibraries/flutter_inapp_purchase/AGENTS.md— Flutter/Dart, generated types.dart, fetchProducts generic APIlibraries/godot-iap/AGENTS.md— GDScript conventions, GDExtension (iOS), AAR plugin (Android)libraries/kmp-iap/AGENTS.md— Kotlin Multiplatform, Flow-based API, SwiftPM iOS integrationlibraries/maui-iap/AGENTS.md— .NET MAUI / C# 12, generated Types.cs, Android/iOS bindings
Key Rules Summary
Code and Docs Quality
- KISS and SSOT are release criteria; apply the canonical rules before implementation and during every review.
- Examples stay clean: example code must not turn into spaghetti. When an example needs refs, maps, retries, or ordering patches to be correct, the framework library gets the abstraction (same design in every framework, tested), and the example goes back to plain usage. Rule.
- Clean up once it works: reread the diff for duplication, redundant
fallbacks, and stale comments, and fix smells you meet even outside the
change. Never write
as any. Checklist. - Comments: one line by default, point first, plain words; keep only what the code cannot show. Checklist.
- Docs: lead with the outcome, state each fact once, keep required caveats. Apply the Reader-First Writing Standard.
- Layout: extend the existing owner instead of adding a parallel root
directory, per the
Directory Ownership Guardrail;
run
bun run audit:layoutafter moving directories.
Docs Ship With The Change
A PR into main that changes a published package also updates the guides it
affects and the release card for the next version, written as already
published. Apply the
Release Note Completeness Gate
before creating or updating a PR, declaring review clean, or releasing. On PRs
from outside contributors the maintainer adds the card.
Public GitHub Writing
- Everything posted to GitHub (issues, PRs, reviews, Discussions, commits, release notes) is in English; follow the language guard.
- Write like a maintainer explaining the change to a colleague: what changed and why, short sentences, no preamble or investigation narrative. A PR body is a few short paragraphs (thirty lines at most); a review reply is one to three sentences. Style rules.
- Creating or updating an issue, Discussion, or PR includes choosing its
labels with
$github-labelsper the GitHub Labels policy.
Opening Pull Requests
This rule binds AI agents and maintainer sessions; human contributors are
welcome to open PRs. Open a new PR only when the maintainer explicitly requests
it. Permission for one PR, or to continue, merge, or release, does not
authorize follow-up PRs. Keep small fixes in the relevant open PR, and leave
unrelated PRs alone. A small docs fix with no open PR is a one-line question
about committing straight to main. Claude Code holds PR creation for approval
(scripts/guard-pull-request.mjs).
Canonical rule.
Platform Function Naming
- iOS functions: Must end with
IOSsuffix (e.g.,syncIOS,getReceiptDataIOS) - Android functions in packages/google: NO
Androidsuffix (it's Android-only) - Cross-platform functions: NO suffix
Physical iPhone Testing
Do not use iPhone Mirroring for debugging, purchases, or E2E tests. Follow the
direct-device XCUITest procedure in
.codex/skills/e2e-matrix-runner/SKILL.md.
Report unavailable checks as BLOCKED (unverified), never as passed.
Production Data Guardrail
- Never write to a production deployment: no mutation or action from the
Convex dashboard runner or
npx convex run --prod, and no HTTP call that is not a plain read. The dashboard runner preselects the last function used, which has includeddrainAccountDeletionBatch; confirm the selection before pressing Run, and prefer not opening it. - Never edit, insert, or delete documents in the production data browser. Schema and data changes ship through a reviewed deploy.
- Read production only when asked (tables, counts, logs, health), report aggregates, and never copy customer emails or other personal data anywhere.
- Try things on the dev deployment; a missing query is added to
packages/kit/convexand reaches production through the normal deploy. - Unsure which deployment is selected? Stop and confirm; the dashboard shows
it next to the project name (e.g.
Production • healthy-kudu-836).
Webhook Direction Guardrail
Webhooks run server-to-server only: store → IAPKit, and IAPKit → a developer
backend the project owner registered. Never add an IAPKit → SDK/mobile webhook
stream, SSE endpoint, WebSocket, push relay, or long-poll feed; device push
belongs to the developer's backend, and a shipped app never gets project-wide
lifecycle events or a secret key. bun audit:parity enforces this; do not
weaken it to bring the feature back. See
IAPKit webhook boundary.
Auto-Generated Files (DO NOT EDIT)
Never edit these by hand. cd specs/client && bun run generate regenerates
them and syncs every target in specs/client/generated-sync-manifest.mjs:
specs/client/src/generated/*packages/apple/Sources/Models/Types.swiftpackages/apple/Sources/OpenIapGeneratedVersion.swift(fromopeniap-versions.json)packages/google/openiap/src/main/java/dev/hyo/openiap/Types.ktlibraries/react-native-iap/src/types.tslibraries/expo-iap/src/types.tslibraries/flutter_inapp_purchase/lib/types.dartlibraries/godot-iap/addons/godot-iap/types.gdlibraries/kmp-iap/library/src/commonMain/kotlin/io/github/hyochan/kmpiap/openiap/Types.ktlibraries/maui-iap/src/OpenIap.Maui/Types.cslibraries/{react-native-iap,expo-iap}/src/{kit-api,purchase-flow-core,purchase-flow-confirmers}.tslibraries/react-native-iap/src/purchase-flow.ts(Expo owns its compatibility facade independently)libraries/expo-iap/src/utils/errorMapping.tsand its__tests__/errorMapping.shared.test.ts, andlibraries/expo-iap/src/utils/purchaseFlowBinding.ts(mirrored from react-native-iap)libraries/expo-iap/src/__tests__/purchaseFlow.shared.test.ts(mirrored from react-native-iap)- each library's
purchase-flow.vectors.jsontest fixture (copied fromspecs/client/src/purchase-flow.vectors.json)
openiap-versions.json tracks only clientProtocol, google, apple, and the
plugins/openiap plugin version, and only release CI changes it; feature work
never edits version fields, plugin manifests included. Framework library
versions live in each library's own metadata. See
Version File Management.
Commits and Releases
- Commit format:
feat: add new featurewith a tag (lowercase after it),Add new featurewithout one. Scopes are in Git Commit Message Format. - Package releases run from
mainthrough explicit workflow dispatches; merging publishes nothing, and Vercel deploys docs frommain. Read.claude/commands/release.mdbefore any deployment. Historical RC sources are retained by a protected archive tag; never change or delete it. Policy: Main And Release Channels.
Agent Tooling
Per-tool setup (Codex, Claude Code, Grok, Muse, Cursor), the compiled context,
and the full skill and slash-command list are in
knowledge/internal/10-agent-tooling.md.
After editing knowledge/, run cd scripts/agent && bun run compile:ai.
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.

