Skip to content
Spools
Documentation
On this page

Configuration reference

The CRM is defined by crm.config.json at the top of your app's folder. The full contract is packages/spools/src/crm/config-schema.ts; crm.config.schema.json is generated from it so your editor can autocomplete and validate the file.

After any change:

sh
bun run crm:gen   # validate the config, regenerate the Prisma schema and JSON Schemabun run db:push   # with DATABASE_URL set: apply the schema to that database

crm:gen stops with a precise error (path and message) when the config is invalid.

Top level#

Key Required Description
version yes Config format version. Currently 1.
app.name yes Your business name. Shown in the CRM, as " CRM" in the browser tab, and on the sign-in and unsubscribe pages.
app.timezone no Where the business keeps its calendar, as an IANA name such as "America/New_York" (default "UTC"). Decides when "today" and "this month" begin in filters.
access yes Who may use the CRM. See Access.
objects yes The record types. See Objects.
scopes no Keep groups of the business (branches, regions, teams) to their own records. See Scopes.
files no The shared library on the Files page: { "label": "Company files", "folders": ["Templates"] }. The library exists without it. See Files.
home no What Home shows each person beside its built-in sections: a button that adds a record, and their own pipeline. See Home.
roles no What people do in the business: what Home, the sidebar and record pages show each of them, and with access, which objects they may reach. Set on the Team page by access.admins. See Roles.
automations no Run something when records change. See Automations.
app.sendingHours no The hours a sequence's later emails may go out in, on the clock of app.timezone: { "from": "08:00", "to": "18:00" }, weekdays only unless "weekdaysOnly": false. See Campaigns.
campaigns no Durable email sequences. See Campaigns.
conversions no Turn a record of one object into a record of another: a lead into a deal, a deal into a job. See Conversions.
guides no Replace, turn off or add the short guides that show people around. See Guides.
modules no Settings of the Spool's modules, by module name. See Module settings.
assistant no How the Ask page presents the assistant, and the objects the tool API never reaches (deny). See The assistant's page.
live no How often list, board and record pages check for changes and refresh themselves: { "seconds": 20 }. Without it they don't. See Live updates.
ui no Pages and record pages you lay out yourself, drawn with the Spools kit, and the sidebar's order (ui.nav). See Layouts.

Access#

The CRM is deny-by-default. A user must be signed in and have a verified primary email that matches the allowlist.

json
"access": {  "allowedDomains": ["acme.com"],  "allowedEmails": ["contractor@gmail.com"]}

At least one entry is required. With Clerk, restrict sign-ups there too (Clerk dashboard → Restrictions) so strangers can't create accounts at all.

"admins": ["pat@acme.com"] names the people who give everyone their role on the Team page. Each must be let in by the lists above.

"default": { "deny": [...], "readOnly": [...] } is what someone who holds no role may reach, when roles say what people may reach (Roles: access). Without it, someone with no role reaches everything, as before roles.

Scopes#

Without this key, and without role access, every allowed user reads and writes every record. With it, each record of the objects you name belongs to one scope, and a person only sees and changes the scopes they hold.

