On this page
Sommatic Docs
Open portal

Hooks

React hooks of the SDK - the Command Center and its registration hooks, the task inbox, real-time task events, deadline monitoring, the run console and notification preferences.

View as Markdown
Open in

The hooks connect your components to the Command Center and to the person’s work. Most of them need the signed-in user from Veripass’s AuthProvider; the Command Center hooks also need CommandCenterProvider.

Command Center

HookWhat it does
useCommandCenter()Returns the Command Center: registerCommands, getContext, registry, executeIntent, allCommands, providers, isThinking, error… Returns null when no provider is mounted, so shared components can fall back to an empty object.
useSommaticContextSource(source, deps)Publishes a snapshot the model can read: { id, description, getData, ttl_ms? }. The snapshot is cached 30 seconds by default.
useSommaticSurface(surface, deps)Publishes a surface with its handlers and targets: { id, type, label, description?, targets?, handlers? }.
useSommaticSelection(selection, deps)Publishes the current selection: { type, content, surface_id }.
useSommaticFocus(focus, deps)Publishes the entity in focus: { entity_type, entity_id, label, metadata }.
useCommandCenterAgent(options)The inference loop on its own: classifyIntent turns a request into a plan and executePlan runs it. The panel already uses it; reach for it only to build your own interface.

All registration hooks unregister on unmount and register again when deps change. How to use them in a page is in Integration.

Tasks

useTaskInbox(options)

The signed-in person’s inbox, sorted by urgency and refreshed on a timer and whenever a task event arrives.

JavaScript
import { useTaskInbox } from '@sommatic/react-sdk';

function InboxBadge() {
  const { counts, badgeSeverity, groups, isLoading, refresh } = useTaskInbox({ pollIntervalMs: 60000, pageSize: 10 });
  return <span data-severity={badgeSeverity}>{counts.total}</span>;
}
OptionDefault
enabledtrueTurns the hook off.
pollIntervalMs60000How often it reloads.
dueSoonThresholdMs1800000How close a deadline must be to count as “due soon” (30 minutes).
pageSize10How many tasks it loads.

It returns tasks, groups (overdue, dueSoon, critical, normal), counts, badgeSeverity, isLoading and refresh.

useEventStream({ userIdentity, enabled, baseUrl })

Opens the task stream for one person and turns each task-assigned event into a sommatic::task-notification DOM event, which TaskNotificationToast shows and useTaskInbox uses to refresh. Mount it once in your layout:

JavaScript
const { user } = useAuth();
useEventStream({ userIdentity: user?.identity, enabled: Boolean(user?.identity) });

useTaskSLAMonitor(fetchActiveTasks, options)

Checks the person’s active tasks on a timer and emits sommatic::task-notification for tasks whose deadline is close or has passed. fetchActiveTasks is an async function you provide that returns the tasks. Options: enabled, onLoad (check on mount, default true), repeat (default true), intervalMs (default 15 minutes) and dueSoonThresholdMs (default 30 minutes).

Notification preferences

useNotificationPreferences() reads the person’s preferences (pause, quiet hours, minimum priority, muted types and per-app switches) from the browser’s local storage and keeps them in sync across tabs. readNotificationPreferences, writeNotificationPreferences, isQuietNow and shouldNotify work with the same data outside React. The storage key is NOTIFICATION_PREFS_KEY, and NOTIFICATION_PREFS_EVENT is the event fired when they change.

Workflows and apps

HookWhat it does
useSseConsole()The controller of FlowsSseConsole: collects run events with stable ids and evaluates JavaScript against them, with $('evt-3'), $events and $last. Returns items, events, commandHistory, push, clear, reset and evaluate.
useAppStateSync(sdk, state, deps, options)For App Engine apps: saves the app’s view state through the runtime sdk (debounced, 5 seconds by default) and restores it when the app reopens, with options.onRestore.
useLocalStorage(key, defaultValue)A value kept in local storage.

Next steps

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs