EXAMPLE / Knowledge
Answer against a named knowledge snapshot
Trace a deterministic answer to approved rule versions, then inspect how citations change after review and publication.
Follow the pattern. Inspect its limits.
Explore the source walkthrough, its evidence and the choices you would make in your own application.
Validate the request envelope
The orchestrator checks the request envelope before searching. An invalid envelope returns a refused answer with a reason code.
An exploration of the inspected source; no example is executed here.
The situation.
A deterministic assistant searches a named curated snapshot. The integration fixture publishes an initial rule version, creates and reviews a change, publishes a second snapshot, and checks that the new answer cites that snapshot.
What you will learn
- Bind an answer to locale, jurisdiction, scope, and a specific knowledge snapshot.
- Keep citations connected to versioned source records.
- Refuse when the request envelope, scope, or citation conditions are not met.
Follow the operation.
- 01
Validate the request envelope
The orchestrator checks the request envelope before searching. An invalid envelope returns a refused answer with a reason code.
- 02
Search one snapshot
The caller supplies kbSearch. The orchestrator uses the snapshot ID and jurisdiction from the validated envelope and derives citations from the returned rule-version IDs.
- 03
Enforce scope and citations
Scope and citation checks can replace the draft with an escalation or blocked answer. The answer builder is deterministic and makes no LLM calls.
- 04
Review and publish a change
The integration test uses in-memory KB and pipeline handlers, approves updated rule material, publishes a new snapshot, and asserts that a subsequent answer cites it.
What the source demonstrates.
- The inspected answer builder uses explicit snapshot, jurisdiction, and scope inputs.
- The integration fixture asserts citation changes after a reviewed publication path.
- The example can be inspected without a model provider.
What it does not establish.
- Legal or regulatory correctness of the sample rules.
- A guarantee against hallucinations for an arbitrary model integration.
- Production knowledge quality, expert identity, or access controls supplied by a host application.
Bring it into your environment.
Use the exact source context and prerequisites below. A source walkthrough is not a verified public-package installation recipe.
- Access to the inspected source repository and a checkout at the cited revision.
- The repository's Bun workspace dependencies and required generated package exports. These instructions were inspected; the examples were not executed in this review.
Répertoire de travail : examples/policy-safe-knowledge-assistant
bun test src/integration.test.tsThe source fixture creates two approved snapshots and checks that each answer cites the selected snapshot.
Orchestrator and test source inspected; not executed here.
Read the related guide →Make the pattern your own.
- Supply curated sources and preserve their version identifiers.
- Define the request envelope and refusal conditions before connecting a model.
- Test stale snapshots, missing citations, and publication transitions with your own content.
Inspect the evidence.
Reviewed 2026-10-27 · b67c376f
Pinned source links require repository access; publication and anonymous package availability were not checked for this example.
- Declared maturity
- beta
- Catalogue registration
- Registered
- Inline preview
- Registered
- Execution in this review
- Not rerun
- Production qualification
- Not assessed