context-aware-delegationGive isolated sessions (cron jobs, sub-agents, event handlers) full conversation context from your main session using sessions_history. Run cheap background...
Install via ClawdBot CLI:
clawdbot install RGBA-Research/context-aware-delegationProblem: Isolated sessions (cron jobs, sub-agents) can't see your main session conversation history. They're cheap (use Haiku) but blind to context.
Solution: Use sessions_history to give isolated sessions full awareness of what happened in your main chat β at a fraction of the cost of running everything in main session.
You want a daily report that includes "what we accomplished last night" β but running that in main session with Sonnet costs ~$0.30/report. Using an isolated session with Haiku costs ~$0.03, but can't see conversation history.
Solution: Isolated session queries main session history first.
// Inside your cron payload.message:
"1. Query main session history: sessions_history('agent:main:telegram:direct:{userId}', limit=50)
2. Read memory files: memory/YYYY-MM-DD.md
3. Fetch weather for Austin 78721
4. Generate report combining:
- Recent conversation highlights
- Memory file summaries
- Current conditions
5. Send via Telegram + email"
Cost: ~$0.03 with Haiku (10x cheaper than Sonnet main session)
Context: Full awareness of overnight work
# List sessions to find main
sessions_list(limit=10)
# Typical main session key format:
# agent:main:telegram:direct:{userId}
# agent:main:main
// In cron job, sub-agent, or event handler:
sessions_history({
sessionKey: "agent:main:telegram:direct:8264585335",
limit: 50 // Last 50 messages
})
Returns conversation history even though you're in an isolated session.
Your isolated session now has:
Morning reports:
Schedule: 8 AM daily
Model: Haiku (~$0.03/run)
Task: Read overnight work, check email, send summary
Context: Last 50 messages from main session
End-of-day summaries:
Schedule: 9 PM daily
Model: Haiku
Task: What got done today? What's pending?
Context: Today's full conversation
Periodic check-ins:
Schedule: Every 2 hours (9 AM - 9 PM)
Model: Haiku
Task: Anything urgent in email/calendar?
Context: Recent discussion about priorities
Background builds:
sessions_spawn({
task: "Build the AREF product page based on our discussion",
model: "haiku",
// In the task prompt:
// "First, query main session history to see our conversation about AREF requirements..."
})
Research tasks:
sessions_spawn({
task: "Research Unreal Engine integration patterns. Reference our earlier discussion about AREF goals.",
model: "haiku"
})
Webhook arrives β isolated session handles it:
// Webhook payload triggers isolated session
// Session logic:
"1. Query main session to see: what did J and I agree about this client?
2. Process webhook based on that context
3. Take action or notify"
| Approach | Model | Context | Cost/Run | When to Use |
|----------|-------|---------|----------|-------------|
| Main session | Sonnet | Full | ~$0.30 | Complex interactive work |
| Isolated (blind) | Haiku | None | ~$0.03 | Simple scheduled tasks |
| Context-aware delegation | Haiku | Full | ~$0.03 | Background tasks needing context |
Savings: ~10x cheaper than main session, with same context awareness.
sessions_list({ kinds: ["main"], limit: 5 })
// Or:
sessions_list({ limit: 10 })
// Look for: agent:main:telegram:direct:{yourUserId}
Start with 50, adjust based on needs.
Best results come from:
"1. sessions_history(limit=30) β what we discussed today
2. read memory/2026-02-13.md β decisions logged
3. Combine both sources for complete picture"
Complete example for daily morning report:
Cron Job Setup:
{
schedule: { kind: "cron", expr: "0 8 * * *", tz: "America/Chicago" },
sessionTarget: "isolated",
payload: {
kind: "agentTurn",
model: "haiku",
message: `Generate morning report:
1. Query main session: sessions_history('agent:main:telegram:direct:8264585335', limit=50)
2. Read yesterday's memory: memory/YYYY-MM-DD.md
3. Get weather: Austin 78721
4. Check email (gog or himalaya)
5. Check calendar events for today
Report format:
π WEATHER: [conditions]
π OVERNIGHT: [from session history - what we worked on]
π PERSISTENT NOTES: [from memory file]
π§ EMAIL: [urgent only]
π
CALENDAR: [today's events]
π DASHBOARD: [mission control link]
Send to Telegram using message tool.
Note: Email delivery from isolated sessions requires SMTP credentials or is better handled via main session heartbeats for reliability.`
},
delivery: { mode: "announce", to: "8264585335", channel: "telegram" }
}
Cost: ~$0.03/report (~$1/month)
Context: Full overnight work awareness
Timing: Exact (8 AM every day)
History truncation:
sessions_history returns limited content (typically last N messages)Main session must exist:
Not real-time:
1. Write good memory summaries
Even with session history access, persistent memory files are gold. Don't rely solely on conversation history.
2. Query only what you need
limit=10 for quick context, limit=50 for substantial work, limit=100 for deep dives.
3. Chain tools effectively
sessions_history β memory_get β web_search β message
Context first, then action.
4. Use Haiku for delegation, Sonnet for decisions
"Empty session history"
sessions_list()limit parameter"Content truncated"
limit (fewer messages = more complete content)"Isolated session can't send messages"
message tool, not sessions_sendDiscovered by RGBA Research during OpenClaw optimization work.
Published to ClawHub as open pattern for the community.
Contact: https://rgbaresearch.com
License: MIT (free to use, adapt, share)
AI Usage Analysis
Analysis is being generated⦠refresh in a few seconds.
A fast Rust-based headless browser automation CLI with Node.js fallback that enables AI agents to navigate, click, type, and snapshot pages via structured commands.
Automate web browser interactions using natural language via CLI commands. Use when the user asks to browse websites, navigate web pages, extract data from websites, take screenshots, fill forms, click buttons, or interact with web applications.
Advanced desktop automation with mouse, keyboard, and screen control
Manage n8n workflows and automations via API. Use when working with n8n workflows, executions, or automation tasks - listing workflows, activating/deactivating, checking execution status, manually triggering workflows, or debugging automation issues.
Design and implement automation workflows to save time and scale operations as a solopreneur. Use when identifying repetitive tasks to automate, building workflows across tools, setting up triggers and actions, or optimizing existing automations. Covers automation opportunity identification, workflow design, tool selection (Zapier, Make, n8n), testing, and maintenance. Trigger on "automate", "automation", "workflow automation", "save time", "reduce manual work", "automate my business", "no-code automation".
Browser automation via Playwright MCP server. Navigate websites, click elements, fill forms, extract data, take screenshots, and perform full browser automation workflows.