openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Design subagent workflows and parallel agent surfaces

Open senamakel opened this issue 5 months ago • 2 comments

Summary

Understand and design how OpenHuman should surface subagent workflows, parallel work, and background agent coordination using Claude Code's current agents/workflows model as a reference, then produce an implementation plan for the app + Rust orchestration surfaces.

User-visible outcome: users can see which agents are available, decide when to fan work out, monitor parallel work, inspect worker/subagent output, and resume or stop long-running delegated work without losing the main conversation.

Problem

OpenHuman already has several backend primitives for delegated work, but they are not presented as a coherent product surface:

  • src/openhuman/agent_registry/agents/orchestrator/agent.toml exposes specialized delegates and direct spawn_worker_thread / spawn_parallel_agents tools, but users cannot browse or configure the agent library from the app.
  • src/openhuman/agent_orchestration/README.md describes a higher-level control plane (spawn_agent, list_agents, wait_agents, close_agent, resume_agent, follow_up), but the first implementation is process-local and not yet a user-facing workflow model.
  • src/openhuman/agent_orchestration/tools/spawn_parallel_agents.rs can fan out independent typed sub-agent runs, emits subagent lifecycle progress, and tracks ownership boundaries, but the current UX mostly sees collapsed tool results.
  • src/openhuman/agent_orchestration/tools/spawn_worker_thread.rs and worker_thread.rs can persist child transcripts as linked worker threads, but this is not surfaced like a background agent/workflow view.
  • app/src/store/chatRuntimeSlice.ts stores subagent activity, transcript/tool-call telemetry, and task boards, while app/src/components/intelligence/IntelligenceTasksTab.tsx aggregates task boards. That gives us useful pieces, but not a dedicated parallel-agent/workflow command center.

Claude Code's docs are a useful reference because they separate several distinct coordination modes instead of treating all delegation as one feature:

  • Agents overview: https://code.claude.com/docs/en/agents
  • Dynamic workflows: https://code.claude.com/docs/en/workflows
  • Custom subagents: https://code.claude.com/docs/en/sub-agents
  • Agent view: https://code.claude.com/docs/en/agent-view
  • Agent teams: https://code.claude.com/docs/en/agent-teams
  • Worktree isolation: https://code.claude.com/docs/en/worktrees

Key ideas to audit for OpenHuman, without copying Claude's UI literally:

  • Subagents: delegated workers inside one session that preserve parent context by returning concise summaries.
  • Agent view / background agents: a screen for dispatching independent tasks, seeing status, and attaching only when input is needed.
  • Agent teams: a lead plus coordinated peer sessions with shared task state and inter-agent messaging.
  • Dynamic workflows: a script-held orchestration plan for many agents, where intermediate state lives outside the main chat context and can be rerun or inspected.
  • Worktree isolation: independent checkouts for edit-heavy parallel sessions to prevent agents from touching overlapping files.

Solution (optional)

Produce a product + architecture proposal first, then implement in follow-up PRs. The design should answer these questions:

  1. Agent library surface

    • How do users discover available OpenHuman agents, their purpose, tool scope, model hint, permissions, memory/profile inclusion, and whether they can run in background?
    • Should this live under Intelligence, Chat, Settings, or a dedicated Agents panel?
    • Can we expose the existing registry definitions from AgentDefinitionRegistry through a controller rather than duplicating metadata in React?
  2. Parallel work command center

    • Should IntelligenceTasksTab become the canonical “agent work” surface, or should it link to a more focused Agents/Workflows view?
    • How should running subagents, worker threads, and persisted task boards be merged into one status model?
    • What actions should users get: open, attach, pause/resume, stop, retry, create follow-up, convert to task, approve plan?
  3. Workflow model

    • Do we need a first-class OpenHuman “workflow run” entity, distinct from task boards and worker threads?
    • Should workflows be authored as scripts, saved prompts/plans, task-board templates, or a Rust-side orchestration graph?
    • Which workflows are worth shipping first: deep research, codebase audit, issue triage, multi-source memory ingestion, PR review, or scheduled community ops?
  4. Coordination and isolation

    • For coding workflows, do we support git worktree isolation per worker, and where is ownership tracked?
    • How do we prevent overlapping edits and stale parent reads beyond the current ownership and file_state annotations in spawn_parallel_agents?
    • What should happen when a worker needs user input: use continue_subagent, task-board approval cards, or a background-agent inbox?
  5. Telemetry, persistence, and resumption

    • Which subagent/workflow state must persist across app restart?
    • How should we store per-agent events, prompts, token/cost totals, tool calls, and final outputs?
    • How do we render completed historical runs without replaying live-only streamed text?
  6. Safety and permissioning

    • How do tool allowlists, permission modes, Composio toolkit scoping, local file permissions, and approval gates inherit into workers?
    • Which workers can write files, call external services, or spawn other agents?
    • Should background workers default to read-only unless a user explicitly approves a higher-autonomy workflow?

