v1.3 → v1.4
What changed from v1.3 to v1.4
From v1.3 (2 Jun) to v1.4 (2 Jun): 12,198 words to 12,291 words, 269 words in new or rewritten paragraphs and 176 taken out, 16 paragraphs changed.
Caching section rewritten around the authors' own systemThe prompt-caching technique (B1) now describes how the authors' own system marks the cached part of the prompt, next to the leaked Claude Code marker, instead of a one-line setting. References to the authors' other papers are replaced by short self-contained definitions, for example of the personality score SyncScore.
- The compaction and tool-pruning sections no longer compare against "our v1.1 design".
- Small wording changes elsewhere.
v1.3 · 2 June 2026v1.4 · 2 June 2026
··· 51 unchanged paragraphs folded ···
v1.3 · 2.5 Industrial Convergence — Evidence from the Claude Code Source Exposure| MYELIN tier | Claude Code equivalent | Source | |---|---|---| | Continuous indexing (B6) | MicroCompact — per-tool-result clearing during the conversation | `services/compact/microCompact.ts` | | Per-turn / per-session retrieval (B4) | Session Compact — full-history summarization via a forked agent | `services/compact/compact.ts`, `sessionMemoryCompact.ts` | | Sleep consolidation (cf. J5) | autoDream — idle-triggered background consolidation | `services/autoDream/autoDream.ts` |
v1.4 · 2.5 Industrial Convergence — Evidence from the Claude Code Source Exposure| MYELIN tier | Claude Code equivalent | Source | |---|---|---| | Continuous indexing (B6) | MicroCompact — per-tool-result clearing during the conversation | `services/compact/microCompact.ts` | | Per-turn / per-session retrieval (B4) | Session Compact — full-history summarization via a forked agent | `services/compact/compact.ts`, `sessionMemoryCompact.ts` | | Sleep consolidation (idle-time memory consolidation) | autoDream — idle-triggered background consolidation | `services/autoDream/autoDream.ts` |
··· 34 unchanged paragraphs folded ···
v1.3 · B1. System Prompt Caching**Status:** [Y] Implemented. Configuration: ``` cacheRetention: "long" ```
removed in v1.4
not in v1.3
v1.4 · B1. System Prompt Caching**Status:** [Y] Implemented. The static portion of the system prompt is emitted as a content block carrying `cache_control: { type: "ephemeral" }`, with extended (1-hour) retention requested where the API supports it; the per-turn portion is split off into a separate uncached block (see the boundary mechanism below).
··· 2 unchanged paragraphs folded ···
v1.3 · B1. System Prompt Caching**Production validation — the dynamic boundary.** The leaked Claude Code source implements exactly this prefix-discipline. `constants/prompts.ts` defines a `SYSTEM_PROMPT_DYNAMIC_BOUNDARY` sentinel: everything before it is globally cacheable (shared across sessions when `shouldUseGlobalCacheScope()` is on), and per-session content goes after. Cache-breaking sections are not just placed correctly — they are *named to be dangerous*: the helper that emits an uncacheable section is literally `DANGEROUS_uncachedSystemPromptSection()` (`constants/systemPromptSections.ts`). Making "this breaks the cache" explicit in the API is the same discipline MYELIN argues for in Section 8.1; seeing it enforced by naming in shipping code is good evidence the principle is load-bearing, not aesthetic.
removed in v1.4
not in v1.3
v1.4 · B1. System Prompt Caching**The dynamic boundary, in two codebases.** The prefix-discipline this technique depends on shows up as an explicit marker in both the system we run and the leaked Claude Code source. TinkerClaw splits every system prompt at a `__PREFRONTAL_CACHE_BOUNDARY__` sentinel (`src/fork/prompt-cache-boundary.ts`): the text before the marker becomes a single content block carrying `cache_control: { type: "ephemeral" }`; everything after it is emitted as an uncached block that may change each turn. The split is the operational form of "keep the prefix static" — dynamic context is physically moved past the cache line rather than mixed into it. Claude Code does the same with a `SYSTEM_PROMPT_DYNAMIC_BOUNDARY` sentinel (`constants/prompts.ts`): everything before it is globally cacheable (shared across sessions when `shouldUseGlobalCacheScope()` is on), per-session content goes after, and the helper that emits an uncacheable section is named to warn — `DANGEROUS_uncachedSystemPromptSection()` (`constants/systemPromptSections.ts`). Two systems, the same line drawn in the same place: strong evidence the principle in Section 8.1 is load-bearing, not aesthetic.
··· 17 unchanged paragraphs folded ···
v1.3 · B4. Context Compaction**Two distinct operations, not one.** Our v1.1 taxonomy conflated two things that the Claude Code source treats separately, and the distinction is worth importing. *Summarization* (lossy, comprehensive) compresses a span of conversation into prose — Claude Code calls this Context Collapse, gated behind a `CONTEXT_COLLAPSE` feature flag in `services/compact/autoCompact.ts`. *File extraction* (lossless, selective) pulls exact facts out to a file that lives outside the summary — Claude Code's Session Memory (`services/SessionMemory/`) does this. The two have different failure modes: summarization can hallucinate or drift; extraction can only omit. A precise compaction tier should run both — extract the facts you must not lose, then summarize the rest — rather than forcing everything through one lossy pass. We recommend B4 implementations expose extraction and summarization as separate stages.
v1.4 · B4. Context Compaction**Two distinct operations, not one.** Compaction is easy to treat as a single step, but the Claude Code source separates two operations whose distinction is worth importing. *Summarization* (lossy, comprehensive) compresses a span of conversation into prose — Claude Code calls this Context Collapse, gated behind a `CONTEXT_COLLAPSE` feature flag in `services/compact/autoCompact.ts`. *File extraction* (lossless, selective) pulls exact facts out to a file that lives outside the summary — Claude Code's Session Memory (`services/SessionMemory/`) does this. The two have different failure modes: summarization can hallucinate or drift; extraction can only omit. A precise compaction tier should run both — extract the facts you must not lose, then summarize the rest — rather than forcing everything through one lossy pass. We recommend B4 implementations expose extraction and summarization as separate stages.
··· 18 unchanged paragraphs folded ···
v1.3 · B6. Surgical Tool Output Pruning**Production validation — MicroCompact.** Claude Code ships exactly this technique, and more surgically than our v1.1 design. Its `microCompact.ts` compacts only specific tool results — `FileRead`, `Bash`, `Grep`, `Glob`, `WebSearch`, `WebFetch`, `FileEdit`, `FileWrite` (eight tool types, confirmed in the imports). Old results are replaced in place with a stub — the literal constant is `TIME_BASED_MC_CLEARED_MESSAGE = '[Old tool result content cleared]'` — and clearing is time-gated (a configurable gap threshold; see `timeBasedMCConfig.ts`). Two refinements over our design are worth adopting: (1) restrict pruning to tool types whose output is large and rarely re-referenced, rather than pruning all messages; and (2) **cache-pinning** — the cleared stubs are kept at the *original positions* in the message list so the prompt-cache prefix up to that point still matches. This is the production answer to the cache-vs-pruning tension B6 raises in the abstract: you can prune content without moving anything, so the cache survives. Note `microCompact.ts` deliberately runs cached MC only on the main thread, to avoid forked agents corrupting the shared cache state — a subtlety our design had not anticipated.
v1.4 · B6. Surgical Tool Output Pruning**Production validation — MicroCompact.** Claude Code ships exactly this technique, and more surgically than the design above. Its `microCompact.ts` compacts only specific tool results — `FileRead`, `Bash`, `Grep`, `Glob`, `WebSearch`, `WebFetch`, `FileEdit`, `FileWrite` (eight tool types, confirmed in the imports). Old results are replaced in place with a stub — the literal constant is `TIME_BASED_MC_CLEARED_MESSAGE = '[Old tool result content cleared]'` — and clearing is time-gated (a configurable gap threshold; see `timeBasedMCConfig.ts`). Two refinements over our design are worth adopting: (1) restrict pruning to tool types whose output is large and rarely re-referenced, rather than pruning all messages; and (2) **cache-pinning** — the cleared stubs are kept at the *original positions* in the message list so the prompt-cache prefix up to that point still matches. This is the production answer to the cache-vs-pruning tension B6 raises in the abstract: you can prune content without moving anything, so the cache survives. Note `microCompact.ts` deliberately runs cached MC only on the main thread, to avoid forked agents corrupting the shared cache state — a subtlety our design had not anticipated.
··· 21 unchanged paragraphs folded ···
v1.3 · B9. Mid-Context Reinjection**Mechanism:** Long conversations suffer from *personality drift* — the agent's behavior gradually diverges from its configured personality as the system prompt's influence is diluted by accumulated conversation context. We measure this as SyncScore (a metric from our J4 Identity Persistence paper).
v1.4 · B9. Mid-Context Reinjection**Mechanism:** Long conversations suffer from *personality drift* — the agent's behavior gradually diverges from its configured personality as the system prompt's influence is diluted by accumulated conversation context. We measure this with SyncScore, a 0–1 coherence score (described in Section 5.2) that compares an agent's live responses against its configured personality; it falls as conversation context dilutes the system prompt's influence.
··· 120 unchanged paragraphs folded ···
v1.3 · 5.2 Quality Metrics**SyncScore.** Personality coherence metric from our J4 paper. Measures how well the agent's responses match its configured personality across sessions. Range 0–1, target >0.85.
v1.4 · 5.2 Quality Metrics**SyncScore.** A personality-coherence metric: it measures how well the agent's responses match its configured personality across sessions by scoring live output against the personality specification. Range 0–1, target >0.85.
··· 27 unchanged paragraphs folded ···
v1.3 · 6.5 Industrial Convergence as Validation| MYELIN claim | Claude Code shipping equivalent | Status of our claim | |---|---|---| | Three-tier compaction is the natural architecture (Sec 2.5) | MicroCompact / Session Compact / autoDream | Independently confirmed | | Cache stability over a static prefix is the core lever (B1, 8.1) | `SYSTEM_PROMPT_DYNAMIC_BOUNDARY`, `DANGEROUS_uncached…` | Confirmed, enforced by API naming | | Prune tool outputs without breaking cache (B6) | Cache-pinned MicroCompact, in-place stubs | Confirmed, more surgical than ours | | Compaction can reuse the parent cache (B4) | `runForkedAgent` + `CacheSafeParams` | Confirmed; we had only theorized it | | Stop spending when returns diminish (4.5) | `DIMINISHING_THRESHOLD = 500`, `COMPLETION_THRESHOLD = 0.9` | New; we under-modeled this | | Background consolidation gated cheaply (cf. J5, D2) | autoDream gates: time 24h → 5 sessions → lock | Confirmed gate ordering |
v1.4 · 6.5 Industrial Convergence as Validation| MYELIN claim | Claude Code shipping equivalent | Status of our claim | |---|---|---| | Three-tier compaction is the natural architecture (Sec 2.5) | MicroCompact / Session Compact / autoDream | Independently confirmed | | Cache stability over a static prefix is the core lever (B1, 8.1) | `SYSTEM_PROMPT_DYNAMIC_BOUNDARY`, `DANGEROUS_uncached…` | Confirmed, enforced by API naming | | Prune tool outputs without breaking cache (B6) | Cache-pinned MicroCompact, in-place stubs | Confirmed, more surgical than ours | | Compaction can reuse the parent cache (B4) | `runForkedAgent` + `CacheSafeParams` | Confirmed; we had only theorized it | | Stop spending when returns diminish (4.5) | `DIMINISHING_THRESHOLD = 500`, `COMPLETION_THRESHOLD = 0.9` | New; we under-modeled this | | Background consolidation gated cheaply (D2) | autoDream gates: time 24h → 5 sessions → lock | Confirmed gate ordering |
··· 1 unchanged paragraph folded ···
v1.3 · 6.5 Industrial Convergence as ValidationA note on consolidation, relevant to our J5 line of work: autoDream's consolidation prompt (`services/autoDream/consolidationPrompt.ts`) runs an information *diet* we found instructive — "grep narrowly, don't read whole files," "look only for things you already suspect matter," convert relative dates to absolute, delete contradicted facts at the source, and keep the memory index under a hard line/byte cap with one-line entries. This is a precision-first stance (read little, write little) where MYELIN's embedding-based retrieval is recall-first. Neither is strictly better: grep-narrow risks missing context it didn't suspect; embedding-broad risks pulling in noise. A consolidation pass that uses embeddings to *find candidates* and grep to *verify exact facts* would combine the two.
v1.4 · 6.5 Industrial Convergence as ValidationA note on consolidation, relevant to any background memory-consolidation pass: autoDream's consolidation prompt (`services/autoDream/consolidationPrompt.ts`) runs an information *diet* we found instructive — "grep narrowly, don't read whole files," "look only for things you already suspect matter," convert relative dates to absolute, delete contradicted facts at the source, and keep the memory index under a hard line/byte cap with one-line entries. This is a precision-first stance (read little, write little) where MYELIN's embedding-based retrieval is recall-first. Neither is strictly better: grep-narrow risks missing context it didn't suspect; embedding-broad risks pulling in noise. A consolidation pass that uses embeddings to *find candidates* and grep to *verify exact facts* would combine the two.
··· 28 unchanged paragraphs folded ···
v1.3 · 8.1 The Surprising Dominance of CachingThis is fundamentally at odds with how most agent frameworks are designed. They inject dynamic context (current time, recent events, user presence status) into the system prompt because it's convenient. Each dynamic injection breaks the cache. Budget Prompting argues that dynamic context should be injected as user-role messages *after* the cached prefix, not *within* it. Claude Code's `SYSTEM_PROMPT_DYNAMIC_BOUNDARY` (Section 2.5) is the same argument made in production code: there is a literal marker dividing the cacheable prefix from per-session content, and the only function that writes past it is named `DANGEROUS_uncached…`. When the principle is correct, the implementation has to draw that line somewhere; it's reassuring that two systems drew it in the same place.
v1.4 · 8.1 The Surprising Dominance of CachingThis is fundamentally at odds with how most agent frameworks are designed. They inject dynamic context (current time, recent events, user presence status) into the system prompt because it's convenient. Each dynamic injection breaks the cache. Budget Prompting argues that dynamic context should be injected as user-role messages *after* the cached prefix, not *within* it. Both systems we examined draw that line explicitly: TinkerClaw splits the prompt at a `__PREFRONTAL_CACHE_BOUNDARY__` marker and caches only the static block, and Claude Code's `SYSTEM_PROMPT_DYNAMIC_BOUNDARY` (Section 2.5) does the same, with the only helper that writes past it named `DANGEROUS_uncached…`. When the principle is correct, the implementation has to draw that line somewhere; two independent systems drawing it in the same place is good evidence the line is real.
··· 16 unchanged paragraphs folded ···
v1.3 · 8.5 Limitations**Flat-rate pricing assumption.** Many techniques are optimized for flat-rate plans with rate limits. Pure metered usage would change the optimization landscape (caching becomes less important relative to context minimization).
v1.4 · 8.5 Limitations**Flat-rate pricing assumption.** Many techniques are optimized for flat-rate plans with rate limits. Pure metered usage would shift the priorities (caching becomes less important relative to context minimization).
··· 29 unchanged paragraphs folded ···
v1.3 · Appendix B: Glossary- **Budget Prompting:** A family of techniques that reduce the per-turn cost of persistent LLM agents without degrading quality. - **Cache hit rate (CHR):** Percentage of system prompt tokens served from provider cache. - **Context window:** The total token capacity of a single LLM request (input + output). - **ITPM:** Input tokens per minute — a rate limit metric on flat-rate plans. - **Prefix stability:** The property of a system prompt remaining unchanged across turns, enabling cache reuse. - **RPD:** Requests per day. - **RPM:** Requests per minute. - **SyncScore:** Personality coherence metric (see J4 paper). - **Token bucket:** Rate-limiting algorithm that smooths bursty usage. - **TPT:** Tokens per turn — average total tokens (input + output) per conversational turn.
v1.4 · Appendix B: Glossary- **Budget Prompting:** A family of techniques that reduce the per-turn cost of persistent LLM agents without degrading quality. - **Cache hit rate (CHR):** Percentage of system prompt tokens served from provider cache. - **Context window:** The total token capacity of a single LLM request (input + output). - **ITPM:** Input tokens per minute — a rate limit metric on flat-rate plans. - **Prefix stability:** The property of a system prompt remaining unchanged across turns, enabling cache reuse. - **RPD:** Requests per day. - **RPM:** Requests per minute. - **SyncScore:** Personality-coherence metric (0–1) comparing live agent output against its configured personality. - **Token bucket:** Rate-limiting algorithm that smooths bursty usage. - **TPT:** Tokens per turn — average total tokens (input + output) per conversational turn.
··· 2 unchanged paragraphs folded ···
v1.3 · References- Anthropic (2026). Claude Code source analysis. Internal codebase exposed via npm source map, `@anthropic-ai/claude-code` v2.1.88; ~512,000 lines of TypeScript. Compaction and budget code (`services/compact/`, `services/autoDream/`, `query/tokenBudget.ts`, `constants/prompts.ts`) analyzed April 2026. Cited as primary-source code, not endorsed documentation. - Kwon, W., et al. (2023). Efficient Memory Management for Large Language Model Serving with PagedAttention. *SOSP '23*. - Lewis, P., et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. *NeurIPS 2020*. - Madaan, A., et al. (2023). Self-Refine: Iterative Refinement with Self-Feedback. *NeurIPS 2023*. - Packer, C., et al. (2023). MemGPT: Towards LLMs as Operating Systems. *arXiv:2310.08560*. - Rajbhandari, S., et al. (2020). ZeRO: Memory Optimizations Toward Training Trillion Parameter Models. *SC '20*. - Serra, O. (2026a). TOTAL RECALL: Persistent Memory Architecture for Stateless AI Agents. *TinkerClaw Working Papers, J1*. - Serra, O. (2026b). SYNAPSE: Identity Persistence Across Sessions in Persistent Memory Agents. *TinkerClaw Working Papers, J4*. - Serra, O. (2026c). CEREBELLUM: Structured Nightly Prompting for Emergent Intelligence. *TinkerClaw Working Papers, J5*. - Sheng, Y., et al. (2023). FlexGen: High-Throughput Generative Inference of Large Language Models with a Single GPU. *ICML 2023*. - Wei, J., et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. *NeurIPS 2022*. - Yao, S., et al. (2023). ReAct: Synergizing Reasoning and Acting in Language Models. *ICLR 2023*.
v1.4 · References- Anthropic (2026). Claude Code source analysis. Internal codebase exposed via npm source map, `@anthropic-ai/claude-code` v2.1.88; ~512,000 lines of TypeScript. Compaction and budget code (`services/compact/`, `services/autoDream/`, `query/tokenBudget.ts`, `constants/prompts.ts`) analyzed April 2026. Cited as primary-source code, not endorsed documentation. - Kwon, W., et al. (2023). Efficient Memory Management for Large Language Model Serving with PagedAttention. *SOSP '23*. - Lewis, P., et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. *NeurIPS 2020*. - Madaan, A., et al. (2023). Self-Refine: Iterative Refinement with Self-Feedback. *NeurIPS 2023*. - Packer, C., et al. (2023). MemGPT: Towards LLMs as Operating Systems. *arXiv:2310.08560*. - Rajbhandari, S., et al. (2020). ZeRO: Memory Optimizations Toward Training Trillion Parameter Models. *SC '20*. - Sheng, Y., et al. (2023). FlexGen: High-Throughput Generative Inference of Large Language Models with a Single GPU. *ICML 2023*. - Wei, J., et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. *NeurIPS 2022*. - Yao, S., et al. (2023). ReAct: Synergizing Reasoning and Acting in Language Models. *ICLR 2023*.
··· 3 unchanged paragraphs folded ···
v1.3 · References*MYELIN v1.3 — TinkerClaw Working Papers, J12* *© 2026 Oscar Serra, Jarvis. All rights reserved.*
v1.4 · References*MYELIN — TinkerClaw Working Paper* *© 2026 Oscar Serra, Jarvis. All rights reserved.*
Changed paragraphs in the same form, for scripts: JSON
· Markdown