simfinity.js
AGENTS.md11 starsChanged 17 days agoApache-2.0View on GitHub
This file helps coding agents (and humans) work productively and safely in this repository. It complements—not replaces—the detailed rules under .cursor/rules/. If something is ambiguous, prefer the matching .mdc file over this summary.
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
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 11
Peers: every package uses graphql ^16.
- Very specific: line 27
If something is ambiguous, prefer the matching .mdc file over this summary.
- Very specific: line 31
Do not: use graphql-middleware’s applyMiddleware or @graphql-tools/utils mapSchema on a Simfinity schema — they rebuild the schema and …
- Very specific: line 33
Behavior changes: update tests under tests/ and public docs (README.md) when the public API or documented behavior changes.
- Distinctive: line 56
Run from the repo root after substantive edits:
- Very specific: line 63
Use npm run test:watch while iterating.
- Distinctive: line 82
Keep changes scoped to the task.
- Very specific: line 85
Keep the root free of backup READMEs and local .tgz/.zip output.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 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
Agent guidance for the Simfinity monorepo
This file helps coding agents (and humans) work productively and safely in this repository. It complements—not replaces—the detailed rules under .cursor/rules/.
What this project is
- Workspace: the root
simfinity-workspacepackage is private. All five publishable libraries, their declarations, licenses and package READMEs live underpackages/. - Examples:
examples/barber/{mongodb,postgres,frontend}are independent private npm applications with their own lockfiles, outside thepackages/*workspaces. The two backends consume released Simfinity runtime packages at exact version 3.7.0; the Next.js frontend is shared. - Packages:
@simtlix/simfinity-jsis the MongoDB/Mongoose facade;@simtlix/simfinity-coreowns the shared GraphQL runtime;@simtlix/simfinity-sqlowns driver-free relational planning/runtime;@simtlix/simfinity-postgresis the PostgreSQL 15+ plugin and compatible facade;@simtlix/simfinity-mcpgenerates MCP tools from a GraphQL schema. - Runtime: Node.js
>=18.18.0for library consumers. Use Node.js 24 for development and CI; documentation requires Node.js 22 or later. - Peers: every package uses
graphql^16. The Mongo facade alone has amongoose^8 peer; MCP has an optional@modelcontextprotocol/sdkpeer. PostgreSQL depends on SQL,pgand core, without MongoDB, Mongoose, or MCP.
Authoritative rules (read these)
| Topic | Rule file |
| Development workflow and release completion | .cursor/rules/simfinity-development-workflow.mdc |
| Architecture, core flow, global state | .cursor/rules/simfinity-architecture.mdc |
| Coding style, imports, errors, schema transforms | .cursor/rules/simfinity-coding-standards.mdc |
| Internal APIs / functions | .cursor/rules/simfinity-core-functions.mdc |
| Auth plugin, rules, expressions | .cursor/rules/simfinity-auth-module.mdc |
| Field extensions / introspection | .cursor/rules/simfinity-extensions.mdc |
| Tests | .cursor/rules/simfinity-testing.mdc |
| README / docs updates | .cursor/rules/simfinity-documentation.mdc |
| Barber applications and their CI | .cursor/rules/simfinity-barber-examples.mdc |
If something is ambiguous, prefer the matching .mdc file over this summary.
Non-negotiables
- Do not use
graphql-middleware’sapplyMiddlewareor@graphql-tools/utilsmapSchemaon a Simfinity schema — they rebuild the schema and duplicate globally injected introspection types. Use Envelop plugins and in-place resolver wrapping instead (see architecture rule). - Imports: static ES imports belong at the top; match existing style (single quotes, semicolons, trailing commas in multiline constructs). Preserve MCP's lazy optional-SDK loading and the explicit import-order test fixtures described in the rules.
- Behavior changes: update tests under
tests/and public docs (README.md) when the public API or documented behavior changes. - Package boundaries: core and SQL must remain driver-free; PostgreSQL must not import MongoDB, Mongoose or MCP. Keep GraphQL semantics in core, relational planning/record/session orchestration in SQL, and physical SQL/DDL/codecs/driver operations in engine plugins. Backend selection is fixed for each runtime; do not add runtime switching.
- Compatibility:
packages/mongodbstill publishes as@simtlix/simfinity-js. Preserve its entry points andsrc/deep imports, and their sibling.d.tsdeclarations, inside the published archive. Keep shared helper/error identities and update package declarations for public API changes. - Example boundaries: install and test Barber apps in their own directories. Keep them private, preserve registry dependencies and separate Compose projects, and do not add them to library workspaces or npm release tooling. Native database code stays in each backend; the frontend treats GraphQL IDs as opaque strings.
- Mongo reference integrity:
createMongoAdapter({ referentialIntegrity: 'transactional' })is opt-in and fixed at startup; default'off'stays compatible. Awaitadapter.initialize()after schema creation and database connection. Preserve target-document locks, snapshot/majority transactions, incoming-reference checks and rollback of supplied sessions on integrity violations. Native model/driver writes remain outside that guarantee; seedocs/guide/mongodb-integrity.md. - Batched reads reproduce single reads: an adapter's
getByIdsandfindChildrenBatchmust return exactly whatgetByIdandfindChildrenreturn for each ID or parent, andbatchesChildrenmust return false whenever a batch would bypass the adapter's ownfindChildren(a copy or override, MongoDB aggregate hooks, a session). Both bundled adapters batch collection reads only withbatchedCollections: true(only the literaltrue); without it they define neither member and keep 3.6.0's reads. PostgreSQL runs each batch in a transaction afterSET LOCAL jit = off, thesetupitscompileChildrenQueryreturns. Batching may reorder only unsorted or tied rows. - Publication is part of completion: when a task includes releasing a library change, the responsible contributor or agent must ensure both its
vX.Y.Ztag and published GitHub release exist, and verify successful package publication and the applicable documentation deployment. A merged PR or version bump is not a completed release.
Shared development and publication rule
This is a repository-wide rule for contributors and coding agents, not a local assistant preference. Follow the development and publication contract and the Cursor workflow rule.
Implement scoped changes on a branch, update the relevant documentation and tests, and merge through a reviewed PR with passing checks. When publication is requested or is already part of the agreed task, carry the work through the release workflow without asking again for the same authorization:
- Prepare the intended version with
node scripts/release-packages.js version <version>and validate it withnode scripts/release-packages.js check. Keep all five packages, their exact internal dependencies and the private root aligned. Reuse a correctly prepared unpublished version instead of inventing another bump. - After merge, create the annotated
vX.Y.Ztag on the validated merge commit inmaster(not the PR's head commit) and push it to GitHub. Ensure the matching GitHub release is published: the tag-triggered workflow can create it, or the contributor can publish the release in GitHub. Both must exist before completion. - Wait for Release Simfinity to finish. Verify npm and GitHub Packages for all five packages, the expected npm distribution tags and archive integrity, the GitHub release assets, and the stable documentation deployment, or the documentation gate's notice that the live site already contains it (then link that deployment). Prereleases use
nextand do not deploy the stable site. - Report the version, tag/release and workflow links, and verification results. If any step fails, resolve the cause and retry the original run; never move an existing release tag or describe a partial release as published. If access or another external dependency blocks completion, state exactly what remains.
Publication intent is required: ordinary edits, merges, and version changes do not authorize or trigger a release on their own. Documentation, CI, repository rules, and example-only changes do not need a library version just to land in the repository. Use the documentation-only deployment flow when website publication is requested. Publish packages through GitHub Actions/OIDC, not a local npm login; the only exception is the one-time bootstrap of a new package before it joins the release set (see the contribution guide). Manual release-workflow dispatch is preview-only.
Verification commands
Run from the repo root after substantive edits:
npm run lint
npm testUse npm run test:watch while iterating; npm run test:coverage when coverage matters.
- For package boundaries, dependencies, exports or declarations:
npm run test:packagespacks the working tree with the release packer (aligned versions and a Git checkout required);npm run test:packages -- <manifest.json>tests exactly a release manifest's archives instead, as the release build does. It checks extracted-archive quality, isolated packed applications, strict TypeScript consumers and MongoDB deep imports/resolution aliases. The core consumer also compiles every public core subpath (namespace, named, default and type imports) under NodeNext, Node16, Bundler and Node10, checking each member's exact type against the root and the export names both ways; it also checks the root's runtime value exports both ways (coreRootValues) and that the root error classes are theauthclasses. The MongoDB consumer compiles the legacysrc/deep imports under the same four resolutions with exact type equality.tests/core-subpath-types.test.jschecks the export map,typesVersions, declared names and re-exported types without packing, and the MongoDBsrc/sibling declarations; the archive quality check requires everyexportstypestarget to be in the archive. Keep quality tooling in root development dependencies only. - For dependency changes:
npm run test:securityaudits the root lockfile including development dependencies; CI and release validation require it. Audit independent documentation/example applications separately. MongoDB requires Mongoose^8.24.2; retain the update-casting security regression. - For database behavior: run the full suite with disposable database URIs, as described in the testing rule.
npm run test:integrationcovers onlytests/integration/; additional MongoDB regression suites live directly undertests/. - For documentation:
npm run docs:installandnpm run docs:build. - For Barber changes: follow
examples/barber/README.mdand.github/workflows/barber.yml. Root lint and Vitest excludeexamples/; run each affected app'snpm run test:security, its app checks, and the shared HTTP/browser contract against both databases for shared behavior changes. Use only disposable example databases for data-changing checks. - For release metadata:
node scripts/release-packages.js check. Release tooling aligns the private root version, all five package versions and exact internal dependencies; the root itself is never published.
Layout hints
- Implementation:
packages/core/src/owns the shared runtime and helpers;packages/mongodb/src/owns the MongoDB facade/adapter and compatibility shims;packages/sql/src/owns relational planning and runtime;packages/postgres/src/owns the plugin, SQL compilation, codecs and physical schema lifecycle;packages/mcp/src/owns MCP generation and transports. - Tests:
tests/covers core, both adapters, MCP and release tooling;tests/contracts/andtests/fixtures/hold shared fixtures. See the testing rule for MongoDB collection suppression in tests without a database. - Documentation:
README.mdis the repository overview;packages/*/README.mddescribes each published package;docs/builds the public website independently of the runtime packages. - Barber examples:
examples/barber/contains both backends, the shared frontend, per-stack Compose files, and HTTP contracts. The dedicatedbarber.ymlworkflow owns their dependencies and checks. PostgreSQL schema exports go to ignoredexamples/barber/postgres/generated/. - Release tooling:
release.ymlresponds tov*tag pushes and published GitHub releases: validate the existing tag against aligned versions andmasterhistory, package/database tests, npm OIDC + GitHub Packages, verified registry availability, GitHub release assets and stable Pages deployment. Version changes and merges do not publish; manual dispatch only previews.publish.ymlis reusable, not a separate manual publication step. Usescripts/release-packages.js version <version>in a reviewed PR; do not publish from a local login.publish.ymlpacks first, in its ownpackjob, before any install or test:release-state.js verify-sourcevalidates the source (workflows only checkGITHUB_REF), thepackCLI refuses untracked or ignored files, and the manifest's SHA-256 is a job output that publish-npm, publish-gpr and github-release enforce (SIMFINITY_RELEASE_MANIFEST_SHA256;publish-packages.js --executealso requiresSIMFINITY_RELEASE_COMMIT); build only uses it to test the same archives.release-state.jsprevents superseded retries from moving current releases backward, fails closed when any release package is missing from npm, and gates Pages withverify-docs(stable only, forward only, skipped with a notice when the live site already contains the source) in a separate job without thegithub-pagesenvironment.verify-published.jschecks npm visibility and integrity from uncached reads (?write=true), retrying transient registry failures within a deadline.github-release.js finddecides whether to create the GitHub release (nevergh release view); stable releases clear pre-release before--latest. GitHub API reads go throughscripts/github-api.js(token required, same-origin pagination), retries throughscripts/transient.js, and release CLIs detect their entry point withisEntryPointfromscripts/cli.js, never a rawprocess.argv[1]comparison. Every workflow action is pinned to a commit SHA with a version comment (Dependabot proposes bumps); pack and publish jobs use exact Node.js 24.21.0 (pack and publish-gpr use its bundled npm; publish-npm installs npm 11.21.0 for Trusted Publishing), bumped by hand; changingnode-versionis what changes the npm that packs the archives. Re-runs and release events for an existing tag run that tag's tooling. Library CI and Database integration cancel only superseded pull request runs. npm trusts callerrelease.ymlwith environmentnpm-release, restricted tov*tags. Pages allowsv*release tags andmasterfor documentation-only deployments; dispatch those onmasteronly. Seedocs/resources/contributing.md.
When editing
- Keep changes scoped to the task; avoid drive-by refactors.
- Extend existing patterns rather than introducing parallel abstractions.
- For GraphQL types in examples/tests: use
extensions.relationon relationship fields; useextensions.readOnlywhere appropriate. - Keep the root free of backup READMEs and local
.tgz/.zipoutput. Generate temporary archives outside the repository. Archives underdocs/public/are intentional website downloads; check links and checksums before changing them.
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 28,693 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 repository9 other files it gives its agents.
- .cursor/rules/simfinity-architecture.mdcCursor rule
- .cursor/rules/simfinity-auth-module.mdcCursor rule
- .cursor/rules/simfinity-barber-examples.mdcCursor rule
- .cursor/rules/simfinity-coding-standards.mdcCursor rule
- .cursor/rules/simfinity-core-functions.mdcCursor rule
- .cursor/rules/simfinity-development-workflow.mdcCursor rule
- .cursor/rules/simfinity-documentation.mdcCursor rule
- .cursor/rules/simfinity-extensions.mdcCursor rule
- .cursor/rules/simfinity-testing.mdcCursor rule
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.

