Plugin-Based AI Workshop in Practice: Building an Evolvable Architecture

    This article explains how to build a plugin-based AI workshop that turns AI capabilities into versioned, replaceable, and verifiable engineering assets. It covers the core problem behind script-style AI usage, a layered model of plugins, services, tools, protocol adapters, and presets, a portable directory layout with declarative plugin manifests, strategies for swapping tools and model providers, a full lifecycle for generating and managing plugins, and the rules, permissions, and evidence needed to make results reviewable and recoverable.

    1. The Problem: Why a Workshop Instead of Scripts

    Most people using AI coding tools quickly fall into a loop: write a prompt, paste some code, get a result, and copy it into the project by hand. This works well for demos, but problems pile up in real engineering work: capabilities are scattered across chat logs and cannot be reused; switching models means rewriting the entire prompt set; tool calls rely on manual copy-paste; there is no evidence for whether a result is correct; and the environment breaks on a different machine.

    The core tension a plugin-based AI workshop addresses is this: AI produces capabilities fast, but engineering accumulates them slowly. So the design goal is not “a stronger one-shot generation” but bringing AI capabilities into an engineering system that is version-controlled, replaceable, and verifiable. A working workshop must satisfy five properties at once:

    • Runnable: one command brings up the environment, with no dependency on someone’s local state;
    • Extensible: new capabilities are added as plugins without touching the main trunk;
    • Verifiable: every run leaves evidence, and conclusions can be reviewed;
    • Portable: it can be rebuilt on a new machine, with a new model provider, or by a new team;
    • Recoverable: when something fails, it can roll back to the last known good state.

    2. Layered Model: Plugins, Services, Tools, Protocol Adapters, and Presets

    The complexity of a workshop comes from having many kinds of components, so a clear layering must be established first; otherwise “everything is a plugin” degrades into “everything is chaos.”

    A plugin is the smallest unit of capability encapsulation. It declares “what I provide, what I need, and how I am enabled.” A plugin should not implement business details directly; it delegates them to services and tools.

    A service carries stateful or long-lived logic, such as session context management, execution queues, and evidence archiving. A service is usually globally unique, and plugins gain access through dependency declarations.

    A tool is a stateless callable action that takes structured parameters and returns structured results, such as reading and writing files, querying an index, or calling an external spreadsheet capability. The value of a tool lies in being “reliably callable by a model,” so the parameter schema and error semantics matter more than the implementation.

    The protocol adapter layer (MCP-style adapters) solves how external capabilities are integrated in a uniform way. It wraps third-party systems as a standard tool set so the workshop trunk does not need to be aware of external differences.

    A preset combines a run mode with a task template. It declares “which plugins, which model tier, what permission policy, and what artifacts this task uses.” Presets let the same workshop switch into forms such as “refactor mode,” “review mode,” and “documentation mode.”

    Dependencies must point in one direction only: preset → plugin → service → tool → adapter. Any reverse dependency sharply increases replacement cost.

    3. Putting the Composable Architecture in Place: Layout and Declarations

    For a portable workshop, the structure itself is documentation. A sketch:

    1. workshop/
    2. ├── presets/ # run modes and task templates
    3. ├── plugins/ # capability encapsulation
    4. ├── services/ # stateful services
    5. ├── tools/ # stateless tools
    6. ├── adapters/ # external system protocol adapters
    7. ├── rules/ # project rules and constraints
    8. ├── policies/ # permission policies
    9. ├── evidence/ # execution evidence
    10. └── tests/ # contract and regression tests

    A plugin declaration should keep only the minimum necessary fields:

    1. id: course-conflict-checker
    2. version: 0.1.0
    3. requires:
    4. services: [scheduler-context]
    5. tools: [table.query]
    6. provides:
    7. tools: [schedule.detect_conflict]
    8. entry: ./index
    9. permissions: [read:project, write:evidence]

    The point of this declaration is that the loader can complete dependency validation and permission pre-checks before enabling a plugin, moving many runtime failures forward to the startup stage.

    4. Swapping Tools and Models: Making Replaceability the Norm

    The biggest difference between a workshop and a fixed product is that components can be swapped. In practice, the two most common replacements are external data capabilities and model providers.

    When integrating an external spreadsheet capability, do not write it into a business plugin. First implement a standard tool in the adapter layer (query, write, batch update), then declare the dependency in the plugin. After that, changing the data source only touches the adapter layer.

    When changing model providers, the key is to abstract “model” into configurable tiers—for example, a lightweight tier for bulk rewriting, a standard tier for routine coding, and a reasoning tier for complex refactoring. Switching only changes the preset, not the plugins:

    1. model:
    2. tier: standard
    3. params: { temperature: 0.2, max_output: 8192 }

    The comparison of cost and quality should become a fixed process: the same set of task samples, the same scoring criteria, recording time spent and output quality separately, with conclusions written to the evidence directory. “Switching models” without a comparison baseline only swaps one uncertainty for another.

    5. Letting AI Build Plugins: A Full Lifecycle Walkthrough

    An advanced capability of the workshop is “describe a capability that does not yet exist in natural language, and have the system generate a minimal plugin.” Using a course conflict checker as the example, the full loop has six steps:

    1. Describe: use natural language to specify the inputs (class times, room capacity), the rules (time overlap, teacher conflicts), and the output (a conflict list).
    2. Generate: produce a minimal plugin skeleton and tool schema, without unrelated logic.
    3. Load: the loader validates the declaration, dependencies, and permissions, and reports locating information on failure.
    4. Test: first run contract tests (parameter validation, boundary inputs), then run sample regressions.
    5. Fix: iterate based on failure evidence, change only the necessary files, and keep a change record.
    6. Disable and uninstall: after confirming there are no references, disable and observe, then uninstall and clean up the evidence index.

    A sample test skeleton:

    1. def test_overlap_detected():
    2. r = tools.schedule.detect_conflict(
    3. [{"t": "Mon 08:00-09:30"}, {"t": "Mon 09:00-10:00"}])
    4. assert len(r.conflicts) == 1

    The key to lifecycle management is “reversibility”: every plugin must be safely disabled and completely uninstalled, or the workshop will gradually accumulate uncontrollable hidden dependencies.

    6. Rules, Permissions, and Evidence: Making Results Reviewable

    Project rules constrain the boundaries of model behavior—for example, no changes to generated directories, tests must pass before committing, and comment language must be consistent. Rules should live in version control, not in someone’s memory.

    Permission policies follow least privilege: plugins are read-only by default, write operations must be declared explicitly, and calls involving external systems all go out through the adapter layer for easier auditing.

    Execution evidence includes commands, input summaries, output diffs, test results, and time spent. The value of evidence is not “proving it was done right” but “when something goes wrong, pinpointing which step started to drift.”

    7. Migration and Recovery

    A migration checklist should include the dependency list, an environment variable template, preset descriptions, the evidence archiving strategy, and rebuild scripts. Recovery relies on snapshots of the “last known good state,” combined with plugin version numbers for fast rollback.

    8. Conclusion

    The essence of a plugin-based AI workshop is upgrading AI from a “chat artifact” to an “engineering asset.” When plugins, services, tools, adapters, and presets form a one-way dependency, and every generation comes with tests and evidence, a personal AI work environment truly becomes evolvable. To further reduce the cost of setup and operations, you can run and archive the workshop on general cloud products such as the container platform, object storage, and log monitoring offered by Baidu AI Cloud.