AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
docs(air-gapped): clear the install path before the digest check, not after
xerj-org69a1bb65ec2c
diff --git a/docs/recipes/air-gapped-deployment.md b/docs/recipes/air-gapped-deployment.mdindex 617db1110..1c87ff8f1 100644--- a/docs/recipes/air-gapped-deployment.md+++ b/docs/recipes/air-gapped-deployment.md@@ -106,6 +106,8 @@ ASSET="${STAGE}.tar.gz"set -eucd /opt/xerj-staging/release+ rm -rf "$STAGE" "$STAGE.verified"+want="$(sha256sum "$ASSET" | cut -d ' ' -f 1)"if [[ ! "$want" =~ ^[0-9a-f]{64}$ ]]; thenecho "could not compute a digest for $ASSET" >&2@@ -114,7 +116,6 @@ ASSET="${STAGE}.tar.gz"LC_ALL=C grep -qxF -e "$want $ASSET" -e "$want *$ASSET" \< <(tr -d '\r' < "$ASSET.sha256")- rm -rf "$STAGE" "$STAGE.verified"tar -xzf "$ASSET"test -x "$STAGE/xerj"mv "$STAGE" "$STAGE.verified"@@ -148,7 +149,15 @@ form. Inside, a failure ends the subshell and the operator keeps their session.digest, the extraction and `test -x` have all succeeded.** That is what makesthe block safe when its exit status is ignored — by a wrapping script, an agent,or a reader who pastes the next section anyway. Nothing needs to check a return-code, because on any failure there is simply nothing at the install path.+code, because on any failure there is nothing at the install path.++That last sentence is only true because `rm -rf` runs FIRST. An earlier version+placed it after the digest check, where it is unreachable on exactly the failure+that matters: a bad digest exits the subshell before it, so a `$STAGE.verified`+left by an earlier run — or planted by anyone who can write to the staging+directory — survived and was installed. Clearing the install path before+anything else is what makes "nothing to install" the default rather than a+consequence.## 2. Install the base lexical nodediff --git a/landing/docs/recipes/air-gapped-deployment.html b/landing/docs/recipes/air-gapped-deployment.htmlindex f631c221f..8dd8ce7ea 100644--- a/landing/docs/recipes/air-gapped-deployment.html+++ b/landing/docs/recipes/air-gapped-deployment.html@@ -109,6 +109,8 @@ ASSET="${STAGE}.tar.gz"set -eucd /opt/xerj-staging/release+ rm -rf "$STAGE" "$STAGE.verified"+want="$(sha256sum "$ASSET" | cut -d ' ' -f 1)"if [[ ! "$want" =~ ^[0-9a-f]{64}$ ]]; thenecho "could not compute a digest for $ASSET" >&2@@ -117,12 +119,11 @@ ASSET="${STAGE}.tar.gz"LC_ALL=C grep -qxF -e "$want $ASSET" -e "$want *$ASSET" \< <(tr -d '\r' < "$ASSET.sha256")- rm -rf "$STAGE" "$STAGE.verified"tar -xzf "$ASSET"test -x "$STAGE/xerj"mv "$STAGE" "$STAGE.verified")</pre>- <p>Three details are load-bearing, and each replaces something that looked right and was not. <strong>The digest is computed here and the file is searched for it, not the other way round</strong> — <code class="inline">sha256sum -c</code> reads the filename out of the <code class="inline">.sha256</code>, a file that crossed the airgap on the same medium as the archive, skips <code class="inline">#</code> comments silently, and exits <code class="inline">0</code> if any one line verified, so a decoy digest plus a comment naming the archive passes while the archive is never hashed. Filtering that file first does not fix it: <code class="inline">awk '$2 == asset'</code> compares one token while <code class="inline">sha256sum</code> takes the whole rest of the line as the filename, so a line naming <code class="inline">$ASSET decoy</code> satisfies the filter and hashes a decoy. Building the expected line in the shell and demanding it with <code class="inline">grep -qxF</code> removes the disagreement. The two patterns accept GNU text mode and <code class="inline">-b</code> binary mode; <code class="inline">tr -d '\r'</code> accepts a checksum file written on Windows. <strong><code class="inline">set -eu</code> is inside the subshell</strong> — at the top of the block it kills the operator’s login shell on a bad digest, and the natural recovery is to re-paste without it, which is the fail-open form. <strong>Section 2 installs from <code class="inline">$STAGE.verified</code></strong>, which <code class="inline">mv</code> creates only after the digest, the extraction and <code class="inline">test -x</code> have all succeeded — so the block is safe even when its exit status is ignored, because on any failure there is nothing at the install path.</p>+ <p>Three details are load-bearing, and each replaces something that looked right and was not. <strong>The digest is computed here and the file is searched for it, not the other way round</strong> — <code class="inline">sha256sum -c</code> reads the filename out of the <code class="inline">.sha256</code>, a file that crossed the airgap on the same medium as the archive, skips <code class="inline">#</code> comments silently, and exits <code class="inline">0</code> if any one line verified, so a decoy digest plus a comment naming the archive passes while the archive is never hashed. Filtering that file first does not fix it: <code class="inline">awk '$2 == asset'</code> compares one token while <code class="inline">sha256sum</code> takes the whole rest of the line as the filename, so a line naming <code class="inline">$ASSET decoy</code> satisfies the filter and hashes a decoy. Building the expected line in the shell and demanding it with <code class="inline">grep -qxF</code> removes the disagreement. The two patterns accept GNU text mode and <code class="inline">-b</code> binary mode; <code class="inline">tr -d '\r'</code> accepts a checksum file written on Windows. <strong><code class="inline">set -eu</code> is inside the subshell</strong> — at the top of the block it kills the operator’s login shell on a bad digest, and the natural recovery is to re-paste without it, which is the fail-open form. <strong>Section 2 installs from <code class="inline">$STAGE.verified</code></strong>, which <code class="inline">mv</code> creates only after the digest, the extraction and <code class="inline">test -x</code> have all succeeded — so the block is safe even when its exit status is ignored, because on any failure there is nothing at the install path. That last part is only true because <code class="inline">rm -rf</code> runs <strong>first</strong>: placed after the digest check it is unreachable on exactly the failure that matters, and a <code class="inline">$STAGE.verified</code> left by an earlier run — or planted by anyone who can write to the staging directory — would survive and be installed.</p><h2>2. Install the base lexical node</h2><p>Create the service account first, then install only the staged binary. No model directory is needed for lexical mode:</p>