Skip to content

Global Agent: Persistent Conversation and Workflow Sessions

Global is the natural-language entry point: it selects workflows from your instructions, starts Supers as needed, receives validated results, and summarizes them. Each Super executes one workflow and owns stage advancement, Checkers, and Sub task delegation. When a task ends, Global waits for your next input.

Startup and Input

Follow the installation guide for the PyPI release and simulator tools, and configure a model in OpenCode. Put the RTL, its dependencies, and the specification in your project. For a first run, use the normal-mode DUT example to create Adder/Adder.v and Adder/README.md.

From the project directory containing Adder/, start Global:

ucagent --agent-mode multi --backend opencode --tui

Enter one request in the Global conversation:

Start a separate ToffeeUT verification task: build Adder/Adder.v with Picker/Verilator (top module Adder), use Adder/README.md to verify carry and boundary inputs, run simulation, and produce a report.

Global prepares a task workspace and starts a Super. Select the task in the sidebar to follow progress. ToffeeUT writes reports and run evidence under ut_project/ in that workspace; see Result Analysis. See the ToffeeUT user guide (Chinese) for other workflows and existing-project recipes. For direct CLI submission or Make in a source checkout, see Multi-Agent Startup.

For a new unit-verification request without a named workflow, Global prefers toffee-ut:ut when it is available. Existing tasks continue with their original workflows. Unless you request a separate task, Global reuses a unique compatible task and asks you to choose when several match. The source directory must be inside the project or a configured source root.

--agent-mode multi and --as-master select different hosts and cannot share one launch command. Multi connects to the running same-project Master or starts the same Master service. Web and Multi share tasks, workspaces, queue and control APIs. Global owns cross-workflow selection; the public entry cannot enable workflow_handoff_enabled. Super starts through an internal role and handles only its current workflow.

Configuring the Workflow Catalog

To restrict a project to ToffeeUT tasks, add the following workflow catalog settings to your YAML configuration.

global_agent:
  plugin_selectors: []
  allowed_workflows: [toffee-ut:ut]
  target_configs: {}
  max_parallel_supers: 2
  max_runs_per_request: 12
  workspace_roots: []
  resources:
    simulator: 1
  launch_profiles:
    standard:
      backend: null
      max_subagents: 2
      max_attempts: 2
      preparation_timeout: 900
      no_embed_tools: false
      resources:
        - simulator
  • Startup discovers installed plugins, repository plugins, and plugins in plugin.search_paths. --plugin / plugin_selectors can explicitly select sources and resolve name conflicts. Catalog discovery imports plugin declarations without activating business tools or stages; configure only trusted plugin paths. One plugin's loading failure does not prevent using others.
  • An empty allowed_workflows allows all discovered workflows; a nonempty list explicitly restricts them to the listed plugin:workflow values. The catalog lists purposes, inputs, outputs, preparation parameters, and reasons for unavailability. The UCAgent wheel bundles UnitTest and ToffeeUT; plugins such as Formal must be installed or available in configured search paths. Restart Global after adding plugins to discover them.
  • A profile with backend: null inherits Global's backend. A Sub role can select its own backend and otherwise inherits Super's.
  • Operators define launch_profiles. Global selects a profile name rather than supplying arbitrary shell commands, argv, or configuration overrides. Catalog queries do not return secret profile values.
  • Child configuration precedence is target_configs[workflow], the profile's config, then Global's launch configuration. CLI task overrides, output directory, and explicit Skill switches pass to children. The framework fixes launch mode and process identity.
  • no_embed_tools: false selects tool paths according to backend capabilities; true forces external tools. When MCP is needed, it listens on a dynamically allocated local port.
  • max_parallel_supers limits Supers preparing or executing concurrently. A profile's max_subagents limits Subs for that Super.
  • Profile resources consume capacity of the same name. For example, a simulator capacity of 1 serializes Supers requiring it.
  • max_runs_per_request limits launches for one user request and subsequent launches triggered by its results; retries also consume this budget. max_attempts permits the initial execution plus retries up to that total in a failure sequence. Operator cancellation and reconnecting do not count as failures. Reconnecting does not consume launch budget; relaunch does not erase previous failure consumption.
  • The project directory defaults to the startup current directory and can be set with a positional argument or MULTI_WORKSPACE. It defines the DUT search scope, not an individual task workspace. Configure additional directories explicitly through workspace_roots; relative paths resolve against the project directory.
  • Global reopens the same project session, default, at <project>/.ucagent/master_db/global_sessions/default/global/. Master owns tasks and results across conversations. New task/workspace IDs are allocated durably as task-000001, with new business workspaces under <global_agent.root>/task-000001/workspace/. Without an explicit root, .ucagent/master_db/global_sessions remains the output root.

