Scope Tag
Scope Tag
Section titled “Scope Tag”Definition
Section titled “Definition”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.
Synonyms / Acronyms
Section titled “Synonyms / Acronyms”None.
Baseline values
Section titled “Baseline values”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.
Relationships
Section titled “Relationships”q_a_pairs.scope_tag—text[]NOT NULL DEFAULTARRAY[]::text[]— NATIVE T6 WP1 baseline column (32-q-a-pair.md§2.1); GIN indexidx_q_a_pairs_scope_tagsupports the&&overlap operator.q_a_pairs.anti_scope_tag—text[]NOT NULL DEFAULTARRAY[]::text[]— same NATIVE baseline; GIN indexidx_q_a_pairs_anti_scope_tagsupports the exclusion filterNOT (anti_scope_tag && workspace.scope_tag).workspaces.scope_tag[]— NOT a real column (correction). Noworkspacestable migration adds ascope_tagcolumn;workspacescarries no scope-tag-shaped field at all (verified against the baselineworkspacesDDL). Perq_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 storedworkspacescolumn. 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 fromq_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.
Consumers
Section titled “Consumers”lib/q-a-pairs/sidecar-path.ts— referencesscope_tag/anti_scope_tag.q_a_search,q_a_get_verbatim,question_match_recompute,question_match_searchRPCs (32-q-a-pair.md§5) — read/returnscope_tag/anti_scope_tagfor 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_tagare live NATIVE columns, not a pending schema change (ID-133 BI-4b). - Ratified as the mechanism replacing direct
q_a_pairs.workspace_idFK per Q-OQR1-06 (S235 ratification 14/05/2026). Supersedes both0.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_tagprovides exclusion semantics (“workspace excludes pairs about [internal_only_topic]” without curating every pair).- Empirical foundation (pre-ID-131;
content_item_workspacestable cited below is now DROPPED at M6): prod had 395 q_a_pair rows, ZERO assigned to any workspace via the legacycontent_item_workspacesjunction (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.