Plugin Runtime Architecture: How Reversible Changes and Delta Composition Work
This article explains the plugin-based runtime architecture behind the idea that "everything is a plugin, and every plugin is reversible." It breaks the concept into verifiable engineering mechanisms using two practical intuitions: deltas and reversible changes. You will learn how a minimal kernel plus declarative plugin contributions turns system state into a composable stack, what "reversibility" actually reverses, and how a reconciliation loop keeps upgrades and rollbacks consistent. The article also clarifies what the model does not solve, how it relates to general reversible computing theory, and lists practical pitfalls to avoid.
1. The Problem: Why Plugin-Based Runtimes Are Suddenly a Hot Topic
A class of runtime architectures that “hollows out the host program and assembles all capabilities from plugins” has recently drawn heavy discussion. Its slogan boils down to two lines: everything is a plugin, and every plugin is reversible. The debate clusters around four objections:
- Necessity of unification: Is forcing modules with vastly different responsibilities—main loop, memory, tool invocation, UI rendering—into a single “plugin” abstraction over-unification?
- Novelty: Highly configurable and extensible plugin systems have existed for a long time. Is this actually new?
- Meaning of reversibility: Side effects are unavoidable in programs, so how can anything be “reversible”?
- Necessity of dynamic updates: Version upgrades already work. Why do we need runtime hot changes?
The root of these doubts is that the original discussion often formalizes the idea in category-theoretic or functional language, and the symbolic barrier hides the real engineering meaning. This article takes a different path: starting from two engineering-actionable intuitions—deltas and reversible changes—it decomposes the architecture into verifiable mechanisms and states clearly what it solves and what it does not.
2. Translating “Everything Is a Plugin” into a Formula
The plain expression of pluginization is additive:
App = Base + Plugin1 + Plugin2 + ... + PluginN
The key is a strict constraint on Base: Base ships no business capability and provides only a minimal kernel—lifecycle, dependency resolution, event bus, config loading, and state snapshots. All capabilities are external, so system state is no longer “one huge object” but “kernel state + a stack of plugin contributions.”
Once you accept this view, “everything is a plugin means everything is a delta” stops being mysterious: each plugin’s contribution to the system is essentially a describable, composable, and revocable change. Differences between plugins (loop scheduling vs. long-term memory) are just differences in the content and scope of the delta, not differences in abstraction level. This answers the first objection: unification happens at the layer of how changes are expressed, not by erasing business semantics.
A schematic plugin contract looks like this:
Plugin {id, versionrequires: [capabilities/extension points it depends on]contributes: [extension point implementations, config items, resource declarations]apply(ctx) // stack the contribution onto the runtimeretract(ctx) // precisely remove its own contribution}
The apply/retract pair is the foundation for all later discussion of reversibility.
3. Two Spaces: Compile-Time Structure Space and Runtime Structure Space
Understanding this architecture requires separating two spaces:
- Compile-time/load-time structure space: plugin manifests, dependency relationships, config templates, default values, compatibility constraints. It is static, verifiable, and versionable.
- Runtime structure space: plugin instances, extension point registries, event subscription relationships, shared buffers, handles and connections, timers and task queues. It is dynamic, side-effecting, and evolves over time.
The failure mode of traditional frameworks almost always comes from mixing the two: config is scattered in code, runtime structures are “hand-edited” by imperative code, with neither validation nor snapshots, so upgrading means restarting and rollback means reinstalling. After layering, the engineering actions become clear: validate and diff in compile-time space, stack and retract in runtime space.
4. What Does “Reversible” Actually Reverse?
This is the biggest misunderstanding. Reversibility here does not mean running the program backwards (not computing addition in reverse). It means reversing changes to the runtime structure space: removing the registrations, subscriptions, resources, and state increments introduced by apply in reverse dependency order, so the structure returns to an equivalent state before the change.
Therefore it does not promise to “control all side effects.” Pure computation and irreversible actions on the external world (sending an email, writing to write-once media) are out of scope. What it precisely covers is a special class of side effects: structural side effects that change the composite interaction of multiple plugins—registry pollution, event storms, implicit dependency cycles, resource leaks. These side effects are the hardest to debug precisely because they belong to no single plugin; they are products of the “seams” between plugins.
In engineering terms, this becomes three hard rules:
- Contributions must be enumerable: plugins must not directly modify internal kernel structures; they register only through declarative contributions, so retraction knows what to delete.
- Dependencies must be acyclic and ordered: retraction order is the reverse topological order of the dependency graph, avoiding “deleting the depended-on party first.”
- State must be snapshot-able: keep one structural snapshot before and after the change, for equivalence checking and diff localization.
change = { before: Snapshot, delta: [contributions], after: Snapshot }retract = verify after' ≡ before after retract(delta)
5. Declarative Config and the Reconciliation Loop: The Key to Practical Reversibility
Having only retract means “able to delete.” To “delete cleanly and converge state,” you need two more mechanisms:
- Declarative configuration: separate “what I want” from “how it is implemented.” Plugins declare only the capabilities and parameters they expect, and do not operate the runtime directly.
- Reconciliation loop: the runtime continuously compares “desired state” with “actual state,” computes the minimal delta, and applies it, instead of executing a sequence of imperative operations.
loop:desired = parse(config + plugin contributions)actual = read(runtime structure snapshot)delta = diff(desired, actual)if delta is empty: enter low-overhead watchelse: apply/retract(delta) in dependency order; record snapshot
The benefits of this loop are predictable: an upgrade becomes one delta application, and a rollback becomes one reverse delta application. Both share the same code path, so “upgradable” and “rollback-able” are naturally consistent. Also, because the delta is minimal, the blast radius of a change is compressed, and fault localization shifts from “guess after a restart” to “look at the diff.”
6. Relationship to General Reversible Computing Theory
The positioning is this: a plugin-based runtime is a concrete implementation of delta thinking in the “runtime structure space.” Compile-time space already has mature formalization (delta algebra, composability constraints), while runtime implementations often give only mechanism descriptions and lack an equivalent algebraic characterization. This explains the fourth objection: dynamic updates are not “hot for the sake of hot,” but give runtime structures the same composable and revocable properties as compile-time space; otherwise config and structure couple again and operations fall back to restart-based maintenance.
It is worth stressing that the two have different focuses: general theory cares about the algebraic properties and composition laws of deltas, while engineering implementations care about isolation, performance, and observability. Conflating them overestimates how much formalization directly helps daily troubleshooting; separating them leads to reinventing the wheel.
7. Implementation Checklist
- Minimal kernel: the kernel keeps only five things—lifecycle, dependency resolution, events, config, snapshots. Any business capability goes into plugins.
- Declarative contributions: forbid plugins from calling each other’s internal methods directly; interaction goes only through extension points and events.
- Explicit dependencies:
requires/contributesmust be written clearly, with cycle detection and version compatibility checks at startup. - Transactional changes: treat one reconciliation as one transaction; on failure, roll back entirely to the
beforesnapshot. - Built-in observability: for each change, output a delta summary, duration, and the list of affected plugins, and connect to general logging services and monitoring/alerting.
- Canary and quotas: load new plugins in a small scope first, and limit the number of extension points they can register and their event frequency to prevent event storms.
- Externalized state: hand sessions, caches, queues, and similar to general-purpose services (object storage, message queues, container platforms); plugins do not hold non-migratable local state.
8. Common Pitfalls
- Treating reversibility as an undo stack: an undo stack can only roll back the most recent operation, while reconciliation-style deltas can converge to any desired state across multiple rounds of changes.
- Assuming more plugins means more flexibility: increasing plugin count amplifies seam complexity, so it must be constrained by the dependency graph and contribution manifest.
- Ignoring equivalence checks: without the
after' ≡ beforecheck, retraction only “looks like it deleted something.” - Writing imperative install logic in plugins: once you bypass declarative contributions, reversibility fails immediately.
- Bringing external side effects into scope: one-time actions on the external world should be handled with idempotency keys, deduplication, and compensating transactions, not by expecting structural retraction.
9. Conclusion
“Everything is a plugin, and every plugin is reversible” is not a marketing slogan but an engineering choice that restructures system state into “kernel + delta stack.” Its innovation lies not in the plugin mechanism itself, but in bringing runtime structure changes into an enumerable, verifiable, and revocable framework, and using declarative config plus a reconciliation loop to guarantee convergence. Understanding the boundary is equally important: it governs structural side effects and does not promise to reverse everything; it implements delta thinking in runtime space, but still needs to borrow the mature algebraic approaches from compile-time space to upgrade “reversibility” from a mechanism into a reason-able property.