Default Session, Continuation, and Automatic Exit

Reopening restores task references, request status, and bounded recent user and assistant messages. An interrupted model operation becomes interrupted; its tools are never replayed automatically. Complete backend-private model memory is not guaranteed to resume. One Master owns each management database, and one Global controller owns each default session.

global_agent.root selects the output root for both the conversation and new tasks. For example, --override global_agent.root=output creates:

1
2
3
4
5
6
<project>/output/
  default/                  # Persistent Global conversation
    session.json / events.jsonl / inbox.json
    global/                 # Global controller workspace
  task-000001/workspace/     # New Super business workspace
  task-000002/workspace/

The output root must be inside the project management root. Tasks still belong to the project's shared Master; ordinary Web creation continues to default to the management root. The common allocator advances IDs across output directories. Existing tasks resume at their recorded paths without being moved. Output trees are excluded from automatic DUT discovery, source fingerprints and new-workspace copies; explicitly selecting an existing business workspace still uses the continuation checks. --output continues to select the child workflow's artifact directory, separately from global_agent.root.

Local child-service allocation excludes both occupied sockets and ports already assigned to starting tasks, even before their listeners bind. Automatic ports are allocated again on relaunch; explicit conflicts with other managed services fail with a diagnostic. This reservation covers launches within one Master; it does not hand a bound socket to the child or eliminate races with external programs.

Existing task Default action
Running Return action=attached; explicitly use MessageSuper for supplemental guidance
Alive but paused Show the issue; resume/reply on user instruction, with operator-only budget grants and review
Exited and unfinished Relaunch in place with the new instruction; retain task_id/workspace_id, allocate a new client_id, return action=relaunched
Accepted success Return action=reused_result and reuse accepted artifacts
Several compatible matches Return candidates for explicit task_id or workspace_id selection
No match or explicit independent=true Create a separate task and workspace

For additional verification after accepted success, explicitly call RetrySuper with the current client_id, force_stage_index and a new instruction. The common relaunch path reopens the selected stage and later stages, preserving business files, previous accepted snapshots and cumulative budgets. Stage 0 is valid. Plain StartSuper continues to reuse accepted results.

Existing Web or standalone workspaces can continue through an exact source_workspace or workspace_id. Master uses existing relaunch registration and checks DUT, workflow and saved configuration. An unprovable match is rejected; identical DUT names alone are insufficient. Changed source content, preparation options or business configuration cannot reuse stale successful evidence. Ordinary hidden inputs such as .include/defs.vh participate in the fingerprint. Changes after queue admission fail preparation explicitly; submit the updated source again. Tasks with the older fingerprint algorithm are not automatically considered compatible under the new algorithm.

A restored pending question, review or budget decision remains paused. Startup does not treat the old launch instruction as a new recovery authorization.

--exit-on-completion waits until accepted requests and result notifications have finished processing, all Supers are terminal, and Global has no active model operation, then selects an exit code from request-processing and task outcomes. A Sub submission or one Super finishing does not directly exit Global. Without the flag, Global keeps waiting for user messages; paused live tasks must first be handled through their recovery actions.

DUT Selection and Workspace Preparation

ListDUTs performs a bounded scan of the project and additional source roots: at most three subdirectory levels and 2,000 directories, returning up to 200 candidates. It recognizes raw RTL and <DUT>_RTL workspaces and does not scan hidden runtime directories. For deeper sources or non-RTL tasks, explicitly provide dut_name and source_workspace. Paths must be within allowed roots; Global's runtime-state directories cannot be inputs.

