Plugin Architecture for AI Agents: Why First-Turn State Governance Matters More Than Plugin Count

    Developer-facing agent runtimes let you swap models, tools, interfaces, and the execution loop independently, which makes it easy to port proven capabilities like terminal access, vision input, generative UI, memory, and multi-step workflows. But because autoregressive models treat the opening tokens as conditions for everything that follows, exposing dozens of tools and constraints in the first turn can push the same model off the interaction pattern it is most skilled at. This article explains the observable "same model, different working state" effect, argues for adding a first-turn anchoring layer before enriching plugins, classifies plugins by which part of the loop they change, and gives a concrete enablement order plus governance rules for teams.

    Why “Can Load Many Plugins” Is Not the Same as “Should Load Them All at Startup”

    A developer-facing agent runtime usually splits four concerns into replaceable parts: model adaptation, tool registration, the interaction interface, and the execution loop that threads together “think, call a tool, observe the result, decide again.” Once these are separated, interaction patterns already validated by the community recombine easily: terminal operations, visual input, generative UI, long-term memory, and multi-step workflows cover most of the common categories.

    The benefits of this architecture are direct. Swapping the model does not require rewriting every tool; swapping the interface does not require changing the execution loop; putting dangerous operations in a sandbox and writing the process into a session log does not have to be tied to the model. The problem is equally direct: the more plugins you have, the more tool descriptions, skill entry points, and system constraints you must expose to the model in the first turn. For an autoregressive model, the opening tokens are not just “descriptive text” but conditions for the generation that follows. Change the conditions, and the same interface with the same model can take a completely different path afterward.

    So before discussing “which plugin is good,” you should first discuss “which first-turn state puts the model into the working mode it is genuinely skilled at,” and only then discuss how plugins attach in layers. Otherwise plugin count goes up while the agent becomes more hesitant, takes more detours, and probes back and forth between tools more often.

    The Phenomenon: The Same Model, but Not the Same State

    What reproduces reliably in practice is usually not a slogan but a comparison experiment:

    • Model identifier, inference parameters, and available compute stay unchanged;
    • You only switch the runtime, or only change the tool catalog and system constraints delivered to the model in the first turn;
    • The completion quality and rhythm of tasks like code understanding, modification, and verification differ noticeably.

    Some attribute the difference to “training data contaminated by a certain interaction format,” others to imbalanced post-training distribution. These explanations are currently more inference than settled fact and should not be treated as conclusions. What can be confirmed is the observable fact: the model weights did not change, but the working state did.

    This is consistent with how autoregressive generation works. The model continues token by token from the existing context, and early tokens change the conditional distribution at every later position, an effect resembling a weakened “butterfly effect.” If the opening activates the interaction the model saw most during post-training and was rewarded most stably for, it continues along the familiar path: clarify the goal, make a small change, gather evidence, then converge. If the opening activates the meta-task of “first choose among a pile of skills,” the model spends compute on selection, self-explanation, and repeated confirmation, while the actual code editing is deferred.

    You can roughly divide first-turn activation into two kinds:

    1. Minimal working state. Few tools with clear boundaries, and the task is framed as the software engineering loop the model knows: read context, locate, modify, run checks, correct based on failure messages. The model stays in its comfort zone, output is usually more coherent, and it tends to improve with each revision.
    2. Overloaded decision state. The first turn spreads out dozens of skills or tools, each with a similar description and overlapping use cases. The model enters a confused phase: it must first answer “which one should I use” rather than “how should I change this code.” If the standard mode simply lays out all capabilities at once, this is often the result.

    There is a practical pattern in the post-training stage: an interaction mode reinforced repeatedly makes the model more skilled at it; a mode that appears rarely or carries unstable rewards leaves the model more prone to hesitate when it comes up. Complex but common software tasks are often handled well as long as the interaction form stays close to the training distribution; what actually drags performance down is frequently not how hard the task is, but that the first turn pushed the model away from the interaction form it is skilled at.

    Anchor First, Then Talk About Plugin Richness

    If you can only add one mechanism right now, the priority is not to stack on another flashy capability but to add a layer of first-turn anchoring. Its goal is not to make the model “smarter” but to fix the opening into the minimal working state, keeping the tool catalog and prompt from pushing the model into decision confusion.

    An anchoring configuration usually contains four things, all of which should be versioned and replayable:

    • A stable task frame. Use a fixed, short system instruction to declare role boundaries: you are a coding assistant making incremental changes in a repository; gather evidence before changing; advance one verifiable step at a time; do not invent multiple parallel solutions before observing a result.
    • A converged first-turn tool surface. Register in the first turn only the few tools necessary to complete the current task, such as reading files, bounded-scope search, applying a patch, and running checks in a sandbox. Other capabilities appear through “on-demand discovery” or attach in a second phase, rather than all being visible at the start.
    • Clear completion criteria. Tell the model what counts as the end of this step: tests pass, static checks pass, or the diff has been confirmed by the user. Without criteria, the model tends to use more tool calls to perform “still trying.”
    • A reproducible session header. Write the model adapter identifier, tool catalog hash, system instruction version, and sandbox policy into the session log. This makes “the model got dumber after switching runtimes” locatable rather than a feeling.

    Anchoring does not disable extension; it governs the timing of extension. Once the model has already written the first batch of effective tokens along the correct trajectory, attaching memory retrieval, visual understanding, or UI generation based on conversation state causes far less interference. The community describes this as “turn the intelligence on first”; the joke aside, the engineering meaning is: align the conditional distribution first, then increase the action space.

    Below is a vendor-neutral sketch of a first-turn catalog, expressing only the layering idea, not any product’s interface:

    1. session.start:
    2. mode: anchored
    3. tools.visible:
    4. - repo.read
    5. - repo.search
    6. - repo.patch
    7. - sandbox.check
    8. tools.deferred:
    9. - memory.recall
    10. - vision.inspect
    11. - ui.render
    12. - workflow.spawn
    13. policy:
    14. max_parallel_tools: 1
    15. require_observation_before_next_edit: true
    16. log:
    17. record: [model_adapter, toolset_hash, prompt_rev, sandbox_policy]

    When implementing, do not fixate on the field names; ensure three things hold at once: the first-turn action space is small, every tool return is treated as new evidence, and the same experiment can be replayed from the log.

    Classify Plugins by “Which Part of the Loop They Change”

    Moving a validated capability into a new runtime does not mean it should be enabled all at once. Dividing plugins by where they rewrite the execution loop makes it easier to decide the enablement order.

    1. Environment and Terminal Plugins

    These plugins let the model touch a real workspace: list directories, read diffs, execute builds or tests in an isolated environment. Their value is turning “claims to be done” into “observed to pass or fail.” The risk is excessive permissions, overly broad commands, and overly long output that blows up the context again.

    In practice, default to least privilege: scope the working directory to the task repository, keep the network off by default, write timeouts and output truncation into policy, and require explicit escalation for destructive commands rather than making them implicitly available. Terminal plugins fit well in the base tool surface after anchoring, but keep command templates few; do not treat “arbitrary shell” as one all-purpose skill.

    2. Visual and Multimodal Input Plugins

    Screenshots, design mockups, error screens, and charts are suited to be enabled only when text is insufficient to locate the problem. Encouraging the model to “look at the image first” in the first turn diverts a simple code task into the perception branch. A better strategy: attach vision tools only after text search fails or the user explicitly provides an image, and require the model to state which facts it adopted from the image, preventing unsupported descriptions from entering the subsequent patch.

    3. Generative UI Plugins

    When the result needs comparison, form confirmation, or step-by-step preview, a temporary interface aids human-machine collaboration better than a large block of plain text. What it changes is “how the human approves the next step,” not whether the model should read the code first. UI plugins should consume structured results already produced (diffs, test summaries, items awaiting confirmation) rather than replace repository tools. If the first turn offers the ability to “generate an arbitrary interface,” the model tends to use interface drafts to mask verification it has not yet completed.

    4. Memory Plugins

    Cross-session memory can reduce re-explaining repository conventions, but it can also write stale decisions and wrong preferences back into a new task. A memory plugin should distinguish three kinds of data: stable engineering conventions, facts of the current task, and unconfirmed inferences. Only the first kind is suited for default injection, and it should carry source and time; the latter two stay out of the first turn by default and are referenced only after a retrieval hit. Memory is not better for being longer; it is equally part of the opening tokens, and dirty memory systematically biases subsequent generation.

    5. Workflow Plugins

    Multi-step orchestration suits repetitive processes like release checks, migrations, and batch refactors: each step has an input, an output, and a failure branch. It is not suited to be the default brain for every conversation. Enable a workflow too early and the model will call tools just to fill the steps. The recommendation is to treat workflows as a second-stage load after the user names them or a task classifier matches, with each step still reusing the same anchoring constraints: small action space, observe before modifying.

    The Runtime Itself Should Be Pluggable, Not Only the “Skills”

    If you make only the skills into plugins and weld the loop and the logging shut, it becomes hard to explain behavioral differences later. A more stable split is:

    • Model adapter. Unify the message format, the tool-call protocol, and failure retries, avoiding each skill assembling requests on its own. The adapter version must go into the log.
    • Tool registry. A tool has not only a name and parameters but also visibility (first-turn / deferred), risk level, mutual exclusion, and output budget. The registry decides the action space, not the appendix of a manual.
    • Sandbox. Configure the filesystem view, process limits, network policy, and secret isolation separately. A plugin declares the permissions it needs and the runtime approves them, rather than the plugin escalating its own privileges.
    • Session log. Record at minimum the system instruction version, the tool catalog, the parameter summary and truncated observation of each call, and the model’s next decision. Without the log, you cannot tell “the model is bad” from “the first-turn state was swapped out.”

    Once all four layers are pluggable, swapping a runtime becomes a controllable experiment: change only one factor at a time. Otherwise, when the community reproduces a capability, it carries over someone else’s prompt, tool list, and hidden state together, and the resulting fluctuation gets mistaken for model randomness.

    How to Design a Plugin That Will Not Push the Model Into the Confused Phase

    1. One plugin solves one observation or one action. A composite skill like “read and freely refactor the whole module” makes the model skip evidence gathering. Split it into read, modify, and check tools, threaded together by the loop.
    2. Write descriptions as boundaries, not advertisements. State when not to use it, which tool it is mutually exclusive with, and the maximum output length. Overlapping descriptions are a major source of the decision state.
    3. Few parameters, explicit enumerations. The more free-text parameters there are, the more easily the model re-plans the whole task inside the parameters. If something can be expressed with a path, a symbol name, or a line-number range, do not use an open-ended instruction.
    4. Return executable evidence. Prefer returning diffs, exit codes, and failing test case names over lengthy explanations. Short evidence makes subsequent tokens look more like the “fix based on the error message” pattern common in training.
    5. Make failures distinguishable. Insufficient permission, timeout, no match, and command failure should be different results. A vague “something went wrong” tempts the model to switch to another tool and retry, producing idle spinning.
    6. Keep it out of the first turn by default. A new plugin enters the deferred catalog first; compare using task samples: once attached, does effective editing appear earlier, and do ineffective tool calls increase? Only when the former improves and the latter stays negligible should you consider raising its visibility.

    An Executable Enablement Order

    When facing a new agent runtime, you can expand in the following order rather than installing by plugin popularity.

    1. Fix the model adapter and sampling parameters, and build a small set of code tasks as a regression set: fix a failing test, change a well-defined interface, complete a refactor within a restricted directory. Record step count, number of ineffective calls, and whether the final check passes.
    2. Enable only the anchoring configuration and the narrowed repository tools and sandbox checks. Get this group running stably first, as the baseline. When the baseline is unstable, do not add memory or workflows, or attribution becomes impossible.
    3. Add one plugin at a time and rerun the same regression set. If ineffective calls rise or the first edit comes later, demote it back to the deferred catalog and tighten its description or permissions.
    4. Trigger memory, vision, UI, and workflows by task, not by conversation default. Write the trigger conditions into the registry, not into an ever-growing system prompt.
    5. Put the tool catalog hash and prompt version into every release note. After a runtime upgrade, check the regression set first, then open the new plugin to the team.

    For enterprise teams, add permission governance: who may register high-risk tools, whether secrets ever enter the model context, how long session logs are retained, and whether plugin upgrades require two-person review. These constraints do not raise the model’s “IQ,” but they ensure performance fluctuations are traceable and misoperations are replayable.

    Aligning With the Training Distribution Matters More Than Stacking Skills

    To truly make good use of a pluggable agent, starting from how lively the plugin marketplace is is not enough; you need to return to what behavior post-training is shaping. If post-training heavily rewards trajectories of “short context, few tools, modify while watching the result,” then the most faithful runtime usage is to reproduce those trajectories. Placing more than twenty skills in the first step is equivalent to improvising an exam the model is not skilled at: classify tools first, then do software engineering. If the classification goes poorly, the code afterward will not suddenly improve.

    This also explains another common experience: on complex but standard-shaped software tasks, the model can perform stably because the steps resemble the distribution it has seen; once the runtime rewrites the opening with a new tool catalog, the same model behaves as if it had a different capability. The capability did not change; the conditions did.

    So a plugin strategy can be summarized in three sentences. First, the runtime must allow replacing the model, tools, interface, and loop, or the community cannot bring validated working patterns in. Second, when porting, you must port the “constraints” and not only the “features”; first-turn anchoring, sandbox, and logging are the minimal set of constraints. Third, the extension order follows regression results: minimal working state first, then deferred-loaded specialized capabilities. The count can grow very large, but the action space the user sees in each concrete task should always stay small enough that the model does not have to pass through a confused phase first.

    Select by this principle, and terminal, vision, generative UI, memory, and workflows each get a clear place; ignore it, and the more plugins you have, the more easily you are simply swapping the opening tokens, then wondering why the subsequent generation changed.