For AI generation
Precise enough for humans. Constrained enough for agents.
Carrier’s advantage isn’t maximal language power. It’s that the backend surface is small, explicit, and compiler-checked. That is exactly the shape that lets code generators stay consistent across a project — and across drafts.
Why it fits
Five properties that matter
Narrow syntax
Fifteen top-level declarations. One
service. A tight scalar set, arrays, optionals, enums, and record types. Fewer ways to be wrong.Authoring tiers
Docs grade constructs: Tier 1 first-pass-safe, Tier 2 recommended, Tier 3 advanced runtime. Start at the smallest tier that fits.
First-class manifest
Every build emits
.carrier/manifest.json: models, routes, policies, jobs, schedules, clients. Tools read it instead of scraping source.Compiler feedback loop
carrier check runs the full semantic pass — types, CRUD validity, auth/policy rules, idempotency scope, built-in signatures.Predictable layout
Numeric-prefixed multi-file layout (
00_models, 10_types, 20_actions, 30_routes) keeps generation order stable.Generated CRUD
crud replaces the repetitive hand-written endpoints that are most likely to drift between drafts.Docs for agents
The generation recipe, verbatim from docs/ai-authoring.md
This is the order the AI authoring guide recommends. It matches what the compiler expects in practice.
docs/ai-authoring.md
fast generation recipe1. write carrier.toml2. declare one service3. add auth jwt if any route is protected4. create enum used by models or query defaults5. create model declarations6. create type declarations for I/O and pagination7. add crud for resource-like models8. add policy for role or tenant visibility9. add action for real business writes10. add custom route11. add job / event / schedule only when needed12. add client for outbound integrations13. add pure fn helpers lastTier 1 — first-pass-safe
one
service · optional auth jwt · type · route · optional model + crud · pure fn helpersTier 2 — recommended
multi-file layout ·
action with transactions · idempotent write routes · policy where role visibility mattersTier 3 — platform
cache · jobs · schedules · events · audit · raw SQL · DB functions · typed clients · @version · tenant RLSHonest
What NOT to invent
Carrier is grounded, not aspirational. The AI authoring guide is explicit about what does not exist yet.
No
Language features not present in the repository — no trait system, no generics, no macros, no custom decorators, no package registry.
No
Framework magic — Carrier does not hide behavior behind annotations. Everything visible compiles into the expected output.
No
Selective imports — imports are validated metadata; every
.carrier file under src/ compiles together.No
return inside transaction { } — do the work in the block, return after.