A recent leak of the source code for Anthropic’s Claude Code has unveiled intricate details about the company’s framework surrounding its proprietary Claude model. Spanning over 512,000 lines of code and more than 2,000 files, the exposed material not only showcases the structure of the program but also hints at previously hidden or inactive features that could play a role in the model’s future enhancements.
Among the standout elements identified in the code is a component known as Kairos, designed as a persistent daemon. This feature is intended to run in the background, functioning even when the terminal window for Claude Code is closed. The system employs periodic prompts to assess whether new actions are warranted and includes a “PROACTIVE” flag intended to surface information necessary for users, even if it hasn’t been explicitly requested.
Kairos leverages a file-based memory system, intended to maintain continuity across user sessions. A specific prompt, currently disabled under the “KAIROS” flag, outlines the system’s purpose: to cultivate a comprehensive understanding of the user, their preferred collaboration methods, behaviors to either encourage or avoid, and the contextual background relevant to the tasks at hand.
To further streamline the management of this memory system across user interactions, the source code introduces the AutoDream system. This feature activates either when a user becomes idle or when they request a pause at the end of a session. The AutoDream system allows Claude Code to engage in a reflective process, described as “performing a dream” over the information accumulated throughout the session.
During this reflective “dream” phase, Claude Code is tasked with reviewing the day’s communications to identify any significant new information, consolidating it effectively to avoid redundancy and contradictions. Additionally, it will prune outdated or excessively verbose memories, while staying vigilant for any memories that may have drifted, a known challenge when integrating memory features into AI systems. The aim of this operation is to synthesize recent learnings into organized, durable memories, facilitating a smoother reorientation in future interactions.


