AI Query Patterns for Reliable Search Results

Write prompts that map cleanly from natural language to structured filters

What This Guide Covers
  • How the ai command translates prompts into filters
  • Prompt structures that produce reliable output
  • Dry-run first validation workflow
  • When to switch from ai to explicit search filters

How Translation Works

The ai command is an interpretation layer over FileFortress search filters. It does not search by chat semantics. It tries to map your sentence to explicit fields like media type, size, dates, extensions, remote name, and metadata predicates.

Strong prompts include concrete filter hints. Weak prompts are usually account, billing, or configuration questions that do not map to file filters.

Pattern 1: Start with Media Type

Including media type up front gives the model a stable anchor and reduces ambiguous output.

# Strong
filefortress ai "find images from onedrive"

# Strong
filefortress ai "find videos larger than 500mb"

# Weak
filefortress ai "find my stuff"

Pattern 2: Use Comparable Phrases

Size and date boundaries are easier to map when phrased as explicit comparisons: larger than, smaller than, before, after, last 30 days, and similar.

Intent Prompt Example Likely Mapping
Upper size bound find images smaller than 5kb sizeMaxBytes = 5120
Lower size bound find videos larger than 1gb sizeMinBytes = 1073741824
Relative date find documents modified in last 30 days modifiedAfter set to relative date

Pattern 3: Prefer Filter Language Over Questions

Questions like how many remotes do I have? are valid product questions but not file-search prompts. Use command-specific intent:

  • Use ai: file discovery requests
  • Use remotes list: remote inventory/count questions
  • Use tools configure foundry: provider/model setup tasks
Common Mistake

Do not use the AI search command as a general assistant. It is scoped to converting natural language into file-search filters.

Recommended Validation Workflow

  1. Start with a filter-oriented prompt.
  2. Run --dry-run to verify interpreted filters.
  3. Add --explain to inspect reasoning when results are surprising.
  4. Run without --dry-run only after interpretation matches intent.
# 1) Validate mapping only
filefortress ai "find images smaller than 5kb" --dry-run

# 2) Inspect model explanation
filefortress ai "find images smaller than 5kb" --dry-run --explain

# 3) Execute search
filefortress ai "find images smaller than 5kb"

When to Move to Explicit Search

If a query remains ambiguous after a couple of rephrases, switch to explicit search options. You will get deterministic behavior and easier scripts.

# Equivalent explicit search for "images smaller than 5kb"
filefortress search --media-type image --size-max 5KB

Related Resources