Skip to content

Commit 7aa0c64

Browse files
committed
feat(agent): add shared_learning module from PR #185 (disabled, needs persistence refactor)
Cherry-picked shared_learning/ directory from PR #185 branch. The store.rs uses sqlx directly which violates project architecture -- it must be refactored to use terraphim_persistence as the storage layer. The module is commented out in lib.rs until the refactor is complete. mention.rs and persona.rs changes from PR #185 were NOT merged because they conflict with the current NormalizedTerm API (u64 vs String IDs). Refs #185
1 parent f920307 commit 7aa0c64

6 files changed

Lines changed: 2067 additions & 0 deletions

File tree

crates/terraphim_agent/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ chrono = { workspace = true }
5858
strsim = "0.11" # For edit distance / fuzzy matching in forgiving CLI
5959
uuid = { workspace = true }
6060
dialoguer = "0.12" # Interactive CLI prompts for onboarding wizard
61+
# TODO: shared_learning needs refactor to use terraphim_persistence instead of direct sqlx
62+
# sqlx = { version = "0.8", features = ["runtime-tokio", "sqlite", "chrono"] }
6163

6264
# REPL dependencies - only compiled with features
6365
rustyline = { version = "17.0", optional = true }

crates/terraphim_agent/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
pub mod client;
22
pub mod onboarding;
33
pub mod service;
4+
// TODO: shared_learning needs refactor to use terraphim_persistence instead of direct sqlx
5+
// #[cfg(feature = "shared-learning")]
6+
// pub mod shared_learning;
47
pub mod tui_backend;
58

69
// Robot mode - always available for AI agent integration
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//! Shared Learning System for Terraphim AI
2+
//!
3+
//! This module provides a shared learning store that aggregates learnings
4+
//! across agents, deduplicates using BM25, and promotes learnings based on
5+
//! trust levels (L1/L2/L3) with Gitea wiki synchronization.
6+
//!
7+
//! # Architecture
8+
//!
9+
//! ```text
10+
//! Learning Capture → BM25 Deduplication → Trust Promotion → Gitea Wiki Sync
11+
//! ↓ ↓ ↓ ↓
12+
//! Multiple Sources Merge Duplicates L1→L2→L3 Wiki Pages
13+
//! ```
14+
//!
15+
//! # Trust Levels
16+
//!
17+
//! - **L1 (Unverified)**: Auto-captured from various sources, advisory only
18+
//! - **L2 (Peer-Validated)**: Applied 3+ times across 2+ agents with positive outcome
19+
//! - **L3 (Human-Approved)**: CTO review via `/evolve` or Gitea issue approval
20+
21+
mod store;
22+
mod types;
23+
mod wiki_sync;
24+
25+
pub use store::{SharedLearningStore, StoreConfig};
26+
pub use types::{SharedLearning, TrustLevel};
27+
pub use wiki_sync::{GiteaWikiClient, WikiSyncError};

0 commit comments

Comments
 (0)