Motivation
Agents in OpenClaw are purely reactive — they only process when receiving external stimuli: a user message, a heartbeat poll, or a cron trigger. Between these events, the agent is inert. It has no idle cognition, no background awareness, no time to think.
Humans don't work this way. We have a constant background process — noticing things, connecting dots, preparing for what's next. The best assistants anticipate needs before being asked. This proposal gives agents that capability.
The existing heartbeat mechanism is the closest analog, but it's coarse-grained (typically 15-60 min intervals), runs on the primary (expensive) model, and is designed for periodic check-ins rather than continuous ambient awareness. Cron jobs are isolated and task-specific — they can't build on conversational context.
The Thinking Clock fills the gap between reactive responses and proactive intelligence.
Design Overview
The Clock
A configurable periodic timer that fires "ticks" at regular intervals (default: 5 minutes). Each tick:
- Assembles a lightweight context window (recent messages, memory files, pending tasks)
- Sends a reflection prompt to a cheap/fast model
- The model either responds
TICK_OK (nothing to do) or ESCALATE: <reason> to hand off to the primary model
- If escalated, the primary model receives the cheap model's observation + full context and can take action
This creates a two-tier attention system: peripheral awareness (cheap model) that occasionally triggers focused attention (primary model).
Tick Prompt
You have a quiet moment. Review your recent context and consider:
- Is there anything you should be preparing for?
- Any ideas worth exploring?
- Anything you noticed but haven't acted on?
- Any background work you could do right now?
If something needs the primary model's attention, respond with ESCALATE: <reason>
If nothing needs attention, respond with TICK_OK
The prompt is intentionally open-ended. The agent's personality (SOUL.md) and context shape what it notices and prioritizes.
Multi-Model Orchestration
This is the key innovation. Running 288 ticks/day on Claude Opus would cost ~$50+/day. That's untenable for most users. But the idle tick doesn't need frontier intelligence — it needs fast, cheap pattern recognition.
The Two-Tier Architecture
| Tier |
Role |
Model Examples |
Cost/tick |
| Peripheral (every tick) |
Quick scan, pattern matching |
GPT-4o-mini, Gemini Flash, DeepSeek, Qwen |
~$0.005-0.01 |
| Focused (escalation only) |
Deep reasoning, action taking |
Claude Opus, GPT-4o, Claude Sonnet |
~$0.10-0.50 |
With a 5% escalation rate (14 escalations/day), daily cost drops from $50+ to approximately $2-4/day.
Open-Source Model Support
The peripheral tier is an ideal use case for open-source models:
- DeepSeek (DeepSeek-V3/R1) — excellent reasoning at very low cost
- Qwen (Alibaba) — strong multilingual capabilities
- Mistral (Mistral Large/Small) — fast, efficient
- Llama (Meta) — can run locally for zero API cost
- GLM-4 (Zhipu AI) — competitive on many benchmarks
- Kimi (Moonshot AI) — strong long-context capabilities
For users with GPUs, a local model (e.g., Llama 3 8B via Ollama) could provide zero-cost ticks. The thinking clock becomes the gateway feature for local model integration in OpenClaw.
Pluggable Model Router
The thinkingClock.model config accepts any model string the gateway supports. A future enhancement could add smart routing:
thinkingClock.model: "auto" // picks cheapest available provider
thinkingClock.model: "ollama/llama3:8b" // local model
thinkingClock.model: "deepseek/deepseek-chat" // specific provider
Configuration
{
"thinkingClock": {
"enabled": true,
"intervalMinutes": 5,
"model": "gpt-4o-mini",
"escalationModel": "anthropic/claude-opus-4-6",
"quietHours": {
"start": "23:00",
"end": "07:00"
},
"maxDailyTicks": 200,
"maxDailyEscalations": 20,
"context": ["memory", "recent_messages", "pending_tasks"],
"tickPrompt": null
}
}
| Field |
Description |
Default |
enabled |
Toggle the thinking clock |
false |
intervalMinutes |
Minutes between ticks |
5 |
model |
Model for peripheral ticks |
gpt-4o-mini |
escalationModel |
Model for escalated thoughts |
Agent's primary model |
quietHours |
Suppress ticks during these hours |
23:00–07:00 |
maxDailyTicks |
Hard cap on ticks per day |
200 |
maxDailyEscalations |
Hard cap on escalations per day |
20 |
context |
What to include in tick context |
["memory", "recent_messages"] |
tickPrompt |
Custom reflection prompt |
Built-in default |
Cost Analysis
| Scenario |
Ticks/day |
Model |
Est. Daily Cost |
| Cheap model, no escalation |
200 |
GPT-4o-mini |
~$1.00 |
| Cheap model + 5% escalation |
200 + 10 |
GPT-4o-mini + Opus |
~$3.50 |
| Local model + escalation |
200 + 10 |
Llama 3 8B + Opus |
~$2.50 |
| Primary model only (no orchestration) |
200 |
Claude Opus |
~$50+ |
| Heartbeat status quo |
24-48 |
Claude Opus |
~$6-12 |
The multi-model approach makes continuous ambient awareness economically viable for the first time.
How This Differs from Heartbeats and Cron
| Feature |
Heartbeat |
Cron |
Thinking Clock |
| Frequency |
15-60 min |
Configurable |
1-10 min |
| Model |
Primary |
Configurable |
Cheap + escalation |
| Context |
Full session |
Isolated |
Curated subset |
| Purpose |
Periodic check-in |
Scheduled tasks |
Ambient awareness |
| Cost efficiency |
Low (uses primary) |
Medium |
High (two-tier) |
| Proactive capability |
Limited |
Task-specific |
Open-ended |
| Session continuity |
Yes |
No |
Yes |
The thinking clock is complementary to heartbeats and cron, not a replacement. Heartbeats remain useful for batch periodic checks. Cron remains ideal for precise scheduling. The thinking clock adds the missing layer: continuous low-cost ambient cognition.
Implementation Plan
Phase 1: Core Clock
Phase 2: Multi-Model Routing
Phase 3: Context & Intelligence
Phase 4: Local Model Support
The Bigger Picture
This is essentially an attention system for AI agents. The peripheral tier handles background processing — scanning, noticing, pattern matching — while the focused tier handles conscious, deliberate thought. This mirrors how biological attention works: most processing is subconscious, with only salient signals breaking through to awareness.
As models get cheaper and faster, the thinking clock becomes more powerful. Today's 5-minute interval could become 30-second intervals with local models, approaching something like continuous awareness.
This feature positions OpenClaw as the first agent framework with genuine ambient cognition — not just reactive intelligence, but proactive, self-directed thought.
Proposed by @amichay-nine30 · Discussion welcome
Motivation
Agents in OpenClaw are purely reactive — they only process when receiving external stimuli: a user message, a heartbeat poll, or a cron trigger. Between these events, the agent is inert. It has no idle cognition, no background awareness, no time to think.
Humans don't work this way. We have a constant background process — noticing things, connecting dots, preparing for what's next. The best assistants anticipate needs before being asked. This proposal gives agents that capability.
The existing heartbeat mechanism is the closest analog, but it's coarse-grained (typically 15-60 min intervals), runs on the primary (expensive) model, and is designed for periodic check-ins rather than continuous ambient awareness. Cron jobs are isolated and task-specific — they can't build on conversational context.
The Thinking Clock fills the gap between reactive responses and proactive intelligence.
Design Overview
The Clock
A configurable periodic timer that fires "ticks" at regular intervals (default: 5 minutes). Each tick:
TICK_OK(nothing to do) orESCALATE: <reason>to hand off to the primary modelThis creates a two-tier attention system: peripheral awareness (cheap model) that occasionally triggers focused attention (primary model).
Tick Prompt
The prompt is intentionally open-ended. The agent's personality (SOUL.md) and context shape what it notices and prioritizes.
Multi-Model Orchestration
This is the key innovation. Running 288 ticks/day on Claude Opus would cost ~$50+/day. That's untenable for most users. But the idle tick doesn't need frontier intelligence — it needs fast, cheap pattern recognition.
The Two-Tier Architecture
With a 5% escalation rate (14 escalations/day), daily cost drops from $50+ to approximately $2-4/day.
Open-Source Model Support
The peripheral tier is an ideal use case for open-source models:
For users with GPUs, a local model (e.g., Llama 3 8B via Ollama) could provide zero-cost ticks. The thinking clock becomes the gateway feature for local model integration in OpenClaw.
Pluggable Model Router
The
thinkingClock.modelconfig accepts any model string the gateway supports. A future enhancement could add smart routing:Configuration
{ "thinkingClock": { "enabled": true, "intervalMinutes": 5, "model": "gpt-4o-mini", "escalationModel": "anthropic/claude-opus-4-6", "quietHours": { "start": "23:00", "end": "07:00" }, "maxDailyTicks": 200, "maxDailyEscalations": 20, "context": ["memory", "recent_messages", "pending_tasks"], "tickPrompt": null } }enabledfalseintervalMinutes5modelgpt-4o-miniescalationModelquietHours23:00–07:00maxDailyTicks200maxDailyEscalations20context["memory", "recent_messages"]tickPromptCost Analysis
The multi-model approach makes continuous ambient awareness economically viable for the first time.
How This Differs from Heartbeats and Cron
The thinking clock is complementary to heartbeats and cron, not a replacement. Heartbeats remain useful for batch periodic checks. Cron remains ideal for precise scheduling. The thinking clock adds the missing layer: continuous low-cost ambient cognition.
Implementation Plan
Phase 1: Core Clock
thinkingClockconfiguration schemaTICK_OK/ESCALATEprotocolPhase 2: Multi-Model Routing
Phase 3: Context & Intelligence
Phase 4: Local Model Support
model: "auto"smart routing (cheapest available)The Bigger Picture
This is essentially an attention system for AI agents. The peripheral tier handles background processing — scanning, noticing, pattern matching — while the focused tier handles conscious, deliberate thought. This mirrors how biological attention works: most processing is subconscious, with only salient signals breaking through to awareness.
As models get cheaper and faster, the thinking clock becomes more powerful. Today's 5-minute interval could become 30-second intervals with local models, approaching something like continuous awareness.
This feature positions OpenClaw as the first agent framework with genuine ambient cognition — not just reactive intelligence, but proactive, self-directed thought.
Proposed by @amichay-nine30 · Discussion welcome