StartSuper resolves the DUT, workflow and preparation options. Process states follow waiting → preparing → starting → running → stopped/failed; task_outcome and evidence_status separately describe business outcome and accepted evidence. Preparation consumes execution/resource capacity and has a configurable preparation_timeout (900 seconds by default). Cancellation drains its commands. After failed preparation, explicit RetrySuper(retry_preparation=true) preserves partial files in the previous client's preparation/ history and retries the same task/workspace.

  • toffee-ut:ut stages raw DUT sources under <DUT>/, preserving README, RTL, and include paths. Existing ToffeeUT projects retain their layout. After inventory and scaffolding, BuildToffeeDUT calls Picker/Verilator to build {OUT}/dut/<DUT>/. Inventory also recognizes root-level <DUT>.v/.sv and README in flat workspaces.
  • formal:formal arranges <DUT>/ from raw RTL or a workspace's <DUT>_RTL, without inheriting UT tests or simulator interfaces. Operators must still configure the necessary EDA tools.
  • Workflows without a preparation hook safely copy the specified source directory. For example, incremental UT should select an existing test workspace. Copying excludes .ucagent, .git, virtual environments, and similar state, and rejects out-of-root file symlinks and directory symlinks.

Master records preparation in preparation.log under the task directory.

Compatibility with existing UnitTest projects

To continue an older task, name its original workflow explicitly: unittest:unittest, unittest:incremental, or unittest:vibe. If you configured allowed_workflows, add that workflow to the list first. See the UnitTest guide for workspace preparation and startup.

Interfaces and Navigation

Global's TUI centers on conversation, with a sidebar showing Super/Sub, workflows, and execution status. The main conversation shows user input, model messages, and thinking/reasoning text published by the backend. Tool and framework logs, preparation output, operation results such as global_message: succeeded, and delivery notices stay out of Messages. Global request failures appear in the separate attention bar; original events remain available in Console/API/archive. Explicit /help and other interface commands still render their requested replies. Selecting an Agent opens its detailed messages instead of mixing all child tool output into the main conversation.

Drag the divider between Global conversation and the Agent tree, or use Ctrl-Left/Right or Ctrl-H/L to move it. Widths are clamped when the terminal shrinks so both columns remain visible. Returning from a Super/Sub page preserves the Global split. Sizes are retained within the current TUI instance; reopening starts with the default width.

Super and Sub both use the existing execution TUI: Mission on the left, Messages on the right, Console below, and a bottom status bar, retaining draggable dividers, command history, and name completion. Super shows stages, changed files, tool calls, and the Sub list. Sub shows its workflow, task instructions, status, result, and own messages. Switching pages does not cancel tasks; pages independently retain messages, draft input, history, and pane sizes.

The Agent tree and Sub page titles use number-English_stage_name, such as 1-parse_specification and 2-check_interfaces. Nested stages use the actual delegated leaf's name. Once a Sub ends and its message replay catches up, Result is appended once at the end of Message. Errors and artifacts remain on the left.

Relaunching a Super in place retains Subs from earlier executions in the Agent tree. Historical pages are read-only and read the original execution's event archive. These records also survive a Master restart; unfinished historical Subs are marked interrupted.

On first opening a Super/Sub page, the TUI displays task state already available in the Agent tree; direct attachment first reads saved Master state. Live status refreshes in the background about once per second. Messages and logs poll independently at 0.25-second intervals, while stage clocks still advance every second. Slow status queries do not block initial content, incoming messages, or input. Hidden pages stop polling; reopening retains their content and resumes updates.

Initial loading selects only the current Agent and attempt's latest 200 activity events and 200 system events. System logs and HTTP share the system allowance. Events are output chunks, not complete messages; existing display character/line limits still apply. Incremental backlogs drain continuously, and historical Subs stop event polling after catching up. Earlier records remain in the archive and are not automatically replayed from the beginning.

Super/Sub Messages shows only that Agent's model exchanges: task/guidance inputs, assistant output, tool calls and returned values. Existing message rendering, tool-result formatting and inline streaming remain in use, preserving headings, colors, indentation, newlines and readable summaries. No message cards, folding or combined tool exchanges are introduced. MCP tool results also follow each tool's existing display rules, retaining readable summaries and hiding internal coordination fields where the tool specifies this instead of displaying a raw dictionary. Actual tool data returned to the model is unchanged; literal JSON strings read from files remain verbatim. External CLIs expose only framework-supplied and client-published exchanges, not their complete private model history. Super no longer includes Sub conversations; Sub views select the exact worker and execution attempt.

The lower Console has only System logs and HTTP. System logs preserves the original Console output, including tool INFO, emitted DEBUG, ordinary prints, multiline diagnostics, command output, and warnings/errors, without extra source or severity filtering. Existing logs that explicitly print prompts or tool-result bodies are also preserved; terminal echoes of model messages are not added again. HTTP shows transport information only, appending each line in its original log format with timestamps and request details instead of count summaries. Tool request/response bodies are not repeated there. Private MCP listener logs belong to their explicit Sub owner; shared CMD/Master traffic belongs to the service host, independently of incidental tool context. HTTP events do not also appear in System logs.

