orca icon indicating copy to clipboard operation
orca copied to clipboard

[Feature]: Chat-style UI for viewing agent runs (Claude, etc.) with smarter text rendering, preserving CLI parity

Open braianj opened this issue 7 months ago • 6 comments

Problem or use case

Summary

Add a chat-style, user-friendly view for inspecting agent runs (e.g. Claude and other agents) inside Orca, while keeping full parity with the native Claude CLI capabilities.

Problem / Motivation

Today, when an agent like Claude runs inside Orca, the output is rendered in a format that:

  • Is dense and log-like, hard to scan visually.
  • Mixes user prompts, agent reasoning, tool calls, tool results, and final answers in a way that breaks the natural flow of a conversation.
  • Makes it difficult to follow long, multi-step agent runs (debugging, demos, support, stakeholder reviews).
  • Underuses formatting that Claude already produces (Markdown, code blocks, tables, citations).

This affects multiple personas:

  • Developers debugging agent behavior need to follow turns clearly.
  • PMs / non-technical users reviewing runs need a readable artifact.
  • Support / QA need to share or replay a run without parsing raw logs.

User Stories

  • As a developer, I want to skim an agent run in chat format so I can quickly identify where it went off track, without losing access to raw events.
  • As a PM, I want to share a clean, readable transcript of an agent run with stakeholders.
  • As a power user, I want to toggle back to the raw CLI view at any time so I do not lose any functionality I rely on today.
  • As a support engineer, I want to expand only the failing tool call instead of scrolling through the whole log.

Proposed solution

Introduce a chat-style renderer for agent runs as the default view, with a toggle to fall back to the raw/native CLI view.

Core elements

  1. Conversation timeline

    • Distinct bubbles/sections for: user, assistant, tool_call, tool_result, system.
    • Avatars/labels per role (e.g. "You", "Claude", tool name).
    • Timestamps and run duration per turn.
  2. Smarter text rendering

    • Full Markdown rendering (headings, lists, bold, links).
    • Syntax-highlighted code blocks with copy button.
    • Collapsible sections for long outputs (tool results, large diffs, JSON payloads).
    • Pretty-printed JSON / YAML / diff blocks.
    • Inline citations and file links rendered as clickable references.
  3. Tool-call visibility

    • Tool call shown as a compact card: tool name, arguments (collapsed by default), result (collapsed by default).
    • Status indicator (running / success / error).
    • "Show raw" toggle per tool call.
  4. Native Claude CLI parity (non-negotiable)

    • All current CLI capabilities remain available: streaming output, interrupts, slash commands, tool approvals, exit codes, transcripts, hooks.
    • Toggle: Chat view ⇄ Raw CLI view.
    • Keyboard shortcuts and pipeable stdout/stderr for scripts must keep working.
    • The chat view is a presentation layer over the existing event stream — it must not drop, reorder, or summarize events.
  5. Navigation & sharing

    • Jump to: latest message, errors, tool calls.
    • Copy-as-Markdown for any turn or the full run.
    • Shareable permalink to a specific run / turn.

UX Concept (rough mockup)

┌─────────────────────────────────────────────────────────┐
│  Run #482  ·  Claude Sonnet  ·  2m 14s   [Chat | Raw]   │
├─────────────────────────────────────────────────────────┤
│  🧑 You · 10:02                                          │
│  Refactor auth.ts to use the new token service.         │
│                                                          │
│  🤖 Claude · 10:02                                       │
│  I'll start by reading the current implementation.       │
│                                                          │
│  🛠  read_file  · auth.ts                ▸ expand        │
│  ✅  success · 312 lines                                  │
│                                                          │
│  🤖 Claude · 10:03                                       │
│  Here's the proposed change (diff with syntax highlight) │
│                                                          │
│  🛠  edit_file · auth.ts                 ▸ expand        │
│  ❌  error · permission denied                            │
└─────────────────────────────────────────────────────────┘

Non-Goals

  • Replacing or hiding the raw CLI view — it must remain a first-class option.
  • Changing agent behavior, prompts, or tool semantics.
  • Building a generic chat client unrelated to agent runs.

Acceptance Criteria

  • [ ] A Chat view is available for any agent run that uses the Claude CLI integration.
  • [ ] A Raw view toggle exists and produces output byte-equivalent to today's CLI output.
  • [ ] All current CLI features (streaming, slash commands, tool approvals, hooks, transcripts) work unchanged in both views.
  • [ ] Markdown, code blocks, JSON, and diffs are rendered with syntax highlighting.
  • [ ] Tool calls render as collapsible cards with name, args, result, and status.
  • [ ] User can copy any turn or the full run as Markdown.
  • [ ] No event from the underlying agent stream is dropped, reordered, or silently summarized.
  • [ ] Performance: chat view renders smoothly for runs up to at least 1,000 turns / 5 MB of text.
  • [ ] Accessibility: keyboard-navigable, screen-reader-friendly roles and labels.

