Skip to content

Feature: expose semantic capability status + typed hybrid errors for clients #583

Closed

Description

@phernandez

Problem

Clients cannot reliably determine whether semantic/hybrid search is truly available for a project before calling search-notes --hybrid.

In practice, downstream integrations fall back to FTS on errors, which can silently degrade relevance without clear operator feedback.

Related downstream issue: basicmachines-co/openclaw-basic-memory#16

Why this looks upstream

Semantic enablement depends on config + dependency availability + provider initialization state, but currently that state is not exposed as a compact machine-readable capability payload for clients.

Relevant modules:

  • src/basic_memory/config.py
  • src/basic_memory/repository/sqlite_search_repository.py
  • project/status APIs and CLI project/status output

Requested fix

Expose semantic capability state in a stable, machine-readable way (CLI JSON and/or API):

  1. configured_enabled (config intent)
  2. dependencies_available (embedding provider import/runtime availability)
  3. effective_enabled (hybrid/vector callable now)
  4. last_semantic_error (if degraded)

Also, return a typed error code when --hybrid is requested but semantic is unavailable (instead of generic failure text).

Acceptance criteria

  • A client can preflight semantic support without trial-and-error calls.
  • Hybrid unavailability is explicit and machine-readable.
  • Docs mention how to remediate disabled/degraded semantic state.

Activity

  1. claude commented on Feb 18, 2026

    @claude
    Contributor

    Claude finished @phernandez's task in 2m 47s —— View job


    Issue Triage Analysis

    • Analyze issue and classify type/priority/component/complexity
    • Check for duplicate issues
    • Explore relevant source files
    • Add appropriate labels
    • Provide triage summary

    Triage Summary

    Type: Feature request / Enhancement
    Priority: Medium - affects downstream client reliability, but workaround exists (fallback to FTS)
    Component: Search API, MCP tools, CLI status
    Complexity: Medium - infrastructure is largely in place, needs new endpoint and schema


    Classification

    Field Value
    Type Feature / Enhancement
    Priority Medium
    Components api, mcp-tool, cli
    Complexity Medium

    Current State (from code exploration)

    The codebase already has solid groundwork for this feature:

    What exists:

    • config.py: Fields for semantic_search_enabled, semantic_embedding_provider, semantic_embedding_model, etc. Default auto-detects if fastembed is installed
    • semantic_errors.py: Two typed exceptions — SemanticSearchDisabledError and SemanticDependenciesMissingError
    • search_repository_base.py: Private _assert_semantic_available() check method
    • search_router.py: Catches both exceptions and returns HTTP 400 (but with generic text, not a typed code)
    • mcp/tools/search.py: Smart error formatting with remediation guidance in MCP responses

    What's missing (the gap):

    • No GET capability/status endpoint — clients must attempt a search to discover semantic availability
    • No machine-readable error codes on HTTP 400 responses (only human-readable detail strings)
    • CLI status command doesn't include semantic search status
    • No last_semantic_error tracking if initialization fails

    Duplicate Check

    No duplicates found. Related issue #577 covers a different semantic search problem (RRF score dilution). Related issue #578 covers silent embedding skip on sqlite-vec load failure — this is closely related and could feed into last_semantic_error.


    Implementation Notes

    The feature can be implemented additively without breaking changes:

    1. New schema: SemanticCapabilityStatus with the 4 requested fields
    2. New endpoint: GET /v2/search/capabilities (or per-project variant)
    3. Detection logic: Reuse existing _assert_semantic_available() patterns; expose via a public method
    4. Typed error codes: Extend HTTP 400 responses with an error_code field (e.g., SEMANTIC_DISABLED, SEMANTIC_DEPENDENCIES_MISSING) alongside the human-readable detail
    5. CLI extension: Add semantic status block to basic-memory status output
    6. Integration with BUG: New entities silently skip embedding generation after sqlite-vec load failure #578: The last_semantic_error field could capture the initialization failure from that issue

    Labels added: enhancement

  2. added
    enhancement
    on Feb 18, 2026
  3. phernandez commented on Feb 18, 2026

    @phernandez
    MemberAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions