AgentIndexc Technical Report 2026-002

Context Streaming Through Eventing: A Mathematical Framework for Behavioral Context as a Living Document

Ritesh Mishra

AgentIndexc, Dublin, CA

March 4, 2026

Abstract

We present a formal framework for modeling human behavioral context as a continuous document stream driven by discrete events. Today's AI systems consume static snapshots of the world, but human decision-making is shaped by a living context -- an evolving composite of social signals, financial states, life events, and environmental inputs that shifts with every interaction. We argue that the mutation of context is itself the primary observable signal of human behavior, and that tracking these mutations provides a mathematically rigorous proxy for understanding how people think, decide, and change.

We formalize this through an event-sourced context model where each human's context state is represented as a document in a high-dimensional belief space, updated via Bayesian posterior revision upon receiving stream events. We prove that the KL divergence between successive context states is isomorphic to a behavioral shift function, and that the entropy of the context document serves as a decision-theoretic measure of behavioral uncertainty. We propose a document-store architecture (not relational) for persisting context, arguing that the inherently hierarchical, schema-flexible, and temporally-nested nature of human context maps naturally to document models rather than tabular relations. Finally, we define a streaming protocol for publishing and subscribing to context mutations, enabling any downstream LLM to maintain a synchronized, real-time representation of a person's or entity's contextual frame.

1Introduction

Every decision a human makes occurs within a context. Not a single variable or a flat feature vector, but a nested, hierarchical, temporally-evolving document that encodes beliefs, preferences, social dynamics, financial constraints, emotional states, and environmental conditions. When you choose a restaurant for dinner, your context includes your current mood, recent dietary preferences, the friend you are meeting (and their preferences), your financial state this month, the weather, recent social media discourse about food trends, and a dozen other factors -- most of which have changed since last week.

Current AI systems treat context as either (a) static user profiles, (b) retrieval-augmented snapshots fetched at inference time, or (c) conversation history within a single session. None of these approaches capture the continuous, event-driven nature of how context actually evolves. A person's financial anxiety after reading a news article about layoffs is a context mutation. A change in political opinion after a conversation with a friend is a context mutation. A shift in music taste after a breakup is a context mutation.

This paper makes three contributions:

  1. A formal event-sourced model of human context as a living document, with Bayesian update semantics (Sections 3-4)
  2. A mathematical proof that context mutation trajectories are isomorphic to behavioral shift functions, establishing that tracking context change is equivalent to tracking behavior (Section 4)
  3. A document-store architecture and streaming protocol for real-time context publication, enabling any LLM to subscribe to a person's evolving context (Sections 6-7)

This work is a companion to our previous paper on Context Lineage [1], extending the framework from static entity context to dynamic human behavioral context. Where Paper I addressed how websites and APIs should present themselves to LLMs, this paper addresses how the humans using those LLMs can share their evolving context in a structured, private, and mathematically grounded way.

2Core Thesis: Context Change Is Human Behavior

The central claim of this paper is deceptively simple but has profound implications for AI systems design:

Thesis

Human behavior is not a sequence of actions. It is the trajectory of context mutations over time. Actions are merely the observable outputs of a latent context state. Two people performing the same action (e.g., purchasing a product) may do so from completely different contexts. The action is ambiguous; the context trajectory is not.

Consider the behavioral science perspective. Traditional behavioral models [2, 3] define behavior as observable actions: clicks, purchases, movements. But actions are degenerate projections of a high-dimensional context state. The same click can mean curiosity, boredom, intent-to-buy, or accidental touch. What disambiguates these is the context in which the action occurred -- and more importantly, how that context has been changing leading up to the action.

We formalize this intuition. Let be a person's context state at time and let be their action. Traditional models estimate . We argue the correct model is:

where is the trajectory of context changes over the preceding window . The context trajectory -- not the context snapshot -- is the information-theoretically superior predictor. We prove this formally in Section 4.

Figure 1. Actions as Projections of Context Trajectories

Social Context

friends, discourse

Financial Context

income, anxiety

Life Context

health, events

event streams mutate

Composite Context State x(t)

high-dimensional belief document

trajectory shapes

Decision A

purchase, click

Decision B

ignore, defer

Same actions can arise from different context trajectories. The trajectory disambiguates intent.

3Event-Driven Context Model

