kirim-saas: Instructions file for Codex

AGENTS.md

kirim-saas AGENTS.md is an instructions file for Codex, OpenCode from orif1n/kirim-saas. It costs 7,673 tokens per session, scanned A, original, MIT.

Project instructions for a modular SaaS starter: a ready-made codebase for building subscription web applications. It uses a Bun monorepo, meaning several related applications and packages are kept in one repository.

In plain words
What is it for?
It helps developers work on the API, React web app, background jobs, database, authentication, email, payments, storage, and shared configuration.
Why use it?
It explains the repository layout, fixed technology versions, and local rules before you change code, reducing the risk of breaking package-specific assumptions.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md.

This is orif1n/kirim-saas's own configuration. It tells Codex and OpenCode how to work on kirim-saas itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything kirim-saas configures →

Reuse

Borrowing it

Nothing to install: this file belongs to orif1n/kirim-saas. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/orif1n/kirim-saas/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/orif1n/kirim-saas

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kirim-saas AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/orif1n/kirim-saas/agents-md/github.svg)](https://agentmods.dev/instructions/orif1n/kirim-saas/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/orif1n/kirim-saas/agents-md"><img src="https://agentmods.dev/badge/instructions/orif1n/kirim-saas/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kirim-saas AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/orif1n/kirim-saas/agents-md"><img src="https://agentmods.dev/badge/instructions/orif1n/kirim-saas/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 7,673 This file is loaded in full into every session.
When invoked 7,673 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What 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.

ModelPer sessionOnce invoked
Fable 5.1 $0.07673 $0.07673
Opus 5 $0.03837 $0.03837
Sonnet 5 $0.01535 $0.01535
Haiku 4.5 $0.00767 $0.00767

Measured 9d ago against content hash 63afb0a8fdcd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

kirim-saas AGENTS.md 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 9d 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.

AGENTS.md · 315 lines

How it starts

The opening of the file, as written. The whole thing — 315 lines — stays where its author put it; the contents beside it link to each section on GitHub.

saas-boilerplate

Modular, type-safe SaaS starter. Bun monorepo, Hono API, Vite/React web, Drizzle + Postgres, Better Auth, provider-agnostic payments, hardened by default (OWASP audit passing).

Read this file first. Then read the AGENTS.md next to whatever you're about to edit — each package documents its local invariants.

Repository map

saas-boilerplate/
├── apps/
│   ├── api/          Hono + zod-openapi + Better Auth handler (Bun runtime)
│   ├── web/          Vite + React 19 + shadcn/ui + TanStack Router + i18next
│   └── worker/       Bun + BullMQ background jobs (billing reconciler, subscription lifecycle)
├── packages/
│   ├── config/       tsconfig presets + Zod env schema
│   ├── shared/       Enums, AppError, Result, crypto helpers — zero I/O, safe everywhere
│   ├── db/           Drizzle schema, client, migrations, seed
│   ├── auth/         Better Auth server factory + browser client
│   ├── email/        Resend mailer + React Email templates
│   ├── payments/     Provider interface + Duitku adapter (Midtrans/Xendit/Stripe are interface-only stubs that throw until implemented)
│   └── storage/      Provider interface + R2/S3 adapter — presigned uploads, magic-byte verify
├── docker-compose.yml    Postgres + Redis + Mailpit for local dev
├── Dockerfile.api        Multi-stage Bun runtime (non-root)
├── Dockerfile.web        Multi-stage nginx-unprivileged (port 8080)
├── renovate.json         Grouped dependency PRs, auto-merge safe minors
└── .github/workflows/    CI (lint/typecheck/test + e2e) and Docker publish to GHCR

Golden rules

  1. No circular deps. apps/* depends on packages/*, never the reverse. packages/db and packages/shared are leaf packages with no cross-package runtime deps.
  2. No I/O at import time. Every package exports pure factories (createXxx(config)). The API's server.ts is the ONE place that reads env and constructs services.
  3. Money is integer minor units. priceAmount, amount are integers. Currency is a separate column. No floats, ever.
  4. Payments are provider-agnostic. Routes talk only to the PaymentProvider interface. Adding a provider = one file + one factory branch. Swapping providers = one env var.
  5. Errors are AppError at package boundaries. The API error middleware is the ONLY response formatter. Frontend surfaces them via normalizeError() + i18n code table.
  6. Type-safe env. @saas/config/env validates once at boot and throws on missing/invalid vars. Placeholder values in .env.example are actively rejected.
  7. OpenAPI is source of truth for the HTTP contract. Every route uses createRoute(...). /api/openapi.json and /api/docs are gated OFF in production.
  8. i18n covers every user-visible string. Locales are split per namespace under apps/web/src/i18n/locales/{en,id}/<ns>.ts. Add keys to BOTH en/<ns>.ts and id/<ns>.ts in the same commit. The id aggregator is typed against typeof en, so a missing key fails typecheck instead of silently falling back. Error codes are looked up via errors.<CODE> in errors.ts.
  9. Column-level encryption for secrets at rest. Two independent mechanisms, do NOT conflate them: (a) OAuth tokens on accounts.* are encrypted by Better Auth's built-in account.encryptOAuthTokens (its own ciphertext format, keyed off AUTH_SECRET) — NOT by @saas/shared/crypto, whose format Better Auth's OAuth refresh path cannot read. (b) Verification tokens (verifications.value) and any third-party integration secrets go through @saas/shared/crypto (AES-256-GCM), gated on COLUMN_ENCRYPTION_KEY — when that key is unset the hook is a no-op and values are stored plaintext (dev default; production MUST set it — the env schema throws at boot without it). See packages/auth/AGENTS.md "Column-level encryption". Personal access tokens (api_keys.hashed_key) use hashApiKey from @saas/shared/crypto, which returns a raw 32-byte Buffer (sha256 digest) mapped to a bytea column — NOT hex. Plaintext is returned to the caller ONCE on create and NEVER persisted or logged.
  10. Webhooks: verify signature, re-check business fields, transact. Never trust that a signed payload is safe to write — cross-check amount/currency against the pending row. Persist raw payloads ONLY through the adapter's redactWebhookPayload() — the DB is not a place for provider signatures, customer PII, or free-form fields. Every PaymentProvider MUST implement redactWebhookPayload(raw); per-provider allowlists are the invariant. Redacted payloads land in the sibling table payment_webhook_events (append-only), NOT on the payments row — that keeps the hot /billing/payments history query narrow. See packages/payments/AGENTS.md.
  11. Tenant scoping is a security invariant, not a filter. Every read/write on business data MUST include WHERE organization_id = ?. The active org is resolved via requireActiveOrg(services, session) — never trust the client. Missing the predicate is a cross-tenant data leak, not a bug.
  12. This is a tenant application, not a platform-admin surface. Roles (owner | admin | member) are per-organization. There is no "platform admin". Dashboard stats, MRR, revenue — all scoped to ONE workspace. Do not add cross-tenant aggregations to /api/*; that belongs in a separate admin surface not shipped here.
  13. Bearer auth inherits creator's role at request time + carries hierarchical scopes. API keys grant the same tenant role their creator had when the request runs. Each key ALSO carries an explicit scope array (api_keys.scopes, jsonb — see API_KEY_SCOPES in @saas/shared/constants). Default is ['read']; write and admin are opt-in at create time. Scopes are hierarchical: admin implies write implies read (via SCOPE_HIERARCHY + scopeImplies). Bearer mutation endpoints call requireScope(c, 'write') from apps/api/src/lib/scopes.ts to reject read-only keys BEFORE the role check; org-wide destructive endpoints (billing cancel, workspace delete) call requireScope(c, 'admin'). Cookie sessions bypass scope entirely (they carry the full role). Elevation guard: a bearer caller can only mint keys with scopes THEY currently hold — a write-scoped key cannot bootstrap an admin-scoped child key (enforced in POST /api/api-keys). Built-in identity flows (password change, account deletion, email change) live under Better Auth's /api/auth/*, where bearer sessions are invisible (Better Auth resolves cookies itself) — no extra guard needed. Any CUSTOM sensitive route you add outside Better Auth MUST call requireCookieAuth(c) from apps/api/src/lib/session-source.ts to reject bearer callers regardless of scope (currently zero call sites, by design — see the helper's doc comment for the pattern). Bearer sessions get a random opaque session.id + session.token per request — NEVER log them (they'd become stable identifiers tying a request back to a specific api_keys row). See apps/api/AGENTS.md "Bearer auth".

Read the full file on GitHub · 315 lines

Changes

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.

  1. 9d ago First seen · 315 lines · 7,673 tokens per session scan A 63afb0a8fdcd

Subscribe to this mod's changes

kirim-saas AGENTS.md is an instructions file published in the GitHub repository orif1n/kirim-saas (10 stars, last pushed 1mo ago), licensed MIT. It adds 7,673 tokens to every session, about $0.0384 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-31.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens