Self-Correction Analysis — Status & Implementation Plan
Issue: Feature: Nightly Self-Correction Analysis — Automated Failure Detection & Remediation #34
Last updated: 2026-02-18
Current status: Implemented (multi-language)
The pipeline is implemented in the memory-hybrid extension with multi-language support via .language-keywords.json (see openclaw hybrid-mem build-languages).
| Component | Status |
|---|---|
| Phase 1: Extract | ✅ openclaw hybrid-mem self-correction-extract — uses merged correction signals (English + translated from .language-keywords.json) |
| Phase 2: Analyse | ✅ Prompt self-correction-analyze.txt; LLM via self-correction-run |
| Phase 3: Remediate | ✅ MEMORY_STORE + TOOLS.md append (cap 5); AGENTS/SKILL as proposals only |
| Phase 4: Report | ✅ memory/reports/self-correction-YYYY-MM-DD.md |
| Protocol doc | ✅ SELF-CORRECTION-PIPELINE.md |
| Cron job | Optional — add to OpenClaw jobs; see pipeline doc |
| Tests | ✅ Extract (self-correction-extract.test.ts), TOOLS section (tools-md-section.test.ts), config (config.test.ts for selfCorrection) |
| Semantic dedup | ✅ Optional (default on): skip MEMORY_STORE when embedding similarity ≥ threshold (config selfCorrection.semanticDedup, semanticDedupThreshold). |
| TOOLS sectioning | ✅ Rules inserted under configurable section (e.g. “Self-correction rules”), not appended at end. Dedup within section. |
| Auto-rewrite vs approve | ✅ Default: suggest TOOLS rules in report; apply with --approve. Opt-in autoRewriteTools: true: LLM rewrites TOOLS.md to integrate new rules (no duplicates/contradictions). |
| Phase 2 via spawn | ✅ Optional: analyzeViaSpawn: true + spawnThreshold → Phase 2 runs via openclaw sessions spawn (e.g. Gemini) for large batches. |
Multi-language: Run openclaw hybrid-mem build-languages once (or when you add languages). Correction phrases are translated into your top languages so detection works in all of them.
Implementation checklist (done)
-
Phase 1 — Extract ✅
Implemented inservices/self-correction-extract.ts; CLIself-correction-extract. UsesgetCorrectionSignalRegex()(English +.language-keywords.jsontranslations). Skip filters applied. -
Phase 2 — Analyse ✅
Promptprompts/self-correction-analyze.txt; invoked insideself-correction-runwith configurable model. -
Phase 3 — Remediate ✅
MEMORY_STORE (with dedup), TOOLS_RULE (append-only), AGENTS_RULE/SKILL_UPDATE as proposals; cap 5. -
Phase 4 — Report ✅
Written tomemory/reports/self-correction-YYYY-MM-DD.md. -
Documentation ✅
SELF-CORRECTION-PIPELINE.md — protocol and multi-language usage. Cron job is optional (user/add-on). -
Tests ✅
self-correction-extract.test.ts— extraction and skip filters.
Success criteria (from issue)
- Detects ≥80% of user corrections within 24 hours.
- Auto-remediates ≥50% of detected issues (memory stores + TOOLS rules).
- Reduces repeat corrections by ≥60% over 30 days.
- False positive rate <20%.
References
- GitHub issue #34: Nightly Self-Correction Analysis
- Related: Procedural Memory #23 (stores learned procedures; this pipeline discovers what to learn).
- Manual analysis:
memory/reports/failure-analysis-v2-2026-02-18.md(if present in workspace). - Raw extracts POC:
memory/reports/correction-extracts-raw.md(if present).