Implement self-correcting memory architecture with critic engine

Adds:
- Critic Engine (critic.js): Validates output against correction store
- Auto-detection: Identifies uncorrected patterns (quantitative without proof, vague quantification, etc.)
- Auto-storage: New patterns immediately stored as corrections
- NocoDB Schema: Tables for corrections, preferences, episodes, decisions, validation
- Memory Service (memory-service.js): NocoDB integration layer
- Response Generator (response-generator.js): End-to-end pipeline with critic
- Correction Store: JSON-based with README documentation

Behavior:
- ALL output validated before delivery
- Quantitative claims without evidence → auto-corrected
- Corrections immediately block future occurrences
- System learns from its own mistakes

Test: node architecture/test-critic.js
This commit is contained in:
JC Beasley
2026-07-04 16:23:05 -07:00
parent 076e9eb605
commit cf3f1e1c53
9 changed files with 1159 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
# Self-Correcting Memory - Correction Store
## What This Is
This directory contains **corrections** - patterns that identify mistakes and enforce quality.
## How It Works
1. **Critic Engine** validates ALL output before delivery
2. **If violation found** → Output blocked, user notified
3. **If new pattern detected** → Auto-stored as correction
4. **Future occurrences** → Immediately blocked
## Correction Format
```json
{
"id": "correction_<timestamp>_<random>",
"pattern": "regex pattern to match",
"excludePattern": "regex that exempts match",
"severity": "error|warning|auto-correct",
"message": "What to tell user",
"suggestion": "How to fix",
"blocking": true,
"autoDetected": true,
"hitCount": 0,
"createdAt": "2026-07-04T..."
}
```
## Active Patterns
| ID | Pattern | Severity | Action |
|----|---------|----------|--------|
| quantitative_without_proof | `\d+\s*(%\|percent\|times)` | auto-correct | Block + require evidence |
| vague_quantification | `\b(many\|few\|several\|some)\b` | auto-correct | Block + require specificity |
| unverified_done | `\b(done\|complete\|finished)\b` | error | Block + require verification |
## Files
- `_index.json` - All corrections (master list)
- `correction_*.json` - Individual correction files
- `README.md` - This file
## Learning
The system learns from its own mistakes:
- Every uncorrected pattern → Becomes a correction
- No manual intervention required
- Immediate enforcement