agentleFS
icoretechicoretech/airbroke/lib/AGENTS.md

airbroke / lib

AGENTS.md221 starsChanged 6 months agoMITView on GitHub

lib/ is the application and server layer, not a generic utility bucket. It owns reads, mutations, auth policy, intake semantics, MCP behavior, and routing. - Import db from lib/db.ts; never construct an ad hoc Prisma client. - Server actions begin with "use server", authenticate before protected mutations, and pair writes with the paths or tags their consumers render. - Preserve Next control flow with unstable_rethrow or redirects outside broad catch blocks. - lib/queries/ is the default UI read layer. MCP…

  • 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,736 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 repository5 other files it gives its agents.

The file

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

6 rules. About 1 is common, 3 are distinctive, and 2 are very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    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. Very specific:

    Import db from lib/db.ts; never construct an ad hoc Prisma client.

    line 36
  2. Very specific:

    Do not turn utils.ts into a home for domain behavior.

    line 55
  3. Distinctive:

    Do not duplicate grouping or persistence rules between Airbrake and Sentry.

    line 57
  4. Distinctive:

    Do not weaken MCP timing-safe key comparison, origin checks, read-only hints, strict schemas, pagination limits, or structured ambiguity …

    line 58
  5. Common:

    Do not expose additional project credentials through MCP setup-guide output without explicit security review and accepted/rejected tests.

    line 60
  6. Distinctive:

    Do not change trigger-dependent resolution behavior without reviewing the corresponding Prisma migration SQL and action tests.

    line 62

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

APPLICATION LIBRARY GUIDE

OVERVIEW

lib/ is the application and server layer, not a generic utility bucket. It owns reads, mutations, auth policy, intake semantics, MCP behavior, and routing.

STRUCTURE

actions/       # Authenticated server mutations and invalidation
auth/          # Better Auth providers, restrictions, and session helpers
intake/        # Airbrake/Sentry normalization and shared persistence
mcp/           # MCP transport, schemas, tools, and read models
queries/       # UI-facing Prisma read paths
integrations/  # SDK metadata and generated setup snippets
routing/       # Breadcrumb and search-parameter contracts
cache/         # Shared cache tags
db.ts          # Lazy shared Prisma client boundary

WHERE TO LOOK

TaskLocationNotes
Database clientdb.tsCallable lazy proxy; one shared entrypoint
Mutation guardactions/requireAuth.tsRun before protected writes
UI invalidationactions/revalidateProjectShellPaths.tsProject paths
Auth configurationauth/index.tsLazy initialization is build-critical
Intake identityintake/upsertNoticeOccurrence.tsGrouping and retries
MCP registrymcp/tools.tsPublic tool list and result contract
MCP securitymcp/server.tsKey, origin, CORS, per-request handler

CONVENTIONS

  • Import db from lib/db.ts; never construct an ad hoc Prisma client.
  • Server actions begin with "use server", authenticate before protected mutations, and pair writes with the paths or tags their consumers render.
  • Preserve Next control flow with unstable_rethrow or redirects outside broad catch blocks.
  • lib/queries/ is the default UI read layer. MCP keeps protocol-specific resolution and response shaping under lib/mcp/readModels/.
  • Intake groups notices by project, environment, and kind; occurrences by notice and SHA-256 message hash. Existing occurrences are reinstated and unique races receive bounded P2002 retries.
  • Better Auth is initialized lazily so imports and production builds do not require provider runtime configuration.
  • MCP tools validate Zod inputs, stay read-only, normalize tool results, and make ambiguous project references explicit rather than guessing.
  • Recreate the MCP transport handler per request; its collaborator retains request/session state internally.

ANTI-PATTERNS

  • Do not turn utils.ts into a home for domain behavior; use the matching action, query, intake, auth, MCP, integration, or routing module.
  • Do not duplicate grouping or persistence rules between Airbrake and Sentry.
  • Do not weaken MCP timing-safe key comparison, origin checks, read-only hints, strict schemas, pagination limits, or structured ambiguity errors.
  • Do not expose additional project credentials through MCP setup-guide output without explicit security review and accepted/rejected tests.
  • Do not change trigger-dependent resolution behavior without reviewing the corresponding Prisma migration SQL and action tests.

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.