terraphim / terraphim/terraphim-ai

feat: Add context-hub haystack connector

Aperta
#651 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement
Lingua principale
Rust
Stelle
62
Fork
5
Merge medio
2h 27m
PR unite (30g)
1

Descrizione

Summary

Add a new haystack connector for context-hub (Andrew Ng's curated API docs for coding agents) to complement the existing grepapp_haystack and query_rs haystacks.

Motivation

Terraphim's haystack architecture already covers two code knowledge sources:

Source Status What it searches
grep.app Implemented (grepapp_haystack) Code across ~1M GitHub repos -- "How do others use this API?"
query.rs Implemented (query_rs haystack) Rust std lib, crates, type signatures, error codes, Clippy lints, books -- "What is the Rust API for X?"
context-hub Proposed Curated, versioned API docs (Stripe, OpenAI, etc.) with agent annotations -- "Give the agent correct, hallucination-free API docs"

Context-hub fills a gap neither grep.app nor query.rs covers: curated, language-aware API documentation specifically designed for AI coding agents. It provides incremental doc fetch (token-efficient), community-maintained quality, language variants (Python/JS), and persistent annotations.

How context-hub differs from existing haystacks

Dimension grep.app query.rs context-hub
Data Source code Rust docs, types, lints Curated API docs (multi-language)
Query model Text/regex Prefixed search + type signatures Hierarchical IDs + chub search
Freshness Live index of GitHub Synced with Rust releases Community-maintained PRs
Privacy Public repos only Public docs Public repo
Best for Usage examples Rust API reference, error lookup Agent-friendly API context for any language
Stack Web API Web API (scraping + JSON) CLI (chub) + markdown repo

Proposed Design

chub_haystack
  • Implement IndexMiddleware trait (same pattern as grepapp and query_rs haystacks)
  • Wrap chub search and chub get CLI or replicate the search/fetch protocol directly via HTTP
  • Map context-hub markdown + YAML frontmatter to Terraphim Document types
  • Preserve language variants (Python/JS) as document metadata
  • Optionally bridge annotations back to Terraphim's learning capture system
  • Feature-gate behind context-hub flag in terraphim_middleware

Acceptance Criteria

  • chub_haystack module in crates/terraphim_middleware/src/haystack/
  • Implements IndexMiddleware trait
  • Feature flag context-hub in middleware Cargo.toml
  • Integration tests with real queries (not mocks)
  • Config support in role configs (similar to grepapp/query_rs entries)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Start by reading the existing grepapp_haystack and query_rs haystack implementations in crates/terraphim_middleware/src/haystack/ and compare their IndexMiddleware integration. Then inspect middleware Cargo.toml and role configs for feature flags and haystack entries. Done means a context-hub module, enabled configuration, real-query integration tests, and mapped documents with language metadata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
ai, backend
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.