Give a run a thread and the conversation is kept on your user's own computer. No database of yours, and Soba can't read it.
A thread is a conversation kept on your user's own computer. Your app lists it, reads it
and adds to it. You need no database, and your user keeps it when they switch AI.
JavaScript
const run = await soba.run({ user, prompt: "Plan the launch", thread: "new" })
for await (const event of run) {
if (event.type === "done") save(event.thread) // "th_…"
}
// Later: send only the new message. Any AI can carry on.
await soba.run({ user, prompt: "Now write the email", thread, runtime: "codex" })
A run with no thread is not kept in one.
How the AI knows what was said#
The run's first status event says so, as continued:
|
|
resumed |
The AI went on with its own conversation |
rebuilt |
It was handed the words so far, up to 100,000 characters. Another AI, another folder or another computer |
new |
It knows none of it |
Reading and changing threads#
JavaScript
const { threads, before } = await soba.threads.list({ user })
const { messages } = await soba.threads.get({ user, thread })
const found = await soba.threads.search({ user, query: "launch date" })
await soba.threads.update({ user, thread, title: "Launch", meta: { board: 7 } })
const branch = await soba.threads.fork({ user, thread, at: messages[2].id })
await soba.threads.delete({ user, thread })
- Your app sees its own threads, and any your user shares with it.
fork copies a thread down to one message. To ask something again, branch at the message before it.
scope: "workspace" on create or update lets your workspace's other apps read and continue a thread, on computers your user connected them to.
meta is yours, up to 4 KB.
A refusal throws a SobaError: not_found when there is no such thread for your app,
no_compute when no computer of theirs is online.
When another compute answers#
A run your user's computer didn't serve is added to the thread afterwards, in words. If the
computer is asleep, the SDK seals the turn to it and it is collected on waking. done has a
thread once it is kept. For a run you served yourself:
JavaScript
await soba.threads.append({
user, thread, turn: "invoice-4411", // your id, so a retry is kept once
messages: [{ role: "user", content: q }, { role: "assistant", content: a }],
})
Where it is#
- On your user's computer, encrypted on its disk. Read it while one of their computers that has it is online.
- Requests are end-to-end encrypted, like runs, unless your client says
encrypt: false.
- Your user can turn on an encrypted backup, which also puts threads on their other computers. Soba stores it and can't open it.
- Tool inputs and outputs are cut at 16,000 characters.
Bring threads into a desktop app#
Your app keeps its own history. @soba-so/sdk/local lets your user bring in the chats they
already have on their Mac or Linux computer, from every AI app that keeps them there. It needs no
key and no network.
|
Where from |
| Agents |
Claude Code (terminal and the Claude app's Code tab), Codex (terminal and app), Cursor's CLI, Gemini CLI, Copilot CLI, Augment, OpenCode, Mistral Vibe, Grok Build |
| Apps |
Cursor, Windsurf (read while it is open, and kept), Claude Cowork, VS Code's chat and its forks, LM Studio, Ollama |
| Imports |
claude.ai and ChatGPT export zips, and any app's Markdown or JSON chat export, once your user imports it in the Soba app |
runtime on each thread says where it is from. Antigravity, Raycast and the ChatGPT app keep theirs
encrypted, and claude.ai keeps its own on its servers, so those come in by import.
JavaScript
import { connectThreads } from "@soba-so/sdk/local"
const threads = await connectThreads({ app: "My Terminal", folder }) // asks once, in the Soba app
const { threads: list } = await threads.list({ folder })
for await (const message of threads.messages(list[0].id)) save(message)
const { command, folder: cwd } = await threads.resume(list[0].id, { in: "codex" })
- Your user answers with all their threads, only
folder, or no. A chat that ran in no folder, such as an export's, comes only with all. They can take it back, which applies to the next request.
- Hand your own threads over with
threads.import({ key, title, folder, messages }), and the person's other allowed apps can bring them in. Call it again to add what is new. threads.remove(key) takes one out.
- Don't hand over what you brought in: it is already there.
own marks yours in list.
- Reading copies: the original stays where it is.
key is a message's own within its thread, so you can bring one in again without duplicates.
resume answers with a shell command to run in folder. In the same agent the conversation goes on. Anywhere else, it is carried over in words, not the model's hidden state: into the other agent, from another app, or from a thread an app handed over.
- Terminal layouts and running programs don't come along. Pictures are noted, not copied. Threads made by other apps' Soba runs aren't listed.
- A signed Mac app is shown by its signature. Anything else is shown as unverified.
- This asks your user. It is not a sandbox: any program running as them can open those files itself.
In another language, start ~/.soba/bin/soba-threads from your app's own process and write a
line of JSON per request: {"id":1,"method":"connect","params":{"app":"My Terminal"}}. Then
list, read, resume, import (up to 500 messages a time) and remove, with the same options. Each answer is a line with your id, and a result or an
error of { code, message }. read takes id and the last answer's next as cursor.
It throws a LocalThreadsError: not_installed, declined, not_allowed, not_found, invalid or unavailable.