# The Wondering Machine: Instilling Purpose and Continuous Learning in Large Language Models: v6.4 → v6.5

From v6.4 (2 Jun) to v6.5 (14 Jun): 9,167 words to 10,880 words, 1,755 words in new or rewritten paragraphs and 42 taken out, 24 paragraphs changed.

## Change note of v6.5

**Answers to reversible compression and doubt-driven review**

This version answers two outside tools and a measured failure. The changes come from the paper's own review notes of 2026-06-13. The text grows by about 1,700 words.

- Section 2.3 takes on headroom, which compresses context reversibly. It admits this pushes the context wall much further out, and argues that stored text still never becomes skill. So the case for weight updates no longer rests on "we ran out of context".
- Section 1.1 and the API-limit case now cite doubt-driven-development (Osmani's agent-skills), a prompt-level check that would have caught that mistake. It still sits under the prompt ceiling.
- Section 3.2 changes its advice on telling learnable gaps from ambiguity. A small supervised head over frozen features failed in the author's own tests, while unsupervised novelty signals worked.
- Section 7.4 adopts headroom's habit of shipping a runnable evaluation.

## Changed paragraphs

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

### 1.1 Where This Sits — Prompt-Level Improvement and Its Ceiling

{+The strongest prompt-level discipline for the specific failure this paper opens on—over-compliance and confabulation—is now a deployed, widely-adopted technique, and it belongs here rather than in a footnote. Osmani's `agent-skills` library (addyosmani/agent-skills, ~56.8k stars) ships **doubt-driven-development**: a structured loop that takes a CLAIM, EXTRACTs it down to an artifact plus a contract (the original reasoning stripped away), submits it to DOUBT (a _fresh-context adversarial reviewer that never saw the original reasoning_), RECONCILEs each finding against the artifact text, and STOPs on trivial findings, after three cycles, or on user override—all gated behind explicit non-trivial-decision criteria. The mechanism is the structural opposite of an agent trusting its own first hypothesis: it manufactures a reviewer with no stake in the original chain of reasoning and forces the claim to survive that reviewer. The same repository's broader authoring discipline—every skill declaring a "When NOT to use" anti-trigger and a "Loading Constraints" section—pushes in the same direction, narrowing where a behavior is allowed to fire. This is, today, the best-in-class prompt-level answer to the confabulation failure dissected in Appendix A.+}

### 1.1 Where This Sits — Prompt-Level Improvement and Its Ceiling

{+But doubt-driven-development lives exactly under the ceiling this section describes. It is a per-turn discipline: its corrections are re-injected into context and compete for the same finite window, and they never become instinct. A fresh-context adversary fixes the claim _for this turn_; nothing about that fix survives the context window closing.+} Prompt-level improvement has a clear upper bound: a prompt can only encode so much, and every encoded rule competes for the same finite [-context window.-] {+context.+} Behavioral corrections accumulate until the instruction set is itself too large to attend to reliably. At that point, the improvement curve flattens—each new lesson displaces an old one rather than adding to a growing competence. Whether that plateau arrives at ten lessons or ten thousand is an open empirical question, and characterizing it directly is the most useful experiment a self-improving deployment can run. This paper asks what comes after: pushing past the prompt ceiling into _weight-level_ adaptation, where a lesson learned today is integrated into the model itself rather than re-injected into every future context. {+The sharpened claim is not "curiosity fixes confabulation" but rather: a fresh-context adversarial check fixes it for this turn; weight-level consolidation is what makes the fix durable past the context window.+} Prompt-level [-improvement is-] {+improvement—reflection cycles and doubt-driven adversaries alike—is+} the warm-up; weight-level consolidation is the thesis.

### 2.3 Level 2: Persistent Text Memories

{+The second of the three walls at Level 1—context-window pressure—is the one the field has attacked most aggressively since, and the most developed deployed counterexample to "text memories grow linearly" is worth confronting directly rather than waving away. Chopra's `headroom` (chopratejas/headroom, ~24.7k stars, Apache-2.0) implements **reversible CCR — Compress-Cache-Retrieve**: originals are cached and the model retrieves them on demand, so the context carries a compressed surrogate while the full content stays one pointer away. This is structurally convergent with the pointer-and-eviction intuitions this paper develops for its own episodic buffer, but far more built-out. It ships per-content-type compressors—statistical JSON-array crushing ("SmartCrusher"), AST-aware code compression via tree-sitter, and dedicated handlers for logs, diffs, and prose—claims 60–95% token savings at roughly zero accuracy delta, and, unusually for a memory system, backs the claim with a _reproducible eval suite_ (`python -m headroom.evals` over GSM8K, TruthfulQA, SQuAD, and BFCL), a trained compression model (Kompress-v2-base, released on HuggingFace), and proxy, MCP, and library form factors.+}

### 2.3 Level 2: Persistent Text Memories

{+Reversible compression substantially raises the Level-2 ceiling. The honest consequence for this paper is that the motivation for weight-level consolidation is _not_ "we ran out of context"—CCR pushes that wall much further out than a naive linear-growth story concedes, directly attacking both retrieval-degradation and context-window pressure. The motivation is the third wall, the one CCR does not touch. Compressed-and-cached text is still declarative: it is recalled, not generalized. CCR makes the filing cabinet enormously more efficient—it is, in effect, a filing cabinet with a brilliant index and a compression scheme—but it never becomes a research assistant, and it performs zero weight updates. What `headroom` has and this paper does not is a production-grade efficiency story for retrieval; what this paper has and `headroom` does not is a curiosity signal mined from retrieval _misses_ (Section 4.3) and a path from those misses into the weights.+}

### 2.3 Level 2: Persistent Text Memories

**Ceiling:** [-Text memories grow linearly and retrieval quality degrades with scale. More importantly,-] {+Even granting arbitrarily efficient context,+} stored text remains _declarative_—it tells the model facts but does not change how the model _processes_ information. A memory file {+(compressed or not)+} can record "the user prefers concise responses," but that preference must still be re-injected into every context window. It never becomes instinct. The model does not generalize from stored memories the way humans generalize from experience into [-intuition.-] {+intuition. The relevant limit is therefore not the size of the cabinet but its nature: efficient retrieval, however good, never crosses into generalized competence.+}

### 2.3 Level 2: Persistent Text Memories

This is the difference between a filing cabinet and a research assistant. A filing cabinet stores exactly what you put in it and retrieves it on [-request;-] {+request—and CCR makes it a faster, denser cabinet, not a different kind of thing;+} a research assistant notices what is missing and goes looking. Text memory, however sophisticated, is a filing cabinet. The remainder of this paper is about building the research assistant.

### 2.5 Level 4: Continual Learning — The Real Frontier

**Current wall:** No production LLM system implements true continual learning. The closest approaches are periodic fine-tuning on accumulated data, which is expensive and still risks forgetting, or ever-growing context and memory systems that never update weights at [-all.-] {+all. Reversible compression (Section 2.3) makes that second category dramatically more efficient, but it leaves the wall exactly where it was: efficiency is not generalization.+}

### 3.2 The Linguistic Curiosity Module

[-2. **Learnability Estimation:** Not all uncertainty deserves curiosity. A secondary network (or a dedicated attention head) estimates whether the uncertainty reflects a genuine knowledge gap (learnable) or inherent ambiguity (not learnable). This parallels the ICM's use of a learned feature space to filter noise.-]

### 3.2 The Linguistic Curiosity Module

{+2. **Learnability Estimation.** Not all uncertainty deserves curiosity. The system must separate a genuine knowledge gap (learnable) from inherent ambiguity (not learnable). An earlier instinct—train a small _supervised_ head over a frozen sentence-embedding space to score learnability directly—should be treated as a known trap, and we now have measured evidence for why. In an offline evaluation from our own ecosystem (the amygdala v3.1 intuition gate), a supervised harmfulness/danger head built on **frozen MiniLM embeddings was killed at AUROC 0.286—below chance**: a frozen embedding space simply could not carry that subtle a semantic judgment through a trained head bolted on top of it. In the same study, two _unsupervised, structural_ signals over the very same embeddings validated strongly—**k-NN novelty at AUROC 0.875** and **clause-cosine incongruity at 0.896**. We are explicit about the boundary: that result is from a _harmfulness_ labeling task, not a learnability task, and it is specific to frozen MiniLM. But "learnability" and "harmfulness" are the same _kind_ of judgment—a subtle, semantic property we were tempted to read off a frozen feature space with a small supervised head—and the failure mode generalizes. The defensible LCM design is therefore the unsupervised one: estimate a gap's learnability from **novelty relative to the existing knowledge manifold** (k-NN distance to stored representations) and **incongruity/surprise** (clause-cosine), rather than from a supervised verdict. This is also closer to Schmidhuber's own framing—learning progress is novelty that is _structurally adjacent_ to what is already understood—and it dovetails with the knowledge-adjacency term the priority score uses in Section 3.3. If a supervised head is used at all, it must unfreeze or fine-tune the encoder; a trained head over frozen features is not merely weaker, it can fall below chance on judgments of this kind.+}

### 4.1 The Five-Stage Loop

where $\alpha, \beta, \gamma, \delta$ are tunable weights normalized to sum to 1. Initial values ($\alpha=0.3$, $\beta=0.3$, $\gamma=0.25$, $\delta=0.15$) reflect the hypothesis that learnability and user relevance dominate, while adjacency and recency serve as tiebreakers. These weights should be tuned via grid search on a held-out set of curiosity-driven learning [-outcomes.-] {+outcomes. Note that with the unsupervised learnability estimator of Section 3.2, the learnability and knowledge-adjacency terms become closely related—both are novelty-relative-to-the-manifold measures—so in practice they should be computed from the same embedding geometry and decorrelated during tuning.+}

### 4.3 Gaps the Real World Hands You for Free

- **Retrieval misses.** The agent searches its own memory for something it believes it stored and comes back empty. As noted in Section 2.2, each miss names a specific gap. {+This is precisely the signal that an efficient retrieval layer like reversible CCR (Section 2.3) does _not_ generate for itself—a better cabinet retrieves more successfully, but a miss against it is still a miss, and still a gap worth feeding into the loop.+} - **Capability failures.** A planned step calls a tool the agent does not have, lacks permission for, or finds unavailable. Each failure is a precise, externally grounded gap—"learn to use X," "request access to Y"—and far cleaner than the soft signal of hedged prose. - **User corrections.** When a user corrects the agent, the gap is not only identified but already paired with its ground truth.

### 5.5 When Is Curiosity Cheaper Than a Bigger Model?

The honest competitor to curiosity-driven fine-tuning is not "do nothing"—it is "rent a bigger frozen [-model."-] {+model," and increasingly "rent a bigger frozen model with reversible-CCR memory bolted on."+} The comparison turns on a single question: is the knowledge you need _general_ or _personal_?

### 5.5 When Is Curiosity Cheaper Than a Bigger Model?

For general capability gains—better reasoning, broader world knowledge—scaling almost always wins. A larger base model amortizes its training cost across every user, and the marginal cost to any one deployment is just inference. Spending ~$2K–4K/month to nudge a 70B model upward on MMLU is poor economics when a frontier model already scores higher and is a configuration change [-away.-] {+away. The same logic now extends to context: where the bottleneck is _recalling_ a large private corpus rather than _generalizing_ from it, an efficient retrieval layer (Section 2.3) is far cheaper than nightly fine-tuning, and the curiosity budget should not be spent on what compression already solves.+}

### 5.5 When Is Curiosity Cheaper Than a Bigger Model?

The calculus inverts for knowledge that is _specific to one deployment and absent from any base model_: the user's evolving preferences, a private corpus, the recurring failure patterns of this particular agent in this particular environment. No amount of [-scaling teaches-] {+scaling—and no amount of compression—teaches+} a frozen model what it was never trained [-on.-] {+on, or turns recalled facts into instinct.+} Here the nightly-consolidation budget buys something a bigger model cannot sell—and the comparison is not against the full $2K–4K figure but against its marginal slice, since the inference line ($1,080–2,160) is paid either way. The genuinely curiosity-attributable spend is the consolidation, validation, and alignment lines: roughly $1,150–1,800/month at 70B, and as little as $50–100/month for a 7B personalization model. Curiosity-driven fine-tuning earns its keep precisely where scaling [-is-] {+and compression are+} structurally unable to help.

### 7.4 Evaluation Framework

{+A discipline worth importing wholesale here comes from the memory-systems work we positioned against in Section 2.3. `headroom` (Chopra) does not merely _claim_ 60–95% token savings at near-zero accuracy delta; it ships a runnable eval suite (`python -m headroom.evals` over GSM8K, TruthfulQA, SQuAD, BFCL) so the claim can be reproduced by anyone. The four metrics above are, in the current paper, specified rather than executed—precisely the gap that a credible self-improvement claim cannot afford. The next implementation milestone for the CCA should therefore be a single-command harness that computes curiosity precision and retention stability against fixed seeds and held-out sets, on the same footing `headroom` already meets for compression. A system that claims to self-improve must be reproducible about it, not just assertive.+}

### 9.3 Bounding the Drive — Safety for a Self-Improving Agent

- **The validation gate is mandatory, not advisory.** No adapter reaches deployment without passing the capability matrix (Section 7.2). Any single-benchmark regression beyond the drift budget ($\leq 2\%$) triggers automatic rejection and rollback to the prior adapter. The system cannot consolidate its way past its own safety check, because the check runs _before_ the merge, every time. In the reference deployment this gate is not a future promise: the consolidation supervisor and the capability-matrix harness that enforces the two-percent bound are already built and tested; it is the trainer feeding them that has yet to run. - **The agent cannot validate its own facts.** Hallucination amplification—the failure mode where a model trains on its own confident-but-wrong output—is barred structurally: a gap detected from the model's _own_ uncertainty is a question, never a fact. It may only ever trigger external verification (web search, the user), and only externally validated information is eligible to enter the training pipeline. The agent's curiosity can ask, but it cannot answer itself into the weights. {+At the prompt level, the fresh-context adversary of doubt-driven-development (Section 1.1) is a complementary guard: it forces a claim to survive a reviewer that never saw the original reasoning before that claim is ever trusted, let alone consolidated.+} - **Curiosity is budgeted.** The compute reserved for self-generated investigation is capped (Section 3.2), and the active-learning queue is bounded per cycle. An agent that wanders is an agent burning the user's money on tangents; the priority score plus a hard per-day cap keep exploration on a leash. - **Alignment is part of the gate, not a separate concern.** Value drift is checked the same way capability regression is: alignment benchmarks sit inside the validation suite, and periodic GRPO on curated preference data corrects drift before it compounds. {+A note on the enforcement substrate: in the reference deployment, the agent's pre-execution safety reflex (the AEGIS gate) is no longer observe-only—it now denies disallowed actions before they run rather than merely logging them. The relevance to this paper is that a self-improving agent's safety boundary should be _enforced_ at the point of action, not advisory; an unenforced gate is indistinguishable from no gate once the agent is choosing its own training data.+} - **Above a threshold, a human decides.** Consolidations that exceed a configurable drift threshold are not auto-merged; they are held for human approval. The agent's autonomy is real but bounded, and the boundary is set by the operator, not the agent. These bounds are the curiosity-side instance of a broader safety principle for autonomous agents: a self-improving system must be constrained in what it can modify, and required to seek human approval for any change above a defined safety threshold.

### 10. Conclusion

We have also placed this work on a clear [-gradient.-] {+gradient, with deployed open-source systems marking each rung.+} Prompt-level self-improvement already runs in production and demonstrably [-works, but-] {+works—and a fresh-context adversarial discipline like doubt-driven-development is the current best answer to the confabulation failure that motivates the whole paper—but+} it is bounded by the context window; the architecture proposed here is what lies past that ceiling. {+Efficient memory, too, has a deployed champion in reversible compression, which pushes the retrieval ceiling far further out than the field once assumed—but compressed text is still recalled, never generalized, and the wall it leaves standing is exactly the one weight-level consolidation exists to break.+} And [-it-] {+the architecture+} is bounded in the other direction too: curiosity that cannot validate its own facts, cannot exceed its compute budget, and cannot merge a regression past the capability gate is curiosity that can be trusted to run unattended.

### References

{+Chopra, T. (2026). headroom: Reversible Compress-Cache-Retrieve for LLM context. Open-source software (Apache-2.0), chopratejas/headroom; companion compression model Kompress-v2-base (HuggingFace).+}

### References

{+Osmani, A. (2026). agent-skills: Composable agent disciplines, including doubt-driven-development. Open-source software, addyosmani/agent-skills.+}

### Appendix A: Case Study — The API Limit Incident

{+There is a prompt-level fix for exactly this failure, and it is worth naming precisely because it shows where the prompt ceiling sits. Doubt-driven-development (Osmani, 2026; Section 1.1) would have caught this turn: the confabulated claim "my usage caused the cap" would have been EXTRACTed to its bare assertion, handed to a fresh-context reviewer with no access to the agent's self-justifying reasoning, and that reviewer—seeing only "agent asserts it exhausted the budget" with no supporting evidence—would have DOUBTed it and demanded the billing logs before the claim was trusted. That is the right fix for the turn, and a deployed, widely-used one. What it does not do is make the fix durable: the lesson lives in the prompt, competes for the context window, and evaporates when the window closes. The next time the same ambiguous error arrives in a fresh session, the adversary has to re-derive the doubt from scratch.+}

### Appendix A: Case Study — The API Limit Incident

[-There-] {+That+} is [-a-] {+the bridge to the+} second [-lesson here, and it-] {+lesson, which+} points directly at Section 4.3. This incident was a knowledge gap of the cleanest possible kind—externally grounded, paired with a ground-truth correction the moment the operator explained the cap. A system that logged such corrections as curiosity signals would not merely have avoided the mistake; it would have had ready-made, high-confidence training data for its next [-consolidation.-] {+consolidation, encoding "ambiguous errors require investigation" as instinct rather than re-deriving it adversarially every session.+} The failures an agent already produces are the syllabus it most needs to [-study.-] {+study—and a fresh-context adversary plus weight-level consolidation are the same fix at two different durations.+}

### Appendix B: Expert Perspectives

**The ML Engineer:** "The cost numbers are real, and that's what makes this exciting. But I'd push back on the progressive complexity timeline. We've shown that LoRA merging can handle factual updates and preference shifts today. The hard part isn't consolidation—it's training data quality. Your episodic buffer needs to generate training pairs that are _better_ than what the model already knows. That means your active learning pipeline needs genuine quality filters, not just novelty detection. [-I'd invest most of-] {+And one more thing: don't bolt a supervised learnability classifier onto a frozen embedding model and trust it. We measured that exact shortcut on a sibling judgment task and it landed below chance—AUROC 0.286. The unsupervised structural signals on+} the [-engineering effort there."-] {+same embeddings worked fine. Estimate learnability from novelty and incongruity, not from a trained head over frozen features."+}

### Appendix B: Expert Perspectives

**The Pragmatist:** "What can we build this year? A 7B model—Llama 3.1 8B or Qwen 2.5 7B—with the full curiosity-memory-consolidation loop, running on a single rented A100, for under $200/month. It won't match GPT-4. But it will be _a system that gets better every day at the specific things its user cares about._ That's not AGI. It's something arguably more useful: AGP—Artificial General Personalization. Start there. Scale [-later."-] {+later. And before you write a line of the trainer, steal headroom's eval discipline: a one-command harness that reproduces your curiosity-precision and retention numbers on fixed seeds. Reproducibility is cheaper to build first than to retrofit."+}

### Appendix B: Expert Perspectives

_Correspondence: This paper is a research synthesis and architectural proposal. The Consolidative Curiosity Architecture (CCA) described herein is a proposed design. The prompt-level reflection cycle and the safety-threshold approval principle referenced in the text describe deployed mechanisms in a related agent system. The front half of the curiosity loop in Section 4—the episodic gap store, a heuristic uncertainty detector, the tool-failure classifier, the nightly re-scoring pass, and the idle goal-proposal trigger—is wired and unit-tested, as is the validation gate that guards Stage 5. The {+pre-execution safety gate referenced in Section 9.3 now enforces denials before actions run rather than logging them; the unsupervised-vs-supervised learnability finding in Section 3.2 is drawn from a sibling harmfulness-classification evaluation on frozen sentence embeddings. The+} GPU-bound LoRA training of Stage 5 remains an external deliverable, unrun at the time of writing. We encourage the community to implement, test, and iterate on these ideas._