Alternatives or additional context

Alternatives Considered

  1. Keep raw view only, improve formatting in-place. Rejected — does not solve the readability problem for non-engineer users.
  2. External viewer / separate tool. Rejected — fragments the workflow; users want to see runs inside Orca.
  3. Auto-summarize runs. Rejected as default — risk of hiding information; could be offered later as an opt-in layer on top of the chat view.

Additional Context

  • Other tools (Claude Desktop, ChatGPT, Cursor chat panel) already use chat-style rendering and set user expectations.
  • This is a UX layer; the underlying agent protocol/event stream should not need to change.
  • Could later enable features like inline annotations, comments per turn, and run comparisons.

Open Questions

  • Should the chat view become the default, with Raw as opt-in, or vice versa, for the first release?
  • Do we need per-user preference persistence for the view toggle?
  • Should we support exporting a run as a standalone HTML/Markdown file?

braianj avatar May 05 '26 18:05 braianj

Appreciate the idea, brother.

Speaking just as an Orca user: I’m not fully convinced yet that I personally need this as a built-in Orca feature. I don’t currently have much friction with how the agent CLIs present input/output, and I like staying close to the native CLI behavior.

Could you elaborate a bit more on the concrete use case you’re trying to solve? Is this mainly about:

  • making live runs easier to follow?
  • reviewing completed runs?
  • sharing a cleaner artifact with others?
  • debugging failed tool calls?
  • making output more readable for non-technical users?

The reason I ask is that several of the user stories sound like they might also be handled with dedicated slash commands or workflows that operate on the stored transcripts. For example: “generate readable transcript”, “find failed tool calls”, “summarize the run”, “extract decisions”, “explain what happened”, etc.

For Claude Code transcripts, I currently use this workflow to generate a more readable Markdown version:

write_claude_code_transcript.md

So I do see the value of readable transcripts/artifacts. I’m just not yet sure whether that needs to be a built-in chat-style renderer inside Orca, or whether transcript/reporting workflows would solve most of the problem with less complexity.

rnoblecodes avatar May 11 '26 19:05 rnoblecodes

Wave T triage update (2026-05-29): I do not see a bounded UI-only slice that is safe to implement from the current origin/main architecture.

This is related to #3099, but it should not be treated as the same product slice. #3099 asks for a primary chat surface for steering agents; #1447 asks for a readable agent-run viewer while preserving native CLI parity, no event loss/reordering, tool cards, raw fallback, copy/export, and sharing. That makes #1447 primarily a timeline/transcript contract problem before it is a renderer problem.

Issue evidence:

  • The issue explicitly makes native CLI parity non-negotiable: streaming output, interrupts, slash commands, tool approvals, exit codes, transcripts, hooks, keyboard shortcuts, and pipeable stdout/stderr must continue working.
  • The acceptance criteria require a chat view for Claude CLI runs, a raw view that is byte-equivalent to today's CLI output, collapsible tool-call rendering, copy-as-Markdown, no dropped/reordered events, and smooth rendering for 1,000 turns / 5 MB.
  • The existing issue comment asks for a more concrete use case and points out that readable transcripts or slash-command workflows may solve much of the need with less built-in UI complexity.

