arXiv(opens in a new tab)cs.PLAug 2026Cited by 7 papers on PaperVantage

Manuscript Offprint

arXiv:2608.25512

A Programming Paradigm for Spatiotemporal Composability

Yifan Shi, Wei Zhang, Tianyi Cui

Abstract

Modern software—from plugin systems to self-evolving agent harnesses—increasingly requires dynamic composition, yet its formal foundations remain underdeveloped. We identify two orthogonal dimensions of the problem: temporal composability, the ability to completely revert a component's side effects upon removal, and spatial composability, the ability to declare and reactively manage inter-component dependencies. We address the two dimensions by lifting classical effect and coefficient concepts to runtime mechanisms. In particular, we formalize revertible effects, in which every context transformation carries an inverse that the runtime holds, establishing temporal composability local to one component. We formalize reactive coefficients, in which every context change is classified against a component's coefficient specification to drive its activation and deactivation, establishing spatial composability local to one component. We then unify the effect context and the coefficient context into a single context type and mediate every effect and coefficient through it, yielding a discipline we call the context paradigm; the mediation induces an observational equivalence up to which the effects of distinct components interleave without disturbing one another. Combining these mechanisms into the notion of a component, we give a calculus of dynamic composition whose metatheory carries spatiotemporal composability from a single component to a whole system of interleaved components. We implement these ideas in Cordis, a meta-framework of spatiotemporal composability that provides a core library with effect tracking and coefficient resolution, as well as a declarative component loader with configuration reconciliation and hot module replacement.

Contents

  1. Introduction ..... 4
    1.1. Dimensions of Composability ..... 4
    1.2. Motivating Examples ..... 4
    1.2.1. Plugin Systems ..... 4
    1.2.2. Self-Evolving Agent Harnesses ..... 5
    1.2.3. The Coarse-Grained Workaround ..... 5
    1.3. Contributions ..... 6

  2. Preliminaries ..... 7
    2.1. Effects ..... 7
    2.2. Coefficients ..... 7
    2.3. Relationship to Dynamic Composability ..... 8

  3. Revertible Effects and Reactive Coefficients ..... 9
    3.1. Revertible Effects ..... 9
    3.1.1. Effect Context ..... 9
    3.1.2. Effect Functions ..... 12
    3.1.3. Effect Iterators ..... 15
    3.2. Reactive Coefficients ..... 16
    3.2.1. Coeffec Context ..... 17
    3.2.2. Specification and Notification ..... 18
    3.2.3. Isolation and Interception ..... 19
    3.3. The Context Paradigm ..... 21
    3.3.1. Unified Context ..... 21
    3.3.2. Observational Equivalence ..... 23
    3.4. Attaining Independence ..... 26
    3.4.1. Effect Independence ..... 26
    3.4.2. Coeffec Commutativity ..... 28

  4. A Calculus of Dynamic Composition ..... 31
    4.1. Components and Fibers ..... 31
    4.2. The Calculus ..... 34
    4.2.1. Orchestration ..... 34
    4.2.2. Lifecycle ..... 35
    4.2.3. Confinement ..... 38
    4.3. Metatheory ..... 39

4.3.1. Preservation ..... 43
4.3.2. Temporal Composability ..... 44
4.3.3. Spatial Composability ..... 47
4.3.4. Progress ..... 49
4.3.5. Confluence ..... 51
4.4. Extensions ..... 55
5. Implementation and Case Study ..... 57
5.1. Core Library ..... 57
5.1.1. Effect Tracking ..... 59
5.1.2. Coeffect Operations ..... 60
5.1.3. Component Lifecycle ..... 61
5.1.4. Context Access ..... 64
5.2. Component Loader ..... 64
5.2.1. Declarative Configuration ..... 65
5.2.2. Hot Module Replacement ..... 67
5.3. Case Study: Koishi ..... 69
6. Discussion ..... 70
6.1. System Boundary ..... 70
6.2. Service Multiplexing ..... 71
6.3. Access Control and Sandboxing ..... 72
6.4. Language Independence and Selection ..... 73
6.5. Mutual Dependencies and Component Granularity ..... 74
6.6. Dependency Typing and Versioning ..... 75
6.7. Co-Design with Languages and Operating Systems ..... 76
7. Related Work ..... 77
7.1. Effect and Coeffect Systems ..... 77
7.2. Programming Paradigms ..... 78
7.3. Temporal Composability ..... 79
7.4. Spatial Composability ..... 81
8. Conclusion ..... 82
References ..... 83

References (100)

Couldn't load all references. Reload the page to try again.