json
"scopes": {  "label": "Branch",  "labelPlural": "Branches",  "objects": { "companies": "branch", "contacts": "branch", "deals": "branch" },  "roles": {    "member": { "write": true },    "viewer": {},    "headOffice": { "write": true, "all": true }  }}
Key Description
label, labelPlural What a scope is called in the CRM. Default "Scope", "Scopes".
objects For each scoped object, the field that says which scope a record is in: a select, a text or a relation field, not encrypted. An object left out is shared by everyone.
roles What a scope can be held with. write lets the role create, change and delete (without it the role only reads). all makes the role reach every scope, whichever one it was granted in (head office).
grantMinutes How many minutes the signed grant a workflow is handed lasts (Swirls). Default 15, at most 10080 (a week). Set it longer only for workflows that wait before they write back.
  • Who holds what is not in the config: it comes from your sign-in provider (Clerk organizations, or devAuth({ scopes }) in development) or from a resolver of your own (Extending). Someone on the access list who holds nothing sees no scoped record.
  • Which scopes there are is the config's to say where it can: a scope a person holds counts only when it is an option of a scope field that is a select. For a scope field kept as text or as a relation the config names none, so they are the ones the resolver lists (scopesFrom for Clerk, list for the development sign-in and for a resolver of your own). A scope that is neither gives its holder nothing.
  • The scope's value is what the field holds: a select option's value, the text, or the related record's id. With Clerk organizations it is the organization's id (org_...). It is never *, and for a select field it is one of the options. When the field is a relation, the record it points at can't be deleted while any record takes its scope from it.
  • Working in a scope. Someone who holds several works in one at a time, or in all of theirs at once, from the switcher at the top of the sidebar. A new record takes the scope being worked in; working in all of them, it has to say.
  • A relation between two scoped objects stays inside one scope. A record can't move to another scope while scoped records point at it. A shared record can't be deleted while records of a scope its deleter can't change point at it.
  • A relations field keeps to the same rule. Two scoped records are linked only inside one scope. A link between a scoped record and a shared one (a contact's tags) belongs to the scoped record: a tag shows each person only the contacts they can reach. A record can't move scope while it is linked to scoped records that would stay behind, or be deleted while it is linked to a record its deleter can't change.
  • Turning it on for a database that has records: give every record of a scoped object its scope, run bun run crm:gen and bun run db:push, then bun run db:scopes so the timeline, tasks, notes, favourites, folders and sequence runs take their record's scope.
  • Changing objects later is the same step again: run bun run db:scopes after adding an object to it or taking one out. Until then the rows on a newly scoped object's records are only there for a role with all, and the rows on a newly shared object's records stay with the scope they had. A server that stays up says at start-up when rows are waiting. Changing which field holds an object's scope is not followed: see Security.

What it does and doesn't keep apart is in Security.

Objects#

Each key under objects is an object key (camelCase, used in URLs and the database). companies becomes the Company model and the companies table.

json
"contacts": {  "label": "Contact",  "labelPlural": "Contacts",  "titleField": "name",  "fields": { "name": { "type": "text", "required": true } },  "views": [{ "id": "all", "label": "All contacts", "type": "table", "columns": ["name"] }],  "actions": []}
Key Required Description
label, labelPlural yes Display names.
icon no Sidebar icon: users, user, building, handshake, briefcase, calendar, checklist, clipboard, check, ticket, home, file, box.
titleField yes Field used as the record's name everywhere.
model no Override the Prisma model name (default: PascalCase singular of the key).
fields yes See Fields.
views yes At least one. See Views.
actions no Buttons on the record page. See Actions.
sections no The record page and new-record form in named groups of fields, [{ "key", "label", "fields", "collapsed" }], each role seeing the ones it cares about open. See Record page sections.
unique no Sets of fields no two records may share, optionally among the records a condition picks out. See Record rules.
lock no { "when": <condition>, "except": [fields] }: once a record meets the condition, nothing but the excepted fields changes. See Record rules.
parentLock no { "on": <relation field>, "when": <condition> }: once the record the relation points at meets the condition, records pointing at it are not added, changed or deleted. See Record rules.
appendOnly no true: records are added and deleted, never changed. See Record rules.
signals no { "also": [relation fields] }: a change to a record also refreshes the pages of the records these relations point at. See Live updates.
files no Give each of this object's records a folder in the file store and a Files tab. { "folders": ["Drawings", "Proposal"] } names folders made inside each record's folder; "under": "<relation field>" nests a record's folder inside the related record's. See Files.

Reserved object keys: assistant, settings, new, tasks, notes, reports, workflows, integrations, marketing, team, files, api, crm, unsubscribe. An object also can't take the path of a page one of the Spool's modules has. Every object also gets system fields id, createdAt, updatedAt and createdBy, which you can use in views but not redefine.

Fields#

Common options for every field:

Key Description
type One of the types below.
label Display label (default: the key in Title Case).
description Help text under the input.
required Not-null column and a required input.
searchable Found by search: Cmd+K, the box on every list, and relation pickers. Text-like fields only. The title field is always searched.
encrypted Field-level encryption intent. See Encryption.
immutable Set when the record is made, refused afterwards, whoever asks. See Record rules.
readonly Written only by the server's own code: not offered in forms, imports or to the assistant. See Record rules.
audit { "note": "<text field>" }: each change a person makes adds who, when, before and after to that field. See Record rules.
untrusted Text people outside the team write. The assistant is handed it marked as data, not instructions. See Record rules.
Type Stored as Extra options
text, longtext, email, phone, url text default (string)
number double precision default (number)
currency numeric(14,2) currency (ISO code, default USD), default
boolean boolean default
date date
datetime timestamptz
select text options: [{ value, label?, color?, probability?, when? }], default, dependsOn. See Pipelines and stages
relation <key>_id foreign key to: target object key
relations a links table to: target object key; inverse: a relations field on that object. See Many related records
user text A person on your team (owner, assignee). Shown as a picker of everyone on the access allowlist; stores the auth provider's id for them

Need a type that isn't here? Add one in two files.

Colors: gray, red, orange, amber, green, teal, blue, indigo, purple, pink.

A relation is many-to-one: a deal has one company. Optional relations are cleared when the target is deleted; required relations block the delete. When writing a relation through the API or the assistant, pass <field>Id (for example companyId). For many on both sides (a contact has several tags, a tag is on several contacts) use relations.

In the app a relation is chosen by searching the related object, in forms, in a table cell and in a filter. The search looks at the related object's title and its searchable fields, so a contact can be found by email as well as by name. Every word typed must be found in one of them. It works the same for ten records or ten thousand.

Select values are stored as plain text, so adding options never needs a migration. Removing an option leaves existing records with that value.

A relations field holds any number of records of another object, or of its own:

json
"contacts": {  "fields": {    "tags": { "type": "relations", "to": "tags" },    "teams": { "type": "relations", "to": "teams" }  }},"tags": {  "fields": {    "name": { "type": "text", "required": true },    "contacts": { "type": "relations", "to": "contacts", "inverse": "tags" }  }}

inverse names a relations field on the target object that this field is the other side of. Both then show and change the same links: add a tag to a contact and the contact appears under that tag. Set inverse on one side only. The side without it owns the links, so adding an inverse later moves nothing. Without an inverse, the other object's record pages still list the records that hold it.

In the app the field is shown as chips, in tables, on board cards and on the record. It is edited with the same search as a relation, where any number of records can be ticked. It can be filtered, and not sorted by.

A record brings its related records back under three keys:

Key Holds
<field> The related records, each as { "id", "<its title field>" }, in title order.
<field>Ids Their ids, in the same order.
<field>Count How many there are. A record brings back at most 100; the count says when there are more.

Write the field as <field>Ids, through the API, the assistant, a hook or a form:

Value Does
["<id>", "<id>"], or the ids in one string Replaces the set. [] or "" empties it.
{ "add": ["<id>"], "remove": ["<id>"] } Links and lets go of those records, and leaves the rest.

One write names at most 1,000 ids in a list, and as many in each of add and remove: as many as an export writes in one cell, so a file the CRM exported imports again. A longer one is refused with a message that names the field and the limit; send the rest in further writes with add. An id that is not a record of the target object is refused, and so is a record's own id in a field that holds records of its own object (a person is not their own mentor). Nothing of a refused change is kept. A list is refused when the record holds more than the 100 a read brings back, because whoever sent it cannot have seen what it would remove: use add and remove there. The app's own forms and cells always send add and remove.

A cell shows the first 100 of a record's links. Its picker asks the server which of the records it lists are held, so one that isn't among those 100 is still ticked, and can be let go there.

Two people can link the same pair at the same moment, one from each side: the link is made once, and neither of them is refused.

A change to a record's links is a change to that record: it goes through its hooks and automations, moves its updatedAt, and adds a line to its timeline ("added Tags: VIP, Partner"). The records at the other end are not changed: no hook runs for them and their timelines say nothing.

With record scopes, a record brings back only the related records its reader can reach, and <field>Count counts only those. See Security for what a link between scopes means.

Each field that owns its links has a table, <object>_<field> (contacts_tags), with one row per pair, made by bun run crm:gen and bun run db:push like any other. Deleting a record deletes its links, never the records at the other end. crm:gen refuses a target or an inverse that doesn't fit, required, a field named <field>Ids, <field>Count or <field>Links beside it, a links table whose name another table has, and a view sorted by the field. The config itself is refused, by the server as well as by crm:gen, when a links table or an object's table would be one of the CRM's own (an object file with a field uploads would keep its links in file_uploads). Renaming the field or its object names a new, empty table: the links stay in the old one until you move them.

Pipelines and stages#

A stage is a select field. Two option keys turn it into a sales pipeline:

  • probability (0 to 100) is the chance of winning a record at that stage. When any option has one, boards show a weighted total beside each column's sum, and Reports adds a weighted total to the field's breakdown.
  • when limits an option to some values of another select, named by the field's dependsOn. That gives one object several pipelines, each with its own stages. Options without when belong to every pipeline.
json
"pipeline": {  "type": "select",  "default": "sales",  "options": [{ "value": "sales", "label": "Sales" }, { "value": "bids", "label": "Bids" }]},"stage": {  "type": "select",  "dependsOn": "pipeline",  "default": "proposal",  "options": [    { "value": "proposal", "label": "Proposal sent", "when": ["sales"], "probability": 40 },    { "value": "bidOut", "label": "Bid out", "when": ["bids"], "probability": 50 },    { "value": "won", "label": "Won", "probability": 100 },    { "value": "lost", "label": "Lost", "probability": 0 }  ]}

Forms and pickers only offer the stages that apply, and the server rejects any other value whoever sends it (the CRM, a CSV import, the assistant). Moving a record to another pipeline moves it to that pipeline's first stage, unless its stage belongs to both. A new record takes the stage's default if it applies to the chosen pipeline, and the pipeline's first stage if not. dependsOn must name a select on the same object that doesn't depend on a field itself.

Give each pipeline its own board with a view filter:

json
{  "id": "sales",  "label": "Sales pipeline",  "type": "board",  "groupBy": "stage",  "filters": { "pipeline": "sales" }}

Encryption#

"encrypted": "storage" | "eq" | "match" | "search" marks a field for CipherStash searchable encryption:

Mode Queries on ciphertext
storage none (encrypted at rest only)
eq exact match
match free-text search
search exact match, range and free-text

The mode also decides what the app will ask of the field today: which filter operators it offers, and whether search reads it. An encrypted field's values are never part of the index the browser searches, apart from a record's title.

Status: @cipherstash/stack-prisma doesn't support Prisma 8 yet, so marked fields are currently stored as plaintext. crm:gen prints a warning for each one. Keep the markers: once support lands, the generator will emit encrypted column types and no config change will be needed.

Record rules#

Guarantees about an object's records that hold however a record is written: the CRM's forms and inline edits, server functions, the assistant and workflows (the tool API), CSV imports, and your own code (@swirls/spools/extensions, or records.ts directly). The data layer enforces them (packages/spools/src/server/records.ts, record-rules.ts), the database keeps uniqueness, and the pages leave out the inputs a rule refuses.

json
"visits": {  "fields": {    "member": { "type": "text", "required": true, "immutable": true },    "job": { "type": "relation", "to": "jobs", "immutable": true },    "checkedOutAt": { "type": "datetime" },    "hours": { "type": "number", "audit": { "note": "timeNote" } },    "timeNote": { "type": "longtext", "readonly": true },    "crewNote": { "type": "longtext", "untrusted": true }  },  "unique": [    {      "name": "oneOpenVisit",      "fields": ["member", "job"],      "where": { "field": "checkedOutAt", "empty": true },      "message": "This person already has an open visit on this job."    }  ]},"closeouts": {  "lock": { "when": { "field": "status", "equals": "submitted" }, "except": ["reviewed"] }},"messages": { "appendOnly": true }

Conditions (where, lock.when, parentLock.when) are a small, closed language: one condition or a list of up to five that must all hold. { "field": "status", "equals": "submitted" } compares a text, select, number, yes/no, relation (by the related record's id) or teammate field with a value. { "field": "stage", "in": ["won", "lost"] } holds when the field is one of up to twenty values, and { "field": "stage", "notIn": ["won", "lost"] } when it is none of them (an empty field is none of them). { "field": "checkedOutAt", "empty": true } (or false) asks whether any field is empty. { "anyOf": [ <group>, <group>, ... ] } holds when at least one of two to five groups does, each one condition or a list that must all hold; it takes its place in a list like a condition, and holds no other anyOf. Every store says the same thing: the data layer, PGlite's and Prisma's partial unique indexes (in is IN (...), notIn is IS NULL OR NOT IN (...), anyOf is OR). An encrypted field can't be named.

jsonc
"where": [  { "field": "stage", "notIn": ["complete", "cancelled"] },  { "anyOf": [{ "field": "fieldStatus", "empty": true }, { "field": "fieldStatus", "notIn": ["closed"] }] }]
Key On What it does
unique object Up to ten rules, each { "fields": [...], "where"?, "name"?, "message"? }. No two records that meet where share the values of fields. An empty value never clashes. A write that would break one fails with a Conflict naming the rule (name, or the fields joined by +) and saying message, or a sentence made from the rule.
lock object { "when", "except"?, "message"? }. Once a record meets when, a change to any field but those in except is refused, whoever asks. The change that makes the record meet it is allowed. A locked record is deleted only by the server's own work (asSystem), never by a person or the assistant: gate such an action yourself (an admin-only server function or handler), so a wrong submission or an erasure request can still be honoured. The records it pointed at say on their timeline who removed it, and that it was a system removal.
parentLock object { "on", "when", "message"? }. on is a relation field; when is conditions on the record it points at (the parent). Once the parent meets when, no record of this object pointing at it is added, changed (nor moved onto or off it) or deleted, whoever asks: "inspectionAnswers": { "parentLock": { "on": "closeout", "when": { "field": "status", "equals": "submitted" } } }. Checked with the parent held, so a change to the parent and one to a record of it happen one after the other. Deleting is the exception, for the server's own work only (asSystem): it may delete such a record, or the parent itself, which then takes the records it locks with it in the same hold; a person may delete neither. Changes stay refused for everyone. The pages still offer the inputs; the server refuses the write.
appendOnly object Records are created and deleted, never changed.
immutable field The value the record was made with stays. Sending the value it already holds is no change, so a form that sends every field back is not refused. On a relations field, its links stay as made.
readonly field Only the server's own code writes it (below). Not shown in forms, not matched by CSV import, marked readonly for the assistant.
audit.note field Each change a person (or the assistant) makes to the field adds a line to the named text or longtext field of the same record, in the same write: 2026-12-01 09:30 Pat Office changed Hours: 4 → 5.5. The trail keeps its newest 20,000 characters. The note field must be readonly, so nobody edits the trail by hand.
untrusted field The tool API hands its values to the assistant wrapped, { "untrusted": true, "text": "..." }, so the model reads them as data. The timeline says "updated " for a change to it, not the value. Search and everything else are unchanged. Mark the object's title field untrusted too when it is ever made from such text (a hook copying one in): its title then comes wrapped wherever the tool API shows it. spools gen warns of an object with untrusted fields whose title isn't marked. Nothing follows text through your own code for you.

Who the server is. A readonly field is refused when whoever a write is put down to is a person: a teammate, the assistant (Assistant), a CSV import. The server's own code may set it in three ways:

  • a beforeCreate or beforeUpdate hook returns it (a hook's values are the app's own, and are not checked for it);
  • your code writes as nobody: createRecord(objectKey, values, null) or updateRecord(objectKey, id, values, null) from @swirls/spools/extensions (the timeline shows "Website"; inside asSystem(...) when the Spool has record scopes);
  • your code calls the data layer, records.createRecord or records.updateRecord, which runs no hooks and writes no timeline.

immutable, lock, appendOnly and unique hold for the server's own writes too. An audit trail is written only for a person's change.

Uniqueness and the database. Each rule is a unique index (partial, when it has where) in every database: PGlite makes it from the config as it starts, and Prisma's schema has it as @@index([...], unique: true, where: sql`...`), which db:push and db:plan apply to Postgres. The data layer looks for a clash first and says it as a Conflict; two writes that race past that are told apart by the index, and the one it refuses is said the same way, never as the database's own error. A clash is looked for as the server: a record out of the writer's record scope clashes too, and is never named. Before adding a rule to an object that has records, see Database: uniqueness rules.

Live updates#

json
"live": { "seconds": 20 }

List, board and record pages ask every seconds (5 to 3600) whether what they show has changed, and reload only when it has: one small request each time. They ask only while the page is visible, and at once when it is shown again; less often (down to a quarter as often) while nothing changes; and never reload while a field has the focus or a dialog is open: the change waits for the next ask. Leave live out and pages don't ask.

A list or board refreshes when any record of its object changes; a record page when the record, its timeline, tasks or notes change. signals.also on an object names relation fields whose records hear of its changes too: with "signals": { "also": ["job"] } on visits, a job's page refreshes when one of its visits changes. The marks are kept in the change_signals table (Database). Code of your own reads them with changedSince(keys, token) from @swirls/spools/extensions, which answers for whoever the code runs for, or changedSinceAs(keys, token, mayRead) with a check of your own for a caller who is not a teammate. A key is an object key, or <object>:<record id>, and a call takes up to ten.

Views#

json
{ "id": "all", "label": "All deals", "type": "table", "columns": ["title", "value", "stage"], "sort": { "field": "createdAt", "dir": "desc" } }{ "id": "pipeline", "label": "Pipeline", "type": "board", "groupBy": "stage", "cardFields": ["value", "company"] }
  • table: a spreadsheet. columns are field keys (including system columns: createdAt, updatedAt, createdBy, and the activity dates lastActivityAt, lastContactedAt and nextTaskDue), with an optional default sort: one { "field", "dir" }, or a list of up to three. Cells edit in place; column headers sort and filter; rows can be selected and deleted in bulk. A relation sorts by the related record's title.
  • board: a kanban grouped by a select field; each option becomes a column. Drag a card to another column to change the field. Columns show a count, and a total of the first currency field in cardFields.
  • filters (either type) starts the view showing only the records that match. The short form pins fields to a value: { "pipeline": "sales" } or { "active": true }. The long form is a list of conditions with operators, such as [{ "field": "value", "op": "gte", "value": 5000 }]; every field type has its own operators, and conditions can reach through relations. See Search and filters. A board filtered to one value of the field its groupBy depends on only shows the columns that apply, and a record created from a filtered view starts out matching it.

The first view is the default; the rest are in the view menu (?view=<id>). Tables show 50 records a page; boards show up to 500 cards. Every list can be searched, filtered by any field and sorted by up to three columns: see Search and filters.

Views saved in the app#

The views in the config are the starting point. In the CRM, anyone can change a view's columns, sort, filters and footer calculations (sum, average, min, max, filled, empty), or create a new view from the view menu. Those changes are stored in the saved_views table and shared with everyone, so they need no deploy.

  • Columns and calculations are saved as they are changed. Filters and sort are tried first: they go in the page address, so the list can be linked to, and are written to the view when someone presses Save. "Save as a new view" makes a view for everyone or one only its maker sees.

  • Changing a config view stores an override. "Reset to default" in the view menu deletes it and the view goes back to what the config says.

  • Views created in the app can be renamed and deleted there.

  • If you later remove a field from the config, saved views drop it. A config change can't break a saved view.

Built into every CRM#

These need no configuration:

Page What it does
Home Record counts, your open tasks, recent activity, and a box that asks the assistant. With home in the config: a button that adds a record, and your own pipeline
Tasks To-dos with a due date and assignee, optionally linked to a record
Files A file browser over the whole drive: a folder per record, a shared library, and any folders the team adds. Needs a file store: see Files
Notes Titled notes, optionally linked to a record
Reports Team activity: calls, emails, meetings, completed tasks and notes per teammate for a period you pick, with CSV export. With home.pipeline: each person's open pipeline and win rate. Records created per week, and a breakdown of every select field. If the object has a currency field, each breakdown also totals it, weighted by win probability when the options have one.
Workflows Your automations, record actions and campaigns, with recent runs
Ask The assistant, laid out like the chat assistants people already use: past chats in the sidebar, a reply column, and a box at the bottom. Needs Swirls: see The assistant

Every page also has a short guide, offered to each person once and replayable from Help at the bottom of the sidebar.

Record pages add an activity timeline, favourites, and a button that sends a one-off email to the record's email field (or, for a record with no address of its own, to the first related record that has one: a deal's contact), from the teammate's own mailbox when their sign-in allows it and otherwise through your email provider. Calls and meetings are logged from a record page with an outcome, when they took place and notes.

Team activity report#

Reports opens with a table of what each teammate did in a period (today, this or last week or month, the last 30 or 90 days, this year, or a custom range of up to two years):

Column Counts
Calls Calls logged on a record, with how many connected
Emails Emails sent from a record page, and emails teammates sent to contacts from their own mailbox. Emails sent by sequences are listed under "Sequence"
Meetings Meetings logged on a record, and finished calendar events with contacts from a teammate's calendar
Tasks completed Tasks completed in the period, credited to whoever completed them
Notes Notes written in the period

Everyone on the access allowlist is listed, including people with nothing logged. A call or meeting counts on the day it took place, not the day it was entered. "Export CSV" downloads the table for the chosen period. Email and meetings are picked up automatically for teammates who have connected their account; calls made on a phone are only counted once someone logs them.

Any view can be exported as CSV, and CSV files can be imported: columns are matched to fields by key or label, select values by option label, and relations by the related record's title. A relations field is one cell with its titles separated by ; (VIP; Partner), up to 1,000 of them on export, which is as many as an import takes for one record; on import each title is matched the same way, and one that matches nothing is left out. A title that itself contains ; can't be matched: use the record's id in its place. An import is limited to 1,000 rows and doesn't fire automations.

Actions#

Buttons on the record page:

json
{ "id": "enrich", "label": "Enrich with AI", "run": "swirls:enrich_contact" },{ "id": "onboard", "label": "Start onboarding", "run": "campaign:onboarding", "confirm": "Send the onboarding sequence?" }

run targets (shared with automations):

Target What runs
swirls:<workflow> A deployed Swirls workflow, by name. Input: { objectKey, record, actor, trigger }. See Swirls.
campaign:<key> Enrolls the record in a campaign (once per record).
local:<handler> A handler in src/app/extensions.ts.
convert:<key> Makes another record from this one, as conversions says, and opens it.
<kind>:<name> Any kind your extensions register. See Extending.

crm:gen and server start-up check that every target resolves, so a misspelt campaign, handler or kind fails early instead of when someone clicks the button.

Record page sections#

An object with many fields can put them in sections on its record page and in its new-record form, most of them collapsed, with what each role cares about open:

json
"deals": {  "titleField": "title",  "fields": { "...": "..." },  "sections": [    { "key": "money", "label": "Money", "fields": ["value", "stage"] },    { "key": "people", "label": "People", "fields": ["company", "contact"], "collapsed": true }  ]}
Key Required Description
key yes What roles and each person's toggles know the section by. Not more (see below).
label yes Its heading.
fields yes Its fields, in order. A field is in one section at most; the title field is in none.
collapsed no true starts it collapsed for someone no role opens it for. Default false.
  • The title field heads the page, above every section, so it is always there to edit.
  • "More details" is a last section, key more, collapsed, that holds every field no section names. It is left off when every field is in a section.
  • Each role can open some sections and leave others off its pages, with roles.<role>.record.<object> (Roles: record page sections).
  • Each person's toggles are remembered in their browser, per object and section, on the record page and the new-record form alike. A toggle never brings back a section their roles leave off.
  • The new-record form puts the title field and every required field first, open, outside the sections, so a record can always be made whatever a role hides or collapses. The other fields follow in their sections. A collapsed section's inputs are still sent; a section a role leaves off is not in the form, and its fields take their defaults.
  • Checked when the config is: a section naming a field the object doesn't have, the title field, or a field another section names, and two sections with one key, are refused.

Without sections the record page and the form list every field, as they always have. Modules can add sections to any object.

Home#

Home greets each person with a box that asks the assistant, a tile per object, their open tasks and recent activity. home adds the two things people who sell come for: a way to add the record they add most, and their own pipeline.

json
"home": {  "create": "deals",  "pipeline": {    "object": "deals",    "stage": "stage",    "owner": "owner",    "won": ["won"],    "lost": ["lost"],    "value": "value",    "closed": "closeDate"  }}
Key Required Description
create no An object. Home shows a "New " button beside the greeting. It opens the same form as the list, and then the new record. When it is the pipeline's object, the form starts with the person adding it as the owner.
counts no false leaves the tile per object, with how many records there are, off Home.
links no Up to eight links under the greeting: [{ "label": "Today", "to": "/pages/today", "icon": "home" }]. to is a path in the CRM: a page of your own, a list, a page a module adds. icon is optional.
pipeline.object yes The object people sell from.
pipeline.stage yes The select field that is a record's stage. See Pipelines and stages.
pipeline.owner yes A user field saying whose each record is. Its label is what you call that person: "Owner", "Rep", "Designer". A list of up to three when a record has more than one person on it: ["owner", "designer"].
pipeline.won yes The stage values that mean a record was won.
pipeline.lost no The stage values that mean it was lost. Every stage that is neither won nor lost is open.
pipeline.value no A currency field. Home totals it for the open records and for each stage. Without it, Home counts records only.
pipeline.closed no A date field holding the day a record was won or lost. With it, the win rate covers the last 90 days; without it, every closed record.

With pipeline, Home shows the person who is signed in:

  • Open records: how many of the records that name them are at an open stage, and what they add up to. When the stages have a probability, the total weighted by it is shown beneath.
  • Win rate: of their records that were won or lost, the share that were won.
  • Each open stage that holds a record, in the config's order, with its count and total. A stage opens the list filtered to it, and "View all" opens every open record.

With several owner fields a record is someone's when any of them names them, and is counted once however many do. The New button fills in the first of them, and Reports shows one table for each field: the same records by who sold them, and by who designs them.

Someone no record names (an owner of the business, a bookkeeper) is shown the whole team's figures instead, under "Team pipeline". Scopes apply as they do everywhere: the figures only cover records the person may read. Home reads up to 2,000 open records, and says so when there are more.

Reports gains a table of the same figures for everyone: each person's open records and total, what they won and lost, and their win rate, with a line for the team.

crm:gen checks that each field exists and has the type above, that won and lost are options of the stage, and that at least one stage is left open.

Automations#

json
"automations": [  { "on": "contacts.created", "run": "swirls:new_contact" },  { "on": "deals.updated", "run": "local:notifySlack" }]

Events: <objectKey>.created, .updated, .deleted. They fire for changes made in the CRM UI and the assistant. Failures are logged and never block the change that triggered them.

when keeps an automation to some records: select fields, each with the values it may hold. All of them must match.

json
{ "on": "deals.updated", "when": { "stage": ["lost"] }, "run": "campaign:winBack" }

On .created and .deleted it runs for a record that matches. On .updated it runs when a record comes to match, not each time one that already does is changed: a deal that is moved to Lost starts the sequence, and a note added to a lost deal does not. To change or reject a write, or to compare against the previous value, use hooks.

Conversions#

Turning one record into another is an ordinary thing to do in a CRM: a lead becomes a deal, a won deal becomes a job, a quote becomes an order. A conversion says how, so nobody types it again:

json
"conversions": {  "dealFromContact": {    "from": "contacts",    "to": "deals",    "fields": {      "title": "name",      "company": "company",      "contact": { "value": "@record" },      "owner": ["owner", { "value": "@me" }]    },    "set": { "status": "qualified" }  }}

Run it from a button on the record page, or by itself when a record changes:

json
{ "id": "makeDeal", "label": "Make a deal", "run": "convert:dealFromContact" }
json
{ "on": "deals.updated", "when": { "stage": ["won"] }, "run": "convert:jobFromDeal" }
Key What it says
from The object whose record is converted. An action or automation that runs the conversion must be on this object.
to The object of the record that is made.
fields The new record's fields, by key. Each takes its value from one source, or from the first of a list that gives one.
link A relation on from to to. It is set to the new record, and a record that already holds one is not converted again: the button opens the record it has.
set Values set on the from record once the new one exists, such as the stage it moves to.

A source is one of:

Source Gives
"name" That field of the from record. A relation copies to a relation to the same object.
{ "value": "new" } A fixed value. "@today" is today's date, "@me" whoever ran it, and "@record" the from record, for a relation back to it.
{ "from": "type", "map": { "kitchen": "k" } } What that field's value becomes. A value the map doesn't list gives nothing.
["quoted", "estimate", { "value": "@today" }] The first of these that gives a value.

A field none of whose sources gives a value is left out, so the new record takes its default. The new record is made as any other is, by whoever ran the conversion: role access, record scopes, required fields, hooks and automations all apply, and a conversion that can't make its record says why and changes nothing. The from record's timeline says what was made from it. A field that holds many records (relations) can't be copied.

For anything a conversion can't say, write a handler and run it with local:<handler>.

Campaigns#

json
"campaigns": {  "onboarding": {    "label": "Onboarding",    "object": "contacts",    "emailField": "email",    "stopWhen": { "status": ["customer", "churned"] },    "steps": [      { "id": "welcome", "wait": "0m", "subject": "Welcome, {{name}}", "body": "Hi {{name}}, ..." },      { "id": "tips", "wait": "3d", "subject": "Three tips", "body": "..." }    ]  }}
  • wait is relative to the previous step: "0m", "90m", "12h", "3d".
  • {{field}} placeholders are filled from the record when each step sends, so edits made mid-campaign are picked up. {{unsubscribeUrl}} is also available.
  • emailField is an email field of the campaign's object, or one of a record it is related to: "contact.email" writes to the contact a deal names. Placeholders reach the same way: {{contact.name}}. The sequence still belongs to the deal: it is on the deal's timeline, and the deal's stopWhen stops it.
  • Before every step the record is re-read. If it was deleted or a stopWhen field matches, the sequence stops for that record. If the address is missing or on the suppression list, that one email is skipped and the next is tried when it is due.

See Campaigns for delivery, unsubscribes and operations.

Marketing#

json
"marketing": {  "website": "https://acme.com",  "tags": { "ga4": "G-ABCDE12345", "metaPixel": "1234567890123456" },  "channels": {    "company": { "label": "LinkedIn page", "network": "linkedin", "account": "urn:li:organization:12345" }  },  "ads": {    "meta": { "label": "Meta Ads", "network": "meta", "account": "1234567890" }  }}
  • website is the business's site, as an https:// address. It is the only required part.
  • tags are the tracking tags the business uses, by id: gtm, ga4, googleAds, metaPixel, linkedinInsight. Each id must be in its vendor's form.
  • channels are where posts can go. network is linkedin, facebook, x, or one your app adds.
  • ads are the ad accounts whose results are shown. network is meta, google, or one your app adds.
  • via on a channel or an ad account says who calls the network: "direct" (the CRM, the default where it can) or "swirls" (a workflow).

With this block the sidebar gains a Marketing page. marketing can no longer be used as an object's key. See Marketing.

The assistant's page#

assistant changes how the Ask page presents the assistant. What the assistant can do is not set here: that is its tools, in swirls/assistant.swirls (see Swirls).

json
"assistant": {  "name": "Assistant",  "greeting": "What can I help with?",  "suggestions": [    { "label": "Open deals", "prompt": "Which deals are in negotiation, and what are they worth?" },    { "label": "Overdue tasks", "prompt": "Which records have a task that is overdue?" }  ]}
Key Description
name What the assistant is called on the page: the box says "Ask ". Default "Assistant", up to 40 characters.
greeting The line a new chat opens with. Default "What can I help with?".
deny Objects the tool API (the assistant, and workflows calling back) never reads or writes: their records are "not found" to it, and a relation to one carries no title. A tool call can't say which person it acts for, so role access can't narrow it; this can.
suggestions Up to six prompts offered under the box of a new chat. label is the button (up to 40 characters); prompt is what gets asked when it is pressed. Without any, the page writes four from the first object in objects.

Module settings#

A module listed in src/spool.server.ts may take settings, under its name:

json
"modules": {  "approvals": { "object": "deals" }}

Each module checks its own with its schema when the server starts and when bun run crm:gen runs, and crm.config.schema.json describes them for your editor. Settings for a module the Spool doesn't list are refused. A module's objects, fields, roles and guides are not written here: they come with the module, and become part of the config this page describes. To change one, define it here too and name it in overrides in src/spool.server.ts (How the parts are put together).