Skip to content

AI Guardrails

AI coding tools write code fast, but they’ll also cross a module boundary, skip a permission check or leave out tests, because nothing told them not to. StackRivet’s answer isn’t a chatbot. It’s a set of machine-readable rules in the repository that keep an AI tool inside the same architecture a senior engineer would enforce.

The public repositories include an AI-readable rule system that tells coding tools how to change StackRivet safely:

LayerPurpose
Repository guideThe change workflow, ownership rules and verification gates.
Machine-readable mapA compact index of the product docs, code areas and hard rules.
Engineering standardsLayering, style, security and test requirements for each repository.
Module manifestModule-local menus, permissions, migrations and AI hints.

The key principle: AI output must satisfy the same engineering rules as human-written code. If the output crosses a module boundary, skips permission checks or omits verification, it is not done.

The guardrails encode the same boundaries the Architecture and Security pages describe, in a form an AI must follow:

  • Module boundaries and the one-directional layering (Controller → Service → Domain → Mapper).
  • Permissions — every protected endpoint declares one; new permissions are declared in the module manifest before the controller uses them.
  • Migrations — all schema changes go through Flyway; no manual production changes.
  • Tests — generated and hand-written code carries tests.
  • No leaking storage keys, no bypassing the Service / permission / audit layers, and the Asset Service is the only file system (store asset_id, never a URL).

The hard rules cover the failure modes AI tools commonly introduce: default-deny on protected APIs, no plaintext passwords, no secrets in logs, every list API paginates (max pageSize 200), heavy work runs as async tasks with an idempotencyKey, and the frontend uses the StackRivet design system rather than default Element Plus chrome.

The rules also tell an AI where to put things, so it doesn’t freelance:

To add…Do…
A business moduleUse the in-product code generator at /api/v1/generator — don’t freeform
A permissionDeclare it in the module manifest, then annotate the controller
A tableAdd a Flyway migration in the owning module
A design tokenExtend the design-token layer, not inline styles

The module manifest ties this together: each module declares its name, version, menus, permissions, dictionaries, migrations and AI rules in one place, which is also what makes a module reviewable and upgradeable.

The core AI guardrails, module manifests and engineering standards are in Community. Higher-tier AI capabilities — a database-design assistant, a requirement-to-module wizard, an AI code-review agent, a private model gateway, a project RAG knowledge base and an MCP service — are Pro / Enterprise; see the pricing page.

To put the guardrails to work in your editor, see the AI coding workflow guide.