A good first implementation path may be:

  • Add controller/RPC schema for listing registered agents and their safe display metadata.
  • Promote subagent/workflow state into a durable orchestration store instead of process-local state only.
  • Extend the Intelligence task view or add an Agents view that shows live + persisted agent runs, grouped by parent thread/workflow.
  • Expose spawn_parallel_agents and worker-thread runs as visible multi-agent work, not just tool timeline internals.
  • Add a narrow saved-workflow prototype, probably “parallel research with cross-checking,” because it can be read-only and demonstrates the dynamic workflow pattern without edit conflict risk.

Acceptance criteria

  • [ ] Claude docs audit — capture a concise comparison of Claude Code subagents, agent view, agent teams, dynamic workflows, and worktrees, with explicit notes on which ideas map cleanly to OpenHuman and which do not.
  • [ ] Current-state inventory — document OpenHuman's existing primitives with file references, including AgentDefinitionRegistry, agent_orchestration, spawn_parallel_agents, spawn_worker_thread, continue_subagent, task boards, and subagent telemetry.
  • [ ] Product surface decision — decide whether the user-facing entry point is Intelligence Tasks, Chat, Settings, a dedicated Agents view, or a combination, and include rough wireframe-level behavior.
  • [ ] Data model proposal — define the durable entities needed for agent runs/workflow runs, parent-child lineage, status, transcript refs, task-board refs, tool/cost telemetry, and resumption.
  • [ ] Workflow prototype plan — choose one first workflow to implement, define scope, safety defaults, acceptance tests, and how users start/watch/stop/resume it.
  • [ ] Isolation policy — decide whether and how to support worktree-per-worker for coding workflows, including ownership boundaries and conflict/stale-read handling.
  • [ ] Permission model — specify inherited vs overridden tool access, approval behavior, Composio toolkit scoping, and background-worker safety defaults.
  • [ ] Tests planned — identify focused Rust tests for orchestration state plus Vitest/E2E coverage for the chosen UI surface.
  • [ ] Diff coverage ≥ 80% — the implementing PR meets the changed-lines coverage gate (Vitest + cargo-llvm-cov, enforced by .github/workflows/coverage.yml).

Related

  • Claude Code agents overview: https://code.claude.com/docs/en/agents
  • Claude Code dynamic workflows: https://code.claude.com/docs/en/workflows
  • Claude Code custom subagents: https://code.claude.com/docs/en/sub-agents
  • Local architecture notes: src/openhuman/agent_orchestration/README.md, docs/agent-subagent-tool-flow.md, docs/DELEGATION_POLICY.md
  • Existing OpenHuman surfaces: src/openhuman/agent_registry/agents/orchestrator/agent.toml, src/openhuman/agent_orchestration/tools/spawn_parallel_agents.rs, src/openhuman/agent_orchestration/tools/spawn_worker_thread.rs, app/src/store/chatRuntimeSlice.ts, app/src/components/intelligence/IntelligenceTasksTab.tsx, app/src/pages/conversations/components/TaskKanbanBoard.tsx

senamakel avatar Jun 04 '26 14:06 senamakel

Deeper breakdown added. I split the parent into six native sub-issues, each with implementation plan, local reference code, Claude docs reference, and acceptance criteria:

  1. #3377 — Persist agent and workflow run state for resume and historical views
  2. #3372 — Expose an agent library and explicit subagent invocation surface
  3. #3373 — Build a background agent command center
  4. #3375 — Implement durable dynamic workflow runs for multi-agent orchestration
  5. #3374 — Add agent-team task coordination and teammate messaging
  6. #3376 — Add worktree isolation for parallel coding agents

