Agent chat ux v1 4 0

From LeoYeAI/openclaw-master-skills · View interactive version

Agent chat ux v1 4 0 is an AI agent skill from the GitHub repository LeoYeAI/openclaw-master-skills. Multi-agent UX for OpenClaw Control UI — agent selector, per-agent sessions, session history viewer with search, agent-filtered Sessions tab with friendly names, Create Agent wizard, emoji picker, and backend agent CRUD.

How to use this skill

Skill file

agent-chat-ux

name: agent-chat-ux

version: 1.4.0

author: Charles Sears

description: Multi-agent UX for OpenClaw Control UI — agent selector, per-agent sessions, session history viewer with search, agent-filtered Sessions tab with friendly names, Create Agent wizard, emoji picker, and backend agent CRUD.


⚠️ Security & Transparency Notes

Before applying this skill's patches, be aware of the following:

Credential Access (`agents.wizard`)

The AI Wizard backend (agents.wizard RPC) calls the configured model provider API directly via HTTP. To do this it needs an API key. It resolves credentials in this exact order:

  1. Default config auth — uses it if the resolved mode is api-key (most common)
  2. Auth profile store — searches for the first api_key-type profile matching the provider. Reads only provider and type fields to find it; does not log or return values.
  3. Environment variable — ANTHROPIC_API_KEY or OPENAI_API_KEY as a last resort

If you don't want the wizard reading your auth store, set ANTHROPIC_API_KEY in your environment and ensure your default auth profile is already api-key mode — step 2 is skipped entirely in that case.

External API Calls

agents.wizard makes a single HTTP POST to:

No other outbound calls. The call carries your user-supplied description and nothing else from your system.

Patch Scope

These patches modify only agent-related files:

| Patch | File modified | What it changes |

|---|---|---|

| schema-agents.txt | src/gateway/protocol/schema/agents-models-skills.ts | Adds emoji optional param to AgentsUpdateParamsSchema |

| server-agents.txt | src/gateway/server-methods/agents.ts | Adds agents.wizard RPC; fixes agents.update to write - Emoji: (not - Avatar:) so emoji edits persist correctly |

| app-main.txt | ui/src/ui/app.ts | Adds 19 @state() fields: 10 for Create Agent/Wizard + 9 for edit agent, delete agent |

| app-render.txt | ui/src/ui/app-render.ts | Wires create/wizard props + edit agent save handler (sends emoji param, not avatar; evicts identity cache after save) |

| app-render-helpers.txt | ui/src/ui/app-render.helpers.ts | Agent selector dropdown in chat header (uses resolveAgentEmoji() for correct emoji), per-agent session filter, + New Session button |

| agents-view.txt | ui/src/ui/views/agents.ts | Create Agent panel (manual + wizard modes, 103-emoji picker); Edit agent inline form (name/emoji/workspace); Delete agent with confirmation; always-editable Overview |

| agents-utils.txt | ui/src/ui/views/agents-utils.ts | buildModelOptionsMulti() for multi-select fallback dropdown |

| agents-panels-cron.txt | ui/src/ui/views/agents-panels-status-files.ts | Cron Jobs tab Scheduler card now shows agent-specific job count and next-wake (not global gateway stats) |

Each patch is scoped to a single concern. If any patch file modifies more than the files listed above, stop — you have an outdated copy.

LLM Output Validation

Wizard model output is parsed as JSON and validated before use:

Source Code Modification

This skill applies git apply patches against ~/openclaw and requires a UI + gateway rebuild. Changes are persistent. Always backup before patching:

cd ~/openclaw && git stash  # or git branch backup/pre-agent-ux

What This Skill Adds

1. Agent Selector Dropdown in Chat Header

When multiple agents are configured, a dropdown appears left of the session dropdown in the chat header. Selecting an agent switches to that agent's most recent session (or falls back to a fresh webchat key for that agent). The session dropdown automatically filters to show only sessions belonging to the selected agent.

2. Per-Agent Session Filtering (Sorted Newest First)

Sessions are now scoped to the active agent and sorted newest-first. No more mixing other agents' cron jobs and subagent sessions into the current chat's session picker.

3. + New Session Button in Chat Header

A + icon button sits right of the session dropdown, allowing new sessions to be started without typing /new.

4. Create Agent Panel (Manual + AI Wizard)

The Agents tab gains a + Create Agent button that expands a panel with two modes:

Manual mode:

AI Wizard mode:

After creation, the agents list and config form are both refreshed automatically — no "not found in config" error, no manual reload needed.

5. Emoji Picker Dropdown

The emoji field in Create Agent and Edit Agent forms is a dropdown with 103 curated emojis grouped into 5 categories (Tech & AI, People & Roles, Animals, Nature & Elements, Objects & Symbols), each showing the emoji and its name. A large live preview shows the selected emoji next to the dropdown.

6. Edit Agent Inline (Agents Overview)

The Agents Overview card now shows editable inputs directly — no toggle needed:

7. Delete Agent

8. Agent-Specific Cron Stats

The Scheduler card on the Cron Jobs tab previously showed global gateway stats (total job count, global next wake). Now:

This means agents with no crons correctly show Jobs: 0 / Next wake: n/a.

9. Agents Tab — Model Selector Cleanup

10. Backend — `agents.create` / `agents.update` / `agents.delete` / `agents.wizard`

New RPC handlers wired into the gateway:

| Method | Description |

|--------|-------------|

| agents.create | Provisions a new agent entry in config + scaffolds workspace (SOUL.md, AGENTS.md, USER.md) |

| agents.update | Patches agent config (name, workspace, model, identity, etc.) |

| agents.delete | Removes agent from config |

| agents.wizard | Calls the configured LLM to generate name, emoji, and SOUL.md from a plain-text description |

Auth fix in agents.wizard: Raw HTTP calls to the model API require an api_key token, not an OAuth/bearer token. The wizard now falls back to an explicit api_key profile (or ANTHROPIC_API_KEY env var) when the default resolved auth mode is oauth or token.

11. Session History Viewer (v1.4.0)

A modal overlay accessible from the Sessions tab that displays full conversation history for any session:

12. Sessions Tab Overhaul (v1.4.0)

The Sessions tab now provides a unified multi-agent experience:

13. Backend — `sessions.history` RPC (v1.4.0)

New RPC handler that reads full JSONL transcript files:

| Param | Type | Description |

|-------|------|-------------|

| key | string | Session key |

| limit | number | Max messages (default 200, max 500) |

| offset | number | Pagination offset |

| search | string | Full-text search filter |

| rolesFilter | string[] | Filter by role(s) |

Returns {key, sessionId, agentId, total, offset, items[{role, text, timestamp}]}.


Files Changed

| File | Change |

|------|--------|

| src/gateway/protocol/schema/agents-models-skills.ts | Adds emoji optional param to AgentsUpdateParamsSchema |

| src/gateway/server-methods/agents.ts | agents.wizard RPC; agents.update emoji fix (writes - Emoji: not - Avatar:) |

| ui/src/ui/app-render.helpers.ts | Agent dropdown in chat (with resolveAgentEmoji()), per-agent session filter, + New Session button |

| ui/src/ui/views/agents.ts | Create Agent panel, 103-emoji picker, edit/delete agent UI, always-editable Overview |

| ui/src/ui/views/agents-utils.ts | buildModelOptionsMulti() for multi-select fallback model dropdown |

| ui/src/ui/views/agents-panels-status-files.ts | Cron Jobs tab Scheduler card: agent-specific job count + next wake |

| ui/src/ui/app-render.ts | Create/wizard props wiring + edit agent save handler (emoji param, cache eviction) + session history modal wiring + agent filter for Sessions tab + agent identity name resolution (identity.name fallback chain) + History button agent pre-selection |

| ui/src/ui/app.ts | 19 @state() fields: create/wizard (10) + edit/delete agent (9) + session history modal (8) + sessions agent filter (1) |

| ui/src/ui/app-view-state.ts | Session history modal + sessions agent filter type definitions |

| ui/src/ui/views/sessions.ts | Overhauled: friendly names, agent identity column, agent filter dropdown, CSS grid layout, History button, Label column removed |

| ui/src/ui/views/sessions-history-modal.ts | New file: Session history modal component |

| src/gateway/protocol/schema/sessions.ts | SessionsHistoryParamsSchema |

| src/gateway/protocol/schema/types.ts | SessionsHistoryParams type export |

| src/gateway/protocol/index.ts | validateSessionsHistoryParams + re-exports |

| src/gateway/server-methods/sessions.ts | sessions.history RPC handler |

| ui/src/ui/app-chat.ts | Removed CHAT_SESSIONS_ACTIVE_MINUTES time filter (was 120min, now 0 = show all sessions in chat dropdown) |


UI Design & Styling Reference

This section documents the UI design decisions for anyone installing or extending this skill.

Sessions Tab Layout

Uses CSS grid (display: grid) instead of the default OpenClaw .table flex layout for precise column alignment:

.sessions-grid {
  grid-template-columns: 2fr 1.2fr 0.6fr 0.8fr 1fr 0.8fr 0.8fr auto;
  /* Session | Agent | Kind | Updated | Tokens | Thinking | Reasoning | Actions */
}

Session History Modal

Dark overlay modal with the following structure:

┌──────────────────────────────────────────────────┐
│  Session History                            [✕]  │
│  [Agent ▼]  [Session ▼]                         │
│  [🔍 Search...]  [All] [User] [Asst] [Sys] [Tool]│
│  ─────────────────────────────────────────────── │
│  👤 User · Feb 23, 10:23 AM                     │
│  Hello, can you help me?                         │
│  ─────────────────────────────────────────────── │
│  🤖 Assistant · Feb 23, 10:23 AM                │
│  Of course! What do you need?                    │
│  ─────────────────────────────────────────────── │
│          [Load More ↓]  Showing 100 of 342       │
└──────────────────────────────────────────────────┘

Key CSS variables used:

Role colors:

| Role | Color |

|------|-------|

