Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
Truth Ledger: memory rollback drops the mirror first; spaces migration test checks the backfill
Lin (kwant bot)a70373283702
diff --git a/src/db/continuity.rs b/src/db/continuity.rsindex ece669a5..e00b9198 100644--- a/src/db/continuity.rs+++ b/src/db/continuity.rs@@ -22,8 +22,13 @@ pub const MAX_MEMORY_SEARCH_LIMIT: i64 = 20;/// Columns a [`Memory`] row is read with.const MEMORY_COLUMNS: &str = "id, kwant_id, text, source, pinned_by, imported, created_at, updated_at";/// Undoes the pinning and memory-search migration (see [`Database::migrate_continuity`]): the-/// table goes back to the shape older releases read. Kept for rollbacks and tested.-pub const MEMORY_PINS_DOWN: &str = "DROP TRIGGER IF EXISTS kwant_memories_fts_ai; \+/// table goes back to the shape older releases read. Kept for rollbacks and tested. The Truth+/// Ledger's mirror reads the dropped columns, so it goes first; the next start brings it back.+pub const MEMORY_PINS_DOWN: &str = "DROP TRIGGER IF EXISTS kwant_memories_ledger_ai; \+ DROP TRIGGER IF EXISTS kwant_memories_ledger_au; \+ DROP TRIGGER IF EXISTS kwant_memories_ledger_pin; \+ DROP TRIGGER IF EXISTS kwant_memories_ledger_ad; \+ DROP TRIGGER IF EXISTS kwant_memories_fts_ai; \DROP TRIGGER IF EXISTS kwant_memories_fts_ad; \DROP TRIGGER IF EXISTS kwant_memories_fts_au; \DROP TABLE IF EXISTS kwant_memories_fts; \diff --git a/tests/spaces_migration_test.rs b/tests/spaces_migration_test.rsindex 6848d084..4b99f88d 100644--- a/tests/spaces_migration_test.rs+++ b/tests/spaces_migration_test.rs@@ -63,10 +63,11 @@ async fn legacy(dir: &Path) -> SqlitePool {}/// Every row of every table except `spaces` and `llm_profile_endpoints` (both new, the second-/// from the Custom API change), without `space_id`, as quoted text.+/// from the Custom API change) and the Truth Ledger's backfill (checked on its own), without+/// `space_id`, as quoted text.async fn snapshot(pool: &SqlitePool) -> BTreeMap<String, Vec<String>> {let tables: Vec<(String,)> = sqlx::query_as(- "SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' AND name NOT IN ('spaces', 'llm_profile_endpoints', 'mcp_suggestions', 'bot_actions', 'hire_proposals', 'hire_policies', 'imports', 'approval_modes') ORDER BY name",+ "SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' AND name NOT IN ('spaces', 'llm_profile_endpoints', 'mcp_suggestions', 'bot_actions', 'hire_proposals', 'hire_policies', 'imports', 'approval_modes', 'knowledge_facts', 'fact_events') ORDER BY name",).fetch_all(pool).await@@ -118,6 +119,11 @@ async fn migration_keeps_every_row_and_id_and_backs_up_first() {let after = snapshot(&pool).await;assert_eq!(before, after, "every row and id survives, nothing added or lost");+ // The Truth Ledger mirrors the one memory, as the person's+ assert_eq!(+ sqlx::query_as::<_, (String, String, String)>("SELECT memory_id, trust, status FROM knowledge_facts").fetch_all(&pool).await.unwrap(),+ vec![("mem_1".to_string(), "person".to_string(), "accepted".to_string())]+ );assert_eq!(sqlx::query_as::<_, (String, String)>("SELECT id, name FROM spaces").fetch_all(&pool).await.unwrap(),