Spec language for LLMs

The specification language that talks back

Allium clarifies your intent into a precise, durable artefact that keeps your AI grounded, conversation after conversation.

orders.allium allium
rule OrderConfirmed {
    when: CheckoutCompleted(cart, payment)

    requires: cart.items.all(in_stock)
    requires: payment.authorised

    ensures:
        let order = Order.created(
            items: cart.items,
            total: cart.total
        )
        PaymentCaptured(order: order)
}

Claude Code
>We need backorder support. Let customers order items that are currently out of stock.
Your Allium says OrderConfirmed triggers PaymentCaptured, which charges the customer immediately. A backorder would charge before the item ships. Should we defer payment capture until the item is available, or capture immediately and refund if we can't fulfil?
>Capture payment details upfront but don't charge until we can fulfil. Update the Allium and implement.
Updated orders.allium. BackorderPlaced authorises payment and defers capture until ReadyToFulfil. Implementing now.

Why a spec language at all?

A formal language for what a system should do, separate from how.

There are four reasons to capture intent this way.

01

Stops the drift

Within a session, meaning slips: by prompt twenty, the model is pattern-matching its own outputs rather than your original intent. A spec anchors it.

02

Persists between sessions

Constraints and decisions captured in conversation disappear when the chat ends. An Allium spec is a durable artefact the next session, or the next engineer, can read.

03

Surfaces contradictions

Markdown lets two requirements quietly disagree. Allium's structure exposes the conflict instead of letting a capable model paper over it.

04

Separates what from how

Code can't tell you whether a behaviour is intended. Allium says what the system should do; the code says how it does it. The gap between them is information.


Code vs intent

Why not just point the LLM at the code?

Modern LLMs navigate codebases effectively, and many engineers find this sufficient. The limit appears when you need to distinguish what the code does from what it should do.

Code captures implementation, including bugs and expedient decisions, and the model treats all of it as intended behaviour. Precise prompting helps, but precise prompting is specifying intent: which behaviours are deliberate, which constraints must be preserved.

You end up writing descriptions of intent scattered across your prompts. Allium captures it in a form that persists, so the next engineer, the next model, or you next week can read not just what the system does, but what it was meant to do.

what the code does
orders.py python
def confirm_order(cart, payment):
    # expedient: VIP carts skip the stock check
    if cart.vip or all(i.in_stock for i in cart.items):
        capture(payment)         # charges immediately
        return Order.created(cart)
intent ≠ implementation
what it should do
orders.allium allium
rule OrderConfirmed {
    when: CheckoutCompleted(cart, payment)

    requires: cart.items.all(in_stock)
    requires: payment.authorised

    ensures: PaymentCaptured(order)
}

Structure over prose

Why not capture requirements in markdown?

Markdown gives you no framework for surfacing ambiguities and contradictions. You can require authentication in one section and allow guest checkout in another, and the format never flags the tension. A capable model may resolve it silently in a way you didn’t intend; a weaker one may never notice it exists.

prose · conflict hidden
requirements.md markdown
## Authentication
- users must be authenticated to check out

## Checkout
- guest checkout is supported
allium · conflict exposed
checkout.allium allium
rule Checkout {
    when: CheckoutStarted(session)
    requires: session.authenticated
}

rule GuestCheckout {
    when: CheckoutStarted(session)
    requires: not session.authenticated
}
$ allium check checkout.allium conflict Checkout and GuestCheckout share trigger CheckoutStarted requires: session.authenticated  ·  requires: not session.authenticated  →  preconditions can never both hold

The model doesn’t need to be clever enough to spot the issue in prose — the structure does that work. Markdown can capture robust behaviour with enough diligence, but that diligence falls entirely on the author. Allium’s constraints guide you toward completeness and consistency.


Two directions of travel

The specification and the code evolve together.

Refining a behavioural model alongside implementation deepens your understanding of both the problem and your solution. LLMs generate code from descriptions, shifting where design thinking happens — the specification becomes the site of that thinking, and the code its expression.

source Intent

What you meant the system to do — goals, constraints, the behaviour you actually intended.

elicitation
model.allium Specification

The durable artefact both directions meet in — the shared site where design thinking now lives.

distillation
source Implementation

What the code actually does today, including behaviours that were never explicitly decided.

Elicitation works forward from intent through structured conversation; distillation works backward from implementation. Distillation reveals what you built; elicitation clarifies what you meant. When the two diverge, you’ve found something worth investigating.


On single sources of truth

Redundancy isn’t duplication, it’s resilience.

A common objection: a behavioural model beside the code violates single-source-of-truth. But code captures both intentional and accidental behaviour, with no mechanism to tell them apart — is that authentication quirk a feature or a bug? The code can’t tell you. You need something outside the code to even say “this is wrong.” Engineers already accept this elsewhere.

01

Type systems

Express intent the implementation must satisfy. Nobody calls a signature a duplicate of its body.

02

Tests

Assert expected behaviour against actual behaviour. The gap between them is the whole point.

03

Allium

The same pattern, raised to behaviour: a model of what, and under which conditions, beside the code that says how.

When code and model disagree, that disagreement is information.


From the field

What early users are saying.

  • I’m definitely enjoying using Allium, and finding driving Claude Code with spec to be highly effective both in brownfield and greenfield developments.

    Jim Downing CPTO, Cyclops Workout
  • This is a game changer for agentic pair planning. I run Allium on all new planning sessions — it catches so many of my blind spots.

    Ben Ritchie CTO, Stealth Startup
  • Thanks for this wonderful contribution! Early days, but I’ve distilled a large amount of knowledge from a heavily WIP backoffice system.

    John Grimsey Group CTO, New Age Partners
Velocity through clarity

Ready to give your AI a clearer brief?

Install Allium in your editor and turn your next conversation into a spec your future self can still read.