Files
openclaw-workspace/.learnings/LEARNINGS.md
2026-04-11 09:45:12 -05:00

313 lines
8.2 KiB
Markdown

# Learnings Log
## [LRN-20260210-001] Cron CLI workaround via exec
**Logged**: 2026-02-10T23:00:00 CST
**Priority**: high
**Status**: promoted
**Area**: config
### Summary
When the `cron` tool fails due to deadlock, use `exec` to run the OpenClaw CLI instead. This bypasses the deadlock entirely.
### Details
The ez-cronjob skill revealed that direct `cron` tool invocation creates deadlock between agent and gateway. The CLI (`openclaw cron`) doesn't have this issue.
### Suggested Action
Always use `exec` for cron operations:
```bash
exec: openclaw cron list
exec: openclaw cron add --name "..." --cron "..." --tz "..." --session isolated ...
```
Key flags for reliable cron jobs:
- `--session isolated` - Prevents message loss
- `--tz "America/Chicago"` - Explicit timezone
- `--deliver --channel discord --to "ID"` - Delivery routing
- `--best-effort-deliver` - Graceful degradation
### Resolution
- **Promoted**: TOOLS.md
- **Notes**: Added to memory system and cron mastery workflow
### Metadata
- Source: user_feedback
- Related Files: skills/ez-cronjob/SKILL.md
- Tags: cron, scheduling, troubleshooting
- See Also: ERR-20260210-001
---
## [LRN-20260210-002] Weather API fallbacks
**Logged**: 2026-02-10T23:05:00 CST
**Priority**: medium
**Status**: pending
**Area**: tools
### Summary
wttr.in weather service may timeout or be blocked on some networks. Open-Meteo API provides reliable fallback with JSON responses.
### Details
Primary weather skill uses wttr.in but it failed silently (no output). Open-Meteo worked immediately with PowerShell's Invoke-RestMethod.
### Suggested Action
When wttr.in fails, use Open-Meteo with coordinates:
```powershell
Invoke-RestMethod -Uri "https://api.open-meteo.com/v1/forecast?latitude=30.3&longitude=-92.2&current_weather=true"
```
### Metadata
- Source: error
- Related Files: skills/weather/SKILL.md
- Tags: weather, api, networking
---
## [LRN-20260210-003] Windows curl vs PowerShell
**Logged**: 2026-02-10T23:05:00 CST
**Priority**: low
**Status**: pending
**Area**: tools
### Summary
On Windows, `curl` command often invokes PowerShell's Invoke-WebRequest alias which has different syntax. Use `curl.exe` for real curl, or use `Invoke-RestMethod` for native PowerShell HTTP calls.
### Details
```bash
# FAILS - PowerShell interprets as Invoke-WebRequest
curl -s "wttr.in/Chicago?format=3"
# Works - explicit exe call
curl.exe -s "wttr.in/Chicago?format=3"
# Better - native PowerShell
Invoke-RestMethod -Uri "http://wttr.in/Chicago?format=3"
```
### Suggested Action
Prefer `Invoke-RestMethod` or `Invoke-WebRequest` on Windows for HTTP calls.
### Metadata
- Source: error
- Tags: windows, curl, powershell, http
---
## [LRN-20260211-004] YouTube Summary Tool Created
**Logged**: 2026-02-11T11:54:00 CST
**Priority**: medium
**Status**: pending
**Area**: tools
### Summary
Created `tools/youtube-summarizer.py` for auto-transcribing and summarizing YouTube videos from URLs.
### Tool Features
- Extract video ID from multiple URL formats
- Download auto-generated captions via yt-dlp
- Parse SRT timestamps into key points
- Generate bullet summary with timestamps
### Dependencies
- **yt-dlp** needs to be installed (not currently on system)
- Install: `pip install yt-dlp` or download from yt-dlp/releases
### Usage
```python
python tools/youtube-summarizer.py "https://youtube.com/watch?v=VIDEO_ID"
```
### Channel Integration
- New channel: #youtube-summaries (ID: TBD_Corey_will_provide)
- Auto-detects YouTube URLs
- Posts transcript + summary back
### Next Steps
- Install yt-dlp on Windows system
- Test with sample video
- Add auto-detection logic for Discord messages
### Metadata
- Source: user_request
- Related Files: tools/youtube-summarizer.py, notes/youtube-summaries-channel.md
- Tags: youtube, transcription, video, tool
---
## [LRN-20260211-001] F1 News - No Spoilers Policy
**Logged**: 2026-02-11T09:33:00 CST
**Priority**: critical
**Status**: active
**Area**: workflow
### Summary
Never include F1 race results, standings, or leaderboards in daily news briefing. User watches races delayed and spoilers ruin the experience.
### Approved Topics
- Pre-race previews and analysis
- Technical updates and car development
- Driver/team news and announcements
- Schedule changes
- Regulatory updates
### Forbidden Topics
- Race winners, podium finishers
- Championship standings
- Race results of any kind
- "Verstappen extends lead" type headlines
- Qualifying results
### Suggested Action
Pre-filter search results before including in briefing. Skip any headline containing: "wins", "wins championship", "standings", "results", "podium", "classified"
### Metadata
- Source: user_feedback
- Related Files: notes/news-sources.md
- Tags: f1, spoilers, critical-rule
---
---
## [LRN-20260214-001] Worker Agent Template Pattern
**Logged**: 2026-02-16T19:00:00 CST
**Priority**: high
**Status**: active
**Area**: architecture
### Summary
Created reusable template for spawning specialized worker agents via cron. Template includes identity, mission, and HEARTBEAT-driven execution checklist.
### Pattern
`
workspace-agents/
+-- TEMPLATE-worker/
¦ +-- IDENTITY.md (who am I, emoji, role)
¦ +-- SOUL.md (mission, principles, boundaries)
¦ +-- USER.md (who I serve, purpose)
¦ +-- HEARTBEAT.md (daily routine checklist) ?
¦ +-- your_script.py (actual logic)
+-- [specific-worker]/ (copy of template, customized)
`
### Cron Setup
Uses message: 'Read IDENTITY.md, SOUL.md, HEARTBEAT.md, then follow your routine'
### Key Insight
HEARTBEAT.md acts as the agent's 'script' — self-directed execution without hardcoded cron logic.
### Active Workers
- Memory Worker (extracts to DB)
- Job Verifier (checks overnight jobs)
### Metadata
- Source: system_design
- Related: FUTURE_WORKER_IDEAS.md
- Tags: workers, agents, cron, templates
---
## [LRN-20260215-001] Hybrid File + Database Memory
**Logged**: 2026-02-16T10:00:00 CST
**Priority**: high
**Status**: active
**Area**: memory
### Summary
Built hybrid memory system: human-readable files (me) + structured SQLite (worker agent). Best of both worlds.
### Architecture
- I write to files (daily notes, MEMORY.md)
- Memory Worker extracts structured data to SQLite
- I can query DB when needed for structured info
### Database Schema
- memory_cells: tasks, decisions, facts, projects
- scenes: daily summaries
- memory_fts: full-text search
### Metadata
- Source: system_design
- Related: workspace-agents/memory-worker/
- Tags: memory, database, sqlite, architecture
---
## [LRN-20260216-001] Python Unicode on Windows
**Logged**: 2026-02-16T10:30:00 CST
**Priority**: low
**Status**: active
**Area**: scripting
### Summary
Windows PowerShell has issues with Unicode characters in print statements. Use ASCII alternatives.
### Problem
print('>= 0.8') with Unicode U+2265 FAILS
print('?') emoji FAILS
### Workaround
Use '>= 0.8' (ASCII) and '[OK]' instead of emoji
### Metadata
- Source: error
- Tags: windows, python, encoding
---
## [LRN-20260217-001] Manual Context Limit Fix - File Chopping
**Logged**: 2026-02-17T20:30:00 CST
**Priority**: high
**Status**: active
**Area**: sessions
### Summary
When session hits token limit (256k/256k 100%) and /terminate or /compact fail, manually edit the session JSON file to remove old context.
### Scenario
- Coding channel hits 'HTTP 400: prompt too long'
- /terminate doesn't clear the session
- /compact doesn't work or is disabled
- Session file grows to >100MB
### Solution
1. Open session file: ~/.openclaw/agents/main/sessions/[SESSION-ID].jsonl
2. Delete first ~50% of lines (oldest messages)
3. Keep the newest half (recent context)
4. Save file
5. New messages spawn with trimmed context
### Why It Works
- Session file is append-only JSON lines
- Each line is one message/tool call
- Removing old lines = forgetting old context
- Keeps recent conversation intact
### Trade-offs
- Loses old conversation history
- But keeps current task context
- Better than losing everything with /terminate
### Prevention
- Compact regularly during long sessions
- Spawn sub-agents for big tasks
- Monitor token count with /session_status
- Coding sessions bloat fastest (code snippets)
### Metadata
- Source: user_workaround
- Related: sessions, context, coding
- Tags: context-limit, manual-fix, session-management
- See Also: ERR-20260217-001