This is Part 3 of a 5-part series: "The Architecture of Agency." Part 1 covered the harness (Bun, context pipeline, YOLO). Part 2 revealed the model roadmap (Mythos, ULTRAPLAN, Undercover Mode). Now we examine the feature that represents the biggest paradigm shift: KAIROS.
KAIROS (καιρός) is Ancient Greek for "the right moment" — the opportune time to act. In the leaked Claude Code source, it’s referenced over 150 times across multiple modules. It represents Anthropic’s most ambitious feature: an always-on autonomous daemon that doesn’t wait for your prompt. It watches, learns, consolidates its memory, and acts when the moment is right.
1. The Tick Loop: The Heartbeat of an Autonomous Agent
Current AI assistants are reactive: you type, they respond. KAIROS inverts this model entirely.
1.1 How It Works
The system injects periodic <tick> messages into KAIROS’s message queue when the user is idle. Each tick is essentially a "heartbeat" — a prompt that says: "You’re awake. What now?"
On each tick, KAIROS evaluates its context and decides:
- Act: Execute a proactive task (fix a spotted bug, update a stale test, organize imports)
- Sleep: Call the
SleepTooland wait for the next tick
"If you have nothing useful to do on a tick, you MUST call Sleep."
— src/constants/prompts.ts:L870-L886
1.2 The Engineering Details
| Component | Location | Detail |
| Tick injection | src/cli/print.ts:L1834-L1856 | Uses setTimeout(0) to yield to event loop, keeping user input preemptable at all times |
| SleepTool | src/tools/SleepTool/prompt.ts:L7-L17 | Explicitly disabled unless proactive mode activates. Model balances wake-up costs against 5-minute prompt cache expiration |
| Decision logic | src/constants/prompts.ts | System prompt composes tick loop, sleep tool, blocking budget, and notification into a coherent decision cycle |
The elegance is in the simplicity: a single directive ("sleep if nothing useful to do") combined with five mechanisms creates an autonomous decision loop that knows when to act and when to stay silent.
2. The 15-Second Blocking Budget
This is a masterclass in UX engineering for autonomous agents. The problem: if an always-on agent starts a complex task, it could freeze your terminal and destroy your workflow. The solution:
ASSISTANT_BLOCKING_BUDGET_MS = 15_000
Source: src/tools/BashTool/BashTool.tsx:L57
The Rule: If KAIROS identifies a proactive task, it has exactly 15 seconds to complete it. If the task exceeds this budget, the code at BashTool.tsx:L973-L983 forces the process to background silently. The .unref() call on timers ensures the backgrounded process doesn’t keep the main process alive.
The UX Result: KAIROS is a "ghost in the machine" — felt but never seen. It fixes things, but it never makes you wait. If you’re typing, it yields instantly. If you’re idle, it uses those 15-second windows to chip away at tasks.
The Analogy: Imagine a janitor who only cleans when you leave the room, and always finishes before you come back. If they can’t finish in 15 seconds, they quietly move the cleaning supplies out of sight and resume later. You never see them, but the room is always cleaner than you left it.
3. Append-Only Daily Logs: The Audit Trail
Unlike current chatbots that "forget" the beginning of a conversation when context fills up, KAIROS maintains a persistent, append-only log system.
3.1 The Structure
| File Pattern | logs/YYYY/MM/YYYY-MM-DD.md |
| Rule | Never rewrite — only append. The agent cannot delete or modify its own history. |
| Location | src/memdir/memdir.ts:L319-L348 |
| Purpose | Complete audit trail of all observations, decisions, and autonomous actions |
The append-only constraint is a security and trust design. If the agent could rewrite its own logs, it could hide mistakes or cover up unintended actions. By making logs immutable, Anthropic ensures that every decision KAIROS makes is permanently recorded and auditable.
3.2 The Tick-Log Interaction
On each <tick>, KAIROS reviews the current day’s log and the accumulated context to make its decision. This creates a feedback loop:
- Action → logged observation → next tick reads observation → informs next decision
- Over hours and days, the log becomes a detailed "journal" of the project’s evolution from the agent’s perspective
4. autoDream: Memory Consolidation While You Sleep
This is perhaps the most fascinating subsystem in the entire leak. How does an agent stay smart over a month-long project? It "dreams."
4.1 The Dream Cycle
When the user is idle for an extended period, KAIROS triggers an autoDream cycle — a reflective pass over its own accumulated logs. The process:
- Read: Scan all recent daily logs
- Merge: Combine duplicate or redundant observations into consolidated entries
- Resolve: Identify contradictions (e.g., "file X uses pattern A" vs. later "file X was refactored to pattern B") and keep only the latest truth
- Prune: Convert vague speculations ("this function might cause issues") into verified facts ("this function caused a timeout in test Y on date Z") or discard them entirely
- Write: Distill the consolidated knowledge into
MEMORY.mdvia the/dreamcommand
4.2 The Three-Gate System
A dream cycle only executes if all three conditions are met:
| Gate 1: Time | At least 24 hours since the last dream cycle |
| Gate 2: Activity | At least 5 user sessions have occurred since the last dream |
| Gate 3: Lock | A consolidation lock must be acquired (prevents parallel dreams from corrupting the memory index) |
The Neuroscience Parallel: This is remarkably similar to how the human brain consolidates memories during sleep. The hippocampus replays the day’s experiences during REM sleep, transferring important memories to long-term storage (cortex) and discarding irrelevant ones. KAIROS’s autoDream does the same thing: replaying logs, consolidating knowledge, and pruning noise. Anthropic is building artificial sleep for an artificial mind.
5. Exclusive Tools: What KAIROS Can Do That Regular Claude Cannot
KAIROS has access to three tools not available in standard Claude Code sessions:
| Tool | Function | Implication |
| SubscribePR | Monitors GitHub pull requests via webhook subscriptions — watches for changes, merges, comments, conflicts | KAIROS can autonomously track your team’s code without being asked |
| PushNotification | Sends alerts to your phone or browser when a background task completes or an issue is detected | The agent can reach you even when you’re away from the terminal |
| SendUserFile | Pushes files directly to the user via a three-tier filtering system (brief-only, default, transcript modes) | KAIROS can deliver results, not just describe them |
The BriefTool (located at src/tools/BriefTool/prompt.ts:L12-L22) includes a status field that distinguishes between "normal" and "proactive" updates, with rendering logic at src/tools/BriefTool/UI.tsx and filtering at src/components/Messages.tsx:L505-L514.
6. The Bigger Picture: From Chat to Continuous Monitoring
KAIROS represents a fundamental shift in the AI interaction paradigm:
| Current Paradigm (Chat) | Discrete inference. Human prompts → AI responds. The AI is "dead" between interactions. No memory between sessions. |
| KAIROS Paradigm (Daemon) | Continuous monitoring. The AI is always alive, always observing, always consolidating knowledge. It acts at the opportune moment. It maintains persistent memory across days and weeks. |
This isn’t just an engineering improvement — it’s a category change. The difference between chat and daemon is the difference between a consultant you call once a week and a team member who sits next to you every day, learns your codebase, and fixes things while you’re at lunch.
The Statistical Framing: In signal processing terms, current AI is a sampled system — it only sees snapshots when you prompt it. KAIROS is a continuous system with its own sampling rate (the tick interval). It has an internal clock, persistent state, and the ability to act asynchronously. This is the foundation for what the industry calls "agentic AI" — and the leaked source shows exactly how Anthropic is building it.
7. What KAIROS Cannot Do (Current Limitations)
It’s important to note what the code does not include:
- No internet access: KAIROS cannot browse the web or make API calls to external services (beyond GitHub webhooks)
- No code execution without the 15-second budget: It cannot run long processes in the foreground
- No self-modification: Append-only logs mean it cannot rewrite its own history or modify its own codebase
- Feature-flagged: KAIROS remains behind flags with no announced launch date. It’s built but not shipped.
Series Roadmap
| Part 1 | The "Harness" Is the Moat — Bun, context pipeline, YOLO classifier |
| Part 2 | "Mythos" & The Roadmap — codenames, ULTRAPLAN, Undercover Mode |
| Part 3 (This Post) | KAIROS — Always-on daemon, 15-second budget, autoDream |
| Part 4 | Prompt Compilation — DANGEROUS_uncached, context poisoning, anti-distillation |
| Part 5 | "Buddy" — Tamagotchi identity anchors, Mulberry32 gacha, persistence |
Sources: