Skip to content

Add "Live agent" setting: agent window with agent-flow graph beside it - #8

Merged
ArtyomVancyan merged 13 commits into
developfrom
auto-claude/006-add-task-flow-page-under-graph-modeled-on-agent-fl
Oct 14, 2026
Merged

ArtyomVancyan merged 13 commits into
developfrom
auto-claude/006-add-task-flow-page-under-graph-modeled-on-agent-fl

Conversation

@ArtyomVancyan

Copy link
Copy Markdown
Member

Summary

  • Adds an optional "Live agent" setting (off by default). When on, each agent window is twice as wide: the terminal on the left, a live agent-flow graph of that Claude Code session on the right.
  • Moves the user's agent-flow graph and relay (from /home/artyom/Python/agent-flow) into Auto Claude with only the changes needed to fit. The relay runs in a Node worker thread and talks to the window over IPC.
  • Replaces the earlier "Task flow page" idea. Those commits were dropped by resetting the branch to develop's merge base.

Changes

  • Setting: "Live agent" switch under "Skip permission prompts" in Settings > Claude Code, with i18n keys. The commit log shows it later became a per-project setting kept in .auto-claude/flow. Added a live-agent-store, IPC handlers and a preload API.
  • Layout: Terminal.tsx and TerminalGrid.tsx widen agent windows only when the graph is actually shown. The terminal never remounts when the setting toggles, so the session and scrollback are kept, and it is refit to its new width. Grid layout logic is in terminal-grid-layout.ts.
  • Graph: components/live-agent/ holds the copied agent-flow canvas, hooks and libs. It draws over bg-background instead of the navy fill, has a light palette, skips glow in light mode and follows the theme switch. Nothing is loaded when the setting is off.
  • Relay: src/main/live-agent/ holds the relay and its worker.
    • It uses worker_threads, not utilityProcess. The relay is pure Node, a thread can't orphan the app, and terminate() is guaranteed.
    • It starts and stops only on a real toggle, and is stopped on app quit (with a safety-net terminate).
    • It sends each window only sessions whose cwd matches its folder. IPC replaces SSE because of the renderer CSP.
    • It scans ~/.claude and every Claude profile's config dir. A new getProfileConfigDirs() is in claude-profile-manager.ts. Subscribing never reads credentials.
    • The only port it opens is agent-flow's hook server on 127.0.0.1, on a free port.
  • Hooks: project-setup.ts and the worktree handlers give worktrees the project's hooks. Switching the setting off removes them everywhere. Nothing edits ~/.claude/settings.json.
  • Dev: electron.vite.config.ts now watches source files when the app runs from a task worktree.

Testing

  • npm run typecheck
  • npm test (118 files, 1836 tests), including new relay, project and Terminal.live-agent tests
  • npx knip --production
  • npm run build: the relay worker is emitted as its own chunk. I ran that chunk in a real worker thread. It started, sent the session only to the subscribed folder's window, and removed its discovery file on stop.
  • Manual (not done yet): the app was never launched, so the layout, graph and light/dark colors are only covered by tests and the build.
    1. Run npm run dev.
    2. Turn on Live agent.
    3. Open an agent window and check that it is twice as wide, with the graph on the right.
    4. Toggle the setting and the theme, and check that the scrollback is kept and the graph stays readable.

Known limitations

  • Two agent windows in the same folder both show the newest session there.
  • Without agent-flow's hooks installed, the graph runs from transcripts alone.
  • Each graph runs its own animation loop, so many agent windows cost more CPU.
  • Follow-ups: the trimming helper is copied in two places, and the project folder watcher rescans on every transcript write.

🤖 Generated with Claude Code

ArtyomVancyan and others added 13 commits October 14, 2026 17:17
…ch agent window

Settings > Claude Code > Agent windows gets a "Live agent" switch (AppSettings.liveAgent, off by
default, saved like the other app settings). With it on, every agent window takes twice its width:
the terminal on the left and a live graph of its Claude Code session on the right.

- Graph: the user's agent-flow visualizer (web/), moved as is into
  src/renderer/components/live-agent (imports made relative). The relay hook reads relay messages
  over IPC instead of EventSource, and the graph is lazy-loaded only when an agent window shows it.
  The canvas no longer paints its own navy background: it draws over bg-background, the palette
  has a light variant with deeper colors that stay readable on it, the bloom is only drawn on dark,
  and the theme follows the root `dark` class as MemoryGraph does.
- Relay: agent-flow's relay (relay/), moved into src/main/live-agent/relay. It runs in a Node
  worker_threads Worker, not a utilityProcess, because it is pure Node (fs watchers, timers, the
  hook HTTP server) and uses no Electron APIs. A thread can't outlive or orphan the app,
  terminate() always works, and process.pid in agent-flow's discovery file stays the app's pid,
  which its hook script checks. It bundles with electron-vite's ?nodeWorker import. Messages
  reach the renderer over IPC rather than its SSE server, because the renderer's CSP only allows
  connect-src 'self'. So the only port it opens is agent-flow's hook server, on 127.0.0.1 with an
  OS-assigned port, closed on stop.
