Skip to main content
IntentLang

Examples

See how intent reads before any code is written.

Each example is a self-contained sketch. Read it top to bottom, that is the point. They are illustrative drafts, not runnable programs.

All examples use draft syntax and do not run yet. There is no compiler or playground execution behind them today.

A complete mission

The canonical CreateInvoice mission: a goal, its inputs and outputs, the guarantees that must always hold, forbidden behavior, targets, and how it is verified.

CreateInvoice.intent
1Mission CreateInvoice
2
3Goal
4 Generate an invoice from approved orders
5
6Requires
7 Customer
8 ApprovedOrders
9
10Input
11 customer: Customer
12 orders: List<Order>
13
14Output
15 invoice: Invoice
16
17Guarantees
18 invoice.total is never negative
19 duplicate invoices are not created
20 every invoice is auditable
21
22Never
23 create invoice for unapproved order
24 expose payment token in logs
25
26Target
27 TypeScript
28 Python
29 DotNet
30
31Verify
32 unit tests
33 duplicate prevention test
34 audit trail test
35 security scan

Three layers

One mission, three levels of precision.

The same ResetPassword mission, written from beginner-friendly human intent down to compiler-ready executable intent.

Layer 1

Human Intent

Readable and structured. Anyone on the team, or an AI agent, can follow it on first read.

ResetPassword.intent
1Mission ResetPassword
2
3Goal
4 Let a user securely reset their password
5
6Requires
7 verified email
8 reset token
9
10Guarantees
11 token expires after 15 minutes
12 token can only be used once
13 password is never logged
Layer 2

Typed Intent

A precise engineering mode with semantic types and explicit constraints.

ResetPassword.intent
1Mission ResetPassword
2
3Input
4 email: Email
5 token: ResetToken
6 newPassword: Secret
7
8Output
9 result: PasswordResetResult
10
11Constraints
12 token.ttl <= 15 minutes
13 password.minLength >= 12
14
15Never
16 log(newPassword)
17 return token
Layer 3

Executable Intent

Compiler-ready mode that names a target, its implementation choices, and the checks to run.

ResetPassword.intent
1Mission ResetPassword
2
3Target DotNet
4
5Implementation
6 use ASP.NET Core
7 use EntityFramework
8 use BCrypt
9
10Verify
11 test token expiration
12 test one time use
13 test password hash stored
14 test raw password not logged

Beyond a single function

Intent for whole systems.

Intent is architecture aware. Services, APIs, events, and tests are all first-class, so the meaning of a system lives in one place.

Architecture as code

Intent understands services: what they own, consume, and publish, their data store, and who owns them.

Billing.intent
1Service Billing
2
3Owns
4 Invoice
5 PaymentAttempt
6
7Consumes
8 OrderApproved
9
10Publishes
11 InvoiceCreated
12
13Database
14 Postgres
15
16Owner
17 Finance Platform Team

API intent

Method, path, required permissions, inputs, outputs, and the errors an endpoint can return.

CreateInvoiceApi.intent
1API CreateInvoice
2
3Method
4 POST
5
6Path
7 /invoices
8
9Requires
10 authenticated user
11 permission invoice:create
12
13Input
14 CreateInvoiceRequest
15
16Output
17 InvoiceResponse
18
19Errors
20 400 InvalidOrder
21 401 Unauthorized
22 409 DuplicateInvoice

Event intent

Who publishes an event, who consumes it, its payload, and the guarantees it must uphold.

InvoiceCreated.intent
1Event InvoiceCreated
2
3PublishedBy
4 BillingService
5
6ConsumedBy
7 NotificationService
8 ReportingService
9
10Payload
11 invoiceId: InvoiceId
12 customerId: CustomerId
13 total: Money
14
15Guarantees
16 event is idempotent
17 event contains no payment secrets

Behavior-first tests

Given, When, Then. Tests describe behavior in the same language as the intent they verify.

DuplicateInvoicePrevention.intent
1Test DuplicateInvoicePrevention
2
3Given
4 approved order already invoiced
5
6When
7 CreateInvoice runs again
8
9Then
10 no duplicate invoice is created
11 existing invoice is returned

Want to try writing intent?

The playground is a preview where you can sketch missions today. Execution and compilation are coming later.