Rename memory to history + build new memory system#36
Merged
priyanshujain merged 34 commits intomasterfrom Mar 9, 2026
Merged
Conversation
Conversation transcripts are history, not memory. Renames source/memory/ to source/history/ with updated package names, struct names, table names, and index names.
Updates config struct, defaults, DSN method, and doctor check to use History instead of Memory.
Moves internal/cli/memory/ to internal/cli/history/ and updates root.go to register the history command.
Updates import, source registration, and switch case from memory to history.
Renames skill directory, updates SKILL.md DB paths and table references, and updates builtinSkills map in install.go.
Updates all test references from memory-read to history-read, updates hook command and README.
Defines Memory struct and Category constants for the new personal memory system (identity, preference, relationship, project).
Adds SQLite and PostgreSQL schema for the memories table with indexes on category and source.
Adds Add, Get, Update, Delete, List, ListByCategory, Search, and Count functions for the memories table.
Adds UserMemory config section with SQLite default, DSN method, and defaults initialization.
Creates CLI commands for managing personal memories: list (with --category filter), add, and delete.
Formats memories grouped by category into markdown suitable for inclusion in LLM system prompts.
Adds Extract function with pre-filtering (trivial messages, acks) and LLM-based fact extraction from conversation messages.
Adds Reconcile function that compares candidate facts against existing memories using keyword search and LLM-based decision making (ADD/UPDATE/DELETE/NOOP).
Extracts personal facts from recent conversation history using LLM-based extraction and reconciliation pipeline.
Updates Stop hook to chain memory extraction after capturing conversation history. Backgrounds extraction to avoid blocking.
Creates memory-save skill with SKILL.md, registers it as a built-in skill, and updates install tests.
Includes UserMemory database in the health check alongside other data stores.
Renames memory/ to history/ and adds user_memory/ directory to reflect the new architecture.
Replaces concrete *provider.Router with LLM interface in Extract and Reconcile. Adds RouterLLM adapter. Enables mock-based testing.
Unit tests: Extract with mock LLM (verifies prompt construction, JSON parsing, filtering), Reconcile with mock (NOOP, UPDATE, DELETE, ADD decisions). Integration tests: real LLM extraction and end-to-end extract→reconcile flow, skipped when no API keys set.
Support GOOGLE_CLOUD_PROJECT env var for Gemini testing via Vertex AI, matching the pattern used in agent/integration_test.go.
Get() was scanning created_at/updated_at directly into time.Time, but SQLite returns datetime as strings. Use parseTime() like queryMemories().
Each obk chat session generates a unique session ID and saves all user/assistant messages to the history DB, making them available for memory extraction via obk memory extract.
gemini-2.0-flash is no longer available to new API keys. Update all integration tests to use gemini-2.5-flash and increase MaxTokens since thinking models use tokens for internal reasoning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
source/memory/→source/history/(conversation transcripts are history, not memory)memory/top-level package for durable personal facts about the user (identity, preferences, relationships, projects)obk memory list/add/delete/extract), extraction pipeline, reconciliation, and agent skillWhat changed
Part 1 — Rename memory → history (mechanical renames, no logic changes):
source/memory/→source/history/with updated package, struct, table names (memory_conversations→history_conversations, etc.)config.MemoryConfig→config.HistoryConfig,MemoryDataDSN()→HistoryDataDSN()internal/cli/memory/→internal/cli/history/(capture command)skills/memory-read/→skills/history-read/Part 2 — New memory system:
memory/types.go—Memorystruct withCategoryconstants (identity, preference, relationship, project)memory/schema.go— SQLite/PostgreSQL schema formemoriestablememory/store.go— CRUD: Add, Get, Update, Delete, List, ListByCategory, Search, Countmemory/format.go—FormatForPrompt()groups memories by category into markdown for LLM system promptsmemory/extract.go— Pre-filters trivial messages, calls LLM to extract personal facts as JSONmemory/reconcile.go— Keyword search + LLM reconciliation (ADD/UPDATE/DELETE/NOOP) against existing memoriesconfig.UserMemoryConfigwithUserMemoryDataDSN()→~/.obk/user_memory/data.dbPart 3 — CLI + integration:
obk memory list [--category <cat>],obk memory add,obk memory delete,obk memory extract [--last <n>]skills/memory-save/SKILL.md— agent skill for "remember this" use caseobk history capture && obk memory extract &UserMemory DBhealth checkTest plan
go build ./...passesgo test ./source/history/...— schema, store, capture tests passgo test ./memory/...— schema, CRUD, format, extraction parsing, reconciliation tests passgo test ./internal/skills/...— install with updated skill names passesgo test ./agent/tools/...— skill search/load with updated names passesobk memory list/add/delete/extract(not yet written)