late-night-regrets
extension
Nightly Bayesian interaction-quality classifier — trains on chat history, flags behavioral patterns, and writes self-improvement reflections
bayesianclassifiernightlyqualityreflectionself-improvement
v0.1.0
Open Settings → Add-Ons and pick late-night-regrets
Source: addons/late-night-regrets

"What did I get wrong today?"

A nightly Bayesian interaction-quality classifier for PiClaw. Trains on chat history, flags behavioral patterns, and writes self-improvement reflections — without spending model tokens on classification.

How it works

text
┌─────────────────────────────────────────────────────────────────┐
│                    Chat message history                           │
│  (SQLite: messages.db, all chats, all sessions)                  │
└──────────────────────────────┬──────────────────────────────────┘
                               │
                    ┌──────────▼──────────┐
                    │  Multinomial Naive   │
                    │  Bayes classifier    │  ← zero model tokens
                    │  (weak-label trained)│
                    └──────────┬──────────┘
                               │
              ┌────────────────▼────────────────┐
              │     Attention-worthy messages     │
              │  (corrections, misinterpretations,│
              │   over-engineering, under-delivery,│
              │   context failures)                │
              └────────────────┬────────────────┘
                               │
                    ┌──────────▼──────────┐
                    │  Agent reflection    │  ← model tokens here only
                    │  (reads context,     │
                    │   extracts patterns) │
                    └──────────┬──────────┘
                               │
              ┌────────────────▼────────────────┐
              │  notes/memory/interaction-       │
              │  reflections.md                  │
              │  notes/memory/feedback.md        │
              └─────────────────────────────────┘

Installation

Open Settings → Add-Ons and install late-night-regrets from the catalog.

Configuration

The settings pane exposes:

Field Default Description
Enabled true Master switch
Cron schedule 30 2 * * * Nightly run time (UTC)
Confidence threshold 0.55 Min confidence for attention-worthy
Reflections path notes/memory/interaction-reflections.md Output file
Exports dir exports/interaction-quality Classifier artifacts
Recent hours 24 Lookback window for each reflection

Categories

The classifier labels user messages that follow agent turns:

Category Signal
successful_execution "perfect", "thanks", "exactly", short affirmatives
course_correction "not that", "I meant", "try again", "to clarify"
misinterpretation "wrong", "misunderstood", "that's not what I asked"
over_engineering "too much", "simpler", "just do", "keep it simple"
under_delivery "you forgot", "also need", "continue", "the rest"
context_failure "I already said", "remember", high self-repetition
good_proactive "good idea", "nice catch", "smart"
neutral Normal flow, no strong signal

Commands

Artifacts

After each run:

text
exports/interaction-quality/
├── interaction-quality-weights-latest.json
├── interaction-quality-predictions-latest.jsonl
├── interaction-quality-attention-latest.jsonl
└── interaction-quality-report-latest.md

Design

Development

bash
# Run the classifier manually
bun run scripts/train-interaction-quality-bayes.ts

# Run with recent-only classification
bun run scripts/train-interaction-quality-bayes.ts --recent-hours 48

# Test
cd /workspace/piclaw-addons/addons/late-night-regrets && bun test

License

MIT