Agent Collaboration in Practice: Connecting Cross-Model Plugins Locally

    This article explains how coding agents can collaborate by treating another agent as a locally orchestrated execution unit rather than relying on implicit model-to-model calls. It covers environment preparation, a four-step plugin integration flow, seven slash commands for review and task delegation, the boundary between local execution and cloud execution, a transferable integration checklist, and common pitfalls to avoid.

    Agent Collaboration in Practice: Connecting Cross-Model Plugins Locally

    1. Why “tools calling each other” has become a new problem

    Once a coding agent evolves from a “model that can chat” into a workbench that can modify code, run commands, and manage tasks, the most common complaint on a team is no longer “is the model smart enough?” but “is the division of labor smooth enough?” A typical scenario is this: one agent is good at fast generation and large-scale refactoring, while another is better at finding flaws, doing design reviews, and watching boundary conditions. So a natural request emerges: can A outsource key checkpoints to B while working, and feed B’s output back into A’s decision chain?

    In the past, this could only be solved by manual copy and paste, which was costly, lost context, and blurred responsibility boundaries. In recent years, a more engineering-oriented approach has appeared in the industry: instead of implicit “model-to-model” invocation, do explicit “tool-to-tool” integration. In other words, treat the other agent as a locally orchestrated execution unit and collaborate through explicit commands, an explicit working directory, and an explicit return structure. The advantage of this approach is that it is auditable, rollback-friendly, and reproducible, rather than depending on an unexplainable “prompt magic.”

    The technical prototype discussed in this article is a concrete sample of this line of thinking: a cloud vendor’s coding agent uses an open-source plugin to “plug” another widely used coding agent into its own workbench. The value of this kind of practice lies not in any single plugin, but in the fact that it demonstrates a transferable collaboration pattern.

    2. Environment preparation: keeping uncertainty out at the first step

    The place where cross-tool collaboration most often goes wrong is usually not a mistyped command, but a runtime environment that does not meet requirements. Take the Node.js ecosystem as an example: a common prerequisite is version 18.18 or above, because newer runtimes provide more complete support for ESM, top-level await, built-in fetch, and other capabilities, making plugin loading and local service communication more stable. It is recommended to pin a version with a version management tool first, then run the installation, to avoid a situation where “it runs locally but not on a colleague’s machine.”

    Another often overlooked point is the login state. Many agent CLIs support two methods: first, an account system (suitable for individual subscription scenarios, where the token is cached locally after one authorization); second, an API Key (suitable for unified team billing, centralized control, and auditing). If you are running in CI or a container, prefer injecting the key via environment variables, and do not write credentials into the repository or image layers.

    1. # Environment self-check
    2. node -v # expect v18.18 or higher
    3. npm -v
    4. # Globally install the target tool (as needed)
    5. npm install -g <coding-agent-cli>
    6. # Prepare login state
    7. <code-agent-cli> login # account method
    8. # Or inject the key via environment variables (recommended for CI)
    9. export CODING_AGENT_API_KEY=***

    This step may seem trivial, but it determines the success or failure of all subsequent commands. The engineering lesson is: make “pre-checks” a standalone step that gives a clear message on failure, rather than letting the user see a vague error in some later command.

    3. Four-step integration flow: from marketplace source to a usable command

    The general path for plugin-based integration can be abstracted into four steps: add a source, install the plugin, reload, and self-check. There are clear engineering reasons behind this order.

    The first step is to add a plugin marketplace source. A so-called “marketplace source” is essentially “the index location of a plugin manifest,” telling the workbench “where to find this plugin, and what its version and entry point are.” In local development, pointing directly to a repository is the easiest option, because it bypasses centralized release approval and iterates faster; when promoting it within a team, it is usually replaced with an internally hosted mirror to make version locking and security scanning easier.

    1. # 1. Add a source
    2. /plugin marketplace add <owner>/<repo>
    3. # 2. Install the specified plugin
    4. /plugin install <plugin-name>
    5. # 3. Reload plugins
    6. /reload-plugins
    7. # 4. Readiness self-check
    8. /codex:setup

    In the installation command in the second step, the plugin name often carries a namespace (such as the plugin@market form). This prevents name conflicts and is also a necessary design when multiple marketplaces coexist.

    The “reload” in the third step is easy to skip, but it determines whether new commands are actually registered into the session. Many “command not found” problems are rooted in changing the configuration without reloading, or reloading in the wrong session.

    The self-check command in the fourth step deserves a separate mention. Its design idea is “probe + guide repair”: first check whether the target executor (such as another coding agent) is already available on the machine; if not and a Node environment is detected, prompt to install it automatically; after installation, check the version and login state again. This “self-check as guidance” model is much friendlier than asking users to read a long document.

    4. Seven slash commands: breaking “collaboration” into assignable responsibilities

    After the plugin is installed, the workbench gains several colon-separated commands (in the form /plugin:command), plus a delegable sub-agent. These commands are not stacked randomly, but organized around four main lines: review, challenge, delegation, and background execution.

    1. Standard review: a read-only, reproducible “second pair of eyes”

    The core constraint of the standard review command is “read-only, no changes.” It does not touch your workspace and only outputs issues and suggestions, so you can safely run it on any branch. There are two typical usages: review the current uncommitted changes, or review the difference between the current branch and the main branch.

    1. # Review workspace changes
    2. /codex:review
    3. # Review the branch diff against main
    4. /codex:review --base main

    There is an easily overlooked engineering detail here: the “baseline” of the review must be explicit. Reviewing uncommitted changes looks at the increment; reviewing branch differences looks at the cumulative impact. The conclusions of the two may be completely different, and mixing them up will lead to misleading judgments.

    2. Adversarial review: upgrading from “finding errors” to “questioning assumptions”

    Standard review answers “is there a bug here,” while adversarial review answers “does the approach itself hold up.” It actively questions the implementation path and design trade-offs: does this premise hold? Is this trade-off worth it? Is there a simpler or safer alternative? If it fails, how large is the rollback cost?

    The value of this kind of review is especially evident before a release. Key areas to check usually include: authentication and authorization boundaries, data loss risks, concurrency and race conditions, and canary and rollback strategies. It does not make decisions for you, but it reopens the places where “you thought you had it figured out.”

    1. /codex:adversarial-review --focus auth,rollback

    It should be emphasized that the output of adversarial review naturally contains subjective judgment, and teams should treat it as “a supplement to the review checklist” rather than “the sole basis for an automated gate.”

    3. Task delegation and background task management: keeping long tasks from blocking the main thread

    A common problem with review commands is that they take time. A full branch review may take several minutes, and if you wait synchronously, the main thread is occupied. Therefore, this kind of plugin usually provides background execution, throwing the task into the background while the main thread continues development and comes back for results later.

    1. # Run a long task in the background
    2. /codex:review --background

    The key to background task management is “observability”: task ID, status, log location, and failure reason should all be queryable. Otherwise, background tasks become a “black box,” and when something goes wrong, you can only kill and restart them.

    4. Sub-agent: treating an “expert” as a callable resource

    In addition to slash commands, the plugin often registers a sub-agent. Its significance lies in “role separation”: the main agent handles orchestration and decision-making, while the sub-agent plays a dedicated reviewer, with isolated contexts between the two, avoiding the blind spot of “writing and reviewing your own work.”

    5. Local-first and the cloud boundary: the dividing line between security and cost

    The default form of this collaboration approach is “local-first”: commands run on the local machine, the working directory is the current repository, and no code is uploaded additionally. This is critical for teams under compliance constraints—the code does not leave the intranet, and review results only land in the local terminal.

    But the cloud is not unusable. When a task needs more computing power (such as a full scan of a very large repository) or needs results shared by multiple people, you can submit the task to the cloud for execution and then pull the conclusions back locally. At this point, three things need to be clear: first, the scope of data leaving the domain; second, how credentials are managed; third, the traceability of results. The recommended approach is “make decisions locally, do heavy work in the cloud, and feed results back uniformly into local tickets.”

    6. A transferable integration checklist: applying this pattern to your own system

    If you want to build a similar dual-agent collaboration for your team, you can follow the checklist below:

    1. Clarify division-of-labor boundaries: who generates, who reviews, who executes. Blurred boundaries are the number one cause of collaboration failure.
    2. Pin the runtime environment: write the Node version, CLI version, and login method into the README and CI checks.
    3. Unify the command namespace: avoid conflicts with existing plugins, and isolate with the plugin:command form.
    4. Separate synchronous and background execution: route time-consuming tasks to the background, and add logs and status queries.
    5. Read-only first: review capabilities are read-only by default, and any write operation requires explicit confirmation.
    6. Establish a rollback plan: issues found by adversarial review must have a corresponding fallback path.
    7. Make results auditable: archive the conclusions of each review to form the team’s knowledge base.

    7. Common pitfalls and how to avoid them

    • Command not registered: most likely the plugin was not reloaded, or was reloaded in the wrong session.
    • Unclear review baseline: forgetting to specify --base, resulting in a diff of the wrong scope.
    • Expired login state: after a token expires, it looks like “insufficient permissions,” so log in again before troubleshooting permissions.
    • Piling up background tasks: without a concurrency limit, tasks keep accumulating and eventually drain local resources.
    • Over-reliance on automated review: treating adversarial review as the sole gate and ignoring human judgment, which amplifies risk instead.

    8. Conclusion

    The essence of cross-tool agent collaboration is not “making two models chat,” but “treating another agent as an executable unit that can be orchestrated, audited, and rolled back.” The four-step integration, seven commands, and local-cloud boundary broken down in this article all revolve around this goal. What really determines the outcome is not which plugin is installed, but whether the team has done the four things—division of labor, environment, rollback, and auditing—solidly.

    From a longer-term perspective, this kind of “mutual invocation” capability will increasingly become infrastructure like water, electricity, and gas: you do not care which power plant the electricity comes from, only whether the socket standard is unified. For engineering teams, what is worth doing now is to settle “integration standards” and “collaboration norms” as early as possible, so that migration costs will be low enough when the tool landscape changes again.