### Install via npm Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Install the package globally and run the setup wizard to configure endpoints and virtual environments. ```sh npm install -g open-context-engine open-context-engine setup ``` -------------------------------- ### Install from source Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Clone the repository and run the setup script directly from the source code. ```sh git clone https://github.com/AnnaSuSu/OpenContextEngine.git cd OpenContextEngine npm ci node bin/opencontextengine.mjs setup ``` -------------------------------- ### Run retrieval service from source on Windows Source: https://github.com/annasusu/opencontextengine/blob/main/docs/LIVE_INDEX.md PowerShell commands to install dependencies, create a virtual environment, and start the retrieval service on Windows. ```powershell npm ci python -m venv .venv .\.venv\Scripts\python.exe -m pip install -r requirements.txt # Set model endpoints and OCE_API_KEY (at least 24 characters) in .env. npm run serve-retrieval -- --root "C:\Users\you\project" --port 23505 ``` -------------------------------- ### Run retrieval service from source on macOS/Linux Source: https://github.com/annasusu/opencontextengine/blob/main/docs/LIVE_INDEX.md Commands to install dependencies, create a virtual environment, and start the retrieval service on Unix-like systems. ```sh npm ci python3 -m venv .venv .venv/bin/pip install -r requirements.txt # Set model endpoints and OCE_API_KEY (at least 24 characters) in .env. npm run serve-retrieval -- --root /absolute/path/to/repository --port 23505 ``` -------------------------------- ### Install OpenContextEngine CLI Source: https://github.com/annasusu/opencontextengine/blob/main/README.md Install the OpenContextEngine CLI globally using npm. ```sh npm install -g open-context-engine ``` -------------------------------- ### MCP Client Configuration Source: https://github.com/annasusu/opencontextengine/blob/main/docs/MCP.md Configuration example for clients that accept mcpServers JSON and can find the CLI on PATH. The command starts the MCP server using the open-context-engine CLI. ```APIDOC ## MCP Client Configuration ### Description Configuration for clients that accept mcpServers JSON and can find the CLI on PATH. ### Configuration ```json { "mcpServers": { "open-context-engine": { "command": "open-context-engine", "args": ["mcp"] } } } ``` ### Notes - Configuration precedence: process environment variables → user settings saved by setup → .env in the OpenContextEngine source directory. - The searched project's .env is not read. - Default index location: ~/.cache/opencontextengine// - Override index location with --state /outside/repository/index. - To use a fixed project, append "--root", "/absolute/path/to/your-repository" to args. - Tool calls may then omit directory_path; if provided, it must refer to that same project. ``` -------------------------------- ### Configure OpenContextEngine Models Source: https://github.com/annasusu/opencontextengine/blob/main/README.md Run the setup command to configure embedding and reranking base URLs, API keys, model names, and dimensions. ```sh open-context-engine setup ``` -------------------------------- ### Setup with custom Python interpreter on Windows Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Specify an absolute path to the Python interpreter during setup on Windows. ```powershell open-context-engine setup --python "C:\Program Files\Python312\python.exe" ``` -------------------------------- ### Start the reranker reference server Source: https://github.com/annasusu/opencontextengine/blob/main/docs/RERANKER_API.md Run the reference server using Uvicorn from the repository root, ensuring the model host environment variable is set. ```sh # Set the model directory and secret in the server's environment first. OCE_REMOTE_MODEL_HOST=1 python -m uvicorn reranker-server:app \ --app-dir scripts/benchmarks --host 127.0.0.1 --port 8000 ``` -------------------------------- ### Upgrade Open Context Engine Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Commands to upgrade the package via npm and re-run the setup process. Press Enter during setup to retain existing saved settings. ```sh npm install -g open-context-engine@latest open-context-engine setup ``` -------------------------------- ### Example tool arguments Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md The JSON structure sent by your agent when invoking tools, requiring a directory_path and a query. ```json {"directory_path":"/absolute/path/to/your-repository","query":"Where are user sessions validated?"} ``` -------------------------------- ### Start shared worker Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Run this command from the source checkout to start a shared worker. Requires an OCE_API_KEY of at least 24 characters in the environment. ```sh npm run serve-retrieval -- --root /absolute/path/to/your-repository --port 23505 ``` -------------------------------- ### Reproduce Django evaluation environment Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/DJANGO_PROTOCOL_V1.md Install dependencies, prepare the Django environment, run tests, and perform a dry-run validation. ```sh npm ci npm run prepare-django -- /absolute/path/to/django npm test npm run ace-django -- --dry-run ``` -------------------------------- ### Start the persistent retrieval service Source: https://github.com/annasusu/opencontextengine/blob/main/docs/MCP.md Starts a persistent service from the OpenContextEngine source directory to allow multiple clients to search the same repository. Ensure OCE_API_KEY is set in your .env file to at least 24 characters. ```sh # Set OCE_API_KEY in .env to at least 24 characters. npm run serve-retrieval -- --root /absolute/path/to/your-repository --port 23505 ``` -------------------------------- ### Start SSH loopback forward Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Establishes an SSH tunnel for internal testing by forwarding local ports to the remote model host. ```sh ssh -N -o ExitOnForwardFailure=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=3 \ -L 127.0.0.1:43079:127.0.0.1:8079 \ -L 127.0.0.1:43078:127.0.0.1:8078 operator@model-host.example ``` -------------------------------- ### Search your project with Claude Code Source: https://github.com/annasusu/opencontextengine/blob/main/README.md Navigate to your project and start a Claude Code session. Then use the /mcp command to verify the connection and ask Claude to use the search_code tool. ```sh cd /path/to/your-project claude ``` -------------------------------- ### Configure Alibaba Cloud Model Studio Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Use these environment variables to configure Alibaba Cloud Model Studio, specifying the DashScope rerank format. Remember to supply your API keys via EMBEDDING_API_KEY and RERANK_API_KEY before running the setup. ```dotenv EMBEDDING_BASE_URL=https://YOUR_WORKSPACE.cn-beijing.maas.aliyuncs.com/compatible-mode/v1 EMBEDDING_MODEL=qwen3.7-text-embedding OCE_EMBEDDING_DIMENSIONS=1024 OCE_EMBEDDING_BATCH_SIZE=20 RERANK_BASE_URL=https://YOUR_WORKSPACE.cn-beijing.maas.aliyuncs.com/api/v1 RERANK_MODEL=qwen3.7-text-rerank OCE_RERANK_API=dashscope ``` -------------------------------- ### GET /v1/models Source: https://github.com/annasusu/opencontextengine/blob/main/docs/RERANKER_API.md Returns authenticated model metadata. ```APIDOC ## GET /v1/models ### Description Returns authenticated model metadata. ### Method GET ### Endpoint /v1/models ### Authentication Requires Authorization: Bearer . ### Response #### Success Response (200) - No specific response body documented. ``` -------------------------------- ### Configure generic embedding and reranking services Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Set these environment variables before running the setup command to configure generic embedding and reranking services. Ensure OCE_EMBEDDING_DIMENSIONS matches your specific endpoint's output size. ```dotenv EMBEDDING_BASE_URL=https://your-embedding-service.example/v1 EMBEDDING_API_KEY=your-embedding-key EMBEDDING_MODEL=Qwen3-Embedding-4B # Match the actual output size of your embedding endpoint. OCE_EMBEDDING_DIMENSIONS=2560 RERANK_BASE_URL=https://your-reranker-service.example/v1 RERANK_API_KEY=your-reranker-key RERANK_MODEL=Qwen3-Reranker-4B ``` -------------------------------- ### GET /healthz Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/OPENCONTEXTENGINE_SPEED.md Returns engine version, source hashes, index metadata, and reranking configuration. Reflects startup configuration. ```APIDOC ## GET /healthz ### Description Returns engine version, source hashes, index metadata, and reranking configuration. Reflects startup configuration. ### Method GET ### Endpoint /healthz ### Response #### Success Response (200) - **engineVersion** (string) - Engine version. - **sourceHashes** (object) - Hashes of source files. - **indexMetadata** (object) - Metadata about the index. - **rerankingConfiguration** (object) - Configuration for reranking. #### Response Example { "engineVersion": "1.0.0", "sourceHashes": {}, "indexMetadata": {}, "rerankingConfiguration": {} } ``` -------------------------------- ### Codex MCP configuration (TOML) Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Add this entry to ~/.codex/config.toml to register the OpenContextEngine MCP server for Codex. Replace the example paths with the absolute command and args from 'open-context-engine mcp-config'. Preserve any env section if present. ```toml [mcp_servers.open-context-engine] command = "/absolute/path/to/node" args = ["/absolute/path/to/bin/opencontextengine.mjs", "mcp"] startup_timeout_sec = 30 tool_timeout_sec = 180 ``` -------------------------------- ### GET /healthz Source: https://github.com/annasusu/opencontextengine/blob/main/docs/LIVE_INDEX.md Indicates process liveness, not index readiness. ```APIDOC ## GET /healthz ### Description Indicates process liveness, not index readiness. ### Method GET ### Endpoint /healthz ### Response #### Success Response (200) - **status** (string) - Liveness status. ``` -------------------------------- ### Run baseline commands for cocoindex and contextweaver Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/OPEN_SOURCE_BASELINES.md Run after installing remote-client dependencies and configuring remote models. Executes the baseline for cocoindex and contextweaver, then scores the Django answers using the answers.v2.json file. ```sh # Run only after installing remote-client dependencies and configuring remote models: npm run baseline -- cocoindex npm run baseline -- contextweaver npm run score-django -- RUN_DIRECTORY answers.v2.json ``` -------------------------------- ### GET /healthz Source: https://github.com/annasusu/opencontextengine/blob/main/docs/RERANKER_API.md Readiness probe endpoint that returns unauthenticated health status. ```APIDOC ## GET /healthz ### Description Readiness probe endpoint that returns unauthenticated health status. ### Method GET ### Endpoint /healthz ### Response #### Success Response (200) - No specific response body documented. ``` -------------------------------- ### GET /status Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Authenticated HTTP equivalent of index_status. Checks index coverage for a given path with optional limit and cursor parameters. ```APIDOC ## GET /status ### Description Authenticated HTTP equivalent of index_status. Checks index coverage for a given path with optional limit and cursor parameters. ### Method GET ### Endpoint /status ### Parameters #### Query Parameters - **path** (string) - Optional - The file or directory path to check. Use "src" for a directory, "." for the workspace, or omit for the usual lightweight status observation. - **limit** (integer) - Optional - Number of entries to return, from 1 to 200. Default is 50. - **cursor** (string) - Optional - Pagination cursor from a previous response's nextCursor. ### Request Example GET /status?path=src/session.py ### Response #### Success Response (200) - **coverage.synchronized** (boolean) - Indicates whether the entire workspace is synchronized. - **summary** (object) - Counts of inventory entries. - **entries** (array) - List of status entries, each with path, status, and optional reason. - **nextCursor** (string) - Pagination cursor for the next page. #### Response Example { "coverage": { "synchronized": true, "summary": { "indexed": 10, "pending": 2, "excluded": 1, "deleted": 0, "not_found": 0, "unknown": 0 }, "entries": [ { "path": "src/session.py", "status": "indexed" } ], "nextCursor": null } } ``` -------------------------------- ### Development-only GPT environment variables Source: https://github.com/annasusu/opencontextengine/blob/main/scripts/README.md Environment variables for running pilot experiments from source. Add these to a private .env or process environment. The pilot fixes the model to gpt-6.1-sol. These settings are not saved by the product setup wizard or required by the npm CLI. ```dotenv GPT_BASE_URL=https://provider.example.com/v1 GPT_API_KEY= GPT_MODEL=gpt-6.1-sol GPT_REASONING_EFFORT=medium GPT_TIMEOUT_MS=300000 # Optional; omitted uses the project's own default identifier. # GPT_USER_AGENT=OpenContextEngine-Pilot/0.1 ``` -------------------------------- ### Publish the verified archive and verify integrity Source: https://github.com/annasusu/opencontextengine/blob/main/docs/RELEASING.md Publishes the verified archive to the public npm registry, then checks the published version and its integrity hash. After publishing, compare the registry integrity with the packed artifact and verify a clean global install. ```sh npm publish .pilot-state/npm-release/open-context-engine-0.1.10.tgz --access public --registry https://registry.npmjs.org/ npm view open-context-engine@0.1.10 version dist.integrity --registry https://registry.npmjs.org/ ``` -------------------------------- ### GET /status Source: https://github.com/annasusu/opencontextengine/blob/main/docs/LIVE_INDEX.md Returns the current index status, version, changed-file counts, reuse counts, and latest error type. Uses the same Bearer authentication as search. ```APIDOC ## GET /status ### Description Returns the current index status, version, changed-file counts, reuse counts, and latest error type. Uses the same Bearer authentication as search. ### Method GET ### Endpoint /status ### Authentication Bearer token (same as search) ### Response #### Success Response (200) - **status** (string) - One of: 'starting', 'updating', 'ready', 'failed'. - **version** (string) - The current version. - **changedFileCounts** (object) - Counts of changed files. - **reuseCounts** (object) - Counts of reused vectors. - **latestErrorType** (string) - The type of the latest error. ``` -------------------------------- ### Initialize Project Search in Codex Source: https://github.com/annasusu/opencontextengine/blob/main/README.md Navigate to the project directory and launch the Codex client to begin searching. ```sh cd /path/to/your-project codex ``` -------------------------------- ### Set Go binary and run prepare-source and inspect-source scripts Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/JS_GO.md Commands to set the OCE_GO_BINARY environment variable and run the Python scripts to prepare and inspect a repository. Requires Go 1.22+ and npm ci for JS/TS parser. ```sh export OCE_GO_BINARY=/path/to/go/bin/go python3 scripts/prepare-source.py /path/to/repository --output /tmp/snapshot.json python3 scripts/inspect-source.py /path/to/repository --snapshot /tmp/snapshot.json --output /tmp/structure.json ``` -------------------------------- ### Build and inspect the release archive Source: https://github.com/annasusu/opencontextengine/blob/main/docs/RELEASING.md Creates a directory for the release, runs the pack script to generate the archive, and performs a dry-run publish to inspect the contents. The archive is named open-context-engine-0.1.10.tgz. ```sh mkdir -p .pilot-state/npm-release node scripts/pack-release.mjs .pilot-state/npm-release npm publish .pilot-state/npm-release/open-context-engine-0.1.10.tgz --dry-run --access public --registry https://registry.npmjs.org/ ``` -------------------------------- ### Prepare and Inspect Source Snapshots Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/TEXT_FALLBACK.md Use these commands to generate a source snapshot and inspect it. Place the output outside the indexed directory to prevent discovery during subsequent passes. ```sh python3 scripts/prepare-source.py /path/to/repository --output /tmp/source-snapshot.json python3 scripts/inspect-source.py /path/to/repository \ --snapshot /tmp/source-snapshot.json --output /tmp/source-units.json ``` -------------------------------- ### Run OpenContextEngine scripts Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/OPENCONTEXTENGINE_PROTOTYPE.md Commands to execute literal retrieval planning, run the engine, and score results locally using the provided scripts. ```sh node scripts/literal-retrieval-plans.mjs node scripts/run-opencontextengine.mjs # Score locally where frozen reference answers are available: node scripts/score-django.mjs RUN_DIRECTORY answers.v2.json ``` -------------------------------- ### Run evaluation benchmarks and reports Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/METHOD_COMPARISON.md Commands to execute the scoring, auditing, plotting, and reporting scripts for the method comparison evaluation. ```sh node scripts/benchmarks/score-methods.mjs eval/method-comparison-v1/runs.json node scripts/benchmarks/audit-methods.mjs python scripts/benchmarks/plot-methods.py python scripts/benchmarks/report-methods.py ``` -------------------------------- ### MCP server configuration for other clients Source: https://github.com/annasusu/opencontextengine/blob/main/README.md JSON configuration for MCP clients that accept mcpServers. The command must be findable on PATH. Add --root with an absolute path to pin a single project. ```json { "mcpServers": { "open-context-engine": { "command": "open-context-engine", "args": ["mcp"] } } } ``` -------------------------------- ### Add and Verify MCP Server in Codex Source: https://github.com/annasusu/opencontextengine/blob/main/README.md Register the OpenContextEngine MCP server with the Codex CLI and verify the configuration. ```sh codex mcp add open-context-engine -- open-context-engine mcp codex mcp get open-context-engine ``` -------------------------------- ### Check npm authentication and package availability Source: https://github.com/annasusu/opencontextengine/blob/main/docs/RELEASING.md Logs in to the npm registry, verifies the authenticated user, and checks the current published versions of open-context-engine. An E404 error indicates the package is not publicly visible. ```sh npm login --registry https://registry.npmjs.org/ npm whoami --registry https://registry.npmjs.org/ npm view open-context-engine versions --json --registry https://registry.npmjs.org/ ``` -------------------------------- ### Configure default target in the snapshot Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/JS_GO.md Sets the Go language options for the snapshot, including the module path and target platform architecture. ```json {"languageOptions":{"go":{"mode":"types","modulePath":"example.com/project","goos":"linux","goarch":"amd64"}}} ``` -------------------------------- ### Run speed benchmarks and scoring scripts Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/OPENCONTEXTENGINE_SPEED.md Commands to rebuild performance summaries, execute service benchmarks, and score saved outputs offline. ```sh # Rebuild summaries from local frozen source and original run records, without model calls. python3 scripts/summarize-speed.py # Repeat three rounds against the current service, making 60 actual queries. npm run benchmark-service # Score a round's saved original outputs offline. npm run score-django -- RUN_DIRECTORY answers.v2.json ``` -------------------------------- ### Run Development and Maintenance Tests Source: https://github.com/annasusu/opencontextengine/blob/main/docs/MCP.md Commands to execute the test suite and smoke tests. Ensure development dependencies and the Python virtual environment are configured before running. ```sh npm test OCE_GO_BINARY=/path/to/go .venv/bin/python -m unittest discover -s tests -p '*_test.py' # Calls configured real remote models and saves results under .pilot-state/mcp-smoke. node scripts/smoke-mcp.mjs --auto-workspace ``` -------------------------------- ### Add the MCP server to Claude Code Source: https://github.com/annasusu/opencontextengine/blob/main/README.md Run this command to add the open-context-engine MCP server with user scope. Replace --scope user with --scope project for a shared project configuration. Requires open-context-engine on the client's PATH. ```sh claude mcp add --transport stdio --scope user open-context-engine -- open-context-engine mcp ``` -------------------------------- ### Execute search via npm Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/OPENCONTEXTENGINE_SPEED.md Runs the search command using npm to query the engine for specific code patterns. ```sh npm run --silent search -- 'Find the code handling Django built-in web login: after a user submits a username and password, how is identity verified and a login session established?' ``` -------------------------------- ### search_code(directory_path, query, budget=8000, freshnessWaitMs=30000) Source: https://github.com/annasusu/opencontextengine/blob/main/docs/MCP.md Searches the specified repository's current source and returns file paths, original line numbers, evidence snippets, and the index version. The directory_path must be the project's absolute path in automatic-workspace mode. ```APIDOC ## search_code(directory_path, query, budget=8000, freshnessWaitMs=30000) ### Description Searches the specified repository's current source and returns file paths, original line numbers, evidence snippets, and the index version. ### Parameters - **directory_path** (string) - Required - The absolute path to the repository to search. - **query** (string) - Required - The search query to find relevant code. - **budget** (number) - Optional - The maximum number of results to return. Default is 8000. - **freshnessWaitMs** (number) - Optional - The maximum time in milliseconds to wait for index freshness. Default is 30000. ### Returns File paths, original line numbers, evidence snippets, and the index version. ``` -------------------------------- ### index_status JSON request Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Use this JSON payload with the index_status tool to check coverage for a specific file. Set path to 'src' for a directory or '.' for the workspace. Coverage returns at most 50 entries by default; use limit (1-200) and cursor for pagination. ```json {"directory_path":"/absolute/path/to/your-repository","path":"src/session.py"} ``` -------------------------------- ### Run test suites and smoke tests Source: https://github.com/annasusu/opencontextengine/blob/main/docs/BENCHMARKS.md Commands to run the Node.js tests, Python unit tests, and MCP smoke tests. The Python tests require configured remote models and save separate reports. The automatic workspace smoke test requires the Go toolchain for Python tests involving Go, and OCE_GO_BINARY may specify its path. ```shell npm test .venv/bin/python -m unittest discover -s tests -p '*_test.py' # Requires configured remote models; saves a separate report for each run. node scripts/smoke-mcp.mjs # Automatic workspace routing, project switching, and the same lifecycle checks. node scripts/smoke-mcp.mjs --auto-workspace ``` -------------------------------- ### Claude Code MCP registration command Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Run this command to register the OpenContextEngine MCP server for Claude Code. Use the same absolute paths as in the Codex configuration. Quote paths with spaces and add --env before --transport stdio if env is needed. ```sh claude mcp add --transport stdio --scope user open-context-engine -- /absolute/path/to/node /absolute/path/to/bin/opencontextengine.mjs mcp ``` -------------------------------- ### Configure MCP client connection Source: https://github.com/annasusu/opencontextengine/blob/main/docs/MCP.md Use this configuration in each MCP client to connect to the shared service. The OCE_API_KEY must match the key used by the service. ```json { "command": "open-context-engine", "args": ["mcp", "--connect"], "env": { "OCE_BASE_URL": "http://127.0.0.1:23505", "OCE_API_KEY": "replace-with-at-least-24-random-characters" } } ``` -------------------------------- ### Run evaluation scripts Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/EXPANDED_EVAL.md Commands to execute evaluation scripts for specific modules using Node.js. ```bash node scripts/expanded/ace.mjs click|httpx|zod ``` ```bash node scripts/expanded/opencontextengine.mjs click|httpx|zod ``` -------------------------------- ### POST /search Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/OPENCONTEXTENGINE_SPEED.md Searches the indexed codebase using a natural language query. Returns source context in the response body. Requires Bearer authentication. ```APIDOC ## POST /search ### Description Searches the indexed codebase using a natural language query. Returns source context in the response body. ### Method POST ### Endpoint /search ### Parameters #### Request Body - **query** (string) - Required - The search query. - **budget** (integer) - Optional - Default 4000. The budget for the search. - **trace** (boolean) - Optional - Default false. Whether to enable tracing. ### Request Example { "query": "Find the code handling Django built-in web login", "budget": 4000, "trace": false } ### Response #### Success Response (200) - **body** (string) - Source context. #### Response Example { "sourceContext": "..." } ``` -------------------------------- ### POST /search Source: https://github.com/annasusu/opencontextengine/blob/main/docs/LIVE_INDEX.md Performs a search query with consistency guarantees. It scans the current source, waits for the matching index, and verifies file hashes after retrieval. ```APIDOC ## POST /search ### Description Performs a search query with consistency guarantees. It scans the current source, waits for the matching index, and verifies file hashes after retrieval. ### Method POST ### Endpoint /search ### Parameters #### Query Parameters - **query** (string) - Required - The search query. - **budget** (number) - Required - The budget for the search. - **trace** (boolean) - Required - Whether to include trace information. - **freshnessWaitMs** (integer) - Optional - Time to wait for index freshness. Default is 30000 ms, maximum is 120000 ms. ### Response #### Success Response (200) - **index.identity** (string) - The identity of the index used. - **freshness** (string) - Indicates freshness verification, value: 'verified-after-search'. #### Error Response (503) - **index status** (object) - Explicit index status when source changes during retrieval, update failures, or wait timeouts occur. ``` -------------------------------- ### Perform offline scoring, summarization, and audit Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/EXPANDED_EVAL.md Commands for scoring runs, summarizing multiple run directories, and auditing the results. ```bash node scripts/expanded/score.mjs RUN_DIRECTORY ``` ```bash node scripts/expanded/summarize.mjs SIX_RUN_DIRECTORIES ``` ```bash python3 scripts/expanded/audit.py SIX_RUN_DIRECTORIES ``` -------------------------------- ### Execute ACE Django evaluation Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/DJANGO_PROTOCOL_V1.md Run the ACE Django evaluation after authenticating with the local session. ```sh npm run ace-django ``` -------------------------------- ### index_status(directory_path) Source: https://github.com/annasusu/opencontextengine/blob/main/docs/MCP.md Checks the index readiness, changed-file counts, embedding reuse, and the most recent update error for the specified repository. The directory_path must be the project's absolute path in automatic-workspace mode. ```APIDOC ## index_status(directory_path) ### Description Checks index readiness, changed-file counts, embedding reuse, and the most recent update error for the specified repository. ### Parameters - **directory_path** (string) - Required - The absolute path to the repository to check. ### Returns Index readiness status, changed-file counts, embedding reuse information, and the most recent update error. ``` -------------------------------- ### Establish SSH tunnel for remote access Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/OPENCONTEXTENGINE_SPEED.md Creates an SSH tunnel to connect the local port 45005 to the remote engine port 23505. ```sh ssh -N -L 127.0.0.1:45005:127.0.0.1:23505 -p "$SSH_PORT" operator@evaluation-host.example ``` -------------------------------- ### Configure CLI SSH tunnel overrides Source: https://github.com/annasusu/opencontextengine/blob/main/docs/QUICKSTART.md Environment variables to route embedding and rerank requests through the established SSH tunnel. ```dotenv EMBEDDING_SSH_TUNNEL_URL=http://127.0.0.1:43079/v1 EMBEDDING_SSH_REMOTE=operator@model-host.example:22 RERANK_SSH_TUNNEL_URL=http://127.0.0.1:43078/v1 RERANK_SSH_REMOTE=operator@model-host.example:22 ``` -------------------------------- ### Score Django evaluation results Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/DJANGO_ACE_RESULTS.md Executes the scoring process for the specified Django evaluation run using the v2 answer set. ```sh # The default uses frozen v1 answers in the run directory; select v2 explicitly below. npm run score-django -- runs/ace-django-2026-10-03T09-25-00.710Z answers.v2.json ``` -------------------------------- ### POST /v1/rerank-batch Source: https://github.com/annasusu/opencontextengine/blob/main/docs/RERANKER_API.md Reranks documents for multiple queries in a batch, sharing inference across requested pairs. Requires Bearer authentication. ```APIDOC ## POST /v1/rerank-batch ### Description Reranks documents for multiple queries in a batch, sharing inference across requested pairs. Returns relevance scores for each pair. ### Method POST ### Endpoint /v1/rerank-batch ### Parameters #### Request Body - **model** (string) - Required - The model identifier to use for reranking. - **queries** (array of strings) - Required - The list of queries. - **documents** (array of strings) - Required - The list of documents. - **pairs** (array of objects) - Required - Pairs of query/document indices. - **query_index** (integer) - Required - Index of the query in the queries array. - **document_index** (integer) - Required - Index of the document in the documents array. ### Request Example { "model": "Qwen3-Reranker-4B", "queries": ["query1", "query2"], "documents": ["doc1", "doc2"], "pairs": [ {"query_index": 0, "document_index": 0}, {"query_index": 1, "document_index": 1} ] } ### Response #### Success Response (200) - **results** (array) - List of reranking results. - **index** (integer) - Original pair index. - **query_index** (integer) - Index of the query. - **document_index** (integer) - Index of the document. - **relevance_score** (number) - Relevance score between 0 and 1. #### Response Example { "results": [ {"index": 0, "query_index": 0, "document_index": 0, "relevance_score": 0.95}, {"index": 1, "query_index": 1, "document_index": 1, "relevance_score": 0.80} ] } ``` -------------------------------- ### Score existing Django evaluation results Source: https://github.com/annasusu/opencontextengine/blob/main/docs/eval/DJANGO_PROTOCOL_V1.md Score results from a specific run directory without initiating new network requests. ```sh npm run score-django -- runs/ace-django-TIMESTAMP ``` -------------------------------- ### POST /v1/rerank Source: https://github.com/annasusu/opencontextengine/blob/main/docs/RERANKER_API.md Reranks a list of documents against a single query and returns relevance scores. Requires Bearer authentication. ```APIDOC ## POST /v1/rerank ### Description Reranks a list of documents against a single query and returns relevance scores. ### Method POST ### Endpoint /v1/rerank ### Parameters #### Request Body - **model** (string) - Required - The model identifier to use for reranking. - **query** (string) - Required - The query string to compare documents against. - **documents** (array of strings) - Required - The list of documents to rerank. - **top_n** (integer) - Optional - The number of top results to return. ### Request Example { "model": "Qwen3-Reranker-4B", "query": "example query", "documents": ["doc1", "doc2"], "top_n": 2 } ### Response #### Success Response (200) - **results** (array) - List of reranking results. - **index** (integer) - Original document index. - **relevance_score** (number) - Relevance score between 0 and 1. #### Response Example { "results": [ {"index": 0, "relevance_score": 0.95}, {"index": 1, "relevance_score": 0.80} ] } ```