Each Console tab retains its own scroll/follow state. clear / Shift-Right clears only the current display, preserving the archive. Explicit commands and their responses appear directly in the system tab using the original Console formatting. Guidance enters Messages when delivered to the model. Activity/Raw are no longer task-page Console tabs; raw output remains available for diagnosis and Web event APIs remain unchanged. The Global home page still displays its own conversation and Agent tree.

Action Purpose
Natural language Start tasks, ask questions, or describe follow-up work
/agents Query Agent status
/open TASK_ID Open a specific Super
/cancel TASK_ID Cancel a Super and its owned execution
/retry TASK_ID Continue an exited task in its original workspace within budget
/help Show Global interface commands
/quit Exit the Global host and clean up child processes
Ctrl-Q Return from Global TUI to Console while tasks continue
Escape or /back Return to the parent Agent page; first close help, completion, or Console paging mode
Ctrl-Left/Right or Ctrl-H/L Resize Global columns; resize columns on Super/Sub pages
Ctrl-Up/Down or Ctrl-K/J Resize rows on Super/Sub pages
F1 / Ctrl-T Show shortcuts / choose a theme on Super/Sub pages

The Super page accepts registered Console commands such as status and task_status, including /status forms. Other plain text becomes supplemental guidance delivered at a safe planning boundary. Guidance from a Sub page goes to its parent Super rather than directly rewriting a running Sub task. Ctrl-C on a Super page interrupts that Super's operation without cancelling other Supers. Pause or cancel a Sub from its parent Super page.

Viewing from Another Terminal

ListAgents provides the session directory: <project>/.ucagent/master_db/global_sessions/default/, or <global_agent.root>/default/ with a custom root.

ucagent attach /absolute/path/to/session_dir --agent task-000001

Attach connects to an existing instance without creating an Agent or rerunning a workflow. Closing the viewer does not stop tasks. Saved read-only status and messages remain viewable after task completion while Master is available; if Master is offline, reopen the project manager first.

Same-root local Master discovery and verified local process execution are supported. Closing Global detaches from an existing external Master. When Global owns the Master, it stops referenced tasks and saves progress before closing. Reopening uses the same management space. Remote automatic discovery and managed-workflow container execution are not enabled. Workspace/process isolation is not an OS sandbox.

Global Tools

Tool Purpose
ListDUTs Query DUT names and raw or prepared source paths
ListWorkflows / ListLaunchProfiles Query the workflow catalog and launch profiles
StartSuper Prefer a compatible existing task; otherwise prepare a new task asynchronously, returning task_id
ListAgents / AgentStatus Query the Agent tree, stages, errors, executions, and artifacts
MessageSuper Deliver supplemental guidance to an active Super
RecoverSuper Reply to or resume a live paused task according to user instructions
CancelSuper / RetrySuper Cancel or retry a specified task
ReadAgentArtifact Read accepted artifacts within size limits and recheck file digests

Completion results include dut_name and source_workspace so follow-up tasks for "the same DUT" can explicitly reuse them. Different workflows prepare independently from the same source files by default; the entire previous task directory is not automatically used as new input. Completion results enter Global's subsequent conversation automatically, without repeated model status polling. To chain workflows, Global waits for upstream artifact acceptance before deciding the next launch. Inputs reference accepted artifacts through task_id, client_id, and path and are copied to target inputs/ paths.

Acceptance and History

A successful Super requires normal exit, a valid run receipt, correct task/workspace/client identity, completed stages, and matching output files and digests. Stage results follow the workflow's existing completion and allowed-skip semantics; the corresponding Checker judges business correctness. Global cannot declare success early through a text reply.

ReadAgentArtifact returns at most 64 KiB by default, with a 1 MiB limit. Acceptance copies artifacts into an immutable execution snapshot; later edits in the business workspace do not change the accepted version. Reads and downstream input copies recheck snapshot digests.

When Web deletes a task, Global sends one notification, closes that reference and continues tracking other tasks. Execution history remains available through the Master task-history endpoint.

