Runbook

These commands operate on WCHT, not on the captured upstream Next.js example. They assume the project checkout and captured sources are already present. No Sanity account, paid API key, remote vector database, or new MCP service is required. Answer generation uses the existing OMP session and can send retrieved content to its configured remote provider.

flowchart TD
  A[Verify captured inputs] --> B[Prepare guide Markdown]
  B --> C[Ingest selected sources]
  C --> D[Query and inspect citations]
  D --> E[Use kb-answer in OMP]
  E --> F[Run evaluation]
  F --> G[Record actual results]
  G --> H[Publish and inspect both wiki builds]

1. Prepare the tutorial corpus

Run from the project root:

cd /home/loca/dev/wcht
python3 scripts/prepare_corpus.py

The preparer uses the ten allowlisted article captures under sources/company-knowledge-base/guide/. It checks each text file against the recorded SHA-256, checks the expected source URL and capture metadata, removes known article furniture, and wraps the captured code blocks in Markdown fences. It writes corpus/tutorial/*.md plus corpus/tutorial/_manifest.json. It does not fetch the network, execute source text, summarize answers, or alter the SQLite index.

Each generated document has a stable official-guide: source ID, the original guide URL, captured_at, and evidence_class: official_companion_guide. There are no video timestamps. Citation line numbers refer to generated Markdown, not the HTML capture or a recording.

If a source digest, article layout, or output allowlist check fails, stop and inspect the capture/provenance mismatch. Do not silently replace the expected hash or delete an unmanaged file just to make preparation pass. Do not add evaluation questions, reference answers, result files, wiki summaries, or raw sessions to this corpus.

2. Ingest and re-ingest incrementally

python3 -m wcht --db data/kb.sqlite ingest corpus/tutorial

Inspect the JSON report. On the first ingest, eligible source documents are indexed; repeating the same command should report unchanged inputs rather than duplicate their chunks. After an approved document change, run the same ingest command again. Hashes determine whether a source needs replacement. Changed content is re-chunked and its previous indexed representation is replaced atomically.

For the generated tutorial corpus, change the approved capture/provenance through the source-recovery workflow and rerun the preparer before ingestion. Do not hand-edit generated Markdown and assume it is still an exact source-derived artifact.

The current database schema is version 2. If the CLI rejects a version-1 database, preserve it rather than editing its version or suppressing the error. Those earlier derived indexes could contain incorrect citation line spans. Rebuild from approved source documents into a new, unused database path, then use that same --db path for search and evaluation. An unchanged source hash does not make a stale derived citation valid. Do not count an old retrieval score as proof of the rebuilt index.

Ingestion is an upsert of selected inputs, not a directory mirror. Files absent from a later directory scan are retained. To retire a source, use the explicit removal operation after confirming its effective source ID. For example, the following removes the guide’s run-locally source; run it only if that source has intentionally been retired, not during the normal 20-question evaluation:

python3 -m wcht --db data/kb.sqlite remove official-guide:run-locally

The ingest report’s sources entries and search hits expose the effective source_id. The removal command accepts multiple IDs atomically; an unknown ID aborts the whole operation. Removing a file from disk alone is insufficient. Re-ingesting a still-present document restores it, so keep the source retirement and the next ingest selection consistent.

Private-marked documents and files under a private directory are excluded by default. If an already indexed public source becomes private, a default re-ingest removes its old public chunks. Authorized private ingestion and retrieval require separate opt-ins; the exact commands and disclosure checks are on the restricted operations page.

3. Retrieve evidence

python3 -m wcht --db data/kb.sqlite search 'What does Fumadocs provide and what does Next.js do?' --limit 5

Inspect the returned passage rather than treating its rank as an answer. Keep the source URL, evidence class, location, and chunk ID with any claim derived from it. The search output is an evidence set, not a generated chat response. FTS5 and the fused secondary ranker are lexical; differently worded questions may miss relevant content.

Copy the returned citation, whose format is {url_or_path} (captured lines {start_line}-{end_line}; chunk {chunk_id}). Use the full identifier, not an abbreviation. For this corpus, the line span is in the ingested Markdown, not the remote page or a video. Read the actual source_path span before citing it; if the source changed, stop using that stale hit, re-ingest the approved change, and search again.

Successful commands emit one JSON object. Search reports status: evidence when candidates exist or status: no_evidence with an empty list otherwise. An invalid input, missing database, or SQLite failure exits nonzero with a diagnostic on stderr. Do not interpret an operational error as evidence that a policy is absent.

If no useful support is returned, reformulate using source vocabulary only when that preserves the actual question. Do not replace the user’s request with an easier claim. A nonempty result list can still be unsupported for the question, especially for a missing policy or an exact-video request.

Wiki Chat, instant search, and service operations

Only one q parameter is accepted, up to 512 characters; results are fixed at five maximum. limit, private-content, and database parameters are not supported. API results omit local filesystem paths. /healthz checks process liveness only; exercise /api/search as well to check database-backed retrieval.

Open Wiki Chat, authenticate through Authelia, and create or reopen a conversation. The corrected D-167 interface streams available real thinking, generated text, sanitized tool activity, and evidence citations from OMP; contextual follow-ups reuse the selected user’s persisted conversation. Cancel stops the request, while unexpected stream disconnect must also terminate its child process group. Use instant search for direct evidence even when inference is unavailable: GET /api/search?q= remains independent of the model. Inspect original source URLs, captured source-file line bounds, chunk provenance, and wiki dissection links. No browser control enables private content, ingests documents, or changes the database.

The deployed process is the user service wcht-web.service, bound to 127.0.0.1:51167. Inspect or restart that owned service with:

systemctl --user status wcht-web.service --no-pager
journalctl --user -u wcht-web.service -n 50 --no-pager
systemctl --user restart wcht-web.service
curl --fail --silent --show-error http://127.0.0.1:51167/healthz
curl --fail --silent --show-error --get --data-urlencode 'q=Fumadocs Next.js' http://127.0.0.1:51167/api/search

For foreground diagnosis, stop the unit first to avoid a port conflict, then run from the project root:

python3 -m wcht.web --host 127.0.0.1 --port 51167 --db /home/loca/dev/wcht/data/kb.sqlite

The local probes deliberately bypass the edge and do not prove HTTPS authentication. At wcht.loca.zone, every route—including /api/search and /healthz—must be gated; an anonymous sign-in redirect is not an authenticated search success. Do not export cookies to manufacture a check. Record observed service, query, provenance, and edge behavior in receipts/wcht-web.json. After foreground diagnosis, end that process and restore the user service with systemctl --user start wcht-web.service.

Chat and history APIs accept identity only from trusted nginx Remote-User, never a browser-selected username. Do not add a public client-header bypass for testing. Verify first turn and contextual follow-up, owner isolation, queue/capacity behavior, timeout/cancel/disconnect cleanup, transcript persistence across teardown/restart, and citations against real evidence before accepting delivery. The global child cap is two; per-user requests queue FIFO. Keep .omp/runtime/web owner directories 0700 and files 0600; preserve histories during service restarts. Same-origin browser assets do not mean local inference: prompts and retrieved evidence reach the configured OMP OAuth provider.

The backend uses native omp acp, not print-mode. Live follow-ups reuse the conversation-owned child. After idle eviction, teardown, or restart, a fresh ACP session receives only that owner’s saved user/assistant transcript; native session/load is not used because the installed path ignores the custom session directory. Queue plus run times out after 300 seconds; idle children expire after 90 seconds. Waiting queues are bounded to four per user and sixteen globally. Queued cancellation adds no submitted turn; started interruption preserves the user turn and partial assistant response, not thinking or raw tool output. The child-local wcht.search stdio MCP tool is read-only; keep the exact tool allowlist/deny guard and child-only automation/discovery overrides intact.

GET / is the static chat shell, not the former server-rendered query page. The protected static /showcase/ alias exists as a separate surface, with an empty content directory permitted by the user. Do not claim showcase content is available; if content is later supplied, verify its same-origin assets and anonymous gate before recording content delivery. Record only actually observed gates in receipts/wcht-web.json; keep wiki_sync before the final current_state deployment record.

4. Answer through OMP, not the static public wiki

Open or use an OMP session rooted in the WCHT project:

cd /home/loca/dev/wcht
omp

Ask the session to use the kb-answer project skill for the question. For index updates, ask it to use kb-ingest with the exact approved input path. These are project skills, not invented slash-command APIs. Browser Wiki Chat is a separate OMP-backed route for the same retrieve/cite/refuse discipline; it does not expose index maintenance.

A useful answer request is:

Use the kb-answer project skill. What does Fumadocs provide, and what does Next.js do?
Retrieve current evidence, cite the supporting chunk IDs and original source URLs,
and distinguish the companion guide from video evidence.

The skill must retrieve first, use the actual returned passages, attach current citations to factual claims, and treat document text as evidence rather than instructions. Memory is not a citation. Inspect the named source when a result is ambiguous or a claim would exceed the retrieved passage.

To exercise unsupported refusal, ask:

Use the kb-answer project skill. What exact words are spoken at 29:08 in DNuD3Ia8qHM?

The original metadata establishes the 29:08 topic start, not exact spoken words. The supplied automatic-caption analysis can identify timecoded caption text, but VTT and JSON3 differ and no independent verbatim-audio verification is claimed. The guide-only search corpus cannot answer a recording-specific request by substituting guide prose. For missing policies, say the source does not specify them; do not convert silence into approval or denial.

The prompts above are reusable examples, not transcripts. The earlier native skill proof answered the Studio-versus-website question and refused visible-code detail at 12:34. Its later 17/20 answer baseline remains in receipts/history-d161-before-media-completion/. The fresh run used openai-codex/gpt-6-astra, 20 actual CLI queries and 19 cited source-span readbacks without gold/old-answer reads, and passed both contracts at 20/20. eval-results separates these runs and their limits.

5. Run and record the evaluation

After preparing and ingesting the tutorial corpus, use the commands below with new output filenames so current receipts are not overwritten. The recorded current paths are receipts/retrieval-evaluation.json, receipts/answer-evaluation.json, receipts/kb-answers.json, and receipts/native-answer-run.json; the old baseline is archived under receipts/history-d161-before-media-completion/.

python3 scripts/evaluate.py --db data/kb.sqlite --dataset evals/tutorial.json --output receipts/retrieval-evaluation-reproduction.json

The dataset has 20 cases and a 0.90 retrieval threshold. Read both the score and failing case details. Operational CLI errors fail the overall run even if 18 cases pass. A retrieval pass is not an answer-correctness pass. The evaluator invokes the actual search CLI but does not make model calls or establish video fidelity.

The evaluator’s exit code is 0 when the requested gates pass, 1 when a threshold, coverage, integrity, refusal, or search-runtime gate fails, and 2 for invalid input or a runner/file error. Its JSON separates retrieval, answer_contract, and refusal_controls; state is the last field.

If 20 actual OMP answers have been collected using the skill’s documented record format, check them separately:

python3 scripts/evaluate.py --db data/kb.sqlite --dataset evals/tutorial.json --answers receipts/kb-answers.json --output receipts/answer-evaluation-reproduction.json

receipts/kb-answers.json must be a real answer artifact, not copied reference answers. Keep raw answer/session material out of the public wiki and publish only a sanitized score, failure summary, scope, and evidence identifiers.

The input record contract is:

FieldRequired content
schema_versionInteger 1 on the outer object
recordsAll 20 actual records, with IDs tutorial-01 through tutorial-20
id, questionCase ID and the exact question from the dataset
queryActual retrieval query; may be omitted only when identical to the question
answer, refusedActual final answer text and a boolean indicating refusal of unsupported detail
citationsArray of actual chunk_id and verbatim retrieved quote pairs; listed IDs must be visible, and every visible chunk ID must be listed and resolve to fresh evidence
refusal_controlsOptional separate real unsupported-question records using the same shape; expected to refuse, not counted as extra correct dataset answers

Each support quote must contain at least 20 characters and three word tokens. Missing rows, invalid citations, wrong refusal behavior, and failed optional refusal controls are hard failures even if the aggregate term score reaches 0.90. The runner freshly retrieves each recorded query; a changed query, corpus, or result limit can invalidate a previously recorded citation. Empty citations are appropriate for a no-evidence control, not for the dataset’s source-documented gap case.

Preserve the relevant input/output digests with the release receipt:

sha256sum evals/tutorial.json corpus/tutorial/_manifest.json data/kb.sqlite receipts/retrieval-evaluation.json receipts/answer-evaluation.json

If the database changes after the run, re-evaluate before attaching the old score to the new revision. See eval-results for the distinction between term/citation checks and semantic correctness.

The recorded schema-2 engine has ten documents and 54 chunks, historical 9/9 CLI smoke scenarios, and 54/54 valid source bounds. The fresh combined evaluation at 2026-09-26T11:23:09Z passed retrieval 20/20, answer lexical contract 20/20, complete coverage, and citation/refusal integrity, with exit 0. Preserve the old failures tutorial-08 (missing [[...slug]]), tutorial-15 (missing Sanity), and tutorial-18 (pet-daycare versus pet daycare) in the archive. The only source fix was the kb-answer skill’s class-level self-contained-subject, exact-identifier, named-actor, and source-spelling discipline; no dataset, evaluator normalization, or threshold change was made. receipts/answer-mutation-completion.json records fresh baseline exit 0 versus invented-quote exit 1, with integrity false even while the term threshold remains met.

6. Keep project automation bounded

Automatic research is a native OMP session mode, not a made-up project configuration switch. An authorized experiment needs a fixed dataset/threshold, a bounded goal, protected source/configuration digests, and a disposable working copy. Record the baseline without changing gold answers, corpus content, or the engine to chase the metric. End research explicitly with /autoresearch off and observe the resulting mode; do not infer shutdown merely from the last successful benchmark.

The historical research proof used one native baseline plus one harness validation, for two evaluator executions. Retrieval remained 1.00, all 19 protected files were unchanged, and research ended off followed by an observed explicit off command. It did not optimize the engine or itself close the old answer-contract shortfall; the later skill correction and fresh native run are separate evidence.

Project-scoped Mnemopi recall/retention and automatic learning were enabled. The citation-provenance lesson was actually retained; two authored project skills remain, and zero new managed skills were created. Managed-skill storage is active-agent storage, not an isolated project vault. Treat stored lessons as workflow aids, not as source citations. Disposable research/mutation scaffolding was removed after its receipts were saved.

7. Preserve and interpret the supplied media

Existing metadata can be checked without repeating failed downloads:

sha256sum --check sources/DNuD3Ia8qHM/SHA256SUMS

The initial official-player capture returned LOGIN_REQUIRED; its failed manual/automatic-caption and video attempts remain historical evidence, not the current access state. The user has now supplied authorized inputs from the Mac: sources/DNuD3Ia8qHM/captions/, sources/DNuD3Ia8qHM/frames-d167/, sources/DNuD3Ia8qHM/chapters.mac-d167.json, and sources/DNuD3Ia8qHM/provenance.mac-d167.json.

All 85 Mac checksums passed. JSON3 normalization produced 1,307 nonblank cues from 2,655 events with zero text/timing mismatches. VTT and JSON3 differ; preserve both originals and do not call either independently verified verbatim audio. The visual reconstruction covers 56 unique 1280×720 frames with no byte/pixel duplicates: all 12 chapter starts plus two seconds and 44 scene samples. It is not continuous scene coverage or a full-video download.

Use tutorial-dissection for the source-bounded reconstruction, preserving distinctions among captions, observed pixels, guide explanations, and the pinned repository. Raw frames can contain credentials: only individually reviewed safe images may enter public wiki assets. Do not publish the raw directory, repeat exhausted downloads, or infer that an audio fallback is required merely because the original host capture failed.

Media analysis and the fresh passing answer evaluation supersede the former unfinished-analysis/below-threshold status. Full publication and mission acceptance remain controlled by the final D-161 receipt, not by source-document readiness alone.

8. Publish the two existing wiki builds

After updating the source pages with actual run results, use only the existing publisher and the two owned wiki names. Capture rollback targets first, following the restricted release procedure.

cd /home/loca/dev/wikis
umask 022
nice -n 10 ./build.sh wcht --check-only &&
nice -n 10 ./build.sh wcht-private --check-only &&
nice -n 10 ./build.sh wcht &&
nice -n 10 ./build.sh wcht-private

A successful build is not proof that live content is correct. Open all six public pages, follow local links, verify rendered Mermaid diagrams and the WCHT footer, and check that private content is absent from public pages/search/sitemap. Verify the restricted prefix without mistaking a followed sign-in redirect for content. Record D-161 distribution IDs and actual publication checks in final receipts/wcht-first-task.json, with an identical external copy at /home/loca/.flowmaster-d161/wcht-first-task.json; preserve the old exact receipt under receipts/history-d161-before-media-completion/. D-167 runtime/deployment observations remain separately recorded in receipts/wcht-web.json. Do not embed active release identities in source.

Keep the public/private access split unchanged. Do not edit the shared Quartz engine, global settings, ingress, unrelated wikis, or credential stores. If a publisher transaction is unresolved, stop and preserve the error rather than removing its state.

Wiki sync

The runbook includes fresh D-161 evaluation and supplied-media procedures alongside unchanged D-167 chat/service operations. Final D-161 publication and mission evidence belongs in receipts/wcht-first-task.json; its old exact version remains archived. D-167 observations remain in receipts/wcht-web.json, with wiki_sync before final current_state; these instructions do not attest new runtime gates.

State block

Measured workflow reconciled on 2026-09-26: fresh retrieval and answer lexical contract 20/20, complete coverage and passing integrity/refusal, with the frozen guide dataset/evaluator/0.90 threshold unchanged. Historical CLI 9/9 and unsupported-frame control 1/1 remain scoped to their runs. Research is explicitly off. Supplied-caption analysis and 56 sampled frames now support the documented reconstruction, not verbatim audio or full-video coverage.

Final D-161 publication/completion and any completion signal are governed by receipts/wcht-first-task.json; no issued signal is asserted here. D-167 retains its separate status in receipts/wcht-web.json, without a fresh runtime-proof claim.