Skip to content

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

Imagine your grandma gives you a recipe card she wrote long ago, and it says 'add a cup of our flour.' When you use it today in a different kitchen, 'our flour' still means the flour from grandma's kitchen back then, not whatever flour is around you now. A Portable Context Bundle is something that carries its old surroundings with it, so it keeps meaning what it meant when it was made, even somewhere new.

Carries Its Old World

A Portable Context Bundle is a piece of behavior (like a rule, recipe, or agreement) that carries with it the situation it was made in, so when you use it later somewhere else, it acts based on its 'made-in' setting instead of your current one. It has blanks that need filling in when you use it, and the big question is: do those blanks get filled from where it was created, or from where it's being used now? Because it remembers its original setting, you can carry it far away and use it many times, and it still behaves by its old rules. But there's a danger: if the old setting and the new setting drift too far apart, the bundle gives answers that fit the past but not the present, like advice that's gone stale.

Definition-Time Binding

A Portable Context Bundle is a unit of behaviour (a function, rule, template, agreement, or model) that carries with it the context it was defined in, so that when it is later invoked in a different context it operates by reference to its definition-time environment rather than the ambient environment of the call site. The essential commitment is that context-of-definition can outlive context-of-use, and the diagnostic question is the same across substrates: which environment does this invocation resolve free references against? It has recurring roles: a behaviour-unit with free references to resolve; a definition-time context captured when the unit was made (a lexical scope, a training distribution, a doctrinal baseline, contract recitals); an invocation-time context (the ambient environment when later applied); and a binding rule choosing whether free references resolve against the captured or the ambient context. Because it is portable, it can move far from its definition site while keeping its captured environment. Its characteristic failure is drift: when captured and ambient diverge enough, the unit produces outputs that fit the captured context but not the ambient one, such as distribution shift, anachronistic precedent, or stale expert advice. The structural insight is that captured-versus-ambient binding is a choice with predictable consequences, not an accident of one substrate.

 

A portable context bundle is a unit of behaviour (a function, rule, template, agreement, or model) that carries with it the context it was defined in, so that when it is later invoked or interpreted in a different context, it operates by reference to its definition-time environment rather than the ambient environment of 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 free references against?) is the same across substrates. The bundle composes naturally with later-context dynamics: definition-time context can be captured at creation, frozen for the life of the bundle, and applied repeatedly at different call sites even when the ambient context differs. The arrangement has a small set of recurring roles. A behaviour-unit has free references that must be resolved at invocation. A definition-time context is the environment captured when the unit was created, such as a lexical scope, a training distribution, a doctrinal baseline, or contract recitals. An invocation-time context is the ambient environment when the unit is later applied. A binding rule makes the structural choice of whether free references resolve against the captured or the ambient context. The bundle is portable across context boundaries: it can be moved from definition site to distant invocation sites while retaining its captured environment. And it carries a characteristic drift failure mode: when captured and ambient diverge sufficiently, the unit produces outputs that fit the captured context but not the ambient one, such as distribution shift, anachronistic precedent, or stale expert advice. The distinctive structural insight is that captured-versus-ambient binding is a choice with predictable consequences, not an incidental property of any one substrate.

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

One-hop neighborhood: parents above, mutual partners to the right, children below.PortableContext Bundlesubsumption: ClosureClosure

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.