Delphi Code
Offline semantic code search for agents. Delphi Code is a small Python CLI that indexes local source trees with a local embedding model and answers natural-language queries with JSON for agents and readable text in a terminal. No daemon, server, account, or cloud embedding provider.
Quick start
Install with the script, which also installs uv if it is missing and runs setup:
curl -LsSf https://github.com/markdorof/delphi-code/releases/latest/download/install.sh | sh
Or, with uv already installed:
uv tool install --managed-python delphi-code
delphi-code setup
Then index a project and search it:
delphi-code index -p /absolute/path/to/project
delphi-code search 'where are user passwords checked?'
setup downloads and verifies the embedding model once; after that, every command runs offline. Without -p, search looks through every indexed project.
To use it from an agent, connect the agent to the MCP server, which keeps the model loaded so repeated searches are near-instant, and give it the skill, which tells it when to search by meaning instead of grep:
| Agent | Setup |
|---|---|
| Claude Code | claude plugin marketplace add markdorof/delphi-code, then claude plugin install delphi-code@delphi-code |
| Codex | codex plugin marketplace add markdorof/delphi-code, then install it from /plugins |
| Cursor | Add {"mcpServers": {"delphi-code": {"type": "stdio", "command": "delphi-code", "args": ["mcp"]}}} to ~/.cursor/mcp.json |
| VS Code (Copilot) | code --add-mcp '{"name": "delphi-code", "command": "delphi-code", "args": ["mcp"]}' |
| Gemini CLI | gemini mcp add delphi-code delphi-code mcp |
The Claude Code and Codex plugins include both. For the others, also copy the skill to ~/.agents/skills/delphi-code/SKILL.md.
Requirements
- macOS 14+ on arm64 (tested). Linux is not yet verified; Windows is not supported.
- Python 3.12+ with SQLite loadable extensions.
--managed-pythonmakes uv use a Python build that supports them;doctorchecks this. - No GPU needed.
Installation
The install script runs the same uv tool install --managed-python delphi-code and delphi-code setup as the uv option. Pass options after sh -s --: --no-setup skips the model download, --version VERSION picks a release. Running it again upgrades.
From a checkout, with uv:
uv tool install --managed-python /absolute/path/to/delphi-code
delphi-code setup
setup downloads the pinned all-MiniLM-L6-v2 model and checks it against bundled hashes. Running it again reuses a valid model. --model DIR or DELPHI_CODE_MODEL selects a different location. For an offline machine, import a prepared model directory:
delphi-code setup --from /absolute/path/to/all-MiniLM-L6-v2
Upgrading
uv tool upgrade delphi-code
See GitHub Releases for changes. The model and indexes are kept. If a release can't reuse an old index, commands fail with index_incompatible; delete the index directory the error names and run index or sync again.
Uninstalling
uv tool uninstall delphi-code
rm -rf ~/Library/Application\ Support/delphi-code
On Linux the data directory is $XDG_DATA_HOME/delphi-code or ~/.local/share/delphi-code.
Indexing projects
delphi-code index -p ~/src/api # one-off; run again after changes
delphi-code add ~/src/api ~/src/web # track local projects
delphi-code add github.com/octo/tools # track a remote repo (no clone needed)
delphi-code add # pick repos from your Bitbucket/GitHub account
delphi-code sync # update everything tracked
Tracked projects live in repos.toml in the data directory. Remote repos are shallow-cloned to a temp dir on sync and skipped when unchanged; --ref picks a branch or tag. Only add and sync use the network.
Remote credentials: GITHUB_TOKEN/GH_TOKEN (or gh auth token) for GitHub; BITBUCKET_APP_PASSWORD (an API token works) with BITBUCKET_EMAIL or BITBUCKET_USERNAME for Bitbucket. Otherwise git's stored credentials are used.
Commands
delphi-code doctor -p /path/to/project
delphi-code index -p /path/to/project
delphi-code search -p /path/to/project 'parse configuration' --language python --path 'src/*' --limit 5
delphi-code status -p /path/to/project
delphi-code list --indexed
| Command | What it does | Options |
|---|---|---|
setup |
Downloads or imports the model and checks the installation. | --from DIR, --model DIR |
doctor |
Checks the model, SQLite extensions, and storage with a real embedding. | -p, --model |
index |
Builds or incrementally updates a project's index. | -p, --model, --path, --language, --ignore, --max-bytes |
search QUERY |
Runs a natural-language query. Without -p, searches every index. |
-p, --model, --path, --language, --limit (default 10) |
status |
Reports a project's index state. | -p |
add [SOURCE ...] |
Tracks and indexes projects or remote repositories; without sources, picks repositories interactively. | --ref, --no-sync, --model, --path, --language, --ignore, --max-bytes |
sync |
Indexes every tracked project. | --model |
list |
Lists tracked projects and stored indexes. | --indexed |
remove NAME |
Stops tracking a project and deletes its index. | --keep-index |
mcp |
Serves the commands above as MCP tools over stdio, with the same names and options. | --model |
Every command accepts --json and --help. --path, --language, and --ignore can be repeated.
Selecting a project
-p / --project takes a path, or, once a project is indexed, its key or folder name (acme/api, api). Use ./name to force a directory. Without -p, search searches all indexes and other commands use the current directory.
Output
In a terminal, commands print readable text (NO_COLOR disables colors). Otherwise, or with --json, each command writes one JSON object with schema_version, ok, command, and data or error:
{
"command": "search",
"ok": true,
"schema_version": 1,
"data": {
"query": "where is the model checksum verified?",
"results": [
{
"path": "delphi_code/setup.py",
"language": "python",
"start_line": 17,
"end_line": 31,
"score": 0.39,
"text": "def verify_assets(root):\n …"
}
]
}
}
Higher score means a closer match.
| Exit code | Meaning |
|---|---|
| 0 | Success, including no matches |
| 2 | Invalid arguments or project |
| 3 | Missing or incompatible model |
| 4 | Missing, incomplete, or incompatible index |
| 5 | Busy index or operational failure |
What gets indexed
.gitignoreand.delphi-codeignorefiles are respected, plus any--ignorepatterns..git,.venv,venv,node_modules,__pycache__, and the model directory are skipped, as are symlinks, binary files, and files over--max-bytes(default 1 MiB).--pathglobs and--languagevalues (such aspython,typescript) narrow the selection. Onindexthey define the whole indexed set; onsearchthey filter results.
Models
The default model, MiniLM, is small and general-purpose. Any local SentenceTransformers model with safetensors weights and no custom code can be used through --model or DELPHI_CODE_MODEL. Searching an index with a different model fails instead of returning wrong results.
Storage and logs
Data lives in ~/Library/Application Support/delphi-code/ on macOS and ~/.local/share/delphi-code/ on Linux: the model, indexes, repos.toml, and logs/delphi-code.log. Override locations with DELPHI_CODE_MODEL, DELPHI_CODE_INDEX_ROOT, DELPHI_CODE_REGISTRY, and DELPHI_CODE_LOG_FILE; set DELPHI_CODE_LOG_LEVEL to DEBUG, INFO, WARNING, ERROR, or OFF. Logs never leave the machine.
A Git repository with an origin remote shares one index across clones and moves; other directories are indexed by path.
Offline guarantees
The CLI disables telemetry, loads models only from local files, and blocks network access from Python. Only setup, and add/sync for remote repositories, need the network. For an OS-level guarantee on macOS:
/usr/bin/sandbox-exec -p '(version 1)(allow default)(deny network*)' \
delphi-code index -p /path/to/project
Development
See CONTRIBUTING.md.
License
Apache-2.0. See THIRD_PARTY_NOTICES.md for dependency and model notices.
Metadata
Release files for delphi-code 0.2.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| delphi_code-0.2.10.tar.gz | 80.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| delphi_code-0.2.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 154.0 kB
Release files / delphi_code-0.2.10.tar.gz
| Download URL | delphi_code-0.2.10.tar.gz |
|---|---|
| Size | 80.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a15d54db1b811312492268d0b6d3b66a4b723f2c052f63cf9eed7f0607cd60df
|
|
BLAKE2b-256 checksum How to use checksums |
feec3a76ba5878c3e41edba6d2fa5514a6a200ef8f57600f156e82f7c4754756
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency logRelease files / delphi_code-0.2.10-py3-none-any.whl
| Download URL | delphi_code-0.2.10-py3-none-any.whl |
|---|---|
| Size | 73.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de49e5cacbea08be209ce93575ef056d11fe5eba7312eed881de1dfc79466b80
|
|
BLAKE2b-256 checksum How to use checksums |
af7476c7fc03cbf9e2579756b3d6547e79bfb72e25101268c6c43f88986e3ed7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency log