Repository Expert: Deployment
How the repository expert is distributed follows from three choices:
- Where inference runs: a local model, a self-hosted model in your network, or an external API.
- Where retrieval state lives: nowhere (files are passed in), a local index, or a shared index service.
- How people invoke it: CLI or IDE, chat bot, or HTTP API.
Once these are fixed, the pattern is mostly determined. Stages of the product itself are in roadmap.
Patterns
A common variant of the shared service keeps model calls on the client and does retrieval on the server, returning “context packs”, so indices are not copied to every machine.
Service topology
- Monolith. One service handles auth, retrieval, prompt assembly, the model call and streaming, over one store stack (vector store plus metadata database). Good until scale or organizational boundaries force a split.
- Split services. An indexer (batch and incremental) writes to the stores; a retriever serves top-k chunks; an answerer assembles prompts and calls the model; an optional model gateway isolates provider credentials, rate limits and caching. A queue between indexer and stores helps with large repositories.
Distribution formats: a Python package for the CLI, a single binary for easy internal distribution, container images for the service and indexer jobs, Kubernetes for a multi-tenant service. Serverless suits webhook-driven CI actions but rarely long-running indexing.
Scaling stages
The stages move from validating value (retrieval quality) to validating architecture (concurrency, latency, governance). The bottleneck shifts from client-side indexing I/O to shared state, then to throughput, then to cost and access control.
Progression for this project
- Local stateless CLI (now, with model calls mocked or direct).
- A local index behind an interface, with the same CLI experience.
- Retrieval extracted into a service once several users need a shared index.
- IDE and CI integrations as further clients of the same retrieval and inference API.
Interfaces to fix now
To move between stages without rewrites:
- Context schema. A strict serialization for retrieved chunks (ID, AST node type, line span, path, commit) instead of raw strings.
- Retriever protocol. An interface that separates the intent (“retrieve context for query X”) from the implementation (cosine similarity, hybrid search, graph expansion), so the backend can change behind a stable client.
- Baseline metrics. Deterministic evaluation (for example recall@k for function definitions, see evaluation) established at the first stage. Scaling infrastructure without a baseline hides quality regressions.