Architecture evidence from origin/main:

  • Raw terminal rendering is the real source of truth today. src/renderer/src/components/terminal-pane/TerminalPane.tsx owns xterm pane lifecycle, input, resize, scrollback, split panes, mobile driver state, and restart behavior. src/renderer/src/components/terminal-pane/pty-connection.ts wires xterm input/output to the PTY transport, including interrupts, bracketed paste, hidden-output recovery, serializer registration, and startup-command delivery. src/renderer/src/components/terminal-pane/pty-transport.ts strips renderer-only OSC 9999 status sequences before xterm sees them, then emits compact side effects for title/status/bell handling.
  • PTY IPC is centralized in src/main/ipc/pty.ts. It routes local/SSH providers, batches PTY output, owns write/resize/kill, records paneKey to PTY mappings, and deliberately skips host-local hook env injection for SSH because those values are loopback/local-path only. Any chat layer must not fork this behavior or it will break raw CLI parity.
  • The current agent-status model is not a transcript. src/shared/agent-status-types.ts defines AgentStatusEntry as current state + prompt + toolName/toolInput preview + lastAssistantMessage preview, while AgentStateHistoryEntry intentionally omits tool and assistant payloads and is capped by AGENT_STATE_HISTORY_MAX = 20. Prompt/tool/assistant fields are also capped (prompt 200 chars, toolName 60, toolInput 160, lastAssistantMessage 8 KB), which is appropriate for status UI but not for a lossless run viewer.
  • The hook pipeline normalizes provider events into status snapshots, not ordered chat events. src/shared/agent-hook-listener.ts keeps per-pane caches for last prompt/tool/status, extracts tool previews via allowlisted fields, and reads only the last assistant text from transcripts by scanning up to 4 MB. src/main/agent-hooks/server.ts persists last-status.json so dashboard rows survive restart and exposes status snapshot/replay, but it does not retain every user message, assistant chunk, tool call, tool result, permission event, and final state as a durable ordered stream.
  • Activity is the closest existing UI surface, but it is pane/status navigation plus raw terminal, not chat. src/renderer/src/components/activity/ActivityPrototypePage.tsx builds pane-keyed AgentPaneThreads from status history/retained rows, caps events at 80, caps response markdown preview at 320 chars, and publishes terminal portal descriptors. src/renderer/src/components/Terminal.tsx then portals the existing TerminalPane into Activity so there is still one PTY/xterm owner. This is the right raw-parity pattern, but it does not provide a durable turn/message/tool timeline.
  • Share/export support is not currently agent-run oriented. The export path in src/main/ipc/export.ts and src/renderer/src/components/editor/export-active-markdown.ts is for markdown editor PDF export. Activity has no copy/export/permalink path for agent runs.
  • SSH/mobile make a desktop-only transcript reader unsafe. src/shared/agent-hook-relay.ts defines the relay envelope for remote hook status, and src/main/agent-hooks/server.ts#ingestRemote revalidates remote status at the SSH trust boundary. Mobile/remote terminal APIs in src/main/runtime/rpc/methods/terminal.ts stream and snapshot raw PTY output with byte/scrollback budgets; they do not expose a normalized chat timeline. A viewer that only reads local Claude transcript paths would violate the SSH use case.
  • Performance assumptions currently rely on compact status state plus xterm/PTY batching. A 1,000-turn / 5 MB chat surface needs a virtualized durable message store and explicit retention/backfill rules; it should not duplicate raw PTY buffers or expand the existing status cache into an unbounded transcript cache.

Recommendation: keep #1447 open, but split it behind prerequisites. I would not ship a speculative chat shell over today’s status previews because it would look like the requested feature while failing the issue’s parity, export, no-drop/no-reorder, and tool-result requirements.

Suggested first safe PRs:

  1. Define an agent-run timeline contract and schema: run, turn, and event records linked to worktreeId, tabId, paneKey, ptyId/sessionId, provider/source, and connectionId; include explicit ordering, retention, restart, and raw-source pointer rules.
  2. Add a Claude-only read/backfill prototype behind a flag or internal API: parse Claude transcript JSONL into normalized events (user, assistant_text, tool_call, tool_result, permission/waiting, stop/error) with fixture tests proving no drop/reorder against transcript order.
  3. Define SSH parity for that timeline before exposing UI: either relay-side transcript/event backfill or a normalized remote timeline stream, not host-local path reads.
  4. Add raw-parity tests around the timeline path: generating/read-backing chat events must not change PTY writes, resize, interrupts, approvals, terminal focus, terminal.read/send/subscribe, hook status, or xterm raw rendering.
  5. After the contract exists, build a read-only Activity-side timeline panel with a Raw toggle, virtualization, markdown rendering, and expandable tool details. Export/copy-as-Markdown can be a smaller follow-up if it is generated from the durable timeline, not from today’s status previews.

The smallest useful product slice I see is therefore not a chat UI. It is a read-only, provider-scoped timeline/backfill contract with tests, probably Claude-only first; once that exists, the UI work becomes bounded and can reuse Activity’s pane selection plus terminal portal pattern without risking CLI parity.

nwparker avatar May 29 '26 23:05 nwparker

Forgot to say, we have this under experiemental for Claude and Codex! Will continue to improve. Happy for feedback

nwparker avatar Jul 13 '26 07:07 nwparker

Automated screenshot pass — this comment is from a bulk process that only adds visual context (Electron e2e captures or re-uploaded docs product shots). It is not a code review, triage decision, or claim that the change is verified. Images may be current baselines or related product references, not before/after of a specific PR branch.

What this image is

Related UI reference only: Explore Orca → Agents / visibility tour (status chips + agent rows). Not a chat transcript viewer.

Visual evidence

04b-feature-tour-agents.png
04b-feature-tour-agents.png

nwparker avatar Jul 24 '26 09:07 nwparker

Can we apply this to OMP also?

rhlsthrm avatar Aug 19 '26 14:08 rhlsthrm

Thanks for the request, @braianj. A chat-style view of agent runs shipped as Native Chat, which is now the default (#22933), and OMP is supported too (#26401). Closing as done; please open a new issue for any specific gaps.

nwparker avatar Oct 24 '26 23:10 nwparker