# Sleep Consolidation: A Repeated Correction Earns a Diagnosed, Tested Repair: v5.0 → v6.0

From v5.0 (1 Apr) to v6.0 (2 Jun): 6,398 words to 9,441 words, 3,808 words in new or rewritten paragraphs and 765 taken out, 203 paragraphs changed.

## Change note of v6.0

**Brain-grounded opening and a new section on procedures**

The paper grows by about 3,000 words. It now opens with how the sleeping brain replays the day, and it summarises the storage, retrieval and identity layers it tunes. The main addition is Section 6: the nightly loop now also improves procedures, not just rules.

- New Section 6: recipes scored by how often they succeed (old versions never deleted), a switch of strategy after repeated failures, and a library of reusable skills in the style of Voyager.
- A single gate reconciles all three kinds of proposed change each night.
- A taxonomy of prompt changes and honest negative results, including a failed concept index from 1 April.
- A section placing the work among other memory systems, and an appendix of default settings.

## Changed paragraphs

Marks: [-removed-] {+added+}.

### Sleep Consolidation: How Structured Nightly Prompting Produces Emergent Behavioral Improvement in Stateless AI Agents

**Authors:** Oscar Serra, JarvisOne AI Research **Date:** [-March-] {+June+} 2026 [-(v5.0)-] {+(v6.0)+} **Keywords:** emergent behavior, prompt engineering, cron-driven learning, self-improving agents, fractal metacognition, autonomous orchestration, memory consolidation, {+recipe evolution, skill libraries,+} operational lessons

### Abstract

Large language model agents are stateless by nature -- every session begins at zero. Existing approaches to persistence usually rely on fine-tuning, retrieval-augmented generation, or larger context windows. We present a different mechanism observed over 30 days of production operation: **structured nightly prompt cycles** that produce compounding behavioral improvement without weight updates, fine-tuning, or architectural changes. A personal AI assistant [-(Jarvis/OpenClaw)-] running [-13-] {+12--13+} autonomous cron jobs exhibited a decline in tracked incidents from 14 (weeks 1--2) to 3 (weeks 3--4) across six error categories -- a 79% reduction overall, with five of the original categories reaching zero recurrence while a new, higher-order error class emerged. The model did not change. The files it read did.

### Abstract