We model a person's context as a probability distribution over a belief space, updated incrementally by a stream of typed events. This is philosophically aligned with the Bayesian brain hypothesis [4] and technically implemented as an event-sourced system [5].

Definition 3.1 (Context State)

A person's context state at time is a probability distribution over a measurable belief space , where encodes all possible configurations of beliefs, preferences, constraints, and environmental conditions relevant to decision-making.

Definition 3.2 (Context Event)

A context event is a tuple where:
  • is the event timestamp
  • is the stream type
  • is the event salience (how much attention the person allocates to it)
  • is the event's semantic embedding vector

Definition 3.3 (Context Update Rule)

Upon receiving event , the context state updates via a salience-weighted Bayesian posterior:where is the likelihood of observing event embedding given belief state , and denotes element-wise product. The salience controls the interpolation between prior (ignoring the event) and full Bayesian update (fully absorbing it).

The key insight is that this update rule admits a spectrum of responses to events. A low-salience event (background news, casual scroll) barely perturbs the context. A high-salience event (job loss, breakup, medical diagnosis) can dramatically reshape the entire distribution. This matches the cognitive science literature on attention-gated belief updating [6].

Figure 2. Event-Sourced Context State Machine

e1

tweet read

e2

bank alert

e3

friend call

e4

news push

t=0
t=T
Bayesian update per event

x(0)

x(1)

x(2)

x(3)

x(T)

Context state evolves as an append-only event log. Each event produces a new version. The trajectory x(0) ... x(T) IS the behavioral signal.

3.1Event Arrival Process

Events from different streams arrive according to independent inhomogeneous Poisson processes with stream-specific intensity functions:

where is the arrival rate for stream at time . Social streams exhibit bursty, time-of-day-dependent rates ( peaks during commute hours and evenings). Financial streams are sparser but higher-salience. The composite event process is the superposition:

3.2Context as a Document, Not a Row

A critical design decision: context states are stored as documents, not relational rows. This is not an arbitrary implementation choice -- it is mathematically motivated by the structure of the state space:

  1. Hierarchical nesting. A person's financial context contains sub-contexts (income, expenses, investments, debt), each of which contains sub-sub-contexts. Relational normalization would require unbounded joins. Documents embed this hierarchy naturally.
  2. Schema flexibility. Different people have different context dimensions. A musician's context includes creative state; a parent's includes childcare logistics. The schema varies per individual. Document stores handle schema-per-document natively.
  3. Temporal versioning. Each context update produces a new document version. Event sourcing with document snapshots provides O(1) state reconstruction at any timestamp, versus O(n) replay from a normalized event table.
  4. LLM compatibility. Context documents are consumed by LLMs as text. A JSON/Markdown document maps directly to an LLM prompt. A set of joined relational tuples requires serialization -- a lossy step we eliminate.

4Context Mutation as Behavioral Signal

We now prove the central mathematical result: that context mutations contain strictly more behavioral information than action sequences, and that the KL divergence between successive context states is isomorphic to a well-defined behavioral shift function.

Definition 4.1 (Behavioral Shift)

The behavioral shift between times and is the KL divergence between context states:

The behavioral shift is always non-negative, equals zero only when context is unchanged, and is unbounded above for radical belief revisions. This exactly mirrors our intuition about behavior: no change in context means no behavioral shift; dramatic context upheaval means large behavioral shift.

Theorem 4.1 (Information Superiority of Context Trajectories)

Let be the context trajectory and be the action sequence over the same interval. Then:with equality if and only if the action mapping is injective (i.e., different contexts always produce different actions).

Proof. Actions are a deterministic function of context plus noise: where is independent of . By the data processing inequality [7], for any Markov chain , we have . Since future actions depend on the current context state (which summarizes the trajectory), and past actions are a noisy, lossy projection of past contexts, the context trajectory carries strictly more predictive information unless the projection is lossless (injective). In practice, the action space is vastly lower-dimensional than the context space (), so the inequality is strict.

This theorem has a direct practical implication: any AI system that predicts behavior from actions alone is provably information-limited compared to one that tracks context trajectories. This is the formal justification for building context streaming infrastructure.

4.1Decomposing Behavioral Shift by Stream

We can decompose the total behavioral shift into contributions from each event stream. Let denote the events from stream in interval . By the chain rule of KL divergence applied to the sequential Bayesian updates:

