Files
basicmachines-co-basic-memory/src/basic_memory
claude[bot] e70ade74ea fix: add fallback resolution and diagnostics to build_context
When build_context performs an exact permalink lookup that returns 0
results, it now tries three fallback resolution strategies before
giving up — mirroring the multi-strategy approach already used by
read_note:

1. Wildcard prefix match (*/path): recovers notes when stored permalinks
   carry an extra leading segment (e.g. project prefix) not present in
   the caller's identifier.
2. Strip-prefix exact lookup: recovers notes when the caller included an
   extra leading segment absent from stored permalinks.
3. Title FTS search on the last path segment: recovers notes when
   permalink normalization diverges from stored values.

Diagnostic fields added:
- ContextMetadata.resolved_path: the normalized path that was tried
- ContextMetadata.no_primary_match: machine-readable reason when all
  fallbacks are exhausted, allowing clients to distinguish "lookup miss"
  from "note has no relations"

Both fields are surfaced through MemoryMetadata (schema) and
to_graph_context (API utils) so they appear in the JSON response.

Backward compatibility: successful exact lookups are unchanged. The
fallbacks are only entered when the primary search returns 0 rows.

Closes #582

Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com>
Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
2026-02-18 17:03:00 +00:00
..