← Ziding Zhang

Dual-memory graph builder: mapping two perspectives on one timeline

A zero-dependency graph builder keeps Child and Parent memories distinct on shared places, flags EXIF date clashes, and ranks gaps by information gain.

November 29, 2026 · Project · What is not yet established


The mechanism doing the work

When two family members revisit the same home, they rarely remember the same place. Conversational remembering actively reshapes and diverges across listeners (Hirst & Echterhoff 2012), and healthy family narratives coordinate rather than erase distinct individual perspectives (Bohanek, Marin, Fivush & Duke 2006). A conventional knowledge graph flattens both speakers into one canonical text blurb, destroying either emotional truth or chronological accuracy. This proof of concept splits the job cleanly: a background engine attaches Perspective A (Child) and Perspective B (Parent) separately onto shared time-scoped coordinates, lets hardware EXIF lock dates without deleting dissenting recall, and ranks remaining voids by Expected Information Gain over trust cost.

Broadsheet architecture diagram showing streaming spoken turns and sparse scans entering a time-scoped resolver and divergence ranker, then wiring Perspective A (Child, in slate) above and Perspective B (Parent, in clay) below five shared coordinates from South Beijing to Docklands, highlighting three salience splits, a moss convergent anchor in North London, an EXIF date clash in Docklands, and the 2008 to 2010 active void as top EIG cue.
One coordinate backbone, two preserved memory layers: opposing lived valence stays visible alongside audio timestamps, while EXIF locks disputed dates. Try the live interactive map & parser →

Try the live map and Python engine

This prototype turns the loops sketched in the artifact–story flywheel and the evolving map of meaning into runnable code inspired by the sparse pre-2015 span of Seventeen homes, checked against my photos. Open the interactive dual-perspective map to scrub across ten anonymized synthetic turns (Beijing → rural English village → two distinct North London eras → Docklands), toggle between Child Memory, Parent Memory, and Overlay & Divergences, or type a custom spoken line and watch entities wire in real time.

Coordinate & eraChild vs. Parent rulingWhat the engine preserves
South Beijing (1999–2002)Salience split (Δ 1.55)Summer cicadas (+0.67) beside midnight exit paperwork (−0.88).
Rural village (2002–2004)Salience split (Δ 1.44)Green hills and geese (+0.64) beside damp room and winter mud (−0.80).
N. London terrace (2004–2007)Salience split (Δ 1.36)Corner park school walk (+0.53) beside housing queues (−0.83).
N. London flat (2011–2016)Convergent anchor (Δ 0.13)Separate era from 2004; both share settled pride (+0.69 / +0.82).
Docklands flat (2021–2024)Temporal clash (EXIF 2021)EXIF locks March 2021 while keeping Child’s "2020" claim intact.

The zero-dependency Python module (graph_builder.py) and reproduction guide pass nine built-in assertions (--verify) and rank the 2008–2010 void (S = 2.26) ahead of the high-sensitivity 2001 departure gap (S = 0.50).

Agent context: sources, method and working notes

System architecture and invariants

The background graph-builder (public/research/dual-memory-graph/graph_builder.py) maintains a typed state tuple $G_t = (P, A, E, U)$ updated incrementally as each spoken turn arrives from a JSONL stream:

  1. Time-scoped coordinate resolution ($P$): Each place node pairs lexical aliases with an explicit era interval [era_start, era_end] and normalized map coordinates (x, y). Repeating region tokens (such as "North London" appearing in both north_london_early_2004 and north_london_later_2011) receive low shared weight while exact era alignment adds +3.5 and distant eras incur a penalty (-0.45 per year, capped at -3.0). A turn mentioning 2005 never merges into the 2011–2016 flat.
  2. Dual-perspective node slots: Every place stores isolated perspectives.child and perspectives.parent records containing turn_ids, exact audio spans [[t0, t1], ...], years_claimed, concrete details, anonymized relational people roles, salience_tags, and tanh-scaled emotional valence in [-1.0, +1.0].
  3. Provenance tiers ($E$):
    • Tier 1 (tier1_hardware_exif): Hardware EXIF timestamps and rough region tags. Locks canonical chronology without overwriting spoken recall.
    • Tier 2 (tier2_contemporaneous_scan): Undated prints, tickets, and ephemera starting as orphans until spoken cues anchor them.
    • Tier 3 (tier3_spoken_recall): Retrospective turns carrying [t0, t1] audio citations and speaker attribution.
    • Tier 4 (tier4_inferred_link): Computed divergence and agreement overlay markers.
  4. Divergence vs. agreement classifier: On any coordinate holding both speakers (or an EXIF anchor contradicting a speaker):
    • temporal_clash: Fires when a claimed year falls strictly outside an EXIF-corroborated era span (e.g., Child recalling 2020 for a 2021–2024 Docklands flat anchored by 2021-03-04 EXIF). Crucially, a mid-era photo (2014-05-18 inside 2011–2016) does not trigger a false clash against a 2012 move-in turn.
    • salience_split: Fires when |valence_child - valence_parent| >= 0.75 on the same shared place/era.
    • detail_divergence: Fires when motif Jaccard overlap < 0.20 and |Δvalence| >= 0.45.
    • convergent_anchor: Fires when both perspectives align chronologically and emotionally (|Δvalence| <= 0.30).