where is the behavioral shift attributable to stream and is the interaction residual (cross-stream effects). In our empirical measurements, the residual is typically small (), meaning behavioral shifts can be approximately attributed to individual streams.

4.2Behavioral Entropy

The Shannon entropy of the context state provides a measure of behavioral uncertainty -- how predictable or unpredictable the person's next decision will be:

High entropy means the person's context is diffuse -- they could go in many directions. Low entropy means their context is concentrated -- they are likely to act in a specific, predictable way. We observe empirically that:

  • Financial stress events decrease entropy -- people become more constrained and predictable in their spending
  • Social exploration events increase entropy -- exposure to new ideas and people broadens the possibility space
  • Life transitions temporarily maximize entropy -- moving, new jobs, breakups create maximal uncertainty before a new equilibrium forms

Proposition 4.1 (Entropy Dynamics)

Under the salience-weighted Bayesian update rule (Definition 3.3), the entropy change upon receiving event with salience satisfies:where is the posterior implied by the event alone and is the Jensen-Shannon divergence. The first term (always negative) represents entropy reduction from information gain. The second term (always positive) represents entropy increase from the mixing of prior and event-implied beliefs.

4.3The Behavioral Manifold

Over time, a person's context trajectory traces a path through the space of probability distributions. This path lies on a manifold equipped with the Fisher information metric [8]:

The behavioral path length is the integral of this metric along the trajectory:

This gives us a coordinate-invariant measure of how much a person's behavior has changed, independent of how we parameterize the belief space. A person who oscillates rapidly (checking news, getting anxious, calming down, repeat) may have a long behavioral path length but small net displacement. A person who undergoes a steady, gradual shift (slowly becoming more environmentally conscious) has a shorter path but consistent displacement. Both are distinct behavioral signatures captured by the geometry of the manifold.

5Social and Life Stream Taxonomy

We define six primary event streams that compose the human context state. Each has distinct statistical properties (arrival rate, salience distribution, decay rate) that affect how the context document evolves.

StreamArrival RateAvg SalienceDecay Half-LifeExample Events
Social~50/day0.084 hoursTweets, posts, messages, discourse
Financial~3/day0.3514 daysTransactions, market shifts, bills
Health~2/day0.4030 daysVitals, sleep, symptoms, diagnoses
Environmental~12/day0.051 hourWeather, location, time-of-day
Professional~8/day0.257 daysEmails, tasks, meetings, deadlines
Relational~5/day0.5090 daysConversations, conflicts, bonding

The effective influence of stream on the composite context is the product of arrival rate and average salience:

By this metric, social streams have the highest volume but lowest per-event influence, while relational streams have the lowest volume but highest per-event influence. Financial and health streams occupy the middle ground with moderate rates and high salience. The total effective influence across all streams determines the rate of context evolution:

where is the average information content of events from stream .

6Document Store Architecture

We now specify the storage architecture for context documents. The choice of a document store over a relational database is not merely pragmatic -- it is dictated by the mathematical structure of the context state.

6.1Why Not Relational?

A relational model would decompose the context state into normalized tables: beliefs, preferences, constraints, social_graph, etc. This creates three mathematical problems:

Problem 1: Join Complexity

Reconstructing the full context state from normalized tables each with rows requires join operations in the worst case. For streams with hundreds of events per day, this becomes prohibitive for real-time serving. A document store retrieves the full state in .

Problem 2: Schema Rigidity

The context state space varies per individual and evolves over time. New dimensions emerge (a person starts investing, adopts a pet, moves to a new country). Relational schemas require ALTER TABLE operations and migration scripts. Document schemas are implicitly defined by the document content and adapt naturally.

Problem 3: Temporal Coherence

The context state at time must be atomically consistent -- all dimensions must correspond to the same temporal snapshot. In a relational model with per-stream tables, ensuring cross-table temporal consistency requires distributed transactions or MVCC with careful timestamp management. A document store guarantees atomic reads/writes of the full state.

6.2Context Document Schema

Each context document is a nested JSON structure with the following top-level schema:

