# Migrating to Ghost AI views

Replace one conversation view while keeping your existing chat stack.

## Choose a view to replace

Start with one visible part of the interface, such as the transcript or a tool result. Keep your thread store, SDK, permissions, and transport. Check the [tested versions](/libraries/ai-stability) if you also plan to upgrade the SDK.

| Current interface | Ghost composition | Preserve |
| --- | --- | --- |
| Trace, Task, Chain of Thought | [Activity](/ai-elements/activity#patterns) | Public event IDs/order, lifecycle and user disclosure |
| Plan / Queue | [TodoList](/ai-elements/todo-list), or sectioned Activity | Known forecast versus observed work; scheduling stays native |
| Tool / Confirmation | [Tool and ToolApproval](/ai-elements/tool) | Call/request IDs; permission, acknowledgement and execution separately |
| Sources / Inline Citation | [Citation](/ai-elements/citation) | Source identity, cited versus provided mode and response scope |
| Terminal / Test Results / Stack Trace | [Activity patterns](/ai-elements/activity#terminal) plus [Snippet](/components/snippet) | Native process/run outcome, partial output and safe detail |
| Message / Prompt Input | [Message](/ai-elements/message), [Composer](/ai-elements/composer) | Draft, attachments, send/stop ownership and focus |

Keep SDK-specific actions such as checkpoint forks and artifact access on the native client until the new view can surface them correctly.

## From shadcn or AI SDK Elements

The current [shadcn AI Elements](https://ui.shadcn.com/docs/ai-elements) catalogue is already a set of copyable compositions. Existing copied files keep working; there is no mandatory migration or AI Elements package to uninstall.

- Choose one existing pattern and keep its data/callbacks unchanged.

- Replace its presentation with the owner in the table. Use explicit host mappings; a queue is not automatically a scheduler and a Snippet is not a process.

- If existing callers depend on legacy exports/props, keep an app-local compatibility wrapper while migrating them. That wrapper belongs to your project, rather than becoming another Ghost public alias.

- Verify IDs, streaming replacement, failure/stopped/unknown states, disclosure and the affected action before replacing another view. Retain the old composition as a rollback until that check passes.

Map your existing props and callbacks to the Ghost view. If you already use Vercel AI SDK or TanStack AI, follow the [Vercel recipe](/libraries/ai-runtime-vercel) or [TanStack recipe](/libraries/ai-runtime-tanstack).

## From Assistant UI

[Assistant UI](https://www.assistant-ui.com/docs/architecture) has managed runtimes, external-store integration and standalone elements. Keep whichever runtime/provider your application already uses. Ghost does not provide a replacement for its thread persistence, branching, editing or server protocol.

Replace an isolated work-history or result view first. Project the native snapshot into explicit Ghost view props, keeping native IDs and the original callbacks. Leave richer native actions on Assistant UI until their meaning can be preserved by a deliberately mapped Ghost command. Do not start a second transcript store or mount a second chat hook for the same thread.

Pass application events that your app has already converted to Ghost props. Keep the Assistant UI hook or store at the application boundary.

```tsx
import type { ActivityEvent, ActivityState } from "@collectivecreation/ghost-ui/chat-model";
import { Activity, ActivityContent, ActivityList, ActivitySummary } from "@collectivecreation/ghost-ui/components/activity";

export function WorkHistory({ events, state, open, onOpenChange }: {
  events: readonly ActivityEvent[];
  state: ActivityState;
  open: boolean;
  onOpenChange: (open: boolean) => void;
}) {
  return <Activity open={open} onOpenChange={onOpenChange}>
    <ActivitySummary state={state} statusText={null}>Recorded work</ActivitySummary>
    <ActivityContent><ActivityList events={events} /></ActivityContent>
  </Activity>;
}

```

Keep final answers and pending decisions outside a collapsed history. Do not identify an answer by taking the last text part. Classify a public reasoning summary explicitly; unclassified model reasoning is omitted. The assistant-stream decoder route is a separate protocol integration, not Assistant UI runtime parity.

## From a native SDK hook or an existing store

Use [plain Ghost props](/libraries/ai#installation) when your application already projects the required records. Add [the optional runtime binding](/libraries/ai-runtime) for current-context command guards or a React store subscription, and select the native recipe in [the runtime chooser](/libraries/ai-runtimes). Bind one native state owner per thread/revision.

Vercel AI SDK output can be preliminary while a payload exists. TanStack interrupts, Cloudflare durable recovery and remote task cancellation have their own semantics. A transport stopping does not establish server cancellation; a callback resolving does not establish approval acknowledgement or execution success. Keep the native object alongside the view projection for capabilities outside Ghost's shared contract.

## Test the replacement

Use the current view as a baseline for one real task. Confirm that the replacement preserves message/part/call/request identity, order, user disclosure, finality, cancellation scope and permission boundaries. Validate unknown custom data before rendering; preserve false/zero/empty results rather than testing payload truthiness. Exercise the selected native version through its public imports before claiming runtime compatibility. Then remove the obsolete app-local view; keep your dependency lockfile and rollback path.

See [contracts](/libraries/ai-contracts), [adapters](/libraries/ai-adapters), [stability](/libraries/ai-stability) and [Activity patterns](/ai-elements/activity#patterns) for the canonical owners and exact boundaries.
