GoodMem
ReferenceCLI

Memory Retrieve

Memory Retrieve CLI command reference

goodmem memory retrieve

Retrieve memories using semantic search

Synopsis

Retrieve memories from specified spaces using semantic search.

By default, this command returns the direct search results. To refine or process these results further, you can specify a post-processor using the --post-processor, --post-processor-args, or --post-processor-interactive flags.

Results are streamed in real-time as they become available.

goodmem memory retrieve <query> [flags]

Examples

  # Basic search in a single space
  goodmem memory retrieve --space-id 123e4567-e89b-12d3-a456-426614174000 "machine learning best practices"

  # Search multiple spaces with additional context
  goodmem memory retrieve \
    --space-id space1 --space-id space2 \
    --context-text "for production systems" \
    --max-results 20 \
    "deployment strategies"

  # Include files as context
  goodmem memory retrieve \
    --space-id 123e4567-e89b-12d3-a456-426614174000 \
    --context-file config.yaml \
    --fetch-content \
    "configuration issues"

  # Control output format and generation
  goodmem memory retrieve \
    --space-id 123e4567-e89b-12d3-a456-426614174000 \
    --filter "CAST(val('$.effectiveDate') AS DATE) >= CAST('2024-10-01' AS DATE)" \
    --no-abstract \
    --format json \
    "debugging tips"

  # Set resource budgets
  goodmem memory retrieve \
    --space-id 123e4567-e89b-12d3-a456-426614174000 \
    --output-budget 1000 \
    --compute-budget 5000 \
    "optimization techniques"

  # Use ChatPostProcessorFactory with custom arguments
  goodmem memory retrieve \
    --space-id 123e4567-e89b-12d3-a456-426614174000 \
    --post-processor-args '{"llm_id": "123e4567-e89b...", "reranker_id": "456e4567-e89b...", "relevance_threshold": 0.7}' \
    "search query"

  # Use ChatPostProcessorFactory with arguments from file
  goodmem memory retrieve \
    --space-id 123e4567-e89b-12d3-a456-426614174000 \
    --post-processor-args @processor-config.json \
    "search query"

  # Use custom post-processor
  goodmem memory retrieve \
    --space-id 123e4567-e89b-12d3-a456-426614174000 \
    --space-id 223e4567-e89b-12d3-a456-426614174111 \
    --filter @filter-prod.sql --filter @filter-staging.sql \
    --post-processor "com.example.SimplePostProcessor" \
    "search query"

  # Interactive configuration for ChatPostProcessorFactory
  goodmem memory retrieve \
    --space-id 123e4567-e89b-12d3-a456-426614174000 \
    --post-processor-interactive \
    "search query"

Options

      --compute-budget uint32        Token budget for compute operations
      --context-file strings         Files to include as binary context (can be specified multiple times)
      --context-text strings         Additional text context to clarify the query (can be specified multiple times)
      --debug                        Show result set boundaries, timing, and additional debugging information
      --fetch-content                Include original memory content in results
      --filter strings               Metadata filter expression; repeat to target specific spaces or use @file.sql to load from a file
  -f, --format string                Output format (stream, json, table) (default "stream")
  -h, --help                         help for retrieve
      --max-results int32            Maximum number of results to retrieve (default 10)
      --no-abstract                  Skip generating abstractive replies
      --output-budget uint32         Token budget for output generation
      --post-processor string        Post-processor class name (Java FQN)
      --post-processor-args string   Post-processor arguments as JSON or @file.json
      --post-processor-interactive   Launch interactive TUI to configure ChatPostProcessorFactory
      --space-id strings             Space IDs to search within (can be specified multiple times)

Options inherited from parent commands

      --api-key string   API key for authentication (can also be set via GOODMEM_API_KEY environment variable)
      --server string    GoodMem server address (gRPC API) (default "https://localhost:9090")

SEE ALSO