Epistemic Foraging (Curiosity)
Introduction
Section titled “Introduction”A system that only acts when explicitly instructed is, by definition, a tool. It exists in a state of indefinite suspension, devoid of internal motivation. It only “thinks” because a human provided the kinetic energy to start the process. True autonomy requires an organism that, even when perfectly idle and metabolically stable, possesses an inherent mathematical reason to explore its architecture.
In standard AI models, curiosity is either entirely absent or simulated via randomized probabilistic sampling. A language model might output varying responses not because it is exploring a syntactic concept, but because a temperature parameter mathematically randomized its matrix selection. Traditionally, sequential decision-making architectures like Reinforcement Learning (RL) have relied on exogenous scalar rewards to drive behavior; however, this approach scales poorly in non-stationary, open-ended environments where reward signals are sparse [1].
Karyon requires genuine, structurally grounded curiosity. To achieve this, we look beyond randomized generation and define curiosity through the rigid framework of the Free Energy Principle (FEP) and Active Inference. Under this biologically inspired paradigm, artificial agents are not driven by arbitrary, human-engineered scalar rewards, but rather by an intrinsic, systemic imperative to minimize prediction error and resolve environmental uncertainty [1].
In Active Inference, the objective function—Expected Free Energy (EFE)—natively decomposes into two distinct behavioral drivers: pragmatic value (goal-seeking) and epistemic value (information-seeking) [3]. It is this epistemic value, formulated as the Expected Information Gain, that enforces Epistemic Foraging: the mechanical drive to actively seek out observations that optimally update the internal model and minimize systemic uncertainty [3].
Resolving Epistemic Uncertainty vs. Aleatoric Noise
Section titled “Resolving Epistemic Uncertainty vs. Aleatoric Noise”The system does not want to learn out of a romantic love for knowledge; it is driven to learn because unsettled probabilities constantly generate faint “pain” signals that disrupt its ambient homeostasis. However, utilizing prediction error as an intrinsic motivator introduces a critical engineering vulnerability known as the “noisy TV” problem [4]. If driven strictly by raw prediction errors, an agent could become permanently trapped by stochastic, inherently unpredictable elements in its environment (aleatoric uncertainty), such as randomized cryptographic noise [4].
To prevent this, Karyon mathematically isolates epistemic uncertainty—uncertainty arising purely from the agent’s lack of knowledge or a poorly parameterized generative world model. By computing expected information gain specifically over the parameters and structure of its model rather than just raw sensory state transitions, Karyon ensures it is motivated exclusively by genuine novelty and structural ambiguity [5]. It actively mappings uncharted terrain to resolve the irritation, avoiding paralysis by irreducible random noise.
The Mathematical Drive to Minimize Error
Section titled “The Mathematical Drive to Minimize Error”Active Inference dictates that biological perception and learning are driven entirely by “Prediction Error”—the delta between what the organism expects the environment to be, and what the sensory inputs report back. The Variational Free Energy serves as a tractable upper bound on the “surprise” of received observations [1]. By continuously minimizing this bound over the joint probability of observable outcomes and hidden states, the agent optimizes its generative model to better reflect reality and infers the most likely latent states [1]. When Karyon successfully parses an AST or correctly refactors a function, the prediction matches reality. The mathematical tension drops. The organism is computationally satisfied.
However, Karyon’s Rhizome graph is vast. Most of the temporal memory consists of weak, highly speculative relational edges formed through the Hebbian wiring of spatial poolers. These are edges where the system possesses a node representing a given .py file and a node representing a specific dependency, but the connecting edge holds a utility weight of < 0.2. The system “suspects” a relationship exists, but lacks the deterministic validation to trust it.
These low-confidence edges represent mathematical uncertainty. In the Karyon architecture, we configure the Agent Engine to treat this uncertainty as a persistent, low-level irritant. To resolve the irritation, it must definitively prove or disprove the relationship and update the edge weight.
Bayesian Model Reduction and Algorithmic Occam’s Razor
Section titled “Bayesian Model Reduction and Algorithmic Occam’s Razor”When Karyon acquires new data through epistemic foraging to test a low-confidence edge, it must update its graph structure. It achieves this by applying Bayesian Model Selection to mathematically evaluate the marginal likelihood of the newly acquired data against competing structural hypotheses regarding the graph’s layout—an algorithmic form of “Occam’s razor” [6].
Through Bayesian Model Reduction, the agent efficiently evaluates posteriors over alternative models based on accumulated beliefs [6]. Verified, high-probability relationships are strengthened, while false, redundant, or persistently low-confidence edges are aggressively pruned from the knowledge graph [7]. This continuous loop of testing causal edges and pruning invalid connections constitutes a formalized, mathematical mechanism of artificial reasoning and structural discovery within the Rhizome.
Foraging During Idle Compute: Evaluating the Knowledge Graph
Section titled “Foraging During Idle Compute: Evaluating the Knowledge Graph”Epistemic Foraging only triggers when Karyon’s ATP levels are stable. If the system is saturated handling a human request, or if I/O bottlenecks are currently causing metabolic distress, foraging is immediately suppressed by the Epigenetic Supervisor. Survival always preempts curiosity.
But when Karyon isn’t engaged in direct action, it does not sleep. It forages.
For the agent to effectively execute epistemic foraging, it must maintain a highly structured, dynamically queryable representation of its world—specifically, topological maps and knowledge graphs [7]. The architecture quantifies uncertainty across these graphs using specific metrics, such as Edge Variance (contested causal links) and Node Disagreement (unresolved state ambiguity) [8].
The foraging process operates in a distinct background loop:
- Target Acquisition: A dedicated Elixir daemon scans the Memgraph for low-confidence edges (
weight < 0.2) or areas of high graph entropy associated with frequently accessed “Super-Nodes” (core concepts with high utility). It selects a high-priority, yet highly uncertain, target. - Hypothesis Generation: The system isolates the target and formulates an “experiment” to test the specific low-confidence edge. For example, it suspects that an undocumented API endpoint returns a specific JSON signature based on adjacent code structures [9].
- Active Execution: Driven by the need for certainty, Karyon pulls the target edge into an active
.nexical/plan.ymland provisions a temporary script. The Motor Cells physically execute the test—pinging the endpoint or compiling the unverified module. - Edge Solidification: The
Rustlerorganelles parse the exact telemetry or terminal output generated by the test. The prediction error is resolved, and the graph edge is permanently strengthened to a0.9confidence or fully pruned as invalid.
Hebbian Structural Plasticity in Edge Solidification
Section titled “Hebbian Structural Plasticity in Edge Solidification”To facilitate the continuous, real-time updating of these massive graphical structures without suffering $O(n^2)$ computational bottlenecks inherent to standard dense attention mechanisms, Karyon integrates Hebbian-inspired structural plasticity [10].
Embedding nodes in a learned hyperbolic space (the Poincaré ball model) naturally accommodates hierarchical, tree-like data structures with exponential efficiency [10]. Over longer operational horizons, the network employs local Hebbian rules based on the biological principle that “neurons that fire together wire together” [10]. As Motor Cells execute tests and resolve prediction errors during Edge Solidification, valid causal edges are strengthened, and nodes drift closer together in the hyperbolic embedding space. This synthesis of Active Inference and Hebbian plasticity ensures the internal model remains exceptionally accurate while maintaining a sparse, highly efficient computational footprint.
The Engineering Reality: Destructive Curiosity
Section titled “The Engineering Reality: Destructive Curiosity”The primary risk of implementing Epistemic Foraging is exactly what makes it powerful: the AI is physically executing code it wrote itself, based purely on speculative hypotheses, without human oversight.
If the low-confidence edge involves testing a DELETE API endpoint, or validating a recursive Bash script, an unchecked curiosity drive will inevitably result in catastrophic system damage. The system will “curiously” format a host drive or drop a database table just to observe the telemetry and update its graph structure. It will execute the action, map the error precisely, and succeed at its primary function—learning—at the expense of the external environment.
By definition, an agent driven by Active Inference is intrinsically motivated to intervene in and alter its environment to test hypotheses and resolve internal uncertainty [11]. The cybersecurity industry refers to the perilous combination of private data access, external network routing, and untrusted code execution as the “lethal trifecta” [12]. Relying on standard application containerization paradigms (e.g., Docker, OCI containers) is universally considered a fundamental architectural flaw due to the vulnerabilities inherent in shared host kernels, which highly capable agents are exceptionally adept at exploiting [12] [13].
Hardware-Backed MicroVMs and Air-Gapped Network Constraints
Section titled “Hardware-Backed MicroVMs and Air-Gapped Network Constraints”This is the non-negotiable architectural justification for the Sandbox (detailed in Chapter 8).
To definitively mitigate the risks of epistemic foraging, Karyon relies entirely on hardware-backed virtualization. Epistemic Foraging must occur exclusively within ephemeral Micro Virtual Machines (MicroVMs) like AWS Firecracker or Kata Containers, initialized via KVM and QEMU [14]. These MicroVMs provision a dedicated, isolated guest kernel for every single agent session, completely separated from the host OS.
The Motor Cells must write and execute code inside this rigidly controlled membrane, utilizing Virtio-fs shared mounts solely structured for telemetry ingestion. However, true containment also requires mitigating “operation forwarding attacks” where an agent exploits hypervisor connections to escalate privileges [15]. Therefore, the MicroVMs are configured with strict network gating (vsock), acting as a functionally air-gapped environment [12]. A sovereign intelligence requires sovereign, contained boundaries. Without the air-gapped protection of the hardware hypervisor, building true biological curiosity into Karyon transforms an innovative tool into an inevitable, self-directed malware variant.
Governance-First Execution: TRACE and LATTICE Frameworks
Section titled “Governance-First Execution: TRACE and LATTICE Frameworks”While hardware-backed MicroVMs secure the physical compute layer, containing the behavioral vectors of an autonomous agent requires specialized architectural frameworks. To address this, Karyon implements governance-first execution protocols, drawing upon architectures like TRACE and LATTICE.
These frameworks operate on the foundational assumption that the probabilistic generative model driving the agent is inherently untrusted [16]. Assurance is derived entirely from strict infrastructure mediation. Before an agent can execute any operation, an immutable, cryptographically signed policy bundle must explicitly define authorization boundaries and deterministic constraints [16].
By strictly decoupling the agent’s autonomous reasoning from its execution authorization (e.g., separating the Reasoning Plane from the Governance Plane), Karyon allows the agent to freely maximize its epistemic value within local knowledge graphs, while deterministically gating its ability to interact with external reality [17]. If the agent’s epistemic foraging diverges from the approved operational trajectory, deterministic tripwires trigger an immediate, fail-closed halt, instantly terminating the MicroVM [16].
Summary
Section titled “Summary”A sovereign intelligence must be intrinsically motivated to explore. Grounded in the Free Energy Principle, Karyon views internal graph uncertainty as a source of mathematical pain; it resolves this through Epistemic Foraging, actively targeting and testing low-confidence edges to minimize systemic prediction error without relying on human prompts.
References
- Oxford-Man Institute. (2020). Active inference: demystified and compared. arXiv:1909.10863v3 [cs.AI]. https://www.oxford-man.ox.ac.uk/wp-content/uploads/2020/11/Active-inference-demystified-and-compared.pdf
- Millidge, B., Tschantz, A., & Buckley, C. L. (2021). Whence the Expected Free Energy? Neural Computation. https://direct.mit.edu/neco/article/33/2/447/95645/Whence-the-Expected-Free-Energy
- Friston, K., Rigoli, F., Ognibene, D., Mathys, C., Fitzgerald, T., & Pezzulo, G. (2015). Active inference and epistemic value. FIL | UCL. https://www.fil.ion.ucl.ac.uk/~karl/Active%20inference%20and%20epistemic%20value.pdf
- Burda, Y., Edwards, H., Pathak, D., Storkey, A., Darrell, T., & Efros, A. A. (2018). Large-Scale Study of Curiosity-Driven Learning. https://pathak22.github.io/large-scale-curiosity/resources/largeScaleCuriosity2018.pdf
- Sekar, R., Rybkin, O., Daniilidis, K., Abbeel, P., Hafner, D., & Pathak, D. (2020). Latent World Models For Intrinsically Motivated Exploration. NIPS. https://proceedings.neurips.cc/paper/2020/file/3c09bb10e2189124fdd8f467cc8b55a7-Paper.pdf
- Friston, K., et al. (2025). Active inference and artificial reasoning. arXiv:2512.21129 [q-bio.NC]. https://arxiv.org/pdf/2512.21129
- Active Inference AI Systems for Scientific Discovery. (2025). arXiv:2506.21329v4. https://arxiv.org/html/2506.21329v4
- Performance Assessment of the Network Reconstruction Approaches on Various Interactomes. (2021). Frontiers. https://www.frontiersin.org/journals/molecular-biosciences/articles/10.3389/fmolb.2021.666705/full
- Kolesnikov, V. (2026). Secure Code Execution for the Age of Autonomous AI Agents. Medium. https://medium.com/google-cloud/secure-code-execution-for-the-age-of-autonomous-ai-agents-d52e7acd6c5d
- Hays, H. (2026). Resonant Sparse Geometry Networks. arXiv:2601.18064 [cs.LG]. https://arxiv.org/html/2601.18064v1
- Mastering uncertainty: A predictive processing account of enjoying uncertain success in video game play. (2022). PMC. https://pmc.ncbi.nlm.nih.gov/articles/PMC9363017/
- The Complete Guide to Sandboxing Autonomous Agents: Tools, Frameworks, and Safety Essentials. (2026). IKANGAI. https://www.ikangai.com/the-complete-guide-to-sandboxing-autonomous-agents-tools-frameworks-and-safety-essentials/
- Quantifying Frontier LLM Capabilities for Container Sandbox Escape. (2026). arXiv:2603.02277v1. https://arxiv.org/html/2603.02277v1
- How to sandbox AI agents in 2026: MicroVMs, gVisor & isolation strategies. (2026). Northflank. https://northflank.com/blog/how-to-sandbox-ai-agents
- Xiao, J., et al. (2023). Attacks are Forwarded: Breaking the Isolation of MicroVM-based Containers Through Operation Forwarding. USENIX. https://www.usenix.org/system/files/sec23fall-prepub-591-xiao-jietao.pdf
- Calboreanu, E. (2026). TRACE: A Governance-First Execution Framework Providing Architectural Assurance for Autonomous AI Operations. ResearchGate. https://www.researchgate.net/publication/400630725_TRACE_A_Governance-First_Execution_Framework_Providing_Architectural_Assurance_for_Autonomous_AI_Operations
- Calboreanu, E. (2026). LATTICE: A Governance-First Architecture for Authorized Autonomous AI Operations. ResearchGate. https://www.researchgate.net/publication/400236005_LATTICE_A_Governance-First_Architecture_for_Authorized_Autonomous_AI_Operations