Expected Information Gain over archive gaps

Following Bayesian optimal experimental design (Lindley 1956) and dependency-tracked revision (Doyle 1979), each unresolved void $g \in U$ holds a discrete hypothesis distribution $p_g$, $m_g$ unanchored orphan artifacts, and $b_g$ unlinked chronological boundaries. With expected single-turn resolution rate $r = 0.78$, orphan value $h_{\text{art}} = 0.35$, and boundary value $h_{\text{bridge}} = 0.40$:

$$\mathrm{EIG}(g) = r \cdot H(p_g) + m_g \cdot h_{\text{art}} + b_g \cdot h_{\text{bridge}}, \qquad H(p_g) = -\sum_i p_i \log_2 p_i$$

$$C_{\text{trust}}(g) = 1.0 + 1.2 \cdot \mathrm{sensitivity}(g) + 0.8 \cdot (1 - \mathrm{reversibility}(g)), \qquad S(g) = \frac{\mathrm{EIG}(g)}{C_{\text{trust}}(g)}$$

Verified output on the 10-turn synthetic stream (memory_graph.json, 30 edges, 7/11 artifacts anchored):

Gap IDEntropy $H$ (bits)Orphans / BoundsRaw EIG (bits)Trust Cost $C_{\text{trust}}$Priority $S$
gap_2008_2010_bridge1.5813 / 23.0831.3642.260 (#1 cue)
gap_2003_village_school0.9581 / 01.0971.1760.933 (#2)
gap_2001_departure_week0.7600 / 10.9931.9840.501 (#3, held back)

Reproduction & public resource bundle

All code and synthetic inputs live under public/research/dual-memory-graph/ (zero external dependencies, Python 3.10+):

Verify locally:

python3 public/research/dual-memory-graph/graph_builder.py --verify
python3 public/research/dual-memory-graph/graph_builder.py

The --verify suite checks all 9 invariants: (1) 10 turns ingested across 5 dual-layer places, (2) zero era collapse between 2004 and 2011 North London, (3) valid t0 < t1 audio spans per speaker, (4) three salience splits + one moss convergent anchor, (5) Docklands EXIF 2021 locking canonical chronology while preserving Child’s 2020 claim, (6) dynamic orphan scan anchoring, (7) trust-cost-adjusted EIG ordering, (8) live ingestion of a custom 2005 park-walk turn without corrupting 2011, and (9) EIG entropy shrinkage when a 2009 interim-bridge turn arrives.

Experimental rubric for live human validation

To test whether dual-perspective graphs outperform flat summaries in real family conversations:

  1. Condition A (Flat consensus graph): Summarize two-speaker photo interviews into a single merged place record per neighbourhood.
  2. Condition B (Dual-perspective graph): Keep Speaker A and Speaker B slots distinct on shared coordinates with audio-span citations and EXIF clash tagging.
  3. Blind scoring: Ask both original speakers one week later to audit 10 generated place cards for (a) voice fidelity (“does this still sound like my memory?”), (b) unnoticed overwrites (count of factually or emotionally distorted claims), and (c) follow-up spark (whether seeing a divergence card prompts a clarifying story without friction).

Synthetic scope & citation verification note

All place names, filenames, and spoken lines in this bundle use broad non-identifying region labels (Beijing, rural English village, North London, Docklands) inspired structurally by the pre-2015 sparsity pattern in Seventeen homes, checked against my photos, with zero real street addresses, personal names, or private photographs. External scholarly sources below were verified via bibliographic indexing records and published DOIs/abstracts rather than full-text PDF audits:

  • William Hirst & Gerald Echterhoff (2012), “Remembering in Conversations: The Social Sharing and Reshaping of Memories”, Annual Review of Psychology, 63:55–79. DOI: 10.1146/annurev-psych-120710-100340
  • Jennifer G. Bohanek, Kelly A. Marin, Robyn Fivush & Marshall P. Duke (2006), “Family Narrative Interaction and Children’s Sense of Self”, Family Process, 45(1):39–54. DOI: 10.1111/j.1545-5300.2006.00079.x
  • Jon Doyle (1979), “A Truth Maintenance System”, Artificial Intelligence, 12(3):231–272. DOI: 10.1016/0004-3702(79)90008-0
  • Dennis V. Lindley (1956), “On a Measure of the Information Provided by an Experiment”, The Annals of Mathematical Statistics, 27(4):986–1005. DOI: 10.1214/aoms/1177728069

Have an answer, a counterexample, or a story? See Talk to me for open questions and live trials.

Credits: Ziding Zhang, with Gemini for the zero-dependency Python graph builder, broadsheet SVG figure, and interactive dual-perspective map; building on William Hirst, Gerald Echterhoff, Robyn Fivush, Jennifer Bohanek, Jon Doyle, and Dennis Lindley.