Skip to content

Scope Tag

LIVE on q_a_pairs (ID-133 BI-4b correction). q_a_pairs.scope_tag / q_a_pairs.anti_scope_tag are NATIVE text[] NOT NULL DEFAULT ARRAY[]::text[] columns — part of the T6 WP1 baseline q_a_pairs schema, not a re-home and not planned; they were never gated on content_items. The content_items half of the old “planned on content_items and q_a_pairs” framing is moot — content_items never had a scope_tag/anti_scope_tag column, and the table is now DROPPED (ID-131 M6) regardless. CLIENT-DEFINED open vocabulary per §6.2: each client’s scope universe differs (Liam suggested internal-it, production-infrastructure, etc. — these are PHEW examples). Empty by default; admin UI manages.

Critical role: q_a_pairs workspace relevance is computed via scope_tag overlap (with anti_scope_tag exclusion) per Q-OQR1-06 ratification — q_a_pairs are corpus-level with NO direct workspace FK, so scope tag matching is the only mechanism deciding which workspace sees which q_a_pair.

None.

TBD — CLIENT-DEFINED. Empty by default. See source kh-client-feedback.md Item 3 for Phew-specific examples (internal-it, production-infrastructure). No baseline values ship.

  • q_a_pairs.scope_tagtext[] NOT NULL DEFAULT ARRAY[]::text[] — NATIVE T6 WP1 baseline column (32-q-a-pair.md §2.1); GIN index idx_q_a_pairs_scope_tag supports the && overlap operator.
  • q_a_pairs.anti_scope_tagtext[] NOT NULL DEFAULT ARRAY[]::text[] — same NATIVE baseline; GIN index idx_q_a_pairs_anti_scope_tag supports the exclusion filter NOT (anti_scope_tag && workspace.scope_tag).
  • workspaces.scope_tag[] — NOT a real column (correction). No workspaces table migration adds a scope_tag column; workspaces carries no scope-tag-shaped field at all (verified against the baseline workspaces DDL). Per q_a_search’s own signature/comment (32-q-a-pair.md §5), scope filtering is caller-side (scope_tag && caller_scope_tags — the caller supplies the tag set as an RPC parameter), not read from a stored workspaces column. Where the caller sources those tags (workspace config, application_type, or elsewhere) is not resolved by this CV — flagging for owner attention since the prior “workspace-side tags” framing asserted a column that does not exist.
  • q_a_extractions.scope_tags (plural — a DIFFERENT column on a DIFFERENT table, the derived extraction cache, text[] DEFAULT '{}') is adjacent but distinct from q_a_pairs.scope_tag (singular) — do not conflate the two when reading migrations.
  • Adjacent to CV 25 application_type — workspaces of different application_types may use different scope_tag conventions.
  • Layer 5: drives the corpus → workspace matching at query time.
  • lib/q-a-pairs/sidecar-path.ts — references scope_tag/anti_scope_tag.
  • q_a_search, q_a_get_verbatim, question_match_recompute, question_match_search RPCs (32-q-a-pair.md §5) — read/return scope_tag/anti_scope_tag for caller-side overlap filtering.
  • Admin UI for tag management (deferred to v1.1 per Q-OQR1-13).
  • Filter UI for scope-tag-based filtering.
  • MCP search tools — scope_tag as a filter parameter.
  • Status: active — corrected from planned; q_a_pairs.scope_tag/anti_scope_tag are live NATIVE columns, not a pending schema change (ID-133 BI-4b).
  • Ratified as the mechanism replacing direct q_a_pairs.workspace_id FK per Q-OQR1-06 (S235 ratification 14/05/2026). Supersedes both 0.9-intended-architecture.md §4.3 N:1 (workspace_id NOT NULL FK) AND prior onto-doc §4.4 M:N-junction recommendation.
  • anti_scope_tag provides exclusion semantics (“workspace excludes pairs about [internal_only_topic]” without curating every pair).
  • Empirical foundation (pre-ID-131; content_item_workspaces table cited below is now DROPPED at M6): prod had 395 q_a_pair rows, ZERO assigned to any workspace via the legacy content_item_workspaces junction (S234 verified). Q&A pairs function as a corpus, not a workspace-partitioned artefact — unaffected by the M6 drop, since that junction table was never the live mechanism for Q&A anyway.
  • CLIENT-DEFINED — admin UI manages; no baseline values ship.