{+This is what sleep gives the human brain. During sleep, the hippocampus replays the day's experiences and broadcasts them to the neocortex, which integrates them into durable knowledge -- the reason a student who sleeps after studying outperforms one who crams and stays awake. The cerebellum, in parallel, refines motor skills through repetitive offline practice, which is why a piano piece learned at night plays more fluently the next morning. Sleep Consolidation is our attempt to give an AI agent the same offline period: a dedicated window where the day's experiences are reviewed, errors are identified, and the rules governing tomorrow's behavior are quietly refined.+}

### Abstract

We formalize this as **Sleep Consolidation** -- a system in which explicit operating prompts are iteratively refined through experience until they produce increasingly automatic, high-quality [-behavior, analogous to how biological sleep consolidation transforms deliberate practice into smooth execution.-] {+behavior.+} We identify three core mechanisms: (1) **failure-driven prompt mutation**, where operational errors trigger targeted prompt refinements (14 mutations documented, all traced to specific incidents); (2) **fractal depth calibration**, where the system learns to allocate metacognitive effort in proportion to task significance; and (3) **cross-cron knowledge transfer**, where lessons learned in one autonomous task propagate to all others through shared memory files (5 documented cross-domain transfer [-events).-] {+events). We then show how the same nightly loop has been extended from declarative memory (rules and facts) to **procedural memory** -- evolving the agent's own recipes, switching failing strategies, and distilling reusable skills.+}

### Contributions

1. **The Sleep Consolidation framework**: a formal architecture for scheduled, autonomous prompt self-improvement through failure-driven mutation, abstraction-level encoding, and cross-task propagation. 2. **Production evidence over 30 days**: 14 documented prompt mutations, 5 error class extinctions, 5 cross-cron transfer events, and token-cost analysis from a real personal assistant deployment. 3. **The fractal depth calibration mechanism**: a prompt-encoded heuristic for allocating metacognitive effort that is itself subject to refinement -- a self-similar cognitive policy. 4. {+**Procedural-memory extensions**: a recipe-evolution loop with empirical fitness and a never-delete archive, a failure-count strategy-switch trigger, and a Voyager-style skill library -- all driven by the same nightly consolidation step (Section 6). 5.+} **Seven design principles** for building self-improving prompt ecosystems, derived from operational [-failures. 5.-] {+failures, plus a mutation taxonomy and honest negative results. 6.+} **Algorithm 1**: a reproducible nightly reflection loop with explicit inputs, outputs, and decision gates.

### 1. Introduction -- The Paradox of the Amnesiac Expert

Every [-morning at 04:00,-] {+night,+} an AI agent [-wakes-] {+winds down knowing it will wake+} up [-knowing nothing about yesterday. By 04:15, it has read-] {+tomorrow remembering nothing. It reads+} its memory files, [-reviewed-] {+reviews+} the [-previous-] day's work, [-identified-] {+identifies+} its own failures, [-rewritten-] {+rewrites+} its own operating rules, and [-gone back to sleep-] {+goes quiet+} -- slightly better than it was the day before. [-By 07:00,-] {+The next morning,+} a [-different-] {+fresh+} instance of the same model reads those updated files and behaves as if it has always known the lessons learned hours earlier.

### 1. Introduction -- The Paradox of the Amnesiac Expert

This is the paradox. The model's weights have not changed. Its architecture is identical. Its context window is the same size. Yet its behavior improves over weeks. The improvement does not live in the model. It lives in the [-_ecosystem-] {+*ecosystem+} of files the model reads and [-writes_.-] {+writes*.+}

### 1. Introduction -- The Paradox of the Amnesiac Expert

[-We call this **Sleep Consolidation**, by analogy to biological sleep consolidation -- the process that turns deliberate, effortful action into fluid, automatic execution through iterative replay and error correction. A child learning to ride a bicycle starts with explicit instructions: _pedal, balance, steer, don't look down_. After enough practice, those separate commands fuse into a single smooth skill. The child's ability to think is not replaced. The translation from thought to action is improved.-]

### 1. Introduction -- The Paradox of the Amnesiac Expert

{+The human brain solves a version of the same problem every night. Waking experience is fragile and short-lived; without consolidation it fades. During sleep the hippocampus replays recent events and transfers them to the neocortex, where they become stable long-term knowledge -- the well-documented reason that sleep after learning beats an equal stretch of waking study. Motor skills get a parallel treatment: the cerebellum refines them through repetitive offline practice, turning a fumbled sequence into a smooth one by morning. A child learning to ride a bicycle starts with explicit instructions -- *pedal, balance, steer, don't look down* -- and after enough practice those separate commands fuse into a single fluid skill. The capacity to think is not replaced. The translation from thought to action is improved.+}

### 1. Introduction -- The Paradox of the Amnesiac Expert

The same pattern appears here. An [-AI-] agent's prompt files begin as explicit instructions. Through nightly reflection, those instructions are tightened, edge cases are encoded, failure modes are made concrete, and vague warnings become operational rules. Over [-time,-] {+time+} the agent behaves more appropriately not because the base model became more capable, but because the substrate around it became more organized. The intelligence is not in the weights alone. It is in the system that selects, sorts, and presents the right constraints at the right time.

### 1. Introduction -- The Paradox of the Amnesiac Expert

{+A useful image: the agent at night is a restaurant after closing. It does not shut down to rest. It reviews the day's orders, identifies what went wrong -- the risotto kept coming back -- and updates tomorrow's recipes and prep instructions. By the time the doors reopen, the kitchen has changed, though no cook learned anything new in the moment.+}

### 1. Introduction -- The Paradox of the Amnesiac Expert

The central question [-of this paper-] is therefore: **Can persistent artifacts combined with scheduled reflection substitute for weight updates in producing sustained behavioral improvement in LLM agents?**

### 1. Introduction -- The Paradox of the Amnesiac Expert

Our evidence suggests a qualified yes -- qualified because the improvements are [-_declarative_-] {+*declarative*+} (better rules and better context) rather than [-_procedural_-] {+*procedural*+} (better underlying reasoning), and because the evidence comes from a single-operator production system rather than a controlled experiment. We document the mechanisms, present production data, acknowledge the limitations plainly, and propose a framework others can [-replicate.-] {+replicate. Section 6 then reports a concrete step toward closing the declarative/procedural gap from the prompt side: extending the same nightly loop to evolve the agent's recipes, strategies, and skills.+}

### 1.1 Where This Sits Among the Memory Systems

{+### 1.1 Where This Sits Among the Memory Systems+}

### 1.1 Where This Sits Among the Memory Systems

{+This work is the meta-layer of a larger memory architecture. A storage layer records every interaction; a retrieval layer indexes and surfaces it; an identity layer reads prompt files to keep behavior consistent. Each of those is, on its own, a *static* architecture -- it does the same thing on day 30 that it did on day 1. Sleep Consolidation is what makes them adaptive without retraining any of them. It does not store and it does not retrieve; it *improves how storing and retrieving work*, by reviewing each night how those layers performed and adjusting the rules and parameters that govern them. The remaining sections describe the storage and retrieval layers only through self-contained one-line summaries where the dependency is load-bearing; the contribution of this paper is the offline loop that tunes them.+}

### 2.1 The Persistence Hierarchy

Agent systems exist on a spectrum of persistence mechanisms, each with {+a+} characteristic [-ceilings-] {+ceiling+} (Lewis et al., 2020; Packer et al., 2023; Hu et al., 2021):

### 2.1 The Persistence Hierarchy

| Level | Mechanism | Persistence | Learning Speed | Characteristic Ceiling | | ----- | [-------------------------] {+---------+} | [-------------------------------] {+-----------+} | [------------------] {+--------------+} | [---------------------------------------------------------------------] {+----------------------+} | | 0 | Prompt engineering | None (session-only) | Zero | Static behavior; cannot adapt beyond {+the+} session boundary | | 1 | RAG / retrieval | Declarative facts | Per-query | Retrieval quality bounds; no behavioral change (Lewis et al., 2020) | | 2 | Persistent memory files | Declarative + some procedural | Per-session | Linear growth, retrieval degradation (Packer et al., 2023) | | 3 | Fine-tuning / LoRA | Weight-level | Per training run | Catastrophic forgetting (French, 1999; Hu et al., 2021) | | 4 | Continual learning | Full integration | Continuous | Open research problem (McClelland et al., 1995) |

### 2.1 The Persistence Hierarchy

Most production agent systems operate at Level 2. This paper shows that Level 2 systems can exhibit Level 3-like [-_behavioral_-] {+*behavioral*+} improvement through structured self-reflection, without weight updates.

### 2.2 What's Missing: The Reflection Loop

Level 2 systems usually accumulate information passively: the agent records what happened, stores preferences, and retrieves relevant context later. But accumulation is not the same as learning. We define **learning** here as [-_behavioral-] {+*behavioral+} policy change that persists across episodes and transfers across task [-domains_.-] {+domains*.+} By contrast, **memory** is [-_state-] {+*state+} persistence without behavioral [-modification_.-] {+modification*.+}

### 2.2 What's Missing: The Reflection Loop

A memory file that says "the user prefers concise responses" is memory. A prompt mutation that changes how the agent [-_formats-] {+*formats+} all future [-outputs_-] {+outputs*+} is learning. The distinction matters because memory must be reinterpreted every session, whereas learning changes default behavior.

### 2.2 What's Missing: The Reflection Loop

The problem is that most memory systems optimize for storage, not for use. They preserve chronology because chronology is easy. But for agents, chronology is rarely the right retrieval axis. **The useful unit is not the event; it is the use-case.** An error in calendar handling belongs with other completeness checks. A messaging failure belongs with targeting rules. A privacy slip belongs with redaction policies. If memory [-remains-] {+stays+} scattered across time-stamped logs, retrieval becomes noisy and expensive. If it is consolidated into purpose-built operational files, the system can act on it cheaply and reliably.

### 2.2 What's Missing: The Reflection Loop

1. Identifies [-_why_-] {+*why*+} a failure occurred (root cause, not symptom) 2. Determines whether the failure class is preventable through prompt changes 3. Modifies the relevant prompt to prevent recurrence 4. Verifies the modification does not break other behaviors 5. Encodes the [-_meta-lesson_-] {+*meta-lesson*+} at the appropriate level of abstraction

### 2.2 What's Missing: The Reflection Loop

This mirrors the [-biological sleep consolidation error-correction loop:-] {+brain's offline error-correction:+} compare {+the+} intended [-movement-] {+outcome+} with {+the+} actual [-movement,-] {+one,+} compute an error signal, then adjust the [-motor program.-] {+program that produced it.+}

### 2.3 Related Work

**Episodic reflection.** Reflexion (Shinn et al., 2023) adds episodic memory of previous [-trial-and-error. However,-] {+trial-and-error, but+} reflection is task-specific and stored per task rather than in shared infrastructure. Our cross-cron transfer mechanism (Section 3.3, Mechanism 3) addresses this [-limitation-] directly. Generative Agents (Park et al., 2023) implement daily reflection and memory consolidation for simulated social agents -- the closest prior work to our nightly cycle. The key difference is that their reflection produces [-_summaries_-] {+*summaries*+} for future retrieval, whereas ours produces [-_prompt mutations_-] {+*prompt mutations*+} that change behavior. Their agents do not rewrite their own operating instructions.

### 2.3 Related Work

**Prompt optimization.** OPRO (Yang et al., 2023) uses LLMs to optimize prompts through iterative evaluation against objective metrics. DSPy (Khattab et al., 2023) automates prompt-pipeline optimization through teleprompting. PromptBreeder (Fernando et al., 2023) evolves prompts through mutation and selection. These systems optimize prompts against [-_defined benchmarks_.-] {+*defined benchmarks*.+} Our system optimizes against [-_real-] {+*real+} operational [-failures_-] {+failures*+} without predefined metrics. The mutation trigger is [-therefore-] qualitatively different: benchmark score versus production incident.

### 2.3 Related Work

**Skill accumulation.** Voyager (Wang et al., 2023) accumulates a skill library in Minecraft through [-exploration,-] {+exploration --+} closer in spirit to our approach but limited to a single domain with clear success criteria. {+Section 6.3 adapts the Voyager skill-library idea to a general personal-assistant workload.+} ADAS (Hu et al., 2024) uses LLMs to design better agent architectures, operating at the meta-level of system design.

### 2.3 Related Work

**Constitutional and governance approaches.** Constitutional AI (Bai et al., 2022) establishes self-critique against explicit principles, [-which is-] related to our operational-lessons governance. Our Principle 7 (human-in-the-loop for Level 2+ changes) addresses the same risk: preventing self-reinforcing error spirals in self-modifying systems.

### 2.3 Related Work

**Incident learning in software engineering.** Our mutation protocol draws [-implicitly from-] {+on+} SRE [-blameless postmortem-] {+blameless-postmortem+} methodology (Beyer et al., 2016), where incidents are systematically analyzed, root-caused, and translated into preventive changes. Sleep Consolidation automates that cycle for AI agent operations.

### 2.3 Related Work

Our contribution differs from all of the above in three ways: (1) it operates on [-_production_ personal assistant-] {+*production* personal-assistant+} workloads, not benchmarks or simulations; (2) improvement is [-_cross-task_-] {+*cross-task*+} -- lessons propagate through shared infrastructure; and (3) reflection is [-_scheduled-] {+*scheduled+} and [-autonomous_,-] {+autonomous*,+} not triggered by explicit failure signals or human feedback.

### 3.1 System Overview

Sleep Consolidation is not a single component. It is an emergent property of four interacting [-systems:-] {+systems.+}

### 3.1 System Overview

[-**Nightly Cycle (reflection layer):** Wind-Down (04:00) --> Consolidation (04:15) --> Cleaning Lady (05:15)-]

### 3.1 System Overview

{+**Nightly Cycle (reflection layer).** A wind-down pass reviews the day and encodes lessons; a memory-consolidation pass compresses logs and routes knowledge; a cleaning pass prunes and enforces budgets. These run on a fixed nightly schedule (Section 3.4).+}

### 3.1 System Overview

- [-operational-lessons.md-] {+an operational-lessons file+} (behavioral rules -- the primary mutation target) - [-bugs/ directory (structured-] {+a structured+} failure {+database (failure+} patterns with [-root cause-] {+root-cause+} analysis) - [-knowledge/ (domain-specific principles-] {+domain knowledge files (principles+} and [-procedures)-] {+procedures, sorted by topic)+} - [-MEMORY.md (core principles ---] {+a core-principles file+} injected into every session's context [-window)-] {+window+} - {+the+} cron prompts themselves (self-modifying task instructions)

### 3.1 System Overview

[-**Daytime Crons (execution layer, consumers + producers):** Morning Briefing (07:00) | Fork Sync (04:45) | Online Engagement (08:00) | 11 others-]

### 3.1 System Overview

{+**Daytime Crons (execution layer, consumers and producers).** A morning briefing, an online-engagement pass, a life-butler pass, and roughly a dozen others.+} Every cron job is both a [-_consumer_-] {+*consumer*+} of the shared memory layer and a [-_producer_-] {+*producer*+} for it. It reads operational lessons, principles, and prior failures before acting; [-later,-] {+later+} it emits receipts, logs failures, and -- during the nightly cycle -- helps mutate the shared layer itself.

### 3.1 System Overview

{+The three layers this meta-system tunes can be summarized self-containedly:+}

### 3.1 System Overview

{+- **Storage layer.** Records every interaction and compacts older events into compressed pointer summaries. The nightly cycle can adjust compaction aggressiveness based on observed retrieval patterns -- if important memories are being over-compressed, the thresholds loosen. - **Retrieval layer.** Maps keywords and embeddings to memory segments. The nightly cycle triggers index rebuilds and can adjust scoring weights -- for example, boosting a domain's memories after repeated retrieval failures there. - **Identity layer.** Reads prompt files (persona definitions, behavioral rules, operational lessons) to keep personality and behavior consistent. The nightly cycle rewrites those same files, creating the core feedback loop: behavior produces incidents, reflection reads incidents, prompt mutation changes the files the identity layer consumes, and tomorrow's behavior shifts accordingly.+}

### 3.2 Algorithm 1: The Nightly Reflection Loop

PHASE 2: CONSOLIDATION (model: strongest available) compress(daily_logs older than 3 days) route_knowledge(new lessons -> [-knowledge/-] {+knowledge+} subdirectories) [-rebuild_search_indexes()-] {+rebuild_search_indexes() build_concept_index(modified knowledge files) // see Section 6.4+}

### Mechanism 1: Failure-Driven Prompt Mutation

When an agent [-encounters-] {+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.**-] {+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.+}

### Mechanism 1: Failure-Driven Prompt Mutation

**Production example -- The B010 cascade [-(2026-03-03-] {+(Mar 3+} to [-2026-03-10):**-] {+Mar 10):**+}

### Mechanism 1: Failure-Driven Prompt Mutation

This seven-day sequence shows the full [-sleep-consolidated learning-] loop, including second-order correction.

### Mechanism 1: Failure-Driven Prompt Mutation

**Day 0 (Mar 3) -- Initial failure.** A fork-sync cron job, prompted to "sync the fork with upstream," [-interpreted-] {+read+} that instruction as permission to edit production source code, run builds, and restart the gateway. The problem was not model incapacity. [-The problem-] {+It+} was prompt ambiguity.

### Mechanism 1: Failure-Driven Prompt Mutation

[-_Prompt before:_-] {+*Prompt before:*+} "Sync the fork with upstream and report the result." [-_Prompt-] {+*Prompt+} after (mutation [-#8):_-] {+#8):*+} "Run the safe merge script. NEVER modify source code directly. NEVER run builds. NEVER restart the gateway. If the script fails, report and STOP."

### Mechanism 1: Failure-Driven Prompt Mutation

The mutation was filed as bug B010, [-with-] root cause: "Ambiguous action verb ('sync') interpreted as permission for unrestricted operations."

### Mechanism 1: Failure-Driven Prompt Mutation

**Day 7 (Mar 10) -- Second-order failure.** The same cron later [-encountered-] {+hit+} a merge conflict. It reported the conflict and stopped -- exactly as mutation #8 required. But the restriction was too broad. The agent was in fact [-_capable_-] {+*capable*+} of resolving the conflict [-intelligently-] by reading [-fork-] {+the fork's patch+} documentation, understanding both sides' intent, and verifying with a build. The blanket prohibition prevented useful work. The merge was blocked for 24 hours.

### Mechanism 1: Failure-Driven Prompt Mutation

[-_Prompt-] {+*Prompt+} after (mutation [-#14):_-] {+#14):*+} "Run the safe merge script. If conflicts remain, read [-FORK_PATCHES.md-] {+the patch registry+} to understand intent, attempt resolution, verify with build. If genuinely uncertain, escalate."

### Mechanism 1: Failure-Driven Prompt Mutation

That meta-lesson now applies to [-_all_-] {+*all*+} future lesson encoding across the system. One incident produced a permanent improvement in how the system [-learns.-] {+learns. As Section 6.2 shows, this same cascade is now the canonical test case for an automated strategy-switch trigger.+}

### Mechanism 2: Fractal Depth Calibration

Not all tasks deserve the same [-amount of-] metacognitive effort. Sleep Consolidation includes a **depth selector** -- a prompt-encoded heuristic that [-determines-] {+decides+} how many layers of "why" to traverse:

### Mechanism 2: Fractal Depth Calibration

| Signal | Depth | Example | | [----------------------------] {+------+} | ----- | [-------------------------------------------------] {+-------+} | | [-Routine/mechanical-] {+Routine / mechanical+} | 0 | Read a file, send a message | | Something broke | 1--2 | Why did it break? What pattern? | | Encoding a new rule | 2--3 | Is the abstraction right? Am I over-correcting? | | Explicit request for depth | 3+ | Go until insight stops being actionable |

### Mechanism 2: Fractal Depth Calibration

**Convergence hypothesis [-(not proven, observed):** In practice, most-] {+(observed, not proven):** Most+} tasks stabilize at depth 0--1 within days of operation, while novel failure classes begin at depth 2--3 and [-gradually-] move to 0--1 as their patterns become encoded. We [-observe approximately-] {+see roughly+} weekly Level 2 refinements and [-approximately-] {+roughly+} monthly Level 3 refinements, [-suggesting that-] {+which suggests+} deeper reflection becomes less necessary as the system matures. We do not claim formal convergence -- only that the 30-day pattern is consistent with it.

### Mechanism 2: Fractal Depth Calibration

**Production example -- Fractal emergence [-(2026-03-10):**-] {+(Mar 10):**+} The merge-conflict episode [-initially operated-] {+began+} at depth 0: just do it, abort on failure. After the B010 [-over-correction incident,-] {+over-correction,+} a human prompt ("think fractal") triggered depth 3+ analysis, [-revealing-] {+which revealed+} that the real problem was not merge strategy but the [-_method-] {+*method+} used to encode [-lessons_.-] {+lessons*.+} The resulting principle -- "separate the failure mode from the restriction" -- now applies to every future lesson, not just merge conflicts.

### Mechanism 3: Cross-Cron Knowledge Transfer

The strongest emergent property is that lessons learned in one autonomous task propagate to all others through shared memory files. {+A lesson learned in one domain -- "always double-check dates" -- spontaneously improves performance in another, the way a surgeon's steady hands might also make for a better painter, though no one taught the transfer.+} We documented 5 cross-domain transfer events over 30 days:

### Mechanism 3: Cross-Cron Knowledge Transfer

| # | Origin Task | Lesson Encoded | Transferred To | Observable Behavior Change | | [-----] {+-+} | [----------------------] {+-----------+} | [------------------------------------------------] {+--------------+} | [-----------------------------] {+--------------+} | [-------------------------------------------------------------------] {+--------------------------+} | | 1 | Calendar management | "When 'the X' is ambiguous, ask before acting" | Fork sync | Cron reported two interpretations of {+a+} conflict instead of guessing | | 2 | WhatsApp messaging | "Use [-JID-based-] {+ID-based+} targeting, never name-based" | All crons with messaging | Morning briefing switched from name to [-JID-] {+ID+} targeting | | 3 | Privacy incident | "Never include phone numbers in visible text" | All sessions | Online engagement cron redacted numbers in PR comments | | 4 | Fork sync (B010) | "Report-only crons must not modify systems" | Security audit cron | Audit reported findings without attempting fixes | | 5 | Memory consolidation | "Enforce file size budgets" | All report-generating crons | Reports began self-truncating at budget limits |

### Mechanism 3: Cross-Cron Knowledge Transfer

The transfer mechanism is architectural, not magical: lessons written to [-`operational-lessons.md`-] {+the operational-lessons file+} are read by all sessions at boot. But the **abstraction level** at which lessons are encoded determines transfer breadth. "Use [-JID-based-] {+ID-based+} targeting" (Level 0, specific) transfers only to messaging tasks. "When something is ambiguous, ask before acting" (Level 1, general) transfers much more widely.

### 3.4 The Nightly Cycle

### 3.4 The Nightly [-Cycle -- Sleep Consolidation for Agents-] {+Cycle+}

### 3.4 The Nightly Cycle

{+The cycle runs as an ordered sequence of passes, each producing inputs for the next:+}

### 3.4 The Nightly Cycle

| [-Time-] {+Order+} | [-Job-] {+Pass+} | Role | Biological Analogy | | ----- | [----------------------] {+----+} | [-----------------------------------------------------------] {+----+} | [-----------------------------------------------------] {+------------------+} | | [-04:00-] {+1+} | Wind-Down | Review, identify failures, encode lessons, mutate prompts | Sleep replay / [-sleep consolidation-] error correction | | [-04:15-] {+2+} | Memory Consolidation | Compress daily logs, route knowledge, rebuild indexes | Hippocampal-to-neocortical [-memory-] transfer | | [-04:45-] {+3+} | Fork Sync | Integrate external changes, self-heal build failures | Environmental adaptation during rest | | [-05:15-] {+4+} | Cleaning [-Lady-] | Trim bloated files, prune stale sessions, enforce budgets | Synaptic pruning |

### 3.4 The Nightly Cycle

**Critical ordering:** Wind-Down runs first because it produces the raw material -- identified failures and encoded lessons -- that Consolidation then routes to permanent storage. Cleaning [-Lady-] runs last because it prunes temporary artifacts. [-The ordering matters.-] We [-observed-] {+learned+} the cost of getting [-it-] {+this+} wrong when a misconfigured schedule ran [-Cleaning Lady-] {+the cleaning pass+} before Wind-Down, pruning the very daily logs [-that-] Wind-Down needed as [-input.-] {+input. (Wall-clock times for each pass have shifted across the deployment's life; the *ordering* is the invariant, not the hour.)+}

### 4.1 Methodology and Limitations

**System:** [-OpenClaw-] {+an OpenClaw-based+} personal assistant [-(Jarvis),-] running on a Linux workstation. Primary {+reflection+} model: [-Claude Opus 4. Cron models:-] {+the strongest available frontier model; daytime crons use a+} mix of [-Opus, Sonnet,-] {+strong+} and [-Haiku. 13-] {+cheaper models. Roughly 12--13+} autonomous cron [-jobs.-] {+jobs over the period.+} One human [-operator (Oscar).-] {+operator.+}

### 4.1 Methodology and Limitations

**Data sources:** [-Cron-] {+cron+} receipts (structured JSON, [-automatically generated-] {+auto-generated+} per run), [-operational lessons-] {+the operational-lessons+} file (git-versioned, all changes tracked), bug reports (structured markdown, manually filed), {+and+} daily Wind-Down [-logs (generated by Opus).-] {+logs.+}

### 4.1 Methodology and Limitations

**Labeling protocol:** [-Error-] {+error+} instances were identified from cron receipts (non-zero exit codes, escalation flags) and operator-reported incidents. Error [-_classes_-] {+*classes*+} were defined post hoc by the authors based on root-cause similarity. No inter-rater reliability was computed -- this is a single-system observational study, not a controlled experiment.

### 4.1 Methodology and Limitations

**Confounds we acknowledge:** [-Over-] {+over+} the 30-day period, the following changed [-simultaneously:-] {+at once:+} prompt content (the variable under study), cron ordering (adjusted twice), model assignments [-(3-] {+(three+} crons moved [-from Opus-] to [-Sonnet),-] {+a cheaper model),+} operator [-familiarity (Oscar learned-] {+familiarity, and+} the [-system's capabilities), and-] upstream codebase (109 commits merged). We cannot isolate the contribution of prompt mutation from these confounds. The evidence is [-_consistent with_-] {+*consistent with*+} the Sleep Consolidation hypothesis but does not [-_prove_-] {+*prove*+} it.

### 4.1 Methodology and Limitations

**What a controlled study would look like:** [-Run-] {+run+} two identical agent [-deployments:-] {+deployments,+} one with nightly reflection [-enabled,-] {+enabled and+} one with static prompts. Measure [-error recurrence-] {+error-recurrence+} rate, [-human intervention-] {+human-intervention+} frequency, [-task completion-] {+task-completion+} quality (rated by blind evaluators), and time-to-resolution for novel incidents. Duration: [-minimum-] {+at least+} 4 weeks. We have not conducted this study.

### 4.2 Prompt Mutations Observed

Over 30 [-days,-] {+days+} we documented 14 prompt mutations -- changes to cron prompts or operational rules triggered by real failures. "Documented" means the mutation has a git commit, a linked bug report or incident description, and a before/after prompt diff. We [-did not observe any-] {+observed no+} mutations that were [-_reverted_-] {+*reverted*+} as harmful, though mutation #8 was later [-_refined_-] {+*refined*+} by mutation #14 after an over-correction.

### 4.2 Prompt Mutations Observed

| # | Date | Trigger | Mutation | Scope | | [-----] {+-+} | [--------] {+----+} | [-----------------------------------------------] {+-------+} | [--------------------------------------------------------------] {+--------+} | [------------------] {+-----+} | | 1 | Feb 10 | Morning briefing missed calendar events | Added dual-calendar query requirement | Single cron | | 2 | Feb 14 | Cron sent message to wrong chat | Added explicit [-JID-based-] {+ID-based+} targeting, banned [-name-based-] {+name+} lookup | All [-WA-] {+messaging+} crons | | 3 | Feb 16 | Memory files growing unbounded | Created size budgets, [-cleaning-lady-] {+cleaning+} cron | System-wide | | 4 | Feb 19 | Agent [-didn't read SOUL.md-] {+skipped its boot-context file+} | Added mandatory boot sequence [-to AGENTS.md-] | All sessions | | 5 | Feb 22 | [-Heartbeat renamed-] {+Renamed+} function broke {+heartbeat+} calls | Created [-FORK_PATCHES.md-] {+a patch+} registry | Fork sync | | 6 | Feb 24 | Cron report was 40KB (unreadable) | Added budget fuses, formatting rules | All report crons | | 7 | Mar 01 | Agent included PII in {+a+} reply | Added privacy guardrail [-to TOOLS.md-] | All sessions | | 8 | Mar 03 | Fork sync cron edited production code (B010) | Added [-HARD CONSTRAINTS-] {+hard constraints+} to cron prompt | Fork sync | | 9 | Mar 03 | Same session: cron killed the gateway | Added "never [-pkill"-] {+force-kill processes"+} rule | All crons | | 10 | Mar 04 | Build failed after merge -- wrong externals | Auto-heal retry + wiring guardian | Fork sync | | 11 | Mar 05 | Model misidentified person from {+a+} headline | Added [-"ALWAYS-] {+"always+} click through" rule | Self-evolution | | 12 | Mar 07 | Wind-Down wrote to {+the+} wrong day's log | Added [-temporal awareness-] {+a temporal-awareness+} step | Wind-Down | | 13 | Mar 08 | Agent didn't recognize {+a+} family member | Added mandatory [-daily log-] {+daily-log+} reading to boot | All sessions | | 14 | Mar 10 | Merge abort on {+a+} single conflict too aggressive | [-Keep-ours + intelligent-] {+Intelligent+} resolution {+with safe defaults+} | Fork sync |

### 4.2 Prompt Mutations Observed

[-**Qualitative observation:** Mutations 1--6 are mostly _reactive_ -- they fix specific failures. Mutations 7--14 are more _structural_ -- they address failure _classes_, encode _principles_ rather than isolated rules, and modify _shared infrastructure_ rather than single prompts.-]

### 4.2 Prompt Mutations Observed

{+**A mutation taxonomy.** Sorting the 14 mutations by intent lets others prioritize which kinds to automate first:+}

### 4.2 Prompt Mutations Observed

{+| Category | Mutations | Count | What it changes | | -------- | --------- | ----- | --------------- | | Safety / guardrail | #2, #7, #8, #9 | 4 | Prevents harmful or out-of-mandate actions | | Completeness | #1, #4, #12, #13 | 4 | Stops the agent acting on partial context | | Resource / efficiency | #3, #6 | 2 | Caps cost, size, and unreadable output | | Resilience / recovery | #5, #10, #14 | 3 | Self-heals after an external or build failure | | Verification | #11 | 1 | Forces a check before asserting a fact |+}

### 4.2 Prompt Mutations Observed

{+Two patterns stand out. First, safety and completeness dominate early failures (mutations 1--9), while resilience and proportional-constraint refinements appear later (10--14) -- the system first stops doing harmful things, then learns to keep doing useful ones safely. Second, the categories map cleanly onto the autonomy gates in Section 6: safety mutations are the ones that most need human review, while efficiency mutations are the safest to auto-apply.+}

### 4.3 Error Class Tracking

| Error Class | Definition | [-Weeks-] {+Wks+} 1--2 | [-Weeks-] {+Wks+} 3--4 | Status | | [----------------------------- | ------------------------------------------------------] {+-----------+} | ---------- | [------------] {+:------:+} | [--------------------------------------------] {+:------: | ------+} | | Wrong [-chat/recipient-] {+chat / recipient+} | Message delivered to unintended target | 3 | 0 | No recurrence after mutation #2 | | File size explosion | Output exceeding [-readability/budget-] {+readability / budget+} limits | 2 | 0 | No recurrence after mutation #3 | | Missing context at boot | Agent unaware of {+available+} information [-in available files-] | 4 | 0 | No recurrence after mutations #4, #13 | | Unsafe cron actions | Cron [-performing operations-] {+acting+} outside its mandate | 2 | 0 | No recurrence after mutations #8, #9 | | Ambiguous request mishandled | [-Agent acting-] {+Acting+} on ambiguous input without [-clarification-] {+clarifying+} | 3 | 1 | Declining; 1 residual instance | | Over-broad safety rules | Safety constraints [-preventing-] {+blocking+} legitimate [-operations-] {+work+} | 0 | 2 | New class, [-discovered-] {+found+} via fractal analysis |

### 4.3 Error Class Tracking

**Total tracked incidents:** 14 (weeks 1--2) to 3 (weeks 3--4), a 79% reduction. {+Mistakes here don't just get patched; whole classes get eliminated -- like a spelling error that autocorrect learns once and never surfaces again.+} The emergence of "over-broad safety rules" as a [-_new_ error-] {+*new*+} class in weeks 3--4 is especially notable. The error surface shifted from execution failures to policy failures. That [-pattern-] is consistent with a maturing system: once first-order mistakes [-are reduced,-] {+drop,+} second-order distortions become easier to see.

### 4.3 Error Class Tracking

**Caveat:** [-We-] {+we+} cannot cleanly [-distinguish between-] {+separate+} "errors eliminated by prompt mutation" [-and-] {+from+} "errors eliminated by operator learning" [-(Oscar-] {+(the operator+} stopped triggering certain edge cases as he learned the system). The confound is real and uncontrolled.

### 4.4 Token Economics

| Component | [-Tokens/night-] {+Tokens / night+} | [-Cost/night-] {+Cost / night+} (est.) | | [------------------------] {+---------+} | [--------------] {+:------------:+} | [-------------------] {+:-----------------:+} | | Wind-Down | ~15K | $0.45 | | Consolidation | ~20K | $0.60 | | Cleaning [-Lady-] | ~8K | $0.12 | | Total nightly overhead | ~43K | $1.17 |

### 4.4 Token Economics

Over 30 days, total reflection [-cost: approximately-] {+cost was about+} $35. We estimate 8 human-intervention incidents were avoided (based on error-class extinction -- incidents that would otherwise have required [-Oscar-] {+the operator+} to debug and fix manually). Valuing operator time at $25/hr with [-an-] {+a 30-minute+} average [-30-minute-] resolution yields [-approximately-] {+about+} $200 saved.

### 4.4 Token Economics

**Sensitivity analysis:** [-If operator time is valued-] at $15/hr [-(low estimate),-] {+(low)+} ROI is [-3.4x. At-] {+3.4x; at+} $50/hr [-(high estimate), ROI-] {+(high) it+} is 11.4x. If only 4 incidents were truly avoided (conservative), ROI at $25/hr is still 2.9x. Under every reasonable [-assumption,-] {+assumption+} the reflection loop [-remains-] {+is+} cost-positive, though the estimates are approximate.

### 5.1 Why Fractal?

[-The term "fractal" refers-] {+"Fractal"+} here [-to-] {+means+} **self-similar cognitive patterns applied at different scales of abstraction.** The same reflective sequence -- [-_what-] {+*what+} happened, why, what principle, what [-meta-principle_-] {+meta-principle*+} -- recurs at every level of task analysis.

### 5.1 Why Fractal?

The key [-insight is that-] {+insight:+} **the same reasoning [-pattern-] that improves a specific task can also improve the category of tasks, the method used to improve categories, and eventually the method used to improve methods.** Each level operates on a [-smaller and-] {+smaller,+} more abstract domain than the one [-below it.-] {+below.+}

### 5.2 Convergence Intuition (Not a Proof)

Consider [-a system with-] error classes at multiple scales:

### 5.2 Convergence Intuition (Not a Proof)

- **Level 0** (execution): [-Fix-] {+fix+} the specific bug. Eliminates one instance of one [-error-] class. - **Level 1** (pattern): [-Encode-] {+encode+} a rule preventing the [-error-] class. Eliminates all instances of one [-error-] class. - **Level 2** (methodology): [-Improve-] {+improve+} how rules are encoded. Reduces the rate at which new [-error-] classes arise from [-over-correction-] {+over-+} or under-correction. - **Level 3** (meta-methodology): [-Improve-] {+improve+} how improvement works. Reduces the overhead of [-the-] reflection [-process-] itself.

### 5.2 Convergence Intuition (Not a Proof)

Each level operates on a smaller domain (instances > classes > methodology > meta-methodology). We [-_hypothesize_ that-] {+*hypothesize*+} this produces convergent behavior: the frequency and magnitude of changes should [-decrease-] {+fall+} at each higher level. Our 30-day observations [-are consistent with-] {+fit+} that pattern (daily Level 0--1, weekly Level 2, monthly Level 3), but 30 days is not enough to establish convergence. The hypothesis is falsifiable: if Level 2+ mutation frequency does not [-decrease-] {+fall+} over time, the convergence claim fails.

### 5.3 The Depth Selector as a Learned Policy

[-The decision of how-] {+How+} deeply to reflect is itself a learnable policy. [-Initially,-] {+Initially+} the agent has little calibration. Over [-time,-] {+time+} the depth selector improves through its own mistakes:

### 5.3 The Depth Selector as a Learned Policy

- [-_Reflected-] {+*Reflected+} too [-shallowly_-] {+shallowly*+} on a merge strategy --> missed the over-correction pattern --> added depth for "encoding new rules" - [-_Reflected-] {+*Reflected+} too [-deeply_-] {+deeply*+} on a routine file operation --> wasted [-2 minutes of-] compute --> reduced depth for [-"routine/mechanical"-] {+"routine / mechanical"+}

### 5.3 The Depth Selector as a Learned Policy

We observe this self-calibration emerging [-naturally-] over the 30-day period, but we lack quantitative metrics for [-"reflection depth-] {+"reflection-depth+} appropriateness." [-A future-] {+An+} instrumentation layer [-that tracks-] {+tracking+} tokens-spent-on-reflection versus value-of-insight-produced would enable a more rigorous evaluation.

### 6. Design Principles for Sleep Consolidation Systems

[-## 6. Design Principles for Sleep Consolidation Systems-]

### 6. Design Principles for Sleep Consolidation Systems

[-Based on our production experience, we propose seven design principles:-]

### 6. From Declarative to Procedural: Evolving Recipes, Strategies, and Skills

{+## 6. From Declarative to Procedural: Evolving Recipes, Strategies, and Skills+}

### 6. From Declarative to Procedural: Evolving Recipes, Strategies, and Skills

{+Sections 3--5 describe consolidation of *declarative* memory -- rules and facts. The same nightly loop has since been extended to *procedural* memory: the agent's own recipes, the strategies it switches between, and the reusable skills it distills. This is the cerebellum half of the analogy made literal -- offline practice refining the *procedures* themselves, not just the rules about them. All three extensions share one shape: **observe the day's episodes, distil a durable ranked artifact, feed it back into tomorrow's behavior.** Each is an opt-in step in the consolidation pipeline, off by default, so the loop's baseline behavior is unchanged when the extension is absent.+}

### 6. From Declarative to Procedural: Evolving Recipes, Strategies, and Skills

{+A load-bearing design boundary keeps this honest. Recipe *execution* lives in a separate subsystem; consolidation does not own it and must not duplicate it. The contribution here is strictly the *offline learning loop*: read episode outcomes, compute fitness, propose mutations, and write a ranked archive that the execution-time selector consumes. Recipes are owned by the execution subsystem; their *measured fitness* is owned by consolidation. Any write back into the execution subsystem's recipe directory is a *proposal* gated by human review (Section 7.1), never a silent overwrite.+}

### 6.1 Recipe Evolution: Empirical Fitness and a Never-Delete Archive

{+### 6.1 Recipe Evolution: Empirical Fitness and a Never-Delete Archive+}

### 6.1 Recipe Evolution: Empirical Fitness and a Never-Delete Archive

{+A recipe is a procedure the agent runs to accomplish a recurring task. Recipes have historically been hand-written and static; nothing measured whether one was better than another, and nothing recorded how a recipe reached its current form. The recipe-evolution step adds a selection loop over the recipe population. Each night it attributes every completed episode to the recipe it used, scores that recipe's *empirical fitness* (success rate, latency, token cost), proposes mutations (add, remove, or reorder a step; tighten or loosen success criteria), keeps a never-delete archive of versioned variants, and ranks variants so the selector can prefer winners. It is the cerebellum turning a fumbled piano piece into a fluent one over successive nights.+}

### 6.1 Recipe Evolution: Empirical Fitness and a Never-Delete Archive

{+Fitness is computed from episode outcomes -- a `completed` episode counts as a success, an `abandoned` one as a failure -- with the success rate Laplace-smoothed so that one success out of one run is not reported as a perfect 1.0. Latency is the episode's end-minus-start time; token cost sums the events in the episode. The hard part is *attribution*: tying an episode to the recipe that ran it. Without a reliable recipe tag on each episode, fitness is computed against the wrong recipe and the loop learns garbage. The implementation only attributes when an explicit `recipe:<slug>` tag is present and returns no attribution otherwise, refusing to guess.+}

### 6.1 Recipe Evolution: Empirical Fitness and a Never-Delete Archive

{+Proposals are gated, not applied. They are written to a daily manifest for review. A narrow auto-promotion path exists for the safest case -- a *corrective* proposal (driven by a success rate far below the floor, not merely under it) that is well-evidenced (at least 8 runs, above the 3-run minimum needed merely to propose) and reversible (the never-delete archive keeps every prior variant). Efficiency proposals, such as those driven by latency regression, are never auto-promoted. This is autonomy-first but bounded, and it maps directly onto the mutation taxonomy of Section 4.2: efficiency-class changes are the only ones the system trusts itself to apply unsupervised, and even those are logged and reversible.+}

### 6.1 Recipe Evolution: Empirical Fitness and a Never-Delete Archive

{+``` interface RecipeFitness { recipeId; version; runs; successes; successRate; // Laplace-smoothed for low n avgLatencyMs; avgTokenCost; lastUpdated; } interface MutationProposal { recipeId; baseVersion; op; // add_step | remove_step | reorder | tighten | loosen payload; rationale; expectedDelta; needsHumanReview; // false only for corrective + well-evidenced + reversible } // nightly step (opt-in) for each completed episode: rid = attributeRecipe(episode) // null unless a recipe:<slug> tag is present if rid is null: continue fit = updateRecipeFitness(archive.latest(rid), episode) archive.putVariant(rid, fit.version, currentBody(rid), fit) proposals += proposeMutations(fit, archive.history(rid)) writeManifest(proposals) // gated; auto-promote only the safe subset ```+}

### 6.2 Failure-Count Strategy Switch

{+### 6.2 Failure-Count Strategy Switch+}

### 6.2 Failure-Count Strategy Switch

{+A single failure triggers a prompt mutation, but the early system had no memory of *how many times in a row* a given strategy had failed, and no rule that said "this approach keeps failing -- switch to a different one." The strategy-switch step adds a per-strategy state machine that counts consecutive failures and fires a switch after a threshold is crossed within a recency window. This is the restaurant that, after the risotto comes back three nights running, stops tweaking the recipe and takes it off the menu.+}

### 6.2 Failure-Count Strategy Switch

{+The canonical case is the B010 cascade from Section 3.3. Three consecutive failures of an always-merge fork-sync strategy should trip a switch to an ask-before-merge strategy -- not a fourth identical patch. The implementation makes this concrete: the default threshold is **3 consecutive failures**, the recency window is **24 hours** (failures spread beyond it do not count as a pattern), and a switch is flagged for human review unless confidence clears **0.8** and a registered fallback strategy exists. Confidence rises with the overshoot past the threshold, so a strategy that has failed five times running is trusted more than one that has just reached three.+}

### 6.2 Failure-Count Strategy Switch

{+Two failure modes shaped the design. First, episode-boundary false positives: a long failing task can be split by the time-gap detector into several `abandoned` episodes, over-counting consecutive failures and tripping a premature switch -- so failures within the same task are de-duplicated. Second, idempotency: if the consolidation cursor goes stale and events are reprocessed, failures would double-count, so records are keyed by event id. A successful episode resets the counter to zero and, if a switch was just made, stamps the time-to-recovery -- which makes a switch that *didn't* help visible rather than silently sticky.+}

### 6.2 Failure-Count Strategy Switch

{+``` interface SwitchDecision { shouldSwitch; fromStrategy; toStrategy; // toStrategy null -> no fallback -> human confidence; needsHumanReview; rationale; } // decideSwitch: // IF consecutiveErrors >= threshold (default 3) // AND (now - lastFailure) < windowMs (default 24h) // THEN switch to fallback if registered, else flag for human; // needsHumanReview = confidence < 0.8 OR no fallback // ELSE no switch ```+}

### 6.2 Failure-Count Strategy Switch

{+The open contract decision -- whether the fallback map is hand-authored per strategy or learned from which alternatives historically scored higher fitness (which would couple this step to the recipe archive of 6.1) -- is deliberately left to a human. So is whether `abandoned` is a sufficient failure signal, since an episode can be abandoned because the *user* walked away, not because the strategy failed.+}

### 6.3 A Skill Library, Voyager-Style

{+### 6.3 A Skill Library, Voyager-Style+}

### 6.3 A Skill Library, Voyager-Style

{+Voyager's idea: as an agent solves tasks, distil the successful behavior into a named, reusable skill, store it in a growing library, rank skills by success, and retrieve and compose them on future tasks so competence compounds instead of being re-derived. The skill-extraction step applies this to a general assistant workload. From each *completed*, tool-using episode with a clear decision, it synthesizes a skill -- name, description, prerequisites, steps, test cases, success metrics -- stores it versioned in a never-delete library, ranks by empirical success rate, and exposes it to retrieval so a recurring situation can carry "this previously used skill X with Y% success." It is the cross-cron transfer of Section 3.3 turned from an emergent side effect into a first-class, addressable artifact.+}

### 6.3 A Skill Library, Voyager-Style

{+Three guards keep the library from rotting. A strict skill-worthiness gate -- completed plus a tool call plus a key decision -- refuses to learn skills from trivial chat or abandoned attempts, so the library does not fill with non-general entries. A Jaccard-similarity dedup at **0.8** over the skill body merges near-identical skills rather than spawning duplicates; when a same-named skill recurs it becomes a new version, and the source-episode ids are merged. And success metrics decay on recent failure so a skill encoding an obsolete procedure stops ranking on past glory and becomes reachable for deprecation. Deprecation marks but never deletes -- the body is still readable, preserving the never-delete invariant the rest of the system relies on.+}

### 6.3 A Skill Library, Voyager-Style

{+The retrieval edit is intentionally minimal and flag-guarded: with the skill rider off (the default) retrieval output is byte-identical to before; with it on, retrieved context gains a "relevant skills" rider. The honest open question is whether extracted skills are *executable code* (true Voyager) or *structured procedures* consumed by the recipe runner. In this deployment recipes are already markdown procedures, so "skill-as-code" most naturally means "skill-as-recipe" -- which raises the question of whether this extension eventually collapses into the recipe archive of 6.1 or stays a distinct library. That is a human design call, not one the system should make for itself.+}

### 6.4 One Gate for Three Mutation Sources -- and a Consolidation Output the Thesis Demanded

{+### 6.4 One Gate for Three Mutation Sources -- and a Consolidation Output the Thesis Demanded+}

### 6.4 One Gate for Three Mutation Sources -- and a Consolidation Output the Thesis Demanded

{+All three extensions add new mutation or selection targets, and on a busy night they can fire for the same task at once: "mutate recipe X," "switch strategy," "use skill Y." Three ad-hoc gates would be three audit surfaces and three chances to thrash. The design calls for **one** arbitration point that collects the night's proposals, de-duplicates conflicting targets for the same task, applies a fixed precedence (a strategy switch outranks a skill suggestion, which outranks a recipe mutation, because a switch can invalidate the recipe a mutation was tuning), and writes a single reconciled manifest for review. This keeps the human-in-the-loop principle (Section 7.1) intact behind one surface.+}

### 6.4 One Gate for Three Mutation Sources -- and a Consolidation Output the Thesis Demanded

{+These procedural extensions also exposed a gap in the *declarative* loop that the paper's own thesis predicted. The thesis says consolidation must organize memory by purpose, not chronology. The early implementation did this for lessons, preferences, and contacts -- but not for *concept-to-document routing*. On April 1, a memory search returned the wrong documents because no concept index existed to route a topic to the files that discuss it. The system meant to prevent retrieval failure through organization had failed to organize the retrieval-critical artifact. The fix is a consolidation output (shown in Algorithm 1, Phase 2): for each knowledge file modified that day, extract retrieval keywords -- including the synonyms a human would actually search for -- and write a concept index mapping keywords to file paths. New or substantially changed knowledge files are also seeded with retrieval keywords so the keyword channel has material to match even when the document's natural language does not contain the search terms. We record the April 1 incident as the consolidation system's own failure case, which is exactly the kind of negative result Section 7 argues should be reported rather than hidden.+}

### 6.4 One Gate for Three Mutation Sources -- and a Consolidation Output the Thesis Demanded

{+---+}

### 7. Design Principles for Sleep Consolidation Systems

{+## 7. Design Principles for Sleep Consolidation Systems+}

### 7. Design Principles for Sleep Consolidation Systems

{+From production experience, we propose seven design principles.+}

### Principle 1: Separate Fast and Slow Learning

Operational sessions handle tasks (fast). Nightly crons handle reflection (slow). Never mix reflection into task execution -- it degrades task performance and produces [-lower-quality-] {+worse+} reflection. This mirrors Kahneman's System 1 / System 2 distinction (Kahneman, 2011) and the biological separation of online performance from offline consolidation.

### Principle 2: Encode at the Right Abstraction Level

[-A lesson about "always-] {+"Always+} check both calendars" is Level 0. "When a system has multiple data sources, query all of them" is Level 1. "Verify completeness assumptions before acting" is Level 2. Encode at the highest level that [-remains _actionable_-] {+stays *actionable*+} -- too abstract and it becomes empty, too specific and it fails to transfer.

### Principle 3: Shared Memory > Private Memory

Lessons stored in a single cron's prompt help only that cron. Lessons stored in shared operational files help every session. Default to shared [-storage. Use-] {+storage; use+} private storage only for [-domain-specific-] {+domain+} knowledge that would confuse other tasks.

### Principle 4: Proportional Constraints

When encoding {+a+} safety [-lessons-] {+lesson+} from [-failures,-] {+a failure,+} the restriction should [-be proportional to-] {+match+} the risk. "Never edit source code" is disproportionate to "a cron edited the wrong file once." "Understand intent before editing, verify [-after editing,-] {+after,+} revert if broken" is proportional and preserves capability. This is the central lesson of the B010 --> mutation #14 [-cascade.-] {+cascade, and it is now enforced mechanically by the strategy-switch step (6.2): a repeated failure switches the strategy rather than piling on another blanket prohibition.+}

### Principle 6: The Budget Fuse

[-Every reflection loop must have a token budget and a wall-clock timeout. Without it, a sufficiently thorough reflection agent will consume unlimited resources chasing diminishing returns. In practice, we cap Wind-Down at 1800 seconds and Consolidation at 1200 seconds.-]

### Principle 6: The Budget Fuse

{+Every reflection loop must have a token budget and a wall-clock timeout. Without one, a sufficiently thorough reflection agent will chase diminishing returns indefinitely. The procedural extensions of Section 6 inherit this discipline: proposals require a minimum number of runs before firing, and the skill library carries the same size-budget and dedup pressure the operational-lessons file already does.+}

### Principle 7: Human-in-the-Loop for Level 2+ Changes

Level 0--1 mutations (specific fixes and [-pattern-level-] {+pattern+} rules) can be autonomous. Level 2+ mutations (methodology changes, [-core principle modifications)-] {+core-principle edits)+} must be flagged for [-human-] review. **Concrete gate:** any mutation that modifies [-MEMORY.md (core principles, injected-] {+the core-principles file (injected+} into all sessions) or changes the depth selector itself requires human approval before taking effect. Mutations to individual cron prompts or [-`operational-lessons.md`-] {+the operational-lessons file+} can be auto-applied but are logged with full diffs for [-audit.-] {+audit. The procedural extensions follow the same rule: recipe mutations, strategy switches, and skills are gated by default, with a narrow auto-promotion path only for corrective, well-evidenced, reversible changes (Section 6.1).+}

### Principle 7: Human-in-the-Loop for Level 2+ Changes

**Rollback mechanism:** [-All-] {+all+} mutations are git-committed with descriptive [-messages. Any mutation-] {+messages and+} can be [-reverted with `git revert`. The Wind-Down cron-] {+reverted. Each night+} logs a "mutation manifest" [-per night-] listing all changes, enabling batch [-review.-] {+review; the procedural extensions write to the same manifest so there is a single audit surface.+}

### 8. Limitations and Failure Modes

## [-7.-] {+8.+} Limitations and Failure Modes

### 8.1 The Self-Reinforcing Error Spiral

### [-7.1-] {+8.1+} The Self-Reinforcing Error Spiral

### 8.1 The Self-Reinforcing Error Spiral

If a reflection loop encodes the wrong lesson, that lesson [-influences-] {+shapes+} future behavior, generating data that appears to confirm [-it. This is-] {+it --+} the AI analogue of confirmation [-bias.-] {+bias. The risk grows with the procedural extensions of Section 6: a bad recipe mutation or an over-eager strategy switch could generate episodes that look like vindication.+}

### 7.1 The Self-Reinforcing Error Spiral

[-- Human review for Level 2+ changes (Principle 7) - Git-versioned mutation log enabling revert - Wind-Down mutation manifest for daily batch review-]

### 8.1 The Self-Reinforcing Error Spiral

{+- Human review for Level 2+ changes (Principle 7), extended to recipe mutations, strategy switches, and skills by default. - Git-versioned mutation log and a never-delete archive enabling revert at any point. - A nightly mutation manifest -- one surface -- for batch review. - Minimum-run thresholds before any procedural proposal fires, so low-n noise cannot trigger a change.+}

### 8.1 The Self-Reinforcing Error Spiral

**Mitigations [-(proposed but-] {+(proposed,+} not yet implemented):**

### 8.1 The Self-Reinforcing Error Spiral

- Automated regression checklist: after each mutation, re-run [-a set of-] known-good scenarios to detect [-degradation-] {+degradation.+} - "Canary mode": {+apply+} new mutations [-are applied-] tentatively for 48 hours, then [-auto-reverted-] {+auto-revert+} if error rates [-increase-] {+rise.+} - Signed mutation [-provenance: each mutation records-] {+provenance recording+} the triggering incident, the model that generated [-it,-] {+the mutation,+} and [-the-] {+a+} confidence [-level-] {+level.+}

### 8.2 Context Window Pressure

### [-7.2-] {+8.2+} Context Window Pressure

### 8.2 Context Window Pressure

Every encoded lesson consumes context-window space. As the [-operational lessons-] {+operational-lessons+} file grows, it competes with task-relevant context. The [-Cleaning Lady cron-] {+cleaning pass+} enforces size budgets (currently [-50KB for `operational-lessons.md`)-] {+50KB)+} and archives stale [-content. This-] {+content, which+} creates a second-order problem: archived lessons may be unavailable when they become relevant again. [-The Fractal Memory Index (Serra & JarvisOne, 2026a) mitigates this through semantic-] {+Semantic+} retrieval of archived [-content.-] {+content mitigates this. The skill library of Section 6.3 raises the same bloat risk and inherits the same budget and dedup discipline.+}

### 8.3 Model Dependency

### [-7.3-] {+8.3+} Model Dependency

### 8.3 Model Dependency

Reflection quality depends on the model's reasoning capability. We use the strongest available model [-(Opus)-] for nightly reflection and cheaper models [-(Sonnet, Haiku)-] for daytime [-execution. This-] {+execution, which+} creates a cost asymmetry: the "learning" is only as good as the reflection model. A weaker reflection model would produce lower-quality mutations, potentially encoding bad lessons and amplifying the {+spiral of Section 8.1. The skill-extraction step adds a related+} risk [-described in Section 7.1.-] {+-- the same episode extracted twice with different wording can slip past string-level dedup -- which is why semantic dedup, not just Jaccard, is the intended longer-term guard.+}

### 8.4 Single-Operator Bias

### [-7.4-] {+8.4+} Single-Operator Bias

### 8.4 Single-Operator Bias

Our data comes from one operator with specific workflows, preferences, and failure patterns. Whether Sleep Consolidation generalizes to multi-user systems, other cultural contexts, or domains beyond [-personal assistant-] {+personal-assistant+} tasks [-remains-] {+is+} an open question. We hypothesize that the [-_mechanisms_-] {+*mechanisms*+} generalize (failure-driven mutation, cross-task transfer, depth [-calibration)-] {+calibration, recipe and skill evolution)+} even if the specific [-_lessons_-] {+*lessons*+} do not.

### 8.5 No True Generalization

### [-7.5-] {+8.5+} No True Generalization

### 8.5 No True Generalization

The fundamental [-limitation-] {+limit+} is that prompt-mediated learning produces [-_declarative_-] {+*declarative*+} improvements (better rules, better context), not [-_procedural_-] {+*procedural*+} improvements [-(better underlying reasoning).-] {+in the model's own reasoning. The recipe and skill extensions of Section 6 push further into procedural territory than rules alone, but they still encode procedures *as artifacts the unchanged model reads*, not as better reasoning inside the model.+} The model's reasoning capability does not itself improve. A sufficiently novel failure class will not be prevented by any amount of prompt {+or recipe+} refinement.

### 9. Future Work

## [-8.-] {+9.+} Future Work

### 9.1 Controlled Ablation Study

### [-8.1-] {+9.1+} Controlled Ablation Study

### 9.1 Controlled Ablation Study

The highest-priority follow-up is straightforward: run two identical deployments (with and without nightly reflection) for 4+ weeks, measuring [-error recurrence-] {+error-recurrence+} rate, intervention frequency, and blind-rated task quality. This [-would-] directly [-address-] {+addresses+} the confounds [-outlined in-] {+of+} Section 4.1 and [-move-] {+moves+} the evidence from observational to [-experimental.-] {+experimental. A second ablation should isolate each Section 6 extension, since they were added incrementally and their individual contribution to error reduction is not yet separated from the declarative loop's.+}

### 9.2 Multi-Phase Sleep Cycles

{+### 9.2 Multi-Phase Sleep Cycles+}

### 9.2 Multi-Phase Sleep Cycles

{+The current loop is a single nightly pass. A multi-phase split would mirror biological sleep more closely: a *light* phase every few hours for quick episode detection and index updates, a *deep* phase nightly for full consolidation and skill extraction, and a *REM* phase weekly for cross-episode pattern detection and higher-order skill clustering. The weekly phase is the natural home for composing several episodes into one higher-order skill rather than extracting one skill per episode.+}

### 9.3 Multi-Agent Prompt Ecosystems

### [-8.2-] {+9.3+} Multi-Agent Prompt Ecosystems

### 9.3 Multi-Agent Prompt Ecosystems

If multiple agents share a memory layer, do lessons from one agent's failures benefit others? Preliminary evidence from cross-agent collaboration suggests yes, but systematic study is [-still-] needed.

### 8.3 Automatic Depth Calibration

[-### 8.3 Automatic Depth Calibration-]

### 9.4 Automatic Depth Calibration

{+### 9.4 Automatic Depth Calibration+}

### 9.4 Automatic Depth Calibration

The fractal depth selector is currently prompt-encoded and manually refined. An instrumented version [-that tracks-] {+tracking+} tokens-spent-on-reflection versus downstream-error-reduction would enable quantitative optimization of reflection effort.

### 9.5 Bridging to Fine-Tuning

### [-8.4-] {+9.5+} Bridging to Fine-Tuning

### 9.5 Bridging to Fine-Tuning

Encoded lessons are `(failure, context, correct_behavior)` tuples -- exactly the format [-needed for-] preference [-optimization.-] {+optimization needs. The recipe-fitness archive of Section 6.1 adds graded outcome signals on top.+} Sleep Consolidation could therefore serve as a [-_data generation pipeline_-] {+*data-generation pipeline*+} for periodic [-LoRA-] {+weight+} updates, bridging Level 2 and Level 3 persistence.

### 8.5 Adversarial Robustness

[-### 8.5 Adversarial Robustness-]

### 9.6 Adversarial Robustness

{+### 9.6 Adversarial Robustness+}

### 9.6 Adversarial Robustness

Can a crafted input trigger a harmful prompt [-mutation? Our-] {+mutation, recipe change, or strategy switch? The+} current mitigation (human review for Level [-2+)-] {+2+ and for procedural proposals)+} is manual. Automated detection of adversarial mutations -- perhaps through consistency checking against existing principles -- [-remains-] {+is+} an open problem.

### 9. Conclusion

[-## 9. Conclusion-]

### 10. Conclusion

{+## 10. Conclusion+}

### 10. Conclusion

We have presented observational evidence that structured nightly prompt cycles can produce compounding behavioral improvement in stateless AI agents. Sleep Consolidation formalizes three [-mechanisms:-] {+declarative mechanisms --+} failure-driven prompt mutation, fractal depth calibration, and cross-cron knowledge [-transfer.-] {+transfer -- and extends them into procedural memory through recipe evolution, strategy switching, and a skill library.+}

### 10. Conclusion

[-But the-] {+The+} deeper claim is about structure. Memory alone is not enough. **Unsorted memory is cheap to store and expensive to use.** The breakthrough is not accumulation; it is consolidation. Scattered memories are operationally useless until they are organized by purpose: rules for messaging, policies for ambiguity, lessons from failures, [-prompts revised-] {+recipes ranked+} by [-yesterday's mistakes.-] {+what actually worked.+} Once sorted by use-case rather than chronology, those memories stop being archives and start becoming policy.

### 10. Conclusion

We are careful to distinguish observation from proof. Our 30-day production data is consistent with the hypothesis but confounded by simultaneous changes in operator behavior, model assignment, and system configuration. Still, the mechanisms are formalized (Algorithm 1), the design principles are actionable, {+the procedural extensions are implemented and tested,+} and the trend is hard to ignore: over 30 days, five of six tracked error classes reached zero [-recurrence,-] {+recurrence+} while total incidents dropped 79%.

### 10. Conclusion

This is not a replacement for fine-tuning or continual learning. It is a [-complement:-] {+complement --+} an accessible, low-cost mechanism [-that-] any agent system with file persistence and scheduled execution can implement now. The prompts rewrite themselves. The {+recipes get ranked. The+} memory layer gets cleaner. The agent makes fewer of yesterday's mistakes.

### 10. Conclusion

Sleep Consolidation does not make the model fundamentally smarter. It makes the system more organized, more adaptive, and more reliable. [-And in-] {+In+} practice, that is often what intelligence looks like.

### References

Bai, Y., et al. (2022). Constitutional AI: Harmlessness from AI Feedback. [-_arXiv:2212.08073_.-] {+*arXiv:2212.08073*.+}

### References

Beyer, B., Jones, C., Petoff, J., & Murphy, N. R. (2016). [-_Site-] {+*Site+} Reliability [-Engineering._-] {+Engineering.*+} O'Reilly Media.

### References

Buzsáki, G. (1996). The hippocampo-neocortical dialogue. [-_Cerebral Cortex_,-] {+*Cerebral Cortex*,+} 6(2), 81--92.

### References

Fernando, C., et al. (2023). PromptBreeder: Self-Referential Self-Improvement via Prompt Evolution. [-_arXiv:2309.16797_.-] {+*arXiv:2309.16797*.+}

### References

French, R. M. (1999). Catastrophic forgetting in connectionist networks. [-_Trends-] {+*Trends+} in Cognitive [-Sciences_,-] {+Sciences*,+} 3(4), 128--135.

### References

Hu, E. J., et al. (2021). LoRA: Low-Rank Adaptation of Large Language Models. [-_arXiv:2106.09685_.-] {+*arXiv:2106.09685*.+}

### References

Hu, S., et al. (2024). Automated Design of Agentic Systems. [-_arXiv:2408.08435_.-] {+*arXiv:2408.08435*.+}

### References

Kahneman, D. (2011). [-_Thinking,-] {+*Thinking,+} Fast and [-Slow._-] {+Slow.*+} Farrar, Straus and Giroux.

### References

Khattab, O., et al. (2023). DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines. [-_arXiv:2310.03714_.-] {+*arXiv:2310.03714*.+}

### References

Lewis, P., et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. [-_NeurIPS 2020_.-] {+*NeurIPS 2020*.+}

### References

Madaan, A., et al. (2023). Self-Refine: Iterative Refinement with Self-Feedback. [-_NeurIPS 2023_.-] {+*NeurIPS 2023*.+}

### References

McClelland, J. L., McNaughton, B. L., & O'Reilly, R. C. (1995). Why there are complementary learning systems in the hippocampus and neocortex. [-_Psychological Review_,-] {+*Psychological Review*,+} 102(3), 419--457.

### References

Packer, C., et al. (2023). MemGPT: Towards LLMs as Operating Systems. [-_arXiv:2310.08560_.-] {+*arXiv:2310.08560*.+}

### References

Park, J. S., et al. (2023). Generative Agents: Interactive Simulacra of Human Behavior. [-_UIST 2023_.-] {+*UIST 2023*.+}

### References

[-Serra, O., & JarvisOne. (2026a). Fractal Memory Index: A Self-Similar Architecture for Scalable Long-Term Memory in LLMs. _JarvisOne AI Research._-]

### References

Shinn, N., et al. (2023). Reflexion: Language Agents with Verbal Reinforcement Learning. [-_NeurIPS 2023_.-] {+*NeurIPS 2023*.+}

### References

Wang, G., et al. (2023). Voyager: An Open-Ended Embodied Agent with Large Language Models. [-_arXiv:2305.16291_.-] {+*arXiv:2305.16291*.+}

### References

Yang, C., et al. (2023). Large Language Models as Optimizers. [-_arXiv:2309.03409_.-] {+*arXiv:2309.03409*.+}

### References

Yao, S., et al. (2023). ReAct: Synergizing Reasoning and Acting in Language Models. [-_ICLR 2023_.-] {+*ICLR 2023*.+}

### Appendix A: The Nightly Cycle (Illustrative Cron Schedule)

## Appendix A: The [-Complete-] Nightly Cycle [-(Cron-] {+(Illustrative Cron+} Schedule)

### Appendix A: The Nightly Cycle (Illustrative Cron Schedule)

{+The exact wall-clock times have changed across the deployment's life; what follows is one representative configuration during the observation period. The *ordering* of reflection before consolidation before pruning is the invariant; the hours are not.+}

### Appendix A: The Nightly Cycle (Illustrative Cron Schedule)

[-| Time-] | Job | Model {+tier+} | Purpose | [-Tokens/run-] {+Tokens / run+} | | [------ | --------------------- | ------ | ----------------------------------------] {+---+} | ---------- | {+-------+} | [-03:00-] {+:----------:+} | [-Outlook-] {+|+} Token Refresh | [-Haiku-] {+cheap+} | Keep auth alive | ~2K | | [-03:30 |-] DB Backup | [-Haiku-] {+cheap+} | [-Backup SQLite-] {+Back up local+} databases | ~2K | | [-03:30 |-] Memory Index Rebuild | [-Haiku-] {+cheap+} | Rebuild [-memory-] {+the+} search index | ~3K | | [-04:00 |-] Wind-Down | [-Opus-] {+strongest+} | Reflect, encode lessons, mutate prompts | ~15K | | [-04:15 |-] Memory Consolidation | [-Opus-] {+strongest+} | Compress, route, index knowledge | ~20K | | [-04:30 |-] Security Check | [-Opus-] {+strong+} | [-OS/network-] {+OS / network+} security audit | ~12K | | [-04:45 |-] Fork Sync | [-Opus-] {+strong+} | Merge upstream, self-heal build | ~10K | | [-05:00 |-] Fork Scanner | [-Opus-] {+strong+} | Analyze other forks for ideas | ~25K | | [-05:15-] {+Cleaning+} | [-Cleaning Lady | Sonnet-] {+mid-tier+} | Prune sessions, enforce size budgets | ~8K | | [-05:30 |-] Self-Evolution | [-Opus-] {+strong+} | Research new [-models,-] {+models and+} techniques | ~20K | | [-05:45 |-] Group Summary | [-Opus-] {+strong+} | Summarize [-WhatsApp-] {+message+} groups | ~15K | | [-06:00 |-] Life Butler | [-Opus-] {+strong+} | [-Personal secretary-] {+Personal-secretary tasks+} | ~10K | | [-07:00 |-] Morning Briefing | [-Opus-] {+strong+} | Daily summary + action items | ~12K | | [-08:00 |-] Online Engagement | [-Opus-] {+strong+} | [-GitHub PRs, community outreach-] {+Community outreach, code review+} | ~12K |

### Mutation #8 -- B010 Incident (Mar 3)

### Mutation #8 -- B010 Incident [-(2026-03-03)-] {+(Mar 3)+}

### Mutation #8 -- B010 Incident (Mar 3)

**Trigger:** [-Fork sync-] {+the fork-sync+} cron edited [-`process-message.ts`,-] {+a source file,+} ran [-`pnpm build`,-] {+a build,+} and killed the gateway.

### Mutation #8 -- B010 Incident (Mar 3)

**Root cause:** [-Prompt-] {+the prompt+} said "sync the fork" -- {+the+} model [-interpreted-] {+read+} that as permission to do whatever syncing required.

### Mutation #8 -- B010 Incident (2026-03-03)

[-**Mutation (v1):**-]

### Mutation #8 -- B010 Incident (Mar 3)

{+**Mutation (v1), as language-agnostic policy:**+}

### Mutation #8 -- B010 Incident (Mar 3)

``` HARD CONSTRAINTS: - [-NEVER-] {+never+} modify source code directly - [-NEVER-] {+never+} run [-pnpm-] {+a+} build - [-NEVER pkill-] {+never restart+} or [-restart-] {+kill+} the gateway - [-If safe-cron-merge.sh exits non-zero,-] {+if the safe-merge step fails,+} report and STOP ```

### Mutation #14 -- Over-correction Fix (Mar 10)

### Mutation #14 -- Over-correction Fix [-(2026-03-10)-] {+(Mar 10)+}

### Mutation #14 -- Over-correction Fix (Mar 10)

**Trigger:** [-Mutation-] {+mutation+} #8 prevented the agent from resolving a merge conflict it was capable of resolving.

### Mutation #14 -- Over-correction Fix (Mar 10)

**Root cause:** [-Mutation-] {+mutation+} #8 encoded a blanket prohibition [-when-] {+where+} a proportional constraint would have preserved capability.

### Mutation #14 -- Over-correction Fix (2026-03-10)

[-**Mutation (v2):**-]

### Mutation #14 -- Over-correction Fix (Mar 10)

{+**Mutation (v2), as language-agnostic policy:**+}

### Mutation #14 -- Over-correction Fix (Mar 10)

``` SAFETY CONSTRAINTS (replaces HARD CONSTRAINTS): - [-NEVER git checkout upstream/main -- . (blanket overwrite)-] {+never blanket-overwrite local changes with upstream+} - [-You-] {+you+} MAY edit source files to resolve [-conflicts in the fork's source tree-] {+a conflict+} - [-You-] {+you+} MAY run [-pnpm-] {+a+} build to verify your resolution - [-ALWAYS-] {+always+} preserve [-fork guard-] {+the fork's protected patch+} strings [-from FORK_PATCHES.md-] - [-When-] {+when+} in doubt: keep [-ours-] {+local changes+} and escalate ```

### Mutation #14 -- Over-correction Fix (2026-03-10)

[-**Meta-lesson encoded:** "When encoding a safety lesson, separate the failure mode from the restriction. The restriction should be proportional to the risk, not a blanket prohibition."-]

### Mutation #14 -- Over-correction Fix (Mar 10)

{+**Meta-lesson encoded:** "When encoding a safety lesson, separate the failure mode from the restriction. The restriction should be proportional to the risk, not a blanket prohibition." This cascade is now the canonical test case for the automated strategy-switch trigger of Section 6.2: three consecutive always-merge failures within a day switch the strategy rather than adding a fourth patch.+}

### Appendix C: The Fractal Depth Selector (Representative Production Version)

## Appendix C: The Fractal Depth Selector [-(Current-] {+(Representative+} Production Version)

### Appendix C: The Fractal Depth Selector (Representative Production Version)

``` Default Fractal Depth [-Selector (2026-03-10):-] {+Selector:+}

### Appendix C: The Fractal Depth Selector (Representative Production Version)

| Signal | Depth | |---------------------------------|--------------------------------------| | [-Routine/mechanical-] {+Routine / mechanical+} task | 0 -- just do it | | Something broke or surprised me | 1-2 -- what pattern? what lesson? | | Encoding a new rule/constraint | 2-3 -- is the abstraction right? | | Explicit request for depth | 3+ -- go until insight is actionable |

### Appendix C: The Fractal Depth Selector (Representative Production Version)

Application rule: [-On-] {+on+} any non-trivial completed action, spend [-10-] {+a few+} seconds asking "one level up: what pattern does this instance belong to?" If interesting, go one more. If not, stop. ```

### Appendix D: Procedural-Extension Defaults

{+## Appendix D: Procedural-Extension Defaults+}

### Appendix D: Procedural-Extension Defaults

{+Representative default thresholds for the Section 6 extensions, as configured in the deployment:+}

### Appendix D: Procedural-Extension Defaults

{+| Extension | Parameter | Default | Effect | | --------- | --------- | :-----: | ------ | | Recipe evolution | Minimum runs to propose | 3 | Below this, no proposal fires | | Recipe evolution | Minimum runs to auto-promote | 8 | Below this, every proposal is human-gated | | Recipe evolution | Success floor | 0.5 | Below this, a corrective proposal is generated | | Strategy switch | Consecutive-failure threshold | 3 | Trips a switch when reached | | Strategy switch | Recency window | 24h | Failures older than this don't count | | Strategy switch | Min confidence to auto-switch | 0.8 | Below this, the switch is human-gated | | Skill library | Dedup similarity (Jaccard) | 0.8 | Above this, two skills merge |+}

### Appendix E: Revision History

## Appendix [-D:-] {+E:+} Revision History

### Appendix E: Revision History

[-**v1.0 (2026-03-10):** Initial-] {+**v1.0:** initial+} draft.

### Appendix E: Revision History

[-**v1.1 (2026-03-10):** Major-] {+**v1.1:** major+} revision [-based on-] {+after+} external review. [-Added: specific metrics in abstract,-] {+Added abstract metrics,+} contributions list, explicit research question, expanded related work, Algorithm 1, cross-cron transfer examples, [-methodology/confound-] {+methodology and confound+} discussion, sensitivity analysis, falsifiability criterion, [-concrete gating/rollback-] {+gating and rollback+} mechanisms, expanded [-mitigations, 7 new citations.-] {+mitigations.+}

### Appendix E: Revision History

[-**v2.0 (2026-03-13):** Quality-] {+**v2.0:** quality+} revision. Fixed terminology [-artifacts-] in biological [-references (Buzsáki, McClelland),-] {+references,+} removed uncited references, reduced [-thematic-] redundancy, corrected [-citation-] attributions, tightened [-prose throughout.-] {+prose.+}

### Appendix E: Revision History

{+**v5.0:** retitled to "Sleep Consolidation"; reframed the analogy from cerebellum-only to whole-sleep consolidation.+}

### Appendix E: Revision History

{+**v6.0:** brain-grounded opening (hippocampal replay + cerebellar motor consolidation); self-contained inline summaries of the storage / retrieval / identity layers; added Section 6 (procedural-memory extensions: recipe evolution, strategy switch, skill library) grounded in the implemented system; added a mutation taxonomy (4.2) and honest negative results (the April 1 concept-index failure, 6.4); added the concept-index consolidation output to Algorithm 1; added similes throughout; added Appendix D (procedural-extension defaults). Prose tightened.+}
