The e2e_truth_status_counts_are_consistent test reads the
"coverage_percent" field but the truth_status tool was emitting
"coverage_pct", causing the test to fall back to -1.0 and panic
with "coverage_percent should be 0-100, got: -1".
Align the JSON output with the test contract by renaming the
JSON key. The internal Rust struct field stats.coverage_pct in
src/db.rs is unchanged, so no other code is affected.
Adds OPENBRAIN__TRUTH__ENABLED=true to the .env upsert list in the
deploy bootstrap step so the background truth scoring worker runs
automatically after every deployment.
- Use /mcp/message endpoint instead of /sse
- Use X-API-Key header instead of Authorization: Bearer
- Use .json() response parsing instead of SSE line parsing
- Match proven patterns from e2e_mcp.rs helpers
- Reduce from 552 to 391 lines while maintaining all 8 tests
- Run cargo test --lib in CI checks to execute PLN/ECAN/scorer unit tests
- Add e2e_truth test suite to VPS e2e test step
- Enable OPENBRAIN__TRUTH__ENABLED for e2e testing
New structs:
- TruthScoreUpdate: parameters for updating truth scores
- TruthStats: aggregated truth scoring statistics
- ScoringCandidate: lightweight record for the scoring worker
New Database methods:
- get_unscored_memories(): fetch unscored memories FIFO
- get_stale_memories(): fetch memories due for re-evaluation
- update_truth_score(): update single memory truth fields
- batch_update_truth_scores(): transactional batch update
- get_truth_stats(): aggregate stats with category breakdown
Uses partial index idx_memories_truth_unevaluated for efficient
unscored memory queries.
Part of #29
Implement Probabilistic Logic Networks (PLN) inference rules:
- TruthValue struct with clamped strength/confidence
- deduction(): chain two implications A->B and B->C
- revision(): merge two independent truth estimates
- negation(): logical NOT (inverts strength, preserves confidence)
- conjunction(): logical AND (multiply strength, min confidence)
- score_with_evidence(): combine base score with confirmations and contradictions
10 unit tests covering basic operations, boundary cases,
symmetry, zero-confidence handling, and output bounds.
Part of #29
Implement Economic Attention Network (ECAN) for memory importance management:
- EcanParams: decay_rate, beta, spread_factor, threshold
- decay_sti(): STI decay toward zero over time
- update_lti(): LTI accumulation weighted by STI, penalized below threshold
- spread(): boost STI for confirmed memories
- cycle(): full decay + LTI update weighted by truth value
- initialize(): compute initial STI/LTI from truth value and confidence
14 unit tests covering decay convergence, LTI growth/penalty,
spread clamping, cycle behavior, initialization, and bounds.
Part of #29
Add TruthConfig struct to config.rs with all truth engine parameters:
- enabled, scoring_interval_seconds, batch_size, rescore_after_seconds
- pln_base_confidence, ecan_decay_rate, ecan_spread_factor
- contradiction_threshold, verification_threshold, cross_ref_limit
All settings configurable via OPENBRAIN__TRUTH__* env vars with sensible defaults.
Update .env.example with full documentation of new variables.
Update Config::load() builder and Default impl.
Part of #29