LemonMemory.SessionSearch (lemon_memory v0.1.0)

View Source

Public search API over durable memory documents.

All calls are feature-flagged behind session_search. Returns [] when the flag is off so callers never need to check.

Scope controls

scopescope_key required?Searches by
:sessionyessession_key
:agentyesagent_id
:workspaceyesworkspace_key
:allnoall stored documents

Example

LemonMemory.SessionSearch.search("fix the login bug",
  scope: :session,
  scope_key: "agent:my_agent:main",
  limit: 5
)

Summary

Functions

Same as search/2 but returns results formatted as a human-readable string suitable for injection into an agent's context.

Search memory documents by free-text query.

Functions

format_results(docs)

@spec format_results([LemonMemory.Document.t()]) :: String.t()

Same as search/2 but returns results formatted as a human-readable string suitable for injection into an agent's context.

search(query, opts \\ [])

@spec search(
  binary(),
  keyword()
) :: [LemonMemory.Document.t()]

Search memory documents by free-text query.

Returns a list of LemonMemory.Document structs, ordered by relevance. Returns [] when session_search is disabled or the query is blank.

Options

  • :scope - :session (default), :agent, :workspace, :all
  • :scope_key - required for scope :session/:agent/:workspace
  • :limit - max results, capped at 20 (default: 5)