| User | var(--accent, #6366f1) (indigo) |

| Assistant | #10b981 (emerald) |

| System | #f59e0b (amber) |

| Tool | #8b5cf6 (violet) |

Role icons: 👤 User, 🤖 Assistant, ⚙️ System, 🔧 Tool, 💬 Other

Session Name Resolution

The friendly name fallback chain:

  1. row.label (user-set label)
  2. row.displayName (server-computed, e.g. "discord:#bot-chat")
  3. Smart key parsing:
  1. Raw key as fallback

Agent Identity Resolution

For the Agent column and dropdowns:

  1. agent.identity.name (from IDENTITY.md — e.g. "Assistant")
  2. agent.name (from config — e.g. "main")
  3. agent.id (raw identifier)

Emoji: agent.identity.emoji with "🤖" as fallback.

Chat Dropdown

The session dropdown in the chat header shows all sessions for the selected agent (no time filter). Previously limited to sessions active within 120 minutes, which hid older Discord channels and other sessions.


Installation

This skill requires patching OpenClaw source files and a UI + gateway rebuild.

Prerequisites

Step 1: Apply patches

cd ~/openclaw

git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/schema-agents.txt
git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/agents-view.txt
git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/agents-utils.txt
git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/agents-panels-cron.txt
git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/app-render-helpers.txt
git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/app-render.txt
git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/app-main.txt
git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/server-agents.txt

If any patch fails due to upstream drift, apply manually using the patch file as a line-by-line reference.

Step 1b: Apply v1.4.0 patches (Session History + Sessions Tab Overhaul)

cd ~/openclaw

# Backend: sessions.history RPC
git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/v1.4.0/patch-01-sessions-history-rpc.txt

# Sessions tab: friendly names, agent column, agent filter
git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/v1.4.0/patch-02-sessions-tab-overhaul.txt

# App state + render wiring for history modal
git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/v1.4.0/patch-03-app-wiring.txt

# New file: session history modal component
cp ~/.openclaw/workspace/skills/agent-chat-ux/references/v1.4.0/patch-04-sessions-history-modal.ts \
   ui/src/ui/views/sessions-history-modal.ts

# Chat dropdown: show all sessions (remove 120min active filter)
git apply ~/.openclaw/workspace/skills/agent-chat-ux/references/v1.4.0/patch-05-chat-sessions-all.txt

Step 2: Rebuild UI

cd ~/openclaw
pnpm ui:build

Step 3: Rebuild gateway (for backend agent methods)

cd ~/openclaw
pnpm build

Step 4: Restart gateway

openclaw gateway restart

Step 5: Verify

  1. Open Control UI at http://localhost:18789
  2. Chat tab — agent dropdown appears left of session dropdown (if >1 agent configured); + button appears right of session dropdown
  3. Agents tab — "+ Create Agent" button with Manual and AI Wizard modes
  4. Agents → Overview → Model Selection — fallback is now a multi-select dropdown
  5. Create an agent with the AI Wizard — should generate cleanly and appear in the list with no "not found" error
  6. Agents → Overview — Name, Emoji, Workspace are editable directly; Save button at bottom activates on any change
  7. Change an agent's emoji — after Save it should persist (not revert to the original creation emoji)
  8. Agents → Cron Jobs — agents with no cron jobs show Jobs: 0 / Next wake: n/a (not the global gateway count)
  9. Sessions tab — sessions show friendly names (e.g. "Main Session") with agent emoji+name column; agent filter dropdown works
  10. Sessions tab → History button — opens modal with conversation history, search, and role filter chips
  11. History modal → Agent filter — changing agent filters the session dropdown; selecting a session loads its messages
  12. Chat dropdown — session dropdown shows ALL sessions for the selected agent (including older Discord channels, OpenAI sessions, etc. — not just recent ones)

Usage

Chat: Switching Agents & Sessions

Agents: Create Agent

  1. Click + Create Agent
  2. Manual: enter name, workspace, pick emoji → "Create Agent"
  3. AI Wizard: describe the agent → "Generate Agent" → review preview → "✅ Create This Agent"

Agents: Fallback Models

In Model Selection:

Sessions: Viewing History

  1. Go to Sessions tab
  2. Optionally filter by agent using the Agent dropdown
  3. Click History on any session row
  4. The modal opens with the full conversation
  5. Search — type to search across all messages (300ms debounce)
  6. Role chips — click All/User/Assistant/System/Tool to filter by role
  7. Load More — pagination loads 100 messages at a time

Sessions: Agent-Filtered View

The Sessions tab now shows:


Architecture Notes

Session Key Format

agent:<agentId>:<rest> — the agent selector reads parseAgentSessionKey(state.sessionKey).agentId to determine the active agent and filters the session list accordingly.

Config Refresh After Creation

After agents.create succeeds, the UI calls both agents.list (to update the sidebar) and loadConfig (to refresh configForm). Without the loadConfig call, selecting the new agent would show "not found in config" because the config form was stale.

Wizard Auth Resolution

agents.wizard makes a direct HTTP call to the model provider API. Raw HTTP calls require an api_key type credential — not an OAuth bearer token. The resolution order is:

  1. Default resolveApiKeyForProvider result (used if mode is api-key)
  2. First api_key-type profile in the auth store for the provider
  3. ANTHROPIC_API_KEY / OPENAI_API_KEY env var directly

This mirrors the same pattern used in enhanced-loop-hook.ts.

Model Fallbacks

Stored as model.fallbacks[] in the agent config. The runtime tries them via runWithModelFallback() when the primary model returns an error.


Changelog

1.4.0 (2026-02-23)

1.3.0 (2026-02-19)

1.2.1 (2026-02-19)

1.2.0 (2026-02-19)

1.1.0 (2026-02-18)

1.0.0 (2026-02-18)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.