Skip to content

Commit d2f2822

Browse files
committed
migrate to sqlite secondary brain
1 parent 363c283 commit d2f2822

11 files changed

Lines changed: 937 additions & 127 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ targets = ["i686-unknown-linux-musl"]
1414
[dependencies]
1515
# Async runtime (poller, agent loop, cron, heartbeat)
1616
tokio = { version = "1.41", features = ["full"] }
17+
# SQLite persistence (bundled C library; works on i686-musl without host toolchain issues)
18+
rusqlite = { version = "0.38", features = ["bundled"] }
1719
# Config and API types (config.toml)
1820
serde = { version = "1.0", features = ["derive"] }
1921
toml = "0.9.8"

src/agent.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use tokio::sync::mpsc;
88
use crate::agent::session::{Session, SessionError};
99
use crate::agent::subagent_manager::{SubagentManager, SubagentStatus};
1010
use crate::llm::{HttpProvider, Message, Role};
11+
use crate::memory::db::BrainDb;
1112
use crate::skills::{self, SkillsError};
1213
use crate::telegram::OutboundMsg;
1314
use crate::tools::context::ToolCtx;
@@ -163,8 +164,9 @@ pub async fn process_message(
163164
chat_id: &str,
164165
user_message: &str,
165166
tool_ctx: &ToolCtx,
167+
db: &Arc<BrainDb>,
166168
) -> Result<String, AgentError> {
167-
let mut session = Session::load(workspace_path, chat_id).await?;
169+
let mut session = Session::load(Arc::clone(db), chat_id).await?;
168170

169171
// Check if summarization is needed (before building context so summary is included)
170172
if session.history().len() > summarize::SUMMARIZE_THRESHOLD {

0 commit comments

Comments
 (0)