Portable Context Bundle¶
Core Idea¶
A portable context bundle is a unit of behaviour — function, rule, model, agreement — that carries the context it was defined in, so that when later invoked elsewhere it resolves its free references against its definition-time environment rather than the ambient one at the call site. The essential commitment is that context-of-definition can outlive context-of-use, and the diagnostic question — which environment does this invocation resolve against? — is the same across substrates.
How would you explain it like I'm…
Grandma's Recipe Card
Carries Its Old World
Definition-Time Binding
Broad Use¶
- Programming closures: a function literal captures its lexical environment at construction and runs with that, not the caller's.
- Legal precedent: a ruling carries the doctrinal context of the deciding court, applied against that baseline.
- Trained ML models: weights encode the training distribution; deployment elsewhere is the predicted distribution-shift failure.
- Configured instances: defaults baked at instantiation carry into every later use.
- Sealed contracts: merger clauses fix the surrounding context at signing, read against that captured environment.
- Institutional memory: a retiring expert applies the procedures current when their mental model formed.
- Configuration snapshots: container images and frozen requirements files capture an explicit environment so runtime cannot change behaviour.
Clarity¶
Sharpens the blurred question "which context applies?" by separating definition-time from invocation-time context and naming the binding rule as the structural choice — explaining why a closure sees its own scope, an old precedent reads strangely today, and a model degrades on deployment.
Manages Complexity¶
Factors "how does this unit interact with its context?" into separable parts (behaviour-unit, captured context, ambient context, binding rule) and collapses "why is this behaving wrong?" into "captured and ambient have diverged — which repair restores fit?", with a fixed three-part catalogue: re-capture, re-bind, or sandbox.
Abstract Reasoning¶
Yields the non-obvious inference that distribution shift, anachronistic precedent, and stale expert advice are one failure mode — drift between captured and ambient — so recognizing the shared structure imports the repair catalogue across substrates, while the opposite (ambient) binding remains legitimate.
Knowledge Transfer¶
- Programming → law: a closure-literate reasoner recognizes stare decisis as "the precedent travels with its doctrinal scope."
- ML → operations: distribution-shift reasoning recognizes the container snapshot as a deliberate use of capture.
- Law → programming: merger clauses recognize the closure pattern; re-capture/re-bind/sandbox port everywhere.
Example¶
A function makeAdder(5) returns x => x + n, capturing n = 5 from its definition-time scope; called later where a different n exists, lexical binding still resolves against the captured 5, yielding 15 — and the loop-capture bug, where closures share one mutable cell, is captured/ambient drift.
Relationships to Other Primes¶
Foundational — no parent edges in the catalog.
Children (1) — more specific cases that build on this
- Closure is a kind of Portable Context Bundle — The file states it directly: "the lexical closure is the purest INSTANCE of this prime, not its scope. The portable context bundle is the substrate-independent pattern of which closures, precedents, trained models, and sealed contracts are all realizations." Direction verified: the bundle is the general definition-time-context-capture pattern; closure (canonical slug) is its programming-language instantiation. NOT a reparent to role (the 0.853 nearest — slot-position vs captured-context, explicitly severed). Distinct from locality_of_reference/exaptation/provenance per the file.
Not to Be Confused With¶
- Portable Context Bundle is not a Closure alone because the closure is its purest instance, whereas the bundle is the substrate-independent pattern covering precedents, trained models, and sealed contracts too.
- Portable Context Bundle is not a Role because it is a behaviour-unit carrying a frozen environment, whereas a role is a relational slot whose occupant resolves against the current structure.
- Portable Context Bundle is not Provenance because it is the operational mechanism resolving behaviour against an origin environment at runtime, whereas provenance documents where something came from.