{
 "paper": "sleep-consolidation",
 "a": "6.1",
 "b": "6.2",
 "summary": "From v6.1 (2 Jun) to v6.2 (2 Jun): 10,375 words to 9,392 words, 7 words in new or rewritten paragraphs and 990 taken out, 5 paragraphs changed.",
 "note": {
  "title": "The two drawn diagrams become images",
  "kind": "revision",
  "body": "## Summary\n\nThe two diagrams added in 6.1 are replaced by image files with captions (the architecture overview and the procedural extensions). This explains the drop of about 1,000 words, which were drawing code, not text. One sentence is softened.",
  "source": "change note"
 },
 "paragraphs_changed": 5,
 "changes": [
  {
   "section": "1.1 Where This Sits Among the Memory Systems",
   "old": "\\begin{figure}[htbp] \\centering \\resizebox{\\linewidth}{!}{% \\begin{tikzpicture}[ font=\\small, box/.style={rectangle, rounded corners=4pt, draw, line width=0.9pt, align=center, inner sep=8pt}, chip/.style={rectangle, rounded corners=2pt, draw=jsBorder, fill=white, align=center, inner sep=4pt, font=\\scriptsize, minimum height=0.7cm}, tag/.style={rectangle, rounded corners=2pt, draw=jsLink!60, fill=jsLink!8, align=center, inner sep=4pt, font=\\scriptsize}, lbl/.style={font=\\scriptsize\\itshape, align=center}, ] % Daytime crons (orange) \\node[box, fill=orange!12, draw=orange!70, text width=13.5cm, minimum height=1.7cm] (crons) { \\textbf{\\color{jsTitle}Daytime Crons --- execution layer}\\\\[1pt] {\\scriptsize\\itshape consumers AND producers}\\\\[1.0cm] }; \\node[chip] at ($(crons.south)+(-5.6,0.45)$) {Morning Briefing}; \\node[chip] at ($(crons.south)+(-3.05,0.45)$) {Online Engagement}; \\node[chip] at ($(crons.south)+(-0.9,0.45)$) {Life Butler}; \\node[chip] at ($(crons.south)+(0.95,0.45)$) {Fork Sync}; \\node[chip] at ($(crons.south)+(3.1,0.45)$) {Security Check}; \\node[chip] at ($(crons.south)+(5.5,0.45)$) {$\\sim$12--13 crons}; % Nightly cycle (green) \\node[box, fill=jsSection!12, draw=jsSection!70, text width=11cm, below=2.2cm of crons] (nightly) { \\textbf{\\color{jsSection}Nightly Cycle --- reflection layer}\\\\[5pt] \\begin{minipage}{10.2cm}\\centering \\fbox{\\parbox{9.6cm}{\\centering\\scriptsize\\textbf{1. Wind-Down} --- identify failures, encode lessons, mutate prompts}}\\\\[2pt] $\\downarrow$\\\\[1pt] \\fbox{\\parbox{9.6cm}{\\centering\\scriptsize\\textbf{2. Memory Consolidation} --- compress logs, route knowledge, rebuild + concept-index}}\\\\[2pt] $\\downarrow$\\\\[1pt] \\fbox{\\parbox{9.6cm}{\\centering\\scriptsize\\textbf{3. Cleaning} --- prune stale, enforce 50KB budgets}} \\end{minipage}\\\\[3pt] {\\scriptsize\\itshape ordering is the invariant (Reflection $\\rightarrow$ Consolidation $\\rightarrow$ Pruning)} }; % Shared memory (blue) \\node[box, fill=jsLink!12, draw=jsLink!70, text width=13.5cm, minimum height=1.6cm, below=2.2cm of nightly] (mem) { \\textbf{\\color{jsLink}Shared Memory Layer}\\\\[0.9cm] }; \\node[chip] at ($(mem.south)+(-5.3,0.4)$) {operational-lessons}; \\node[chip] at ($(mem.south)+(-2.7,0.4)$) {failure DB}; \\node[chip] at ($(mem.south)+(0,0.4)$) {domain knowledge}; \\node[chip] at ($(mem.south)+(2.7,0.4)$) {core-principles}; \\node[chip] at ($(mem.south)+(5.3,0.4)$) {cron prompts}; % three static layer tags \\node[tag, below=1.1cm of mem.south, xshift=-4.5cm] (storage) {Storage layer\\\\compaction thresholds}; \\node[tag, below=1.1cm of mem.south] (retrieval) {Retrieval layer\\\\index + scoring weights}; \\node[tag, below=1.1cm of mem.south, xshift=4.5cm] (identity) {Identity layer\\\\prompt files}; % arrows \\draw[-{Stealth[length=3mm]}, jsSection, line width=1.2pt] (crons) -- node[right, lbl] {emit receipts + logged failures} (nightly); \\draw[-{Stealth[length=3mm]}, jsAccent, line width=1.2pt] (nightly) -- node[right, lbl] {writes mutations} (mem); \\draw[-{Stealth[length=2mm]}, dotted, jsLink, line width=0.8pt] (mem.south) -- (storage.north); \\draw[-{Stealth[length=2mm]}, dotted, jsLink, line width=0.8pt] (mem.south) -- (retrieval.north); \\draw[-{Stealth[length=2mm]}, dotted, jsLink, line width=0.8pt] (mem.south) -- (identity.north); % big return arrow up the right side \\draw[-{Stealth[length=3.5mm]}, jsSection, line width=1.8pt] (mem.east) -- ++(2.6,0) |- node[pos=0.25, right, lbl, text width=2.6cm] {read at boot $\\rightarrow$ changed behavior tomorrow} (crons.east); \\end{tikzpicture}% } \\caption{Sleep Consolidation as the meta-layer over storage, retrieval, and identity. Daytime crons read shared memory and produce receipts and failures; the nightly cycle reads those, mutates prompts, and feeds the changes back so tomorrow's behavior shifts.} \\label{fig:architecture-overview} \\end{figure}",
   "new": null,
   "marked": "[-\\begin{figure}[htbp] \\centering \\resizebox{\\linewidth}{!}{% \\begin{tikzpicture}[ font=\\small, box/.style={rectangle, rounded corners=4pt, draw, line width=0.9pt, align=center, inner sep=8pt}, chip/.style={rectangle, rounded corners=2pt, draw=jsBorder, fill=white, align=center, inner sep=4pt, font=\\scriptsize, minimum height=0.7cm}, tag/.style={rectangle, rounded corners=2pt, draw=jsLink!60, fill=jsLink!8, align=center, inner sep=4pt, font=\\scriptsize}, lbl/.style={font=\\scriptsize\\itshape, align=center}, ] % Daytime crons (orange) \\node[box, fill=orange!12, draw=orange!70, text width=13.5cm, minimum height=1.7cm] (crons) { \\textbf{\\color{jsTitle}Daytime Crons --- execution layer}\\\\[1pt] {\\scriptsize\\itshape consumers AND producers}\\\\[1.0cm] }; \\node[chip] at ($(crons.south)+(-5.6,0.45)$) {Morning Briefing}; \\node[chip] at ($(crons.south)+(-3.05,0.45)$) {Online Engagement}; \\node[chip] at ($(crons.south)+(-0.9,0.45)$) {Life Butler}; \\node[chip] at ($(crons.south)+(0.95,0.45)$) {Fork Sync}; \\node[chip] at ($(crons.south)+(3.1,0.45)$) {Security Check}; \\node[chip] at ($(crons.south)+(5.5,0.45)$) {$\\sim$12--13 crons}; % Nightly cycle (green) \\node[box, fill=jsSection!12, draw=jsSection!70, text width=11cm, below=2.2cm of crons] (nightly) { \\textbf{\\color{jsSection}Nightly Cycle --- reflection layer}\\\\[5pt] \\begin{minipage}{10.2cm}\\centering \\fbox{\\parbox{9.6cm}{\\centering\\scriptsize\\textbf{1. Wind-Down} --- identify failures, encode lessons, mutate prompts}}\\\\[2pt] $\\downarrow$\\\\[1pt] \\fbox{\\parbox{9.6cm}{\\centering\\scriptsize\\textbf{2. Memory Consolidation} --- compress logs, route knowledge, rebuild + concept-index}}\\\\[2pt] $\\downarrow$\\\\[1pt] \\fbox{\\parbox{9.6cm}{\\centering\\scriptsize\\textbf{3. Cleaning} --- prune stale, enforce 50KB budgets}} \\end{minipage}\\\\[3pt] {\\scriptsize\\itshape ordering is the invariant (Reflection $\\rightarrow$ Consolidation $\\rightarrow$ Pruning)} }; % Shared memory (blue) \\node[box, fill=jsLink!12, draw=jsLink!70, text width=13.5cm, minimum height=1.6cm, below=2.2cm of nightly] (mem) { \\textbf{\\color{jsLink}Shared Memory Layer}\\\\[0.9cm] }; \\node[chip] at ($(mem.south)+(-5.3,0.4)$) {operational-lessons}; \\node[chip] at ($(mem.south)+(-2.7,0.4)$) {failure DB}; \\node[chip] at ($(mem.south)+(0,0.4)$) {domain knowledge}; \\node[chip] at ($(mem.south)+(2.7,0.4)$) {core-principles}; \\node[chip] at ($(mem.south)+(5.3,0.4)$) {cron prompts}; % three static layer tags \\node[tag, below=1.1cm of mem.south, xshift=-4.5cm] (storage) {Storage layer\\\\compaction thresholds}; \\node[tag, below=1.1cm of mem.south] (retrieval) {Retrieval layer\\\\index + scoring weights}; \\node[tag, below=1.1cm of mem.south, xshift=4.5cm] (identity) {Identity layer\\\\prompt files}; % arrows \\draw[-{Stealth[length=3mm]}, jsSection, line width=1.2pt] (crons) -- node[right, lbl] {emit receipts + logged failures} (nightly); \\draw[-{Stealth[length=3mm]}, jsAccent, line width=1.2pt] (nightly) -- node[right, lbl] {writes mutations} (mem); \\draw[-{Stealth[length=2mm]}, dotted, jsLink, line width=0.8pt] (mem.south) -- (storage.north); \\draw[-{Stealth[length=2mm]}, dotted, jsLink, line width=0.8pt] (mem.south) -- (retrieval.north); \\draw[-{Stealth[length=2mm]}, dotted, jsLink, line width=0.8pt] (mem.south) -- (identity.north); % big return arrow up the right side \\draw[-{Stealth[length=3.5mm]}, jsSection, line width=1.8pt] (mem.east) -- ++(2.6,0) |- node[pos=0.25, right, lbl, text width=2.6cm] {read at boot $\\rightarrow$ changed behavior tomorrow} (crons.east); \\end{tikzpicture}% } \\caption{Sleep Consolidation as the meta-layer over storage, retrieval, and identity. Daytime crons read shared memory and produce receipts and failures; the nightly cycle reads those, mutates prompts, and feeds the changes back so tomorrow's behavior shifts.} \\label{fig:architecture-overview} \\end{figure}-]"
  },
  {
   "section": "1.1 Where This Sits Among the Memory Systems",
   "old": null,
   "new": "![Sleep Consolidation as the meta-layer over storage, retrieval, and identity. Daytime crons read shared memory and produce receipts and logged failures; the nightly cycle reads those, mutates prompts, and feeds the changes back up so tomorrow's behavior shifts.](images/architecture-overview.png)",
   "marked": "{+![Sleep Consolidation as the meta-layer over storage, retrieval, and identity. Daytime crons read shared memory and produce receipts and logged failures; the nightly cycle reads those, mutates prompts, and feeds the changes back up so tomorrow's behavior shifts.](images/architecture-overview.png)+}"
  },
  {
   "section": "Mechanism 1: Failure-Driven Prompt Mutation",
   "old": "When an agent hits a failure, the default response is to log it and move on. Sleep Consolidation adds the crucial second step: **determine whether the failure came from a prompt deficiency, and if so, mutate the prompt.** The agent rewrites its own operating manual each night -- like a pilot who, after every flight, updates a personal checklist based on what went well and what nearly went wrong.",
   "new": "When an agent hits a failure, the default response is to log it and move on. Sleep Consolidation adds a second step: **determine whether the failure came from a prompt deficiency, and if so, mutate the prompt.** The agent rewrites its own operating manual each night -- like a pilot who, after every flight, updates a personal checklist based on what went well and what nearly went wrong.",
   "marked": "When an agent hits a failure, the default response is to log it and move on. Sleep Consolidation adds [-the crucial-] {+a+} second step: **determine whether the failure came from a prompt deficiency, and if so, mutate the prompt.** The agent rewrites its own operating manual each night -- like a pilot who, after every flight, updates a personal checklist based on what went well and what nearly went wrong."
  },
  {
   "section": "6. From Declarative to Procedural: Evolving Recipes, Strategies, and Skills",
   "old": "\\begin{figure}[htbp] \\centering \\resizebox{\\linewidth}{!}{% \\begin{tikzpicture}[ font=\\small, box/.style={rectangle, rounded corners=4pt, draw, line width=0.9pt, align=center, inner sep=7pt}, lane/.style={box, fill=jsSection!12, draw=jsSection!70, text width=4.3cm, minimum height=2.8cm}, lbl/.style={font=\\scriptsize\\itshape, align=center}, ] % top banner \\node[box, fill=black!6, draw=black!30, text width=15cm] (banner) { {\\scriptsize\\itshape shared shape: observe episodes $\\rightarrow$ distil durable ranked artifact $\\rightarrow$ feed back} }; % input (orange) \\node[box, fill=orange!12, draw=orange!70, text width=2.8cm, below=2.2cm of banner.west, anchor=west] (input) { \\textbf{\\color{jsTitle}Day's Episodes}\\\\[2pt] {\\scriptsize completed / abandoned, with \\texttt{recipe:<slug>} where present} }; % three lanes \\node[lane, right=1.0cm of input, yshift=2.6cm] (recipe) { \\textbf{\\color{jsSection}Recipe Evolution}\\\\[2pt] {\\scriptsize attribute episode $\\rightarrow$ Laplace-smoothed fitness $\\rightarrow$ propose add/remove/reorder/tighten/loosen. Never-delete archive.}\\\\[2pt] {\\scriptsize\\itshape auto-promote only corrective + $\\geq$8 runs + reversible} }; \\node[lane, right=1.0cm of input] (strategy) { \\textbf{\\color{jsSection}Strategy Switch}\\\\[2pt] {\\scriptsize per-strategy consecutive-failure counter $\\rightarrow$ switch after 3 failures / 24h. Confidence $\\geq$0.8 to auto-switch, else human.}\\\\[2pt] {\\scriptsize\\itshape B010 always-merge $\\rightarrow$ ask-before-merge} }; \\node[lane, right=1.0cm of input, yshift=-2.6cm] (skill) { \\textbf{\\color{jsSection}Skill Library}\\\\[2pt] {\\scriptsize skill-worthy episode $\\rightarrow$ extract skill (name/steps/tests/metrics) $\\rightarrow$ Jaccard 0.8 dedup, decay on failure, never delete.} }; % gate (red) \\node[box, fill=red!12, draw=red!70, text width=3.4cm, right=1.2cm of strategy] (gate) { \\textbf{\\color{red!60!black}Evolution Gate}\\\\[2pt] {\\scriptsize one arbitration point; de-dup conflicting targets; precedence: strategy $>$ skill $>$ recipe.}\\\\[2pt] {\\scriptsize\\itshape human-in-the-loop (Principle 7)} }; % output (purple) \\node[box, fill=jsAccent!15, draw=jsAccent!70, text width=3.2cm, right=1.2cm of gate] (out) { \\textbf{\\color{jsAccent}Reconciled daily manifest}\\\\[2pt] {\\scriptsize human review $\\rightarrow$ approved changes feed tomorrow's selector} }; % arrows fan-out \\draw[-{Stealth[length=2.5mm]}, orange!80, line width=1pt] (input.east) -- (recipe.west); \\draw[-{Stealth[length=2.5mm]}, orange!80, line width=1pt] (input.east) -- (strategy.west); \\draw[-{Stealth[length=2.5mm]}, orange!80, line width=1pt] (input.east) -- (skill.west); % converge on gate \\draw[-{Stealth[length=2.5mm]}, jsSection, line width=1pt] (recipe.east) -- (gate.west); \\draw[-{Stealth[length=2.5mm]}, jsSection, line width=1pt] (strategy.east) -- (gate.west); \\draw[-{Stealth[length=2.5mm]}, jsSection, line width=1pt] (skill.east) -- (gate.west); % gate to output \\draw[-{Stealth[length=3mm]}, jsAccent, line width=1.3pt] (gate.east) -- (out.west); % dashed tomorrow return \\draw[-{Stealth[length=2.5mm]}, dashed, jsMuted, line width=0.9pt] (out.south) -- ++(0,-1.6) -| node[pos=0.25, below, lbl] {tomorrow} (input.south); \\end{tikzpicture}% } \\caption{The three procedural extensions share one pipeline: each night the agent observes the day's episodes, distils a durable ranked artifact (recipe fitness, strategy-failure counts, extracted skills), and a single gate reconciles all proposals into one human-reviewed manifest that feeds tomorrow's selector.} \\label{fig:procedural-extensions} \\end{figure}",
   "new": null,
   "marked": "[-\\begin{figure}[htbp] \\centering \\resizebox{\\linewidth}{!}{% \\begin{tikzpicture}[ font=\\small, box/.style={rectangle, rounded corners=4pt, draw, line width=0.9pt, align=center, inner sep=7pt}, lane/.style={box, fill=jsSection!12, draw=jsSection!70, text width=4.3cm, minimum height=2.8cm}, lbl/.style={font=\\scriptsize\\itshape, align=center}, ] % top banner \\node[box, fill=black!6, draw=black!30, text width=15cm] (banner) { {\\scriptsize\\itshape shared shape: observe episodes $\\rightarrow$ distil durable ranked artifact $\\rightarrow$ feed back} }; % input (orange) \\node[box, fill=orange!12, draw=orange!70, text width=2.8cm, below=2.2cm of banner.west, anchor=west] (input) { \\textbf{\\color{jsTitle}Day's Episodes}\\\\[2pt] {\\scriptsize completed / abandoned, with \\texttt{recipe:<slug>} where present} }; % three lanes \\node[lane, right=1.0cm of input, yshift=2.6cm] (recipe) { \\textbf{\\color{jsSection}Recipe Evolution}\\\\[2pt] {\\scriptsize attribute episode $\\rightarrow$ Laplace-smoothed fitness $\\rightarrow$ propose add/remove/reorder/tighten/loosen. Never-delete archive.}\\\\[2pt] {\\scriptsize\\itshape auto-promote only corrective + $\\geq$8 runs + reversible} }; \\node[lane, right=1.0cm of input] (strategy) { \\textbf{\\color{jsSection}Strategy Switch}\\\\[2pt] {\\scriptsize per-strategy consecutive-failure counter $\\rightarrow$ switch after 3 failures / 24h. Confidence $\\geq$0.8 to auto-switch, else human.}\\\\[2pt] {\\scriptsize\\itshape B010 always-merge $\\rightarrow$ ask-before-merge} }; \\node[lane, right=1.0cm of input, yshift=-2.6cm] (skill) { \\textbf{\\color{jsSection}Skill Library}\\\\[2pt] {\\scriptsize skill-worthy episode $\\rightarrow$ extract skill (name/steps/tests/metrics) $\\rightarrow$ Jaccard 0.8 dedup, decay on failure, never delete.} }; % gate (red) \\node[box, fill=red!12, draw=red!70, text width=3.4cm, right=1.2cm of strategy] (gate) { \\textbf{\\color{red!60!black}Evolution Gate}\\\\[2pt] {\\scriptsize one arbitration point; de-dup conflicting targets; precedence: strategy $>$ skill $>$ recipe.}\\\\[2pt] {\\scriptsize\\itshape human-in-the-loop (Principle 7)} }; % output (purple) \\node[box, fill=jsAccent!15, draw=jsAccent!70, text width=3.2cm, right=1.2cm of gate] (out) { \\textbf{\\color{jsAccent}Reconciled daily manifest}\\\\[2pt] {\\scriptsize human review $\\rightarrow$ approved changes feed tomorrow's selector} }; % arrows fan-out \\draw[-{Stealth[length=2.5mm]}, orange!80, line width=1pt] (input.east) -- (recipe.west); \\draw[-{Stealth[length=2.5mm]}, orange!80, line width=1pt] (input.east) -- (strategy.west); \\draw[-{Stealth[length=2.5mm]}, orange!80, line width=1pt] (input.east) -- (skill.west); % converge on gate \\draw[-{Stealth[length=2.5mm]}, jsSection, line width=1pt] (recipe.east) -- (gate.west); \\draw[-{Stealth[length=2.5mm]}, jsSection, line width=1pt] (strategy.east) -- (gate.west); \\draw[-{Stealth[length=2.5mm]}, jsSection, line width=1pt] (skill.east) -- (gate.west); % gate to output \\draw[-{Stealth[length=3mm]}, jsAccent, line width=1.3pt] (gate.east) -- (out.west); % dashed tomorrow return \\draw[-{Stealth[length=2.5mm]}, dashed, jsMuted, line width=0.9pt] (out.south) -- ++(0,-1.6) -| node[pos=0.25, below, lbl] {tomorrow} (input.south); \\end{tikzpicture}% } \\caption{The three procedural extensions share one pipeline: each night the agent observes the day's episodes, distils a durable ranked artifact (recipe fitness, strategy-failure counts, extracted skills), and a single gate reconciles all proposals into one human-reviewed manifest that feeds tomorrow's selector.} \\label{fig:procedural-extensions} \\end{figure}-]"
  },
  {
   "section": "6. From Declarative to Procedural: Evolving Recipes, Strategies, and Skills",
   "old": null,
   "new": "![The three procedural extensions share one pipeline: each night the agent observes the day's episodes, distils a durable ranked artifact (recipe fitness, strategy-failure counts, extracted skills), and a single gate reconciles all proposals into one human-reviewed manifest that feeds tomorrow's selector.](images/procedural-extensions.png)",
   "marked": "{+![The three procedural extensions share one pipeline: each night the agent observes the day's episodes, distils a durable ranked artifact (recipe fitness, strategy-failure counts, extracted skills), and a single gate reconciles all proposals into one human-reviewed manifest that feeds tomorrow's selector.](images/procedural-extensions.png)+}"
  }
 ]
}
