/assistant-ui:inkfrom assistant-ui
Builds terminal chat UIs using assistant-ui with Ink renderer, including ANSI markdown, thread primitives, and keyboard navigation. Use when scaffolding or composing terminal chat apps.
Ships in assistant-ui. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Always consult assistant-ui.com/llms.txt for the latest API.
@assistant-ui/react-ink connects the assistant-ui runtime to Ink's terminal renderer. It shares runtime, tools, state, and AI SDK transport with web apps, but it has no DOM, CSS, or copied elements. Compose your screen from Ink's Box and Text plus the runtime aware primitives. @assistant-ui/react-ink-markdown renders assistant text as ANSI styled terminal markdown.
TextInputScaffold the terminal example when starting fresh:
npx assistant-ui@latest create --ink my-app
cd my-app
--ink resolves to the with-react-ink CLI example. The example inventory also contains with-react-ink-web, but it is not the --ink scaffold target.
For an existing Node project, install the runtime, terminal renderer, and AI SDK transport together:
npm install @assistant-ui/react-ink @assistant-ui/react-ink-markdown ink react @assistant-ui/ai-sdk
The API route must run in a separate backend project. Unlike a browser app, a terminal process cannot use a relative /api/chat URL. Give AssistantChatTransport a complete URL that the process can reach.
import { AssistantRuntimeProvider } from "@assistant-ui/react-ink";
import { AssistantChatTransport, useChatRuntime } from "@assistant-ui/ai-sdk";
import { Box } from "ink";
import { TerminalThread } from "./components/terminal-thread.js";
const CHAT_API_URL = "http://localhost:3000/api/chat";
export function App() {
const runtime = useChatRuntime({
transport: new AssistantChatTransport({ api: CHAT_API_URL }),
});
return (
<AssistantRuntimeProvider runtime={runtime}>
<Box flexDirection="column">
<TerminalThread />
</Box>
</AssistantRuntimeProvider>
);
}
useChatRuntime and AssistantChatTransport come from @assistant-ui/ai-sdk. Its backend uses the AI SDK v7 UI message stream. See the runtime's AI SDK v7 guide for the route shape.
ThreadPrimitive.Messages creates the current message scope before each child runs. Read s.message inside the message component, then use Ink primitives rather than web elements. Use AuiIf for runtime state gates and LoadingPrimitive for the active run.
import { Box, Text } from "ink";
import {
AuiIf,
ComposerPrimitive,
LoadingPrimitive,
ThreadPrimitive,
useAuiState,
} from "@assistant-ui/react-ink";
import { MarkdownText } from "@assistant-ui/react-ink-markdown";
function Message() {
const message = useAuiState((s) => s.message);
const text = message.content
.filter((part) => part.type === "text")
.map((part) => ("text" in part ? part.text : ""))
.join("");
if (message.role === "user") {
return <Text color="green">You: {text}</Text>;
}
return (
<Box flexDirection="column" marginBottom={1}>
<Text color="blue">Assistant:</Text>
<MarkdownText text={text} />
</Box>
);
}
export function TerminalThread() {
return (
<ThreadPrimitive.Root flexDirection="column">
<AuiIf condition={(s) => s.thread.isEmpty}>
<Text dimColor>Send a message to begin.</Text>
</AuiIf>
<ThreadPrimitive.Messages>{() => <Message />}</ThreadPrimitive.Messages>
<LoadingPrimitive.Root gap={1}>
<LoadingPrimitive.Spinner variant="bar" />
<LoadingPrimitive.Text />
<LoadingPrimitive.ElapsedTime />
</LoadingPrimitive.Root>
<Box borderStyle="round" borderColor="gray" paddingX={1}>
<Text color="gray">{"> "}</Text>
<ComposerPrimitive.Input submitOnEnter placeholder="Message..." autoFocus />
</Box>
</ThreadPrimitive.Root>
);
}
The simple message example deliberately renders only text parts. Use MessagePrimitive.Parts when you need tool calls, attachments, data, sources, or reasoning. Its default terminal safe renderers handle those part types, and primitives shows the component map.
ComposerPrimitive.Input is a composer bound TextInput. It is a controlled line editor, not Ink's nonexistent native input. submitOnEnter sends the current composer text. With multiLine, Enter inserts a newline unless submitOnEnter is enabled, in which case Shift Enter inserts a newline when the terminal distinguishes it. Ctrl J inserts a newline only in multiline mode and never submits a single line input.
Ctrl D operate on one grapheme, so an emoji, ZWJ sequence, combining character, or CJK ideograph is never split.Ctrl A and Ctrl E always select the current line boundary.Ctrl W, Alt B, Alt F, and Alt D navigate or delete by Intl.Segmenter word boundaries. Ctrl U and Ctrl K kill to the current boundary. At multiline end of line, Ctrl K joins the next line.Meta bindings need a terminal that emits Escape prefixed sequences. In macOS Terminal, enable “Use Option as Meta key” for the Alt bindings. Shift Enter requires CSI u support, including iTerm2 3.4 or newer, kitty, and foot. Other terminals treat it as Enter and use submitOnEnter behavior. See primitives for TextInput outside a composer.
Pass accumulated text to MarkdownText from @assistant-ui/react-ink-markdown. It produces terminal styled output rather than HTML or a React DOM tree. The package also exports MarkdownTextPrimitive, useShikiHighlighter, and theme types for a custom renderer, but start with MarkdownText unless you need to change its rendering pipeline.
import { MarkdownText } from "@assistant-ui/react-ink-markdown";
export function AssistantReply({ text }: { text: string }) {
return <MarkdownText text={text} />;
}
The terminal app sends requests to its own process instead of the backend
AssistantChatTransport needs an absolute api URL such as http://localhost:3000/api/chat. Host the AI SDK route separately from the Ink process.A web Thread or shadcn element renders nothing in the CLI
Box, Text, and @assistant-ui/react-ink primitives.A primitive or state hook throws about missing runtime context
AssistantRuntimeProvider runtime={runtime}. ThreadPrimitive.Messages and MessagePrimitive.Parts also create the item scopes their children read.Enter does not send or inserts a newline unexpectedly
submitOnEnter is false by default. Combine it with multiLine only when Enter should send and Shift Enter should insert a newline on capable terminals.Emoji deletion corrupts the visible input or vertical navigation lands in the wrong place
ComposerPrimitive.Input or exported TextInput. Their buffer uses grapheme segmentation and terminal display widths. Do not substitute character index arithmetic.Thread data disappears after restarting the CLI
useLocalRuntime is process memory. Use createFileStorageAdapter for one local process or a RemoteThreadListAdapter for backend owned metadata.Markdown was imported from the web package
MarkdownText from @assistant-ui/react-ink-markdown, which emits terminal formatting. Web markdown renderers target the DOM.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub assistant-ui/skills --plugin assistant-ui17 skills in this plugin
/assistant-uiOverview and router for assistant-ui, the React library for building AI chat interfaces from composable primitives and a styled elements catalog. Use for high-level, cross-cutting, or architecture questions: choosing packages, picking a runtime, or understanding the layers (elements, primitives, the aui client with AuiConfig and AuiProvider, the runtime, adapters) and the message model. Covers `@assistant-ui/react` 0.15.x, `@assistant-ui/ai-sdk` for AI SDK v7 (`useChatRuntime`), `@assistant-ui/core`, `@assistant-ui/store`, `assistant-stream`, `assistant-cloud`, the LangGraph, LangChain, Google ADK, A2A, AG-UI, Eve, OpenCode, and Pi adapters, the `@assistant-ui/react-native` and `@assistant-ui/react-ink` bindings, and the `useAui`, `useAuiState`, and `useAuiEvent` hooks. For a specific area route to a focused sibling instead: setup, elements, primitives, runtime, tools, generative-ui, streaming, cloud, thread-list, copilots, markdown, react-mcp, observability, react-native, ink, or update./cloudAdds AssistantCloud backed persistence, authorization, and telemetry to assistant-ui apps. Use when wiring cross-session thread and message history, multi-device chat, message feedback, file uploads, or auth: passing `cloud` to `useChatRuntime` from `@assistant-ui/ai-sdk`, `AISDKThreads({ cloud })` for `AuiConfig` hosts, or `cloud` on `useLangGraphRuntime`. Covers constructing `AssistantCloud` with `authToken` (JWT), `apiKey` plus `userId`/`workspaceId` (server-side only), or `anonymous`; Clerk, Auth0, Supabase, and Firebase integrations and a backend token endpoint; the `cloud.threads`, `cloud.files`, `cloud.runs`, and `cloud.telemetry` client surface; and a custom `ThreadHistoryAdapter` on `CloudMessagePersistence`. Route here for threads that do not persist, 401s against the cloud API, or feedback buttons that do not save. For the `<ThreadList />` sidebar UI use thread-list; for the general adapter contracts use runtime./copilotsGrounds an assistant in your app with assistant-ui copilots. Use when steering behavior with useAssistantInstructions, feeding send-time app state through useAssistantContext({ getContext }), exposing components with makeAssistantVisible(Component, { clickable, editable }), giving the model two-way component state through interactables (unstable_useInteractable for app-scoped panels, unstable_interactableTool inside defineToolkit for thread-scoped artifacts, mounted via AuiConfig({ unstable_interactables: unstable_Interactables() })), registering instructions and tools with aui.modelContext.register, or bridging model context across an iframe with AssistantFrameProvider and useAssistantFrameHost. Legacy Interactables(), useAssistantInteractable, and useInteractableState are deprecated in favor of the unstable_ API. Reach for this when the assistant should read the page, click or edit UI, or update component state. For LLM tools use tools; for runtime and thread state use runtime./elementsInstalls and customizes assistant-ui elements, the styled shadcn-style component catalog served from the r.assistant-ui.com registry through `npx assistant-ui@latest add <item>`. Use when adding a prebuilt chat surface or widget (Thread, ThreadList, AssistantModal, AssistantSidebar, ToolFallback, ToolGroup, MarkdownText, Reasoning, Sources, Attachment, ModelSelector, Voice orb, McpConfig) or one of the 120 standalone elements (approval card, agent plan, code diff, data table, chart, and so on), choosing between runtime-connected `<name>.aui.tsx` files and props-driven standalone files, overriding Thread slots through the `components` prop, editing the copied source under `components/assistant-ui/elements/`, or picking the Radix versus Base UI flavor in `components.json`. Route here when an import from `@/components/assistant-ui/...` fails, an element renders unstyled, or the CLI installs the wrong flavor. For unstyled building blocks use primitives; for the CLI scaffold itself use setup./generative-uiLets the model compose interfaces at runtime from a component vocabulary instead of one hand-written component per tool, and covers every generative UI pattern in the framework. Use for the model-driven present tool: JSONGenerativeUI, defaultGenerativeUILibrary, and present({ display }) from @assistant-ui/generative-ui/react, registered through AuiConfig({ tools: Tools({ toolkit }) }). Also covers the backend-driven MessagePrimitive.GenerativeUI primitive and its component allowlist, the Slack Block Kit and Microsoft Teams Adaptive Card renderers and their action decoders, A2UI surfaces over AG-UI, and the third-party OpenUI integration. Route here when the model should design its own layout rather than fill one you wrote, when an unknown _type or component name throws or silently renders nothing, or when a generative UI tree needs to post to Slack or Teams or paint an A2UI surface. For a widget tied to one tool call you already know about, use tool-ui in the tools skill instead./markdownRenders assistant message text as markdown in assistant-ui. Use when wiring MarkdownTextPrimitive or the markdown-text element into MessagePrimitive.Parts, installing Shiki or Prism highlighting, adding KaTeX math or Mermaid diagrams, normalizing model-produced math delimiters, or choosing StreamdownTextPrimitive for block-aware streaming with optional code, math, Mermaid, and CJK plugins. Covers defer and smooth parsing behavior, code block overrides, and stream completion. For the surrounding unstyled message composition use primitives, and for installing or editing a styled renderer use elements.Other plugins' skills for the same job