feat(store): add recall tracking and promoted observations endpoint#96
Open
sergiomarquezdev wants to merge 1 commit intoGentleman-Programming:mainfrom
Open
Conversation
Add read-side instrumentation to observations: recall_count and last_recalled_at columns track how often each observation is retrieved via Search and GetObservation. Frequently recalled observations can be queried through a new /promoted HTTP endpoint and mem_promoted MCP tool. - Add recall_count and last_recalled_at to observations schema - Increment recall_count on Search() and GetObservation() (fire-and-forget) - Split GetObservation into public (with recall) and private (without) to prevent Timeline navigation from inflating counts - Add PromotedObservations() store method with configurable threshold - Add GET /promoted HTTP endpoint with project/scope/min_recalls/limit params - Add mem_promoted MCP tool to agent profile (deferred loading) - Add 4 tests covering recall increment and promotion filtering Closes Gentleman-Programming#95
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.
Linked Issue
Closes #95
PR Type
Summary
recall_count,last_recalled_at) to observations, tracking how often each memory is retrieved viaSearchandGetObservationGET /promotedHTTP endpoint andmem_promotedMCP tool that surface frequently-recalled observations above a configurable thresholdChanges
internal/store/store.gorecall_count/last_recalled_atto schema, struct, all 13 scan sites, migration. NewincrementRecall()(fire-and-forget),PromotedObservations(), and privategetObservation()(no side effects)internal/store/store_test.gointernal/server/server.goGET /promotedendpoint withproject,scope,min_recalls,limitquery paramsinternal/mcp/mcp.gomem_promotedtool in agent profile (deferred loading), updated tool counts in package docinternal/mcp/mcp_test.goDesign Decisions
Fire-and-forget recall tracking:
incrementRecall()uses_, _ = s.db.Exec(...)— recall tracking must never break reads. Errors are silently ignored.Public vs private GetObservation: Split into
GetObservation()(increments recall, for external callers) andgetObservation()(no side effects, for internal use likeTimeline()). This prevents navigational reads from inflating counts.No sync for recall data:
recall_countis analytics metadata, not content. NoenqueueSyncMutationTxcalls — avoids noise in cross-device sync.Schema migration: Uses existing
addColumnIfNotExistspattern.recall_countdefaults to0for existing rows,last_recalled_atdefaults toNULL. Safe for databases with existing data.Test Plan
TestRecallCountIncrementsOnSearch— verifies Search bumps recall_countTestRecallCountIncrementsOnGetObservation— verifies GetObservation bumps recall_countTestPromotedObservationsReturnsHighRecallOnly— verifies threshold filteringTestPromotedObservationsExcludesDeleted— verifies soft-deleted excluded/promotedreturns correct resultsAutomated Checks
Contributor Checklist
Notes for Reviewers
TestNewErrorBranches/fails_when_migration_encounters_conflicting_object— a pre-existing Windows file-locking issue unrelated to this PRrecall_countis monotonically increasing by design. Staleness filtering (e.g., "not recalled in last 30 days") is a natural follow-up but not in scope for v1mem_promotedtool uses deferred loading to avoid bloating the initial tool context for agents that don't need it