@alan-ai-hq/agent-manager-linux-arm64 0.1.199 → 0.1.200

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/alan-agent.cjs +8885 -5214
  2. package/alan-holder.cjs +5364 -3401
  3. package/alan-lease.cjs +808 -200
  4. package/builtin-skills/agent-desktop/SKILL.md +94 -0
  5. package/builtin-skills/alan-artifact/SKILL.md +128 -0
  6. package/builtin-skills/alan-artifact/examples/interactive-diagram.md +50 -0
  7. package/builtin-skills/alan-artifact/examples/prototype.md +53 -0
  8. package/builtin-skills/alan-artifact/examples/test-report.md +55 -0
  9. package/builtin-skills/alan-artifact/references/design.md +39 -0
  10. package/builtin-skills/alan-artifact/references/diagrams.md +20 -0
  11. package/builtin-skills/alan-deck/SKILL.md +189 -0
  12. package/builtin-skills/alan-diagrams/SKILL.md +105 -0
  13. package/builtin-skills/alan-diagrams/references/diagram-catalogue.md +847 -0
  14. package/builtin-skills/alan-docs/SKILL.md +143 -0
  15. package/builtin-skills/alan-docs/references/administration/members-and-teams.md +48 -0
  16. package/builtin-skills/alan-docs/references/administration/org-dashboard.md +19 -0
  17. package/builtin-skills/alan-docs/references/administration/organisation-settings.md +41 -0
  18. package/builtin-skills/alan-docs/references/agents-and-sessions/code-context.md +60 -0
  19. package/builtin-skills/alan-docs/references/agents-and-sessions/coding-agents-and-models.md +78 -0
  20. package/builtin-skills/alan-docs/references/agents-and-sessions/session-lifecycle.md +62 -0
  21. package/builtin-skills/alan-docs/references/agents-and-sessions/start-a-session.md +110 -0
  22. package/builtin-skills/alan-docs/references/automations/automation-runs.md +69 -0
  23. package/builtin-skills/alan-docs/references/automations/create-an-automation.md +143 -0
  24. package/builtin-skills/alan-docs/references/automations/overview.md +77 -0
  25. package/builtin-skills/alan-docs/references/cloud-and-local/cloud-images.md +64 -0
  26. package/builtin-skills/alan-docs/references/cloud-and-local/cloud-sessions-and-execution.md +89 -0
  27. package/builtin-skills/alan-docs/references/cloud-and-local/cloud-setup.md +128 -0
  28. package/builtin-skills/alan-docs/references/cloud-and-local/codex-cli-connector.md +92 -0
  29. package/builtin-skills/alan-docs/references/cloud-and-local/local-execution.md +213 -0
  30. package/builtin-skills/alan-docs/references/cloud-and-local/runtime-recovery.md +60 -0
  31. package/builtin-skills/alan-docs/references/cloud-and-local/sandboxes.md +74 -0
  32. package/builtin-skills/alan-docs/references/cloud-and-local/troubleshooting-and-faq.md +102 -0
  33. package/builtin-skills/alan-docs/references/get-started/connect-azure-devops.md +89 -0
  34. package/builtin-skills/alan-docs/references/get-started/connect-bitbucket.md +86 -0
  35. package/builtin-skills/alan-docs/references/get-started/connect-github.md +114 -0
  36. package/builtin-skills/alan-docs/references/get-started/join-a-team.md +114 -0
  37. package/builtin-skills/alan-docs/references/get-started/product-map.md +96 -0
  38. package/builtin-skills/alan-docs/references/get-started/quickstart.md +158 -0
  39. package/builtin-skills/alan-docs/references/get-started/set-up-your-team.md +200 -0
  40. package/builtin-skills/alan-docs/references/get-started/sign-in.md +104 -0
  41. package/builtin-skills/alan-docs/references/get-started/welcome.md +39 -0
  42. package/builtin-skills/alan-docs/references/integrations/connect-microsoft-teams.md +116 -0
  43. package/builtin-skills/alan-docs/references/integrations/connect-slack.md +164 -0
  44. package/builtin-skills/alan-docs/references/integrations/import-from-linear.md +172 -0
  45. package/builtin-skills/alan-docs/references/plans-and-billing/plans-and-limits.md +115 -0
  46. package/builtin-skills/alan-docs/references/plans-and-billing/usage-and-credits.md +47 -0
  47. package/builtin-skills/alan-docs/references/reference/documents-and-artifacts.md +52 -0
  48. package/builtin-skills/alan-docs/references/reference/faq.md +89 -0
  49. package/builtin-skills/alan-docs/references/reference/feature-catalog.md +89 -0
  50. package/builtin-skills/alan-docs/references/reference/glossary.md +96 -0
  51. package/builtin-skills/alan-docs/references/reference/links-and-ids.md +80 -0
  52. package/builtin-skills/alan-docs/references/reference/roles-and-permissions.md +64 -0
  53. package/builtin-skills/alan-docs/references/reference/statuses.md +86 -0
  54. package/builtin-skills/alan-docs/references/reviews-testing-deploys/deployments.md +28 -0
  55. package/builtin-skills/alan-docs/references/reviews-testing-deploys/pull-requests.md +85 -0
  56. package/builtin-skills/alan-docs/references/reviews-testing-deploys/review-work.md +55 -0
  57. package/builtin-skills/alan-docs/references/reviews-testing-deploys/testing-evidence.md +52 -0
  58. package/builtin-skills/alan-docs/references/skills/plugins-and-mcp.md +24 -0
  59. package/builtin-skills/alan-docs/references/skills/skills.md +103 -0
  60. package/builtin-skills/alan-docs/references/tasks/complete-a-task.md +79 -0
  61. package/builtin-skills/alan-docs/references/tasks/create-a-task.md +67 -0
  62. package/builtin-skills/alan-docs/references/tasks/subtasks-and-status.md +55 -0
  63. package/builtin-skills/alan-docs/references/tasks/task-artifacts.md +56 -0
  64. package/builtin-skills/alan-docs/references/tasks/task-detail.md +65 -0
  65. package/builtin-skills/alan-docs/references/teams-and-planning/cycles.md +93 -0
  66. package/builtin-skills/alan-docs/references/teams-and-planning/documents.md +66 -0
  67. package/builtin-skills/alan-docs/references/teams-and-planning/epics.md +95 -0
  68. package/builtin-skills/alan-docs/references/teams-and-planning/whiteboard.md +52 -0
  69. package/builtin-skills/alan-docs/references/troubleshooting/agent-blocked.md +38 -0
  70. package/builtin-skills/alan-docs/references/troubleshooting/common-problems.md +118 -0
  71. package/builtin-skills/alan-docs/references/troubleshooting/github-access.md +41 -0
  72. package/builtin-skills/alan-docs/references/troubleshooting/missing-artifact.md +47 -0
  73. package/builtin-skills/alan-docs/references/troubleshooting/report-an-issue.md +74 -0
  74. package/builtin-skills/alan-docs/references/troubleshooting/runtime-unavailable.md +49 -0
  75. package/builtin-skills/alan-docs/scripts/generate-references.mjs +363 -0
  76. package/builtin-skills/alan-environment-setup/SKILL.md +320 -0
  77. package/builtin-skills/alan-environment-setup/references/android.md +118 -0
  78. package/builtin-skills/alan-environment-setup/references/troubleshooting.md +33 -0
  79. package/builtin-skills/alan-skill-authoring/SKILL.md +83 -0
  80. package/builtin-skills/alan-tasks/SKILL.md +195 -0
  81. package/builtin-skills/alan-test-android/SKILL.md +224 -0
  82. package/builtin-skills/alan-test-android/scripts/android-up.sh +227 -0
  83. package/builtin-skills/alan-test-android/scripts/install-launch.sh +38 -0
  84. package/builtin-skills/alan-test-android/scripts/record.sh +64 -0
  85. package/builtin-skills/alan-test-android/scripts/ui.py +367 -0
  86. package/builtin-skills/alan-test-desktop/SKILL.md +107 -0
  87. package/builtin-skills/alan-test-desktop/references/linux-recording.md +31 -0
  88. package/builtin-skills/alan-test-feature/SKILL.md +243 -0
  89. package/builtin-skills/alan-test-mobile/SKILL.md +65 -0
  90. package/builtin-skills/alan-test-web/SKILL.md +113 -0
  91. package/builtin-skills/alan-walkthrough/SKILL.md +152 -0
  92. package/builtin-skills/alan-walkthrough/scripts/mark-changes.js +419 -0
  93. package/builtin-skills/alan-walkthrough/scripts/publish-capture.mjs +288 -0
  94. package/builtin-skills/alan-workflows/SKILL.md +235 -0
  95. package/builtin-skills/manifest.json +19 -0
  96. package/package.json +3 -2
