The New Cordis Paper Behind DeepSeek Harness Explained
DeepSeek Harness has been open‑sourced together with a newly released Cordis paper that lifts the effect‑coeffect concepts to runtime, defines spatiotemporal composability, details a TypeScript implementation, and validates the approach with the Koishi chatbot framework.
Core Idea: Spatiotemporal Composability
Effect (how a program modifies its environment) and coeffect (what a program needs from its environment) are lifted from compile‑time analysis to a runtime mechanism, forming a full theory and engineering implementation for dynamic composition.
Time Dimension: Revertible Effect
Effect is modeled as Γ->Γ × (Γ->Γ), returning the modified context together with an explicit inverse. The runtime tracks these inverses and automatically composes them using the twisted composition monoid 𝔗Γ. When a component is unloaded, the inverse is applied, restoring the environment without a full restart.
Space Dimension: Reactive Coeffect
Components declare required dependencies as a specification. Whenever the surrounding context changes, the runtime notifies components and classifies them as activating , deactivating , or neutral . Missing dependencies cause the component to become silently inactive without errors, and switching a provider (e.g., a storage backend) only re‑activates consumers whose dependencies actually changed.
Unifying Effect and Coeffect
Effect and coeffect contexts are merged into a single context type. An observation equivalence on coeffects gives effects independence, and together they form a new programming paradigm. The dynamic‑composition calculus defines operations L-Begin, L-Iter, L-Finish, L-Divert, L-Leave, L-Unload, and L-Raise. A meta‑theorem proves that spatiotemporal composability scales from a single component to an interleaved system of components.
Cordis Implementation
Cordis is a TypeScript meta‑framework that provides generic dynamic‑composition semantics without assuming any specific domain.
Core Library Three‑Layer Architecture
(1) Effect Tracking
All context changes are executed through ctx.effect(callback). The callback returns a dispose function that serves as the inverse. Parent contexts prepend child disposes into an accumulator, forming a recursive ∂²Γ structure.
(2) Coeffect Operations
Coeffects are stored in three Symbol‑keyed slots: @@store: value storage ( σ) @@isolate: isolation domain table ( ρ) @@intercept: interception metadata ( ι)
Operations ctx.get and ctx.set manipulate these slots. ctx.set is implemented via ctx.effect and triggers notify on installation and removal of bindings.
(3) Component Lifecycle ctx.use(component, config) instantiates a Fiber. The returned dispose cascades to unload child Fibers.
Algorithms
Algorithm 1 – Effect Tracking drives the effect iterator, wrapping disposal and parent composition logic.
Algorithm 2 – Coeffect Set implements ctx.set via ctx.effect, invoking notify for binding changes.
Algorithm 3 – Notify traverses all Fibers, checks whether inject is affected, and calls refresh.
Algorithm 4 – Use creates a Fiber; its inverse forces child Fibers to bottom (⊥) and triggers unload.
Algorithm 5 – Refresh / Reload / Unload forms an inertial state machine; reload commits the view and executes effects, while unload waits for dependents to empty before disposing.
Declarative Component Loader
A declarative configuration layer maps each entry in the configuration tree to a Fiber. Incremental reconciliation handles changes instead of full reconstruction, minimizing disruption.
Hot Module Replacement (HMR)
HMR uses the reversible effect pattern: the old Fiber’s dispose undoes all prior effects, and the new Fiber installs from the reloaded module. If any module fails to load, a transactional rollback restores the cache and Fiber state.
Case Study: Koishi Chatbot Framework
Koishi, an open‑source chatbot built on Cordis, hosts over 4 000 community plugins, providing the largest production‑scale validation of the framework.
Zero‑cognitive‑burden time composability: plugin authors need not write uninstall paths; the ctx -driven effect automatically provides ordered cleanup.
Open‑ecosystem space composability: adapters, database drivers, and functional plugins declare dependencies via coeffect; the runtime automatically maintains composition consistency, re‑activating only downstream plugins whose dependencies changed.
Paper repository: https://github.com/cordiverse/paper
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
