Open-source software
Delphi
A local-first context engine for coding agents
Abstract
Coding agents work from what they can see, and most of what they need is not in their training data: the repository in front of them, the documentation for the exact library version it depends on, the paper a method came from. Delphi is an open-source context engine that indexes repositories, documentation sites, research papers, datasets, and local folders into a PostgreSQL database on the user's own machine and exposes them to any MCP client as a small set of tools for indexing, searching, following call graphs, and assembling context packs under a token budget. Retrieval fans a query out to six candidate sources, dense vectors, BM25 full text, trigram symbol matching, exact symbol and path lookup, and path tokens, and fuses them by reciprocal rank, so identifier-heavy and prose queries share one pipeline. Identical requests return identical results, completed indexing runs produce immutable snapshots, and saved context sessions record exactly which snapshot an agent used. No source content leaves the machine unless a remote provider is explicitly allowed.
1What Delphi indexes
A source is anything an agent might need to read while working. Each source type has its own parser and produces the kind of context that is useful for it (Table 1). Repositories are cloned with Git and parsed with tree-sitter, so functions, classes, and their call relationships are available in addition to text. Documentation is crawled within the requested scope and kept per version. Papers are split into sections with their citations and equations preserved, so an agent can quote evidence with its anchor.
Table 1: Source types and the context available for each.
| Source | Available context |
|---|---|
| Repositories | Code search, symbols, call graphs, and the tests and documentation related to a file |
| Documentation | Versioned pages from documentation sites, with full-text search |
| Papers | Sections, citations, equations, and quoted evidence from arXiv or uploaded PDFs |
| Datasets | Hugging Face dataset cards and metadata |
| Local folders | Private, in-progress work that has no Git remote |
Every index lives in the user's PostgreSQL database. When an indexing run completes, it publishes an immutable snapshot of the source; a failed or cancelled run leaves the previous snapshot searchable. Repositories can be indexed at a branch or at an exact commit, and a freshness check reports when a local folder or repository has drifted from its index.
2Retrieval
Dense retrieval alone is a poor fit for code. An agent asking for handleAuthCallback should get that function on the first try, not a list of semantically similar middleware. Delphi therefore treats retrieval as candidate generation followed by fusion (Figure 2). A query is sent to six candidate sources at once: cosine similarity over pgvector embeddings, BM25 over a full-text index of the chunks, trigram similarity over symbol names for partial and misspelled identifiers, exact lookup of symbols by name or qualified name, exact lookup of files by path or glob, and an opt-in overlap between query tokens and normalized file paths.
Candidates are fused by weighted reciprocal rank. A chunk found by several sources rises; a chunk found by one strong source is kept rather than averaged away. The fused list is diversified across files so a single large file cannot fill the result set, and it can optionally pass through a cross-encoder or a listwise reranker over the head of the list. Prose questions can optionally be expanded with a hypothetical document before embedding.
Determinism
An agent that reruns a search should see the same answer. Every candidate query has a total ordering, concurrent identical requests share a single execution, and the outputs of any optional model providers are cached on disk, so a search repeats exactly across requests and across restarts of the service. Vector search can run as an exact scan rather than an approximate index when exact repeatability matters more than latency.
Code structure
Symbol extraction runs through tree-sitter for Python, JavaScript, TypeScript, Go, Rust, Java, C, C++, C#, Ruby, and PHP. From the extracted definitions and references Delphi builds a dependency graph per repository, which answers who calls a function, what it calls, and what would be affected by changing it.
Context packs
A context pack takes a task description and a token budget and returns a ranked set of files and excerpts sized to fit the agent's next call, together with the snapshot each item came from. A context session saves that pack so another agent, or the same agent later, can rehydrate exactly the same view.
3Agent interface
Delphi is an MCP server. Its tools are grouped, and a profile selects which groups are advertised to the agent, since every tool definition costs tokens on each handshake. The default code profile exposes repository indexing, search, code structure, and context tools; papers, docs, minimal, and all select other subsets. Table 2 lists representative tools.
Table 2: Representative MCP tools by group.
| Group | Tools |
|---|---|
| Indexing | index_repository, index_local_folder, index_paper, index_dataset, index_source |
| Search | search_code, search_symbols, search_papers, grep_source, search |
| Code structure | find_callers, find_callees, impact_analysis, build_code_graph, get_symbol |
| Context | build_context_pack, get_context, context_session_create, context_session_handoff |
| Sources | resolve_source, read_source, tree_source, check_freshness, list_stale_sources |
| Research (opt-in) | research, research_start, research_status, research_followup |
The same operations are available over HTTP at localhost:8742, and a local dashboard at localhost:3000 shows indexed sources, jobs, and API keys.
4Getting started
The installer starts the local stack and can register Delphi with Claude Code, Cursor, Windsurf, or Claude Desktop. It needs Docker, Git, and one embeddings provider; the default local sentence-transformers model needs no API key.
$ npx @synsci/delphi$ delphi # open the dashboard $ delphi status # check the stack $ delphi logs -f # follow logs $ delphi stop # stop services
Any other MCP client connects through a small stdio proxy. Create an API key in the dashboard, then add:
{
"mcpServers": {
"delphi": {
"command": "uvx",
"args": ["synsci-delphi-proxy"],
"env": {
"SYNSC_API_KEY": "your-api-key",
"SYNSC_API_URL": "http://localhost:8742"
}
}
}
}To run from source, clone the repository, copy env.example to .env, and run ./scripts/launch_app.sh. Configuration is documented in the advanced environment reference.
5Local-first execution
The API, workers, database, and dashboard all run on the user's machine. The default network policy is local_only: no remote provider is called unless the deployment allowlists it, and a per-request policy can only narrow that ceiling, never widen it. Embeddings default to a local sentence-transformers model; OpenAI and Gemini embeddings, and a keyless hash embedding for constrained machines, are alternatives. Hosted web search and crawling exist but are off by default and, when enabled, send only the query, never indexed content.
Delphi is licensed under Apache 2.0 and developed in the open at github.com/synthetic-sciences/delphi.
Updates
- Aug 2026
- Deterministic hybrid retrieval: identical searches return identical results. Agent mode now indexes generated source files. A file-level BM25 candidate source ships opt-in.
- Jul 2026
- Immutable source snapshots, reproducible context sessions, durable connector synchronization, policy-gated web search and crawl, query expansion, and listwise reranking.
- Jun 2026
- Code dependency graph (callers, callees, impact analysis), symbol extraction for eleven languages, local-folder indexing, index drift detection, and a lite deployment mode.
Citation
@software{delphi2026,
title = {Delphi: a local-first context engine for coding agents},
author = {Bansal, Aayam},
year = {2026},
url = {https://github.com/synthetic-sciences/delphi},
license = {Apache-2.0}
}