Pre-flight Checks
Problem Description / Descripción del Problema
English: When mem_search returns results, each observation is isolated — the agent has no awareness of related observations that share the same topic_key. For example, if an agent finds 'JWT Middleware' (topic: auth/jwt), it doesn't know about 'Token Rotation Bug' or 'Session Fix' that share the same topic. This forces additional manual searches to build relational context.
Español: Cuando mem_search retorna resultados, cada observación está aislada — el agente no tiene awareness de observaciones relacionadas que comparten el mismo topic_key. Esto fuerza búsquedas manuales adicionales para construir contexto relacional.
Proposed Solution / Solución Propuesta
English: Post-process search results in two layers:
- Store layer: New
RelatedByTopicKeys() function that queries siblings by topic_key using the existing idx_obs_topic composite index (efficient, no schema migration)
- MCP layer: Inject related metadata as enriched text in
handleSearch response:
Related (topic 'auth/jwt'): ID 4 (JWT Middleware), ID 12 (Token Rotation Bug)
Limits: max 5 siblings per topic_key. Excludes soft-deleted observations. Filters by project + scope. No query executed when results have no topic_keys.
Español: Post-procesamiento en dos capas: (1) nueva función RelatedByTopicKeys() en store usando el índice compuesto idx_obs_topic existente, y (2) inyección de metadata relacional como texto enriquecido en handleSearch. Máximo 5 hermanos por topic_key, filtra por project+scope, excluye soft-deleted.
Affected Area
Store (new query function), MCP Server (search response enrichment)
Additional Context
- Leverages existing
idx_obs_topic(topic_key, project, scope, updated_at DESC) index
- No schema migration needed
- New
RelatedObservation struct: {ID int64, Title string}
- Separation of concerns: store returns pure data, handler serializes to text
Pre-flight Checks
Problem Description / Descripción del Problema
English: When
mem_searchreturns results, each observation is isolated — the agent has no awareness of related observations that share the sametopic_key. For example, if an agent finds 'JWT Middleware' (topic:auth/jwt), it doesn't know about 'Token Rotation Bug' or 'Session Fix' that share the same topic. This forces additional manual searches to build relational context.Español: Cuando
mem_searchretorna resultados, cada observación está aislada — el agente no tiene awareness de observaciones relacionadas que comparten el mismotopic_key. Esto fuerza búsquedas manuales adicionales para construir contexto relacional.Proposed Solution / Solución Propuesta
English: Post-process search results in two layers:
RelatedByTopicKeys()function that queries siblings bytopic_keyusing the existingidx_obs_topiccomposite index (efficient, no schema migration)handleSearchresponse:Related (topic 'auth/jwt'): ID 4 (JWT Middleware), ID 12 (Token Rotation Bug)Limits: max 5 siblings per topic_key. Excludes soft-deleted observations. Filters by project + scope. No query executed when results have no topic_keys.
Español: Post-procesamiento en dos capas: (1) nueva función
RelatedByTopicKeys()en store usando el índice compuestoidx_obs_topicexistente, y (2) inyección de metadata relacional como texto enriquecido enhandleSearch. Máximo 5 hermanos por topic_key, filtra por project+scope, excluye soft-deleted.Affected Area
Store (new query function), MCP Server (search response enrichment)
Additional Context
idx_obs_topic(topic_key, project, scope, updated_at DESC)indexRelatedObservationstruct:{ID int64, Title string}