Multi-adapter AI chat plugin for Paperclip. Provides a conversational interface to Paperclip agents with thread management, slash commands, and real-time streaming.
- A running Paperclip instance (
paperclipaiCLI available) - Node.js 20+ and npm
- At least one agent with
adapterType: "claude_local"(or another supported adapter)
git clone https://github.com/NSXBet/paperclip-plugin-chat.git
cd paperclip-plugin-chat
npm install
npm run buildThe preinstall script automatically locates and copies the Paperclip Plugin SDK from your local Paperclip installation (bun cache, npm cache, or plugins directory).
If the auto-detection fails, set it up manually:
# Find the SDK in your Paperclip installation's cache:
mkdir -p .paperclip-sdk
cp -r ~/.bun/install/cache/@paperclipai/plugin-sdk@*/ .paperclip-sdk/plugin-sdk
# Then re-run:
npm install
npm run buildThe build pipeline:
tsc— type-checks and emits declaration filesbuild-worker.mjs— bundlessrc/worker.tswith esbuild (all deps inlined, zero runtime resolution needed)build-ui.mjs— bundlessrc/ui/index.tsxwith esbuild (React/SDK UI externalized)
Output: dist/worker.js (server-side, self-contained) and dist/ui/index.js (browser bundle).
paperclipai plugin install "$(pwd)" --localNote: This command requires board-level access. Run it as the Paperclip board user, not as an agent.
paperclipai plugin inspect paperclip-chatLook for status: running. If it shows errored, check paperclipai plugin inspect paperclip-chat for error details.
After installation, hard-refresh your browser (Ctrl+Shift+R). You should see:
- A "Chat" link in the company sidebar (between Inbox and Issues)
- Clicking it navigates to
/:companyPrefix/chat
The plugin creates a chat UI inside the Paperclip plugin page slot. When a user sends a message, the plugin:
- Creates a thread (persisted in plugin state)
- Finds a compatible agent via
ctx.agents.list()(prefers "Chat Assistant", falls back to role "general") - Creates or resumes an agent session via
ctx.agents.sessions - Streams the agent's response back to the UI
All LLM access goes through Paperclip's agent session system. The plugin does not talk to models directly — it talks to agents that talk to models. See Plugin vs Core Analysis for the implications of this architecture.
- Welcome screen with quick action chips (check issues, review goals, plan work, agent status)
- Threaded conversations with sidebar navigation
- Rich markdown rendering (tables, code blocks, lists, links, blockquotes)
- Collapsible tool usage display ("Used 3 tools Bash x3")
- Auto-generated thread titles from first message
- Inline thread rename (double-click) and delete (with confirmation)
Type / in the input to access built-in commands:
| Command | Action |
|---|---|
/tasks |
List active tasks |
/dashboard |
Workspace dashboard |
/agents |
Agent status overview |
/create |
Create a new task |
/projects |
List projects |
/costs |
Cost breakdown |
/activity |
Recent activity |
/blocked |
Blocked tasks |
/plan |
Plan and break down work |
/handoff |
Hand off work to an agent |
The plugin supports real-time streaming via SSE (ctx.streams). During agent execution, users see live text output with a blinking cursor, tool activity indicators, and a stop button.
Navigate to Settings > Plugins > Chat (gear icon):
| Setting | Description |
|---|---|
| Default Adapter | Adapter type for new threads (claude_local, codex_local, opencode_local) |
| System Prompt Override | Custom text appended to chat sessions |
| Capability | Purpose |
|---|---|
ui.page.register |
Full chat page at /:prefix/chat |
ui.sidebar.register |
Sidebar nav link |
agent.sessions.* |
Create and message agent sessions |
agents.read |
Discover available agents/adapters |
plugin.state.* |
Thread and message persistence |
activity.log.write |
Activity logging |
Browser Server
------- ------
ChatPage (React)
|
|-- usePluginData("threads") --> Worker: getData("threads")
|-- usePluginData("messages") --> Worker: getData("messages")
|-- usePluginAction("sendMessage") --> Worker: sendMessage action
| |
| |--> ctx.agents.sessions.create()
| |--> ctx.agents.sessions.sendMessage()
| | |
| | +--> Agent adapter --> CLI process
| | |
| | +--> onEvent callbacks
| |
| |--> ctx.streams.emit() (SSE)
|
|-- usePluginStream("chat:threadId") <-- SSE events (text, thinking, tool, done)
The worker must be bundled with esbuild so all dependencies (including @paperclipai/plugin-sdk, zod, @paperclipai/shared) are inlined. If you see this error, run npm run build — the build script bundles the worker via scripts/build-worker.mjs.
Paperclip's sidebar renders PluginSlotOutlet with slotTypes=["sidebar"], which matches ui.slots entries — not launchers. The manifest must include a sidebar type slot (not just a launcher). This is already configured in the current version.
paperclipai plugin inspect paperclip-chatCheck the error message. Common causes:
- Missing SDK: ensure
.paperclip-sdk/plugin-sdkexists andnpm installcompleted - Build not run: ensure
npm run buildcompleted without errors
# Type-check without building
npm run typecheck
# Full build
npm run build
# Clean build artifacts
npm run clean
# Reinstall after changes
paperclipai plugin uninstall paperclip-chat
paperclipai plugin install "$(pwd)" --local- No direct LLM access — requires a pre-configured agent; can't create agents or select models
- Agent sessions are task-oriented — no way to distinguish "answer this question" from "execute this task"
- No deep linking — thread state is lost on page refresh
- Host page chrome — breadcrumbs and back button can't be hidden
For the full analysis, see Plugin vs Core: Chat Feature Analysis.
See the Testing Guide for setup instructions, a full test checklist, and troubleshooting steps.
| Document | Description |
|---|---|
| Plugin vs Core Analysis | Why chat as a plugin has fundamental limitations |
| Testing Guide | Test checklist and setup for testers |
| Core Integration Spec | Recommendation for building chat as a core page |
| Streaming Implementation | SSE streaming architecture notes |
| Stream Bus Gap | Stream bus wiring analysis |