jeeves-watcher
    Preparing search index...

    API Reference

    The watcher exposes a lightweight HTTP API for search, metadata enrichment, and operational control.

    Default address: http://127.0.0.1:1936 (configurable via api.host and api.port)

    Authentication: none by default. When api.apiKey is set, every route except GET /status and GET /openapi.json requires Authorization: Bearer <key>; see Authentication. The examples below omit the header.

    Endpoint catalog (unreleased): every route below except GET /openapi.json is described once, as an entry of WATCHER_CATALOG in @karmaniverous/jeeves-watcher-core. Its route, request validation, response validation, the OpenAPI document and the plugin tools are all built from it.

    Request validation: every route's body, query string and path parameters are validated against its catalog entry's schemas (the Zod schemas exported by @karmaniverous/jeeves-watcher-core). An invalid request returns jeeves's 400 with code FST_ERR_VALIDATION (v0.22.0+), whose message joins one <slot>/<path> <issue message> per failure with , , for example { "statusCode": 400, "code": "FST_ERR_VALIDATION", "error": "Bad Request", "message": "querystring/path Missing required query parameter: path, querystring/commit Missing required query parameter: commit" } (the slot is body, querystring or params). There is no details field. Unless a section says the schema is strict, unknown keys are dropped silently. Before v0.22.0 this was 400 { code: "invalid_request", error, details }; earlier still, the routes outside the catalog answered with their own error text (quoted in their sections as "before"), and a missing body, which those routes answered with the generic 500, became this 400 in 0.21.0. Checks a schema cannot express (a rule that does not compile, metadata that does not match its rule, a filter Qdrant rejects) answer 400 WATCHER_INVALID_REQUEST, as their sections describe.

    Gated routes (unreleased): the /vcs/* routes need version control. A server built without a VCS coordinator (createApiServer without vcsCoordinator; the service always builds one) answers every /vcs/* request, whatever its method, query or body, with the 404 body of an unregistered route (byte-identical): { "statusCode": 404, "code": "WATCHER_NOT_FOUND", "error": "Not Found", "message": "Route GET:/vcs/show?path=a.md&commit=abc not found" } (the URL as sent, query string included). Nothing is validated first, so not even a malformed body gets a 400.

    Response validation (unreleased): each catalog route's response is checked against its entry's schema before it is sent. A response that doesn't match is never sent: the client gets 500 with code JEEVES_RESPONSE_VALIDATION and the message The server could not complete the request. (v0.22.0+; before, { "error": "Response validation failed", "code": "internal_error" }), and the mismatch is logged as an error with its issues. This indicates a server bug; report it.

    Errors (v0.22.0+): every non-2xx response is Fastify's standard error body { statusCode, code?, error, message }; see Error Handling.

    Source documents (v0.20.0+): besides files, the watcher indexes records retrieved from other systems by callback. See POST /documents, POST /documents/delete and the Source Documents guide.


    Health check and service stats.

    curl http://localhost:1936/status
    
    {
    "name": "watcher",
    "version": "0.20.0",
    "uptime": 86400,
    "status": "healthy",
    "health": {
    "collection": {
    "name": "jeeves_archive",
    "pointCount": 10498,
    "dimensions": 3072,
    "systemIndexes": {
    "chunk_index": "ready",
    "file_path": "ready",
    "matched_rules": "ready"
    }
    },
    "reindex": {
    "active": true,
    "scope": "rules",
    "startedAt": "2026-03-15T02:00:00.000Z",
    "filesProcessed": 1200,
    "totalFiles": 4800
    },
    "initialScan": {
    "active": false,
    "filesMatched": 156576,
    "filesEnqueued": 156576,
    "completedAt": "2026-03-15T01:31:12.000Z",
    "durationMs": 552000
    },
    "vcs": {
    "roots": 2,
    "pending": 0,
    "trippedRoots": 0,
    "oldestTrippedAt": null
    },
    "embedding": {
    "state": "ok",
    "lastSuccessAt": "2026-03-15T02:10:04.000Z",
    "lastError": { "at": "2026-03-15T01:58:30.000Z", "code": "http_503" },
    "failingSince": null,
    "backoffUntil": null
    }
    }
    }
    Field Type Description
    name string Always "watcher".
    version string Service package version.
    uptime number Whole seconds since the API server was created.
    status string "healthy", or "degraded": when the health probe failed (for example Qdrant is unreachable; health then holds only { "error": "..." }), while embeddings are failing, or while a VCS circuit breaker is tripped (v0.21.0+).
    health.collection object Qdrant collection stats: name, pointCount (total points/chunks), dimensions; and (v0.21.0+) systemIndexes, the state of each system payload index by field: building, ready, conflict (another index type exists and is left alone) or failed.
    health.reindex object Reindex progress. active; while active also scope, startedAt, filesProcessed and totalFiles (files plus source documents in the run; both stay 0 during a prune). POST /reindex { scope: "path", source } and POST /documents are not tracked here.
    health.initialScan object? Initial filesystem scan after start (absent when there is no filesystem watcher). Only { "active": false } before the scan starts; then active, filesMatched, filesEnqueued; startedAt while active; completedAt and durationMs once finished.
    health.vcs object? Version control across roots (absent when no root has VCS enabled): roots (VCS-enabled roots), pending (files queued or in flight, not yet committed), trippedRoots (roots whose commit circuit breaker is tripped), oldestTrippedAt (ISO time the longest-tripped breaker tripped, or null). Per-root detail is in GET /vcs/status.
    health.embedding object? Embedding provider health (v0.21.0+): state (ok, or failing after at least 3 failures with 60 s without a success), lastSuccessAt (null before the first), lastError ({ at, code } with code rate_limited, timeout, http_<status>, network or error; null if none), failingSince (null while ok) and backoffUntil (end of a stored provider back-off, at most 5 minutes ahead, or null). Codes only, never provider text. See Embedding Health.
    health.changeSource object Change source and reconciliation (v0.21.0+): source (parcel or chokidar), resubscribes (parcel subscriptions re-created after an error; 0 under chokidar), unavailableRoots (roots currently unreachable), reconcileEvents (synthetic events reconciliation emitted since start: a rising value means the source is missing events), reconcileErrors (reconciles that failed and emitted nothing), lastReconcileAt and lastReconcileDurationMs (null before the first), pendingStability (paths waiting in the shared stability ticker), lastRenewDurationMs (the last Linux parcel subscription renewal; null on Windows and under chokidar) renewFailures (renewals that forced a rebuild of every subscription, plus rejections inside one; 0 on Windows and under chokidar), and lastRestartCause and lastRestartAt (why and when the previous process exited with code 75 for a service-manager restart, Windows parcel only: watch-config-changed, subscription-error or root-gone; null when this process did not start after one). Counts, codes and timestamps only, never paths. See Configuration.
    health.indexCheck object Index check at start (v0.21.0+): state (pending until the start walk completes, running, done, failed when the index could not be listed or the service stopped first; a watcher rebuild that interrupts it also shows failed until it runs again after the rebuilt watcher's initial scan, off when watch.indexCheckOnStart is false), at and durationMs (when it ended and how long it took; null before), checked (indexed file documents compared with the inventory), removed (documents deleted because their file is gone), skippedRoots (roots unavailable, unwatched, gone or whose start walk failed) and capped (roots where more than 10% (once more than 20 are missing) or more than 1,000 of the indexed documents were missing: nothing deleted there). Counts and timestamps only, never paths. See Configuration.

    v0.5.0 change: payloadFields has been removed from the status response. Use GET /config or GET /config/schema to discover schema and payload field information.

    Status codes:

    • 200 OK - always, also when status is "degraded"; check the status field, not the HTTP status.

    The response is cached for api.cacheTtlMs (default 30 seconds), so progress counters can lag by that much.

    GET /status is always open, even when api.apiKey is set, so load balancers and uptime checks can use it.


    Unreleased. The OpenAPI 3.1 document of every catalog route (all routes but this one): request and response schemas, field descriptions, error responses and the bearer security scheme. The description of each /vcs/* operation notes its gated 404.

    curl http://localhost:1936/openapi.json
    

    Like GET /status, it is open even when api.apiKey is set. The same document ships in @karmaniverous/jeeves-watcher-core as WATCHER_OPENAPI_DOCUMENT and as the @karmaniverous/jeeves-watcher-core/openapi.json file; info.version is the watcher-core version.


    POST /metadata

    Enrich a document's metadata without re-embedding. Targets a file (path) or, since v0.20.0, a source document (source).

    curl -X POST http://localhost:1936/metadata \
    -H "Content-Type: application/json" \
    -d '{
    "path": "D:/projects/readme.md",
    "metadata": {
    "title": "Project Overview",
    "labels": ["documentation", "important"],
    "priority": "high"
    }
    }'

    Body schema:

    {
    path?: string; // File path (non-empty)
    source?: string; // Source reference <name>://<id> (v0.20.0+)
    metadata: Record<string, unknown>; // Metadata to merge (required object)
    }
    // Exactly one of path or source is required.

    Schema: metadataRequestSchema in @karmaniverous/jeeves-watcher-core. Neither or both of path / source, a malformed reference, or a missing or non-object metadata is the request-validation 400 FST_ERR_VALIDATION (v0.22.0+; 0.21.0 sent invalid_request, and before that a missing metadata read error: "Missing required field: metadata (object)").

    Success (200 OK):

    {
    "ok": true,
    "matched_rules": ["chat-thread"]
    }

    matched_rules lists the rules the metadata was validated against. For a file these are the config inferenceRules (virtual rules are not consulted) whose match accepts the path alone: they are tested against synthetic attributes built from the path (no file is read, so rules that match on content or JSON fields do not apply). For a source document it is the designated rule.

    Validation error (400 Bad Request): WATCHER_INVALID_REQUEST, with a property-level summary of the failures (<property>: expected <type>, received <type>, joined with ; , capped at 300 characters) in message:

    {
    "statusCode": 400,
    "code": "WATCHER_INVALID_REQUEST",
    "error": "Bad Request",
    "message": "The metadata does not match the matched rules' schemas: priority: expected integer, received string"
    }

    Before v0.22.0 this was { "code": "invalid_request", "error": "Validation failed", "details": [...] } with one { property, expected, received, rule, message } entry per failure.

    v0.5.0: Metadata is validated against the merged schema of the matched rules. Only the declared type of each property is checked; properties the schema does not declare, and null values, are accepted.

    Source not indexed (404, v0.20.0+): WATCHER_SOURCE_NOT_INDEXED, message The source document is not indexed.

    Not available (503, v0.20.0+): WATCHER_NOT_AVAILABLE (Source documents are not available on this instance.) for a source request on an instance without source-document support.

    Document busy (503, v0.21.0+): WATCHER_NOT_AVAILABLE with Retry-After: 10 when the document is being processed (indexed, deleted, moved or updated) and its lock is not free within 10 s. Nothing is changed (the enrichment store included); retry after the delay. message is "The document is being processed; retry after 10 s.".

    Error (500 Internal Server Error): the cause is logged, never returned. Every 5xx the API produces for an unexpected failure is the masked body, with no code (v0.22.0+):

    {
    "statusCode": 500,
    "error": "Internal Server Error",
    "message": "The server could not complete the request."
    }

    Enrichment metadata lives in the enrichment store, a SQLite database at <stateDir>/enrichments.sqlite (default stateDir: .jeeves-metadata), keyed by file path or source reference. Writing to it merges shallowly: new keys are added and existing keys are overwritten.

    Files (path):

    1. Validates the metadata (see above).
    2. Merges it into the file's enrichment-store entry, before checking whether the file is indexed.
    3. Reads the file's chunk-0 point. When the file is indexed, writes the merged enrichment to every chunk with setPayload (no re-embedding): one write filtered on the stored file_path once the file_path system index is ready (v0.21.0+), otherwise by point ID, over the chunks that exist. The stored file_path (casing included) and matched_rules are kept.
    4. When the file is not indexed yet, nothing is written to Qdrant, but the stored enrichment is kept and merged into the payload when the file is indexed (its next filesystem event or a reindex). The response is still 200.

    A failure reading or writing Qdrant does not fail the request: it is logged (a failed payload write also records an upsert_error issue for the file), the response is 200, and the enrichment stays stored.

    Source documents (source):

    • The document must be indexed: its designated rule is read from the stored source_rule. Otherwise the response is 404 WATCHER_SOURCE_NOT_INDEXED and nothing is stored.
    • When Qdrant cannot be read, the response is the masked 500 (v0.20.0+), never 404: a failed read is not taken to mean "not indexed". A failed payload write is also 500.
    • The metadata is validated against the designated rule's schema (400 on failure). The rule is looked up by name among the config rules, then the virtual rules registered by plugins, so a document whose designated rule is virtual is validated too. A designated rule that no longer exists validates nothing (matched_rules: []).
    • Without source support on the instance, a source request is 503 WATCHER_NOT_AVAILABLE.
    • It is stored in the enrichment store under the exact reference, written to every chunk with setPayload (no re-embedding, no callback), and merged again whenever the document is re-processed.

    For both kinds, reserved system fields (file_path, source, source_rule, chunk_*, total_chunks, content_hash, matched_rules, line_start, line_end, created_at, modified_at) are dropped before any payload write, so metadata can never overwrite them. When a document is (re)indexed, its enrichment is merged over the rule metadata: scalars replace the rule value, arrays are unioned without duplicates.


    POST /render

    Render a document through the inference rule engine without embedding. Returns the transformed (or passthrough) content along with metadata. Targets a file (path) or, since v0.20.0, a source document (source).

    v0.8.0+

    curl -X POST http://localhost:1936/render \
    -H "Content-Type: application/json" \
    -d '{"path": "/data/chat/general/1234567.json"}'

    Body schema:

    {
    path?: string; // File path (must be within watched scope)
    source?: string; // Source reference <name>://<id> (v0.20.0+)
    }
    // Exactly one of path or source is required.

    Schema: renderRequestSchema in @karmaniverous/jeeves-watcher-core.

    Success (200 OK):

    {
    "renderAs": "md",
    "content": "---\nchannelName: general\n---\n# Message\nHello world",
    "rules": ["slack-message", "json-subject"],
    "metadata": {
    "domain": "slack",
    "entity_type": "message",
    "matched_rules": ["slack-message", "json-subject"]
    }
    }
    Field Type Description
    renderAs string Output content type (file extension without dot). Always present.
    content string Rendered content (from template/render transform) or extracted text (passthrough).
    rules string[] Names of matched inference rules (diagnostic).
    metadata object Composed embedding properties from matched rules, with the document's stored enrichment merged in and matched_rules added.
    • Transformed responses (template or render ran): cached with the configured TTL (api.cacheTtlMs).
    • Passthrough responses (no transform): Cache-Control: no-cache header set; bypasses the cache.
    • Source documents (source): never cached (no cache read, no cache write) and always sent with Cache-Control: no-cache, because the record behind the callback can change at any time.
    • Errors carry no Cache-Control header (v0.22.0+).
    Code Condition
    200 Success
    400 FST_ERR_VALIDATION: invalid body (neither or both of path / source, empty path, malformed reference)
    403 WATCHER_PATH_NOT_WATCHED (The path is outside the watched scope or is gitignored.): the path does not match watch.paths or matches watch.ignored
    404 WATCHER_NOT_FOUND (The file or directory does not exist.); or WATCHER_SOURCE_NOT_INDEXED (The source document is not indexed.: no stored point, so no designated rule is known); or WATCHER_SOURCE_NOT_FOUND (The source reports that the document does not exist.: the callback answered 404; points are left alone)
    422 WATCHER_PIPELINE_<TYPE>_ERROR: rendering or extraction failed at the stage the issue code names: for a file WATCHER_PIPELINE_EXTRACTION_ERROR (The document could not be extracted.); for a source document WATCHER_PIPELINE_RULE_MISSING_ERROR, WATCHER_PIPELINE_MATCH_FAILED_ERROR, WATCHER_PIPELINE_NO_CONTENT_ERROR, WATCHER_PIPELINE_INTERPOLATION_ERROR, or WATCHER_PIPELINE_EXTRACTION_ERROR for an untagged failure. The failure's own message and details (AJV errors, say) go to the service log only. WATCHER_UNSUPPORTED_CONTENT_TYPE (The source returned a body that is not a JSON object.) when the callback returned a non-JSON body
    502 WATCHER_SOURCE_UNAVAILABLE (The source could not be reached or answered with an error.): the source callback failed; its status and error are logged
    503 WATCHER_NOT_AVAILABLE (Source documents are not available on this instance.): source render on an instance without source-document support
    500 Masked (no code): unexpected failure, including a Qdrant read failure while looking up a source document's designated rule (the cause is only logged)

    Before v0.22.0 every 422 was pipeline_error with the failure message as error, the issue code as issueType and any AJV errors in details; no message names the path, the callback or the library error any more.

    1. Validates the path against watch.paths and watch.ignored globs
    2. Runs the file through buildMergedMetadata (same pipeline as indexing)
    3. Resolves renderAs: rule-declared value → file extension → "txt"
    4. Returns rendered or extracted content with matched rules and metadata

    For a source document, the watcher reads the designated rule from the stored source_rule, retrieves the record through its callback, applies that rule and returns the result. renderAs is "md" when the rule has a template or render, otherwise "json". Nothing is embedded or written, and failures are returned, never recorded as issues.

    Use cases:

    • Server-side document rendering (jeeves-server consumes this for its document viewer)
    • Content preview without embedding
    • Debugging: see what a file looks like after template/render transforms

    Returns schema-derived facet definitions for building search filter UIs. The Facets guide covers the whole path: declaring facet fields, the uiHint table, indexes, counts and filters.

    v0.8.0+ (rules v0.21.0+)

    curl http://localhost:1936/search/facets
    curl 'http://localhost:1936/search/facets?rules=jira-issue,slack-message'
    Query Type Description
    rules string? Comma-separated rule names, configured or registered at runtime (v0.21.0+). Only the fields those rules declare are listed, with only the values recorded for their documents, and rules on each facet names only those rules. An unknown name answers 400 WATCHER_INVALID_REQUEST (message: "Unknown rule(s): <names>"); a value naming no rule (?rules=) answers 400 WATCHER_INVALID_REQUEST (rules must name at least one rule). Without it, the answer is the same as before 0.21.0: every configured rule.

    Success (200 OK):

    {
    "facets": [
    {
    "field": "domain",
    "type": "string",
    "uiHint": "dropdown",
    "values": ["email", "jira", "meetings", "slack"],
    "rules": [
    "email-archive",
    "jira-issue",
    "meetings-transcript",
    "slack-message"
    ]
    },
    {
    "field": "priority",
    "type": "string",
    "uiHint": "dropdown",
    "values": ["Critical", "High", "Medium", "Low"],
    "rules": ["jira-issue"]
    }
    ]
    }
    Field Type Description
    facets Facet[] Array of facet definitions.

    Facet:

    Field Type Description
    field string Metadata field name.
    type string JSON Schema type (e.g. "string", "number", "boolean").
    uiHint string UI rendering hint (e.g. "dropdown", "tags", "date"; all hints in the Facets guide); "dropdown" when only enum is declared.
    values unknown[] Known values: the enum values if declared; otherwise, for the enumerated hints dropdown, tags, select and multiselect, the sorted live values from the values index; otherwise [].
    rules string[] Which inference rules define this field.
    1. Resolves the schemas of the config inferenceRules via mergeSchemas (virtual rules registered by plugins are included only when rules names them)
    2. Extracts properties that declare uiHint or enum (object properties never become facets; a property without type is reported as "string")
    3. Deduplicates fields across rules (later rules override uiHint and enum)
    4. Enriches with live distinct values from the values index
    5. Schema structure is cached internally; rebuilt when rules change

    If the rule schemas cannot be resolved, the error is logged and the response is { "facets": [] }.

    Caching: The schema structure is computed once and cached until inference rules change. Live values from ValuesManager are merged fresh on each request.

    Use cases:

    • Building dynamic search filter UIs
    • LLM agent orientation: discover filterable fields before constructing search queries

    For how many documents hold each value under a filter, use POST /search/facets/counts.


    POST /search/facets/counts

    Counts the values of payload fields over the documents matching a filter, or gives { min, max } for a numeric or date field (see the Facets guide for building a filter UI on it, dates and several tenants). Each document counts once, however many chunks it has. Counts are approximate: they come from Qdrant's default (approximate) facet counts, so treat them as sizes for a UI, not as exact totals (for an exact count of one value use POST /scan with countOnly, adding { "key": "chunk_index", "match": { "value": 0 } } to the filter so it counts documents rather than chunks, plus the rule scope if you used rules). Ranges are exact.

    v0.21.0+

    curl -X POST http://localhost:1936/search/facets/counts \
    -H "Content-Type: application/json" \
    -d '{
    "filter": { "must": [{ "key": "silo", "match": { "value": "acme" } }] },
    "rules": ["jira-issue", "slack-message"],
    "fields": ["status", "priority", "created"],
    "limit": 20
    }'
    Field Type Required Description
    fields string[] Yes 1 to 20 payload fields. Each needs a payload index: keyword, integer or bool for value counts; integer, float or datetime for a range. A field named twice is counted once.
    filter object? No Qdrant filter scoping the counts, as for POST /search (for example a tenant condition).
    rules string[]? No Rule names, configured or registered at runtime: only documents that matched at least one of them are counted (a file document by its matched_rules, a source document by its source_rule), each once. An unknown name answers 400 WATCHER_INVALID_REQUEST.
    limit number? No Most values per counted field, highest counts first (default 100, max 1000).

    Unknown body keys are rejected with 400.

    Success (200 OK):

    {
    "counts": {
    "status": [
    { "value": "Open", "count": 412 },
    { "value": "Done", "count": 380 }
    ],
    "priority": [{ "value": "High", "count": 97 }],
    "created": { "min": "2025-01-03T09:12:00Z", "max": "2026-11-04T17:40:00Z" }
    }
    }
    Field Type Description
    counts object Per requested field: an array of { value, count } (documents holding the value, highest first; counts are approximate, see below), or { min, max } for a range. A range bound is a number or the stored date string; both are null when no matching document holds the field. An array value counts once per element; its range uses its smallest and largest elements.

    Each field is answered by its uiHint when every rule in scope that declares it gives the same hint (an enum without a hint counts as dropdown): number, date and range give { min, max }, any other hint gives value counts. When no rule declares it, a declaring rule gives no hint, or the hints disagree, the payload index type decides: keyword, bool and integer are counted, float and datetime give a range. The rules in scope are those named in rules, else every configured and registered rule.

    Status code When
    400 FST_ERR_VALIDATION The body is invalid.
    400 WATCHER_INVALID_REQUEST A rule is unknown (Unknown rule(s): <names>) or rules is empty (rules must name at least one rule); a field has no usable payload index (No usable payload index for field(s): <names>; see vectorStore.payloadIndexes); or Qdrant rejects the filter (The vector store rejected the filter: <Qdrant's reason>).
    503 WATCHER_NOT_AVAILABLE The chunk_index system index is not ready yet (Facet counts need the chunk_index system index, which is not ready yet; retry shortly.); with rules, the same for matched_rules. Both are built in the background after the first 0.21.0 start (see system indexes). The index state is logged.
    503 WATCHER_NOT_AVAILABLE The counts did not finish within the 10 s budget (Facet counts exceeded the time budget; not counted: <fields>. Count fewer fields or narrow the filter.).

    Before v0.22.0 these were invalid_request and not_available with details (unknownRules, fields, { index, state }, pending); the names they held are now in message, capped at 300 characters.

    1. Checks the rule names, then that the system indexes it needs are ready, then reads the collection's payload index types and decides each field's mode.
    2. Counts on chunk-0 points only, so a document counts once: the filter is { must: [<your filter>, <rule scope>, chunk_index = 0] }. Your filter is nested, never merged, so its top-level should keeps its meaning.
    3. Counts at most 4 fields at a time with Qdrant's approximate facet counts (its default mode; exact counts were too slow at production size, D194); a range is two one-point scrolls ordered by the field. Every Qdrant call is given the seconds left in the 10 s budget as its timeout; once the budget is spent no field starts and in-flight results are discarded.
    4. Answers from Qdrant on every request: there is no response cache.
    5. A request taking over 500 ms is logged at info with its field count, whether a filter or rules were given, and its duration (never values).

    Exposure: counts reveal the values of any indexed field under the caller's filter. Callers holding the API key can already read payloads with POST /scan; put tenant isolation in the filter the calling application sends.


    POST /search

    Semantic search across indexed documents.

    curl -X POST http://localhost:1936/search \
    -H "Content-Type: application/json" \
    -d '{
    "query": "machine learning algorithms",
    "limit": 10
    }'

    Body schema:

    {
    query: string; // Natural language search query (non-empty)
    limit?: number; // Max results, positive integer (default: 10)
    offset?: number; // Skip N results for pagination, integer >= 0 (default: 0)
    filter?: Record<string, unknown>; // Qdrant filter object (optional)
    }

    Schema: searchRequestSchema in @karmaniverous/jeeves-watcher-core; the default limit is SEARCH_DEFAULT_LIMIT (10). The schema is strict (v0.20.0+): an unknown key such as collapse is a 400 FST_ERR_VALIDATION (body/ Unrecognized key: "collapse") instead of being silently ignored.

    Filtered search example:

    curl -X POST http://localhost:1936/search \
    -H "Content-Type: application/json" \
    -d '{
    "query": "authentication flow",
    "limit": 5,
    "filter": {
    "must": [{ "key": "domain", "match": { "value": "backend" } }]
    }
    }'

    Paginated search example:

    curl -X POST http://localhost:1936/search \
    -H "Content-Type: application/json" \
    -d '{
    "query": "authentication flow",
    "limit": 10,
    "offset": 20
    }'

    The filter parameter accepts a native Qdrant filter object. A filter Qdrant rejects (malformed condition, unknown match variant) is a 400 WATCHER_INVALID_REQUEST with Qdrant's reason in message (The vector store rejected the filter: <reason>, capped at 300 characters; v0.22.0+, before which it was invalid_request with error: "Invalid filter"). Use GET /config or GET /config/schema to discover available payload fields and their types, then construct filters accordingly. Common patterns:

    • Exact match: { "must": [{ "key": "domain", "match": { "value": "email" } }] }
    • Negation: { "must_not": [{ "key": "domain", "match": { "value": "codebase" } }] }
    • Multi-field: Combine conditions in the must array
    • Full-text: { "key": "chunk_text", "match": { "text": "keyword" } } (tokenized)

    Success (200 OK):

    [
    {
    "id": "uuid-chunk-0",
    "score": 0.87,
    "payload": {
    "file_path": "d:/projects/ml/readme.md",
    "chunk_index": 0,
    "total_chunks": 3,
    "content_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
    "chunk_text": "Machine learning is...",
    "domain": "projects",
    "title": "ML Overview"
    }
    },
    {
    "id": "uuid-chunk-1",
    "score": 0.82,
    "payload": {
    "file_path": "d:/projects/ml/readme.md",
    "chunk_index": 1,
    "total_chunks": 3
    }
    }
    ]

    Embedding unavailable (503 Service Unavailable, v0.20.0+):

    {
    "statusCode": 503,
    "code": "WATCHER_EMBEDDING_UNAVAILABLE",
    "error": "Service Unavailable",
    "message": "The embedding provider is unavailable; retry later."
    }

    Returned when the query cannot be embedded within the search budget (3 provider attempts, at most 10 seconds waiting on the shared rate limiter), or at once when the provider has asked for a pause longer than max(root maxBackoffMs, 65 seconds). A Retry-After header (seconds) is set when the limiter knows when it will accept requests again. The provider's error is logged, never sent. See Rate Limiting.

    Invalid filter (400 Bad Request, v0.20.0+):

    {
    "statusCode": 400,
    "code": "WATCHER_INVALID_REQUEST",
    "error": "Bad Request",
    "message": "The vector store rejected the filter: Wrong filter"
    }

    Error (500 Internal Server Error): the masked body (no code), see Error Handling.

    Each result is a Qdrant point:

    Field Type Description
    id string Qdrant point ID (deterministic UUID from file path or source reference + chunk index).
    score number Cosine similarity score (higher is better), or the fused rank score when search.hybrid.enabled is set.
    payload object Document metadata and chunk info.

    Payload fields:

    Field Type Description
    file_path string Normalized file path (forward slashes). File points only.
    source string Source reference <name>://<id>. Source points only (v0.20.0+).
    source_rule string Designated rule of a source document. Source points only (v0.20.0+).
    chunk_index number Chunk index (0-based).
    total_chunks number Total chunks for this document.
    content_hash string SHA-256 hex digest of the document text that was chunked and embedded (extracted or rendered).
    chunk_text string Text content of this chunk.
    matched_rules string[] Names of the rules applied to the document.
    line_start, line_end number 1-based lines of the document text where the chunk starts and ends.
    created_at, modified_at number Document timestamps (Unix seconds).
    Custom fields any Metadata from inference rules and POST /metadata.
    1. Embeds the query text using the configured embedding provider
    2. Searches Qdrant using cosine similarity; with search.hybrid.enabled, fuses the vector results with full-text matches on chunk_text (reciprocal rank fusion, text weighted by search.hybrid.textWeight, default 0.3)
    3. Returns top limit results (includes all chunks; caller groups by file_path or source if needed)

    The query embedding draws from the same rate limiter as indexing.


    POST /scan

    Filter-only point query without vector search. Returns metadata for points matching a Qdrant filter with cursor-based pagination.

    curl -X POST http://localhost:1936/scan \
    -H "Content-Type: application/json" \
    -d '{
    "filter": {
    "must": [{ "key": "domain", "match": { "value": "email" } }]
    },
    "limit": 50
    }'

    Body schema:

    {
    filter: Record<string, unknown>; // Qdrant filter object (required)
    limit?: number; // Page size, integer 1-1000 (default: 100)
    cursor?: string | number; // Opaque cursor from previous response
    fields?: string[]; // Payload field projection
    countOnly?: boolean; // If true, return { count } instead of points
    }

    Schema: scanRequestSchema in @karmaniverous/jeeves-watcher-core; the default page size is SCAN_DEFAULT_LIMIT (100) and the maximum SCAN_MAX_LIMIT (1000).

    Success (200 OK) — normal scan:

    {
    "points": [
    {
    "id": "uuid-chunk-0",
    "payload": { "file_path": "/data/email/msg.json", "domain": "email" }
    },
    {
    "id": "uuid-chunk-1",
    "payload": {
    "file_path": "/data/email/msg2.json",
    "domain": "email"
    }
    }
    ],
    "cursor": "5f0c3e2a-8b1d-5c4e-9a7f-2d6b8e1c0a93"
    }

    Success (200 OK) — count only:

    {
    "count": 4217
    }

    Last page (no more results):

    {
    "points": [],
    "cursor": null
    }
    Field Type Description
    points ScrolledPoint[] Matched points with payload.
    cursor string | number | null Opaque cursor for next page. null when no more results.
    count number Total matching points (only when countOnly: true).
    Code Condition
    200 Success
    400 FST_ERR_VALIDATION: missing or non-object filter, a limit outside 1 to 1000 (body/limit limit must be between 1 and 1000) or not an integer (limit must be an integer). WATCHER_INVALID_REQUEST: a filter Qdrant rejects (The vector store rejected the filter: <Qdrant's reason>)
    500 Masked (no code): unexpected failure
    1. Validates the body (filter must be an object; limit out of range is rejected, never clamped)
    2. If countOnly: calls Qdrant count() with exact mode and returns { count }
    3. Otherwise: calls Qdrant scroll() with the filter, limit, cursor, and optional field projection
    4. Returns matched points and an opaque cursor for the next page

    Use cases:

    • File enumeration (list all points in a domain)
    • Staleness checks (count points matching a filter)
    • Delta computation (scan for points with specific metadata)
    • Structural queries that don't need semantic similarity

    Difference from POST /search:

    • /scan does NOT embed a query or compute similarity scores
    • /scan uses cursor-based pagination (efficient for large result sets)
    • /search uses offset-based pagination (suitable for small ranked result sets)

    POST /walk

    List watched files whose paths match globs, from the filesystem watcher's inventory (no filesystem reads, no Qdrant). The inventory holds only files that pass the watcher's filters: never directories, glob-rejected, watch.ignored or gitignored files (v0.21.0+; 0.20.0 listed chokidar's own entries).

    curl -X POST http://localhost:1936/walk \
    -H "Content-Type: application/json" \
    -d '{"globs": ["/data/email/**/*.json"]}'

    Body schema:

    {
    globs: string[]; // Non-empty array of glob patterns
    }

    Success (200 OK):

    {
    "paths": ["/data/email/archive/msg-456.json"],
    "matchedCount": 1,
    "scannedRoots": ["/data/domains"]
    }
    Field Type Description
    paths string[] Inventory files matching any of the globs, sorted by path.
    matchedCount number Length of paths.
    scannedRoots string[] Resolved base directories of the configured watch.paths.

    Globs are matched against slash-normalised paths, case-insensitively, dotfiles included. paths and scannedRoots are returned in the platform's native form (backslashes on Windows).

    Code Condition
    400 FST_ERR_VALIDATION: globs is missing, not an array, empty, or has a non-string entry (0.21.0: invalid_request; before, error: "Missing globs" without details, and the entries' types were not checked)
    503 WATCHER_NOT_AVAILABLE (The filesystem watcher is not initialized.): the instance has no filesystem watcher; WATCHER_SCAN_IN_PROGRESS (The initial filesystem scan is still running; retry when it finishes.): retry later
    500 Masked (no code): unexpected failure (before 0.21.0, also a request without a JSON body)

    POST /rebuild-metadata

    Rebuild the enrichment store from Qdrant file point payloads: each file's entry is chunk 0's payload minus the reserved system fields. Each entry is written under the file's document lock, waiting as long as a run of that file takes, from chunk 0 read inside the lock, so a concurrent POST /metadata is never overwritten.

    curl -X POST http://localhost:1936/rebuild-metadata
    

    Success (200 OK):

    {
    "ok": true
    }

    Error (500 Internal Server Error): the masked body (no code), see Error Handling.

    No request body is needed.

    1. Scrolls all Qdrant points in the collection
    2. Skips every point without a non-empty file_path: source documents are never touched
    3. For each file point, drops every reserved system field (isReservedPayloadField in @karmaniverous/jeeves-watcher-core: file_path, source, source_rule, chunk_index, chunk_text, total_chunks, content_hash, matched_rules, line_start, line_end, created_at, modified_at) and merges the remaining payload fields into the file's entry in the enrichment store (<stateDir>/enrichments.sqlite)

    Qdrant payloads do not distinguish enrichment from rule metadata, so every remaining field, rule-inferred ones included, becomes stored enrichment for the file.

    Use cases:

    • Enrichment store corruption or accidental deletion
    • Migrating to a new machine (copy Qdrant snapshot, rebuild the enrichment store)
    • First-time setup from an existing Qdrant collection

    Cost: No embedding API calls — pure data extraction.


    POST /reindex

    Trigger a scoped reindex operation. Non-prune scopes include a plan object showing blast area. Live prune (non-dry-run) returns immediately without a plan.

    Body schema:

    {
    scope?: "issues" | "full" | "rules" | "path" | "prune"; // Default: "issues"
    path?: string | string[]; // Scope "path": files or directories; scope "rules": globs
    source?: string | string[]; // Source references for scope "path" (v0.20.0+), at most 1000
    dryRun?: boolean; // Compute plan without executing (default: false)
    }
    // Scope "path" requires exactly one of path or source; source is only valid with scope "path".

    Schema: reindexRequestSchema in @karmaniverous/jeeves-watcher-core. Paths must be non-empty strings and an array must not be empty. source accepts at most 1000 references per request (MAX_REINDEX_SOURCES_PER_REQUEST); split larger sets into several requests. path is ignored by the scopes issues, full and prune.

    Examples:

    # Rules-only reindex (re-apply inference rules, no re-embedding)
    curl -X POST http://localhost:1936/reindex \
    -H "Content-Type: application/json" \
    -d '{"scope": "rules"}'

    # Full reindex (re-process every watched file; re-embed every source document)
    curl -X POST http://localhost:1936/reindex \
    -H "Content-Type: application/json" \
    -d '{"scope": "full"}'

    # Re-process only documents with issues
    curl -X POST http://localhost:1936/reindex \
    -H "Content-Type: application/json" \
    -d '{"scope": "issues"}'

    # Re-process a specific directory
    curl -X POST http://localhost:1936/reindex \
    -H "Content-Type: application/json" \
    -d '{"scope": "path", "path": "/data/projects/example-app"}'

    # Re-process specific source documents (v0.20.0+)
    curl -X POST http://localhost:1936/reindex \
    -H "Content-Type: application/json" \
    -d '{"scope": "path", "source": ["app://chat/thread/6710c3a9"]}'

    # Delete orphaned points (files no longer in watch scope)
    curl -X POST http://localhost:1936/reindex \
    -H "Content-Type: application/json" \
    -d '{"scope": "prune"}'

    # Dry run: preview blast area without executing
    curl -X POST http://localhost:1936/reindex \
    -H "Content-Type: application/json" \
    -d '{"scope": "prune", "dryRun": true}'

    Success (200 OK) — normal execution:

    {
    "status": "started",
    "scope": "rules",
    "plan": {
    "total": 148000,
    "toProcess": 148000,
    "toDelete": 0,
    "byRoot": {
    "/data": 95000,
    "/srv/config": 3000
    }
    }
    }

    Success (200 OK) — live prune (no plan):

    {
    "status": "started",
    "scope": "prune"
    }

    Success (200 OK) — dry run:

    {
    "status": "dry_run",
    "scope": "prune",
    "plan": {
    "total": 562000,
    "toProcess": 0,
    "toDelete": 2300,
    "byRoot": {
    "/srv/app/node_modules": 1800,
    "/srv/app/.cache": 500
    }
    }
    }

    Plan fields:

    Field Type Description
    total number Total points (prune) or files and source documents (other scopes) examined.
    toProcess number Items to embed/re-apply rules (0 for prune).
    toDelete number Points to delete (prune only, 0 for others).
    byRoot object Files to process grouped by watch root prefix, plus source documents to process grouped by source name. For a prune: orphaned files (not points) grouped by watch root. Files outside every root count under "(unmatched)". Root containment is separator-aware (/docs does not contain /docs2).
    incomplete boolean? Prune only: true when the Qdrant scroll failed part-way (after 5 attempts per page), so the counts are partial. A live prune with an incomplete plan deletes nothing.

    The reindex runs asynchronously: the API returns immediately with the plan. Use GET /status to track progress.

    The plan is computed once per request, before the response: the files listed and the source documents discovered for it are the ones the run then processes (no second listing or Qdrant scroll). An invalid path target is therefore an HTTP error (see below), and so is a failure while planning (for example Qdrant unreachable during source discovery: the masked 500). Once the run has started, failures are logged and reported to the completion callback, never as an HTTP error.

    Error codes:

    Code Condition
    200 Success (started or dry_run)
    400 FST_ERR_VALIDATION: invalid body (unknown scope, missing path/source for scope path, both given, source outside scope path, empty path or array, malformed reference, more than 1000 references). WATCHER_INVALID_REQUEST: a scope-path target that is neither a file nor a directory (The path is neither a file nor a directory.)
    403 WATCHER_PATH_NOT_WATCHED (The path is outside the watched scope or is gitignored.): a scope-path target is outside the watch scope or gitignored (v0.20.0+; was 500)
    404 WATCHER_NOT_FOUND (The file or directory does not exist.): a scope-path target does not exist (v0.20.0+; was 500)
    503 WATCHER_NOT_AVAILABLE: source on an instance without source-document support (Source documents are not available on this instance., v0.20.0+); a prune without a vector store (Prune needs a vector store, and none is configured.; v0.22.0+, was 400 not_available)
    500 Masked (no code): unexpected failure, including a planning failure

    No message names the target path (v0.22.0+; before, Path not found: <path> and the like).

    Re-processes documents with open issues (from GET /issues): files, and source references. An indexed source document is re-processed with its stored designated rule; a reference that was never indexed (its first notification failed, so it has no points) is retried with the rule recorded on its issue. A reference with neither is counted in total but skipped. A reference whose stored rule cannot be looked up (a Qdrant read error, or a processor without source support) does not fail the run: it is counted in total, not processed, and reported as failed (callback errors and sources.failed). Use after fixing the root cause of failures (permissions, encoding, file format, a source outage).

    Re-reads file attributes, re-applies current inference rules, updates Qdrant payloads of indexed files (changed values are written, keys the rules no longer project are removed; files that are not indexed are skipped). No re-embedding for files. Use after editing inference rules.

    With path, the entries are globs matched (case-insensitively) against the watched files, and only matching files are covered. Without path, every watched file is covered and so are the source documents: each is retrieved through its callback and its stored rule re-applied. Unchanged content gets a metadata-only setPayload; if the rule now renders different text, the document is re-embedded.

    Re-processes every watched file through the full pipeline (extract, apply rules, render) and clears the values index first. A file is re-embedded and re-upserted only when its rendered text changed: a file whose text hashes to the content_hash stored on its chunk 0 is skipped without an embedding call and its payload is not rewritten. Source documents are retrieved through their callbacks and always re-embedded (forced). Use after adding watch paths or changing rules that alter rendered text. Unchanged files are not re-embedded after an embedding provider or chunk size change; delete their points (for example with POST /points/delete) or re-create the collection first.

    With path: re-processes a specific file or all watched files under a directory (globs are not expanded here), with the same unchanged-content skip as full. Each target must match watch.paths and not watch.ignored (a directory target must itself match, e.g. with a /** watch glob) and must not be gitignored (403 WATCHER_PATH_NOT_WATCHED); it must exist (404 WATCHER_NOT_FOUND). Directory containment is separator-aware: /docs covers /docs/a.md, never /docs2/a.md. A file named directly and found again by expanding its directory is processed once. Use for targeted re-embedding without a full reindex.

    With source (v0.20.0+): looks up each distinct reference's stored designated rule (up to reindex.concurrency lookups in flight, default 50) and enqueues the indexed ones on the notify queue, exactly as POST /documents does: they coalesce with concurrent notifications and failures land in GET /issues. References that are not indexed are skipped: they count in total but not in toProcess. This form is not a tracked run: GET /status does not show it and no completion callback is sent. plan.byRoot counts the enqueued references by source name.

    Lists the watched files, scrolls all Qdrant points, and batch-deletes orphaned file points: those whose file_path is not a watched file (outside the watch scope, ignored or gitignored), whose file no longer exists on disk, or that have no file_path at all. No re-embedding, no file content reads: a file listing, a Qdrant scroll, existence checks and deletes. Use after changing watch.paths, adding gitignore rules, or to clean up stale data (e.g., indexed node_modules).

    Prune never selects source points (a non-empty source and no file_path): source documents are removed only by a callback 404 or POST /documents/delete. A legacy file point that carries a rule-written source field is still a file point and is pruned like any other. The file and notify queues are paused (and in-flight work drained) while a prune plans and runs.

    Note: prune is NOT valid for the config-watch auto-trigger (configWatch.reindex). It can only be triggered via explicit API calls.

    Explicit POST /reindex requests cover source documents as described above; a reindex triggered by a config change (configWatch.reindex, POST /config/apply) or by rule registration covers files only. Source documents are discovered from Qdrant (chunk-0 source points: a non-empty source and no file_path), retrieved through their callbacks, and processed with their stored source_rule; one without a stored source_rule counts in total but is skipped. Up to reindex.concurrency (default 50) documents are submitted at once; the notify queue's own concurrency still applies. In every scope a callback 404 deletes the document and any other failure records an issue and leaves its points untouched.

    Every source run goes through the notify queue, like a notification: a reindex and a notification of the same reference never run in parallel, they coalesce (a pending full run stays forced if a notification merges into it), and the latest record wins. See the Source Documents guide.

    When dryRun: true, the plan is computed and returned synchronously without starting the async job. Works for all scopes. Use to preview impact before committing to a large operation.

    While a reindex is running, GET /status shows the active reindex state under health:

    {
    "health": {
    "reindex": {
    "active": true,
    "scope": "rules",
    "startedAt": "2026-02-24T08:00:00Z",
    "filesProcessed": 1200,
    "totalFiles": 4800
    }
    }
    }

    If reindex.callbackUrl is configured, the watcher sends a POST request (JSON body) to that URL when a tracked reindex completes (every run except POST /reindex { scope: "path", source }, which only enqueues):

    {
    "scope": "rules",
    "filesProcessed": 1234,
    "durationMs": 45000,
    "errors": [],
    "sources": { "indexed": 12, "unchanged": 300, "deleted": 1, "failed": 2 }
    }
    Field Description
    scope The run's scope.
    filesProcessed Files whose processing completed (0 for a prune or a failed run).
    durationMs Run duration.
    errors The failed file paths, then the failed source references. A failure inside the pipeline (extraction, embedding, upsert) is recorded as an issue and does not count here; only a file whose processing threw is listed. When the run fails as a whole (including a live prune whose planning fails), errors holds the failure message and filesProcessed is 0.
    sources v0.20.0+, only when the run covered source documents: counts by outcome (indexed, unchanged, deleted, failed). Failed documents are also recorded in GET /issues.
    pointsDeleted Prune only: points deleted.

    A failing file or source document never stops the run: it is logged and collected, and the rest still run. A live prune whose plan is incomplete is aborted without deleting anything and sends no callback.

    Delivery is attempted up to 3 times, with exponential backoff (1 second, then 2 seconds); a non-2xx response counts as a failure. When every attempt fails the failure is logged (Reindex callback delivery failed; giving up) and the run's result is unaffected: callback delivery never throws, and a reindex started fire-and-forget never rejects.


    POST /documents

    Notify the watcher that source documents changed. v0.20.0+

    The watcher validates each notification, queues it, and later retrieves the current record through the source's configured callback, renders it with the designated rule, and indexes it. See the Source Documents guide for the model, configuration and callback contract.

    curl -X POST http://localhost:1936/documents \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $WATCHER_API_KEY" \
    -d '{
    "documents": [
    { "source": "app://chat/thread/6710c3a9", "rule": "chat-thread" }
    ]
    }'

    Body schema:

    {
    documents: Array<{
    source: string; // Source reference <name>://<id>; <name> must be configured in `sources`
    rule: string; // Designated rule name
    }>; // 1 to 100 entries
    }

    Query string: ?wait=true processes synchronously (also accepts 1; false/0 or omitted = asynchronous).

    Schema: documentsEnvelopeSchema (the request shape of documentsRequestSchema with source validated per document) and documentsQuerySchema in @karmaniverous/jeeves-watcher-core; at most MAX_DOCUMENTS_PER_REQUEST (100) documents. Notify only: there is no push form. Document entries are strict: unknown keys (for example inline text) fail the request with 400. A malformed reference rejects only its own document (invalid_reference).

    Accepted (202), the default:

    {
    "accepted": ["app://chat/thread/6710c3a9"],
    "rejected": [
    {
    "source": "zz://chat/thread/1",
    "error": {
    "code": "unknown_source",
    "message": "Source \"zz\" is not configured"
    }
    }
    ]
    }

    Validation is synchronous and per document; accepted references are queued. A rejected document does not fail the others.

    Rejection code Meaning
    invalid_reference source is not <name>://<id>.
    unknown_source <name> is not configured in sources (or no sources are configured). No request is made.
    invalid_id The id has an empty, . or .. segment, or would produce a URL outside the configured origin.
    rule_missing No rule of that name exists in the current rule set.
    queue_stopped The service is shutting down; notify again later.

    Processing failures after acceptance are not in the response: they are recorded under the reference in GET /issues.

    Synchronous (200) with ?wait=true:

    {
    "results": [
    {
    "source": "app://chat/thread/6710c3a9",
    "status": "indexed",
    "chunks": 2,
    "matched_rules": ["chat-thread"]
    },
    {
    "source": "app://chat/thread/6710c3b0",
    "status": "unchanged",
    "matched_rules": ["chat-thread"]
    },
    { "source": "app://chat/thread/0000", "status": "deleted" },
    {
    "source": "app://chat/thread/6710c3b1",
    "status": "failed",
    "error": {
    "code": "match_failed",
    "message": "Document does not match rule \"chat-thread\": ...",
    "details": []
    }
    }
    ]
    }

    One result per submitted document, in submission order:

    status Meaning
    indexed Written: content re-embedded, or (same content, changed metadata) payloads updated without an embedding call. chunks is the chunk count.
    unchanged Same rendered content and metadata; nothing written, no embedding call.
    deleted The callback answered 404; the document's points were removed.
    failed error.code is a rejection code above or an issue code; existing points are untouched. details holds AJV errors for match_failed and the per-rule errors for interpolation_error.

    A designated rule whose match rejects the record is never an HTTP error: asynchronously it becomes a match_failed issue, with ?wait=true a failed result.

    Errors:

    Code Condition
    400 FST_ERR_VALIDATION: documents missing, empty or over 100 entries; missing or empty source/rule; unknown keys in a document; invalid wait (the query and body are validated before source support is checked)
    401 WATCHER_UNAUTHORIZED: api.apiKey is set and the bearer token is missing or wrong
    503 WATCHER_NOT_AVAILABLE (Source documents are not available on this instance.): the instance's document processor does not support source documents
    500 Masked (no code): unexpected failure, including an unexpected processing error with ?wait=true (a stopping queue is reported per document as queue_stopped instead)
    • Notifications are queued in memory, keyed by reference. A notification for a pending reference merges with it; one for an in-flight reference triggers exactly one more run after the current one. Every run retrieves the current record, so the latest state always wins. See coalescing.
    • ?wait=true uses the same queue (concurrency and coalescing apply) and waits for the results. Use it for backfills and tests.
    • Up to embedding.concurrency references are processed at once (default 5).
    • The error.code values are typed in @karmaniverous/jeeves-watcher-core: rejection codes (documentRejectionCodeSchema) plus issue types (documentFailureCodeSchema covers both).
    • Re-notifying an unchanged record costs one callback and no embedding call.

    POST /documents/delete

    Delete source documents by reference or by Qdrant filter. v0.20.0+

    # By reference
    curl -X POST http://localhost:1936/documents/delete \
    -H "Content-Type: application/json" \
    -d '{"sources": ["app://chat/thread/6710c3a9"]}'

    # By filter
    curl -X POST http://localhost:1936/documents/delete \
    -H "Content-Type: application/json" \
    -d '{"filter": {"must": [{"key": "user_id", "match": {"value": "u-123"}}]}}'

    Body schema: exactly one of

    { sources: string[] }                // 1 to 1000 <name>://<id> references
    { filter: Record<string, unknown> } // native Qdrant filter with at least one condition

    Schema: documentsDeleteRequestSchema in @karmaniverous/jeeves-watcher-core. Both forms are strict (no other keys). sources accepts at most MAX_DELETE_SOURCES_PER_REQUEST (1000) references (v0.20.0+); split larger sets into several requests.

    { "deleted": 1 }
    

    deleted counts documents (distinct references), not points.

    • The filter is always constrained to source points: the caller's filter is nested inside a condition that requires a non-empty source and an empty file_path. A filter can never delete a file point, whatever it names (even a legacy file point whose rule wrote a source field). The sources form carries the same file_path guard.
    • A filter without any condition is rejected with the request-validation 400 FST_ERR_VALIDATION (v0.20.0+; invalid_request before 0.22.0): {}, { "must": [] } and filters whose clauses are all empty, at any depth. To remove every source document, name a condition explicitly (for example { "must": [{ "key": "source_rule", "match": { "any": [...] } }] }). The SDK refuses such filters before sending them.
    • A filter Qdrant rejects is 400 WATCHER_INVALID_REQUEST (The vector store rejected the filter: <reason>); nothing is deleted.
    • Every chunk of each matching document is deleted.
    • Enrichment metadata and issues are removed for the deleted references, and, in the sources form, for every listed reference (so a document that only ever failed leaves no issue behind).
    • Deletion does not touch the source system. If the owner notifies the reference again (or a notification for it was still queued), it is retrieved and indexed again.

    Documents are deleted one at a time, each under its document lock (v0.21.0+), so a deletion never interleaves with the document being indexed.

    Errors: 400 FST_ERR_VALIDATION for an invalid body (both or neither of sources/filter, an empty sources array or one over 1000 references, a malformed reference, a condition-free filter, an unknown key); 400 WATCHER_INVALID_REQUEST for a filter Qdrant rejects; 503 WATCHER_NOT_AVAILABLE with Retry-After: 10 (v0.21.0+; The document is being processed; retry after 10 s.) when a document's lock is not free within 10 s (documents already deleted stay deleted; retry to finish); the masked 500 (no code) for an unexpected failure. This route does not depend on source-document support.


    Returns the current issues file contents: every document (file or source document) whose last processing failed, with error details.

    v0.5.0+

    curl http://localhost:1936/issues
    

    Success (200 OK):

    {
    "count": 2,
    "issues": {
    "/data/tickets/PROJ-123.json": [
    {
    "type": "type_collision",
    "property": "created",
    "rules": ["jira-issue", "frontmatter-created"],
    "types": ["integer", "string"],
    "message": "Type collision on 'created': jira-issue declares integer, frontmatter-created declares string",
    "timestamp": 1771865063
    }
    ],
    "/data/email/archive/msg-456.json": [
    {
    "type": "interpolation_error",
    "property": "author_email",
    "rule": "email-archive",
    "message": "Failed to resolve ${json.from.email}: 'from' is null",
    "timestamp": 1771865100
    }
    ]
    }
    }
    Field Type Description
    count number Number of documents with issues (not total issue count).
    issues object Issues keyed by file path or source reference.
    Field Type Description
    type string Issue code; see Issue Codes.
    operation string? Operation that failed (e.g. Failed to process source document).
    property string? Property name where the issue occurred.
    rules string[]? Rule names involved in the issue (for type collisions).
    rule string? Rule name for single-rule issues; for a source document, its designated rule (recorded on every source failure).
    types string[]? Declared types for type collision issues.
    message string Human-readable error message.
    details unknown? Structured details (JSON), e.g. the AJV errors of a match_failed issue.
    timestamp number | string Unix timestamp (seconds) or ISO string of last occurrence.

    Every issue record carries one code from a single canonical list (ISSUE_TYPES in @karmaniverous/jeeves-watcher-core). The same codes appear as error.code in failed results of POST /documents?wait=true (where a notification that failed synchronous validation carries its rejection code instead, e.g. invalid_reference).

    Code Applies to Meaning
    type_collision files, sources Matched rules declare the same property with incompatible types.
    interpolation_error files, sources A set expression, template or render could not be resolved. A file is still indexed (without the failed values) and the issue records the failures; a source document fails and nothing is written. details holds one entry per failed rule step.
    extraction_error files, sources Reading or extracting the document, applying rules, or chunking failed. Also the code for any failure no stage tagged. A file that has points and whose content can no longer be parsed, extracted or run through its rules has its points deleted, until it reads again; a system error reading the file (locked, gone mid-save, a dropped share) or a Node error (an enrichment store read that fails, an extractor that does not load) keeps them.
    embedding_error files, sources The embedding provider failed, including a rate-limit retry budget that ran out.
    upsert_error files, sources Writing to or deleting from the vector store failed.
    match_failed sources The designated rule's match rejected the retrieved record. Nothing was written.
    rule_missing sources The designated rule does not exist (any more). Points untouched.
    no_content sources The callback returned an empty JSON object, or the designated rule rendered no text. Nothing was written.
    source_unavailable sources The callback failed: any status other than 200/404 (redirects included), a timeout, a network error, a body that is not valid JSON, a body over 10 MiB (response too large), or no sources configured. Points untouched.
    unsupported_content_type sources The callback answered 200 with a content type other than application/json, or with JSON that is not an object. Points untouched.
    too_large files, sources Over a processing ceiling (v0.21.0+): file size, extracted text bytes or chunk count. The document's points were deleted; the message names the ceiling. Raise it and POST /reindex { "scope": "issues" } to bring the document back.

    Issue files written by versions before 0.20.0 contain only type_collision and interpolation_error and still load unchanged.

    Source-document issues (v0.20.0+) always carry rule (the designated rule of the failed run). POST /reindex { "scope": "issues" } uses it to retry a reference that was never indexed. details carries structured context where there is any: the AJV errors of match_failed, the per-step failures of interpolation_error.

    The issues file is self-healing:

    • A document whose processing failed is logged and not written; a source document's existing points are left untouched. (A file whose only problem is an interpolation_error is still indexed, without the failed values.)
    • Successful re-processing (config fix, file edit, re-notification, reindex) clears the entry
    • A source document that is deleted (callback 404 or POST /documents/delete) has its entry cleared
    • The response represents the current set of unresolved problems, cached for api.cacheTtlMs (default 30 seconds)

    Empty response:

    {
    "count": 0,
    "issues": {}
    }

    Return the merged virtual configuration document, optionally filtered with a JSONPath expression. (Earlier guides described this as POST /config/query; that route does not exist.)

    # Whole document
    curl http://localhost:1936/config

    # JSONPath filter (URL-encoded)
    curl "http://localhost:1936/config?path=%24.inferenceRules%5B*%5D.name"

    Query string: path: optional JSONPath expression (evaluated with jsonpath-plus).

    Success (200 OK): the whole document, or { "result": [...], "count": n } for a path query.

    {
    "result": ["email-classifier", "meeting-tagger", "project-labeler"],
    "count": 3
    }

    An invalid JSONPath expression is jeeves's 400 JEEVES_CONFIG_QUERY_INVALID with the parser's message, for example { "statusCode": 400, "code": "JEEVES_CONFIG_QUERY_INVALID", "error": "Bad Request", "message": "Unclosed ( at character 2" } (v0.22.0+; before, invalid_request). A failure building the document is logged and answered with the masked 500 (no code). Responses are cached for api.cacheTtlMs (default 30 seconds).

    The query runs against a virtual document with exactly these top-level keys (the allow-list PUBLIC_CONFIG_KEYS, plus issues):

    • description ("" when unset), watch, configWatch, search, schemas, maps, templates: from the running configuration (maps, templates and .json rule map file references are resolved to their contents; named schema references in a rule's schema are expanded).
    • inferenceRules: the config rules (source: "config") followed by the virtual rules registered by plugins (source: the registering source). Each rule carries values: the distinct values seen per property (replaces the old payloadFields of /status). Values are collected from files only: source documents never feed the values index (v0.20.0+).
    • mapHelpers, templateHelpers: the configured helper modules, with their introspected exports when available.
    • issues: the current runtime issues (as in GET /issues).

    Everything else (api including api.apiKey, sources with callback URLs and headers, embedding and vectorStore with provider keys, stateDir, logging, vcs, ...) is never included, with or without a path.

    See Inference Rules Guide for rule structure details.


    Returns the JSON Schema describing the merged virtual document (authored config + runtime state).

    v0.5.0+

    curl http://localhost:1936/config/schema
    

    Success (200 OK):

    Returns a JSON Schema object describing the merged config document shape:

    • Exactly the document's top-level keys, all required: the PUBLIC_CONFIG_KEYS allow-list (description, watch, configWatch, search, schemas, inferenceRules, mapHelpers, templateHelpers, maps, templates) plus issues. Each config key is taken from the core config schema (jeevesWatcherConfigSchema), so schemas is a record of named schemas and search includes scoreThresholds and hybrid.
    • Runtime-injected fields: inferenceRules[].source and inferenceRules[].values, helper exports under mapHelpers / templateHelpers, and issues (issue records as in GET /issues).
    • Since 0.21.0, watch.paths[].vcs includes maxFileBytes, the per-root override of vcs.maxFileBytes, because watch is public (an approved departure from 0.20.0's wire shape, D185).

    The schema is generated from Zod using z.toJSONSchema() and describes the queryable surface exposed by GET /config.

    Example response (excerpt):

    {
    "type": "object",
    "properties": {
    "description": { "type": "string" },
    "schemas": {
    "type": "object",
    "propertyNames": { "type": "string" },
    "additionalProperties": {
    "anyOf": [{ "type": "object" }, { "type": "string" }]
    }
    },
    "inferenceRules": {
    "type": "array",
    "items": {
    "type": "object",
    "properties": {
    "name": { "type": "string" },
    "description": { "type": "string" },
    "source": { "type": "string" },
    "values": {
    "type": "object",
    "additionalProperties": { "type": "array" }
    }
    }
    }
    }
    }
    }
    • Introspection of the watcher's queryable config surface
    • UI generation for config editors
    • LLM agent orientation (understand structure before querying)

    POST /config/match

    Tests file paths against inference rules and watch scope without indexing.

    v0.5.0+

    curl -X POST http://localhost:1936/config/match \
    -H "Content-Type: application/json" \
    -d '{
    "paths": [
    "/data/tickets/PROJ-123.json",
    "/data/chat/general/1234567.json",
    "/data/unknown/file.txt"
    ]
    }'

    Body schema:

    {
    paths: string[]; // File paths to test
    }

    A missing body, or one whose paths is not an array of strings, is the request-validation 400 FST_ERR_VALIDATION (body/paths Request body must include "paths" array; 0.21.0 sent invalid_request, and before that a request without a JSON body failed with the generic 500).

    Success (200 OK):

    {
    "matches": [
    { "rules": ["jira-issue", "json-subject"], "watched": true },
    { "rules": ["slack-message", "json-participants"], "watched": true },
    { "rules": [], "watched": false }
    ]
    }
    Field Type Description
    matches PathMatch[] Match results for each input path (same order).

    PathMatch:

    Field Type Description
    rules string[] Ordered list of matching inference rule names.
    watched boolean Whether the path is within watch scope (matches watch.paths and not in watch.ignored).
    • Each path is normalized and tested against the config inferenceRules (virtual rules are not included), using synthetic attributes built from the path alone: no file is read, so rules that match on content or JSON fields do not match here
    • Rules are returned in definition order (same order as inferenceRules array)
    • watched tests against the watch.paths and watch.ignored globs (case-sensitive; gitignore rules are not consulted)
    • Empty rules array means no inference rules match (but file may still be watched)
    • watched: false means the path falls outside watch scope or is excluded by ignore patterns

    Use cases:

    • Pre-flight path testing before file creation
    • Debugging rule match logic
    • UI path validation in config editors

    POST /config/validate

    Pre-flight validation of configuration changes without applying them.

    curl -X POST http://localhost:1936/config/validate \
    -H "Content-Type: application/json" \
    -d '{
    "config": {
    "inferenceRules": [
    {
    "name": "new-rule",
    "description": "Test rule",
    "match": { "type": "object" },
    "schema": [
    { "properties": { "domain": { "type": "string", "set": "test" } } }
    ]
    }
    ]
    },
    "testPaths": ["d:/docs/sample.md"]
    }'

    Body schema:

    {
    config?: Record<string, unknown>; // Partial or full config to validate
    testPaths?: string[]; // File paths to test rules against
    }

    config is merged into the running configuration (as loaded, after ${ENV_VAR} substitution) one level deep: each top-level key it contains replaces the running value as a whole (unlike POST /config/apply, nested objects are not merged), except inferenceRules, which merge by name: provided rules replace existing rules with the same name, new ones are appended, and unmatched existing rules are preserved. Without config, the running configuration itself is validated.

    testPaths are matched against the candidate rules using each file's path and stat attributes (its content is not read). A path that cannot be stat'ed gets { "matchedRules": [], "metadata": {}, "error": "File not found" }; testResults is omitted when there are none.

    Valid (200 OK):

    {
    "valid": true,
    "testResults": [
    {
    "path": "d:/docs/sample.md",
    "matchedRules": ["new-rule"],
    "metadata": { "domain": "test" }
    }
    ]
    }

    Invalid (also 200 OK): an invalid config is a successful validation with a negative result, not an HTTP error. The route has no 400 of its own: only a request its schema rejects (malformed JSON, a missing body, a non-object config, a non-array testPaths) is a 400: FST_ERR_VALIDATION, or Fastify's own FST_ERR_CTP_* code for malformed JSON (v0.22.0+; 0.21.0 sent invalid_request, and before that a request without a JSON body failed with the generic 500).

    {
    "valid": false,
    "errors": [
    {
    "path": "api.apiKey",
    "message": "api.apiKey must be a non-empty string (remove it to disable authentication)"
    }
    ]
    }

    errors[].path is the dotted config path (for schema failures) or names the rule (inferenceRules[<name>]) or helper whose check failed. Validation stops at the first failing stage (schema, helper files, rule schemas), and an invalid result carries no warnings.

    Valid with warnings (200 OK, v0.20.0+):

    {
    "valid": true,
    "warnings": [
    {
    "path": "sources.app.timeout",
    "message": "Unknown source setting \"timeout\" is ignored (supported: url, headers, timeoutMs, concurrency)."
    }
    ]
    }

    Validation includes checking that referenced helper files can be loaded. Warnings (never failures) report unknown keys under sources.<name> and rule schema properties that use a reserved payload field name; the same warnings are logged at startup and on config reload.

    Schema checks added in v0.20.0 make these configs invalid: an empty api.apiKey (also after ${ENV_VAR} substitution), and a vectorStore.payloadIndexes entry repeating a field or naming the system-indexed source / source_rule.


    POST /config/apply

    Deep-merge a partial config into the config file the service runs from, validate it, write it, and trigger a reindex.

    curl -X POST http://localhost:1936/config/apply \
    -H "Content-Type: application/json" \
    -d '{
    "patch": {
    "inferenceRules": [
    {
    "name": "new-rule",
    "description": "Test rule",
    "match": { "type": "object" },
    "schema": [
    { "properties": { "domain": { "type": "string", "set": "test" } } }
    ]
    }
    ]
    }
    }'

    Body schema:

    {
    patch?: Record<string, unknown>; // Partial config to merge (default {})
    replace?: boolean; // true = the patch replaces the whole config instead of merging
    }

    Schema: the configApply entry of WATCHER_CATALOG (core's configApplyBodySchema). Other keys are ignored. Before validation, a body without patch gets patch: {}, and a body with config but no patch uses config as the patch. Deprecated: send patch; the config alias will be removed. A patch that is not an object, or a replace that is not a boolean, is a request-validation 400 FST_ERR_VALIDATION (for example body/patch Invalid input: expected record, received array; 0.21.0 sent invalid_request with details, and before that a non-object patch was answered with issues: [{ "path": ["patch"], "message": "patch must be an object" }]).

    Success (200 OK):

    {
    "applied": true,
    "config": {
    "watch": { "paths": ["/data/**"], "ignored": [] },
    "inferenceRules": [
    {
    "name": "new-rule",
    "description": "Test rule",
    "match": { "type": "object" },
    "schema": [
    { "properties": { "domain": { "type": "string", "set": "test" } } }
    ]
    }
    ]
    }
    }
    Field Type Description
    applied true The file was written.
    config object The validated config, reduced to the same allow-list as GET /config (PUBLIC_CONFIG_KEYS: description, watch, configWatch, search, schemas, inferenceRules, mapHelpers, templateHelpers, maps, templates; only the keys present). api, sources, embedding, vectorStore and every other key, so every secret, is never echoed (v0.20.0+).
    warning string? Present when the file was written but the post-write step that triggers the reindex failed: "The config was written but could not be applied." (v0.22.0+, jeeves 0.11; the cause is logged; before, "Config written but callback failed: <message>"). The status is still 200.

    Validation failure (400 Bad Request): jeeves's JEEVES_CONFIG_INVALID, with the merged config's Zod issues folded into message (v0.22.0+; before, invalid_request with an issues array):

    {
    "statusCode": 400,
    "code": "JEEVES_CONFIG_INVALID",
    "error": "Bad Request",
    "message": "Config validation failed: watch: Invalid input: expected object, received number"
    }

    Server failure (500, v0.20.0+): when the config file cannot be read (or does not hold a JSON object) the response is 500 JEEVES_CONFIG_READ_FAILED (The config file could not be read.), and when it cannot be written 500 JEEVES_CONFIG_WRITE_FAILED (The config file could not be written.) (v0.22.0+; before, the generic internal_error body). The cause, which names the file, is logged only. An unreadable file is left untouched.

    1. Reads the raw config file the service was started with (not the running, environment-substituted config)
    2. Deep-merges the patch: objects merge recursively, arrays and scalars replace, inferenceRules merge by name (so { "patch": {} } or a single key is valid). With replace: true the patch is the new config
    3. Validates the merged config against the config schema
    4. Writes the merged raw object (not the schema's parsed output: unknown keys are kept, defaults are not added) atomically to the same file, keeping its permission bits
    5. Triggers a file-only reindex with the running config's configWatch.reindex scope (default issues)

    The new settings take effect when the config watcher reloads the file (configWatch.enabled, default true); that reload triggers the configured configWatch.reindex scope again. With config watching off, restart the service to load the file.


    POST /rules/register

    Register virtual inference rules from an external source.

    curl -X POST http://localhost:1936/rules/register \
    -H "Content-Type: application/json" \
    -d '{
    "source": "my-external-system",
    "rules": [
    {
    "name": "external-rule",
    "description": "Rule registered from external source",
    "match": { "type": "object" },
    "schema": [
    { "properties": { "domain": { "type": "string", "set": "external" } } }
    ]
    }
    ]
    }'

    Body schema:

    {
    source: string; // Identifier for the rule source (non-empty)
    rules: InferenceRule[]; // Array of inference rules to register (each with a non-empty name)
    }

    Schema: rulesRegisterRequestSchema in @karmaniverous/jeeves-watcher-core (v0.20.0+). It checks source and that every rule is an object with a name; the rest of each rule is validated when it is compiled.

    Success (200 OK):

    {
    "source": "my-external-system",
    "registered": 1,
    "totalVirtualRules": 4
    }

    totalVirtualRules is the number of virtual rules registered across all sources after this registration.

    Registering replaces the source's previous rules, rebuilds the processor's rule set (config rules plus all virtual rules) and, when any virtual rule matches on a file.path glob (match.properties.file.properties.path.glob), starts a file-only rules reindex of the watched files under the globs of all virtual rules. That reindex is tracked in GET /status and reported to the completion callback.

    Virtual rules live in memory: a restart loses them and they must be registered again. A config reload rebuilds the processor's rule set from the config rules alone: registered virtual rules stay in the store (and in GET /config) but stop applying to processing until the next register or unregister call.

    Errors (v0.20.0+; these were 500 before): 400 FST_ERR_VALIDATION when source is missing or empty, rules is not an array or a rule is not an object with a name (request validation; 0.21.0 sent invalid_request, and before that these read "Missing required field: source", "Missing required field: rules (array)" and "Every rule must be an object with a name"); 400 WATCHER_INVALID_REQUEST when the rules do not compile, for example two rules share a name or a match schema is invalid (The rules are not valid: <the compiler's explanation>, capped at 300 characters; before 0.22.0, error: "Invalid rules"). Nothing is registered then.


    Remove all virtual rules from a source.

    curl -X DELETE http://localhost:1936/rules/unregister \
    -H "Content-Type: application/json" \
    -d '{ "source": "my-external-system" }'

    Body schema:

    {
    source: string; // Source identifier to unregister
    }

    Success (200 OK):

    {
    "source": "my-external-system",
    "removed": true
    }

    removed is false when the source had no rules. When rules were removed, the processor's rule set is rebuilt and, if the remaining virtual rules match on file.path globs, a file-only rules reindex runs as for registration. A missing or empty source is the request-validation 400 FST_ERR_VALIDATION (schema rulesUnregisterRequestSchema; v0.20.0+, was 500; 0.21.0 sent invalid_request, and before that it read error: "Missing required field: source").


    Remove all virtual rules from a named source (path parameter variant).

    curl -X DELETE http://localhost:1936/rules/unregister/my-external-system
    

    Same behaviour as the body variant; the :source path segment is the source.

    Success (200 OK):

    {
    "source": "my-external-system",
    "removed": true
    }

    POST /points/delete

    Delete points from Qdrant matching a filter.

    curl -X POST http://localhost:1936/points/delete \
    -H "Content-Type: application/json" \
    -d '{
    "filter": {
    "must": [{ "key": "domain", "match": { "value": "obsolete" } }]
    }
    }'

    Body schema:

    {
    filter: Record<string, unknown>; // Qdrant filter object
    }

    Schema: pointsDeleteRequestSchema in @karmaniverous/jeeves-watcher-core (v0.20.0+).

    Success (200 OK):

    {
    "deleted": 42
    }

    deleted counts points. Unlike POST /documents/delete, this route applies the filter as given, to file and source points alike, and does not refuse a condition-free filter: { "filter": {} } deletes every point. Matching points are collected first, then deleted in batches.

    Errors (v0.20.0+; these were 500 before): 400 FST_ERR_VALIDATION when filter is missing or not an object (request validation; 0.21.0 sent invalid_request, and before that it read error: "Missing required field: filter (object)"); 400 WATCHER_INVALID_REQUEST when Qdrant rejects it (The vector store rejected the filter: <reason>). Nothing is deleted then.


    POST /rules/reapply

    Re-apply current inference rules to indexed files matching glob patterns, without re-embedding.

    curl -X POST http://localhost:1936/rules/reapply \
    -H "Content-Type: application/json" \
    -d '{
    "globs": ["/data/email/**"]
    }'

    Body schema:

    {
    globs: string[]; // Non-empty array of glob patterns
    }

    Missing or empty globs, or an empty or non-string entry, is the request-validation 400 FST_ERR_VALIDATION (schema rulesReapplyRequestSchema; v0.20.0+, was 500; 0.21.0 sent invalid_request, and before that it read error: "Missing required field: globs (non-empty string array)").

    Success (200 OK):

    {
    "matched": 150,
    "updated": 148
    }
    Field Type Description
    matched number Distinct indexed files matching the glob patterns.
    updated number Files whose points were updated.
    1. Scrolls all points (file_path only) to find the indexed files matching the globs (slashes normalised, case-insensitive, dotfiles included); source documents never match
    2. For each matching file, re-applies current inference rules (metadata update only): changed values are written and payload keys the rules no longer project are removed (one filtered write once the file_path system index is ready, v0.21.0+)
    3. Files that fail re-processing are logged but don't abort the operation
    4. Each file is updated under its document lock (v0.21.0+). If a file's lock is not free within 10 s, the request answers 503 WATCHER_NOT_AVAILABLE with Retry-After: 10 (The document is being processed; retry after 10 s.); files already updated keep their update, so a retry finishes the rest

    Use cases:

    • After editing inference rules, selectively re-apply to specific domains
    • More targeted than POST /reindex with scope rules (which re-applies to everything)

    Version control endpoints for git-backed content history. Requires vcs.enabled: true in config: without it there are no VCS roots, so GET /vcs/status answers { "enabled": false, "roots": [] } and the other VCS routes answer 404 WATCHER_NOT_FOUND (no matching watch root). A server embedded without a VCS coordinator answers every VCS route as unregistered (see Gated routes). Every VCS route's query or body is validated by its catalog entry: a missing parameter is the request-validation 400 FST_ERR_VALIDATION, whose message names each missing parameter (for example querystring/glob Missing required query parameter: glob). See the Version Control (VCS) Guide for architectural context, configuration, and operational details.


    VCS state for all watch roots.

    curl http://localhost:1936/vcs/status
    

    Success (200 OK):

    {
    "enabled": true,
    "roots": [
    {
    "path": "d:/documents",
    "tracked": 1523,
    "lastCommit": {
    "hash": "a1b2c3d4e5f60718293a4b5c6d7e8f9012345678",
    "message": "update project notes and readme",
    "timestamp": "2026-06-10T14:30:00+00:00"
    },
    "remoteUrl": "https://github.com/org/docs-backup.git",
    "lastPush": "2026-06-10T14:30:05.000Z",
    "pushErrors": [],
    "breaker": {
    "consecutiveFailures": 0,
    "tripped": false,
    "trippedAt": null,
    "lastError": null,
    "pendingCount": 0
    }
    }
    ]
    }
    Field Type Description
    enabled boolean Whether any watch root has VCS enabled.
    roots array Per-root VCS state.
    roots[].path string Watch root path.
    roots[].tracked number Number of commits on HEAD in this root's repository (git rev-list --count HEAD; 0 without commits).
    roots[].lastCommit object | null Most recent commit: full hash, subject message, author timestamp (ISO 8601); null if no commits yet.
    roots[].remoteUrl string | null Configured remote URL, else the repository's origin URL, else null.
    roots[].lastPush string | null ISO 8601 timestamp of the last successful push since start.
    roots[].pushErrors { timestamp, message }[] Recent push errors.
    roots[].breaker object | null Commit circuit breaker: consecutiveFailures, tripped, trippedAt, lastError, and pendingCount (files queued or in flight, not yet committed).

    Commit history for files matching a glob pattern.

    curl "http://localhost:1936/vcs/history?glob=d:/documents/**/*.md&limit=10&since=2026-06-01T00:00:00Z"
    

    Query parameters:

    Param Type Default Description
    glob string Required Glob pattern to filter history.
    since string undefined ISO-8601 lower bound (inclusive).
    until string undefined ISO-8601 upper bound (inclusive).
    limit number 20 Max entries to return.

    Success (200 OK):

    [
    {
    "commit": "a1b2c3d4e5f60718293a4b5c6d7e8f9012345678",
    "message": "update project notes and readme",
    "timestamp": "2026-06-10T14:30:00+00:00",
    "files": ["projects/readme.md", "projects/notes.md"]
    }
    ]
    Field Type Description
    commit string Full commit hash.
    message string Commit subject line.
    timestamp string ISO 8601 author timestamp.
    files string[] Files changed in this commit that match the glob, relative to the watch root.

    Runs git log (with --since / --until when given) in every VCS root the glob falls under, or that falls under the glob's base path, with the root-relative glob as pathspec. Entries from all roots are merged, sorted by timestamp descending and cut to limit. A root whose log fails (for example no commits yet) is skipped.

    400 FST_ERR_VALIDATION without glob (querystring/glob Missing required query parameter: glob); 404 WATCHER_NOT_FOUND when no VCS root matches (No version-controlled watch root matches the path or glob.).


    Retrieve file content at a specific commit.

    curl "http://localhost:1936/vcs/show?path=d:/documents/readme.md&commit=a1b2c3d"
    

    Query parameters:

    Param Type Description
    path string Required. Absolute file path.
    commit string Required. Commit hash.

    Returns the raw file content with a Content-Type header based on the file extension: text/plain (.txt, .ts), text/markdown (.md), application/json, application/xml, text/html, text/css, application/javascript, text/yaml (.yaml, .yml), text/csv; otherwise application/octet-stream.

    Resolves the watch root for the path, computes the relative path, and runs git show {commit}:{relativePath}.

    400 FST_ERR_VALIDATION when path or commit is missing or empty, its message naming each missing one (querystring/path Missing required query parameter: path, querystring/commit Missing required query parameter: commit); 404 WATCHER_NOT_FOUND when no VCS root contains the path (No version-controlled watch root matches the path or glob.) or git show fails, for example an unknown commit or a file absent at that commit (The file does not exist at that commit.).


    Unified diff between commits for files matching a glob.

    curl "http://localhost:1936/vcs/diff?glob=d:/documents/**/*.md&commit=a1b2c3d"
    

    Query parameters:

    Param Type Description
    glob string Required. Glob pattern to filter files.
    commit string Required. Start commit hash.
    commitEnd string End commit hash. Defaults to HEAD if omitted.

    Returns unified diff text (Content-Type: text/plain).

    Resolves matching watch roots and runs git diff {commit}..{commitEnd} (or ..HEAD) in each, with the root-relative glob as pathspec, and joins the outputs with newlines. A root where the diff fails (for example an unknown commit) contributes nothing, so the response can be 200 with an empty body.

    400 FST_ERR_VALIDATION when glob or commit is missing (querystring/commit Missing required query parameter: commit); 404 WATCHER_NOT_FOUND when no VCS root matches (No version-controlled watch root matches the path or glob.).


    POST /vcs/revert

    Restore files from a historical commit. Forward-only — writes old content as new changes, HEAD never moves backward.

    curl -X POST http://localhost:1936/vcs/revert \
    -H "Content-Type: application/json" \
    -d '{
    "glob": "d:/documents/projects/**",
    "commit": "a1b2c3d",
    "existingOnly": true
    }'

    Body schema:

    {
    glob: string; // Glob pattern for files to revert
    commit: string; // Commit hash to revert to
    existingOnly?: boolean; // Only restore files that currently exist on disk (default: false)
    }

    Success (200 OK):

    {
    "restored": 3,
    "files": [
    "d:/documents/projects/readme.md",
    "d:/documents/projects/notes.md",
    "d:/documents/projects/spec.md"
    ]
    }
    Field Type Description
    restored number Number of files restored.
    files string[] Absolute paths (forward slashes) of restored files.

    existingOnly must be a JSON boolean; anything else answers 400 FST_ERR_VALIDATION (0.21.0, D183: 0.20.0 read any truthy value, so "false" acted as true).

    1. Lists the files at the specified commit with git ls-tree -r --name-only {commit} -- {root-relative glob} (the whole tree when the glob is a root itself)
    2. Retrieves each file's content via git show and writes it to disk (skipping files absent on disk when existingOnly is set, and files git show cannot read)
    3. Records reversion metadata: the resulting commit message is revert: {glob} to {shortCommit} — restored {n} files
    4. The written files then flow through the normal watcher events and are re-indexed

    A root whose listing fails (for example an unknown commit) restores nothing, so the response can be { "restored": 0, "files": [] }.

    400 FST_ERR_VALIDATION when glob or commit is missing (body/commit Missing required body parameters: glob, commit); 404 WATCHER_NOT_FOUND when no VCS root matches (No version-controlled watch root matches the path or glob.).


    POST /vcs/exclude

    Exclude a path from version history without dropping it from search (VCS-only exclusion, unreleased, spec B4). The pattern goes to the root's .git/info/exclude, which git honours and the watcher's indexing filter never reads, and the tracked files it matches are untracked in one commit. This entry is destructive in the catalog (D103): history stops for the untracked files.

    curl -X POST http://localhost:1936/vcs/exclude \
    -H "Content-Type: application/json" \
    -d '{
    "glob": "d:/documents/temp/**/*.tmp"
    }'

    Body schema:

    {
    glob: string; // One gitignore pattern: absolute under a VCS root, or relative to `root`
    root?: string; // VCS root to write under (default: the root containing the glob)
    remove?: boolean; // Remove the pattern instead of adding it (default: false)
    confirm?: boolean; // Required (true) to untrack more than 100 files
    }

    The glob is a gitignore pattern, so *, ?, ** and brackets keep their gitignore meaning. Brackets are a character class: Report [draft].docx matches Report d.docx, not the file with the brackets. Escape them to name a file literally: "Report \\[draft\\].docx" in JSON (Report \[draft\].docx). A backslash before a bracket is kept as that escape; any other backslash is a Windows path separator.

    Success (200 OK):

    {
    "ok": true,
    "file": "d:/documents/.git/info/exclude",
    "action": "added",
    "untracked": 3
    }
    Field Type Description
    ok boolean Success indicator.
    file string Path (forward slashes) of the file written: the root's .git/info/exclude, or, for a remove of a pattern 0.20.0 wrote, that .gitignore.
    action string "added" or "removed".
    untracked number Paths removed from the index (committed in HEAD or only staged); 0 for removed.

    Confirmation needed (200 OK, v0.22.0+): when more than 100 files would be untracked and confirm is not true, nothing is written and the reply is

    { "confirmRequired": true, "untracked": 101 }
    

    The response schema is the union of the two shapes (vcsExcludeResponseSchema in core); tell them apart by confirmRequired. Check the count with whoever asked, then repeat with confirm: true. Before v0.22.0 this was 409 { "code": "confirm_required", "error": "Excluding <pattern> would untrack <n> files; repeat with confirm: true", "untracked": <n> }.

    0.20.0 answered { ok, gitignorePath, action }; file and untracked replace gitignorePath (an approved wire departure, spec Design 2).

    • Anchoring. The pattern is written root-anchored: / followed by the glob relative to the root (D81). The written patterns /docs and /docs/ (from the glob <root>/docs, or docs with root) name the root's docs folder and everything under it; **/build/ names every build folder. With root, a glob starting with / (or a drive) is a filesystem path, so /docs there means the folder /docs on disk and is 400 unless it lies under the root; give root-relative globs without the leading /. Trailing spaces are dropped (git ignores them in the exclude file). 0.20.0 wrote un-anchored lines into a .gitignore near the glob, so *.log there matched at every depth; 0.21.0's /*.log matches only at the root. Write **/*.log for every depth.
    • Adding runs in one hold of the root's git lock, waited for at most 30 s: the tracked files the pattern matches are listed (git ls-files -c -i -x <pattern>, in HEAD and in the index), the line is appended to .git/info/exclude (once: a pattern already there is not duplicated), the files are removed from HEAD in one commit Untrack <n> files matching <pattern> and from the index, and the commit is pushed when the root has a remote. Files stay on disk and in search. Other staged changes are kept. A file a failed batch staged but never committed is untracked too and counted. With an unborn HEAD nothing is committed; staged matches are unstaged.
    • More than 100 files to untrack need confirm: true. Without it the route answers 200 { confirmRequired: true, untracked } and writes nothing (v0.22.0+; was 409).
    • Removing deletes the anchored line from .git/info/exclude; if it is not there, the line 0.20.0 wrote for the same glob in its locality .gitignore (the deepest literal directory of the glob). Untracked files are not re-added: their next change is versioned again.
    • Queued batches that hold an excluded path drop it, because git now reports it ignored.
    • Refused patterns (400): a newline, a leading ! or #, braces ({a,b} is not gitignore syntax), and a pattern matching the whole root (a path part that is empty or only *, ** and /: *, **, /, /**, **/*, */**). docs/* and **/*.tmp are accepted.
    Status code When
    400 FST_ERR_VALIDATION glob missing (body/glob Missing required body parameter: glob), remove or confirm not a JSON boolean (D183).
    400 WATCHER_INVALID_REQUEST A refused pattern: The exclude glob is refused: <reason>, the reason one of The glob must be a single pattern (no newline), The glob must not start with ! or #, Braces are not gitignore syntax, The glob matches the whole root, or The glob resolves outside the root (a glob outside an explicit root: with root, an absolute glob must lie under it and a relative one may not climb out with ..).
    404 WATCHER_NOT_FOUND root is not a VCS root (The named root is not a version-controlled watch root.), no VCS root contains the glob (No version-controlled watch root matches the path or glob.), or, for remove, the pattern is in neither file (The pattern is not excluded on this root.).
    503 WATCHER_NOT_AVAILABLE The root's git lock stayed busy (a long batch commit or squash) for 30 s. Nothing is written. Retry-After: 30; message is "Version control is busy on this root; retry after 30 s.".
    500 Masked (no code) git failed, including an untrack commit beaten twice by commits from elsewhere (the appended line is removed again).

    Over the threshold without confirm is not an error (the 200 confirmation under Response above); it was 409 confirm_required before v0.22.0.


    Check whether git ignores a path, and why.

    curl "http://localhost:1936/vcs/check-exclusion?path=d:/documents/temp/scratch.tmp"
    

    Query parameters:

    Param Type Description
    path string Required. Absolute file path to check.

    Success (200 OK):

    {
    "excluded": true,
    "rule": "/temp/**/*.tmp",
    "source": ".git/info/exclude",
    "line": 2
    }
    Field Type Description
    excluded boolean Whether git ignores the path.
    rule string? The matching pattern (if excluded).
    source string? The file holding the rule, as git check-ignore -v names it: .git/info/exclude for a VCS-only exclusion, a .gitignore relative to the watch root, or a global excludes file.
    line number? The rule's 1-based line number in source (unreleased, D82).

    Runs git check-ignore -v in the watch root (unreleased, D82):

    • A tracked path is never reported ignored, even when a rule matches it: excluded: false. So a file a human .gitignore covers but git still tracks answers excluded: false; exclude it through POST /vcs/exclude to untrack it.
    • A path a negated rule (!pattern) re-includes answers excluded: false.
    • git's "not ignored" exit answers excluded: false; any other git failure answers the masked 500. (0.20.0 answered excluded: false for every git failure, and excluded: true without rule for output it could not parse.)

    400 FST_ERR_VALIDATION without path (querystring/path Missing required query parameter: path); 404 WATCHER_NOT_FOUND when no VCS root contains the path (No version-controlled watch root matches the path or glob.); the masked 500 when git fails.


    Since v0.22.0 every non-2xx response is Fastify's standard error body, errorBodySchema in @karmaniverous/jeeves/catalog (on jeeves 0.11.0):

    {
    "statusCode": 503,
    "code": "WATCHER_SCAN_IN_PROGRESS",
    "error": "Service Unavailable",
    "message": "The initial filesystem scan is still running; retry when it finishes."
    }
    • statusCode repeats the HTTP status; error is its standard reason phrase (Bad Request, Not Found, ...).
    • code is machine-readable and stable in meaning: branch on it, never on message. It is a WATCHER_* code (the table below; the list is WATCHER_ERROR_CODES in @karmaniverous/jeeves-watcher-core, type WatcherErrorCode, with each code's status in WATCHER_ERROR_STATUS), a jeeves JEEVES_* code or a Fastify FST_ERR_* code. An unexpected failure has no code at all.
    • message is a fixed sentence written for the caller. It never carries a filesystem path, host, source callback URL, credential, stack or library error text; where a message names something (a field, a rule, the filter Qdrant rejected, the caller's own method and URL), that part comes from the request and is capped at 300 characters. What a message leaves out (the callback's status and error, the extraction or rule error and its details, the Qdrant error, the embedding error) goes to the service log.
    • There are no other fields: no details, no issueType, no issues, no untracked. The body is strict.
    • Headers: Retry-After (seconds) is sent only with DocumentBusy (10), VcsBusy (30) and WATCHER_EMBEDDING_UNAVAILABLE (when the provider's back-off is known), and the message says the wait in words too. A 401 carries no WWW-Authenticate. Error replies carry no Cache-Control.
    • The SDK copies code to WatcherError.code (http_<status> when the body has none), message to WatcherError.message, the whole body to details, and Retry-After to retryAfterMs. The CLI prints <code>: <message>. The plugin's tools report HTTP <status>: <body> with the JSON body verbatim. Parse the body as JSON rather than relying on key order.

    One code can be sent by several errors, each with its own fixed message (%s marks the part taken from the request).

    Status code Meaning Message
    400 WATCHER_INVALID_REQUEST Qdrant rejected the filter (POST /search, /scan, /search/facets/counts, /points/delete, /documents/delete) The vector store rejected the filter: %s (Qdrant's reason)
    400 WATCHER_INVALID_REQUEST A facet field has no usable payload index (POST /search/facets/counts) No usable payload index for field(s): %s
    400 WATCHER_INVALID_REQUEST rules names no rule (GET /search/facets, POST /search/facets/counts) rules must name at least one rule
    400 WATCHER_INVALID_REQUEST rules names an unknown rule Unknown rule(s): %s
    400 WATCHER_INVALID_REQUEST Metadata fails the matched rules' schemas (POST /metadata) The metadata does not match the matched rules' schemas: %s
    400 WATCHER_INVALID_REQUEST The rules do not compile (POST /rules/register) The rules are not valid: %s
    400 WATCHER_INVALID_REQUEST A scope-path target is neither a file nor a directory (POST /reindex) The path is neither a file nor a directory.
    400 WATCHER_INVALID_REQUEST POST /vcs/exclude refused the glob The exclude glob is refused: %s (one of five fixed reasons)
    401 WATCHER_UNAUTHORIZED api.apiKey is set and the bearer key is missing or wrong A valid API key is required: send Authorization: Bearer <key>.
    403 WATCHER_PATH_NOT_WATCHED The path is outside the watched scope or gitignored (POST /render, POST /reindex scope path) The path is outside the watched scope or is gitignored.
    404 WATCHER_NOT_FOUND No such route, or a gated /vcs/* route (byte-identical) Route %s:%s not found (the caller's method and URL)
    404 WATCHER_NOT_FOUND The file or directory does not exist (POST /render, POST /reindex scope path) The file or directory does not exist.
    404 WATCHER_NOT_FOUND No VCS-enabled root matches the path or glob No version-controlled watch root matches the path or glob.
    404 WATCHER_NOT_FOUND The named root is not VCS-enabled The named root is not a version-controlled watch root.
    404 WATCHER_NOT_FOUND The file is not at that commit (GET /vcs/show) The file does not exist at that commit.
    404 WATCHER_NOT_FOUND The pattern to remove is not excluded (POST /vcs/exclude with remove) The pattern is not excluded on this root.
    404 WATCHER_SOURCE_NOT_INDEXED No stored point for the source reference, so no designated rule is known (POST /render, POST /metadata) The source document is not indexed.
    404 WATCHER_SOURCE_NOT_FOUND The source callback answered 404 (POST /render) The source reports that the document does not exist.
    422 WATCHER_UNSUPPORTED_CONTENT_TYPE The source callback's body is not a JSON object (POST /render) The source returned a body that is not a JSON object.
    422 WATCHER_PIPELINE_EXTRACTION_ERROR Extraction failed (POST /render; also an untagged source failure) The document could not be extracted.
    422 WATCHER_PIPELINE_RULE_MISSING_ERROR The designated rule does not exist (POST /render with source) The designated rule does not exist.
    422 WATCHER_PIPELINE_MATCH_FAILED_ERROR The record does not match its designated rule The document does not match its designated rule.
    422 WATCHER_PIPELINE_NO_CONTENT_ERROR Nothing to render The document has no content to render.
    422 WATCHER_PIPELINE_INTERPOLATION_ERROR A rule's template or set expression failed A rule's template or set expression failed for this document.
    422 WATCHER_PIPELINE_TYPE_COLLISION_ERROR Defined, not raised by any route today The document's metadata types conflict with each other.
    422 WATCHER_PIPELINE_EMBEDDING_ERROR Defined, not raised by any route today The document could not be embedded.
    422 WATCHER_PIPELINE_UPSERT_ERROR Defined, not raised by any route today The document could not be written to the vector store.
    422 WATCHER_PIPELINE_TOO_LARGE_ERROR Defined, not raised by any route today The document is over a processing size limit.
    502 WATCHER_SOURCE_UNAVAILABLE The source callback failed (network error, timeout, non-404 HTTP error) (POST /render) The source could not be reached or answered with an error.
    503 WATCHER_NOT_AVAILABLE No source-document support (POST /documents, and POST /render, POST /metadata and POST /reindex with source; POST /documents/delete works without it) Source documents are not available on this instance.
    503 WATCHER_NOT_AVAILABLE No filesystem watcher (POST /walk) The filesystem watcher is not initialized.
    503 WATCHER_NOT_AVAILABLE A system index the counts need is not ready (POST /search/facets/counts) Facet counts need the %s system index, which is not ready yet; retry shortly. (the index name)
    503 WATCHER_NOT_AVAILABLE The counts exceeded their 10 s budget Facet counts exceeded the time budget; not counted: %s. Count fewer fields or narrow the filter.
    503 WATCHER_NOT_AVAILABLE A document lock stayed busy for 10 s (POST /metadata, /rules/reapply, /documents/delete); Retry-After: 10 The document is being processed; retry after 10 s.
    503 WATCHER_NOT_AVAILABLE A root's git lock stayed busy for 30 s (POST /vcs/exclude); Retry-After: 30 Version control is busy on this root; retry after 30 s.
    503 WATCHER_NOT_AVAILABLE A prune without a vector store (POST /reindex) Prune needs a vector store, and none is configured.
    503 WATCHER_SCAN_IN_PROGRESS The initial filesystem scan is still running (POST /walk) The initial filesystem scan is still running; retry when it finishes.
    503 WATCHER_EMBEDDING_UNAVAILABLE The embedding provider is in back-off or failing (POST /search); Retry-After when the back-off is known The embedding provider is unavailable; retry later.

    <TYPE> in WATCHER_PIPELINE_<TYPE>_ERROR is the issue code in upper case with a trailing _error dropped. The four pipeline codes no route raises today exist so that a future route reporting a processing failure has its code ready.

    Status code When
    400 FST_ERR_VALIDATION The body, query string or path parameters fail the route's catalog schema. message joins <slot>/<path> <issue> per failure, e.g. body/query query must be a non-empty string.
    400, 413, 415 FST_ERR_CTP_* Fastify rejected the request before validation: malformed or empty JSON body, body too large, unsupported media type.
    400 JEEVES_CONFIG_QUERY_INVALID GET /config: the JSONPath does not parse (the parser's message).
    400 JEEVES_CONFIG_INVALID POST /config/apply: the merged config fails the schema (the issues folded into message).
    500 JEEVES_CONFIG_READ_FAILED POST /config/apply: the config file can't be read (The config file could not be read.).
    500 JEEVES_CONFIG_WRITE_FAILED POST /config/apply: the config file can't be written (The config file could not be written.).
    500 JEEVES_RESPONSE_VALIDATION A catalog route's response failed its schema: a server bug (The server could not complete the request.; the issues are logged).

    Unexpected failures are masked: 500 with no code and a fixed message, the cause logged once by the service (Error reply masked). A thrown error's own status, message and headers never reach the client:

    {
    "statusCode": 500,
    "error": "Internal Server Error",
    "message": "The server could not complete the request."
    }

    This includes a Qdrant read failure on POST /metadata or POST /render with source, a git failure in GET /vcs/check-exclusion other than "not ignored", and any Qdrant error outside the filter checks. Before v0.22.0 the body was { "code": "internal_error", "error": "Internal Server Error", "message": "Internal server error" }.

    Per-document outcomes are not HTTP errors and use their own codes: rejected[].error.code of POST /documents (rejection codes) and error.code of failed results (issue codes).

    For the 0.21 codes (invalid_request, not_available, pipeline_error, ...) and their successors, see Upgrading to 0.22.0.

    Status codes:

    • 200 OK: success (including POST /vcs/exclude's { confirmRequired: true, untracked })
    • 202 Accepted: notifications queued (POST /documents)
    • 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 413 Payload Too Large, 415 Unsupported Media Type, 422 Unprocessable Entity, 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable: see the tables above

    v0.20.0+. Authentication is optional and off by default: without api.apiKey, the API is open, and is intended for localhost-only access (default host: "127.0.0.1").

    Set api.apiKey (usually through an environment variable) to require a bearer token:

    {
    "api": {
    "host": "0.0.0.0",
    "port": 1936,
    "apiKey": "${WATCHER_API_KEY}"
    }
    }
    curl -X POST http://watcher.internal.example:1936/search \
    -H "Authorization: Bearer $WATCHER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"query": "password reset"}'
    • Every route requires Authorization: Bearer <apiKey> (the Bearer scheme name is case-insensitive) — including unknown routes, the config, rules and VCS endpoints — except GET /status (and HEAD /status), which stays open for health checks, and GET /openapi.json (unreleased).
    • A missing, malformed or wrong token gets 401 { "statusCode": 401, "code": "WATCHER_UNAUTHORIZED", "error": "Unauthorized", "message": "A valid API key is required: send Authorization: Bearer <key>." }, with no WWW-Authenticate header (v0.22.0+; before, { "code": "unauthorized", "error": "Unauthorized" }). The presented token is never logged; rejections log only the method and path at debug level.
    • The comparison is constant-time.
    • apiKey must be non-empty: "" (or a variable that substitutes to "") is a config validation error, so the service does not start. Omit the key to run without authentication. (Should an empty key ever reach the server, it still fails closed: no token matches.)
    • If apiKey still contains an unresolved ${...} after environment-variable substitution, loading the config fails and the service does not start.
    • The key is read at startup only. Rotating it means changing the config (or the environment variable) and restarting the watcher, then updating every client.
    • Clients send the key as follows:
      • CLI (config, config apply, search, enrich, scan, reindex, rebuild-metadata, issues, helpers): the --api-key <key> flag, else the JEEVES_WATCHER_API_KEY environment variable. These commands do not read the config file. Prefer the environment variable: a flag value is visible in the process list. See CLI Reference.
      • OpenClaw plugin: plugins.entries.jeeves-watcher-openclaw.config.apiKey, else JEEVES_WATCHER_API_KEY; sent on every tool request.
      • SDK: the apiKey option.
      • On 401, the CLI says how to supply the key (or, when one was sent, that it was rejected) and never prints it. The plugin's tools report HTTP 401: <body>; the skill's troubleshooting section covers it. The environment variable name is API_KEY_ENV_VAR in core.
    • api settings never appear in GET /config.

    For TLS, or for authentication schemes other than a single shared key, put a reverse proxy in front of the watcher.


    The API itself has no request rate limit; add one at a reverse proxy if you need it.

    The embedding provider is rate-limited. Since v0.20.0, one shared limiter wraps the provider and every caller draws from it: file watching, source-document notifications, reindex and search. It admits at most embedding.rateLimitPerMinute embedded items (texts) in any minute. Indexing leaves a reserve of that budget (10% rounded up, at most 60 items; none at a limit of 1) free for search, so a reindex that keeps the limiter busy does not make searches wait. See embedding.rateLimitPerMinute for the semantics (and the behaviour changes in 0.20.0 and after 0.21.0).

    When the provider answers 429, the limiter pauses all embedding requests:

    • The pause is the delay the provider asks for (Retry-After, or Google's retryDelay when there is no header) or the exponential backoff from 1 second (capped at max(root maxBackoffMs, 65 seconds)), whichever is longer, so Gemini's retryDelay: "0s" does not spend every retry in the same quota minute. A delay of up to max(root maxBackoffMs, 65 seconds) is waited in full, then the request is retried.
    • A requested delay longer than that ceiling is not shortened: the request fails at once, and every other caller fails fast until the pause has fully passed, instead of retrying early and being throttled again.
    • Indexing makes up to 7 attempts per embedding request (63 seconds of backoff between them) and then records an embedding_error issue (the document is retried on its next change, notification or reindex).
    • Search makes up to 3 attempts and waits at most 10 seconds in total; when that budget runs out, or the provider's pause is too long, POST /search answers 503 WATCHER_EMBEDDING_UNAVAILABLE (The embedding provider is unavailable; retry later.) with a Retry-After header when the back-off is known, instead of 500.
    • Retries the Gemini client makes on its own (non-429 failures) also go through the limiter: each takes its items and waits out any pause, so every request to the provider counts against rateLimitPerMinute.

    Not enabled by default. To enable for browser access, modify the Fastify server initialization (code change required).


    curl -X POST http://localhost:1936/search \
    -H "Content-Type: application/json" \
    -d '{"query": "billing integration", "limit": 5}' \
    | jq '.[] | {score, path: .payload.file_path, title: .payload.title}'

    Output:

    { "score": 0.91, "path": "d:/projects/billing/spec.md", "title": "Billing API Spec" }
    { "score": 0.87, "path": "d:/meetings/2026-02-15/notes.md", "title": "Billing Discussion" }
    ...
    
    for file in file1.md file2.md file3.md; do
    curl -X POST http://localhost:1936/metadata \
    -H "Content-Type: application/json" \
    -d "{\"path\": \"$file\", \"metadata\": {\"reviewed\": true}}"
    done
    curl http://localhost:1936/status | jq '.uptime'
    

    Output: 86400 (uptime in seconds)