matter.work
Building Apps / The SDK

Boards and tasks

Read, watch, and write the tasks of your app's boards through their built-in indexes.

Call matter.board(key) to read and write the tasks of a task board in your app’s space. Name your app’s own boards (declared under boards in matter.json) by key, and any other board of the space by its name or ID. Boards need Matter 0.4.3: an app that declares them sets "minMatterVersion": "0.4.3" or newer.

Reading and writing tasks
const pipeline = matter.board('pipeline')

// The board's open tasks, column by column
const { tasks } = await pipeline.query()

// Mine, in the active statuses
const mine = await pipeline.query({ index: 'by_owner_status', eq: { owner: '$viewer', status: ['new', 'contacted'] } })

// Add a task, move it, and note what happened
const id = await pipeline.insert({ title: 'Acme', values: { tier: 'a' }, due: '2026-11-03' })
await pipeline.update(id, { status: 'meeting' })
await pipeline.addUpdate(id, 'Booked a call with Sam for Tuesday.')

// Add a step to its plan
const task = await pipeline.get(id)
if (task) await pipeline.update(id, { plan: [...task.plan, { title: 'Send pricing' }] })

Tasks are always on the member’s computer, so every read is local and fast. Writes run as the member using the app, update local reads immediately, and resolve once the server commits them, as table writes do.

Tasks#

A task
{
  id: string
  title: string
  status: string                // a status key of the board
  owner: { id, name } | null
  priority: 'low' | 'medium' | 'high' | 'urgent' | null
  due: number | null            // epoch milliseconds
  description: string           // markdown
  plan: { id, title, done, due, dueTime }[]   // its plan's steps, in order
  values: { [fieldKey]: value } // the board's fields
  startedAt: number | null      // first entered an active status (Matter 0.4.4+)
  completedAt: number | null    // entered a done status
  canceledAt: number | null     // entered a canceled status (Matter 0.4.4+)
  createdAt: number
  updatedAt: number
}

values holds the board’s own fields by key, in the same shapes as table rows: select options by key, people as { id, name }, and linked rows as { id, title }.

Matter sets the lifecycle times from the task’s status, whoever moves it: startedAt the first time the task enters an active-group status (it stays after that), completedAt when it enters a done status, and canceledAt when it enters a canceled one. Leaving the group clears completedAt or canceledAt, and moving between two statuses of the same group keeps the original time. Tasks canceled before Matter 0.4.4 have no canceledAt.

Reading Tasks#

Method Returns
info() { id, key?, name, statuses, fields }. Each status is { key, name, group, color? }, in the board’s order.
query(read?) Without an index, { tasks }: every open task (up to 5,000) in board order. With an index, a page: { tasks, nextCursor? }.
count(read?) How many tasks the same read matches.
get(id) / getMany(ids) One task (or null) / the tasks found, by ID.
matter.boards() The info() of every board in the app’s space.

A task is open while its status is in the backlog, ready, active, or blocked group, and finished once it’s in done or canceled. Board order is column by column, in the order people arranged each column.

Board Indexes#

Boards don’t declare indexes. Every board has four, over its tasks’ built-in fields:

Index eq Order
by_status { status } (required: a key or a list) Board order
by_owner_status { owner, status? }; owner is required: a member ID or '$viewer' Board order
by_status_due { status? } Tasks with a due date, soonest first
by_completed { status? } Finished tasks, most recently completed first

A page holds limit tasks (default 100, up to 1,000). Pass after: nextCursor for the next page, and order: 'desc' to read an index in reverse.

Paging through finished tasks
let after: string | undefined
do {
  const page = await pipeline.query({ index: 'by_completed', eq: { status: 'meeting' }, limit: 200, after })
  report(page.tasks)
  after = page.nextCursor
} while (after)

Live Reads#

watch(read, listener), watchCount(read, listener), and watchTasks(ids, listener) deliver the current answer and fire again whenever it changes. Listeners get the same ReadState as table watches, and each call returns a function that stops the watch.

Watching a column
const stop = pipeline.watch({ index: 'by_status', eq: { status: 'contacted' } }, (state) => {
  if (state.status === 'ready') renderColumn(state.value.tasks)
})

Writing Tasks#

Method Behavior
insert(task | tasks, options?) Creates up to 500 tasks. Resolves to the new ID (or IDs).
update(id, changes, options?) Changes the given parts of a task. null clears priority, due, description, or a field in values.
updateMany(changes, options?) Updates up to 500 tasks: each item is { id, ...changes }.
delete(id | ids) Deletes one or up to 500 tasks.
addUpdate(id, text) Posts a note on the task’s timeline (its updates) as the member.
  • A new task needs a title. Its status defaults to the board’s first status, and its owner to the member (pass '$viewer' or a member ID to choose).
  • due takes epoch milliseconds or an ISO date or date-time.
  • Writes don’t take startedAt, completedAt, or canceledAt: change the status and Matter sets them (see Tasks).
  • plan takes the task’s whole plan, up to 50 steps of { id?, title, done? }, in order: the plan becomes exactly that list, and [] clears it. A step’s id keeps a step the plan has (and its done, if you leave done out); a step without one is new. An update changes only the steps that differ, so steps people check off or edit meanwhile keep their changes.
  • A step’s due (since Matter 0.4.4) is when it’s to be done: a day as "YYYY-MM-DD", or a time as an ISO date and time or epoch milliseconds; null clears it, and a kept step without one keeps its own. Reads give epoch milliseconds, with dueTime saying whether it has a time (a day is at noon, as a task’s due is). Matter never works dates out: a step’s date is whatever the app, an agent or a person set.
  • { createOptions: true } adds unknown select options, but only on boards no app owns. An app’s own board has the options its manifest declares.

Typed Boards#

matter app types also types your declared boards, so matter.board('pipeline') checks status keys, field keys, and values, and types the tasks it returns.