Build an app
An app is a set of screens that runs inside Alma, in a frame of its own. It
reads and changes your workspace’s records through Alma’s public /v1 API,
always as the person using it, and its backend is ordinary Alma workflows. It
never sees more than the person using it could already see. An app that
declares what the public may do can also be published: the same screens, at an
address anyone can open.
You write an app’s source, and Alma builds it. You need Node.js and an editor.
The SDK’s alma-app command signs you in and sends your source to Alma; an AI
client connected to Alma’s MCP server can do the same.
Set up the project
Section titled “Set up the project”The project needs these files:
- manifest.json what the app is and what it may do
- package.json
- tsconfig.json
Directorysrc
- app.tsx the app’s screens
- Onboarding.tsx
- style.css
An app imports the SDK as @alma/app-sdk, so package.json installs the
published package under that name, beside the TypeScript, React types and Vite
client types its build script checks against:
{ "name": "onboarding-board", "private": true, "type": "module", "scripts": { "build": "tsc --noEmit" }, "devDependencies": { "@alma/app-sdk": "npm:@almateam/app-sdk@^0.12.0", "@types/react": "^19.3.0", "react": "^19.3.1", "typescript": "^6.0.3", "vite": "^8.3.1" }}{ "compilerOptions": { "target": "ES2022", "module": "ESNext", "moduleResolution": "bundler", "lib": ["ES2022", "DOM", "DOM.Iterable"], "jsx": "react-jsx", "types": ["vite/client"], "strict": true, "noEmit": true, "skipLibCheck": true, "verbatimModuleSyntax": true }, "include": ["src"]}With these files in place, install the dependencies package.json names:
npm installRun npm run build to type-check your source. Alma builds it, and checks
manifest.json when you push it.
The manifest
Section titled “The manifest”The manifest says what the app is called, which version this is, what it may do
(scopes), which workflows it may start (workflows) and which record types it
keeps its data as (types). This one keeps customer onboardings as records and
starts a “Mark live” workflow, once you have
built it and put its id in workflows:
{ "name": "Onboarding board", "version": "0.1.0", "scopes": ["topics:read", "facts:confirm", "workflows:read", "workflows:run"], "workflows": ["<the id of your Mark live workflow>"], "types": [ { "key": "customer_onboarding", "name": "Customer onboarding", "fields": [ { "key": "stage", "name": "Stage", "type": "choice", "options": ["Kickoff", "Setup", "Live"] }, { "key": "go_live_date", "name": "Go-live date", "type": "date" } ], "relationships": [ { "label": "CSM", "to": "person", "cardinality": "N:1" } ] } ]}| Field | What it holds |
|---|---|
name |
The app’s name when you create it: up to 80 characters, and not one of Alma’s own app names. A later version’s name doesn’t rename the app; alma_rename_app does. |
version |
major.minor.patch. Bump it with every change you send. |
scopes |
What the app may do, from the table below. Every call outside them is refused. |
workflows |
Up to 20 workflow ids the app may start. Naming any requires workflows:run. Optional: leave it out, or [], until the workflow exists. |
types |
Up to 10 record types the app keeps its data as. |
screens |
Optional. { "entry": "<path>" } names the module that holds the app’s screens, when it is not src/app.tsx. |
public |
Optional. What anyone on the web may do with the app once it is published; see Public on the web. |
Records: the workspace’s typed topics
Section titled “Records: the workspace’s typed topics”An app’s records are your workspace’s topics, of the types its manifest
declares. Each type has a key and a name, and may have an icon and a
description. Each field has a key, a name and a type; a choice field
lists its options, and an instruction tells Alma what to look for when it
reads your sources. Each relationship has a label, the key of the type it
points at (to) and a cardinality. to is a type the manifest declares or
one the workspace already has. Every workspace has person (its members),
contact (people outside it), responsibility, group, tool and
general.
A field's type is one of text, date, number, money, choice. A relationship's cardinality is one of 1:1, 1:N, N:1, N:M.
Keys are lowercase letters, digits and underscores. When the app is shared, the
workspace’s type of that key is reused, gaining any fields it lacks, or created.
A relationship’s values sit under the key rel_<label>__<type key>, where the
label is lowercased, each run of characters other than letters and digits
becomes one _, and a leading or trailing _ is dropped: “CSM” to person is
rel_csm__person, and “Account owner” to person is
rel_account_owner__person. While the app is installed, the workspace’s schema
editor lists it under “Used by” and refuses to retype or remove what it
declares.
A field or a relationship can be smart: give it smart with an instruction,
and Alma computes its value on every record from the rest of the record, and
keeps it current as records change. Each fill is billed to the workspace. The
app reads a smart value and never writes it.
{ "key": "phase", "name": "Phase", "type": "choice", "options": ["Kickoff", "Build", "Live"], "smart": { "instruction": "The phase the latest status notes describe" } }A type can also declare views: saved views of its records, each with a key
(lowercase words joined by hyphens), a name, and what the records grid holds:
filters (each { key, operator, value }), sort, groupBy and hidden.
Sharing the app makes each one a shared view of the type, unless the type
already has a view of that key, which is kept as the workspace left it. Read one
with readView(type, key). A version that declares a smart field or a view the
shared version did not is a wider version, like one adding a field.
Workflows: the app’s backend
Section titled “Workflows: the app’s backend”An app’s backend is ordinary workflows of your workspace, edited by their managers and listed under Workflows on the workspace rail. Build one as Building workflows describes and enable it: an app can’t start a workflow that is off. It needs no particular trigger, since an app starts it the way a person runs it by hand.
To find a workflow’s id, choose it under Workflows on the workspace rail,
then Copy id from the ⋯ menu at the top of its page. (An AI client connected
to Alma finds it with alma_list_workflows.) List the ids in workflows and
declare workflows:run. Each push checks that you can edit every workflow it
adds to the manifest. One the app already names stays named whoever changes the
app next, so its editors and a new owner keep it. Until the workflow exists,
leave workflows out.
Naming a workflow gives the app nothing. Whether a viewer may start it from your app is the workflow’s own access list:
- Someone who can change the workflow adds your app on its Access tab at Can use. Then anyone the app is shared with may start it from the app.
- Without that, only viewers who can use the workflow themselves (Can use or Can change) may start it.
A draft starts a workflow only on the right of the person it belongs to: a grant to
the app applies to its shared version. The viewer must also be able to see the
record a run is started on. listWorkflows() says which workflows this viewer
may start, as runnable, or why not, as not_runnable.
runWorkflow(workflowId, { topicId, input }) starts a run. The run is the
workflow’s, not the viewer’s: it acts on the workflow’s own permissions and the
accounts its steps name, and does the same whoever pressed the button. The
viewer who started it from the app sees its status and the report the workflow
submits, and no report when the run read something an integration marks
sensitive. A viewer who can use or change the workflow themselves opens every
run of it in Alma, reads it whole and sees who started it. With a
topicId, the run is on that record. listRuns finds the record’s runs later.
input reaches the run as data, never as instructions.
A workflow your app ships and marks startable (workflows: [{ "key": "invite", "definition": "workflows/invite.json", "startable": true }], with the
workflows:run scope) is started by its key instead:
runWorkflow({ key: "invite" }, { input }) and listRuns({ key: "invite" }),
so a copy of the app starts its own copy with the same code. Only a key the
version in use ships as startable starts anything, and the share card says the
app can start it. A step of such a workflow can act from the account of whoever
starts the run, such as their own Gmail, with "accounts": { "alma_gmail_send_email": "requester" } beside its tool_config, on a named
tool only. That grant always asks the person who started the run before each
call, they must have connected the integration themselves, and the share card
says whose account it uses.
A run under way finishes even if the workflow is turned off or its grant to the app is taken away; that stops the next start. Suspending, removing or unsharing the app stops a run at its next step. A workflow that has granted an app can’t be deleted until the app is taken off its access list; one an app only names can be.
A run started on a record can set that record’s fields itself, with Alma’s
record field tool (alma_set_record_field). The step that uses it needs the
tool and Read + Write on the record, which an Owner grants on the step’s
Memory tab. The value is recorded as Alma’s, not as a person’s. On a record set
to ask before updating, it is not applied: it waits for the record’s reviewers.
Your app does not write the outcome and does not trust what the run says it did.
Each run it reads carries field_writes, one entry for each write the run made
to its record, taken from what the write actually did:
outcome |
What happened | Show it as |
|---|---|---|
applied |
The record holds the value (value, revision). |
Done |
unchanged |
The record already held it. | Already so |
proposed |
The record asks before updating. Nothing changed yet. | Waiting for review, never as done |
refused |
Nothing was written. refusal.reason says why. |
Not done, with the reason |
unknown |
The write may have completed. | Check the record before trying again |
A run can end completed with no entry at all, or with a proposed or
refused one, so read field_writes before saying a record changed.
In the example, “Mark live” is a workflow that takes a customer live: an approval step where the onboarding lead signs off, then a step that posts to the team’s channel and sets the record’s Stage to Live. The app shows what that write did.
Scopes
Section titled “Scopes”Each scope is a permission from Alma’s API scope catalog, and each lets the app call the operations beside it.
| Scope | Lets the app | Operations |
|---|---|---|
topics:read | List topics, and read their facts, updates timeline, and summaries. | listTopics (SDK: listTopics, watchTopics), listTopicTypes (SDK: createTopic, listTopicTypes), getTopicRecord, listViews, readView, listTopicReferences, countTopics, listRelatedTopics, getTopicFieldHistory, getTopicSummary, getTopicFactDiscussion, downloadTopicFactAttachment |
facts:confirm | Set or clear a topic's field values as the person behind the call, where they may edit the topic. An app also creates records with it, deletes the ones it made, and restores the ones its viewer deleted. | createTopic, deleteTopic, restoreTopic, setTopicField, clearTopicField |
workflows:read | Read what each workflow does and the history of its runs, as its member card shows them. | listWorkflows, getWorkflowCard, listWorkflowExecutions (SDK: listRuns), getExecution (SDK: getExecution, waitForExecution) |
workflows:run | Trigger workflow runs on demand. An app starts only the workflows its manifest names, as its viewer. | runWorkflow |
lessons:write | Add, edit, or remove lessons that guide the agent's behavior. | createLesson (SDK: createWorkflowLesson), updateLesson |
shared_state:write | Keep a small state that everyone who can open the app reads and changes, and that reaches each open copy as it changes, and send quick messages to everyone who has it open. | listAppSharedState (SDK: shared.list), getAppSharedState (SDK: shared.get), setAppSharedState (SDK: shared.set), deleteAppSharedState (SDK: shared.delete), sendAppBroadcast (SDK: broadcast) |
events:raise | Raise the events the app declares, so the workflows that subscribe to them start. | raiseAppEvent (SDK: raiseEvent) |
records:share | Let the person using the app hand one of its records to someone outside Alma by a private link, showing only the fields the app makes public, and switch the link off again. | issueRecordLink, revokeRecordLink |
viewer:read is accepted in a manifest, but no operation an app calls needs it yet, so declaring it lets the app do nothing more.
Write the app
Section titled “Write the app”An app is one module, src/app.tsx, that default-exports defineApp. Each
route names an address and the screen drawn there, each screen in its own
module:
// Alma's look: its tokens, Geist, the accent and the kit's Theme knobs.import "@alma/app-ui/base.css";import "./style.css";import { defineApp } from "@alma/app-sdk";
export default defineApp({ routes: [ { path: "/", audience: "members", component: () => import("./Onboarding"), }, ],});A screen reaches Alma through useAlma(), the SDK for the place it runs:
import { useCallback, useEffect, useState, type FormEvent } from "react";import { isFieldChanged, type TopicRecord } from "@alma/app-sdk";import { useAlma } from "@alma/app-ui";
const TYPE = "customer_onboarding";
export default function Onboarding() { const alma = useAlma(); const [records, setRecords] = useState<TopicRecord[]>([]); const [status, setStatus] = useState(""); const [name, setName] = useState("");
const say = (error: unknown) => setStatus(error instanceof Error ? error.message : "Something went wrong");
const render = useCallback(async () => { const page = await alma.listTopics({ type: TYPE, sort: "name", limit: 50 }); setRecords(page.data); }, [alma]);
useEffect(() => { render().catch(say); }, [render]);
// The app's backend: the workflow its manifest names, run as the workflow. async function markLive(topic: TopicRecord) { // Each workflow the manifest names is `runnable`, or says in // `not_runnable` why this person may not start it now. const workflow = (await alma.listWorkflows()).find( (w) => w.runnable || w.not_runnable ); if (!workflow) throw new Error("This app names no workflow."); if (workflow.not_runnable) throw new Error(workflow.not_runnable.reason); const run = await alma.runWorkflow(workflow.id, { topicId: topic.id }); const done = await alma.waitForExecution(run.id, { onUpdate: (execution) => setStatus( execution.status === "waiting" ? `Waiting for ${execution.approvers.map((p) => p.name).join(", ") || "approval"}` : `${workflow.name}: running` ), }); // The workflow sets the stage itself. What that write did is on the run: // never take the run's own report, or its status, as the record's news. const stage = done.field_writes .filter((w) => w.field_key === "stage") .at(-1); setStatus( done.status !== "completed" ? `${workflow.name}: ${done.error ?? done.status}` : stage?.outcome === "applied" || stage?.outcome === "unchanged" ? `${topic.name} is live` : stage?.outcome === "proposed" ? `${topic.name}: going live is waiting for review` : stage?.outcome === "refused" ? `${topic.name} was not marked live. ${stage.refusal?.reason ?? ""}` : `${workflow.name} finished without changing the stage` ); await render(); }
async function moveToSetup(topic: TopicRecord) { try { await alma.setTopicField(topic.id, "stage", "Setup"); } catch (error) { // Someone moved the stage after this list was read: nothing was saved. // Show what it is now and let the person decide again. if (!isFieldChanged(error)) throw error; setStatus( `This changed since you opened it. ${topic.name} is now at ${error.current.values[0]?.text ?? "no stage"}.` ); } await render(); }
async function add(event: FormEvent) { event.preventDefault(); if (!name.trim()) return; try { const types = await alma.listTopicTypes(); // The new record takes the app's audience. await alma.createTopic( name.trim(), types.find((type) => type.key === TYPE)?.id ); setName(""); await render(); } catch (error) { say(error); } }
return ( <main> <h1>Onboarding</h1> <form onSubmit={add}> <input aria-label="Customer" value={name} onChange={(event) => setName(event.target.value)} required /> <button>Add customer</button> </form> <p role="status">{status}</p> <ul> {records.map((topic) => ( <li key={topic.id}> {topic.name} · {topic.values["stage"]?.[0]?.text ?? "No stage yet"} {topic.can_edit && ( <> <button onClick={() => moveToSetup(topic).catch(say)}> Move to Setup </button> <button onClick={() => markLive(topic).catch(say)}> Mark live </button> </> )} </li> ))} </ul> </main> );}main { max-width: 640px; margin: auto; padding: 24px;}button { margin-left: 8px;}A route is for members and the public both unless its audience says
members (only in Alma) or public (only at the published address). Add a
route for each further screen; the app kit’s Link moves between them, and
usePath says where the person is. A route’s path may have parameters, such as
/customers/:id, which its screen gets as params.
Alma adds nothing of its own look to an app that does not ask for it. Importing
@alma/app-ui/base.css puts it beneath yours: Geist, Alma’s colors for the
person’s light or dark theme, and focus rings. Your CSS wins wherever it sets
something. Alma sets data-theme="light" or "dark" on the page’s root
element to match the person’s theme, and its colors follow it. They are CSS
variables you can use in your own rules, such as var(--background),
var(--foreground-60) and var(--border), and they also go by the MCP Apps
names (--color-background-primary, --color-text-secondary and the rest).
With Tailwind, dark: follows the person’s theme rather than their device’s,
and Alma’s colors are utilities beside Tailwind’s own: bg-background,
text-foreground-60, border-border, and the names shadcn/ui components use
(bg-primary, text-muted-foreground, bg-card, border-input). Leave those
and --chart-1 to --chart-7 undefined and the components and charts look like
Alma.
Run it in Alma
Section titled “Run it in Alma”From the project’s folder, start the dev loop:
npx alma-app dev(bunx alma-app dev works too.) The first time, it opens your browser to sign
in to Alma, the same sign-in an MCP client uses, and keeps your session on this
machine. Then it sends manifest.json and your source (see
what it sends), and Alma builds it into a draft only
you can open. The command prints the draft’s address, and on the first push the
--app <app id> to pass next time so later pushes add versions to the same app.
Each time you save, it pushes again and your draft moves to the new version. A
build that fails prints the build’s own report, and the loop waits for your next
save.
If you’re a member of more than one workspace, say which one the app belongs to
with --org <organization id>. Without it, the first push is refused with a
list of your workspaces and their ids. Once you pass --app, the push goes to
that app’s own workspace.
npx alma-app dev --org <organization id>npx alma-app dev --app <app id>What alma-app dev sends
Section titled “What alma-app dev sends”It sends every file whose name ends in .tsx, .ts, .jsx, .js, .mjs,
.css, .svg, .json, .md or .txt. It leaves out:
- the
node_modules,distandbuildfolders; - every file or folder whose name starts with
.; - lockfiles (
package-lock.json,npm-shrinkwrap.json,bun.lock,bun.lockb,yarn.lock,pnpm-lock.yaml).
Pictures, fonts, PDFs and audio aren’t source. Put them in _site-files in the
app’s folder (or name another folder with --files <folder>): the command
uploads each new or changed one and lists it in site-files.json before it
pushes, and a screen shows one with the app kit’s useFileUrl("<name>"). An
image can also be an .svg file the source imports.
While you have your own app open, what it logs with console and every error it
doesn’t catch appear in its Manage sheet, under Logs, beside the newest
failed run of each workflow it starts, linked to that run. Only your own
sessions are recorded there: what an app logs can carry its viewer’s data, so
nothing from anyone else’s session reaches you.
What the SDK calls
Section titled “What the SDK calls”Every SDK call is one of Alma’s public /v1 operations, the same routes an API
key calls, made as the person using the app.
alma.call(operationId, { params, query, body }) reaches any of them, and the
SDK’s typed helpers wrap the common ones:
- Query records —
listTopics({ type, filter, sort, updated_after, cursor, limit }). A filter is<field>:<op>:<value>witheq,ne,lt,lte,gt,gteorcontains;sortnames a field,name,created_atorupdated_at, with-in front for descending. A page carriesmeta.next_cursor. To poll for what changed, passupdated_after(an ISO 8601 instant with its offset) withsort: "updated_at": only the records whoseupdated_atis at or after it come back, oldest first. A change is stamped when it is written, not when it commits, so start each poll well before the newestupdated_atyou already read and take every record that comes back as its current state. Only a change to the record or its own values movesupdated_at: a referenced record renamed, the type’s fields changed, or a record newly shared with the viewer is not picked up, and an archived or deleted record simply stops being listed. A full read catches up on all of these. - Watch records —
watchTopics(query, listener, { intervalMs })reads the query and tellslistenerabout its records, returning the unsubscribe. It calls{ kind: "topic", topic_id }when a record it read changes, and{ kind: "added", topic_id }the first time this watch sees a record: one created since, one an edit brought into the query, one restored, or one on a page it had not read. For a query that namestype, Alma tells the open app within seconds that some record of the type changed or joined, and the SDK rereads only what changed since, as the viewer. When a record of the type is deleted, restored, archived, merged away or moved to another type, the SDK rereads the whole query (its 1,000 most recently changed records) and calls{ kind: "removed", topic_id }for each record it had seen that is gone. Only that reread reports a removal, never the timed reread. One past those 1,000 is not reported. One an edit takes out of the query, or one whose type was not told (more than 8 types left in one change), is reported at the next such reread, or when the app opens again. For a query withouttype, it watches each record it read and does not report one that leaves the query; in a host that tells it nothing it polls everyintervalMs(default 15 seconds). A bulk change callslisteneronce per record, many times in a row, so reread once per burst rather than once per call. A record changed by a transaction that took more than a minute to commit can be missed, unless it is on the query’s first page, which the watch rereads every five minutes. - Read one record —
getTopicRecord(topicId). - Read a record’s page —
getTopicSummary(topicId)resolves with{ topic_id, content, generated_at }: the record’s page as markdown, as the person using the app reads it, with every passage about a property they may not read left out. Both are null while the record has no page they can read. An API key reading the same path gets the topic’s SUMMARY.md instead; an app does not, since that file carries where each value came from and the quote behind it. - Read a saved view —
listViews(typeKey)lists a type’s saved views the viewer can open (each{ key, name, scope }: the type’s shared views, then the viewer’s own), andreadView(typeKey, viewKey, { cursor, limit })reads a page of one, filtered, searched, sorted and grouped as the view says, the same records the type’s grid shows. A page carriesview, thecolumnsthe view shows (each property’skey,nameandkind, with a choice’soptions),datawith each record’s values for those columns, andmeta.next_cursorandmeta.total; a grouped view brings its records group by group, andmeta.groupscounts each ({ value, count },valuenull for the records holding none). A view a manager changes in the grid changes what the app reads, with no new version. - Read a field’s earlier values —
getTopicFieldHistory(topicId, fieldKey)lists the values a field held before, newest first, each with who or what wrote it, why it stopped standing and what took its place. An entry does not carry where the value came from or the quote behind it. Each section ofgetTopicRecord’s record carriesearlier_values, how many there are, so offer the history only where it is set. - Create a record —
createTopic(name, typeId), which resolves with aCreatedTopicRecord. The record takes the app’s audience, set in Alma. The app never decides who can see it. - Create a record with its values —
createTopic(name, typeId, { fields: [{ key: "stage", value: "Live" }] })saves the record and its first values in one request, so nobody ever reads it half written. Each entry is akey, avalueand, for a relationship, arefTopicId; naming a key twice gives a field that holds many both values. The values are the person’s own confirmed word, as withsetTopicField, and need onlyfacts:confirm. If one value is refused nothing is created, and the refusal starts with the field’s key, so show it to the person. A request denied whole, such as one with a credential in a value, names no field. The result carries each field’svaluesandrevisions. - Delete a record —
deleteTopic(topicId)deletes one of your app’s own records: a record of a type the manifest declares for the app alone ("scope": "app", which a type naming no scope gets), until an owner promotes it to the workspace. It is deleted as the person using the app and kept for 30 days. Only someone who can edit the record deletes it; anyone else’s call rejects with the refusal’s words. Any other record rejects as not found. - Restore a deleted record —
restoreTopic(topicId)is the Undo behind a delete: the person who deleted one of your app’s records brings it back, within 30 days and while they can still edit it. It resolves with{ id, name, cleared };clearedlists the values that did not come back because they no longer fit the record’s type, so say so when it is not empty. A record somebody else deleted rejects as not found, and one no longer theirs to edit rejects with the refusal’s words. So does one past its 30 days, until Alma removes it for good; then it rejects as not found. Someone who edits the app can also restore a record from its Data. - Update a record —
setTopicField(topicId, fieldKey, value, refTopicId?)sets one field. The value is parsed against the field’s type, and setting the value a field already holds confirms it. The write says what your app last read of that field (the SDK remembers each read’srevisionsand sends the right one), so read a record before you write it: a write that says nothing about what it read is refused and writes nothing. If someone changed the field since, nothing is written and the call rejects with afield.changederror:isFieldChanged(error)is true anderror.currentholds the field’s values and revision now. Show the person “This changed since you opened it” with the current value, and write again with{ ifRevision: error.current.revision }as the fifth argument once they have decided. - Keep screen state —
state.get(key),state.set(key, value)andstate.delete(key)keep what only this person’s screen of your app needs between visits: a filter, a collapsed column, a half-written draft. The rule: if a workflow or Alma needs to see or act on it, or the workspace should keep it for other people to find, it is a record; if everyone with the app open sees it together, it is shared state; if only this app’s screen for this person needs it, it is app state. It needs no scope and no owner’s approval. Nothing in it reaches a workflow run, search or what Alma knows. App state survives a reload and a new version, and goes when the app is removed or the person leaves the workspace. A value is any JSON up to 16 KB; one person holds at most 64 keys and 256 KB in one installation. Past either, thesetrejects withapp_state.value_too_largeorapp_state.quota_exceeded. - Share state live —
shared.get(key),shared.list(),shared.set(key, value, { ifRevision? })andshared.delete(key)keep what everyone with this installation open sees and changes together: a leaderboard’s scores, a board’s column order, a vote, whose turn it is. It survives a reload and needs theshared_state:writescope.shared.watch(listener)callslistenerwith every key, then with each key as it changes, whoever changed it, within a second or two; it returns the unsubscribe, so never poll. Keep what each person changes under a key of their own, so two people writing at once never write over each other, keep that key the same between visits, and send one write at a time. WithifRevision, asetwrites only over that revision (0: only where the key holds nothing), and otherwiseisSharedStateConflict(error)is true anderror.currentis the key as it stands. A value is any JSON up to 16 KB; one installation holds at most 128 keys and 256 KB, and everyone using it may write 60 times at once, then 10 a second, a refused write included. Past each, the write rejects withapp_shared_state.value_too_large,app_shared_state.quota_exceededorapp_shared_state.rate_limited. The builder’s guide hands out a multiplayer leaderboard built with shared state, presence and quick messages. - See who else is here —
presence.watch(listener)callslistenerwith{ count, people }: how many have this installation open right now, the viewer among them while they are shown, and again within a second or two of anyone opening or closing it.peopleis[{ person_id }], each person once, for an app that declaresviewer:read, andnullotherwise, whencountcounts open copies. Someone is present only while their “Show when I’m viewing a task” switch is on and they are not in Do not disturb. Where Alma cannot tell, the listener is never called. It returns the unsubscribe and needs no scope. - Send a quick message —
broadcast(event, payload)sends one to everyone who has this installation open right now, andonBroadcast(event, listener, { self?, missed? })callslistenerwith the payload of each one sent underevent, within about a second; the sender’s own are skipped unlessselfis true. Nothing is kept, so someone who opens the app later never hears it, andmissedis called when messages may have passed unheard: a connection that joined late, or dropped and came back. A payload is any JSON up to 8 KB, one viewer may send 20 at once, then 10 a second, and everyone using the installation together may send 60 at once, then 30 a second; past any of them, the send rejects withapp_broadcast.payload_too_large,app_broadcast.rate_limitedorapp_broadcast.installation_rate_limited. Where the workspace’s IP allowlist is in force, no message is sent: a viewer on an approved network is refused withapp_broadcast.ip_allowlist_in_force, and one outside it like any other call. Both need theshared_state:writescope, andonBroadcastreturns the unsubscribe. - Read the field contract —
listTopicTypes(): every type, its fields with their value types and options, its relationships, and itsschema: the workspace’s knowledge (kind: "workspace") or your app’s own (kind: "app"). A type’s key is unique within its schema. - Start a workflow —
runWorkflow(workflowId, { topicId, input }), for a workflow the manifest names, orrunWorkflow({ key }, …)for one it ships. - Watch a run —
waitForExecution(runId, { onUpdate, signal })polls with backoff until it ends. A run paused at an approval step readswaiting, with the people it waits on inapprovers.listRuns(workflowId, { topicId })finds the runs started on a record when the app opens again.
| Operation | SDK helper | /v1 call | Scope |
|---|---|---|---|
listTopics | listTopics, watchTopics | GET /v1/topics | topics:read |
createTopic | alma.call only | POST /v1/topics | facts:confirm |
deleteTopic | deleteTopic | DELETE /v1/topics/:id | facts:confirm |
restoreTopic | restoreTopic | POST /v1/topics/:id/restore | facts:confirm |
listTopicTypes | createTopic, listTopicTypes | GET /v1/topic-types | topics:read |
getTopicRecord | getTopicRecord | GET /v1/topics/:id/record | topics:read |
listViews | listViews | GET /v1/views | topics:read |
readView | readView | GET /v1/views/:key | topics:read |
listTopicReferences | listTopicReferences | GET /v1/topics/:id/references | topics:read |
countTopics | countTopics | GET /v1/topic-counts | topics:read |
listRelatedTopics | listRelatedTopics | GET /v1/topics/:id/related | topics:read |
getTopicFieldHistory | getTopicFieldHistory | GET /v1/topics/:id/fields/:key/history | topics:read |
getTopicSummary | getTopicSummary | GET /v1/topics/:id/summary | topics:read |
getTopicFactDiscussion | getTopicFactDiscussion | GET /v1/topics/:id/facts/:factId/discussion | topics:read |
downloadTopicFactAttachment | downloadTopicFactAttachment | GET /v1/topics/:id/facts/:factId/attachments/:attachmentId | topics:read |
setTopicField | setTopicField | PUT /v1/topics/:id/fields/:key | facts:confirm |
clearTopicField | clearTopicField | DELETE /v1/topics/:id/fields/:key | facts:confirm |
listWorkflows | listWorkflows | GET /v1/workflows | workflows:read |
getWorkflowCard | getWorkflowCard | GET /v1/workflow-cards/:id | workflows:read |
runWorkflow | runWorkflow | POST /v1/workflows/:id/executions | workflows:run |
listWorkflowExecutions | listRuns | GET /v1/workflows/:id/executions | workflows:read |
getExecution | getExecution, waitForExecution | GET /v1/executions/:id | workflows:read |
createLesson | createWorkflowLesson | POST /v1/lessons | lessons:write |
updateLesson | updateLesson | PATCH /v1/lessons/:id | lessons:write |
getAppState | state.get, lastLooked.changes | GET /v1/app-state/:key | None |
publishCard | publishCard | POST /v1/app-cards | None |
setAppState | state.set | PUT /v1/app-state/:key | None |
deleteAppState | state.delete | DELETE /v1/app-state/:key | None |
listAppSharedState | shared.list | GET /v1/app-shared | shared_state:write |
getAppSharedState | shared.get | GET /v1/app-shared/:key | shared_state:write |
setAppSharedState | shared.set | PUT /v1/app-shared/:key | shared_state:write |
deleteAppSharedState | shared.delete | DELETE /v1/app-shared/:key | shared_state:write |
sendAppBroadcast | broadcast | POST /v1/app-broadcast | shared_state:write |
issueRecordLink | issueRecordLink | POST /v1/topics/:id/private-link | records:share |
revokeRecordLink | revokeRecordLink | DELETE /v1/topics/:id/private-link | records:share |
raiseAppEvent | raiseEvent | POST /v1/app-events | events:raise |
The response types are generated from Alma’s OpenAPI document and carry its
schema names: TopicRecord is a row from listTopics, CreatedTopicRecord
what createTopic returns, AppTopicRecord what getTopicRecord returns (a
TopicRef and its KnowledgeRecord), TopicFieldReceipt what setTopicField
returns, TopicType an entry of the field contract, AppWorkflowSummary a
workflow from listWorkflows, and AppRunReceipt and AppExecution a started
run and a run as it stands. OperationResult<"listTopics"> names what any
operation resolves with.
A call resolves with its result, or rejects with the refusal’s own words, within 30 seconds. A change is the person’s own act: it saves as them where they may make it and is refused where they may not. Nobody is asked, and no dialog appears. The host refuses an operation outside the manifest’s scopes, a path parameter that isn’t an id (or, for a field, a field key), and any query key the operation doesn’t declare.
The frame’s limits
Section titled “The frame’s limits”An app runs on an isolated origin with no Alma session and no credential.
- No network. The frame’s policy refuses every fetch, image, form and connection to anywhere else. Everything the app needs is in its own files or comes through the SDK.
- One document.
document.openordocument.writereplaces it, and Alma closes the app. - No navigation of its own. If the frame navigates or reloads, Alma closes
the app. Move between screens with the app kit’s
Link: an address of the app moves through Alma, and an address outside it opens in a new tab when the person clicks it. To send the person somewhere in Alma, usehostNavigation()from the SDK, which can open a topic, Tasks or the Apps page. - No inline code. Inline
<script>and styles injected at runtime are blocked. Import CSS from your code. - One script and one stylesheet. In Alma, the app is built with Vite into one script and one stylesheet, with images and fonts inlined. Each route’s import is bundled in.
- A fixed package set. The source may import
react,react-dom,radix-ui,lucide-react,clsx,tailwind-merge,class-variance-authority,tailwindcss,chart.js,@alma/app-sdkand@alma/app-ui, Alma’s app kit. Importing anything else fails the build with the package’s name. Avite.configorpackage.jsonin the source is kept but never read, and nothing is installed. The app kit is not on npm yet, so an editor outside Alma has no types for it. - Charts. Draw a bar or line chart with the app kit’s
<Chart>, which takes Alma’s colors for the viewer’s theme, redraws when the theme changes, and gives screen readers the data as a table. Usechart.jsdirectly only for a chart<Chart>does not draw. Put the canvas in a relative element with a height and setmaintainAspectRatio: false. A canvas cannot read a CSS variable, so resolve each color withgetComputedStylefirst, and draw again when thedata-themeattribute on<html>changes. - No resource hints. Alma removes
dns-prefetch,preconnect,prerender,prefetch,preloadandmodulepreloadlinks. - Source size. At most 200 files, 500,000 characters per file and 2,000,000
in all, with relative paths ending in
.tsx,.ts,.jsx,.js,.mjs,.css,.html,.svg,.json,.mdor.txt.alma-app devsends fewer.
Add, share and permissions
Section titled “Add, share and permissions”-
Create it.
npx alma-app devcreates the app on its first push, as a draft only you can open. Or ask your AI client: it callsalma_create_appwithmanifest.jsonas the manifest and your other files as the source. -
Change it. Each change is a new version: every save while the dev loop runs, or
alma_add_app_version. Your draft moves to it at once. For a small change,alma_add_app_versiontakes only what changed:edits(an exact replacement that matches once in a file) andchanges(a file’s whole new text, ornullto delete it) apply to the app’s newest version, keep its manifest with the patch version bumped, and build like the whole source would. The Manage sheet (oralma_set_app_draft_version) moves your draft back, andalma_get_app_sourcereads any version’s manifest and source. While your draft is on an older version than the newest, reading the newest source names your draft’s version asdraft, and a small change’s answer names it asdraft_was. With no draft yet, the shared app you open is named the same way, assharedandshared_was, when it is on an older version. Either way the change still starts from the newest, so send the older version’s manifest (with a newer version) and whole source to start again from it. -
Share it. From the app’s Manage sheet, or with
alma_share_app, share one exact version with everyone, with an account tier, or with the people and groups you name. Depending on your workspace’s setting it’s shared at once, or it waits for an owner to approve it as a Task. Once approved, it’s shared with nothing more to do. Stopping sharing (the Manage sheet, oralma_stop_sharing_app) takes it back; your draft stays. -
Let others change it.
alma_set_app_editorsnames the people and groups who edit your app besides you. Each of them works on a draft of their own, adds versions, shares it and changes who else edits it. To hand the app to someone else,alma_transfer_appmakes them its owner at once: they get a draft on its newest version, and you stay on as an editor. Only you and a workspace owner can transfer or delete it. You, its editors and a workspace owner can rename it withalma_rename_app: every installation takes the new name at once.
A share that’s wider than what’s shared now — more people, or a version that can do more — counts as widening. A version can do more when it declares a new scope or declares a new type, field or relationship. Naming a new workflow doesn’t widen it: the app runs a workflow only where that workflow’s owner lets it. Owners choose when they approve, in the workspace’s security settings:
| Workspace setting | What an owner approves |
|---|---|
| Never | Members share apps without asking. |
| First share | An owner approves the first share of each app. |
| When access widens (the default) | An owner approves the first share, and any change that widens access. |
| Every version | An owner approves every new version, and any change that widens access. An owner's own version waits for another owner. |
The people a version is shared with open it without being asked. Inside it, nothing is wider than their own access:
- They see only the records they can already see.
- A change saves as them, and only where they may edit that record.
- They choose who can see a record they create.
- A workflow starts only where its owner granted the app, or where they can run it themselves, and on a record they can see. The run acts as the workflow, not as them, and its approval steps go to the people the workflow names.
Public on the web
Section titled “Public on the web”An app can be published: the same screens, at an address anyone opens with no
sign-in. It is the app’s own routes that are published, not a second site:
every route whose audience is not members. The manifest declares what the
public may do, and declaring public (even {}) is what lets a version be
published:
{ "public": { "types": [ { "key": "signup", "add": ["email", "role"], "read": "own", "fields": ["name", "result"] } ], "events": ["signup.submitted"] }}- A type in
publicis one of the app’s own types ("scope": "app") that the manifest declares.addlists the fields a visitor may set on a new entry; without it, they can’t add one.readis"all"(list and open the type’s entries) or"own"(read back only the entry they made, from a private link); without it, they read nothing.fieldslists what a visitor is shown of an entry they may read."own"needs a text fieldresult_keyon the type, which Alma sets and a visitor never adds or sees. eventslists the declared events a visitor may raise. A visitor starts work only through an event: the workflows whose trigger names the app and the event start, and an event that names aresult_typeanswers the visitor with a private link to the result.- Each power is a line on the share card the owner reads, such as “Anyone on the internet can add a Signup (email, role)”, so a version asking for a power the published one did not is a wider version.
- Visitors are anonymous. They see live records, as members do: publishing a version decides its screens and what the public may do, not which data it shows.
Whoever can share the app can publish it: from On the web in Share, or
with alma_share_app and audience.web (true for the address the app’s name
gives, or the address you want), whose answer names the site_url.
- The address is
<name>.sites.alma.team: 3 to 63 lowercase letters, digits and single hyphens, starting and ending with a letter or digit. It belongs to one app at a time, and a reserved name is refused. - Publishing follows the workspace’s approval level for sharing apps, and going public counts as widening who sees it.
- Alma builds each public route at every address it lists when it builds the
version, with the route’s
metaas its title and description, plus a sitemap. - Taking it off the web applies at once, from Remove beside the address in Manage, or from the console. Stopping sharing takes the address down too.
- At the published address,
alma.raiseEventraises one ofpublic.events, and an event that names aresult_typeanswers with a result token.alma.result(token)reads what the workflow has answered so far, andalma.waitForResult(token)waits until it is ready. Inside Alma both reject withresult.unavailable. Every call the public may not make rejects withsite.no_viewer.
Owners manage every app from the console. See Memory · Apps for adding, suspending and removing apps, and Your workspace · Apps for what members see.
2026 Alma