The session retains all pending messages and the latest 20 terminal turns, archiving older turns under inbox_history/ without replaying historical notifications on reopen. A backlog of 1000 pending messages requires waiting before sending more. Event checkpoints restore recent messages; an interrupted final write preserves damaged bytes and reports recovery, while middle-record corruption still requires investigation. Master completes durable management commits before reopening, avoiding partially published task/workspace records. See Development Architecture for storage boundaries.

State and Evidence Index

Location relative to the project Purpose and boundary
.ucagent/master_db/tasks.json / workspaces.json Shared task/workspace records; process liveness is probed separately
.ucagent/master_db/global_sessions/default/session.json Conversation references, requests and notification positions, not another scheduler
Session events.jsonl / inbox.json Standard events and input/notification delivery; not success evidence
<global_agent.root>/<task_id>/preparation.log New-workspace preparation log
.ucagent/master_db/task_history/<task_id>/<client_id>/ Process stdout/stderr, standard events, receipt and historical state
Execution history accepted/ Accepted receipt and artifact snapshot
<global_agent.root>/<task_id>/workspace/.ucagent/multi_checkpoint.json Super budget usage, granted additions, pending decisions and guidance
<global_agent.root>/<task_id>/workspace/ Business workspace retained across relaunches

Global business identity has no attempt. Worker attempts remain execution-budget counters. The framework assigns actual Sub IDs as stage-NNN-<stage-name>-sub-NNN; see the Multi-Agent delegation contract for numbering and plan-local dependency references. Events use id/time/generation/cursor/gap.

After a Master crash, interrupted preparation becomes explicitly failed with partial assets preserved. Unknown exit codes cannot produce accepted success; unknown executor status keeps the workspace reserved. New processes do not reset budgets or approve pending questions/reviews. Correlate diagnostics by task_id/client_id; see Troubleshooting. Restricted connection.json contains credentials and must not be copied into issue reports.

Local Message and Log Archives

Multi automatically archives published events from all three Agent tiers; --log is not required:

  • Global: <global_agent.root>/default/events.jsonl, or the project's .ucagent/master_db/global_sessions/default/events.jsonl when no root is specified.
  • Super/Sub: the project's .ucagent/master_db/task_history/<task_id>/<client_id>/events.jsonl. Subs share their parent Super's archive, identified by worker_id and worker_attempt. Relaunching in place creates history for a new client_id and retains earlier records.

Archives include activity, system (including HTTP), and raw events. UI separation and deduplication do not delete archived raw output. text stores display text; message and tool events may also carry a content body. Switching pages or clearing the display does not delete these records.

The live event buffer retains at most 10000 records and 1 MiB per category by default; buffer eviction does not remove disk history. An individual event's text or content exceeding 1 MiB is truncated before archival and marked truncated. Archives cover only events captured by the framework or published by the backend. They do not guarantee external CLIs' private model history; locally generated UI responses such as /help and command echoes are not uniformly archived either, so the archive is not a complete UI replay.

CMD's GET /api/events and Master's GET /api/task/{task_id}/events accept recent=true for recent events and apply worker_id / worker_attempt filters before pagination. An empty worker_id= selects only Super; omitting it includes all Agents. limit defaults to 200 and accepts 1–1000. For full replay, explicitly start at after=0 and continue with the returned cursor. Omitting after on CMD selects recent events; Master defaults to reading from the beginning and requires the original execution's client_id.

Pending Tasks and Interface Recovery

Global retains its conversation, Agent tree, and input layout. The top summarizes running and pending tasks, the tree shows specific pause categories, and the bottom indicates which Super to open. Each status change generates only one notification.

Super retains the Mission / Messages / Console layout and adds an execution status card above Messages. When paused, it expands the reason, current planning consumption, and applicable actions. Details distinguish Agent reports, runtime condition checks, and actual call evidence. The budget dialog shows explicit increments that take effect only on submission. Human review keeps its existing approval and version checks.

Sub shows only its assigned stages, own tool statistics, tool-result bodies, and own Console. After an attempt ends, it indicates that Super is handling the task and offers a direct link to the parent. Text entered in Sub's input box is guidance for Super.

RecoverSuper replies to or resumes a live paused task according to explicit user instructions; MessageSuper only supplies guidance. Budget additions and formal reviews use Super's operation entry points. Tasks whose processes have ended are read-only; use /retry TASK_ID to start a new process in the original workspace. See Multi-Agent Pausing and Recovery for issue categories and Console commands.