Skip to main content

ADR-024: Haystack Migration

Status: Accepted Date: 2026-06-02 Authors: paulhumanity (with grazianognoll) Supersedes: ADR-004, ADR-009

Contextโ€‹

The RAGflow stack ran at approximately $2k per environment-month, remained internal-testing-only, and locked humanwork into RAGflow's bundled search, embedder, and reranker. The stack did not provide a clean swap path for the retrieval runtime or upstream AI providers.

Decisionโ€‹

Use Haystack 2.x plus Hayhooks on Railway for dev, staging, and production. Route embedding, chat, and rerank traffic through OpenRouter. Use pgvector on the existing humanwork Postgres instance as the document store.

Whyโ€‹

This migration provides vendor neutrality through config-only swaps, consolidates upstream AI spend into a single OpenRouter billing line, removes RAGflow search/runtime lock-in, targets $440 per environment, and reuses the existing Postgres instance. The target cost is approximately a 78% reduction from the RAGflow stack.

Consequencesโ€‹

Positive consequences:

  • Lower per-environment cost.
  • Simpler operations.
  • Vendor swap is a config change.

Negative consequences:

  • One new Python service, Hayhooks/rag, must be maintained.
  • pgvector capacity is tied to Postgres scaling.

Referenceโ€‹

The authoritative spec lives in Notion; this ADR is the in-repo digest.