@@ -0,0 +1,847 @@
1
+ # Diagram catalogue
2
+
3
+ Every diagram type Alan renders, with the job it does, a starter that shows its
4
+ most useful features, and the mistakes that break or mislead it. Alan draws
5
+ ` ```mermaid ` fences with pele 1.6.0, which reads Mermaid 12.1 syntax. Every
6
+ fence in this file renders at full and phone width. Read [the skill](../SKILL.md)
7
+ first for what to draw; use this file for how.
8
+
9
+ Rules that hold for every type:
10
+
11
+ - Quote any label that contains `()[]{}:;#|` or starts with a keyword: `A["Run tests (unit)"]`, `-->|"retry (3x)"|`.
12
+ - Keep the `-beta` suffix where the keyword has one (`architecture-beta`, `treeView-beta`, `radar-beta`, `swimlane-beta`, `agentflow-beta`, `venn-beta`, `cynefin-beta`, `wardley-beta`, `usecase-beta`, `railroad-*-beta`). Without it the fence errors.
13
+ - Labels take `<br/>`, `<b>`, `<i>` and backtick markdown strings (`` "`**bold**`" ``); every other HTML tag is stripped.
14
+ - `style`, `classDef`, `linkStyle`, `rect` colours, C4 `Update*Style` and `%%{init}%%` themes are fixed colours that ignore dark mode. Leave them out; Alan themes every diagram.
15
+ - Icons need a resolver Alan does not pass: `fa:fa-car`, `::icon(...)`, `logos:...` and treeView `showIcons` draw nothing. Only the architecture built-ins (`cloud`, `database`, `disk`, `internet`, `server`) draw.
16
+ - `click` with a URL works (http, https, mailto, tel); callbacks are ignored.
17
+ - Wide diagrams scale down to the container, so text shrinks on a phone. Above about 8 nodes across, prefer a top-to-bottom direction.
18
+ - `accTitle:` and `accDescr:` work in most types and become the SVG's accessible name.
19
+ - ZenUML is not supported (`unsupported-diagram`).
20
+
21
+ ## Contents
22
+
23
+ | Group | Types |
24
+ |---|---|
25
+ | Structure and behaviour | flowchart, sequence, class, state, entity relationship, architecture, C4, block, swimlane, agentflow, event modeling, requirement, use case |
26
+ | Code, history and time | git graph, gantt, timeline, tree view, packet, railroad |
27
+ | Analysis and metrics | ishikawa, quadrant, radar, xy chart, pie, sankey, treemap, mindmap, kanban, user journey |
28
+ | Rarely the right call | cynefin, wardley, venn, info |
29
+
30
+ ## Structure and behaviour
31
+
32
+ ### Flowchart: `flowchart TD|LR|BT|RL` (alias `graph`)
33
+
34
+ Pick it for decision logic or a small pipeline, when no more specific type fits.
35
+ Subgraphs group a stage, `direction` inside a subgraph lays that stage out on its
36
+ own axis, and `@{ shape: ... }` picks from Mermaid's 50+ semantic shapes.
37
+
38
+ ```mermaid
39
+ flowchart LR
40
+ user([Engineer]) --> send[Send message]
41
+ send --> online{Runtime online?}
42
+ online -->|yes| deliver[Deliver turn]
43
+ online -->|"no (queued)"| queue[(Message queue)]
44
+ subgraph wake [Wake path]
45
+ direction TB
46
+ queue --> boot@{ shape: delay, label: "Boot sandbox" }
47
+ boot --> healthy@{ shape: diam, label: "Healthy?" }
48
+ end
49
+ healthy -->|yes| deliver
50
+ healthy -.->|"no, retry 3x"| boot
51
+ deliver ==> transcript@{ shape: doc, label: "Transcript" }
52
+ ```
53
+
54
+ - Edges: `-->` arrow, `---` line, `-.->` dotted, `==>` thick, `--o` / `--x` circle and cross ends, `<-->` both ways, `~~~` invisible (layout only), `a & b --> c` fans out.
55
+ - Classic shapes: `[rect]`, `(rounded)`, `([stadium])`, `[[subroutine]]`, `[(cylinder)]`, `((circle))`, `{diamond}`, `{{hexagon}}`, `>flag]`, `[/lean/]`, `[/trapezoid\]`, `(((double circle)))`.
56
+ - Useful `@{ shape: }` names: `doc`, `docs`, `cyl`, `lin-cyl`, `h-cyl`, `datastore`, `bucket`, `delay`, `st-rect` (several workers), `fr-rect` (subprocess), `browser`, `console`, `cloud`, `folder`, `person`, `brace` (comment), `text`.
57
+ - `fork`, `hourglass`, `bolt`, `f-circ`, `sm-circ`, `fr-circ` and `cross-circ` draw no label even when given one, as in Mermaid.
58
+ - `end` (lowercase) is not a node id: `done[end]` works, `a --> end` fails.
59
+ - Below 640px wide an `LR` chart can turn top-to-bottom; that is pele's phone layout.
60
+
61
+ ### Sequence: `sequenceDiagram`
62
+
63
+ Pick it for who calls whom, in what order: request lifecycles, retries, auth
64
+ handshakes, queue hand-offs.
65
+
66
+ ```mermaid
67
+ sequenceDiagram
68
+ autonumber
69
+ actor U as Engineer
70
+ box Alan
71
+ participant W as Web
72
+ participant A as API
73
+ end
74
+ participant Q@{ "type": "queue" } as Jobs
75
+ participant R as Runtime
76
+ U->>W: Send message
77
+ W->>+A: POST /messages
78
+ alt runtime online
79
+ A->>+R: deliver(turn)
80
+ R-->>-A: accepted
81
+ else runtime offline
82
+ A-)Q: enqueue
83
+ Note right of Q: replayed on reconnect
84
+ end
85
+ A-->>-W: 202
86
+ loop each delta
87
+ R--)W: stream text
88
+ end
89
+ critical persist transcript
90
+ W->>A: PUT /transcript
91
+ option conflict
92
+ A--xW: 409
93
+ end
94
+ ```
95
+
96
+ - Arrows: `->>` call, `-->>` reply, `-)` / `--)` async, `-x` / `--x` lost or rejected, `<<->>` both ways.
97
+ - `+` / `-` on an arrow (or `activate` / `deactivate`) draws the activation bar; every `+` needs a matching `-`.
98
+ - Blocks: `alt`/`else`, `opt`, `loop`, `par`/`and`, `critical`/`option`, `break`, `rect` (highlight), `box Name` (participant group).
99
+ - Participant symbols: `participant X@{ "type": "database" }` (also `queue`, `boundary`, `control`, `entity`, `collections`), `actor` for people, `create participant` / `destroy` for short-lived workers.
100
+ - `;` in a message ends the statement and is a syntax error; write `#59;` or rephrase. Colons and paths like `/a/:id` are fine.
101
+ - `autonumber 10 5` starts at 10 and steps by 5. `link` / `links` menus parse but draw nothing.
102
+
103
+ ### Class: `classDiagram`
104
+
105
+ Pick it for interfaces, ports and adapters, type hierarchies and module contracts.
106
+
107
+ ```mermaid
108
+ classDiagram
109
+ direction LR
110
+ class MemoryProvider~T~ {
111
+ <<interface>>
112
+ +search(query string) T[]
113
+ +ingest(doc T) void
114
+ }
115
+ class ProviderRegistry {
116
+ -providers Map~string, MemoryProvider~
117
+ +resolve(teamId string)$ MemoryProvider
118
+ }
119
+ class SupermemoryAdapter
120
+ class MaximemAdapter
121
+ class SyncStatus {
122
+ <<enumeration>>
123
+ QUEUED
124
+ SYNCED
125
+ }
126
+ MemoryProvider <|.. SupermemoryAdapter
127
+ MemoryProvider <|.. MaximemAdapter
128
+ ProviderRegistry "1" o-- "*" MemoryProvider : selects
129
+ SupermemoryAdapter ..> SyncStatus : reports
130
+ note for ProviderRegistry "core never imports adapters"
131
+ ```
132
+
133
+ - Generics: `Repo~T~` draws `Repo<T>`; nested commas work (`Map~string, T~`).
134
+ - Annotations: `<<interface>>`, `<<abstract>>`, `<<enumeration>>`, `<<service>>`.
135
+ - Visibility `+ - # ~`; `$` after a member is static, `*` is abstract.
136
+ - Relations: `<|--` inheritance, `<|..` realization, `*--` composition, `o--` aggregation, `-->` association, `..>` dependency, `--` link. Cardinality goes in quotes on either side.
137
+ - `namespace Name { class A }` groups classes; `note for X "..."` attaches a note.
138
+
139
+ ### State: `stateDiagram-v2`
140
+
141
+ Pick it for lifecycles and status transitions: sessions, tasks, sandboxes, PRs.
142
+
143
+ ```mermaid
144
+ stateDiagram-v2
145
+ direction LR
146
+ state check <<choice>>
147
+ [*] --> Provisioning
148
+ Provisioning --> check
149
+ check --> Running : healthy
150
+ check --> Failed : start timeout
151
+ state Running {
152
+ direction TB
153
+ [*] --> Idle
154
+ Idle --> Busy : turn
155
+ Busy --> Idle : done
156
+ }
157
+ Running --> Paused : idle 30 min
158
+ Paused --> Running : resume
159
+ state teardown <<fork>>
160
+ state released <<join>>
161
+ Running --> teardown : stop
162
+ teardown --> UploadLogs
163
+ teardown --> ReleaseVM
164
+ UploadLogs --> released
165
+ ReleaseVM --> released
166
+ released --> Stopped
167
+ note right of Paused : memory snapshot kept 7 days
168
+ Stopped --> [*]
169
+ Failed --> [*]
170
+ ```
171
+
172
+ - Composite states nest with `state Name { ... }`; a nested `direction` applies to that box.
173
+ - `<<choice>>`, `<<fork>>` and `<<join>>` are pseudo-states. Declare them before the first transition that names them; a state used first and declared later stays an ordinary box.
174
+ - Concurrent regions: separate them with `--` on its own line inside a composite state.
175
+ - `state "Waiting for input" as waiting` gives a long display name; `s1 : description` adds a description.
176
+ - Notes: `note right of X : text`, or a multi-line `note left of X` ... `end note`.
177
+
178
+ ### Entity relationship: `erDiagram`
179
+
180
+ Pick it for tables, keys and cardinality in a schema change.
181
+
182
+ ```mermaid
183
+ erDiagram
184
+ direction LR
185
+ TEAM ||--o{ TASK : owns
186
+ TASK ||--o{ CONVERSATION : has
187
+ TASK }o--o{ LABEL : "tagged with"
188
+ CONVERSATION ||--o{ ARTIFACT : produces
189
+ TASK {
190
+ uuid id PK
191
+ uuid team_id FK
192
+ varchar(255) title "shown in UI"
193
+ timestamp deleted_at "soft delete"
194
+ }
195
+ ARTIFACT {
196
+ uuid id PK
197
+ uuid conversation_id FK
198
+ text slug UK
199
+ }
200
+ LABEL["team label"] {
201
+ uuid id PK
202
+ text name
203
+ }
204
+ ```
205
+
206
+ - Cardinality: `|o` zero or one, `||` exactly one, `}o` zero or more, `}|` one or more. `--` is identifying, `..` non-identifying. Word forms (`one or more`, `0+`, `only one`) also work.
207
+ - Keys: `PK`, `FK`, `UK`, combined as `PK, FK`. A trailing quoted string is a column comment.
208
+ - An attribute name cannot be a quoted string (`text "display name"` fails); quote only the comment.
209
+ - Aliases go on the entity declaration (`LABEL["team label"] { ... }`, or bare `p["Person"]`), never inside a relationship line: `p["Person"] ||--o{ ...` fails.
210
+ - Quote an entity name with spaces in relationships: `TEAM ||--o{ "user account" : employs`.
211
+
212
+ ### Architecture: `architecture-beta`
213
+
214
+ Pick it for deploy or service topology with groups: what runs where.
215
+
216
+ ```mermaid
217
+ architecture-beta
218
+ group edge(cloud)[Edge]
219
+ group core(server)[GCP VM]
220
+ group data(database)[Data]
221
+ service web(internet)[Web app] in edge
222
+ service api(server)[API] in core
223
+ service worker(server)[Worker] in core
224
+ junction fan in core
225
+ service db(database)[Postgres] in data
226
+ service blob(disk)[Object store] in data
227
+ web:R -[HTTPS]-> L:api
228
+ api:R -- L:fan
229
+ worker:T -- B:fan
230
+ fan:R -[SQL]-> L:db
231
+ worker:R -[uploads]-> L:blob
232
+ align column api worker
233
+ align column db blob
234
+ ```
235
+
236
+ - Every edge names a side on both ends (`api:R --> L:db`, sides `T B L R`); `api --> db` is a syntax error.
237
+ - Edge labels: `a:R -[writes]-> L:b`. Arrowheads: `-->`, `<--`, `<-->`, or plain `--`.
238
+ - `junction` merges several edges into one. `align row a b` / `align column a b` pin positions; add them when an edge crosses a service it does not touch.
239
+ - Groups nest with `in`; `a{group}:B --> T:b{group}` draws the edge from the group box.
240
+ - Built-in icons are `cloud`, `database`, `disk`, `internet`, `server`. Any other name (`queue`, `logos:aws-s3`) draws an empty box with no error.
241
+
242
+ ### C4: `C4Context`, `C4Container`, `C4Component`, `C4Dynamic`, `C4Deployment`
243
+
244
+ Pick it for system boundaries with labelled, protocol-tagged relationships. Use
245
+ `C4Context` for the system in its world, `C4Container` for deployable units,
246
+ `C4Component` inside one container, `C4Dynamic` for numbered calls and
247
+ `C4Deployment` for hosts.
248
+
249
+ ```mermaid
250
+ C4Container
251
+ title Alan containers
252
+ Person(eng, "Engineer")
253
+ System_Boundary(alan, "Alan") {
254
+ Container(web, "Web app", "React", "Chat, tasks, docs")
255
+ Container(api, "API", "Fastify", "REST and MCP")
256
+ ContainerQueue(jobs, "Jobs", "BullMQ")
257
+ ContainerDb(db, "Postgres", "SQL")
258
+ }
259
+ System_Ext(sandbox, "Cloud sandbox", "Runs the agent")
260
+ Rel(eng, web, "Uses", "HTTPS")
261
+ Rel(web, api, "Calls", "JSON")
262
+ Rel(api, jobs, "Enqueues")
263
+ Rel(api, db, "Reads and writes")
264
+ BiRel(api, sandbox, "Turns and events", "WebSocket")
265
+ ```
266
+
267
+ ```mermaid
268
+ C4Deployment
269
+ title Production hosts
270
+ Deployment_Node(gcp, "GCP", "us-central1") {
271
+ Deployment_Node(vm, "API VM", "Ubuntu, Docker") {
272
+ Container(api, "API", "Node 22")
273
+ }
274
+ }
275
+ Deployment_Node(daytona, "Daytona", "Sandbox cloud") {
276
+ Container(sandbox, "Sandbox", "alan-agent")
277
+ }
278
+ Rel(api, sandbox, "Delivers turns", "WebSocket")
279
+ ```
280
+
281
+ - Elements: `Person`, `System`, `SystemDb`, `SystemQueue`, `Container`, `ContainerDb`, `ContainerQueue`, `Component`, each with an `_Ext` form. Boundaries: `Enterprise_Boundary`, `System_Boundary`, `Container_Boundary`, `Boundary`, `Deployment_Node`.
282
+ - Relations: `Rel`, `BiRel`, `Rel_U|D|L|R`, `Rel_Back`. The fourth argument is the protocol.
283
+ - `UpdateLayoutConfig($c4ShapeInRow="2")` controls wrapping; leave `UpdateElementStyle` and `UpdateRelStyle` out (fixed colours).
284
+ - C4 is wide; at phone width it stacks and scales down.
285
+
286
+ ### Block: `block` (alias `block-beta`)
287
+
288
+ Pick it for layered stacks and package layering, where position carries the meaning.
289
+
290
+ ```mermaid
291
+ block
292
+ columns 3
293
+ web["Web app"] pwa["Mobile PWA"] desktop["Desktop"]
294
+ hooks["packages/api-hooks"]:3
295
+ block:core:2
296
+ columns 2
297
+ ui["packages/ui"] shared["packages/shared"]
298
+ end
299
+ db[("Postgres")]
300
+ down<["reads"]>(down):3
301
+ api{{"apps/api"}}:3
302
+ ui --> shared
303
+ ```
304
+
305
+ - `columns N` sets the grid; `id:N` spans N columns; `space` / `space:N` leaves gaps.
306
+ - `block:id:N ... end` nests a group with its own `columns`.
307
+ - Block arrows: `id<["label"]>(right|left|up|down|x|y)`.
308
+ - Shapes follow flowchart syntax (`[( )]`, `(( ))`, `{{ }}`); edges `a --> b` and `a-- "label" -->b` draw over the grid.
309
+
310
+ ### Swimlane: `swimlane-beta LR|TB`
311
+
312
+ Pick it for a process that crosses owners: engineer, agent, CI, reviewer.
313
+
314
+ ```mermaid
315
+ swimlane-beta LR
316
+ subgraph eng [Engineer]
317
+ ask[Request change]
318
+ review[Review PR]
319
+ end
320
+ subgraph agent [Agent]
321
+ plan[Write plan]
322
+ build[Implement and test]
323
+ end
324
+ subgraph ci [CI]
325
+ checks{Checks pass?}
326
+ end
327
+ ask --> plan --> build --> checks
328
+ checks -->|yes| review
329
+ checks -->|no| build
330
+ ```
331
+
332
+ - Each `subgraph` is a lane; `subgraph id [Display name]` names it. Nodes use flowchart shapes and edges.
333
+ - On a phone the lanes turn into columns and the flow runs downward.
334
+
335
+ ### Agentflow: `agentflow-beta LR|TB`
336
+
337
+ Pick it for an agent or workflow pipeline that shows which tools and references
338
+ each step uses.
339
+
340
+ ```mermaid
341
+ agentflow-beta LR
342
+ task["Task description"]@{ shape: input }
343
+ flow planner["Planner"]
344
+ plan["create_plan"]@{ shape: tool }
345
+ rules["AGENTS.md"]@{ shape: refdoc }
346
+ plan -.- rules
347
+ end
348
+ flow builder["Builder"]
349
+ code["Edit and test"]@{ shape: task }
350
+ green["Checks green?"]@{ shape: decision }
351
+ code --> green
352
+ end
353
+ pr["gh pr create"]@{ shape: action }
354
+ task --> plan --> code
355
+ green -- yes --> pr
356
+ green -- no --> code
357
+ ```
358
+
359
+ - Shapes: `input`, `task`, `tool`, `decision`, `action`, `refdoc`. `-.-` links a reference document.
360
+ - `flow id["Agent"] ... end` boxes one agent's steps; flows nest, and `global ... end` holds shared references.
361
+ - `id@{ view: "collapsed" }` folds a flow; `connector id["API"]` with `@{ protocol, endpoint }` documents an external API.
362
+
363
+ ### Event modeling: `eventmodeling`
364
+
365
+ Pick it for event-sourced or queue flows: which screen issues which command,
366
+ which event it records, which processor reacts.
367
+
368
+ ```mermaid
369
+ eventmodeling
370
+ tf 01 ui Composer
371
+ tf 02 cmd SendMessage [[SendMessage]]
372
+ tf 03 evt MessageQueued
373
+ tf 04 pcr Deliverer
374
+ tf 05 evt MessageDelivered
375
+ tf 06 rmo Thread ->> 05
376
+ data SendMessage {
377
+ conversationId: uuid
378
+ text: string
379
+ }
380
+ ```
381
+
382
+ - Frames: `tf NN <kind> Name` (or `timeframe`); kinds `ui`, `cmd`/`command`, `evt`/`event`, `pcr`/`processor`, `rmo` (read model).
383
+ - `rf` (`resetframe`) starts a new swimlane row; `->> NN` links a read model to the frames it reads.
384
+ - `[[Name]]` references a `data Name { ... }` block; `{ field: type }` inlines a schema.
385
+
386
+ ### Requirement: `requirementDiagram`
387
+
388
+ Pick it for invariants a change must satisfy and the element that verifies each.
389
+
390
+ ```mermaid
391
+ requirementDiagram
392
+ requirement isolation {
393
+ id: 1
394
+ text: Staging never deletes prod sandboxes
395
+ risk: high
396
+ verifymethod: test
397
+ }
398
+ functionalRequirement scoped {
399
+ id: 1.1
400
+ text: Sweep filters by deployment tag
401
+ risk: medium
402
+ verifymethod: inspection
403
+ }
404
+ element sweep {
405
+ type: worker
406
+ docref: "apps/api/src/workers/sandbox-sweep.ts"
407
+ }
408
+ element sweepTest {
409
+ type: vitest
410
+ }
411
+ scoped - derives -> isolation
412
+ sweep - satisfies -> scoped
413
+ sweepTest - verifies -> scoped
414
+ ```
415
+
416
+ - Requirement kinds: `requirement`, `functionalRequirement`, `interfaceRequirement`, `performanceRequirement`, `physicalRequirement`, `designConstraint`.
417
+ - `risk`: `low`, `medium`, `high`. `verifymethod`: `analysis`, `inspection`, `test`, `demonstration`.
418
+ - Relations: `contains`, `copies`, `derives`, `satisfies`, `verifies`, `refines`, `traces`.
419
+ - Quote any value with a hyphen (`text: "prod-tagged sandboxes"`, `docref: "a/b-c.ts"`); unquoted, the `-` is read as a relation and fails.
420
+ - Every `element` needs a `{ ... }` body; a bare `element e` is a syntax error. `direction LR` is accepted.
421
+
422
+ ### Use case: `usecase-beta`
423
+
424
+ Pick it for who can do what in a product boundary, for example permissions per role.
425
+
426
+ ```mermaid
427
+ usecase-beta
428
+ direction LR
429
+ actor Eng("Engineer")
430
+ actor Bot("CI")@{ type: hollow }
431
+ systemBoundary "Alan"
432
+ Plan("Plan task")
433
+ Ship("Open PR")
434
+ Check("Run checks")
435
+ end
436
+ Eng --> Plan
437
+ Eng --> Ship
438
+ Bot --> Check
439
+ Ship ..> : include Check
440
+ ```
441
+
442
+ - `actor id("Name")`; `@{ type: hollow }` marks a system actor. Use cases are `Id("Label")`.
443
+ - `systemBoundary "Name" ... end` draws the product box. `..> : include X` and `..> : extend X` draw the UML relations.
444
+
445
+ ## Code, history and time
446
+
447
+ ### Git graph: `gitGraph` (`gitGraph LR:`, `TB:`, `BT:`)
448
+
449
+ Pick it for branching strategy, back-merges, cherry-picks and release tags.
450
+
451
+ ```mermaid
452
+ gitGraph
453
+ commit id: "base"
454
+ branch feat/runtime-v2
455
+ checkout feat/runtime-v2
456
+ commit id: "driver"
457
+ commit id: "flaky test" type: REVERSE
458
+ checkout main
459
+ commit id: "hotfix" type: HIGHLIGHT
460
+ checkout feat/runtime-v2
461
+ merge main
462
+ commit id: "tests"
463
+ checkout main
464
+ merge feat/runtime-v2 tag: "v1.4.0"
465
+ branch release/1.4
466
+ cherry-pick id: "hotfix"
467
+ ```
468
+
469
+ - `commit id: "..." tag: "..." type: NORMAL|REVERSE|HIGHLIGHT`; quote ids with spaces.
470
+ - `branch name order: N` fixes lane order; `checkout` and `switch` are the same.
471
+ - `merge` of a branch that was never created is a semantic error. `cherry-pick` needs an existing commit id from another branch.
472
+ - Unnamed commits get generated ids; name the ones the reader needs.
473
+
474
+ ### Gantt: `gantt`
475
+
476
+ Pick it for a rollout or migration schedule with dependencies and a critical path.
477
+
478
+ ```mermaid
479
+ gantt
480
+ title Runtime v2 rollout
481
+ dateFormat YYYY-MM-DD
482
+ axisFormat %b %d
483
+ excludes weekends
484
+ section Build
485
+ Driver rewrite :done, drv, 2026-10-01, 5d
486
+ Conformance tests :active, conf, after drv, 4d
487
+ section Ship
488
+ Staging soak :soak, after conf, 3d
489
+ Production cutover :crit, cut, after soak, 1d
490
+ Cutover done :milestone, after cut, 0d
491
+ ```
492
+
493
+ - Task tags: `done`, `active`, `crit`, `milestone` (zero length), combined with commas before the id.
494
+ - Starts: a date, `after id` (or `after a b`), or nothing (follows the previous task). The first task needs a real start: `A :a1, 3d` fails because `a1` is read as a date.
495
+ - Ends: a length (`3d`, `1w`) or `until id` / an end date.
496
+ - `excludes weekends` (and `weekend friday`), `tickInterval 1week`, `todayMarker off`, `topAxis`, `vert` markers all work.
497
+ - Without `todayMarker off` the marker follows today's date, so an old plan shows a line past its end.
498
+
499
+ ### Timeline: `timeline`
500
+
501
+ Pick it for incident timelines, roadmaps by quarter and release history.
502
+
503
+ ```mermaid
504
+ timeline
505
+ title Checkout outage, 2026-10-17 (UTC)
506
+ section Detect
507
+ 14#58;02 : 5xx alert fires
508
+ 14#58;10 : On-call acks : rollback starts
509
+ section Recover
510
+ 14#58;25 : Rollback complete
511
+ 14#58;40 : Error rate back to baseline
512
+ ```
513
+
514
+ - A period cannot contain `:`; `14:02 : alert` is a syntax error even when quoted. Write `14.02`, `14h02`, or `14#58;02` (draws `14:02`). Colons inside event text are fine.
515
+ - `period : event : event` puts several events under one period; a line starting with `:` adds another.
516
+ - `section` groups periods; `timeline TD` stacks vertically.
517
+
518
+ ### Tree view: `treeView-beta`
519
+
520
+ Pick it for the files a plan adds or changes, or a repo layout.
521
+
522
+ ```mermaid
523
+ treeView-beta
524
+ packages/ui/src/
525
+ components/markdown/
526
+ pele-diagram.tsx ## shared renderer
527
+ Markdown.tsx
528
+ styles/
529
+ pele-theme.css :::highlight ## new file
530
+ package.json
531
+ ```
532
+
533
+ - Indent by a fixed step; a trailing `/` marks a folder.
534
+ - `## text` adds a description, `:::highlight` marks an entry.
535
+ - The `├──` / `└──` box-drawing form also parses, so `tree` output can be pasted as is.
536
+
537
+ ### Packet: `packet` (alias `packet-beta`)
538
+
539
+ Pick it for wire frames, binary headers and bit-field layouts.
540
+
541
+ ```mermaid
542
+ packet
543
+ title Runtime frame header
544
+ 0-3: "Version"
545
+ 4-7: "Type"
546
+ 8-15: "Flags"
547
+ +16: "Payload length"
548
+ 32-63: "Sequence"
549
+ ```
550
+
551
+ - Fields are `start-end: "Label"`, a single bit `n: "Label"`, or `+N: "Label"` for the next N bits.
552
+ - 32 bits per row; frontmatter `packet: { bitsPerRow: 16 }` changes it.
553
+
554
+ ### Railroad: `railroad-ebnf-beta`, `railroad-abnf-beta`, `railroad-peg-beta`, `railroad-beta`
555
+
556
+ Pick it for CLI argument grammar, a DSL or a config syntax.
557
+
558
+ ```mermaid
559
+ railroad-ebnf-beta
560
+ title "alan-agent CLI"
561
+ command = "alan-agent" ( "start" | "stop" | "status" ) [ "--json" ] { flag } ;
562
+ flag = "--" name [ "=" value ] ;
563
+ ```
564
+
565
+ - EBNF: `|` choice, `[ ]` optional, `{ }` or `( )*` repeat, `?` optional, `+` one or more, `;` ends a rule.
566
+ - ABNF uses `/` and `*( )`, PEG uses `<-` and `/`. `railroad-beta` takes a function DSL (`sequence(...)`, `choice(...)`), not EBNF.
567
+
568
+ ## Analysis and metrics
569
+
570
+ ### Ishikawa: `ishikawa` (alias `ishikawa-beta`)
571
+
572
+ Pick it for root-cause analysis in an incident review or flaky-test triage.
573
+
574
+ ```mermaid
575
+ ishikawa
576
+ Sandbox start timeouts
577
+ Image
578
+ Stale npm cache
579
+ Large snapshot
580
+ Network
581
+ DNS lookups slow
582
+ ISP resolver
583
+ Code
584
+ Missing retry on claim
585
+ Process
586
+ No soak before prod
587
+ ```
588
+
589
+ - The first line is the effect, the next indent level the categories, deeper levels the causes. Indent consistently.
590
+
591
+ ### Quadrant: `quadrantChart`
592
+
593
+ Pick it for impact-versus-effort triage or risk-versus-likelihood.
594
+
595
+ ```mermaid
596
+ quadrantChart
597
+ title Backlog by impact and effort
598
+ x-axis Low effort --> High effort
599
+ y-axis Low impact --> High impact
600
+ quadrant-1 Plan it
601
+ quadrant-2 Do now
602
+ quadrant-3 Skip
603
+ quadrant-4 Reconsider
604
+ Retry claim: [0.2, 0.8]
605
+ Pool resize: [0.35, 0.6] radius: 9
606
+ Rewrite queue: [0.85, 0.7]
607
+ Rename flags: [0.15, 0.2]
608
+ ```
609
+
610
+ - Points are 0..1 on both axes; `[1.2, 0.5]` is a lexical error.
611
+ - `quadrant-1` is top-right, `-2` top-left, `-3` bottom-left, `-4` bottom-right.
612
+ - `radius: N` sizes a point; leave `color:` and `classDef` out.
613
+
614
+ ### Radar: `radar-beta`
615
+
616
+ Pick it for comparing two to four options across the same criteria.
617
+
618
+ ```mermaid
619
+ radar-beta
620
+ title Queue options
621
+ axis lat["Latency"], ops["Ops cost"], dur["Durability"], fit["Team fit"]
622
+ curve bull["BullMQ"]{4, 4, 3, 5}
623
+ curve sqs["SQS"]{3, 5, 5, 3}
624
+ max 5
625
+ min 0
626
+ graticule polygon
627
+ ```
628
+
629
+ - One value per axis in axis order. `max` / `min` fix the scale; `graticule polygon` draws straight rings.
630
+ - `radar` without `-beta` is `unsupported-diagram`.
631
+
632
+ ### XY chart: `xychart` (alias `xychart-beta`)
633
+
634
+ Pick it for an axis title, a fixed scale, or bars and lines on one chart; plain rows of numbers fit a ` ```chart ` fence.
635
+
636
+ ```mermaid
637
+ xychart
638
+ title "p95 send latency (ms)"
639
+ x-axis [Mon, Tue, Wed, Thu, Fri]
640
+ y-axis "ms" 0 --> 1200
641
+ bar [820, 790, 1100, 640, 610]
642
+ line [700, 700, 700, 700, 700]
643
+ ```
644
+
645
+ - Quote any title or axis label with spaces: an unquoted `title Latency by day` draws `Latencybyday`.
646
+ - Several `bar` and `line` series overlay; there is no legend, so say which is which in the caption.
647
+ - `xychart horizontal` flips the axes; `x-axis "week" 1 --> 5` makes a numeric axis; negative values work.
648
+
649
+ ### Pie: `pie`
650
+
651
+ Pick it for a share of a whole in a document. Keep it to six slices or fewer.
652
+
653
+ ```mermaid
654
+ pie showData title Failed runs by cause
655
+ "Timeout" : 42
656
+ "Auth" : 18
657
+ "OOM" : 9
658
+ ```
659
+
660
+ - `showData` prints each value next to its label. Slices take values, not percentages.
661
+
662
+ ### Sankey: `sankey` (alias `sankey-beta`)
663
+
664
+ Pick it for volumes splitting through stages: traffic, a funnel, cost.
665
+
666
+ ```mermaid
667
+ sankey
668
+ Requests,Served from cache,620
669
+ Requests,Hit database,380
670
+ Hit database,Success,350
671
+ Hit database,Timeout,30
672
+ ```
673
+
674
+ - CSV rows `source,target,value`; quote a name with a comma (`"Hit, cache"`). Blank lines are fine.
675
+ - Cycles are a semantic error.
676
+
677
+ ### Treemap: `treemap-beta` (alias `treemap`)
678
+
679
+ Pick it for what takes the space or the cost: bundle size, code by package, spend by service.
680
+
681
+ ```mermaid
682
+ ---
683
+ config:
684
+ treemap:
685
+ valueFormat: '$0,0'
686
+ ---
687
+ treemap-beta
688
+ "Monthly infra"
689
+ "Compute"
690
+ "API VMs": 1800
691
+ "Sandboxes": 4200
692
+ "Data"
693
+ "Postgres": 1300
694
+ "Redis": 300
695
+ ```
696
+
697
+ - Quote every name; leaves are `"Name": value`, and indentation makes the hierarchy.
698
+ - `valueFormat` takes d3-style formats (`'$0,0'`, `'.1%'`).
699
+
700
+ ### Mindmap: `mindmap`
701
+
702
+ Pick it for scoping and brainstorming before a plan exists.
703
+
704
+ ```mermaid
705
+ mindmap
706
+ root((Desktop perf))
707
+ Startup
708
+ Lazy routes
709
+ Preload IPC
710
+ [Chat]
711
+ Virtualized list
712
+ Diagram mounts
713
+ (Memory)
714
+ Tab quiesce
715
+ {{Unknowns}}
716
+ ```
717
+
718
+ - Node shapes: `[square]`, `(rounded)`, `((circle))`, `))bang((`, `)cloud(`, `{{hexagon}}`, or plain text.
719
+ - Inconsistent indentation does not error; it silently reparents nodes. Indent by a fixed step.
720
+ - `::icon(...)` draws nothing in Alan.
721
+
722
+ ### Kanban: `kanban`
723
+
724
+ Pick it for a status snapshot of a handful of work items in a report.
725
+
726
+ ```mermaid
727
+ kanban
728
+ todo[To do]
729
+ t1[Add retry on claim]@{ ticket: AL-2887, priority: 'High' }
730
+ doing[In progress]
731
+ t2[Pele theme tokens]@{ assigned: 'aman' }
732
+ done[Done]
733
+ t3[Remove mermaid.js]@{ priority: 'Low' }
734
+ ```
735
+
736
+ - Metadata: `ticket`, `assigned`, `priority` (`'Very High'`, `'High'`, `'Low'`, `'Very Low'`). High priorities use the themed critical colour.
737
+ - Frontmatter `kanban: { ticketBaseUrl: 'https://linear.app/team/issue/#TICKET#' }` links each ticket.
738
+
739
+ ### User journey: `journey`
740
+
741
+ Pick it for onboarding or UX friction, scored 1 (bad) to 5 (good) per step.
742
+
743
+ ```mermaid
744
+ journey
745
+ title First cloud session
746
+ section Setup
747
+ Connect GitHub: 4: Engineer
748
+ Pick environment: 2: Engineer
749
+ section First task
750
+ Wait for sandbox: 1: Engineer
751
+ Review plan: 5: Engineer, Agent
752
+ ```
753
+
754
+ - Each step is `Task: score: actor, actor`. Keep scores in 1..5; larger values are accepted without an error.
755
+
756
+ ## Rarely the right call
757
+
758
+ These render well but rarely fit engineering work. Use one when the user asks
759
+ for it or the framing is the point.
760
+
761
+ ### Cynefin: `cynefin-beta`
762
+
763
+ Pick it to sort work by how knowable it is (clear, complicated, complex, chaotic).
764
+
765
+ ```mermaid
766
+ cynefin-beta
767
+ title Incident triage
768
+ complex
769
+ "Unknown flake in CI"
770
+ complicated
771
+ "Slow query under load"
772
+ clear
773
+ "Restart stuck worker"
774
+ chaotic
775
+ "Prod API down"
776
+ confusion
777
+ "Mixed signals"
778
+ chaotic --> complex : "stabilised"
779
+ ```
780
+
781
+ ### Wardley map: `wardley-beta`
782
+
783
+ Pick it for build-versus-buy strategy: what is visible to the user and how commoditised each part is.
784
+
785
+ ```mermaid
786
+ wardley-beta
787
+ title Agent platform
788
+ anchor Engineer [0.95, 0.60]
789
+ component Chat UI [0.80, 0.55]
790
+ component Agent runtime [0.60, 0.45] (build)
791
+ component Sandboxes [0.40, 0.70] (buy)
792
+ component Compute [0.15, 0.90]
793
+ Engineer -> Chat UI
794
+ Chat UI -> Agent runtime
795
+ Agent runtime -> Sandboxes
796
+ Sandboxes -> Compute
797
+ evolve Agent runtime 0.65
798
+ note "runtime commoditises" [0.30, 0.30]
799
+ ```
800
+
801
+ - Coordinates are `[visibility, evolution]`, both 0..1. `(build)`, `(buy)`, `(outsource)`, `(inertia)` tag components.
802
+
803
+ ### Venn: `venn-beta`
804
+
805
+ Pick it for overlap between two to four sets.
806
+
807
+ ```mermaid
808
+ venn-beta
809
+ title Shared surface
810
+ set Web["Web app"]
811
+ set PWA["Mobile PWA"]
812
+ union Web,PWA["Shared packages"]
813
+ text t1["api-hooks"]
814
+ text t2["ui primitives"]
815
+ ```
816
+
817
+ - `set A["Label"]:20` sizes a set; `text id["..."]` lists items inside a region.
818
+
819
+ ### Info: `info`
820
+
821
+ Prints the renderer version. Useful only to check what Alan is running.
822
+
823
+ ```mermaid
824
+ info
825
+ ```
826
+
827
+ ## Failures to recognise
828
+
829
+ These are verified errors; the fix is in the right column.
830
+
831
+ | Source | Error | Fix |
832
+ |---|---|---|
833
+ | `a[Run tests (unit)]` | syntax | `a["Run tests (unit)"]` |
834
+ | `start --> end` | syntax | `start --> done[end]` |
835
+ | `A->>B: a; b` | syntax | `A->>B: a, b` or `#59;` |
836
+ | `14:02 : alert` (timeline) | syntax | `14.02 : alert` |
837
+ | `api --> db` (architecture) | syntax | `api:R --> L:db` |
838
+ | `text "display name"` (ER attribute) | syntax | `text display_name "display name"` |
839
+ | `p["Person"] ||--o{ c : x` (ER) | syntax | declare `p["Person"]` on its own line |
840
+ | `element e` with no body (requirement) | syntax | `element e { type: service }` |
841
+ | `text: prod-tagged sandboxes` (requirement) | syntax | `text: "prod-tagged sandboxes"` |
842
+ | `Retry: [1.2, 0.5]` (quadrant) | lexical | coordinates in 0..1 |
843
+ | `A,B,1` and `B,A,1` (sankey) | semantic | remove the cycle |
844
+ | `merge ghost` (gitGraph) | semantic | `branch ghost` first |
845
+ | `A :a1, 3d` as the first gantt task | semantic | `A :a1, 2026-10-01, 3d` |
846
+ | `architecture`, `treeView`, `radar`, `usecase`, `swimlane` | syntax or unsupported-diagram | add `-beta` |
847
+ | `zenuml` | unsupported-diagram | use `sequenceDiagram` |