holo-fiction
A memory where fiction is a first-class citizen.
Every item carries two orthogonal tags: a modal (the epistemic status β fact, hypothesis, fiction, counterfactual, or any user-registered category) and a world (the context the item belongs to, "real" by default). The substrate stores fiction and fact with the same primitives. The difference is the tag.
Three use cases motivated the design:
- Knowledge-mode switch (DeepSeek-style). Distinguish "known science" from "frontier" from "speculative."
- Book reader's memory. Track what is true in the world of a novel, cross-referenced against real-world facts.
- Counterfactual reasoner. Ask "what would be the case if X were fact instead of fiction."
What it does
from holo_fiction import FictionalMemory
mem = FictionalMemory(d=2048)
# Real world
mem.observe("water_is_wet", modal="fact")
mem.observe("london", modal="fact", country="england")
# Fictional world
mem.observe("sherlock_holmes",
modal="fiction", world="sherlock",
occupation="detective", city="london")
# Separate queries
mem.query("water_is_wet", modal="fact") # YES
mem.query("water_is_wet", world="sherlock") # UNKNOWN
mem.query("sherlock_holmes", world="sherlock") # YES
# Cross-world reference
mem.cross_world_reference("sherlock")
# [{"label": "sherlock_holmes", "field": "city",
# "references": "london", "reference_world": "real"}]
# Character sheet
mem.character_sheet("sherlock_holmes", world="sherlock")
# What-if reasoning
mem.what_if("sherlock_holmes", "fiction", "fact",
world="sherlock")
# Promotion
mem.promote("sherlock_holmes", "fiction", "fact",
world="sherlock")
# Knowledge modes
mem.register_modal("known", confidence=1.0)
mem.register_modal("frontier", confidence=0.7)
mem.register_modal("speculative", confidence=0.4)
Results
All results at D=2048, threshold=0.05.
Self-test
| Check | Result |
|---|---|
| bind/unbind identity | PASS |
| observe + query | PASS (conf=1.000) |
| fiction in separate world | PASS (conf=0.900) |
| fact world unaffected | PASS (conf=β0.014) |
Fiction vs fact separation
| Query | world=real | world=sherlock |
|---|---|---|
| water_is_wet | +1.015 | β0.014 |
| sherlock_lives_on_baker_street | +0.005 | +0.907 |
Cross-contamination is at the noise floor.
Knowledge modes
| Query | known | frontier | speculative |
|---|---|---|---|
| water_boils_at_100C | +1.016 | β0.003 | +0.006 |
| universe_is_simulation | β0.022 | β0.007 | +0.411 |
Each query retrieves cleanly in exactly one mode.
Promotion
Storing dark_matter_exists as hypothesis (weight 0.5):
| fact | hypothesis | fiction | |
|---|---|---|---|
| before promote | β0.035 | +0.500 | +0.000 |
| after promote | +0.965 | +0.000 | +0.000 |
The item moves from one modal trace to another. No re-observation.
Character sheet
sherlock_holmes:
occupation = detective (fiction)
friend = john_watson (fiction)
address = 221b_baker_street (fiction)
city = london (fiction)
Cross-world reference
Items in the fictional world that cite real-world labels:
sherlock_holmes city -> london
john_watson city -> london
221b_baker_street city -> london
Installation
pip install numpy
No other dependencies. Single file, approximately 600 lines.
Usage
CLI
python holo_fiction.py
python holo_fiction.py --output results/
Runs ten demonstrations and writes a JSON state file.
Python
from holo_fiction import FictionalMemory
mem = FictionalMemory(d=2048)
# Storage
mem.observe(label, modal="fact", world="real",
weight=1.0, source=None, **fields)
# Register a custom modal
mem.register_modal("known", confidence=1.0)
mem.register_modal("frontier", confidence=0.7)
# Query
result = mem.query(label, modal="fact", world="real",
fields=None)
# {"label": ..., "modal": ..., "world": ...,
# "confidence": ..., "verdict": ...}
# Query across modals
results = mem.query_across_modals(label, world="real")
# Cross-modal operations
mem.what_if(label, from_modal, to_modal, world="real")
mem.promote(label, from_modal, to_modal, world="real")
# Analysis
mem.contradictions(world="real")
mem.modal_distribution(label)
mem.world_summary(world)
mem.character_sheet(name, world)
mem.cross_world_reference(world, reference_world="real")
mem.timeline(world, modal=None)
# Diagnostics
mem.stats()
mem.save_json("state.json")
API reference
FictionalMemory
FictionalMemory(d=2048, threshold=0.05)
Modal registration
register_modal(name, confidence=1.0)β add a modal with a confidence weight.register_world(name)β add a world context.
Storage
observe(label, modal="fact", world="real", weight=1.0, source=None, **fields)β store an observation.
Query
query(label, modal=None, world="real", fields=None) -> dictquery_across_modals(label, world="real") -> {modal: result}
Cross-modal
what_if(label, from_modal, to_modal, world="real") -> dictpromote(label, from_modal, to_modal, world="real") -> dict
Analysis
contradictions(world="real") -> {modal_conflicts, field_conflicts}modal_distribution(label, world=None) -> {modal: count}world_summary(world) -> {counts, labels}character_sheet(name, world) -> {fields: {field: [entries]}}cross_world_reference(world, reference_world="real") -> [refs]timeline(world, modal=None) -> [entries]
Diagnostics
stats() -> dictsave_json(path)
Design notes
Two orthogonal tags
Modal and world are independent. modal="fiction" in world="sherlock"
is different from modal="fiction" in world="realm". The same
item can be stored in multiple modals and multiple worlds; queries
select by either tag.
Modal Γ world traces
Each (world, modal) pair has its own trace. The traces share the underlying codebook: name vectors and role vectors are global. This means an item stored in one (world, modal) has the same composite representation as the same item stored elsewhere. Promotion is a trace arithmetic operation, not a re-encoding.
Modal confidence as a weight
The confidence registered per modal multiplies the observation
weight at storage time. A fiction item stored with weight 1.0 and
modal confidence 0.9 produces a projection of ~0.9. The confidence
factors are a design parameter, not a physical constant.
The field-matching principle
Observations with fields require queries with the same fields.
If an item was stored with composite(a + b) and queried with
composite(a), the projection dilutes.
The correct query:
mem.observe("dark_matter_exists", modal="frontier",
evidence="rotation_curves")
mem.query("dark_matter_exists", modal="frontier",
fields={"evidence": "rotation_curves"})
The demo's failure on dark_matter_exists is the empirical
demonstration of this principle.
Cross-world reference
Field values share the name-vector namespace with labels. A field value that matches a label in the reference world is a cross-world reference. This works because both are stored as name vectors, not because of any special machinery.
Limitations
Field-matched queries required. Observations with fields must be queried with matching fields. Dilution, not error, is the failure mode.
Worlds are fully independent. No relation between worlds is modeled. A fiction world that is "about" the real world is not distinguished from one that is not.
Modal confidence fixed at registration. Changing a modal's confidence does not retroactively re-weight items. Re-storage is required.
No modal inference. Every observation specifies its modal explicitly. The substrate does not infer the modal from context.
No cross-world causal structure. A fictional world cannot declare that its events have effects in the real world, or vice versa.
promote mutates records. The Obs.modal field is mutated in
place. Copy the record if audit history is required.
Citation
@misc{holo-fiction2026,
title = {holo-fiction: A memory where fiction is a first-class
citizen},
author = {zeechimp},
year = {2026},
note = {Modal and world as orthogonal tags on every item.
Knowledge modes, book reader's memory, and
counterfactual reasoning.}
}
References
- Plate, T. A. "Holographic Reduced Representations." IEEE Transactions on Neural Networks 6:3 (1995), 623β641.
- Kanerva, P. "Hyperdimensional Computing." Cognitive Computation 1:2 (2009), 139β159.
- Lewis, D. "Truth in Fiction." American Philosophical Quarterly 15:1 (1978), 37β46.
- Ryan, M.-L. "Possible Worlds, Artificial Intelligence, and Narrative Theory." Indiana University Press (1991).
License
Apache 2.0