Helpdesk
Requesters submit support tickets and track their status.
A small support-ticket app that exercises every AIM v5.6 feature in one connected graph. It is intentionally split across files, because the point of the graph model is that the relation graph spans files — and you can still traverse, check, and diff it.
- Who
- Requester · Agent
- Steps
- 12 in 4 processes
Use it with your agent
Connect AIM to the agent you already use, then ask it to start your own version:
Read the AIM context "Helpdesk" at https://intentmodel.org/registry/reference/helpdesk/ and start our own version of it for our team.
Browse the model
How the intents fit together
NotifyRequester
View workflow sourceFile
AGENTS.md
Agents
This project uses the Agentic Intent Model (AIM) v5.6 for behavioral specification.
The ./aim/ tree is the behavioral authority for a small support-ticket app (see README.md for the guided tour). .aim files are a projection of a node-and-edge graph: headings are addressable nodes, [verb](aim:<address>) tokens are typed edges, and the graph is derived — never authored as a separate artifact. The intent tree reads parent/children; each child intent lives in its own directory with its intent file, and mapping/binding facets sit alongside the intent they realize.
Roles: the Architect authors intent, the Developer realizes it in code, the Reviewer diffs reality against the declared graph. Realization detail (symbols, routes, tables) belongs in ### Bindings properties (or deprecated kind: binding sidecars) only — behavioral files never carry code paths.
intent
Comms
A minimal shared messaging capability that other intents depend on. It is included here so the helpdesk's cross-intent edge (NotifyRequester → SendEmail) resolves against a real node rather than dangling.
Summary
Sends transactional email. Exposed as a single contract that other intents import and invoke.
Requirements
- An email is sent to one recipient with a subject and body.
Contract
SendEmail
Send one transactional email.
Input
to: string required
subject: string required max(200)
body: string requiredEnsures
- The message is handed to the mail provider for delivery.
Returns
- A provider message id.
intent
Helpdesk
A small support-ticket system. Requesters open tickets; agents work a shared queue and resolve them. This parent file is the index for the intent and the home for everything shared across features: the schemas, the personas, the dashboard views, the external dependencies, and the resolved-ticket notification flow. Each lifecycle action is a child intent.
Summary
Requesters submit support tickets and track their status. Agents see the whole queue as a table, open a ticket's detail, and resolve it. Resolving a ticket notifies the requester by email — handled asynchronously off the resolved event, not in the request path.
Requirements
- Every ticket has exactly one requester and at most one assigned agent.
- A ticket moves through states:
open→in_progress→resolved. - Requesters see only their own tickets; agents see the whole queue.
- Resolving a ticket notifies the requester.
Children
Dependencies
Imports
comms.SendEmailas Mailer
Requires
- Directory as Users
Record
User
A person who can use the helpdesk, in either role.
Schema
id: string required
name: string required max(120)
email: string required
role: enum(requester, agent) requiredRecord
Ticket
A single support request and its lifecycle state.
Schema
id: string required
subject: string required min(1) max(160)
body: string required max(4000)
requesterId: string required ref(User.id)
assigneeId: string optional ref(User.id)
status: enum(open, in_progress, resolved) required default(open)
createdAt: datetime required
resolvedAt: datetime optionalConstraints
statustransitions follow:open→in_progress→resolved.
Bindings
- binds:
src/models/ticket.ts#Ticket— as: model - binds:
table:tickets— as: table
Persona
Requester
An authenticated user who opens and tracks their own tickets.
Access
Persona
Agent
A support agent who works the shared queue and resolves tickets.
Access
View
TicketQueue
The agent's worklist — every ticket as a table, newest first.
Display
- A table of reads · Ticket rows: subject, requester, status, createdAt.
- Status shown as a colored badge; resolved tickets dimmed.
Actions
- Clicking a row — navigates · TicketDetail.
Bindings
- binds:
src/views/TicketQueue.tsx#TicketQueue— as: component
View
TicketDetail
A single ticket in full, with the actions available for the viewer's role.
Display
- The reads · Ticket record: subject, body, requester, assignee, status, timestamps.
Actions
- Resolve (agents only) — exposes · ResolveTicket.
Flow
NotifyRequester
When a ticket is resolved, email its requester. Event-driven and asynchronous — it is entered by subscribing to the resolved event, not invoked in the resolve request path.
Steps
- React to a resolved ticket — subscribes · TicketResolved.
- Load the ticket to find its requester — reads · Ticket.
- Resolve the requester's email address via the
Usersdirectory. - Send the notification — invokes · SendEmail.
Flow
EscalateStale
Find tickets still open past the SLA window and escalate them (bump priority, re-surface to agents). Runs on a schedule, not in any request path.
Steps
- Find open tickets older than the SLA window — reads · Ticket.
- Re-stamp the stale tickets for escalation — mutates · Ticket.
Trigger
StaleSweep
A nightly schedule that escalates stale open tickets — a non-actor entry point (no Persona or View involved).
Kind
- schedule
Schedule
- cron:
0 2 * * *
Fires
mapping
Helpdesk Mappings
Binds the helpdesk's required capabilities (declared under ## Dependencies → Requires in the parent intent) to concrete providers.
Map
Users
Resolves the Users directory alias to the company identity provider.
Target
company.identity
Operation Map
Users.ResolveUser→company.identity.ResolveUser
intent
ResolveTicket
Summary
An agent resolves a ticket. Its status moves to resolved, resolvedAt is stamped, and a TicketResolved event is emitted — which the parent's NotifyRequester flow consumes to email the requester.
Requirements
- Only an agent may resolve a ticket.
- A ticket may be resolved only from
openorin_progress. - Resolving stamps
resolvedAtand emitsTicketResolved.
Tests
- A requester (non-agent) is denied.
- Resolving an already-resolved ticket is a safe no-op.
- A
TicketResolvedevent carries the ticket id and the resolver.
Contract
ResolveTicket
Mark a ticket resolved on behalf of the acting agent.
Input
ticketId: string requiredAuthz
- Caller must be an agent.
Expects
- The ticket exists and is not already
resolved.
Ensures
- Orchestration is delegated to the resolve flow — invokes · ExecuteResolve.
- The ticket status becomes
resolvedandresolvedAtis set — mutates · #Record:Ticket. - A resolution event is emitted — emits · TicketResolved.
Returns
- The updated Ticket.
Bindings
- binds:
src/tickets/resolve.ts#resolveTicket— as: handler - binds:
route:POST /api/tickets/:id/resolve— as: route
Flow
ExecuteResolve
Transition the ticket to resolved and emit the event.
Steps
- Verify the acting agent and the current status.
- Set
status="resolved"and stampresolvedAt— mutates · #Record:Ticket. - Emit the event — emits · TicketResolved.
Event
TicketResolved
Emitted when an agent resolves a ticket. Consumed by the parent's NotifyRequester flow.
Payload
ticketId: string required
resolvedBy: string required
resolvedAt: datetime requiredRouting
- Channel:
helpdesk.tickets.resolved - Durable: true
Bindings
- binds:
topic:helpdesk.tickets.resolved— as: topic
intent
SubmitTicket
Summary
A requester opens a new ticket from a form. The ticket starts open, owned by the requester, and a TicketSubmitted event is emitted. Ticket and User are not defined here — they resolve upward to the parent helpdesk.tickets.
Requirements
- Subject is 1–160 characters; body is required.
- The new ticket is owned by the submitting user and starts
open. - A
TicketSubmittedevent is emitted on success.
Tests
- Submitting with an empty subject fails validation.
- A submitted ticket appears in the requester's list and the agent queue.
- A
TicketSubmittedevent carries the new ticket id.
View
SubmitForm
The requester's "New ticket" form.
Display
- Fields: subject (single-line text), body (multiline text).
Actions
- Submit — exposes · SubmitTicket.
Contract
SubmitTicket
Create a new ticket on behalf of the current requester.
Input
subject: string required min(1) max(160)
body: string required max(4000)Authz
- Caller must be an authenticated requester.
Ensures
- Orchestration is delegated to the submit flow — invokes · ExecuteSubmit.
- A new Ticket is persisted with status="open" — mutates · #Record:Ticket, satisfies · #Requirements[2].
- A submission event is emitted — emits · TicketSubmitted, satisfies · #Requirements[3].
Returns
- The created Ticket.
Bindings
- binds:
src/tickets/submit.ts#submitTicket— as: handler - binds:
route:POST /api/tickets— as: route
Flow
ExecuteSubmit
Persist the ticket and emit the submission event.
Steps
- Set
requesterIdto the current user andstatustoopen. - Persist the ticket — mutates · #Record:Ticket.
- Emit the event — emits · TicketSubmitted.
Event
TicketSubmitted
Emitted when a requester opens a new ticket.
Payload
ticketId: string required
requesterId: string required
createdAt: datetime requiredRouting
- Channel:
helpdesk.tickets.submitted - Durable: true
File
graph.svg
<svg viewBox="0 0 1060 600" xmlns="http://www.w3.org/2000/svg" role="img" font-family="ui-sans-serif, system-ui, sans-serif">
<title>AIM v4 helpdesk relation graph</title>
<desc>Nodes colored by facet type across columns — Persona/Trigger, View, Contract, Flow, Schema/Event — connected by typed edges labelled with verbs.</desc>
<rect x="0" y="0" width="1060" height="600" fill="#ffffff"/>
<defs>
<marker id="ar" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="#64748b"/></marker>
<marker id="ard" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="#9333ea"/></marker>
<marker id="art" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="#0f766e"/></marker>
</defs>
<g font-size="12" font-weight="700" fill="#94a3b8" text-anchor="middle">
<text x="80" y="24">PERSONA / TRIGGER</text><text x="270" y="24">VIEW</text><text x="480" y="24">CONTRACT</text><text x="690" y="24">FLOW</text><text x="930" y="24">SCHEMA / EVENT</text>
</g>
<!-- gray edges -->
<g fill="none" stroke="#64748b" stroke-width="1.6" marker-end="url(#ar)">
<path d="M150 235 L190 150"/>
<path d="M150 250 L190 470"/>
<path d="M150 380 L190 305"/>
<path d="M150 395 L190 485"/>
<path d="M350 300 C 300 380, 300 420, 270 460"/>
<path d="M350 290 L840 215"/>
<path d="M350 480 L840 230"/>
<path d="M350 135 L400 135"/>
<path d="M350 475 L400 475"/>
<path d="M610 135 L660 135"/>
<path d="M610 475 L660 475"/>
<path d="M820 135 L840 195"/>
<path d="M820 150 L900 330"/>
<path d="M820 475 L840 240"/>
<path d="M820 490 L900 475"/>
<path d="M900 100 L880 75"/>
<path d="M770 318 L846 224"/>
</g>
<!-- async / cross-component (purple dashed) -->
<g fill="none" stroke="#9333ea" stroke-width="1.6" stroke-dasharray="5 4" marker-end="url(#ard)">
<path d="M760 545 C 850 545, 905 510, 905 495"/>
<path d="M760 560 C 840 590, 900 300, 905 245"/>
<path d="M685 545 C 560 520, 540 510, 540 500"/>
</g>
<!-- triggers (teal dashed) -->
<g fill="none" stroke="#0f766e" stroke-width="1.8" stroke-dasharray="2 4" marker-end="url(#art)">
<path d="M160 488 C 380 470, 450 360, 608 320"/>
</g>
<!-- edge labels -->
<g font-size="10.5" fill="#475569" text-anchor="middle">
<text x="158" y="186">accesses</text>
<text x="120" y="362">accesses</text>
<text x="300" y="372">navigates</text>
<text x="560" y="243">reads</text>
<text x="372" y="124">exposes</text>
<text x="372" y="466">exposes</text>
<text x="632" y="124">invokes</text>
<text x="632" y="466">invokes</text>
<text x="824" y="172">mutates</text>
<text x="868" y="252">emits</text>
<text x="884" y="92">refs</text>
<text x="812" y="282">reads / mutates</text>
<text x="820" y="540" fill="#9333ea">subscribes</text>
<text x="640" y="600" fill="#9333ea">invokes</text>
<text x="392" y="404" fill="#0f766e">triggers</text>
</g>
<!-- nodes -->
<g font-size="12.5" text-anchor="middle">
<rect x="10" y="220" width="140" height="40" rx="9" fill="#fde68a" stroke="#b45309"/><text x="80" y="245" fill="#3f2d00">Requester</text>
<rect x="10" y="370" width="140" height="40" rx="9" fill="#fde68a" stroke="#b45309"/><text x="80" y="395" fill="#3f2d00">Agent</text>
<rect x="10" y="470" width="150" height="40" rx="9" fill="#99f6e4" stroke="#0f766e"/><text x="85" y="495" fill="#042f2e">⏰ StaleSweep</text>
<rect x="190" y="115" width="160" height="40" rx="9" fill="#bfdbfe" stroke="#1d4ed8"/><text x="270" y="140" fill="#0b2559">SubmitForm</text>
<rect x="190" y="285" width="160" height="40" rx="9" fill="#bfdbfe" stroke="#1d4ed8"/><text x="270" y="310" fill="#0b2559">TicketQueue ▦</text>
<rect x="190" y="460" width="160" height="40" rx="9" fill="#bfdbfe" stroke="#1d4ed8"/><text x="270" y="485" fill="#0b2559">TicketDetail</text>
<rect x="400" y="115" width="160" height="40" rx="9" fill="#bbf7d0" stroke="#15803d"/><text x="480" y="140" fill="#053019">SubmitTicket</text>
<rect x="400" y="460" width="160" height="40" rx="9" fill="#bbf7d0" stroke="#15803d"/><text x="480" y="485" fill="#053019">ResolveTicket</text>
<rect x="460" y="480" width="160" height="40" rx="9" fill="#bbf7d0" stroke="#15803d"/><text x="540" y="505" fill="#053019">SendEmail ⤴</text>
<rect x="610" y="115" width="160" height="40" rx="9" fill="#ddd6fe" stroke="#6d28d9"/><text x="690" y="140" fill="#2a1065">ExecuteSubmit</text>
<rect x="610" y="300" width="160" height="40" rx="9" fill="#ddd6fe" stroke="#6d28d9"/><text x="690" y="325" fill="#2a1065">EscalateStale</text>
<rect x="610" y="460" width="160" height="40" rx="9" fill="#ddd6fe" stroke="#6d28d9"/><text x="690" y="485" fill="#2a1065">ExecuteResolve</text>
<rect x="610" y="525" width="160" height="40" rx="9" fill="#ddd6fe" stroke="#6d28d9"/><text x="690" y="550" fill="#2a1065">NotifyRequester</text>
<rect x="850" y="40" width="150" height="38" rx="9" fill="#fecaca" stroke="#b91c1c"/><text x="925" y="64" fill="#450a0a">User</text>
<rect x="850" y="195" width="150" height="38" rx="9" fill="#fecaca" stroke="#b91c1c"/><text x="925" y="219" fill="#450a0a">Ticket</text>
<rect x="850" y="312" width="150" height="38" rx="9" fill="#fed7aa" stroke="#c2410c"/><text x="925" y="336" fill="#431407">TicketSubmitted</text>
<rect x="850" y="456" width="150" height="38" rx="9" fill="#fed7aa" stroke="#c2410c"/><text x="925" y="480" fill="#431407">TicketResolved</text>
</g>
<!-- legend -->
<g font-size="11" fill="#475569">
<rect x="12" y="556" width="13" height="11" rx="3" fill="#fde68a" stroke="#b45309"/><text x="30" y="565" text-anchor="start">Persona</text>
<rect x="86" y="556" width="13" height="11" rx="3" fill="#99f6e4" stroke="#0f766e"/><text x="104" y="565" text-anchor="start">Trigger</text>
<rect x="150" y="556" width="13" height="11" rx="3" fill="#bfdbfe" stroke="#1d4ed8"/><text x="168" y="565" text-anchor="start">View</text>
<rect x="210" y="556" width="13" height="11" rx="3" fill="#bbf7d0" stroke="#15803d"/><text x="228" y="565" text-anchor="start">Contract</text>
<rect x="290" y="556" width="13" height="11" rx="3" fill="#ddd6fe" stroke="#6d28d9"/><text x="308" y="565" text-anchor="start">Flow</text>
<rect x="345" y="556" width="13" height="11" rx="3" fill="#fecaca" stroke="#b91c1c"/><text x="363" y="565" text-anchor="start">Schema</text>
<rect x="420" y="556" width="13" height="11" rx="3" fill="#fed7aa" stroke="#c2410c"/><text x="438" y="565" text-anchor="start">Event</text>
<line x1="500" y1="562" x2="525" y2="562" stroke="#0f766e" stroke-width="1.8" stroke-dasharray="2 4"/><text x="531" y="565" text-anchor="start">triggers</text>
<line x1="600" y1="562" x2="625" y2="562" stroke="#9333ea" stroke-width="1.6" stroke-dasharray="5 4"/><text x="631" y="565" text-anchor="start">async / cross-component</text>
</g>
</svg>
File
README.md
Example: Helpdesk (multi-file, full v5 showcase)
A small support-ticket app that exercises every AIM v5.6 feature in one connected graph. It is intentionally split across files, because the point of the graph model is that the relation graph spans files — and you can still traverse, check, and diff it.
The single-file
nemicko.demo.todo.aimshows the basics in one file. This example shows the graph at scale.
The app
Requesters open support tickets from a form and track them. Agents work a shared table of all tickets, open one, and resolve it. Resolving a ticket emits an event that an asynchronous flow picks up to email the requester.
What it showcases
| Feature | Where |
|---|---|
| All seven facets | Record ×2, Contract ×3, Flow ×4, Persona ×2, View ×3, Event ×2, Trigger ×1 |
| Child intents + parent-as-index | submit/ and resolve/ under helpdesk.tickets; parent holds shared schema, personas, views |
| All ten typed edges | exposes, invokes, reads, mutates, emits, subscribes, accesses, navigates, triggers, refs |
| Non-actor entry point | Trigger: StaleSweep (cron) triggers Flow: EscalateStale — a scheduled sweep with no Persona or View |
| Upward resolution | child intents write [mutates](aim:#Record:Ticket) — Ticket resolves up to the parent |
| Cross-component edges | parent → child (...resolve#Contract:ResolveTicket) and → external (comms#Contract:SendEmail) |
| Dependencies + mapping | Imports/Requires in the parent; helpdesk.tickets.mapping.aim binds the Users capability |
| Intent↔code bindings | helpdesk.tickets.binding.aim maps nodes to file#symbol, route:, table:, topic: |
| A table view and a form view | View: TicketQueue (table) and View: SubmitForm (form) |
Layout
aim/
helpdesk.tickets/
helpdesk.tickets.aim # parent: index, shared User+Ticket, personas, views, notify + escalate flows, StaleSweep trigger, deps
helpdesk.tickets.mapping.aim # Users capability → company.identity (facet: mapping)
helpdesk.tickets.binding.aim # intent → code, raises the component to Level 3 (facet: binding)
submit/ helpdesk.tickets.submit.aim # SubmitForm + SubmitTicket + ExecuteSubmit + TicketSubmitted
resolve/ helpdesk.tickets.resolve.aim # ResolveTicket + ExecuteResolve + TicketResolved
comms/
comms.aim # SendEmail — the external capability the notify flow invokesThe graph
Every heading is a node; every [verb](aim:…) is a typed edge. Collected across the files, they form one graph (colored by facet type):
graph LR
classDef persona fill:#fde68a,stroke:#b45309,color:#3f2d00;
classDef view fill:#bfdbfe,stroke:#1d4ed8,color:#0b2559;
classDef contract fill:#bbf7d0,stroke:#15803d,color:#053019;
classDef flow fill:#ddd6fe,stroke:#6d28d9,color:#2a1065;
classDef schema fill:#fecaca,stroke:#b91c1c,color:#450a0a;
classDef event fill:#fed7aa,stroke:#c2410c,color:#431407;
classDef trigger fill:#99f6e4,stroke:#0f766e,color:#042f2e;
P_Req["Persona: Requester"]:::persona
P_Ag["Persona: Agent"]:::persona
V_Form["View: SubmitForm"]:::view
V_Queue["View: TicketQueue"]:::view
V_Detail["View: TicketDetail"]:::view
C_Sub["Contract: SubmitTicket"]:::contract
C_Res["Contract: ResolveTicket"]:::contract
C_Email["Contract: SendEmail"]:::contract
F_Sub["Flow: ExecuteSubmit"]:::flow
F_Res["Flow: ExecuteResolve"]:::flow
F_Notify["Flow: NotifyRequester"]:::flow
S_Ticket["Record: Ticket"]:::schema
S_User["Record: User"]:::schema
E_Sub["Event: TicketSubmitted"]:::event
E_Res["Event: TicketResolved"]:::event
F_Esc["Flow: EscalateStale"]:::flow
T_Sweep["Trigger: StaleSweep"]:::trigger
P_Req -->|accesses| V_Form
P_Req -->|accesses| V_Detail
P_Ag -->|accesses| V_Queue
P_Ag -->|accesses| V_Detail
V_Queue -->|reads| S_Ticket
V_Queue -->|navigates| V_Detail
V_Detail -->|reads| S_Ticket
V_Form -->|exposes| C_Sub
V_Detail -->|exposes| C_Res
C_Sub -->|invokes| F_Sub
C_Res -->|invokes| F_Res
F_Sub -->|mutates| S_Ticket
F_Sub -->|emits| E_Sub
F_Res -->|mutates| S_Ticket
F_Res -->|emits| E_Res
F_Notify -->|subscribes| E_Res
F_Notify -->|reads| S_Ticket
F_Notify -->|invokes| C_Email
S_Ticket -->|refs| S_User
T_Sweep -->|triggers| F_Esc
F_Esc -->|reads| S_Ticket
F_Esc -->|mutates| S_Ticket(The contracts also declare mutates/emits as their observable guarantees — the flows then realize them. The diagram shows the flow-level edges to keep the chain readable; both are in the .aim files.)
A standalone vector version of the same graph (facet columns, left-to-right) lives in graph.svg:
AIM helpdesk relation graph
Reading the graph
- Submit path:
RequesteraccessesSubmitForm, which exposesSubmitTicket; the contract invokesExecuteSubmit, which mutatesTicketand emitsTicketSubmitted. - Resolve + notify (the async hop):
AgentopensTicketDetail, which exposesResolveTicket→ invokesExecuteResolve→ mutatesTicket+ emitsTicketResolved. Separately,NotifyRequestersubscribes toTicketResolved, reads theTicket, and invokes the externalcomms.SendEmail. Nothing invokesNotifyRequester— it is entered by the event, which is exactly why event-driven flows are not orphans. - Scheduled, non-actor path:
StaleSweep(a cronTrigger) triggersEscalateStale, which reads and mutatesTicket. No Persona or View is involved — the Trigger is the entry point, so the flow has a real inbound edge instead of looking orphaned. (External webhooks model the same way.) - Impact analysis for free: changing
Record: Ticketreaches 12 nodes along inbound edges — both contracts, all four flows (incl. the notify and escalate flows), all three views, both personas, and theStaleSweeptrigger (transitively). That set is computed from the graph, not guessed. - Drift as graph-diff: because
helpdesk.tickets.binding.aimmaps nodes to code (SubmitTicket → src/tickets/submit.ts#submitTicket,Ticket → table:tickets,TicketResolved → topic:…), a Reviewer can diff this declared graph against the realized code graph and report precise, owner-routed findings.
For developers: packages, files and how to check them
AIM Core only
About this example
The single-file
nemicko.demo.todo.aimshows the basics in one file. This example shows the graph at scale.
The app#
Requesters open support tickets from a form and track them. Agents work a shared table of all tickets, open one, and resolve it. Resolving a ticket emits an event that an asynchronous flow picks up to email the requester.
What it showcases#
| Feature | Where |
|---|---|
| All seven facets | Record ×2, Contract ×3, Flow ×4, Persona ×2, View ×3, Event ×2, Trigger ×1 |
| Child intents + parent-as-index | submit/ and resolve/ under helpdesk.tickets; parent holds shared schema, personas, views |
| All ten typed edges | exposes, invokes, reads, mutates, emits, subscribes, accesses, navigates, triggers, refs |
| Non-actor entry point | Trigger: StaleSweep (cron) triggers Flow: EscalateStale — a scheduled sweep with no Persona or View |
| Upward resolution | child intents write [mutates](aim:#Record:Ticket) — Ticket resolves up to the parent |
| Cross-component edges | parent → child (...resolve#Contract:ResolveTicket) and → external (comms#Contract:SendEmail) |
| Dependencies + mapping | Imports/Requires in the parent; helpdesk.tickets.mapping.aim binds the Users capability |
| Intent↔code bindings | helpdesk.tickets.binding.aim maps nodes to file#symbol, route:, table:, topic: |
| A table view and a form view | View: TicketQueue (table) and View: SubmitForm (form) |
Layout#
aim/
helpdesk.tickets/
helpdesk.tickets.aim # parent: index, shared User+Ticket, personas, views, notify + escalate flows, StaleSweep trigger, deps
helpdesk.tickets.mapping.aim # Users capability → company.identity (facet: mapping)
helpdesk.tickets.binding.aim # intent → code, raises the component to Level 3 (facet: binding)
submit/ helpdesk.tickets.submit.aim # SubmitForm + SubmitTicket + ExecuteSubmit + TicketSubmitted
resolve/ helpdesk.tickets.resolve.aim # ResolveTicket + ExecuteResolve + TicketResolved
comms/
comms.aim # SendEmail — the external capability the notify flow invokes
The graph#
Every heading is a node; every [verb](aim:…) is a typed edge. Collected across the files, they form one graph (colored by facet type):
graph LR
classDef persona fill:#fde68a,stroke:#b45309,color:#3f2d00;
classDef view fill:#bfdbfe,stroke:#1d4ed8,color:#0b2559;
classDef contract fill:#bbf7d0,stroke:#15803d,color:#053019;
classDef flow fill:#ddd6fe,stroke:#6d28d9,color:#2a1065;
classDef schema fill:#fecaca,stroke:#b91c1c,color:#450a0a;
classDef event fill:#fed7aa,stroke:#c2410c,color:#431407;
classDef trigger fill:#99f6e4,stroke:#0f766e,color:#042f2e;
P_Req["Persona: Requester"]:::persona
P_Ag["Persona: Agent"]:::persona
V_Form["View: SubmitForm"]:::view
V_Queue["View: TicketQueue"]:::view
V_Detail["View: TicketDetail"]:::view
C_Sub["Contract: SubmitTicket"]:::contract
C_Res["Contract: ResolveTicket"]:::contract
C_Email["Contract: SendEmail"]:::contract
F_Sub["Flow: ExecuteSubmit"]:::flow
F_Res["Flow: ExecuteResolve"]:::flow
F_Notify["Flow: NotifyRequester"]:::flow
S_Ticket["Record: Ticket"]:::schema
S_User["Record: User"]:::schema
E_Sub["Event: TicketSubmitted"]:::event
E_Res["Event: TicketResolved"]:::event
F_Esc["Flow: EscalateStale"]:::flow
T_Sweep["Trigger: StaleSweep"]:::trigger
P_Req -->|accesses| V_Form
P_Req -->|accesses| V_Detail
P_Ag -->|accesses| V_Queue
P_Ag -->|accesses| V_Detail
V_Queue -->|reads| S_Ticket
V_Queue -->|navigates| V_Detail
V_Detail -->|reads| S_Ticket
V_Form -->|exposes| C_Sub
V_Detail -->|exposes| C_Res
C_Sub -->|invokes| F_Sub
C_Res -->|invokes| F_Res
F_Sub -->|mutates| S_Ticket
F_Sub -->|emits| E_Sub
F_Res -->|mutates| S_Ticket
F_Res -->|emits| E_Res
F_Notify -->|subscribes| E_Res
F_Notify -->|reads| S_Ticket
F_Notify -->|invokes| C_Email
S_Ticket -->|refs| S_User
T_Sweep -->|triggers| F_Esc
F_Esc -->|reads| S_Ticket
F_Esc -->|mutates| S_Ticket
(The contracts also declare mutates/emits as their observable guarantees — the flows then realize them. The diagram shows the flow-level edges to keep the chain readable; both are in the .aim files.)
A standalone vector version of the same graph (facet columns, left-to-right) lives in graph.svg:
Reading the graph#
- Submit path:
RequesteraccessesSubmitForm, which exposesSubmitTicket; the contract invokesExecuteSubmit, which mutatesTicketand emitsTicketSubmitted. - Resolve + notify (the async hop):
AgentopensTicketDetail, which exposesResolveTicket→ invokesExecuteResolve→ mutatesTicket+ emitsTicketResolved. Separately,NotifyRequestersubscribes toTicketResolved, reads theTicket, and invokes the externalcomms.SendEmail. Nothing invokesNotifyRequester— it is entered by the event, which is exactly why event-driven flows are not orphans. - Scheduled, non-actor path:
StaleSweep(a cronTrigger) triggersEscalateStale, which reads and mutatesTicket. No Persona or View is involved — the Trigger is the entry point, so the flow has a real inbound edge instead of looking orphaned. (External webhooks model the same way.) - Impact analysis for free: changing
Record: Ticketreaches 12 nodes along inbound edges — both contracts, all four flows (incl. the notify and escalate flows), all three views, both personas, and theStaleSweeptrigger (transitively). That set is computed from the graph, not guessed. - Drift as graph-diff: because
helpdesk.tickets.binding.aimmaps nodes to code (SubmitTicket → src/tickets/submit.ts#submitTicket,Ticket → table:tickets,TicketResolved → topic:…), a Reviewer can diff this declared graph against the realized code graph and report precise, owner-routed findings.