An introduction for developers, human or agent
Presenting AXIS
AXIS is a way of deciding where code goes. It names fourteen parts, which sounds like a lot until you notice they are seven pairs, and that you can work out every pair yourself by asking one question of code you have already written.
This page works them out with you on one small app: an invoice with a Send button. It starts as Model–View–Controller. We split each of those three boxes in two, then follow what happens to state, and to the outside world, when someone presses Send. Every example below is running in your browser.
- Start with MVCThree boxes you already know, and one controller quietly doing nine jobs.
- ··Split each box in twoWhat is defined ahead of time, and what is alive only at runtime.
- →→Follow the changeHow state moves, and how the outside world gets touched.
Reading as an agent? Use the agent edition instead: ../skill/llms.txt. Short on time? Chapter 9 is the cheat-sheet. The lesson is also in this file as structured JSON (<script id="axis-model">), and the page's own source is a working example of everything it describes.
Chapter 1
The app you already know
Here is an invoice app written the way most of us would write it first. A Model holds the invoice. A View draws it. A Controller handles the Send button. It is real code and it runs. Press Send invoice.
It works. Now press Start over, switch the mail server off, and send again.
The screen says sent. The database says sent. The outbox is empty, and an error went past with nothing listening for it. The invoice is now wrong, and it will stay wrong.
No single line of that controller is a mistake. The trouble is how many different jobs one function is doing. Click through its lines and read what each is for: reading the page, deciding who is allowed, finding a record, following a relationship, applying a business rule, changing state, writing to storage, drawing, talking to another system. Nine lines, nine jobs, in an order that happens to matter.
MVC's three boxes are a good first cut. Each of them is holding more than one kind of thing, and the rest of this page takes them apart with a single question.
Chapter 2
One question, asked three times
Take any statement you could make about the invoice app and ask:
Is this true before the program runs, or only while it runs?
Things that are true beforehand are definitions. AXIS calls that side Essence: stable shapes, rules and capabilities. Things that exist only at runtime are live. AXIS calls that side Expression: state, requests, sessions, work in progress.
Each MVC box below holds a handful of statements about the app. Sort them. A few will not fit either half of their box. Leave those where they are; they come back in chapters 4 and 5.
The Model split into what an invoice is and what this invoice holds. The View split into what can be done here and what someone meant. The Controller split into the rule and the running of it. Three boxes became six parts, and the question that did it was the same each time.
A note on the View. What splits here is its meaning: what is on offer, and what a gesture meant. Its pixels and its click handlers are a separate concern, and they are among the statements still on the table.
Essence defines what something is. Expression is how it shows up at runtime. Keep them in separate places and each becomes easier to read, to test and to change.
Chapter 3
How state works
With the Model split in two, state has one shape and one way to move.
- A Form says what a valid invoice is: its fields, its starting values, and the rules it must always satisfy.
- An Instance is one snapshot of an invoice: plain values, plus a revision number.
- Nothing edits an Instance in place. An Action looks at the current one and returns a delta, a description of what should be different. The Manager commits it: apply the delta, check every rule, keep the result as the next revision. If a rule breaks, the commit is refused and nothing changes.
Add and remove a few line items and watch the revisions accumulate. Then press the button marked wrong on purpose. It runs an Action with a bug in it.
The buggy Action asked to take $500 off the total without touching the line items. The commit refused it, because the result would break the rules: a Form rule says a total is never negative, and a rule about how an invoice relates to its line items says the total must equal their sum. (That second kind of rule gets its own name in chapter 5.) The Action was wrong. The state never was.
State changes are values, not mutations. One place commits them, and it checks the rules every time.
Chapter 4
How change works
Press Send and two different things need to change. The invoice has to become sent: a change to what the system knows. And an email has to leave the building: a change to the world. The MVC controller did both in one breath, which is how a dead mail server left the invoice wrong.
AXIS makes one move here. An Action never does either. It returns a description of both. This is the Action the page is running:
delta is the change inside. effects is the change outside, written down as plain data. Each entry is an Effect: what should happen, to what, and what to do if it cannot. The Manager commits the delta. A separate part, Impact, carries out the Effects, and it is the only code in the system allowed to touch the outside world.
That is the first of the leftover statements finding a home, and the same question sorted it. An email should go to that customer is true the moment the rule runs: a definition. Open a connection and send it exists only while it is happening.
Send the invoice. Then start over, switch the mail server off, and send again.
The same dead server as chapter 1. This time Impact tried three times, because the Effect said to. When that failed it ran the Effect's own plan B, which came back into the system as an ordinary request and returned the invoice to draft. Nothing was thrown. The failure is a record you can read.
Describe change before performing it. Actions decide, the Manager commits what is inside, and Impact performs what is outside.
“Static structures produce dynamic behavior. Dynamic behavior produces change. Change becomes new declarative state.” (AXIS Principles)
Chapter 5
What MVC never named
Six parts came from splitting MVC, and two more from following a side effect. Six statements are still on the table. They pair up, and the same question sorts every pair. In each pair below, pick the definition.
That completes the grid: seven concerns, each with a definition and a live counterpart. Read a row and you get one concern. Read a column and you get one kind of thing. Click any cell for what it is, what you probably call it already, and the real object this page is running.
And here is the controller from chapter 1 again. Every line had somewhere to go.
Coming from Redux, CQRS or event sourcing?
Flux and Redux. The flow is the same and the names collide, so read carefully: a Redux action is an AXIS Intent (a description of what happened); a reducer is an AXIS Action; the store is an Instance; the dispatcher is the Manager. The real difference is that thunks and middleware both declare a side effect and perform it. AXIS separates those into Effect and Impact, so side effects can be tested without mocking middleware.
CQRS. Not a separate pattern to adopt; it is a Facet configuration. A command is an Intent whose capability maps to a state-changing Action in a write Facet. A query maps to a read-only Action in a read Facet. Different Tokens can be given different Facets.
Event sourcing. The Intent stream is an event source. Store the Intents, or the committed deltas, and you get replay, audit and undo. AXIS adds names for what sits around the stream: Forms validate, Actions transform, Effects declare consequences.
Event → handler. The generic pattern gives you one seam. AXIS gives you five: Event → Adapter → Intent → Manager → Facet → Action, each testable on its own.
AXIS is a decompression. It does not add fourteen new ideas to MVC. It gives separate names to things MVC kept in three boxes.
Chapter 6
The whole loop
Fourteen parts, one path. Every interaction with a system built this way takes it.
Raw input arrives at the edge. A Wrapper hosts the surface, and an Adapter turns the raw event into an Intent, a plain statement of what was meant. The Manager works out who is asking (a Token), which Facet applies, and resolves any Links the rule will need. The Action returns a delta and some Effects. The delta is committed into a new Instance, checked against its Form and Bonds. The Effects go to Impact. Anything Impact learns comes back as a new Intent, by the same door.
The map lights up with the path the last request actually took. Try three things, and watch where each one stops:
- Ask as Kit, a viewer, and press Send.
- Ask as Sam, the clerk. Remove every line item, then press Send.
- Start over, switch the mail server off, and press Send.
Three failures, caught by three different parts. The Manager turned Kit away because the Facet in force for a viewer has no send; the rule never ran, and it contains no line about roles. The Action refused an empty invoice, because that is a business rule. Impact handled the dead server, because that is the world. None of them threw an exception. Each produced data.
A role is a claim in a Token. A capability is an entry in a Facet. A rule is an Action. Authorization is the Manager choosing the Facet. Each can change without touching the others.
Chapter 7
What it buys you
Structure is only worth its cost if it makes something easier. Here are two things it makes easier. You can run both.
A business rule you can test with two plain objects
The rule is a sent invoice cannot be sent twice. Below are two tests of it: one against the AXIS Action, one against the chapter 1 controller.
A session you can replay
Every Intent the invoice has received on this page was recorded, including the ones Impact sent back in. Because Actions are pure and Effects are data, feeding that recording to a brand-new Manager with Impact disconnected has to arrive at the same state.
AXIS Lite sets the bar plainly: a business rule should be unit-testable without network or database mocks, and a reviewer should be able to tell at a glance where IO happens. If adopting it does not reduce ambiguity more than it adds ceremony, simplify the shape.
Chapter 8
Start smaller than this
You do not need fourteen parts to begin, and most features never need all of them. What you need from the first day is the discipline. AXIS Lite states it as eight rules:
Everything else is added when the problem asks for it. Pick the kind of thing you are building:
The signal to add a part is that you can feel its absence:
And the signal to stop: AXIS is less useful for a mostly static page or a handful of direct listeners, and nobody should create a dozen files for a simple CRUD endpoint.
Preserve the discipline, not the ceremony. Add the next part only when the current shape would hide IO, blur ownership, or mix unrelated responsibilities.
Chapter 9
If you are an agent
Or a person who wants the page that stays open in another tab. An agent does not inherit a team's memory of where things go, so AXIS writes the placement rules down.
Where does this code go?
Constraints when generating or reviewing
One test per layer
Break a change into keyed units
The brief
Everything above, compressed for a context window.
The agent edition
This page is written for people. The same material, organised for agents, is in ../skill/llms.txt: plain markdown, a core of about 2,600 tokens, and references fetched only when a task needs them. It installs as an Agent Skill from ../skill/axis.skill, which adds two things a page cannot: a repo mapper that describes any existing codebase in AXIS terms and leaves a map for the next agent, and a lint that checks code claimed to be pure for hidden IO.
Chapter 10
This page, in its own terms
Every button above went through the loop it describes. There are two bounded contexts on this page, and they were built to two different profiles on purpose.
The lesson context tracks your place, your answers, and what the outside world currently looks like. It runs the Lite profile: one Form, one Instance, pure Actions, a Manager, Effects and Impact, Wrappers and Adapters. It has no Tokens, Bonds or Links, because nothing about it needs them. The billing context is the invoice. It uses all fourteen parts, because it has roles, a lifecycle, relationships, and a side effect that can fail. The two share no state and never call each other. (The tests in chapter 7 import billing's pure functions directly, as tests do.)
The prose you are reading is plain HTML. A read-only display needs a Wrapper and nothing else.
What is simulated
- The mail server is a small object in this page that can be switched off. Its failures are real exceptions. Its email is not real email.
- The chapter 1 controller is assembled from the nine lines shown and really executes, against stand-ins for a database, a session and a view.
- Retries happen immediately. There is no real backoff delay.
- Both contexts live in one browser tab. Nothing here shows how AXIS behaves across a network, or across a team.
Where to go next
- AXIS-Lite.md: the hard rules and the pragmatic profile. Start here.
- AXIS-Design.md: deciding when more structure is justified.
- AXIS-Code.md: the feature recipe, test examples, and a checklist of common mistakes.
- AXIS-Specification.md: the complete reference, with two worked examples.
- AXIS-FrontEnd-Web.md and AXIS-Principles.md: the browser mapping, and the reasoning underneath.