Skip to content

ADR 040 — AI fixture `@search` decorator

Accepted (2026-05-11). Implemented via @search HIR fixture and Rust codegen (runtime wiring hardened in follow-on remediation).

Vox already ships retrieval/runtime surfaces (vox-search, memory manager lookup, research cascade) but they are consumed through programmatic or MCP pathways instead of a language fixture.

Introduce @search(...) decorator on fn declarations with initial payload:

  • corpus (docs | code | memory | web)
  • query (string)
  • into (target type)
  • optional top_k, policy

Lowering target is HirAiFixture::Search, with codegen dispatch to:

  • execute_search_plan (docs/code)
  • MemoryManager::lookup_fact_by_key (memory)
  • cascade_with_optional_manual (web)
  • Unifies retrieval authoring under one language surface.
  • Preserves ACI mutation classification for each corpus path.
  • Enables compile-time diagnostics for unsupported corpus/type combinations.

Search intent is modeled as a decorator on existing function declarations, not as a new bare keyword.

  • vox/search/corpus-denied
  • vox/search/memory-key-invalid
  • vox/search/web-policy-denied