Integration of CPU-powered semantic search.
  • TypeScript 54.6%
  • Python 38.4%
  • JavaScript 6.6%
  • Dockerfile 0.2%
  • Shell 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
oliver.maklott 79185c6984
All checks were successful
Publish / dev-image (push) Successful in 0s
Publish / test (push) Successful in 1m2s
Publish / worker-test (push) Successful in 1m43s
Publish / pack-and-publish (push) Successful in 24s
Publish / build-sidecar (push) Successful in 1m14s
Merge pull request 'Encrypted mode: no content id of an uploaded file in cache or Redis names. Release 0.6.0.' (#6) from keyed-names into main
2026-11-15 21:04:01 +01:00
.forgejo/workflows Cache directory purge is confined to the cache root; worker stats detail needs the sidecar key; handoff markers in document text are neutralized; index busy answers retry instead of empty results; purged content is removed from the index file. Release 0.5.0. 2026-11-15 00:05:41 +01:00
.githooks Sub-repo fmt/lint pre-push rollout 2026-08-29 15:43:24 +02:00
blob Encrypted mode: no content id of an uploaded file in cache file names or Redis names. Prepared artifacts, chunk records and vectors are named by keyed digests under the sidecar key; outbox entries are named by a keyed token and their values sealed. Release 0.6.0. 2026-11-15 19:57:17 +01:00
client Readable rebuild / diagnostics errors; never rebuild a published worker image. Release 0.3.1. 2026-10-25 19:42:49 +01:00
locales Ship own translations (locales/en,de) via pluginT. Release 0.3.0. 2026-10-24 23:23:07 +02:00
prep Encrypted mode: no content id of an uploaded file in cache file names or Redis names. Prepared artifacts, chunk records and vectors are named by keyed digests under the sidecar key; outbox entries are named by a keyed token and their values sealed. Release 0.6.0. 2026-11-15 19:57:17 +01:00
protocol Retry policy restamps, fence stale replays, and keep drafts out of anonymous search. 2026-10-18 17:23:25 +02:00
search_pipeline Cache directory purge is confined to the cache root; worker stats detail needs the sidecar key; handoff markers in document text are neutralized; index busy answers retry instead of empty results; purged content is removed from the index file. Release 0.5.0. 2026-11-15 00:05:41 +01:00
server Cache directory purge is confined to the cache root; worker stats detail needs the sidecar key; handoff markers in document text are neutralized; index busy answers retry instead of empty results; purged content is removed from the index file. Release 0.5.0. 2026-11-15 00:05:41 +01:00
worker Encrypted mode: no content id of an uploaded file in cache file names or Redis names. Prepared artifacts, chunk records and vectors are named by keyed digests under the sidecar key; outbox entries are named by a keyed token and their values sealed. Release 0.6.0. 2026-11-15 19:57:17 +01:00
.env.example Migrate to new owner 2026-10-02 13:18:53 +02:00
.gitignore Python 3.14 worker from a hashed lock; host redis for the app side. Release 0.4.0. 2026-11-10 12:35:35 +01:00
CACHE_BOUNDARIES.md Encrypted mode: no content id of an uploaded file in cache file names or Redis names. Prepared artifacts, chunk records and vectors are named by keyed digests under the sidecar key; outbox entries are named by a keyed token and their values sealed. Release 0.6.0. 2026-11-15 19:57:17 +01:00
compose.dev.yml Encrypt the search pipeline: handoffs, chunks, vectors, index, Redis. 2026-10-23 19:15:25 +02:00
deploy.json Worker: own Redis user, non-root, no capabilities. Release 0.3.4. 2026-10-26 14:51:20 +01:00
LICENSE.md Name Oliver Maklott (Belowtoxic e.U.) as the FSL licensor. 2026-10-17 11:13:17 +02:00
limedoc.project.json Encrypted mode: no content id of an uploaded file in cache file names or Redis names. Prepared artifacts, chunk records and vectors are named by keyed digests under the sidecar key; outbox entries are named by a keyed token and their values sealed. Release 0.6.0. 2026-11-15 19:57:17 +01:00
README.md Encrypted mode: no content id of an uploaded file in cache file names or Redis names. Prepared artifacts, chunk records and vectors are named by keyed digests under the sidecar key; outbox entries are named by a keyed token and their values sealed. Release 0.6.0. 2026-11-15 19:57:17 +01:00
rebuild_response.ts Readable rebuild / diagnostics errors; never rebuild a published worker image. Release 0.3.1. 2026-10-25 19:42:49 +01:00
search_hit_auth.test.ts Jailed users get tree and block hits only. Release 0.3.5. 2026-10-26 23:39:50 +01:00
search_provider.test.ts Cache directory purge is confined to the cache root; worker stats detail needs the sidecar key; handoff markers in document text are neutralized; index busy answers retry instead of empty results; purged content is removed from the index file. Release 0.5.0. 2026-11-15 00:05:41 +01:00
search_provider.ts Cache directory purge is confined to the cache root; worker stats detail needs the sidecar key; handoff markers in document text are neutralized; index busy answers retry instead of empty results; purged content is removed from the index file. Release 0.5.0. 2026-11-15 00:05:41 +01:00
SearchResultsModal.tsx Ship own translations (locales/en,de) via pluginT. Release 0.3.0. 2026-10-24 23:23:07 +02:00
SEMANTIC_CHUNKER.md Encrypted mode: no content id of an uploaded file in cache file names or Redis names. Prepared artifacts, chunk records and vectors are named by keyed digests under the sidecar key; outbox entries are named by a keyed token and their values sealed. Release 0.6.0. 2026-11-15 19:57:17 +01:00
semantic_entity_repr.ts Pass the origin instance id when representing linked blobs. 2026-10-18 18:18:15 +02:00
semantic_export.test.ts Semantic export stays linear on adversarial bodies: trailing blanks are trimmed by a loop, image labels are bounded, overlapping spans are found in one pass, one representation per embedded path. Release 0.5.1. 2026-11-15 14:11:06 +01:00
semantic_export.ts Semantic export stays linear on adversarial bodies: trailing blanks are trimmed by a loop, image labels are bounded, overlapping spans are found in one pass, one representation per embedded path. Release 0.5.1. 2026-11-15 14:11:06 +01:00
settings_schema.test.ts Cache directory purge is confined to the cache root; worker stats detail needs the sidecar key; handoff markers in document text are neutralized; index busy answers retry instead of empty results; purged content is removed from the index file. Release 0.5.0. 2026-11-15 00:05:41 +01:00
settings_schema.ts Cache directory purge is confined to the cache root; worker stats detail needs the sidecar key; handoff markers in document text are neutralized; index busy answers retry instead of empty results; purged content is removed from the index file. Release 0.5.0. 2026-11-15 00:05:41 +01:00
vectorsearch-lite.plugin.json Encrypted mode: no content id of an uploaded file in cache file names or Redis names. Prepared artifacts, chunk records and vectors are named by keyed digests under the sidecar key; outbox entries are named by a keyed token and their values sealed. Release 0.6.0. 2026-11-15 19:57:17 +01:00
vectorsearch-lite.ts Cache directory purge is confined to the cache root; worker stats detail needs the sidecar key; handoff markers in document text are neutralized; index busy answers retry instead of empty results; purged content is removed from the index file. Release 0.5.0. 2026-11-15 00:05:41 +01:00
vectorsearch_dashboard_widget.tsx Readable rebuild / diagnostics errors; never rebuild a published worker image. Release 0.3.1. 2026-10-25 19:42:49 +01:00
vectorsearch_header_tool.tsx Deferred follow-ups from review fixes 2026-08-28 14:41:19 +02:00
vectorsearch_hydrator.tsx Initial commit 2026-08-21 14:45:58 +02:00
vectorsearch_settings_client.tsx Readable rebuild / diagnostics errors; never rebuild a published worker image. Release 0.3.1. 2026-10-25 19:42:49 +01:00

Vector Search Lite

Hybrid vector search with permission-aware retrieval.

Requirements

  • Docker (or Podman with DOCKER_CMD=podman)
  • That's it — everything else runs inside containers.

Quick start

# 1. Pull the dev image and set up .env
./ldcmd setup

# 2. Start the dev environment (app + Redis)
./ldcmd up

# 3. Open http://localhost:5173 in your browser

# 4. Edit plugin sources — HMR applies automatically
# 5. Run tests
./ldcmd test

# 6. Check types and import boundaries
./ldcmd check

Directory layout

vectorsearch-lite.plugin.json   # Plugin manifest
vectorsearch-lite.ts            # Server entry (defineLimedocPlugin)
vectorsearch_lite_editor_tool.tsx  # Browser client (builds to client/*.js)
client/              # Pre-built browser bundles (committed)
limedoc.project.json # Store metadata (package download URLs)
compose.dev.yml      # Dev compose (uses the published limedoc-dev image)
ldcmd                # Bridge script — the only thing you run on your host
.env.example         # Env var template — copy to .env and fill in OIDC values

ldcmd commands

Command What it does
./ldcmd setup Pull limedoc-dev image, copy .env.example → .env
./ldcmd up Start dev environment
./ldcmd down Stop dev environment
./ldcmd logs [service] Follow container logs
./ldcmd sh [service] Open shell in container (default: app-dev)
./ldcmd test Run plugin tests
./ldcmd fmt Format sources
./ldcmd lint Lint sources
./ldcmd check Type-check + import boundary check
./ldcmd pack Build zip + sha256 (CI also publishes sig.json)
./ldcmd publish Pack and upload (needs .forgejo.env / PACKAGE_TOKEN)
./ldcmd plugin install <id> Install a plugin dependency into the running env
./ldcmd plugin ls List installed plugins

Building client bundles

# Inside the container (run after editing .tsx files)
./ldcmd sh
deno task plugin:build -- /limedoc/plugins/vectorsearch-lite.plugin

Or directly:

./ldcmd check  # runs build as part of the check

Production sidecar (host)

Pack Store / packs:install unpacks this plugin into the app only. The Docker sidecar is not started by Limedoc (no Docker socket in the app). On the deploy host:

ldcmd sidecar up vectorsearch-lite
# or: ldcmd up

Compose SoT: deploy.json + worker/docker-compose.yml (joins DOCKER_NETWORK_NAME).

Hardening notes

  • Cache directory. The cacheDir setting must lie below the app's cache root (CACHE_DIR, else {DATA_DIR}/cache) or at/below VECTORSEARCH_CACHE_DIR; a stored value outside is ignored with a warning. "Purge cache" only empties a directory that carries the plugin's marker file or scaffolding (409 cache_dir_refused otherwise).
  • Worker port. In external mode (worker/docker-compose.publish.yml) the health port is published on 127.0.0.1 only; set VECTORSEARCH_HOST_BIND when the app runs on another host. A worker run outside a container can narrow its listener with SEARCH_HEALTH_BIND.
  • Worker stats. /stats serves the cache path and the entity of the running job only to the app (a header sealed under the sidecar key; never in plaintext mode). Update the pack before the worker image: an older pack sends no header and then shows less detail in Admin diagnostics.
  • Upgrade. The first purge after the worker upgrade converts an existing index with one full VACUUM; searches during it answer "busy, retry".

See CACHE_BOUNDARIES.md "Purge and erasure" and "Worker stats".

Encrypted storage mode

With CONTENT_VERSION_MODE=encrypted the search cache and the Redis traffic are sealed end to end (sidecar id vectorsearch-lite, spec in Limedoc docs/security/SIDECAR_ENCRYPTION.md):

  • prep handoffs (prepared/…/source.md, sidecar.json, artifacts/*.json) and the worker's chunks, vectors and manifests are AES-256-GCM binary envelopes bound to their cache-relative path;
  • the SQLite index (index/search.db: FTS5 text, embeddings, tree paths, policy stamps) is a SQLCipher database;
  • search:req commands (query text), search:resp:* replies (hits, snippets), pipeline payloads, outbox entries and error texts are sealed in Redis; result cache keys are HMACs, not plain hashes of the query;
  • names never confirm a guess: artifact, chunk and vector files are named by keyed addresses (HMAC under keys derived from the sidecar key) instead of content hashes, and outbox entries by keyed tokens instead of entity ids, so neither the content id of an uploaded file (the SHA-256 of the file) nor a plain hash of content holding it appears in a file name, a Redis key name or a set member (CACHE_BOUNDARIES.md, "Names in encrypted mode").

Give the worker its key: ldcmd sidecar configure writes VECTORSEARCH_LITE_SIDECAR_KEY into the deploy .env, and worker/docker-compose.yml maps it to the worker's LIMEDOC_SIDECAR_KEY. Recreate the worker after enabling encryption or rotating the global key; it wipes its cache once (key id recorded in index/sidecar-kid) and the app re-indexes. A missing, stale or unexpected worker key shows up as sidecarKeySkew in the plugin diagnostics and in the app log; indexing waits until it is fixed. Plaintext deployments are unchanged. Details and the choice of SQLCipher over an in-memory index: CACHE_BOUNDARIES.md.

Search authorization

The worker filters hits by the read-policy ids stamped on index rows. Those stamps follow ACL changes asynchronously (restamp outbox), so the app re-authorizes every hit at query time with the host's read check (authorizeHitEntity in search_provider.ts): read on the document's tree path, or a published public path, or (for documents at several paths) a current read policy the user holds through an ACL grant. Titles and links come from the path that passed the check; when only another path is readable the hit is shown without title or link. The worker reads the result-cache epoch from Redis on every query, so a purge or restamp on any replica invalidates cached results on all of them.

Packing and publishing

# Build the installable zip + sha256 sidecar (local)
./ldcmd pack

# Publish (needs .forgejo.env with PACKAGE_TOKEN, PACKAGE_OWNER)
./ldcmd publish

CI (Forgejo Actions, .forgejo/workflows/publish.yml) on push to main publishes zip + sha256 + sig.json to Packages and Releases. Pack CI signs the content hash with OpenBao Transit (Forgejo Actions OIDC). Actions secret PACKAGE_TOKEN only — PACKAGE_OWNER is in the workflow env.

Developing with plugin dependencies

Your plugin may depend on another plugin at runtime. Three ways to include it:

1. Install via ldcmd (easiest, needs the app running)

./ldcmd up
./ldcmd plugin install media   # fetches from PACKAGE_STORE_URL in .env

Set PACKAGE_STORE_URL in .env to point at the Forgejo package registry:

PACKAGE_STORE_URL=https://git.belowtoxic.cloud/api/packages/limedoc-plugins

2. Local bind-mount (no running app needed)

Download the pack zip, unzip it next to this directory, then add a volume to compose.dev.yml:

app-dev:
    volumes:
        - .:/limedoc/plugins/vectorsearch-lite.plugin
        # Add the dependency:
        - ../other-plugin.plugin:/limedoc/plugins/other.plugin

Then ./ldcmd up — the app loads all *.plugin directories in plugins/.

3. Multi-repo development (two plugins at once)

Check out the other plugin repo next to this one:

cd ..
git clone git@git.belowtoxic.cloud:limedoc-plugins/other.git other.plugin

Then add it as a bind-mount in compose.dev.yml as shown above. Both plugins are mounted into the same app instance. No special ldcmd support required — the app discovers every *.plugin directory at startup.

Startup order: The app loads plugins alphabetically. If your plugin requires another, the dependency must be present on disk for the load plan to resolve. The compose depends_on in the sidecar template ensures the worker sidecar is healthy before the app starts, but for plugin-to-plugin dependencies no extra compose configuration is needed.

CI / CD

Push to main → Forgejo Actions runs .forgejo/workflows/publish.yml:

  1. Tests pass inside the limedoc-dev container
  2. Client bundles built; boundary check passes
  3. plugin:pack produces vectorsearch-lite-{version}.zip + .sha256
  4. OpenBao signs the content hash → vectorsearch-lite-{version}.sig.json
  5. Zip, sha256, and sig.json uploaded to the generic package registry (store)
  6. Same artifacts attached to a Forgejo Release v{version} (operators)

The app installs plugins from the generic package registry at PACKAGE_STORE_URL.

Using Podman instead of Docker

# In .env (or export before running):
DOCKER_CMD=podman
./ldcmd up

ldcmd detects podman compose automatically.

License

This pack is source-available under the Functional Source License, Version 1.1, ALv2 Future License (FSL-1.1-ALv2). Copyright 2026 Oliver Maklott (Belowtoxic e.U.).

You may use, modify, and redistribute it for any purpose other than a Competing Use. Two years after a version is made available, that version is also licensed under the Apache License 2.0. Third-party files under vendor/ keep the license shipped with those files.