fix(mcp): remove DefaultProject from reads, add date filters and input validation (#146)#213
Open
CTRQuko wants to merge 3 commits intoGentleman-Programming:mainfrom
Open
Conversation
…t validation (Gentleman-Programming#146) Bug fixes: - mem_search/mem_context no longer fallback to DefaultProject on reads - Empty FTS5 query guard prevents SQLite crash on blank search - Invalid date strings (since/until) now return explicit error instead of silent bypass - handleSave rejects empty title/content with clear error message - SQL alias typo in topic_key search path with date filters (o.created_at -> created_at) - HTTP /search now passes since/until params to store (were silently dropped) - Import normalizes project names for sessions and observations New features: - mem_search: since/until date filters (YYYY-MM-DD or RFC3339) - mem_context: since/until date filters - mem_sessions: new tool to list sessions by date range - CLI: --since/--until flags for search command Tests: 28 new tests across 5 files - mcp_bug146_test.go: 2 regression tests for Gentleman-Programming#146 - mcp_date_test.go: 4 date filter tests - mcp_audit_test.go: 8 tests (empty input, concurrency, MCP-layer validation) - store_audit_test.go: 12 tests (FTS5, dates, private tags, normalization) - store_phase2_test.go: 9 tests (import normalize, export, merge, truncation) - server_phase2_test.go: 2 tests (HTTP date filter passthrough) Fixes Gentleman-Programming#146
…lete endpoints
- MCP Tools: 15 → 16 (added mem_sessions)
- mem_search: document since/until params and empty query guard
- mem_context: document since/until params
- mem_sessions: new tool section with all parameters
- HTTP API: added since/until to GET /search
- HTTP API: added DELETE /sessions/{id} and DELETE /prompts/{id}
- New section: Input Validation (dates, empty queries, required fields, import)
- FTS5 section: updated to include topic_key column and special char handling
…external KB) New skill: engram-knowledge-recall - 4-level retrieval chain: mem_context → mem_search → external KB → explicit 'not found' - Agent-agnostic: works with any Obsidian MCP, Notion MCP, or file-based MCP - Rehidration pattern: findings from KB are saved back to Engram for faster future recall - Compaction recovery extended to include KB fallback Integrated into all agent plugins: - plugin/opencode/engram.ts — MEMORY_INSTRUCTIONS updated - plugin/claude-code/skills/memory/SKILL.md — search section updated - internal/setup/setup.go — memoryProtocolMarkdown updated (Gemini CLI, Codex) - skills/catalog.md — registered - AGENTS.md — registered with trigger description
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
mem_searchandmem_contextno longer fallback toDefaultProjecton reads — searches across all projects when project is omittedsince/untilparameters formem_search,mem_context, and newmem_sessionstoolhandleSave/searchnow passessince/untilto store (were silently dropped)Bug Fixes
handleSearch/handleContextreplaced emptyprojectwithDefaultProjectsanitizeFTS("")producesMATCH ""datetime("not-a-date")returns NULLvalidateDate()rejects invalid formatso.created_atbut query has nooaliassince/untilnot passed tostore.SearchSearchOptionsNormalizeProject()on importNew Features
mem_sessionstool — list sessions by date range with observation counts--since/--untilflags forengram searchTests
28 new tests across 5 files:
mcp_bug146_test.go— 2 regression tests for MCP server search returns empty results while CLI works correctly (data exists in database) #146mcp_date_test.go— 4 date filter testsmcp_audit_test.go— 8 tests (empty input, concurrency, MCP-layer validation)store_audit_test.go— 12 tests (FTS5, dates, private tags, normalization, SQL alias)store_phase2_test.go— 9 tests (import normalize, export, merge, truncation)server_phase2_test.go— 2 tests (HTTP date filter passthrough)Breaking Changes
None for MCP clients. Three store functions now return errors where they previously silently ignored bad input:
Search()— rejects empty query and invalid datesRecentSessions()— rejects invalid datesRecentObservations()— rejects invalid datesAll callers (MCP handlers, HTTP handlers, CLI) already handle errors from these functions.