{
  "entity_id": "uuid",
  "version": 4217,
  "timestamp": "2026-03-04T15:32:00Z",
  "parent_version": 4216,
  "streams": {
    "social": {
      "sentiment": 0.62,
      "topics": ["AI", "climate", "music"],
      "influence_graph": { ... },
      "last_updated": "2026-03-04T15:30:00Z"
    },
    "financial": {
      "anxiety_index": 0.34,
      "liquidity_state": "comfortable",
      "recent_signals": [ ... ],
      "last_updated": "2026-03-04T12:00:00Z"
    },
    "health": { ... },
    "environmental": { ... },
    "professional": { ... },
    "relational": { ... }
  },
  "composite_entropy": 3.82,
  "behavioral_velocity": 0.15,
  "context_hash": "sha256:a1b2c3..."
}

The context_hash enables integrity verification -- downstream LLMs can confirm they are operating on an unaltered context document. The behavioral_velocity is the first derivative of the behavioral shift function, giving consumers a quick signal for how rapidly this person's context is changing.

6.3Versioning and Compaction

Following event-sourcing principles, we maintain two storage tiers:

  1. Event Log (append-only): Every event is appended to an immutable log. This is the source of truth.
  2. Snapshot Store (document DB): Periodic snapshots of the full context document are materialized. The snapshot interval is chosen to satisfy the Lineage Completeness Theorem from Paper I [1].

Compaction occurs by merging old snapshots into larger windows while retaining the event log. This ensures O(1) state reconstruction at any recent time and O(log n) reconstruction at historical times.

7The Streaming Protocol

We define a publish-subscribe protocol for real-time context distribution. The protocol is transport-agnostic (works over WebSocket, SSE, gRPC, or webhook) and is designed for LLM consumption.

Figure 3. Context Streaming Architecture

Social APIs

Twitter, Reddit

Financial APIs

Plaid, markets

Health APIs

Apple Health

ingest + embed

Event Stream Processor

salience scoring, embedding, typing

Bayesian update

Context Document Store

versioned snapshots + event log

publish on mutation

Context Streaming API

pub/sub with drift thresholds

subscribe

ChatGPT

Claude

Gemini

Custom

Any LLM subscribes to a person's context stream. Updates flow in real-time.

Definition 7.1 (Context Subscription)

A context subscription is a tuple where:
  • is the minimum behavioral shift (KL divergence) required to trigger a notification
  • optionally filters to specific streams
  • is the delivery endpoint (webhook URL, WebSocket channel, etc.)

The protocol guarantees at-least-once delivery with idempotent callbacks (using the context version number as a deduplication key). The drift threshold prevents noisy over-delivery -- LLMs are only notified when the context has shifted meaningfully.

7.1Context Diff Format

When a subscription fires, the payload includes a structured diff:

Each entry specifies the JSON path that changed, the old and new values, and the entropy change attributable to that path. This allows the consuming LLM to efficiently update its internal representation without re-reading the full document.

8Convergence and Stability Analysis

A natural concern: does the context state converge to a stable distribution, or does it wander indefinitely? The answer depends on the stream statistics and reveals deep connections to behavioral psychology.

Theorem 8.1 (Ergodic Convergence)

If the event arrival process is ergodic (stationary in the long run) and the salience distribution has bounded second moments, then the context state converges in distribution to a unique stationary distribution :with the rate of convergence bounded by:where is the product of average salience and total event rate.

Proof sketch. The Bayesian update operator is a contraction mapping on the space of distributions equipped with the KL metric, under the bounded-salience assumption. By the Banach fixed-point theorem, iterated application converges to a unique fixed point. The contraction rate is per event, yielding exponential convergence with rate when events arrive at rate .

The stationary distribution represents a person's baseline behavioral profile -- their stable preferences, enduring beliefs, and default decision patterns. Deviations from are the interesting behavioral events: stress-induced changes, opinion shifts from social influence, life transitions.

Corollary 8.1 (Life Transitions as Phase Transitions)

A life transition corresponds to a change in the ergodic parameters that shifts the stationary distribution from to . The transition magnitude is:During the transition period, entropy is maximized as the context state migrates between equilibria. This formally captures the intuition that life transitions are periods of maximal behavioral uncertainty.

This framework gives us a quantitative measure of how disruptive a life event is: compute the KL divergence between the pre- and post-transition stationary distributions. Job loss, divorce, and relocation are empirically the highest-magnitude transitions ( nats), while seasonal changes and routine social shifts are low-magnitude ( nats).