Suggested execution order:

  • Start with #3377 because every other surface needs a durable run ledger instead of process-local/live-only state.
  • Then #3372 to expose safe agent metadata and explicit invocation.
  • Then #3373 to give users one place to monitor live + historical work.
  • Then #3375 for reusable workflow runs, starting with a read-only research/cross-check workflow.
  • Then #3374 for true team coordination once task/run state is durable.
  • Then #3376 for edit-capable coding workflows and branch/worktree isolation. This can start earlier if the first workflow chosen is code-focused, but it should not block read-only research workflows.

Claude docs mapping:

Claude concept OpenHuman plan
Subagents #3372 exposes registry-backed agent definitions; existing delegate_*, spawn_subagent, and spawn_parallel_agents become visible user choices instead of hidden-only tool calls.
Agent view #3373 turns worker threads, subagent telemetry, and task boards into one background-agent command center.
Agent teams #3374 extends TaskKanbanBoard and agent_orchestration with teammate names, shared tasks, direct messages, dependencies, and gates.
Dynamic workflows #3375 adds durable workflow definitions/runs with phase state, child agent refs, caps, approval, stop/resume, and saved read-only prototypes.
Worktrees #3376 adds a Rust worktree manager and worker isolation metadata for edit-capable parallel agents.
Cross-cutting resume/progress #3377 adds the run ledger, event stream, telemetry, and checkpoint references needed by all of the above.

Local implementation anchors used across the child issues:

  • src/openhuman/agent_registry/agents/orchestrator/agent.toml — current user-facing orchestrator inventory and direct tools (spawn_worker_thread, spawn_parallel_agents).
  • src/openhuman/agent_orchestration/README.md — intended orchestration control plane and current process-local persistence caveat.
  • src/openhuman/agent_orchestration/ops.rs — spawn_agent, list_agents, message_agent, wait_agents, close_agent, resume_agent, follow_up primitives.
  • src/openhuman/agent_orchestration/tools/spawn_parallel_agents.rs — existing fanout, ownership boundary, progress, and stale-read checks.
  • src/openhuman/agent_orchestration/tools/spawn_worker_thread.rs and worker_thread.rs — linked child transcript creation.
  • src/openhuman/agent_orchestration/tools/continue_subagent.rs — awaiting-user continuation path.
  • src/core/event_bus/events.rs — Subagent* and AgentOrchestration* lifecycle events.
  • app/src/store/chatRuntimeSlice.ts — subagent/tool timeline state and persisted/live split.
  • app/src/components/intelligence/IntelligenceTasksTab.tsx and app/src/pages/conversations/components/TaskKanbanBoard.tsx — existing task/work UI to extend instead of replacing.

Reference docs audited:

  • Agents overview: https://code.claude.com/docs/en/agents
  • Custom subagents: https://code.claude.com/docs/en/sub-agents
  • Agent view: https://code.claude.com/docs/en/agent-view
  • Agent teams: https://code.claude.com/docs/en/agent-teams
  • Dynamic workflows: https://code.claude.com/docs/en/workflows
  • Worktrees: https://code.claude.com/docs/en/worktrees

senamakel avatar Jun 04 '26 15:06 senamakel

Epic complete — all 6 sub-issues shipped to main

Capability Issue PR
Agent library + explicit subagent invocation #3372 merged
Persist agent/workflow run state (resume + history) #3377 merged
Background agent command center (status groups, stop/retry/continue/follow-up) #3373 #3698
Durable dynamic workflow runs + approval card + phase progress #3375 #3697
Worktree isolation for parallel coding agents #3376 #3696
Agent-team coordination + teammate messaging + live exec #3374 #3637

End-to-end user flow is live: discover agents → run/monitor/control background work → launch workflows with approval → coordinate teams → isolate parallel coding agents → resume history across restart. Closing the epic.

oxoxDev avatar Jun 16 '26 07:06 oxoxDev