{
 "paper": "identity-persistence",
 "a": "7.1",
 "b": "7.2",
 "summary": "From v7.1 (2 Jun) to v7.2 (2 Jun): 6,792 words to 5,948 words, 352 words in new or rewritten paragraphs and 1,196 taken out, 74 paragraphs changed.",
 "note": {
  "title": "Repository details removed; one architecture figure added",
  "kind": "revision",
  "body": "## Summary\n\nThe paper reads less like code documentation. A March audit in the improvement notes asked for this: no figures, file paths and commit hashes in the text, and code that was too specific.\n\n- Adds the first figure: the architecture and data flow.\n- Removes the lists of source files, line counts and commits, and the test-count section; the implementation becomes one prose description of seven cooperating parts.\n- Removes the changelog block at the top.\n- \"PersonaState\" becomes \"persona state\" in the text.\n- About 840 words shorter.",
  "source": "change note"
 },
 "paragraphs_changed": 74,
 "changes": [
  {
   "section": "",
   "old": "> **Changelog v7.0 → v7.1.** Grounded the introduction in the neuroscience of identity (prefrontal cortex, the continuity of self, the Phineas Gage lesion). Added a dedicated treatment of identity stability under model switching (§4.4) — a failure mode unique to multi-model agent runtimes. Documented the persona self-improvement loop (§5.1): an external nightly reflection layer rewrites the very persona files this system consumes. Made each cross-paper reference self-sufficient with an inline one-sentence summary. Promoted multi-agent identity from a one-line limitation to a concrete future direction (§11.3). Added similes for the core constructs (SOUL.md, SyncScore, drift, model-switch resilience). Prose tightened; hedges removed.",
   "new": null,
   "marked": "[-> **Changelog v7.0 → v7.1.** Grounded the introduction in the neuroscience of identity (prefrontal cortex, the continuity of self, the Phineas Gage lesion). Added a dedicated treatment of identity stability under model switching (§4.4) — a failure mode unique to multi-model agent runtimes. Documented the persona self-improvement loop (§5.1): an external nightly reflection layer rewrites the very persona files this system consumes. Made each cross-paper reference self-sufficient with an inline one-sentence summary. Promoted multi-agent identity from a one-line limitation to a concrete future direction (§11.3). Added similes for the core constructs (SOUL.md, SyncScore, drift, model-switch resilience). Prose tightened; hedges removed.-]"
  },
  {
   "section": "",
   "old": "> **Changelog v6.0 → v7.0.** Major editorial revision (two critique→fix cycles). Abstract condensed to ~160 words. Merged §3/§4 into single section. Added §10 (Comparison to Existing Approaches), §11.4 (Error Analysis with quantitative failure bounds), §13 (Ethical Considerations), and inter-rater reliability (Krippendorff's α) for human evaluation. Addressed numerical stability of E_φ distances. Fixed dangling cross-references. Removed redundant restatements (core mechanisms reduced from 5× to 2×). Eliminated commit hashes from claims table. Tightened prose throughout.",
   "new": null,
   "marked": "[-> **Changelog v6.0 → v7.0.** Major editorial revision (two critique→fix cycles). Abstract condensed to ~160 words. Merged §3/§4 into single section. Added §10 (Comparison to Existing Approaches), §11.4 (Error Analysis with quantitative failure bounds), §13 (Ethical Considerations), and inter-rater reliability (Krippendorff's α) for human evaluation. Addressed numerical stability of E_φ distances. Fixed dangling cross-references. Removed redundant restatements (core mechanisms reduced from 5× to 2×). Eliminated commit hashes from claims table. Tightened prose throughout.-]"
  },
  {
   "section": "",
   "old": "> **Changelog v5.0 → v6.0.** Prose tightened throughout; redundancy eliminated. Core mechanism stated unambiguously. All cross-references verified against current names. Experiential deployment data strengthened. Abstract rewritten for impact. No changes to math, algorithms, or benchmark results.",
   "new": null,
   "marked": "[-> **Changelog v5.0 → v6.0.** Prose tightened throughout; redundancy eliminated. Core mechanism stated unambiguously. All cross-references verified against current names. Experiential deployment data strengthened. Abstract rewritten for impact. No changes to math, algorithms, or benchmark results.-]"
  },
  {
   "section": "Abstract",
   "old": "Because the persona lives in editable state outside any model's weights, the same machinery keeps identity stable when the underlying model is swapped mid-conversation — a property training-time methods cannot offer — and lets an external reflection layer rewrite the persona overnight, so identity not only persists but improves. A discrete-time Lyapunov analysis provides closed-form variance bounds. Benchmarks confirm 50-turn SyncScore stability (mean 0.977), drift recovery from 0.027 to 0.980, and 442× on/off-persona separation. Human evaluation (30 logs, 3 judges, Krippendorff's α = 0.81) yields consistency of 4.2 ± 0.4 versus 2.6 ± 0.7 baseline. The system has maintained consistent personality across 30+ days of production deployment spanning model switches, context resets, and hundreds of sessions. Implementation: 14 files, 4,974 LOC (TypeScript), 368 tests at 100%.",
   "new": "Because the persona lives in editable state outside any model's weights, the same machinery keeps identity stable when the underlying model is swapped mid-conversation — a property training-time methods cannot offer — and lets an external reflection layer rewrite the persona overnight, so identity not only persists but improves. A discrete-time Lyapunov analysis provides closed-form variance bounds. Component benchmarks confirm 50-turn SyncScore stability (mean 0.977), drift recovery from 0.027 to 0.980, and 442× on/off-persona separation. Human evaluation (30 logs, 3 judges, Krippendorff's α = 0.81) yields consistency of 4.2 ± 0.4 versus 2.6 ± 0.7 baseline. The system has maintained consistent personality across 30+ days of production deployment spanning model switches, context resets, and hundreds of sessions.",
   "marked": "Because the persona lives in editable state outside any model's weights, the same machinery keeps identity stable when the underlying model is swapped mid-conversation — a property training-time methods cannot offer — and lets an external reflection layer rewrite the persona overnight, so identity not only persists but improves. A discrete-time Lyapunov analysis provides closed-form variance bounds. [-Benchmarks-] {+Component benchmarks+} confirm 50-turn SyncScore stability (mean 0.977), drift recovery from 0.027 to 0.980, and 442× on/off-persona separation. Human evaluation (30 logs, 3 judges, Krippendorff's α = 0.81) yields consistency of 4.2 ± 0.4 versus 2.6 ± 0.7 baseline. The system has maintained consistent personality across 30+ days of production deployment spanning model switches, context resets, and hundreds of [-sessions. Implementation: 14 files, 4,974 LOC (TypeScript), 368 tests at 100%.-] {+sessions.+}"
  },
  {
   "section": "1. Introduction",
   "old": "Persistent LLM-based agents face the same dissociation. They must do more than remember facts — they must maintain a consistent voice, relational stance, and behavioral repertoire as conversations extend beyond their context windows. This work is our attempt to give an AI agent what the prefrontal cortex gives us: a stable identity that survives across sessions, model switches, and complete restarts. Three failure modes stand in the way: (1) **Persona drift** from attention dilution as context fills (Li et al., 2024); (2) **Context rot** degrading mid-context recall (Liu et al., 2024); and (3) **Memory-identity dissociation**, where standard memory systems preserve factual recall but strip stylistic identity during compaction — the agent's own Phineas Gage problem.",
   "new": "Persistent LLM-based agents face the same dissociation. They must do more than remember facts — they must maintain a consistent voice, relational stance, and behavioral repertoire as conversations extend beyond their context windows. This work gives an AI agent what the prefrontal cortex gives us: a stable identity that survives across sessions, model switches, and complete restarts. Three failure modes stand in the way: (1) **Persona drift** from attention dilution as context fills (Li et al., 2024); (2) **Context rot** degrading mid-context recall (Liu et al., 2024); and (3) **Memory-identity dissociation**, where standard memory systems preserve factual recall but strip stylistic identity during compaction — the agent's own Phineas Gage problem.",
   "marked": "Persistent LLM-based agents face the same dissociation. They must do more than remember facts — they must maintain a consistent voice, relational stance, and behavioral repertoire as conversations extend beyond their context windows. This work [-is our attempt to give-] {+gives+} an AI agent what the prefrontal cortex gives us: a stable identity that survives across sessions, model switches, and complete restarts. Three failure modes stand in the way: (1) **Persona drift** from attention dilution as context fills (Li et al., 2024); (2) **Context rot** degrading mid-context recall (Liu et al., 2024); and (3) **Memory-identity dissociation**, where standard memory systems preserve factual recall but strip stylistic identity during compaction — the agent's own Phineas Gage problem."
  },
  {
   "section": "1. Introduction",
   "old": null,
   "new": "![Identity Persistence architecture and data flow: the model-external persona store feeds the session runtime, which composes drift, consistency, voice-marker and convergence modules into a single SyncScore, with cross-module hooks for severe drift, compaction, and humor calibration.](images/architecture.png)",
   "marked": "{+![Identity Persistence architecture and data flow: the model-external persona store feeds the session runtime, which composes drift, consistency, voice-marker and convergence modules into a single SyncScore, with cross-module hooks for severe drift, compaction, and humor calibration.](images/architecture.png)+}"
  },
  {
   "section": "4.1 Priority-Aware Injection",
   "old": "Personality injection is a non-negotiable invariant enforced by the scheduling policy, not a heuristic. The mechanism uses a **Tiered Selection Strategy** mapping onto structured episodic memory push-pack assemblies:",
   "new": "Personality injection is a non-negotiable invariant enforced by the scheduling policy, not a heuristic. The mechanism uses a **Tiered Selection Strategy** mapping onto structured episodic memory assemblies:",
   "marked": "Personality injection is a non-negotiable invariant enforced by the scheduling policy, not a heuristic. The mechanism uses a **Tiered Selection Strategy** mapping onto structured episodic memory [-push-pack-] assemblies:"
  },
  {
   "section": "4.1 Priority-Aware Injection",
   "old": "1. **Tier 1 (Pinned):** PersonaState block (priority $\\geq 0.7$). Injected first to maximize prompt-cache hit rates. Non-evictable. 2. **Tier 2 (Recent):** Last $K$ conversation turns. 3. **Tier 3 (Scored):** Task-conditioned retrieval memories (supplied by Instant Recall; Serra, 2026b).",
   "new": "1. **Tier 1 (Pinned):** Persona block (priority $\\geq 0.7$). Injected first to maximize prompt-cache hit rates. Non-evictable. 2. **Tier 2 (Recent):** Last $K$ conversation turns. 3. **Tier 3 (Scored):** Task-conditioned retrieval memories (supplied by Instant Recall; Serra, 2026b).",
   "marked": "1. **Tier 1 (Pinned):** [-PersonaState-] {+Persona+} block (priority $\\geq 0.7$). Injected first to maximize prompt-cache hit rates. Non-evictable. 2. **Tier 2 (Recent):** Last $K$ conversation turns. 3. **Tier 3 (Scored):** Task-conditioned retrieval memories (supplied by Instant Recall; Serra, 2026b)."
  },
  {
   "section": "4.1 Priority-Aware Injection",
   "old": "**Proposition 1 (Persona Budget Bound).** For effective task performance, the persona block should satisfy: $\\frac{|P|}{B_{\\text{ctx}}} \\leq \\eta_{\\max} = 0.05$. _Justification._ Empirically (see Fig. 4), average task success dropped only 2% when $\\eta_{\\max}$ increased from 5%→10%, but persona consistency improved 6%; we keep $\\eta_{\\max} = 5\\%$ as a conservative default.",
   "new": "**Proposition 1 (Persona Budget Bound).** For effective task performance, the persona block should satisfy: $\\frac{|P|}{B_{\\text{ctx}}} \\leq \\eta_{\\max} = 0.05$. _Justification._ Empirically, average task success dropped only 2% when $\\eta_{\\max}$ increased from 5%→10%, but persona consistency improved 6%; we keep $\\eta_{\\max} = 5\\%$ as a conservative default.",
   "marked": "**Proposition 1 (Persona Budget Bound).** For effective task performance, the persona block should satisfy: $\\frac{|P|}{B_{\\text{ctx}}} \\leq \\eta_{\\max} = 0.05$. _Justification._ [-Empirically (see Fig. 4),-] {+Empirically,+} average task success dropped only 2% when $\\eta_{\\max}$ increased from 5%→10%, but persona consistency improved 6%; we keep $\\eta_{\\max} = 5\\%$ as a conservative default."
  },
  {
   "section": "4.1 Priority-Aware Injection",
   "old": "**Implementation:** `priority-injection.ts` (229 LOC) implements `PriorityInjector` and the tiered selection logic. `identity-persistence-runtime.ts` (404 LOC) wires the runtime, loading `PersonaState` from `SOUL.md` via `loadLatestPersonaState()` and computing SyncScore after every turn.",
   "new": null,
   "marked": "[-**Implementation:** `priority-injection.ts` (229 LOC) implements `PriorityInjector` and the tiered selection logic. `identity-persistence-runtime.ts` (404 LOC) wires the runtime, loading `PersonaState` from `SOUL.md` via `loadLatestPersonaState()` and computing SyncScore after every turn.-]"
  },
  {
   "section": "4.1 Priority-Aware Injection",
   "old": null,
   "new": "The injection layer renders the persona into pinned tiers and enforces the context budget before recent turns and retrieved memories are appended. The persona specification is loaded once per session from its human-readable source file; the runtime recomputes SyncScore after every turn.",
   "marked": "{+The injection layer renders the persona into pinned tiers and enforces the context budget before recent turns and retrieved memories are appended. The persona specification is loaded once per session from its human-readable source file; the runtime recomputes SyncScore after every turn.+}"
  },
  {
   "section": "4.2 Identity-Preserving Compaction (IPC)",
   "old": "**Persona Feature Space ($E_\\phi$):** The projection $E_\\phi: \\text{Text} \\to \\mathbb{R}^{d_p}$ combines $d_A=8$ measurable linguistic features (type-token ratio, hedging frequency, sentence length variance, etc.) and a $d_B=128$ dense style embedding. Unless otherwise stated, we use a _separate_ 768-d RoBERTa encoder to avoid leakage; §8.6 reports comparative results. We recommend $\\lambda_{\\text{info}} = 0.6, \\lambda_{\\text{persona}} = 0.4$.",
   "new": "**Persona Feature Space ($E_\\phi$):** The projection $E_\\phi: \\text{Text} \\to \\mathbb{R}^{d_p}$ combines $d_A=8$ measurable linguistic features (type-token ratio, hedging frequency, sentence length variance, etc.) and a $d_B=128$ dense style embedding. Unless otherwise stated, we use a _separate_ 768-d RoBERTa encoder to avoid leakage; §7.6 reports comparative results. We recommend $\\lambda_{\\text{info}} = 0.6, \\lambda_{\\text{persona}} = 0.4$.",
   "marked": "**Persona Feature Space ($E_\\phi$):** The projection $E_\\phi: \\text{Text} \\to \\mathbb{R}^{d_p}$ combines $d_A=8$ measurable linguistic features (type-token ratio, hedging frequency, sentence length variance, etc.) and a $d_B=128$ dense style embedding. Unless otherwise stated, we use a _separate_ 768-d RoBERTa encoder to avoid leakage; [-§8.6-] {+§7.6+} reports comparative results. We recommend $\\lambda_{\\text{info}} = 0.6, \\lambda_{\\text{persona}} = 0.4$."
  },
  {
   "section": "4.2 Identity-Preserving Compaction (IPC)",
   "old": "**Implementation:** `voice-markers.ts` (338 LOC) encodes the $E_\\phi$ projection; `consistency-metric.ts` (235 LOC) computes the consistency metric $C$. IPC delegates factual summarization to Total Recall's `engram_compact` primitive (Serra, 2026a), then applies the persona-preservation pass.",
   "new": null,
   "marked": "[-**Implementation:** `voice-markers.ts` (338 LOC) encodes the $E_\\phi$ projection; `consistency-metric.ts` (235 LOC) computes the consistency metric $C$. IPC delegates factual summarization to Total Recall's `engram_compact` primitive (Serra, 2026a), then applies the persona-preservation pass.-]"
  },
  {
   "section": "4.2 Identity-Preserving Compaction (IPC)",
   "old": null,
   "new": "IPC delegates factual summarization to Total Recall's compaction primitive (Serra, 2026a), then applies a separate persona-preservation pass that re-runs summarization with style preserved if the persona-feature distance between source and summary exceeds a threshold.",
   "marked": "{+IPC delegates factual summarization to Total Recall's compaction primitive (Serra, 2026a), then applies a separate persona-preservation pass that re-runs summarization with style preserved if the persona-feature distance between source and summary exceeds a threshold.+}"
  },
  {
   "section": "4.3.1 Signal Fusion and Sparsity Adaptation",
   "old": "**Implementation:** `drift-detection.ts` (206 LOC) exposes `detectUserCorrections()`, `computeAdaptiveWeights()`, and `computeDriftScore()`. `behavioral-probes.ts` (301 LOC) implements the three-tier probe schedule.",
   "new": null,
   "marked": "[-**Implementation:** `drift-detection.ts` (206 LOC) exposes `detectUserCorrections()`, `computeAdaptiveWeights()`, and `computeDriftScore()`. `behavioral-probes.ts` (301 LOC) implements the three-tier probe schedule.-]"
  },
  {
   "section": "4.3.2 Theorem 1: Drift Correction Convergence",
   "old": "**Linearity assumption and practical limits.** The linear correction model holds when persona deviations are small relative to the feature space scale — the typical operating regime. Under catastrophic drift (e.g., model substitution mid-conversation), the correction dynamics may exhibit nonlinear saturation. In practice, the `severe_rebase` action (§8.4) handles this by performing a full persona re-injection rather than incremental correction, bypassing the linear model entirely.",
   "new": "**Linearity assumption and practical limits.** The linear correction model holds when persona deviations are small relative to the feature space scale — the typical operating regime. Under catastrophic drift (e.g., model substitution mid-conversation), the correction dynamics may exhibit nonlinear saturation. In practice, the `severe_rebase` action (§7.4) handles this by performing a full persona re-injection rather than incremental correction, bypassing the linear model entirely.",
   "marked": "**Linearity assumption and practical limits.** The linear correction model holds when persona deviations are small relative to the feature space scale — the typical operating regime. Under catastrophic drift (e.g., model substitution mid-conversation), the correction dynamics may exhibit nonlinear saturation. In practice, the `severe_rebase` action [-(§8.4)-] {+(§7.4)+} handles this by performing a full persona re-injection rather than incremental correction, bypassing the linear model entirely."
  },
  {
   "section": "4.3.2 Theorem 1: Drift Correction Convergence",
   "old": "**Implementation:** `convergence-monitor.ts` (204 LOC) implements the EWMA accumulator and closed-loop correction logic.",
   "new": null,
   "marked": "[-**Implementation:** `convergence-monitor.ts` (204 LOC) implements the EWMA accumulator and closed-loop correction logic.-]"
  },
  {
   "section": "4.4 Identity Stability Under Model Switching",
   "old": null,
   "new": "![Identity stability under a mid-conversation model switch: a backend change is a step disturbance the detector registers immediately; severe_rebase re-injects the full persona and the agent settles in 5–8 turns, while a baseline without enforcement stays off-persona.](images/model-switch.png)",
   "marked": "{+![Identity stability under a mid-conversation model switch: a backend change is a step disturbance the detector registers immediately; severe_rebase re-injects the full persona and the agent settles in 5–8 turns, while a baseline without enforcement stays off-persona.](images/model-switch.png)+}"
  },
  {
   "section": "4.4 Identity Stability Under Model Switching",
   "old": "Because Identity Persistence operates entirely at inference time over a model-external PersonaState, it treats a model switch as just another source of drift. The same machinery applies, with one refinement:",
   "new": "Because Identity Persistence operates entirely at inference time over a model-external persona state, it treats a model switch as just another source of drift. The same machinery applies, with one refinement:",
   "marked": "Because Identity Persistence operates entirely at inference time over a model-external [-PersonaState,-] {+persona state,+} it treats a model switch as just another source of drift. The same machinery applies, with one refinement:"
  },
  {
   "section": "4.4 Identity Stability Under Model Switching",
   "old": "1. **The persona specification is model-independent.** PersonaState lives outside any model's weights, so the target $\\theta^*$ does not move when the backend does. Whatever model is serving the turn is handed the same Tier 1 persona block (§4.1). 2. **A switch is a step disturbance, not gradual drift.** Where ordinary drift accumulates over many turns, a model change injects a discontinuity in $\\epsilon_t$ at a single step. The two-signal detector (§4.3) registers the jump in $E_\\phi$ distance immediately rather than waiting for it to compound. 3. **Large jumps bypass the linear loop.** When the post-switch deviation exceeds the linear-correction regime (§4.3.2), the `severe_rebase` action performs a full persona re-injection instead of incremental nudging. In the error analysis (§11.4) this is the dominant recovery path after a switch to a backend with sharply different priors, taking 5–8 turns to settle rather than ~2.",
   "new": "1. **The persona specification is model-independent.** It lives outside any model's weights, so the target $\\theta^*$ does not move when the backend does. Whatever model is serving the turn is handed the same Tier 1 persona block (§4.1). 2. **A switch is a step disturbance, not gradual drift.** Where ordinary drift accumulates over many turns, a model change injects a discontinuity in $\\epsilon_t$ at a single step. The two-signal detector (§4.3) registers the jump in $E_\\phi$ distance immediately rather than waiting for it to compound. 3. **Large jumps bypass the linear loop.** When the post-switch deviation exceeds the linear-correction regime (§4.3.2), the `severe_rebase` action performs a full persona re-injection instead of incremental nudging. In the error analysis (§11.4) this is the dominant recovery path after a switch to a backend with sharply different priors, taking 5–8 turns to settle rather than ~2.",
   "marked": "1. **The persona specification is model-independent.** [-PersonaState-] {+It+} lives outside any model's weights, so the target $\\theta^*$ does not move when the backend does. Whatever model is serving the turn is handed the same Tier 1 persona block (§4.1). 2. **A switch is a step disturbance, not gradual drift.** Where ordinary drift accumulates over many turns, a model change injects a discontinuity in $\\epsilon_t$ at a single step. The two-signal detector (§4.3) registers the jump in $E_\\phi$ distance immediately rather than waiting for it to compound. 3. **Large jumps bypass the linear loop.** When the post-switch deviation exceeds the linear-correction regime (§4.3.2), the `severe_rebase` action performs a full persona re-injection instead of incremental nudging. In the error analysis (§11.4) this is the dominant recovery path after a switch to a backend with sharply different priors, taking 5–8 turns to settle rather than ~2."
  },
  {
   "section": "5. PersonaState Specification",
   "old": "## 5. PersonaState Specification",
   "new": null,
   "marked": "[-## 5. PersonaState Specification-]"
  },
  {
   "section": "5. Persona State Specification",
   "old": null,
   "new": "## 5. Persona State Specification",
   "marked": "{+## 5. Persona State Specification+}"
  },
  {
   "section": "5. Persona State Specification",
   "old": "`PersonaState` is a structured, versioned, non-evictable object injected as Tier 1 content every turn. It encodes Identity Statements, Hard Rules (binary constraints), Traits, Voice Markers, and Humor Calibration. The `humor` field is typed as `HumorCalibration` and consumed directly by Humor Embeddings's `createLimbicRuntime()` (Serra, 2026d). See Appendix A for the full schema.",
   "new": "The persona is a structured, versioned, non-evictable object injected as Tier 1 content every turn. It encodes Identity Statements, Hard Rules (binary constraints), Traits, Voice Markers, and Humor Calibration. The humor field is a typed `HumorCalibration` structure consumed directly by the humor/affect layer (Serra, 2026d). See Appendix A for the full schema.",
   "marked": "[-`PersonaState`-] {+The persona+} is a structured, versioned, non-evictable object injected as Tier 1 content every turn. It encodes Identity Statements, Hard Rules (binary constraints), Traits, Voice Markers, and Humor Calibration. The [-`humor`-] {+humor+} field is {+a+} typed [-as-] `HumorCalibration` [-and-] {+structure+} consumed directly by [-Humor Embeddings's `createLimbicRuntime()`-] {+the humor/affect layer+} (Serra, 2026d). See Appendix A for the full schema."
  },
  {
   "section": "5.1 The Self-Improvement Loop",
   "old": "\\begin{figure}[H] \\centering \\begin{tikzpicture}[ node distance=2.6cm and 4.2cm, box/.style={draw=serraBorder, fill=serraSurface, rounded corners=2pt, align=center, font=\\small, inner sep=6pt, text width=4.2cm}, arr/.style={-{Stealth[length=2.2mm]}, thick, draw=serraAccent} ] \\node[box] (rewrite) {reflection layer\\\\rewrites \\texttt{SOUL.md}}; \\node[box, right=of rewrite] (reload) {\\texttt{PersonaState}\\\\reloads the edits}; \\node[box, below=of reload] (behave) {agent behaves under\\\\the new persona}; \\node[box, below=of rewrite] (observe) {observes results};",
   "new": null,
   "marked": "[-\\begin{figure}[H] \\centering \\begin{tikzpicture}[ node distance=2.6cm and 4.2cm, box/.style={draw=serraBorder, fill=serraSurface, rounded corners=2pt, align=center, font=\\small, inner sep=6pt, text width=4.2cm}, arr/.style={-{Stealth[length=2.2mm]}, thick, draw=serraAccent} ] \\node[box] (rewrite) {reflection layer\\\\rewrites \\texttt{SOUL.md}}; \\node[box, right=of rewrite] (reload) {\\texttt{PersonaState}\\\\reloads the edits}; \\node[box, below=of reload] (behave) {agent behaves under\\\\the new persona}; \\node[box, below=of rewrite] (observe) {observes results};-]"
  },
  {
   "section": "5.1 The Self-Improvement Loop",
   "old": "\\draw[arr] (rewrite) -- (reload); \\draw[arr] (reload) -- (behave); \\draw[arr] (behave) -- (observe); \\draw[arr] (observe) -- (rewrite); \\end{tikzpicture} \\caption{The persona self-improvement loop. A slow offline reflection cycle edits \\texttt{SOUL.md}; Identity Persistence reloads and enforces the new persona every turn, and the observed results feed the next reflection cycle.} \\label{fig:selfimprovement} \\end{figure}",
   "new": "![The persona self-improvement loop: a slow offline reflection cycle edits SOUL.md; Identity Persistence reloads and enforces the new persona every turn, and observed results feed the next reflection cycle.](images/selfimprovement.png)",
   "marked": "[-\\draw[arr] (rewrite) -- (reload); \\draw[arr] (reload) -- (behave); \\draw[arr] (behave) -- (observe); \\draw[arr] (observe) -- (rewrite); \\end{tikzpicture} \\caption{The-] {+![The+} persona self-improvement [-loop. A-] {+loop: a+} slow offline reflection cycle edits [-\\texttt{SOUL.md};-] {+SOUL.md;+} Identity Persistence reloads and enforces the new persona every turn, and [-the-] observed results feed the next reflection [-cycle.} \\label{fig:selfimprovement} \\end{figure}-] {+cycle.](images/selfimprovement.png)+}"
  },
  {
   "section": "5.1 The Self-Improvement Loop",
   "old": "The division of labor is deliberate. The reflection layer changes *what the persona is* (slow, offline, reviewed); Identity Persistence enforces *that the persona is present and consistent* (fast, every turn, automatic). Because PersonaState is loaded from disk at session start via `loadLatestPersonaState()`, an overnight edit takes effect on the next session with no redeployment — persona evolution and persona enforcement stay cleanly separated. This loop is also the reason the human-readable `SOUL.md` format matters beyond auditability: it is the shared write target that lets one system improve the identity another system protects.",
   "new": "The division of labor is deliberate. The reflection layer changes *what the persona is* (slow, offline, reviewed); Identity Persistence enforces *that the persona is present and consistent* (fast, every turn, automatic). Because the persona is loaded from disk at session start, an overnight edit takes effect on the next session with no redeployment — persona evolution and persona enforcement stay cleanly separated. This loop is also the reason the human-readable `SOUL.md` format matters beyond auditability: it is the shared write target that lets one system improve the identity another system protects.",
   "marked": "The division of labor is deliberate. The reflection layer changes *what the persona is* (slow, offline, reviewed); Identity Persistence enforces *that the persona is present and consistent* (fast, every turn, automatic). Because [-PersonaState-] {+the persona+} is loaded from disk at session [-start via `loadLatestPersonaState()`,-] {+start,+} an overnight edit takes effect on the next session with no redeployment — persona evolution and persona enforcement stay cleanly separated. This loop is also the reason the human-readable `SOUL.md` format matters beyond auditability: it is the shared write target that lets one system improve the identity another system protects."
  },
  {
   "section": "5.2 Behavioral Probes",
   "old": "1. _Hard-Rule Audit_: Cheap model, every turn (cost ~$0.0001$). 2. _Style Consistency_: Voice markers checked against reference samples every 5 turns. 3. _Full Persona Audit_: Deep trait reasoning every 20 turns. Amortized total probe cost: roughly $\\$0.00035/\\text{turn}$.",
   "new": "1. _Hard-Rule Audit_: Cheap model, every turn (cost ~$0.0001$). 2. _Style Consistency_: Voice markers checked against reference samples every 5 turns. 3. _Full Persona Audit_: Deep trait reasoning every 20 turns.",
   "marked": "1. _Hard-Rule Audit_: Cheap model, every turn (cost ~$0.0001$). 2. _Style Consistency_: Voice markers checked against reference samples every 5 turns. 3. _Full Persona Audit_: Deep trait reasoning every 20 [-turns. Amortized total probe cost: roughly $\\$0.00035/\\text{turn}$.-] {+turns.+}"
  },
  {
   "section": "5.2 Behavioral Probes",
   "old": null,
   "new": "Amortized total probe cost: roughly $\\$0.00035/\\text{turn}$.",
   "marked": "{+Amortized total probe cost: roughly $\\$0.00035/\\text{turn}$.+}"
  },
  {
   "section": "7.2 Persona Stability Benchmark: 50-Turn SyncScore",
   "old": "SyncScore is the system's single health metric for identity. *It measures consistency the way a tuning fork tests pitch: strike it against the agent's behavior at any turn, and the resonance tells you whether it is still in character.* The Phase 6.3 stability benchmark ran against the JarvisOne persona specification using 50 turns of on-persona response fixtures spanning 10 distinct topic domains. At each turn $t$, the composite SyncScore was computed as:",
   "new": "SyncScore is the system's single health metric for identity. *It measures consistency the way a tuning fork tests pitch: strike it against the agent's behavior at any turn, and the resonance tells you whether it is still in character.* The stability benchmark ran against a reference persona specification using 50 turns of on-persona response fixtures spanning 10 distinct topic domains. At each turn $t$, the composite SyncScore was computed as:",
   "marked": "SyncScore is the system's single health metric for identity. *It measures consistency the way a tuning fork tests pitch: strike it against the agent's behavior at any turn, and the resonance tells you whether it is still in character.* The [-Phase 6.3-] stability benchmark ran against [-the JarvisOne-] {+a reference+} persona specification using 50 turns of on-persona response fixtures spanning 10 distinct topic domains. At each turn $t$, the composite SyncScore was computed as:"
  },
  {
   "section": "7.5 Real-World Evaluation on Production Logs",
   "old": "**Human-annotated evaluation.** Three judges independently rated persona consistency on a 1–5 scale across 30 production OpenClaw logs, evaluating responses before and after drift perturbations. Inter-rater reliability was strong (Krippendorff's α = 0.81). Identity Persistence maintained an average consistency score of $4.2 \\pm 0.4$, compared to $2.6 \\pm 0.7$ for baseline. The false positive rate for intervention was 3.5%.",
   "new": "**Human-annotated evaluation.** Three judges independently rated persona consistency on a 1–5 scale across 30 production logs, evaluating responses before and after drift perturbations. Inter-rater reliability was strong (Krippendorff's α = 0.81). Identity Persistence maintained an average consistency score of $4.2 \\pm 0.4$, compared to $2.6 \\pm 0.7$ for baseline. The false positive rate for intervention was 3.5%.",
   "marked": "**Human-annotated evaluation.** Three judges independently rated persona consistency on a 1–5 scale across 30 production [-OpenClaw-] logs, evaluating responses before and after drift perturbations. Inter-rater reliability was strong (Krippendorff's α = 0.81). Identity Persistence maintained an average consistency score of $4.2 \\pm 0.4$, compared to $2.6 \\pm 0.7$ for baseline. The false positive rate for intervention was 3.5%."
  },
  {
   "section": "7.7 Phase 6.2 Full Test Suite Statistics",
   "old": "### 7.7 Phase 6.2 Full Test Suite Statistics",
   "new": null,
   "marked": "[-### 7.7 Phase 6.2 Full Test Suite Statistics-]"
  },
  {
   "section": "7.7 Phase 6.2 Full Test Suite Statistics",
   "old": "The Phase 6.2 validation run (2026-02-24T07:50:00+01:00, Vitest v4.0.18) provides aggregate implementation-correctness statistics.",
   "new": null,
   "marked": "[-The Phase 6.2 validation run (2026-02-24T07:50:00+01:00, Vitest v4.0.18) provides aggregate implementation-correctness statistics.-]"
  },
  {
   "section": "7.7 Phase 6.2 Full Test Suite Statistics",
   "old": "**Table 9.** Full test suite summary.",
   "new": null,
   "marked": "[-**Table 9.** Full test suite summary.-]"
  },
  {
   "section": "7.7 Phase 6.2 Full Test Suite Statistics",
   "old": "| Metric | Value | | -------------------------- | ------------------------ | | Total tests (src + mirror) | 368 | | Passed | **368** | | Failed | **0** | | Pass rate | **100%** | | Total execution time | 1,590 ms | | Test files | 12 (6 source + 6 mirror) |",
   "new": null,
   "marked": "[-| Metric | Value | | -------------------------- | ------------------------ | | Total tests (src + mirror) | 368 | | Passed | **368** | | Failed | **0** | | Pass rate | **100%** | | Total execution time | 1,590 ms | | Test files | 12 (6 source + 6 mirror) |-]"
  },
  {
   "section": "7.7 Phase 6.2 Full Test Suite Statistics",
   "old": "**Table 10.** Per-file breakdown (source files only).",
   "new": null,
   "marked": "[-**Table 10.** Per-file breakdown (source files only).-]"
  },
  {
   "section": "7.7 Phase 6.2 Full Test Suite Statistics",
   "old": "| Test file | Tests | Passed | Duration (ms) | | ---------------------------------------- | ------- | ------- | ------------- | | identity-persistence.test.ts | 41 | 41 | 20 | | identity-persistence-integration.test.ts | 20 | 20 | 25 | | identity-persistence-benchmark.test.ts | 3 | 3 | 14 | | mid-context-reinject.test.ts | 19 | 19 | 25 | | sync-score.test.ts | 26 | 26 | 38 | | phase5.test.ts | 75 | 75 | 43 | | **Total (source-only)** | **184** | **184** | **165** |",
   "new": null,
   "marked": "[-| Test file | Tests | Passed | Duration (ms) | | ---------------------------------------- | ------- | ------- | ------------- | | identity-persistence.test.ts | 41 | 41 | 20 | | identity-persistence-integration.test.ts | 20 | 20 | 25 | | identity-persistence-benchmark.test.ts | 3 | 3 | 14 | | mid-context-reinject.test.ts | 19 | 19 | 25 | | sync-score.test.ts | 26 | 26 | 38 | | phase5.test.ts | 75 | 75 | 43 | | **Total (source-only)** | **184** | **184** | **165** |-]"
  },
  {
   "section": "7.7 Phase 6.2 Full Test Suite Statistics",
   "old": "Key coverage: `identity-persistence-benchmark.test.ts` exercises SyncScore computation, drift detection, and recovery code paths (§7.2–§7.3); `sync-score.test.ts` covers the full SyncScore formula including EWMA accumulation; `phase5.test.ts` covers priority-aware injection and IPC logic (§4.1–§4.2); `mid-context-reinject.test.ts` validates re-injection after severe drift.",
   "new": null,
   "marked": "[-Key coverage: `identity-persistence-benchmark.test.ts` exercises SyncScore computation, drift detection, and recovery code paths (§7.2–§7.3); `sync-score.test.ts` covers the full SyncScore formula including EWMA accumulation; `phase5.test.ts` covers priority-aware injection and IPC logic (§4.1–§4.2); `mid-context-reinject.test.ts` validates re-injection after severe drift.-]"
  },
  {
   "section": "7.7 Phase 6.2 Full Test Suite Statistics",
   "old": "Combined with component-fixture benchmarks (§7.2–§7.4) and human-judged evaluation (§7.5), three independent validation layers support the claims in §12.1.",
   "new": null,
   "marked": "[-Combined with component-fixture benchmarks (§7.2–§7.4) and human-judged evaluation (§7.5), three independent validation layers support the claims in §12.1.-]"
  },
  {
   "section": "8.1 Source Files and Line Counts",
   "old": "### 8.1 Source Files and Line Counts",
   "new": null,
   "marked": "[-### 8.1 Source Files and Line Counts-]"
  },
  {
   "section": "8.1 Source Files and Line Counts",
   "old": "Identity Persistence is implemented in TypeScript (ESM, Node 22+) using Vitest for testing.",
   "new": null,
   "marked": "[-Identity Persistence is implemented in TypeScript (ESM, Node 22+) using Vitest for testing.-]"
  },
  {
   "section": "8.1 Source Files and Line Counts",
   "old": "**Core module (`src/memory/identity-persistence/`):**",
   "new": null,
   "marked": "[-**Core module (`src/memory/identity-persistence/`):**-]"
  },
  {
   "section": "8.1 Source Files and Line Counts",
   "old": "| File | LOC | Role | | ------------------------ | --------- | ----------------------------------------------------------------------- | | `persona-state.ts` | 296 | `PersonaState` schema, validation, serialization, SOUL.md I/O | | `drift-detection.ts` | 206 | EWMA accumulator, `detectUserCorrections()`, `computeAdaptiveWeights()` | | `behavioral-probes.ts` | 301 | Three-tier probe schedule, `aggregateProbeScores()` | | `priority-injection.ts` | 229 | Tiered selection, context budget enforcement | | `consistency-metric.ts` | 235 | Consistency metric $C$, `classifyAction()` | | `convergence-monitor.ts` | 204 | Lyapunov convergence monitor, EWMA state machine | | `voice-markers.ts` | 338 | $E_\\phi$ feature space, voice marker extraction | | **Subtotal (core)** | **1,809** | |",
   "new": null,
   "marked": "[-| File | LOC | Role | | ------------------------ | --------- | ----------------------------------------------------------------------- | | `persona-state.ts` | 296 | `PersonaState` schema, validation, serialization, SOUL.md I/O | | `drift-detection.ts` | 206 | EWMA accumulator, `detectUserCorrections()`, `computeAdaptiveWeights()` | | `behavioral-probes.ts` | 301 | Three-tier probe schedule, `aggregateProbeScores()` | | `priority-injection.ts` | 229 | Tiered selection, context budget enforcement | | `consistency-metric.ts` | 235 | Consistency metric $C$, `classifyAction()` | | `convergence-monitor.ts` | 204 | Lyapunov convergence monitor, EWMA state machine | | `voice-markers.ts` | 338 | $E_\\phi$ feature space, voice marker extraction | | **Subtotal (core)** | **1,809** | |-]"
  },
  {
   "section": "8.1 Source Files and Line Counts",
   "old": "**Runtime extension (`src/agents/pi-extensions/`):**",
   "new": null,
   "marked": "[-**Runtime extension (`src/agents/pi-extensions/`):**-]"
  },
  {
   "section": "8.1 Source Files and Line Counts",
   "old": "| File | LOC | Role | | --------------------------------- | ------- | ------------------------------------------------------------------ | | `identity-persistence-runtime.ts` | 404 | Session-scoped runtime: loads `PersonaState`, wires SyncScore loop | | **Subtotal (runtime)** | **404** | |",
   "new": null,
   "marked": "[-| File | LOC | Role | | --------------------------------- | ------- | ------------------------------------------------------------------ | | `identity-persistence-runtime.ts` | 404 | Session-scoped runtime: loads `PersonaState`, wires SyncScore loop | | **Subtotal (runtime)** | **404** | |-]"
  },
  {
   "section": "8.1 Source Files and Line Counts",
   "old": "**Test files (`src/memory/identity-persistence/`):**",
   "new": null,
   "marked": "[-**Test files (`src/memory/identity-persistence/`):**-]"
  },
  {
   "section": "8.1 Source Files and Line Counts",
   "old": "| File | LOC | Role | | ------------------------------------------ | --------- | ------------------------------------------------- | | `identity-persistence.test.ts` | 424 | Unit tests for core components | | `identity-persistence-integration.test.ts` | 306 | Integration tests across modules | | `identity-persistence-benchmark.test.ts` | 298 | SyncScore stability and drift recovery benchmarks | | `mid-context-reinject.test.ts` | 446 | Mid-context re-injection scenarios | | `sync-score.test.ts` | 442 | Full SyncScore formula coverage | | `phase5.test.ts` | 845 | Priority injection and IPC coverage | | **Subtotal (tests)** | **2,761** | |",
   "new": null,
   "marked": "[-| File | LOC | Role | | ------------------------------------------ | --------- | ------------------------------------------------- | | `identity-persistence.test.ts` | 424 | Unit tests for core components | | `identity-persistence-integration.test.ts` | 306 | Integration tests across modules | | `identity-persistence-benchmark.test.ts` | 298 | SyncScore stability and drift recovery benchmarks | | `mid-context-reinject.test.ts` | 446 | Mid-context re-injection scenarios | | `sync-score.test.ts` | 442 | Full SyncScore formula coverage | | `phase5.test.ts` | 845 | Priority injection and IPC coverage | | **Subtotal (tests)** | **2,761** | |-]"
  },
  {
   "section": "8.1 Source Files and Line Counts",
   "old": "**Grand total: 4,974 LOC across 14 files.**",
   "new": null,
   "marked": "[-**Grand total: 4,974 LOC across 14 files.**-]"
  },
  {
   "section": "8.2 Key Commits",
   "old": "### 8.2 Key Commits",
   "new": null,
   "marked": "[-### 8.2 Key Commits-]"
  },
  {
   "section": "8.2 Key Commits",
   "old": "| Commit | Message | | --------- | ---------------------------------------------------------------------------------------------------- | | `6dd80ce` | `identity-persistence: inject PersonaState from SOUL.md into system prompt` | | `47d3b72` | `identity-persistence: SyncScore automation with EWMA drift detection` | | `08a4f3d` | `identity-persistence: mid-context re-injection and observational memory` | | `fdf0132` | `feat(identity-persistence): wire persona state, SyncScore, and observation extraction into runtime` | | `7a467d2` | `bench(identity-persistence): persona stability and drift recovery benchmark` |",
   "new": null,
   "marked": "[-| Commit | Message | | --------- | ---------------------------------------------------------------------------------------------------- | | `6dd80ce` | `identity-persistence: inject PersonaState from SOUL.md into system prompt` | | `47d3b72` | `identity-persistence: SyncScore automation with EWMA drift detection` | | `08a4f3d` | `identity-persistence: mid-context re-injection and observational memory` | | `fdf0132` | `feat(identity-persistence): wire persona state, SyncScore, and observation extraction into runtime` | | `7a467d2` | `bench(identity-persistence): persona stability and drift recovery benchmark` |-]"
  },
  {
   "section": "8.3 Architecture and Data Flow",
   "old": "### 8.3 Architecture and Data Flow",
   "new": null,
   "marked": "[-### 8.3 Architecture and Data Flow-]"
  },
  {
   "section": "8.3 Architecture and Data Flow",
   "old": "\\begin{figure}[H] \\centering \\resizebox{\\linewidth}{!}{% \\begin{tikzpicture}[ font=\\small, store/.style={draw=serraBorder, fill=serraSurface, rounded corners=2pt, align=center, inner sep=6pt, font=\\bfseries\\small}, rt/.style={draw=serraAccent, fill=serraSurface, rounded corners=2pt, align=center, inner sep=6pt, font=\\bfseries\\small}, mod/.style={draw=serraBorder, fill=white, rounded corners=1pt, align=left, inner sep=4pt, font=\\footnotesize, text width=7.2cm}, note/.style={draw=serraSection, fill=serraSurface, rounded corners=1pt, align=left, inner sep=4pt, font=\\footnotesize, text width=9.6cm}, arr/.style={-{Stealth[length=2mm]}, thick, draw=serraAccent} ] \\node[store] (store) {\\texttt{SOUL.md} / \\texttt{PersonaState} store}; \\node[rt, below=0.9cm of store] (rt) {\\texttt{identity-persistence-runtime.ts}\\\\(session entry point)};",
   "new": null,
   "marked": "[-\\begin{figure}[H] \\centering \\resizebox{\\linewidth}{!}{% \\begin{tikzpicture}[ font=\\small, store/.style={draw=serraBorder, fill=serraSurface, rounded corners=2pt, align=center, inner sep=6pt, font=\\bfseries\\small}, rt/.style={draw=serraAccent, fill=serraSurface, rounded corners=2pt, align=center, inner sep=6pt, font=\\bfseries\\small}, mod/.style={draw=serraBorder, fill=white, rounded corners=1pt, align=left, inner sep=4pt, font=\\footnotesize, text width=7.2cm}, note/.style={draw=serraSection, fill=serraSurface, rounded corners=1pt, align=left, inner sep=4pt, font=\\footnotesize, text width=9.6cm}, arr/.style={-{Stealth[length=2mm]}, thick, draw=serraAccent} ] \\node[store] (store) {\\texttt{SOUL.md} / \\texttt{PersonaState} store}; \\node[rt, below=0.9cm of store] (rt) {\\texttt{identity-persistence-runtime.ts}\\\\(session entry point)};-]"
  },
  {
   "section": "8.3 Architecture and Data Flow",
   "old": "\\node[mod, below=0.7cm of rt] (m1) {% \\texttt{loadLatestPersonaState()} \\;$\\leftarrow$\\; \\texttt{persona-state.ts}\\\\ \\texttt{PriorityInjector} \\;$\\leftarrow$\\; \\texttt{priority-injection.ts} (Tier 1 pinned)\\\\ \\texttt{EWMA DriftDetector} \\;$\\leftarrow$\\; \\texttt{drift-detection.ts}\\\\ \\quad\\texttt{detectUserCorrections()}, \\texttt{computeAdaptiveWeights()}\\\\ \\texttt{BehavioralProbes} \\;$\\leftarrow$\\; \\texttt{behavioral-probes.ts} (async, 3-tier)\\\\ \\texttt{ConsistencyMetric C} \\;$\\leftarrow$\\; \\texttt{consistency-metric.ts} $\\to$ \\texttt{classifyAction()}\\\\ \\texttt{VoiceMarkers} $E_\\phi$ \\;$\\leftarrow$\\; \\texttt{voice-markers.ts}\\\\ \\texttt{ConvergenceMonitor} \\;$\\leftarrow$\\; \\texttt{convergence-monitor.ts}\\\\ \\texttt{SyncScore(t)} \\;$\\leftarrow$\\; composite: EWMA + C + $E_\\phi$ proximity};",
   "new": null,
   "marked": "[-\\node[mod, below=0.7cm of rt] (m1) {% \\texttt{loadLatestPersonaState()} \\;$\\leftarrow$\\; \\texttt{persona-state.ts}\\\\ \\texttt{PriorityInjector} \\;$\\leftarrow$\\; \\texttt{priority-injection.ts} (Tier 1 pinned)\\\\ \\texttt{EWMA DriftDetector} \\;$\\leftarrow$\\; \\texttt{drift-detection.ts}\\\\ \\quad\\texttt{detectUserCorrections()}, \\texttt{computeAdaptiveWeights()}\\\\ \\texttt{BehavioralProbes} \\;$\\leftarrow$\\; \\texttt{behavioral-probes.ts} (async, 3-tier)\\\\ \\texttt{ConsistencyMetric C} \\;$\\leftarrow$\\; \\texttt{consistency-metric.ts} $\\to$ \\texttt{classifyAction()}\\\\ \\texttt{VoiceMarkers} $E_\\phi$ \\;$\\leftarrow$\\; \\texttt{voice-markers.ts}\\\\ \\texttt{ConvergenceMonitor} \\;$\\leftarrow$\\; \\texttt{convergence-monitor.ts}\\\\ \\texttt{SyncScore(t)} \\;$\\leftarrow$\\; composite: EWMA + C + $E_\\phi$ proximity};-]"
  },
  {
   "section": "8.3 Architecture and Data Flow",
   "old": "\\node[note, below=0.7cm of m1] (n1) {% On severe drift $\\to$ mid-context re-injection (\\texttt{PersonaState} Tier 1 forced)\\\\ On compaction $\\to$ IPC dual-track (Total Recall factual + persona-preservation)\\\\ \\texttt{HumorCalibration} field $\\to$ Humor Embeddings \\texttt{createLimbicRuntime()}};",
   "new": null,
   "marked": "[-\\node[note, below=0.7cm of m1] (n1) {% On severe drift $\\to$ mid-context re-injection (\\texttt{PersonaState} Tier 1 forced)\\\\ On compaction $\\to$ IPC dual-track (Total Recall factual + persona-preservation)\\\\ \\texttt{HumorCalibration} field $\\to$ Humor Embeddings \\texttt{createLimbicRuntime()}};-]"
  },
  {
   "section": "8.3 Architecture and Data Flow",
   "old": "\\draw[arr] (store) -- (rt); \\draw[arr] (rt) -- (m1); \\end{tikzpicture}% } \\caption{Identity Persistence architecture and data flow. The persona store feeds the session-entry runtime, which composes the drift, consistency, voice-marker, and convergence modules into a single \\texttt{SyncScore}; severe drift, compaction, and humor-calibration events trigger the listed cross-module hooks.} \\label{fig:architecture} \\end{figure}",
   "new": null,
   "marked": "[-\\draw[arr] (store) -- (rt); \\draw[arr] (rt) -- (m1); \\end{tikzpicture}% } \\caption{Identity Persistence architecture and data flow. The persona store feeds the session-entry runtime, which composes the drift, consistency, voice-marker, and convergence modules into a single \\texttt{SyncScore}; severe drift, compaction, and humor-calibration events trigger the listed cross-module hooks.} \\label{fig:architecture} \\end{figure}-]"
  },
  {
   "section": "8. Implementation",
   "old": null,
   "new": "Identity Persistence is implemented as a self-contained module in TypeScript (ESM, Node 22+), with Vitest covering the core components. The module decomposes into seven cooperating units — persona-state schema and SOUL.md loading, priority-aware injection, two-signal drift detection, the three-tier behavioral probes, the voice-marker $E_\\phi$ feature space, the consistency metric and its action classifier, and a convergence monitor — wired together by a session-scoped runtime that loads the persona once per session and recomputes SyncScore after every turn. A separate observation pass extracts persona signals during compaction for the IPC track. The full schema and the two core algorithms (IPC dual-track compaction and $E_\\phi$ computation) appear in Appendices A–C as language-agnostic pseudocode; the body deliberately avoids repository-specific paths so the design reads independently of any one codebase.",
   "marked": "{+Identity Persistence is implemented as a self-contained module in TypeScript (ESM, Node 22+), with Vitest covering the core components. The module decomposes into seven cooperating units — persona-state schema and SOUL.md loading, priority-aware injection, two-signal drift detection, the three-tier behavioral probes, the voice-marker $E_\\phi$ feature space, the consistency metric and its action classifier, and a convergence monitor — wired together by a session-scoped runtime that loads the persona once per session and recomputes SyncScore after every turn. A separate observation pass extracts persona signals during compaction for the IPC track. The full schema and the two core algorithms (IPC dual-track compaction and $E_\\phi$ computation) appear in Appendices A–C as language-agnostic pseudocode; the body deliberately avoids repository-specific paths so the design reads independently of any one codebase.+}"
  },
  {
   "section": "8. Implementation",
   "old": null,
   "new": "The action classifier maps the consistency metric onto four escalating responses — `none`, `mild_reinforce`, `moderate_refresh`, and `severe_rebase` — with `severe_rebase` reserved for the full persona re-injection used after catastrophic drift and model switches (§4.4). The complete test suite passes; we report magnitudes rather than a frozen count, since both grow as the module evolves.",
   "marked": "{+The action classifier maps the consistency metric onto four escalating responses — `none`, `mild_reinforce`, `moderate_refresh`, and `severe_rebase` — with `severe_rebase` reserved for the full persona re-injection used after catastrophic drift and model switches (§4.4). The complete test suite passes; we report magnitudes rather than a frozen count, since both grow as the module evolves.+}"
  },
  {
   "section": "8.1 Cross-Module Dependencies",
   "old": "### 8.4 Cross-Module Dependencies",
   "new": "### 8.1 Cross-Module Dependencies",
   "marked": "### [-8.4-] {+8.1+} Cross-Module Dependencies"
  },
  {
   "section": "8.1 Cross-Module Dependencies",
   "old": "| Dependency | Direction | Interface | | ----------------------------------- | ------------- | --------------------------------------------- | | **Total Recall** (Serra, 2026a) | Consumes | `engram_compact()` for factual track of IPC | | **Instant Recall** (Serra, 2026b) | Consumes | Tier 3 retrieval chunks injected after Tier 1 | | **Humor Embeddings** (Serra, 2026d) | Exposes | `PersonaState.humor: HumorCalibration` | | **Round Table** (Serra, 2026e) | Orchestration | Routes SyncScore events and drift alerts | | **Reflection Layer** (Serra, 2026c) | Upstream | Rewrites `SOUL.md`; reloaded via `loadLatestPersonaState()` (§5.1) |",
   "new": "| Dependency | Direction | Interface | | ----------------------------------- | ------------- | -------------------------------------------------- | | **Total Recall** (Serra, 2026a) | Consumes | Compaction primitive for the factual track of IPC | | **Instant Recall** (Serra, 2026b) | Consumes | Tier 3 retrieval chunks injected after Tier 1 | | **Humor Embeddings** (Serra, 2026d) | Exposes | Persona `humor` field typed as `HumorCalibration` | | **Round Table** (Serra, 2026e) | Orchestration | Routes SyncScore events and drift alerts | | **Reflection Layer** (Serra, 2026c) | Upstream | Rewrites `SOUL.md`; reloaded at session start (§5.1) |",
   "marked": "| Dependency | Direction | Interface | | ----------------------------------- | ------------- | [-----------------------------------------------] {+--------------------------------------------------+} | | **Total Recall** (Serra, 2026a) | Consumes | [-`engram_compact()`-] {+Compaction primitive+} for {+the+} factual track of IPC | | **Instant Recall** (Serra, 2026b) | Consumes | Tier 3 retrieval chunks injected after Tier 1 | | **Humor Embeddings** (Serra, 2026d) | Exposes | [-`PersonaState.humor: HumorCalibration`-] {+Persona `humor` field typed as `HumorCalibration`+} | | **Round Table** (Serra, 2026e) | Orchestration | Routes SyncScore events and drift alerts | | **Reflection Layer** (Serra, 2026c) | Upstream | Rewrites `SOUL.md`; reloaded [-via `loadLatestPersonaState()`-] {+at session start+} (§5.1) |"
  },
  {
   "section": "9. Computational Cost Analysis",
   "old": "Identity Persistence adds less than 3% overhead to baseline inference costs. Standard model inference costs $\\$0.015\\text{--}\\$0.05$ per turn. The full suite of probes and EWMA loops adds only $\\sim\\$0.00047/\\text{turn}$. **Prompt caching** makes this practical: prefixing the stable 1,200-token `PersonaState` block hits cache >95% of the time, reducing injection costs from $\\$0.006$ to $\\$0.0006/\\text{turn}$.",
   "new": "Identity Persistence adds less than 3% overhead to baseline inference costs. Standard model inference costs $\\$0.015\\text{--}\\$0.05$ per turn. The full suite of probes and EWMA loops adds only $\\sim\\$0.00047/\\text{turn}$. **Prompt caching** makes this practical: prefixing the stable 1,200-token persona block hits cache >95% of the time, reducing injection costs from $\\$0.006$ to $\\$0.0006/\\text{turn}$.",
   "marked": "Identity Persistence adds less than 3% overhead to baseline inference costs. Standard model inference costs $\\$0.015\\text{--}\\$0.05$ per turn. The full suite of probes and EWMA loops adds only $\\sim\\$0.00047/\\text{turn}$. **Prompt caching** makes this practical: prefixing the stable 1,200-token [-`PersonaState`-] {+persona+} block hits cache >95% of the time, reducing injection costs from $\\$0.006$ to $\\$0.0006/\\text{turn}$."
  },
  {
   "section": "9. Computational Cost Analysis",
   "old": "We will release IPC and probe code under MIT licence together with anonymised evaluation traces.",
   "new": "We will release the IPC and probe code under an MIT licence together with anonymised evaluation traces.",
   "marked": "We will release {+the+} IPC and probe code under {+an+} MIT licence together with anonymised evaluation traces."
  },
  {
   "section": "10. Comparison to Existing Approaches",
   "old": "However, we note key architectural differences that favor the inference-time approach for persistent agents: (1) fine-tuned personas are frozen at training time and cannot adapt to evolving user relationships; (2) weight-space interventions require separate model variants per persona; (3) none of the training-time approaches include drift detection or recovery mechanisms. A controlled comparison using a shared evaluation protocol is planned for future work (§12.2).",
   "new": "We note key architectural differences that favor the inference-time approach for persistent agents: (1) fine-tuned personas are frozen at training time and cannot adapt to evolving user relationships; (2) weight-space interventions require separate model variants per persona; (3) none of the training-time approaches include drift detection or recovery mechanisms. A controlled comparison using a shared evaluation protocol is planned for future work (§12.2).",
   "marked": "[-However, we-] {+We+} note key architectural differences that favor the inference-time approach for persistent agents: (1) fine-tuned personas are frozen at training time and cannot adapt to evolving user relationships; (2) weight-space interventions require separate model variants per persona; (3) none of the training-time approaches include drift detection or recovery mechanisms. A controlled comparison using a shared evaluation protocol is planned for future work (§12.2)."
  },
  {
   "section": "11.3 Single-Persona Scope and the Path to Multi-Agent Identity",
   "old": "The first is *multi-persona routing within one instance* — an agent that adopts different registers for different users. This requires only per-user PersonaState selection in front of the existing injection policy; the enforcement machinery is unchanged.",
   "new": "The first is *multi-persona routing within one instance* — an agent that adopts different registers for different users. This requires only per-user persona selection in front of the existing injection policy; the enforcement machinery is unchanged.",
   "marked": "The first is *multi-persona routing within one instance* — an agent that adopts different registers for different users. This requires only per-user [-PersonaState-] {+persona+} selection in front of the existing injection policy; the enforcement machinery is unchanged."
  },
  {
   "section": "11.3 Single-Persona Scope and the Path to Multi-Agent Identity",
   "old": "The second is more consequential: *multiple distinct agent identities running side by side*. A multi-agent system in which, say, one agent presents as \"Agent A / LUNA\" and another as \"Agent B / ATLAS\" needs each identity to stay separable and individually stable — exactly the guarantee this system already provides for one persona. Because PersonaState is a self-contained, model-external object keyed by agent, scaling from one identity to many is primarily a matter of namespacing the persona store and the SyncScore loop per agent, not redesigning the mechanism. The hard open question is *interference*: when several personas share an underlying model and memory substrate, does one agent's voice bleed into another's under compaction or fallback? Measuring and bounding cross-identity contamination is the natural bridge from this work to a multi-agent identity layer, and we leave its evaluation to future work.",
   "new": "The second is more consequential: *multiple distinct agent identities running side by side*. A multi-agent system in which, say, one agent presents as \"Agent A / LUNA\" and another as \"Agent B / ATLAS\" needs each identity to stay separable and individually stable — exactly the guarantee this system already provides for one persona. Because the persona is a self-contained, model-external object keyed by agent, scaling from one identity to many is primarily a matter of namespacing the persona store and the SyncScore loop per agent, not redesigning the mechanism. The hard open question is *interference*: when several personas share an underlying model and memory substrate, does one agent's voice bleed into another's under compaction or fallback? Measuring and bounding cross-identity contamination is the natural bridge from this work to a multi-agent identity layer, and we leave its evaluation to future work.",
   "marked": "The second is more consequential: *multiple distinct agent identities running side by side*. A multi-agent system in which, say, one agent presents as \"Agent A / LUNA\" and another as \"Agent B / ATLAS\" needs each identity to stay separable and individually stable — exactly the guarantee this system already provides for one persona. Because [-PersonaState-] {+the persona+} is a self-contained, model-external object keyed by agent, scaling from one identity to many is primarily a matter of namespacing the persona store and the SyncScore loop per agent, not redesigning the mechanism. The hard open question is *interference*: when several personas share an underlying model and memory substrate, does one agent's voice bleed into another's under compaction or fallback? Measuring and bounding cross-identity contamination is the natural bridge from this work to a multi-agent identity layer, and we leave its evaluation to future work."
  },
  {
   "section": "11.4 Error Analysis: When Does Identity Persistence Fail?",
   "old": "1. **Catastrophic model substitution.** When the underlying model changes to one with fundamentally different style priors (e.g., a model that ignores system prompts), the linear correction model saturates. The `severe_rebase` fallback handles this, but recovery takes 5–8 turns rather than 2. 2. **Adversarial user steering.** A user who deliberately and persistently pushes the agent off-persona can overwhelm the correction mechanism if their inputs are misclassified as legitimate $S_u$ signals. In testing, sustained adversarial pressure over >10 turns with correction-framing language caused SyncScore to drop below 0.6 before the system stabilized. Rate-limiting user correction weight mitigates but does not eliminate this attack surface. 3. **Persona specification ambiguity.** Vague or contradictory entries in `PersonaState` (e.g., \"be formal\" alongside \"use slang freely\") produce oscillating SyncScores as the system alternately satisfies each constraint. The architecture correctly detects drift but cannot resolve specification conflicts.",
   "new": "1. **Catastrophic model substitution.** When the underlying model changes to one with fundamentally different style priors (e.g., a model that ignores system prompts), the linear correction model saturates. The `severe_rebase` fallback handles this, but recovery takes 5–8 turns rather than 2. 2. **Adversarial user steering.** A user who deliberately and persistently pushes the agent off-persona can overwhelm the correction mechanism if their inputs are misclassified as legitimate $S_u$ signals. In testing, sustained adversarial pressure over >10 turns with correction-framing language caused SyncScore to drop below 0.6 before the system stabilized. Rate-limiting user correction weight mitigates but does not eliminate this attack surface. 3. **Persona specification ambiguity.** Vague or contradictory entries in the persona (e.g., \"be formal\" alongside \"use slang freely\") produce oscillating SyncScores as the system alternately satisfies each constraint. The architecture correctly detects drift but cannot resolve specification conflicts.",
   "marked": "1. **Catastrophic model substitution.** When the underlying model changes to one with fundamentally different style priors (e.g., a model that ignores system prompts), the linear correction model saturates. The `severe_rebase` fallback handles this, but recovery takes 5–8 turns rather than 2. 2. **Adversarial user steering.** A user who deliberately and persistently pushes the agent off-persona can overwhelm the correction mechanism if their inputs are misclassified as legitimate $S_u$ signals. In testing, sustained adversarial pressure over >10 turns with correction-framing language caused SyncScore to drop below 0.6 before the system stabilized. Rate-limiting user correction weight mitigates but does not eliminate this attack surface. 3. **Persona specification ambiguity.** Vague or contradictory entries in [-`PersonaState`-] {+the persona+} (e.g., \"be formal\" alongside \"use slang freely\") produce oscillating SyncScores as the system alternately satisfies each constraint. The architecture correctly detects drift but cannot resolve specification conflicts."
  },
  {
   "section": "12.1 Completed Component Benchmarks",
   "old": "The Phase 6.3 test suite (§7.2–§7.4) provides implementation-level empirical evidence:",
   "new": "The component test suite (§7.2–§7.4) provides implementation-level empirical evidence:",
   "marked": "The [-Phase 6.3-] {+component+} test suite (§7.2–§7.4) provides implementation-level empirical evidence:"
  },
  {
   "section": "12.1 Completed Component Benchmarks",
   "old": "| Claim | Benchmark | Result | | ------------------------------------------- | ------------------------ | --------------------------------------- | | Persona stability over extended interaction | 50-turn SyncScore (§7.2) | Mean 0.977, min 0.976 | | Drift detection and recovery | Drift-recovery (§7.3) | 0.027 → 0.980 | | Per-component signal validity | Ablation (§7.4) | $E_\\phi$ 442×; Δ$C$ = 0.57; $w_p$ +0.30 | | Implementation correctness | Phase 6.2 suite (§7.7) | 368/368 passed (100%) | | Real-world consistency | Human-annotated (§7.5) | $4.2 \\pm 0.4$ vs. $2.6 \\pm 0.7$ | | Sustained deployment | Production (§7.5) | 30+ days, hundreds of sessions |",
   "new": "| Claim | Benchmark | Result | | ------------------------------------------- | ------------------------ | --------------------------------------- | | Persona stability over extended interaction | 50-turn SyncScore (§7.2) | Mean 0.977, min 0.976 | | Drift detection and recovery | Drift-recovery (§7.3) | 0.027 → 0.980 | | Per-component signal validity | Ablation (§7.4) | $E_\\phi$ 442×; Δ$C$ = 0.57; $w_p$ +0.30 | | Real-world consistency | Human-annotated (§7.5) | $4.2 \\pm 0.4$ vs. $2.6 \\pm 0.7$ | | Sustained deployment | Production (§7.5) | 30+ days, hundreds of sessions |",
   "marked": "| Claim | Benchmark | Result | | ------------------------------------------- | ------------------------ | --------------------------------------- | | Persona stability over extended interaction | 50-turn SyncScore (§7.2) | Mean 0.977, min 0.976 | | Drift detection and recovery | Drift-recovery (§7.3) | 0.027 → 0.980 | | Per-component signal validity | Ablation (§7.4) | $E_\\phi$ 442×; Δ$C$ = 0.57; $w_p$ +0.30 | | [-Implementation correctness | Phase 6.2 suite (§7.7) | 368/368 passed (100%) | |-] Real-world consistency | Human-annotated (§7.5) | $4.2 \\pm 0.4$ vs. $2.6 \\pm 0.7$ | | Sustained deployment | Production (§7.5) | 30+ days, hundreds of sessions |"
  },
  {
   "section": "12.1 Completed Component Benchmarks",
   "old": "These span five validation layers: theoretical (Theorem 1), implementation (§7.7), component-fixture (§7.2–§7.4), human-judged (§7.5), and ecological (production deployment).",
   "new": "These span five validation layers: theoretical (Theorem 1), implementation (passing test suite), component-fixture (§7.2–§7.4), human-judged (§7.5), and ecological (production deployment).",
   "marked": "These span five validation layers: theoretical (Theorem 1), implementation [-(§7.7),-] {+(passing test suite),+} component-fixture (§7.2–§7.4), human-judged (§7.5), and ecological (production deployment)."
  },
  {
   "section": "13. Ethical Considerations",
   "old": "The architecture is designed for transparent, user-controlled personas. PersonaState is human-readable (stored as `SOUL.md`), editable without technical expertise, and versioned. Users retain full authority over what the agent is. We explicitly do not support covert persona manipulation — the system has no mechanism for hidden personality traits or undisclosed behavioral objectives.",
   "new": "The architecture is designed for transparent, user-controlled personas. The persona is human-readable (stored as `SOUL.md`), editable without technical expertise, and versioned. Users retain full authority over what the agent is. We explicitly do not support covert persona manipulation — the system has no mechanism for hidden personality traits or undisclosed behavioral objectives.",
   "marked": "The architecture is designed for transparent, user-controlled personas. [-PersonaState-] {+The persona+} is human-readable (stored as `SOUL.md`), editable without technical expertise, and versioned. Users retain full authority over what the agent is. We explicitly do not support covert persona manipulation — the system has no mechanism for hidden personality traits or undisclosed behavioral objectives."
  },
  {
   "section": "14. Conclusion",
   "old": "The production implementation — 14 files, 4,974 LOC, 368 tests at 100% — demonstrates that the theory translates to deployable code. Identity Persistence anchors the identity layer of a cognitive stack built on Total Recall and Instant Recall, with Humor Embeddings providing trait-specific generation and Round Table providing cross-session coordination.",
   "new": "Identity Persistence anchors the identity layer of a cognitive stack built on Total Recall and Instant Recall, with Humor Embeddings providing trait-specific generation and Round Table providing cross-session coordination.",
   "marked": "[-The production implementation — 14 files, 4,974 LOC, 368 tests at 100% — demonstrates that the theory translates to deployable code.-] Identity Persistence anchors the identity layer of a cognitive stack built on Total Recall and Instant Recall, with Humor Embeddings providing trait-specific generation and Round Table providing cross-session coordination."
  },
  {
   "section": "A.1 Persona State Schema",
   "old": "### A.1 PersonaState Schema",
   "new": "### A.1 Persona State Schema",
   "marked": "### A.1 [-PersonaState-] {+Persona State+} Schema"
  },
  {
   "section": "A.1 Persona State Schema",
   "old": "```python @dataclass class PersonaState: \"\"\"Core persona specification for a persistent agent.\"\"\" version: int last_updated: datetime name: str identity_statement: str hard_rules: list[HardRule] # Binary constraints traits: list[Trait] # Graded tendencies voice_markers: VoiceMarkers # Stylistic targets relational: RelationalState # User rapport history humor: HumorCalibration # Interface for Humor Embeddings reference_samples: list[str] # E_phi anchors ```",
   "new": "```python @dataclass class PersonaState: \"\"\"Core persona specification for a persistent agent.\"\"\" version: int last_updated: datetime name: str identity_statement: str hard_rules: list[HardRule] # Binary constraints traits: list[Trait] # Graded tendencies voice_markers: VoiceMarkers # Stylistic targets relational: RelationalState # User rapport history humor: HumorCalibration # Interface for the humor/affect layer reference_samples: list[str] # E_phi anchors ```",
   "marked": "```python @dataclass class PersonaState: \"\"\"Core persona specification for a persistent agent.\"\"\" version: int last_updated: datetime name: str identity_statement: str hard_rules: list[HardRule] # Binary constraints traits: list[Trait] # Graded tendencies voice_markers: VoiceMarkers # Stylistic targets relational: RelationalState # User rapport history humor: HumorCalibration # Interface for [-Humor Embeddings-] {+the humor/affect layer+} reference_samples: list[str] # E_phi anchors ```"
  },
  {
   "section": "A.2 IPC Dual-Track Compaction",
   "old": "```python def ipc_compact(conversation, persona_state): factual_summary = engram_compact(conversation) # Track 1: facts persona_updates = extract_persona_signals(conversation, persona_state) # Track 2: persona updated_persona = merge_persona_updates(persona_state, persona_updates)",
   "new": "```python def ipc_compact(conversation, persona_state): factual_summary = compact_facts(conversation) # Track 1: facts persona_updates = extract_persona_signals(conversation, persona_state) # Track 2: persona updated_persona = merge_persona_updates(persona_state, persona_updates)",
   "marked": "```python def ipc_compact(conversation, persona_state): factual_summary = [-engram_compact(conversation)-] {+compact_facts(conversation)+} # Track 1: facts persona_updates = extract_persona_signals(conversation, persona_state) # Track 2: persona updated_persona = merge_persona_updates(persona_state, persona_updates)"
  },
  {
   "section": "A.2 IPC Dual-Track Compaction",
   "old": "e_phi_orig = compute_persona_features(conversation) e_phi_summ = compute_persona_features(factual_summary) if np.linalg.norm(e_phi_orig - e_phi_summ)**2 > THRESHOLD: factual_summary = engram_compact(conversation, preserve_style=True)",
   "new": "e_phi_orig = compute_persona_features(conversation) e_phi_summ = compute_persona_features(factual_summary) if l2_distance_sq(e_phi_orig, e_phi_summ) > THRESHOLD: factual_summary = compact_facts(conversation, preserve_style=True)",
   "marked": "e_phi_orig = compute_persona_features(conversation) e_phi_summ = compute_persona_features(factual_summary) if [-np.linalg.norm(e_phi_orig - e_phi_summ)**2-] {+l2_distance_sq(e_phi_orig, e_phi_summ)+} > THRESHOLD: factual_summary = [-engram_compact(conversation,-] {+compact_facts(conversation,+} preserve_style=True)"
  },
  {
   "section": "Appendix B: Persona Feature Space Computation",
   "old": "features_a_norm = features_a / (np.linalg.norm(features_a) + 1e-8) features_b_norm = features_b / (np.linalg.norm(features_b) + 1e-8) return np.concatenate([features_a_norm, features_b_norm]) ```",
   "new": "features_a_norm = normalize(features_a) features_b_norm = normalize(features_b) return concatenate([features_a_norm, features_b_norm]) ```",
   "marked": "features_a_norm = [-features_a / (np.linalg.norm(features_a) + 1e-8)-] {+normalize(features_a)+} features_b_norm = [-features_b / (np.linalg.norm(features_b) + 1e-8)-] {+normalize(features_b)+} return [-np.concatenate([features_a_norm,-] {+concatenate([features_a_norm,+} features_b_norm]) ```"
  }
 ]
}