- Each graph subscribes with its window's directory. The relay watches that directory's sessions
  in ~/.claude and every Claude profile's config dir, and sends a client only the sessions whose
  recorded cwd is that directory, so a task's worktree session never shows in the project's
  window. console output in the relay goes to appLog through the worker's port, and the Windows
  path check uses src/main/platform.
- Lifecycle (LiveAgentRelay): started when the setting is switched on (or at startup if saved
  on), stopped when it is switched off, and stopped by before-quit (stop message, 2s cap, then
  terminate) with a will-quit terminate as a safety net. Agent windows only subscribe and
  unsubscribe, so opening, closing or reloading them never restarts it. Start failures and crashes
  become a text status shown in the graph pane.
- Grid: with agent windows that are twice as wide, the windows keep their flat order and are
  placed as boxes from computeWeightedTerminalLayout (an agent window counts as two slots).
  Without any, the existing grid is used unchanged. The xterm container is never remounted when
  the setting changes, and the terminal is refit (and the PTY resized) when its graph appears or
  goes away.

Drops the earlier Task flow page work on this branch (reset to the develop merge base).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Read the Claude profiles' config dirs without checking credentials (getSettings() can run a
  blocking keychain lookup on the main thread for every graph subscription)
- Start or stop the relay only when the setting actually switches (the dialog autosave sends every
  setting, which restarted a failed relay on unrelated changes)
- Stop scanning and advertising a directory once no agent window shows it
- Only widen agent windows that can show a graph (they have a directory)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ider

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…laude/flow

- The setting is now the selected project's: it is on while the project has a .auto-claude/flow
  directory (no app-wide AppSettings.liveAgent any more), so it stays stored with the project
  across restarts and project switches. Settings > Claude Code switches it for the selected
  project, and agent windows read it for their own project.
- Switching it on creates the directory and runs agent-flow's setup for the project
  (src/main/live-agent/project-setup.ts, from relay/setup.js): the hook forwarder goes to
  .auto-claude/flow/hook.cjs (.cjs, so a "type": "module" project can run it) and Claude Code's
  hooks to the project's .claude/settings.local.json, run by Auto Claude's own executable as Node
  (ELECTRON_RUN_AS_NODE). Switching it off removes our hooks (others stay) and the directory.
- The relay writes its discovery files to the project's flow directory instead of
  ~/.claude/agent-flow, and the hook script reads the ones next to it.
- The relay runs while any project has Live agent on. At startup the setup is refreshed for those
  projects (it only writes when something changed, e.g. the executable moved).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…moves them everywhere

- A worktree of a project with Live agent on gets a copy of the project's
  .claude/settings.local.json (git doesn't check it out, and Claude Code reads it from the
  worktree's own .claude), or our hooks added to its own: when a task or terminal worktree is
  created, for existing worktrees when Live agent is switched on, and at startup (to refresh them)
- Switching Live agent off removes our hooks from the project's and every worktree's
  settings.local.json (other settings and hooks stay; a file left empty is deleted), deletes
  .auto-claude/flow (hook script and discovery files), and drops the project's graph
  subscriptions from the relay at once

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the background (the agent window's) follows the light or dark theme: the light palette,
the theme observer and the light-mode bloom skip are gone, so every graph element is drawn in
the colors of agent-flow's colors.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Agent nodes: no interior fill or drop shadow, the center icon in the full state color, and the
  glow starting at the hexagon's border instead of filling the node (the inside stays clear; the
  scan line is kept)
- Tool nodes: outline only (no background fill), with a 2px border in the full state color for
  every state
- colors.ts keeps a single DEFAULT palette without nodeInterior, toolNodeErrorBase, toolNodeBase,
  agentShadowFill and withAlpha

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The renderer dev server ignored `**/.auto-claude/**`, which also matches every file of a task
worktree (<project>/.auto-claude/worktrees/...), so a dev app started there never picked up edits.
Only the project's own .auto-claude folder is ignored now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- No drifting background dots (the depth particles); the spotlight following the active agent stays
- Resting zoom 3 (was 2): nodes draw 50% larger when the graph fits; auto-fit still zooms out
- No circle effect when an agent completes (flash, expanding ring, glow); the hexagon shapes stay
- Sub-agent nodes show the Agents menu icon (its path is shared with AgentsIcon in app-icons.tsx)
  instead of a text glyph

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…manager

worktree-manager imported the Live agent setup, which pulls in the app logger (electron-log, which
loads the real electron package). CI installs dependencies without the Electron binary, so
task-retry-reset.test.ts, which imports createOrGetWorktree, failed to load there. The hooks are now
copied by AgentManager, the only caller, right after it gets the task's worktree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test-frontend matrix ran with fail-fast: false, so a failure on one platform left the others
running to the end. Steps already stop at the first failing one within a job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The relay resolves each profile's config dir, which on Windows turns /tmp/claude-work into a drive
path, so the test failed there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ArtyomVancyan
ArtyomVancyan merged commit bd5a1a5 into develop Oct 14, 2026
4 checks passed
@ArtyomVancyan
ArtyomVancyan deleted the auto-claude/006-add-task-flow-page-under-graph-modeled-on-agent-fl branch October 14, 2026 17:06
remc010 pushed a commit to remc010/workbench that referenced this pull request Oct 26, 2026
…/006-add-task-flow-page-under-graph-modeled-on-agent-fl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant