@sdotwinter/openclaw-deterministic 0.19.1 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
Canonical-Hash: SHA256:
|
|
2
|
+
Canonical-Hash: SHA256:3166f922ed65819dc3cc3fdee1101625ecd80f6994fd08271254235aa51d7a78
|
|
3
3
|
-->
|
|
4
4
|
|
|
5
5
|
# Memory Compactor Skill
|
|
@@ -16,6 +16,7 @@ RISK_THRESHOLD: 1020
|
|
|
16
16
|
2. Semantic risk threshold (>1020 tokens = 85% of HARD_LIMIT)
|
|
17
17
|
3. Volume overload triggers
|
|
18
18
|
4. Weekly trigger
|
|
19
|
+
5. Incident detection trigger
|
|
19
20
|
|
|
20
21
|
### Time-Based Trigger (Baseline)
|
|
21
22
|
- Cron: Every Sunday at 03:00 UTC (unchanged)
|
|
@@ -23,6 +24,12 @@ RISK_THRESHOLD: 1020
|
|
|
23
24
|
- **Execute only if thresholds met**
|
|
24
25
|
- If no thresholds met → exit cleanly with report
|
|
25
26
|
|
|
27
|
+
### Incident Detection Trigger (Auto)
|
|
28
|
+
- Runs on every cron execution
|
|
29
|
+
- Scans OpenClaw logs for errors
|
|
30
|
+
- Auto-creates working memory entries when issues detected
|
|
31
|
+
- Does NOT overwrite - creates new entries only
|
|
32
|
+
|
|
26
33
|
### Volume-Based Triggers
|
|
27
34
|
**Working tier triggers:**
|
|
28
35
|
- If ANY:
|
|
@@ -80,6 +87,7 @@ All compaction runs must report:
|
|
|
80
87
|
- Which trigger fired
|
|
81
88
|
- Tier classification applied
|
|
82
89
|
- Cooldown status
|
|
90
|
+
- Incident detection results (if any)
|
|
83
91
|
- If no action taken: Report reason explicitly
|
|
84
92
|
|
|
85
93
|
## Trigger
|
|
@@ -90,6 +98,57 @@ Maintain tiered memory system by:
|
|
|
90
98
|
1. Compacting old working memory into episodic summaries
|
|
91
99
|
2. Extracting durable insights into semantic memory
|
|
92
100
|
3. Archiving raw files (never deleting)
|
|
101
|
+
4. Auto-detecting incidents from logs
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Auto-Incident Detection
|
|
106
|
+
|
|
107
|
+
### What It Does
|
|
108
|
+
On every run, scan OpenClaw logs for errors and automatically create working memory entries.
|
|
109
|
+
|
|
110
|
+
### Log Sources to Scan
|
|
111
|
+
- `~/.openclaw/logs/` - OpenClaw log files
|
|
112
|
+
- `~/.openclaw/cron/logs/` - Cron job logs
|
|
113
|
+
- Recent session outputs
|
|
114
|
+
|
|
115
|
+
### Error Patterns to Detect
|
|
116
|
+
- `ERROR` | `error` | `Error`
|
|
117
|
+
- `FAILED` | `failed` | `Failure`
|
|
118
|
+
- `Exception` | `exception`
|
|
119
|
+
- `Crashed` | `crash`
|
|
120
|
+
- `Timeout` | `timeout`
|
|
121
|
+
- HTTP 5xx errors
|
|
122
|
+
- Connection refused errors
|
|
123
|
+
|
|
124
|
+
### Working Entry Format (Auto-Created)
|
|
125
|
+
```markdown
|
|
126
|
+
# Auto-Detected Incident
|
|
127
|
+
Date: [ISO timestamp]
|
|
128
|
+
Source: [log file name]
|
|
129
|
+
|
|
130
|
+
Error: [extracted error message]
|
|
131
|
+
Context: [surrounding log lines]
|
|
132
|
+
Detected by: memory-compactor skill
|
|
133
|
+
Status: Needs investigation
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Rules
|
|
137
|
+
- Create NEW entry, never overwrite existing
|
|
138
|
+
- Skip if similar incident already logged (within 24 hours)
|
|
139
|
+
- Only create entry - do NOT investigate or fix
|
|
140
|
+
- Mark as "Needs investigation" status
|
|
141
|
+
- Limit: Max 5 auto-created entries per run
|
|
142
|
+
|
|
143
|
+
### Output
|
|
144
|
+
After incident scan, report:
|
|
145
|
+
```
|
|
146
|
+
🔍 Incident Detection:
|
|
147
|
+
• Logs scanned: X
|
|
148
|
+
• Errors found: X
|
|
149
|
+
• New entries created: X
|
|
150
|
+
• Skipped (duplicate): X
|
|
151
|
+
```
|
|
93
152
|
|
|
94
153
|
---
|
|
95
154
|
|
|
@@ -163,6 +222,12 @@ Before appending: Check for similar Title (substring/fuzzy match)
|
|
|
163
222
|
|
|
164
223
|
## Workflow
|
|
165
224
|
|
|
225
|
+
### 0. Incident Detection (New!)
|
|
226
|
+
- Scan logs for errors
|
|
227
|
+
- Create working entries for detected issues
|
|
228
|
+
- Skip duplicates (within 24 hours)
|
|
229
|
+
- Limit: 5 new entries max per run
|
|
230
|
+
|
|
166
231
|
### 1. Identify Files to Compact
|
|
167
232
|
- Scan `memory/working/` for files older than 7 days
|
|
168
233
|
- Scan `memory/episodic/` for files older than 30 days
|
|
@@ -233,6 +298,7 @@ For each episodic file >30 days:
|
|
|
233
298
|
- ⛔ Never write governance/debug/logs to semantic
|
|
234
299
|
- ⛔ Never bypass schema validation
|
|
235
300
|
- ⛔ Never ignore cooldown
|
|
301
|
+
- ⛔ Never investigate or fix incidents (only detect)
|
|
236
302
|
- ✅ Always preserve full history in archive/
|
|
237
303
|
- ✅ Always enforce semantic entry schema
|
|
238
304
|
- ✅ Always check duplicate before append
|
|
@@ -242,6 +308,10 @@ For each episodic file >30 days:
|
|
|
242
308
|
After run, report:
|
|
243
309
|
```
|
|
244
310
|
🗑️ Memory Compaction Complete
|
|
311
|
+
🔍 Incident Detection:
|
|
312
|
+
• Logs scanned: X
|
|
313
|
+
• Errors found: X
|
|
314
|
+
• New entries created: X
|
|
245
315
|
📦 Working→Episodic: X files compacted
|
|
246
316
|
📚 Episodic→Semantic: Y insights extracted
|
|
247
317
|
📁 Archived: Z files moved
|