Plugin-Based Agent Architecture: From Composable Runtime to Desktop Delivery

    This article explains how a plugin-based architecture turns an AI agent runtime into an assemblable plugin tree, and how a desktop shell plus interaction redesign removes the terminal barrier for non-developers. It covers pluggable layers, mount and unmount lifecycle rules, configuration trees as deployment units, desktop responsibilities and isolation boundaries, and practical UI improvements such as clearer information hierarchy, shorter navigation paths, and information shown ahead of time. A final checklist summarizes the implementation priorities.

    1. Background: Capable, but Not Yet Ready for Daily Use

    Over the past two years, the capability boundary of agent runtimes has expanded quickly: skill invocation, external tool integration, model adaptation, file read and write, session persistence, and sandbox isolation can now each evolve independently. Yet when such systems are actually used day to day, the problems that surface are rarely about whether a capability exists. They are about how capabilities are organized, replaced, and delivered.

    The first problem is architectural coupling. Many systems put model calls, tool execution, storage, and the interface in the same process early on. Iteration is fast at first, but over time no single layer can be replaced. Switching model providers means changing the call layer; changing session storage means touching business logic; adjusting the permission policy means going back to the entry code.

    The second problem is the delivery barrier. The official startup flow is usually simple enough: prepare the runtime environment and run one command in a terminal. But for users who do not write code, opening a terminal is itself a wall. When promoting developer tools, this is exactly where many people drop off.

    The third problem is interaction maturity. Early versions exposed the underlying capabilities as fast as possible, so the interface was feature-complete but rough in detail: unclear information hierarchy, weak state distinction, and long paths for common actions. These issues do not affect whether something works, but they directly affect whether people are willing to use it every day.

    The core of this article is how a plugin-based architecture addresses the first problem, and how desktop delivery and interaction redesign address the second and third.

    2. Core Design: Making the Runtime an Assemblable Plugin Tree

    An approach repeatedly validated in the industry is to treat the agent runtime as a plugin tree assembled from configuration, rather than a monolith with fixed features.

    2.1 Pluggable Layers

    Under this architecture, almost every layer of capability is composed through plugins:

    • Skills and tools: external capabilities are packaged as registrable, invokable units;
    • External protocol integration: third-party systems and data sources are connected through standardized protocols;
    • Interface and interaction: front-end views, panels, and interaction components are all replaceable;
    • Model adapters: differences across model interfaces are unified and protocol details are hidden;
    • File system: local directories, virtual file systems, or remote storage can all be swapped in;
    • Session storage: in-memory, file-based, database-backed, and other persistence options are pluggable;
    • Sandbox: the isolation boundary for command execution and code execution is replaceable;
    • Agent main loop: even the loop logic that drives the whole flow can be replaced.

    The key here is not “supports plugins” but making pluginization thorough: only when the main loop, storage, and sandbox can all be replaced does the system truly gain the ability to evolve.

    2.2 Mount and Unmount Lifecycle

    The hard part of pluginization has never been registration; it is revocation. A reliable plugin mechanism must guarantee:

    • On mount, the plugin registers services, events, and interface elements into a shared context;
    • On unmount, the corresponding registrations are fully revoked with no dangling references left behind;
    • When multiple implementations of the same capability exist, configuration decides which one takes effect, not code branches.

    A schematic plugin contract can be understood like this:

    1. interface Plugin {
    2. id: string
    3. mount(ctx: SharedContext): Promise<void>
    4. unmount(ctx: SharedContext): Promise<void>
    5. }
    6. // Mount: register services / events / interface
    7. // Unmount: revoke in reverse registration order, keeping it idempotent

    Three engineering rules are worth agreeing on: registrations must be enumerable, unmount must be idempotent, and dependencies must be one-directional. As long as these three hold, replacing a capability usually means changing one item in the configuration tree or inserting a new plugin, without touching other layers.

    2.3 The Configuration Tree as the Deployment Unit

    When the plugin tree is described by configuration, the configuration itself becomes the deployment unit and the convergence point for environment differences. Development, testing, and production can share the same codebase and differ only in configuration: which plugin set is enabled, which storage backend is used, and which permission mode applies. This also turns “gradually replacing one implementation” into a configuration change rather than a release.

    3. Delivery Layer: Removing the Terminal Barrier with a Desktop Shell

    No matter how elegant the architecture is, if users must open a terminal first, it cannot become a daily tool. A workable approach is to add a desktop shell and a set of client plugins without changing the runtime core.

    3.1 Responsibility Boundaries

    The desktop side handles only “host tasks” and does not take over agent logic:

    • Desktop: starting and stopping the local runtime process, window management, directory selection, data directory management, runtime restart, and log and status display;
    • Runtime: model scheduling, tool execution, sessions, and permissions all reuse the existing implementation;
    • Client plugins: they only enhance the interface and interaction, without changing execution semantics.

    A schematic startup sequence:

    1. Desktop starts
    2. -> Select or create a data directory
    3. -> Launch the local runtime (plugin tree assembled per configuration)
    4. -> Native window loads the interface
    5. -> On runtime failure, the desktop handles restart and notification

    This layering brings one important benefit: architecture upgrades and interface upgrades can be released independently. Users who already have the runtime deployed can install only the client plugins they need and skip the desktop client.

    3.2 Security and Isolation

    A desktop shell touches the local file system, so boundaries must be explicit: directory access must be explicitly chosen by the user and persisted as workspace configuration; the data directory and project directories stay separate; the runtime starts with least privilege; and command execution and code execution both go through the sandbox plugin so the shell never becomes a bypass around isolation.

    4. Interaction Redesign: From Developer Preview to Daily Tool

    Once the underlying capabilities are exposed, interaction details determine retention. Below are general solutions to three high-frequency problems.

    4.1 Information Hierarchy in the Left Sidebar

    Early interfaces usually already supported workspaces and a multi-level session tree, but the visual difference among workspace, session, and current task was too small. Once projects pile up, users have to pause to confirm which directory they are in and which session is open. The direction for improvement is to strengthen three levels of state: highlight the current workspace, bold the current session with a status dot, and lower the contrast of inactive sessions.

    4.2 Shorter Paths for Common Actions

    Change project clicks from “expand or collapse only” to a more direct semantic: clicking an inactive project switches to it and enters a new session; an active project keeps expand and collapse; the new-entry control beside it stays. Switching projects goes from two steps to one without breaking existing habits.

    4.3 Information Up Front

    Session hover cards add key information: the owning workspace, creation and update times, message count, the model and permission mode in use, and whether unfinished tasks exist. This moves the cost of judgment from “click in and look” to “hover and know.”

    5. Implementation Advice and Checklist

    • Define the plugin contract and shared context first, then migrate existing functionality;
    • Put the configuration tree under version control so changes can be reviewed and rolled back;
    • Write tests for the unmount path, covering idempotency and residue checks;
    • Bind permission modes to the sandbox plugin and forbid bypasses;
    • Use “shorter paths, clearer state” as the acceptance criteria for interface changes;
    • On delivery, remove the terminal dependency first, then fill in interaction details step by step.

    The value of pluginization is not “supports extension” but making every layer replaceable, gradually rollable out, and rollback-able. The value of desktop delivery and interaction redesign is putting these capabilities into the hands of non-developers. Combined, they form the complete path for an agent to move from demo to daily tool.