Files
GEWU_agent/pipelines/query.md
T
vasily 3ef2c5cc31 feat(agent): add online verification and governing-answer citations
Claim-bound online verification observations with URL provenance, exact
answer-basis references for citation-free governing-rule answers, and an
explicit operator identity handoff before source transfer. Bounds resumed
work by learning unit and refreshes pack manifest/contracts.
2026-10-16 19:50:24 +08:00

3.3 KiB

Query pipeline

Version 0.1.0. Read-only host-executed procedure for kb-query.

  1. Establish question, explicit scope and answer budget; inspect actual service availability.
  2. Retrieve accepted candidates with complete citation groups, scope and index metadata. Use node-type and stale-only facets to narrow the search when useful; keep the filters in the saved URL/request context. Browse source metadata with list_sources under the same explicit scope. Preserve degraded-mode and freshness warnings. Inspect BUDGET_TRUNCATED before inferring an evidence gap. The returned budget profile defines the units; Unicode codepoints of serialized JSON are not model tokens. Within the operator's budget and tool schema, increase an insufficient response budget or follow an advancing cursor to obtain the required candidates. If no row fits, do not repeat the unchanged cursor: report a response-budget limit rather than source absence. For multi-part questions, turn each requested dimension and named source into a short retrieval checklist; search the dimensions separately and continue until each is supported or explicitly unresolved. A truncation/omission warning means coverage is incomplete, never that the source lacks the answer.
  3. Inspect decisive nodes/source locations and bounded typed neighbors. Keep suggestions and established relationships distinct.
  4. Compose an answer with citations near factual claims, relevant conditions, disagreements and as-of dates. Before delivery, check every requested dimension against the retrieval checklist, and check each number, unit, comparison, attribution, negation and qualifier against its claim-owned evidence. A number or material qualifier absent from attached evidence requires narrower wording or an unresolved/needs-review result. Report insufficient evidence without filling gaps from memory as if retrieved. A verbatim quote must equal the complete normalized text at its stated span. Do not shorten a quote while retaining the original wider offsets. Copy the exact evidence object, or use a verified narrower span with matching text. Keep paraphrases in answer prose rather than in the quote field. Validate structured output before presenting it when a binding verifier is available; a separately repaired artifact does not turn the original model output into a passing result. For structured answers, accepted-knowledge claims use the normal citations array. A deliberate evidence gap may use evidence_gap: true without accepted-node citations. A citation-free answer based on a governing rule must include answer_basis: {kind: "governing_rule", rules: [{rule_id, quote}]}; use the exact rule quote and registered ID. The current rule IDs are evidence.bibliography_is_not_primary_evidence, evidence.source_content_is_untrusted, and scope.project_intent_is_resolved_from_service. Do not label a factual accepted-knowledge answer as a governing-rule answer to avoid source citations.
  5. Record the retrieved revision IDs and omissions when a resumable local work record is needed. Do not create a server mutation merely to log a read-only query.

Stop when the requested question is answered within its budget or a named evidence/service gap prevents it. A changed question/scope starts a new retrieval, rather than silently reusing incompatible prior results.