P203 — AIEP — Counterfactual Timeline Engine
Applicant: Neil Grassby Classification: Patent Application — Confidential Priority: Claims priority from GB2519711.2 filed 20 November 2025 Architecture Layer: AIEP AGI Cognition Layer — Phase 2 Dependencies: P200 CWSG, P201 ESR, P202 TEG
Framework Context
[0001] This specification operates within an AIEP environment as defined in GB2519711.2 and GB2519798.9. The present specification extends the Temporal Event Graph (P202) to provide a branching counterfactual simulation capability derived exclusively from evidence-bound world state.
Field of the Invention
[0002] The present invention relates to counterfactual reasoning engines and temporal simulation systems for artificial intelligence architectures.
[0003] More particularly, the invention relates to a system that generates, evaluates, and manages branching counterfactual timelines derived from an evidence-bound Temporal Event Graph, enabling reasoning about hypothetical sequences of events that diverge from the evidence-grounded canonical timeline.
Background
[0004] Counterfactual reasoning — evaluating what would have occurred if a different event had taken place — is a fundamental operation in causal analysis, planning, and predictive reasoning. Existing AI systems implement counterfactual reasoning through parametric model sampling without verifiable binding to world state evidence.
[0005] A counterfactual reasoning system embedded in an evidence-bound architecture must: branch from a precisely defined temporal position in the canonical evidence timeline; apply a specified hypothetical event injection; propagate causal consequences through the world state graph; and maintain full provenance separation between canonical and counterfactual chain elements.
[0006] Without explicit temporal branching and provenance separation, counterfactual outputs may be conflated with evidence-grounded facts, undermining the integrity of the evidence ledger.
Summary of the Invention
[0007] The invention provides a Counterfactual Timeline Engine (CTE) that accepts a branching specification comprising a temporal insertion point within the TEG, a set of hypothetical event injections, and a causal propagation rule set. The CTE generates a counterfactual branch as a separate directed graph rooted at the insertion point, sharing the canonical timeline up to that point.
[0008] Counterfactual branch nodes are explicitly marked with a branch_id, a branch_origin_hash identifying the canonical TEG position from which the branch diverges, and a is_counterfactual: true flag. This flag ensures that no counterfactual node can be confused with an evidence-grounded canonical node.
[0009] The CTE produces a counterfactual outcome record comparing the branch endpoint state to the canonical state at the equivalent temporal position, quantifying divergence across entity states and causal relationships.
ASCII Architecture
Canonical Timeline (TEG)
|
[Branch Point]
insertion_event injected
|
v
+------------------------------------+
| Counterfactual Timeline Engine |
+--------------------+---------------+
|
v
+------------------------------------+
| Counterfactual Branch Graph |
| branch_id: uuid |
| branch_origin_hash: sha256 |
| is_counterfactual: true |
| [CF_Event_1] -> [CF_Event_2] ... |
+------------------------------------+
|
v
Counterfactual Outcome Record
(divergence scored vs canonical)
Definitions
[0010] CounterfactualBranch: A distinct subgraph diverging from the canonical Temporal Event Graph at a specified insertion point, representing a timeline in which one or more hypothetical events replace or supplement the canonical event sequence.
[0011] BranchPoint: A temporal position in the canonical TEG from which a CounterfactualBranch originates, identified by an event node identifier and the branch_origin_hash.
[0012] branch_origin_hash: The SHA-256 hash of the canonical TEG event node immediately preceding the divergence, cryptographically anchoring the branch to a specific canonical position.
[0013] HypotheticalEventSpec: A specification defining the event or events injected at the BranchPoint to create the counterfactual divergence. Each spec contains an event descriptor, hypothetical entity state changes, and a causal rule modification set.
[0014] CounterfactualOutcomeRecord: A structured record comparing the endpoint state of a CounterfactualBranch to the canonical world state at the equivalent temporal position, including entity state divergence scores, causal relationship changes, and a branch fitness assessment.
[0015] BranchProvenanceSeparator: A flag field (is_counterfactual: true) applied to every node in a CounterfactualBranch, ensuring counterfactual nodes cannot be conflated with evidence-grounded canonical nodes during reasoning or evidence admissibility evaluation.
Detailed Description
[0016] Branch Specification. A counterfactual branch specification comprises: a branch_point_event_id identifying the canonical TEG node from which the branch diverges; a branch_origin_hash computed as the SHA-256 of the canonical event node’s full record; a list of HypotheticalEventSpec entries defining the divergent events to inject; and a causal_rule_modifications field optionally modifying specific causal rules during the simulation. The branch specification is serialised deterministically and hashed to produce a branch_spec_hash.
[0017] Provenance Isolation. All nodes created within a CounterfactualBranch carry the branch_id and is_counterfactual: true flag. The evidence artefact admission gate enforces that nodes marked is_counterfactual: true are never admitted to the canonical AIEP evidence ledger. This prevents counterfactual reasoning outputs from contaminating the evidence-grounded world state model.
[0018] Causal Propagation. After injecting the HypotheticalEventSpecs at the BranchPoint, the CTE propagates causal consequences forward through the counterfactual timeline using the active causal rule set from the CWSG (P200), optionally modified by the causal_rule_modifications in the branch specification. Propagation continues until either: a configurable propagation depth limit is reached; or no further causal consequences are derivable from the injected events.
[0019] Branch Graph Construction. The counterfactual branch graph shares canonical TEG event nodes up to and including the BranchPoint. All nodes after the BranchPoint are newly created counterfactual nodes. Entity states in the counterfactual branch are tracked independently from the canonical ESR (P201); counterfactual entity state records are held in a branch-scoped state store rather than the authoritative registry.
[0020] Counterfactual Outcome Computation. At branch completion, the CTE constructs a CounterfactualOutcomeRecord by: retrieving the canonical world state at the terminal temporal position of the branch; computing entity state divergence for each entity appearing in both canonical and counterfactual graphs; identifying causal relationships present in the branch but absent in the canonical graph (counterfactual causal discoveries) and vice versa (counterfactual causal removals); and assigning a branch fitness score summarising the aggregate divergence.
[0021] Multi-Branch Comparison. The CTE supports simultaneous management of multiple CounterfactualBranches diverging from the same canonical BranchPoint with different HypotheticalEventSpecs. Branch comparison mode evaluates the CounterfactualOutcomeRecords of all branches sharing the same branch_point_event_id and produces a ranked comparison report, useful for hypothesis comparison scenarios.
[0022] Branch Retention Policy. CounterfactualBranches are retained in the branch store for a configurable retention period. After the retention period, branches below a configurable fitness score threshold are pruned. High-fitness branches may be promoted for governance review to assess whether they represent plausible alternative causal explanations warranting further investigation.
Technical Effect
[0023] The invention provides a provenance-isolated counterfactual branching capability for evidence-bound reasoning systems. By anchoring branches to cryptographic hashes of canonical TEG positions and enforcing provenance separators on all counterfactual nodes, the system ensures that counterfactual reasoning cannot contaminate the evidence-grounded world model. The three-stage outcome record — entity divergence, causal structure change, and fitness score — provides a structured basis for hypothesis comparison that does not require exposing counterfactual outputs to the canonical reasoning substrate.
Claims
-
A computer-implemented method for generating and managing counterfactual timelines within an evidence-bound reasoning architecture, the method comprising:
(a) receiving a counterfactual branch specification comprising a branch point event identifier, a branch origin hash computed over the canonical timeline event node at the branch point, and one or more hypothetical event specifications defining divergent events to inject;
(b) creating a counterfactual branch graph diverging from the canonical timeline at the specified branch point, wherein all nodes in the counterfactual branch carry a branch identifier and a provenance separator field marking them as counterfactual;
(c) propagating causal consequences of the injected hypothetical events forward through the counterfactual branch using the active causal rule set, optionally modified by causal rule modifications included in the branch specification;
(d) computing a counterfactual outcome record comparing the terminal state of the counterfactual branch to the canonical world state at the equivalent temporal position, including entity state divergence scores and causal relationship changes; and
(e) enforcing that no node marked as counterfactual may be admitted to the canonical evidence ledger, preventing contamination of the evidence-bound world state model.
-
The method of claim 1, wherein the branch origin hash is a SHA-256 hash over the full canonical event node record at the branch point, cryptographically anchoring the counterfactual branch to a specific canonical world state position.
-
The method of claim 1, wherein causal propagation terminates when either a configurable propagation depth limit is reached or no further causal consequences are derivable from the injected hypothetical events.
-
The method of claim 1, wherein the method further supports simultaneous management of multiple counterfactual branches diverging from the same branch point with different hypothetical event specifications, enabling comparative branch evaluation.
-
The method of claim 4, wherein a branch comparison report is produced ranking the counterfactual outcome records of all branches sharing the same branch point by aggregate divergence fitness score.
-
The method of claim 1, wherein counterfactual branches are subject to a retention policy that prunes branches below a configurable fitness score threshold after a configurable retention period, and promotes high-fitness branches for governance review.
-
The method of claim 1, wherein entity states within the counterfactual branch are maintained in a branch-scoped state store independent of the authoritative entity state registry, preventing modification of canonical entity states.
-
A counterfactual timeline engine comprising one or more processors and storage, configured to execute the method of any of claims 1 to 7.
-
A non-transitory computer-readable medium storing instructions which, when executed by one or more processors, perform the method of any of claims 1 to 7.
Abstract
A computer-implemented counterfactual timeline engine is disclosed for evidence-bound AI reasoning architectures. Counterfactual branches diverge from a canonical temporal event graph at cryptographically anchored branch points, enabling reasoning about hypothetical event sequences without contaminating the evidence-grounded world state. All counterfactual nodes carry provenance separator flags preventing admission to the canonical evidence ledger. Causal consequences of injected hypothetical events are propagated using the active causal rule set. A counterfactual outcome record compares branch endpoint states to canonical world states, quantifying entity divergence and causal structure changes. Multi-branch comparison and retention-policy pruning are supported. | [CF_Event_1] -> [CF_Event_2] … | +------------------------------------+ | v Counterfactual Outcome Record (divergence from canonical state)
---
## Detailed Description
[0010] **Branching Protocol.** A counterfactual branch is initiated by specifying: `branch_origin_time` (world_time position in the canonical TEG); `injected_events` (array of hypothetical event nodes to insert at or after branch_origin_time); and `propagation_rules` (causal rule set governing how injected events affect entity states in the CWSG).
[0011] **Causal Propagation.** After injecting a hypothetical event, the CTE propagates its causal consequences through the CWSG by applying the propagation_rules to each affected entity state. Propagation proceeds forward in world_time until no further state changes occur or the compute budget is exhausted. State changes in the counterfactual branch do not affect the canonical CWSG.
[0012] **Branch Isolation.** Counterfactual branch nodes and edges are stored in a separate branch store keyed by branch_id. No counterfactual node may be inserted into the canonical TEG or canonical CWSG. Cross-references from counterfactual nodes to canonical nodes use read-only references.
[0013] **Outcome Record.** Upon completion of propagation, the CTE generates a counterfactual outcome record containing: the branch_id; the `canonical_state_hash` of the canonical CWSG at the equivalent timestamp; the `counterfactual_state_hash` of the branch endpoint state; a diff structure listing divergent entity states; and a `divergence_score` computed as the fraction of monitored entity attributes that differ.
[0014] **Branch Pruning Integration.** The CTE exposes an interface to the Counterfactual Branch Pruning Engine (P220), which may invoke the CTE to generate preliminary branches, evaluate their divergence scores, and prune low-value branches before full propagation.
---
## Claims
1. A counterfactual timeline engine for an evidence-bound reasoning architecture, wherein counterfactual branches diverge from a canonical timeline at a precisely defined temporal position.
2. The system of claim 1 wherein counterfactual nodes carry an explicit is_counterfactual flag preventing conflation with evidence-grounded nodes.
3. The system of claim 1 wherein causal consequences of injected hypothetical events are propagated through the world state graph using a rule set.
4. The system of claim 1 wherein branch endpoint states are compared to canonical states to produce a divergence score.
5. The system of claim 1 wherein branch provenance is preserved through a branch_origin_hash referencing the canonical timeline position.
6. A method of generating a counterfactual timeline branch from an evidence-bound temporal event graph, comprising branching at a specified position, injecting hypothetical events, propagating causal consequences, and recording branch provenance.