Skip to content

feat(agents): spawn Claude Code teammate agents into real Quil panes #141

Description

@artyomsv

Problem

Claude Code's agent-team feature spawns teammate agents. When it cannot find a multiplexer it recognises, those teammates run in-process and invisible — no pane, no output, no way to watch what they are doing or intervene when one goes wrong.

That is the exact failure mode Quil's sidebar exists to prevent. An agent that is blocked on a question you cannot see is worse than one you never started. Today a Quil user running agent teams gets a single pane whose subagents are opaque.

Mechanism

Claude Code selects its spawn backend from the environment. When TMUX is set it treats itself as running inside a tmux-compatible multiplexer and drives teammate creation through shell-outs — a split to create the pane, then a keystroke send to launch claude --agent-id <id> --agent-name <name> ... inside it.

Quil's daemon already does every one of those primitives. MsgCreatePane splits the layout tree, enqueueInput → Pane.EnqueueInput writes to a PTY in order, and spawnPane() already knows how to start a claude-code typed pane with a preassigned session id. The gap is purely the interface Claude Code reaches for.

Proposed scope

  1. Env shimming. Set the variables Claude Code checks in each pane's environment. internal/pty's SetEnv() is already the seam for this — it is how OSC 7 / OSC 133 shell integration is injected today.
  2. A minimal command shim. A quil tmux-shim subcommand (name TBD) on PATH inside panes, implementing only the handful of verbs teammate spawning actually calls — split, send-keys, and enough of list-panes / display-message to not error. It talks to the daemon over the existing IPC socket. This is deliberately not a tmux compatibility layer; it is the smallest surface that makes one specific integration fire.
  3. Type the spawned panes. A teammate pane should register as a claude-code pane, not a bare terminal — so it gets session-id resume, hook-driven work state, and a name in the sidebar.
  4. Roll teammates up in the sidebar. Once they are real panes they inherit ⚠ / ◐ / ✓ and Alt+Shift+A for free. That is the whole payoff.
  5. Config gate. Off by default, [agents] teammate_panes = true in config.toml. Never override a user's own explicit Claude Code settings.

Known limitation, worth stating up front

Claude Code has two independent agent systems. Only the teammate path is reachable this way. Agents spawned with worktree isolation run in-process by a different code path and cannot be pulled into panes by any environment shim. Higher-capability models tend to prefer worktree isolation for parallel work, so this will not capture every subagent — it captures the teammate path, and the rest stay invisible.

That is not a reason to skip it, but the docs must say so plainly rather than promising "see all your agents".

Risks

  • This depends on an integration surface owned by another project and gated behind an experimental flag. It can change or disappear without notice. Keep the shim small and the failure mode graceful — if the spawn fails, the agent should still run, just invisibly, exactly as it does today.
  • Composes with, does not replace, the MCP server. MCP is the active path (the agent asks Quil for things); this is the passive path (Quil makes the agent's own spawning visible). Both should work at once.

Success check

With agent teams enabled, asking Claude Code in a Quil pane to run a multi-agent task produces one new Quil pane per teammate, each showing live output, each tracked in the sidebar, and each restored by name after quil restart.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions