Embedded assistant
A small task board with Familiar beside it. The board keeps its own tasks. Familiar gets tools that call the board’s operations, so dragging a card and asking Familiar change the same data.
Everything runs in this page: the real core, in-memory storage, the HTTP API and its event stream, and the client store. Only the model is scripted, so Familiar understands a few phrases. Press Assistant in the frame, or open it fullscreen to see the chat beside the board, and try:
- What’s in progress?
- Add a task: Write the release notes
- Assign T-3 to me
- Move T-3 to done
- What’s on the board?
Then drag a card or press Assign to me and ask again. Familiar reads the board as it is now. Reloading resets the demo.
One owner for the tasks
Section titled “One owner for the tasks”The board is the only place tasks change. Its UI and Familiar’s tools call the same operations. Each tool returns text for the model, and a change the board refuses as an error result the model can explain:
defineTool({ name: 'assign_task_to_me', description: 'Assigns a task to the person asking.', parameters: schema.obj({ taskId }), execute: async ({ taskId }, _api, context) => { // The person who asked, never a tool argument. Undefined for // work nobody asked for, such as memory filing. const author = await familiar(context).author() return run(() => { if (!author) { throw new BoardError('Nobody asked, so there is no one to assign.') } return `Assigned ${describeTask(board.assign(taskId, author))}.` }) },})Every board tool is available to everyone in the board’s room. assign_task_to_me acts only for a person: the author of the message that started the call, or a schedule’s creator, never memory filing. This board lets anyone change any task. A board with rules about who may change what would check them in its operations, against the author, so the same rules apply to the UI and the tools.
Only what it needs
Section titled “Only what it needs”The host opens a workspace with one Familiar and one room for the board, and allows only posting, history, Stop and the events of that room. Memory, schedules, other rooms, sign-in, connections and MCP answer 403:
const familiar = await workspace.familiars.create({ name: 'Familiar', persona: PERSONA,})const room = await workspace.rooms.create({ name: 'Board', familiars: [familiar.id],})
const CHAT = new Set<Operation>([ 'rooms.post', 'rooms.history', 'rooms.stop', 'events.room',])
const api = createHttpApi(workspace, { // Nobody signs in to this demo, so every request is from its one person. authenticate: () => CURRENT_AUTHOR, allow: (_, operation, resource) => CHAT.has(operation) && !!resource && 'room' in resource && resource.room === room,})
// In-page requests. A real host passes its API's URL instead.const store = createRoomStore('https://demo.invalid', room, { fetch: async (input, init) => api.fetch(new Request(input, init)),})The demo has one fixed person and nobody signs in, so authenticate names them for every request. That is a demo identity, not authentication. In the demo, fetch hands each request to the API inside the page. A real host serves them from its server, authenticates each request from its session and passes the API’s URL instead.
Using a real model
Section titled “Using a real model”The scripted model comes from core’s scriptedModels, which answers a few phrases with the tool calls a model might make. To use a real one, run the same Familiar on a server you control with a provider from Models and sign-in, and serve its API as in Serve the API. Model credentials stay on that server. The host must also provide an API and updates for its task data. Here, React and the tools share an in-page Zustand store. On a server, tools should use the host’s server-side task operations, while the React board uses the host’s API to read and change tasks. Familiar’s room events do not synchronise that data.