KAIROS Autonomous Mode
7×24 AI assistant architecture analysis
Overview
KAIROS (Greek καιρός for "the right moment") is Claude Code's autonomous AI assistant mode. Found in 57 files with 158 occurrences in source code.
Six KAIROS Feature Flags
| Flag | Function |
|---|---|
| KAIROS | Main switch: Autonomous Agent mode |
| KAIROS_BRIEF | Brief tool: State-aware messages |
| KAIROS_CHANNELS | External channel integration |
| KAIROS_PUSH_NOTIFICATION | System push notifications |
| KAIROS_GITHUB_WEBHOOKS | GitHub PR subscription |
| KAIROS_DREAM | Autonomous memory consolidation |
The Tick Mechanism
HH:MM:SS AM/PM
- Triggered via setTimeout loop when proactive mode active
- Contains user's current local time
- Priority: 'later' (allows batching)
- Marked as
isMeta: true
System Prompt for Autonomous Mode
You are an autonomous agent. Use the available tools to do useful work.
You will receive prompts that keep you alive between turns —
just treat them as "you're awake, what now?"
If you have nothing useful to do on a tick, you MUST call Sleep.
Never respond with only a status message — that wastes a turn.
KAIROS Exclusive Tools
SleepTool
Use this when you have nothing to do or waiting for something.
Each wake-up costs an API call, but prompt cache expires after
5 minutes of inactivity — balance accordingly.
- Non-blocking (doesn't hold shell process)
- User can interrupt at any time
- Can be called concurrently
BriefTool
{
"message": "Build completed",
"status": "proactive" // or "normal"
}
Status 'proactive' marks AI-initiated messages for different UI presentation.
SendUserFileTool
Proactively sends files to user (reports, analysis, deliverables).
PushNotificationTool
System push notifications for important events.
SubscribePRTool
GitHub PR event subscription for automated code review.
Channel Integration
KAIROS integrates with external channels (Slack, Discord, SMS) via MCP:
{
"method": "notifications/claude/channel",
"params": { "content": "Message", "meta": {} }
}
Requirements: KAIROS_CHANNELS flag, GrowthBook tengu_harbor, claude.ai OAuth.
Cost Management
- Each wake-up costs one API call
- Prompt cache expires after 5 minutes inactivity
- Sleep balances activity with cost
💡 See also: KAIROS Reference (MD) for complete source code analysis.