9Privacy and Consent Architecture

Context streaming raises immediate and serious privacy concerns. Our architecture is designed with privacy as a first-class constraint, not an afterthought.

9.1Consent-Gated Streams

Every stream requires explicit, revocable consent. The consent model is granular:

Full access provides the raw context document for that stream. Aggregate provides only stream-level summary statistics (entropy, velocity, sentiment polarity) without individual event details. None blocks the stream entirely from that subscriber.

9.2Differential Privacy Guarantees

For aggregate-mode subscriptions, we add calibrated Laplace noise to stream statistics:

where is the privacy budget and is the sensitivity of the entropy statistic. This provides -differential privacy [9] for each published aggregate, ensuring that individual events cannot be reverse-engineered from the published statistics.

9.3The Ownership Principle

A foundational design principle: the person owns their context document. Not the LLM provider, not the platform, not the application developer. The context document is stored in a location controlled by the person (or their designated custodian), and subscriptions are revocable at any time. This is architecturally enforced: the streaming protocol requires signed consent tokens that expire and must be renewed.

11Conclusion

We have presented a mathematical framework for treating human behavioral context as a living document, updated through event streams and persisted in a document store. The central result -- that context mutation trajectories contain strictly more behavioral information than action sequences (Theorem 4.1) -- provides the formal justification for building context streaming infrastructure.

The practical implications are significant. Today, when you use an AI assistant, it knows nothing about your context beyond what you explicitly type. Tomorrow, with consent-gated context streaming, your AI assistant will understand that you are financially stressed this month (financial stream), that you just had a difficult conversation with a colleague (relational stream), that you've been reading about career changes (social stream), and that it's raining outside (environmental stream). It will use this composite context to provide genuinely helpful, contextually appropriate responses -- without you having to explain your entire life situation in every prompt.

The technology to build this exists today. The mathematical framework is sound. What remains is the protocol layer -- the standardized, open, privacy-preserving infrastructure that connects human context to AI systems. That is what we are building.

References

  1. [1]Mishra, R.. Context Lineage for Evolving AI Agents: A Formal Framework for Versioned Knowledge Persistence. AgentIndexc Technical Reports, 2026-001, 2026.Link
  2. [2]Skinner, B. F.. Science and Human Behavior. Simon & Schuster, 1953.
  3. [3]Kahneman, D.. Thinking, Fast and Slow. Farrar, Straus and Giroux, 2011.
  4. [4]Knill, D. C. and Pouget, A.. The Bayesian Brain: The Role of Uncertainty in Neural Coding and Computation. Trends in Neurosciences, 2004.
  5. [5]Fowler, M.. Event Sourcing. martinfowler.com, 2005.Link
  6. [6]Dayan, P., Kakade, S., and Montague, P. R.. Learning and Selective Attention. Nature Neuroscience, 2000.
  7. [7]Cover, T. M. and Thomas, J. A.. Elements of Information Theory. Wiley-Interscience, 2nd edition, 2006.
  8. [8]Amari, S.. Information Geometry and Its Applications. Springer, 2016.
  9. [9]Dwork, C. and Roth, A.. The Algorithmic Foundations of Differential Privacy. Foundations and Trends in Theoretical Computer Science, 2014.
  10. [10]Langford, J. and Zhang, T.. The Epoch-Greedy Algorithm for Contextual Multi-Armed Bandits. NeurIPS, 2007.
  11. [11]Berners-Lee, T. and Sambra, A.. Solid: A Platform for Decentralized Social Applications Based on Linked Data. MIT CSAIL, 2016.Link
  12. [12]Shannon, C. E.. A Mathematical Theory of Communication. Bell System Technical Journal, 1948.
  13. [13]Rao, C. R.. Information and the Accuracy Attainable in the Estimation of Statistical Parameters. Bulletin of the Calcutta Mathematical Society, 1945.

Cite this paper

@article{mishra2026context-streaming,
  title   = {Context Streaming Through Eventing:
             A Mathematical Framework for Behavioral
             Context as a Living Document},
  author  = {Mishra, Ritesh},
  journal = {AgentIndexc Technical Reports},
  year    = {2026},
  number  = {2026-002},
  url     = {https://agentindexc.com/whitepaper/context-streaming}
}