runtime
Skill8 starsChanged 5 months agoMITView on GitHub
Guide to the assistant-ui runtime system, single-thread state, and the imperative runtime API in @assistant-ui/react. Use when creating a runtime (useLocalRuntime with a ChatModelAdapter, useExternalStoreRuntime for Redux/Zustand, useRemoteThreadListRuntime), wiring AssistantRuntimeProvider, or reading/mutating thread, message, and composer state and events. Covers the unified hooks useAui, useAuiState, useAuiEvent (composer.send, thread.runStart, thread.runEnd), legacy hooks (useAssistantRuntime, useThreadRuntime, useMessageRuntime, useComposerRuntime, useThread, useThreadMessages), the AssistantRuntime/ThreadRuntime/MessageRuntime/ComposerRuntime hierarchy, thread operations (append, cancelRun, message().edit/reload), capabilities, and types (ThreadMessage, MessagePart, MessageStatus, ChatModelRunResult). Use for provider "Cannot read property of undefined" errors or state not updating. For multi-thread list UI and switching between conversations use thread-list instead.
4 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- koharu-rs/koharutheir own version, first seen Nov 8, 2026
- utopusc/livinity-ioedited, first seen Oct 8, 2026
- mayocream/koharutheir own version, first seen Oct 8, 2026
- PlayUGCAI/bloxkit-aitheir own version, first seen May 7, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- utopusc/livinity-io★ 7269% same
Wrote their own version · 3
- koharu-rs/koharu★ 6.9ksame name
- mayocream/koharu★ 6.9ksame name
- PlayUGCAI/bloxkit-ai★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- public/llms-full.txtllms.txt
- public/llms.txtllms.txt
- assistant-uiSkill
- cloudSkill
- copilotsSkill
- markdownSkill
- observabilitySkill
- primitivesSkill
- react-mcpSkill
- setupSkill
- speckit-agent-context-updateSkill
- streamingSkill
- thread-listSkill
- toolsSkill
- updateSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 111
Ensure hooks are called inside AssistantRuntimeProvider
- Very specific: line 115
Use selectors with useAuiState to prevent unnecessary re-renders
- Distinctive: line 119
Check runtime is configured
- Distinctive: line 120
Verify API response format
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
assistant-ui Runtime
Always consult assistant-ui.com/llms.txt for the latest API.
References
- ./references/local-runtime.md -- useLocalRuntime deep dive
- ./references/external-store.md -- useExternalStoreRuntime deep dive
- ./references/thread-list.md -- Thread list management
- ./references/state-hooks.md -- State access hooks
- ./references/types.md -- Type definitions
- ./references/adapters.md -- Attachment, speech, dictation, suggestion, and history adapters
- ./references/voice.md -- Realtime voice chat
- ./references/runtime-concepts.md -- Stability policy, transport runtime, message timing
Runtime Hierarchy
AssistantRuntime
├── ThreadListRuntime (thread management)
│ ├── ThreadListItemRuntime (per-thread item)
│ └── ...
└── ThreadRuntime (current thread)
├── ComposerRuntime (input state)
└── MessageRuntime[] (per-message)
└── MessagePartRuntime[] (per-content-part)State Access (Modern API)
import { useAui, useAuiState, useAuiEvent } from "@assistant-ui/react";
function ChatControls() {
const api = useAui();
const messages = useAuiState((s) => s.thread.messages);
const isRunning = useAuiState((s) => s.thread.isRunning);
useAuiEvent("composer.send", (e) => {
console.log("Sent in thread:", e.threadId);
});
return (
<div>
<button
onClick={() =>
api.thread().append({
role: "user",
content: [{ type: "text", text: "Hello!" }],
})
}
>
Send
</button>
{isRunning && <button onClick={() => api.thread().cancelRun()}>Cancel</button>}
</div>
);
}Thread Operations
const api = useAui();
const thread = api.thread();
thread.append({ role: "user", content: [{ type: "text", text: "Hello" }] });
thread.cancelRun();
const state = thread.getState(); // { messages, isRunning, ... }Message Operations
const message = api.thread().message(0);
message.edit({ role: "user", content: [{ type: "text", text: "Updated" }] });
message.reload();Events
useAuiEvent("thread.runStart", () => {});
useAuiEvent("thread.runEnd", () => {});
useAuiEvent("composer.send", ({ threadId }) => {
console.log("Sent in thread:", threadId);
});
useAuiEvent("thread.modelContextUpdate", () => {});Capabilities
const caps = useAuiState((s) => s.thread.capabilities);
// { cancel, edit, reload, copy, speak, attachments }Common Gotchas
"Cannot read property of undefined"
- Ensure hooks are called inside
AssistantRuntimeProvider
State not updating
- Use selectors with
useAuiStateto prevent unnecessary re-renders
Messages array empty
- Check runtime is configured
- Verify API response format
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

