KH Platform Data Inventory (RAW)
KH Platform Data Inventory (RAW)
Section titled “KH Platform Data Inventory (RAW)”Audit date: 13/05/2026 (S234 Phase B prerequisite 1) Purpose: complete enumeration of every data entity / concept the Knowledge Hub platform deals with today, plus concepts mentioned in docs but not yet built. RESEARCH ONLY — feeds the retrospective ontology mapping in main session. No synthesis of ontology layers (vocabulary/taxonomy/thesaurus/etc.) — that is main session’s job.
Scope reminder (Theme E from feedback-findings-review): applications above workspaces include bids, sector-intelligence, sales-proposals (next), competitor-research (future), training/onboarding (future), product-guides (Phew use case — undetermined whether application or content).
Conventions:
- Canonical names preserved (snake_case for DB tables/columns, camelCase for TypeScript types).
- Lifecycle stages:
active/partially-built/specced-but-not-built/legacy/unclear. - Schema row counts as of 13/05/2026 query against
rovrymhhffssilaftdwd(prod). - Where an entity exists in both DB and TypeScript code, both surfaces are recorded.
§1 — Inventory by domain
Section titled “§1 — Inventory by domain”Domain: Source / binary
Section titled “Domain: Source / binary”Entity: source_documents (table)
Section titled “Entity: source_documents (table)”- Home:
public.source_documents(rows: 0 on prod; backfilled to 20 in S103, since drained). - Description: Tracks uploaded source documents with version history. Each row is a specific version of a binary file (DOCX, PDF, XLSX).
parent_idchain links versions. - Key attributes:
filename,original_filename,mime_type,file_size,content_hash(md5 of raw bytes),version(int),parent_id(self-FK),storage_path(Supabase Storage),status(uploaded/processing/processed/failed),extracted_text,extraction_metadata(jsonb — page count, table count),workspace_id,pipeline_run_id,uploaded_by,archived_at,archived_by. - Relationships:
--(versioned_by self-FK)--> source_documents.parent_id(ON DELETE SET NULL — version chain preserved when parent purged)--(emitted_by)--> pipeline_runs--(scoped_to)--> workspaces--(uploaded_by)--> auth.users--(produces)--> content_items.source_document_id--(produces)--> source_document_diffs.{old,new}_document_id
- Application served: cross-cutting (bids primary today via DOCX/PDF tender uploads; sector-intelligence does not use it; future apps inherit).
- Lifecycle stage:
partially-built— table specced + RLS shipped, but 0 prod rows (per Finding 01: upload-route silent-fail atapp/api/upload/route.ts:444-447AND platform-not-live). Under cocoindex Scenario A → Option α (slim-and-keep) retiring versioning cols; Option β drops entirely.
Entity: source_document_diffs (table)
Section titled “Entity: source_document_diffs (table)”- Home:
public.source_document_diffs(rows: 0). - Description: Q&A pair-level diffs between two source_documents versions. Each row = one matched-or-unmatched pair across versions.
- Key attributes:
old_document_id/new_document_id(FKs CASCADE),diff_type(added/removed/modified/unchanged),diff_mode— CHECK enum 2 values:qa, full_text(Layer-1 CV — relevant to Theme C edit_intent + Theme D cocoindex ops-DB ledger),old_content,new_content,old_question,new_question,similarity_score,affected_content_item_id,status(pending_review/applied/dismissed),reviewed_at,reviewed_by. - Relationships:
--(compares)--> source_documents(×2)--(affects)--> content_items(SET NULL)
- Application served: bids (Q&A pair re-upload diff review); future apps as forms are introduced.
- Lifecycle stage:
partially-built— depends on source_documents fill. Likely retires under cocoindex Scenario A (cocoindex ops-DB ledger + source-key history covers).
Entity: extracted_text / extraction metadata (column-level concept on source_documents)
Section titled “Entity: extracted_text / extraction metadata (column-level concept on source_documents)”- Home:
source_documents.extracted_text(text) +source_documents.extraction_metadata(jsonb: page_count, table_count, etc.). - Description: Full extracted text used for diffing; binary extraction signals.
- Lifecycle stage:
activefor spec, currently unused.
Entity: storage_path / Supabase Storage bucket (external)
Section titled “Entity: storage_path / Supabase Storage bucket (external)”- Home: Supabase Storage (bucket name implicit in
storage_pathcolumn). - Description: Raw binary file storage for uploaded source documents and bid templates.
- Lifecycle stage:
activefor templates (template uploads); platform-not-live for source_documents.
Entity: external folder canonical (specced, not built)
Section titled “Entity: external folder canonical (specced, not built)”- Home: Planned (per
0.9-intended-architecture.md§5;workspaces.canonical_folder_path+ adapter classes). - Description: External-folder model — LocalFS / SharePoint / Notion / Google Drive / Dropbox / Box. Folder is canonical; DB is materialised index.
- Lifecycle stage:
specced-but-not-built— v1 LocalFS only.
Domain: Content
Section titled “Domain: Content”Entity: content_items (table)
Section titled “Entity: content_items (table)”- Home:
public.content_items(rows: 629 on prod). - Description: Core knowledge base content with progressive depth layers (brief/detail/reference), classification, embeddings, freshness, governance, lifecycle, dedup state, supersession, owner. Single canonical record per knowledge artefact (“one record, many views”).
- Key attributes:
- Identity:
id,title,content,source_url,source_domain,source_file,source_document_id(FK),source_document(legacy text — to be retired),parent_id(self-FK for hierarchy),file_path,thumbnail_url. - Classification:
content_type(15-value enum: article, blog, pdf, note, research, other, q_a_pair, case_study, policy, certification, compliance, methodology, capability, product_description, document),platform(web/email/manual/upload/extraction/other),primary_domain,primary_subtopic,secondary_domain,secondary_subtopic,classification_confidence,classified_at,classification_reasoning,suggested_title,summary(renamed from ai_summary),ai_keywords,summary_data(jsonb),layer(FK→layer_vocabulary.key). - Progressive depth:
brief,detail,reference. - Q&A-specific (slated to move out per Q3):
answer_standard,answer_advanced. - Embedding:
embeddingvector(1024),embedding_model,embedding_tokens. - User signal:
user_tags,priority,starred,notes. - Lifecycle:
captured_date,freshness(fresh/aging/stale/expired),previous_freshness,freshness_checked_at,lifecycle_type(evergreen/date_bound/regulation/bid_discovered),expiry_date. - Governance:
publication_status(draft/in_review/published/archived),governance_review_status(pending/approved/reverted/changes_requested/review_overdue),governance_review_due,governance_reviewer_id,verified_at,verified_by,next_review_date,review_cadence_days,content_owner_id,archived_at,archived_by,archive_reason. - Quality:
quality_score,previous_quality_score,quality_score_updated_at. - Dedup / supersession:
content_text_hash(GENERATED ALWAYS),dedup_status(clean/suspected_duplicate/confirmed_duplicate/confirmed_unique/superseded),superseded_by(self-FK). - Citation:
citation_count. - Provenance / source:
ingest_source(manual, url_import, upload, upload_autosplit, mcp_create, rss_feed, bid_outcome_integration, python_url, python_markdown, qa_import, batch_reclassify),source_bid(FK→workspaces — legacy). - Telemetry:
classification_model,classification_tokens_in/_out/_cache_creation_tokens/_cache_read_tokens. - JSONB:
metadata(see §36 of SCHEMA-QUICK-REFERENCE — keys: layer, topic_id, starred, source_file, source_folder, source_document, ingestion_source, original_format, original_filename, file_size, mime_type, import_batch, batch_tag, reader_html, extracted_images, images_extracted_at, page_count, tables, table_count, chapters, section_name, table_index, row_index, has_standard, has_advanced, extraction_failed).
- Identity:
- Relationships:
--(M:N via content_item_workspaces)--> workspaces--(N:1)--> source_documents--(self-FK)--> content_items.parent_id(hierarchical)--(self-FK)--> content_items.superseded_by--(1:N)--> content_history--(1:N)--> content_chunks--(1:N)--> entity_mentions--(1:N)--> citations / content_citations(as cited)--(1:N)--> ingestion_quality_log--(1:N)--> read_marks--(1:N)--> classification_disputes--(1:N)--> verification_history--(N:1)--> auth.users(content_owner_id, created_by, updated_by, archived_by, verified_by)--(produces via feed_articles.content_item_id)--> feed_articles(intelligence flow)
- Application served: cross-cutting — bids (Q&A library), sector-intelligence (passed articles), sales-proposals (planned), training (planned), product-guides (Phew content).
- Lifecycle stage:
active. Per Q1 of intended-architecture: REFINE in place (54 cols KEEP, 13 AMBIGUOUS, dropq_a_paircontent_type post Q3 split). Wide table; substantial.
Entity: content_history (table)
Section titled “Entity: content_history (table)”- Home:
public.content_history(rows: 1223). - Description: Immutable version snapshots of content_items. INSERT-only — no UPDATE or DELETE. Rows are written by app code (
lib/governance/content-history.ts+ related), with version assigned by triggerauto_version_content_history()on INSERT. Triggerensure_v1_history_at_commit()guarantees every content_item has a v1 history row at commit time. Triggerenforce_archive_state_consistency()enforces the archive-state invariant (publication_status='archived' ↔ archived_at IS NOT NULL) oncontent_items(not on this table — included here for the surrounding lifecycle picture). - Key attributes:
content_item_id(SET NULL — preserves audit),version(monotonic per item, set by trigger),titlesnapshot,contentsnapshot,brief/detail/referencesnapshots,metadatasnapshot,change_summary,change_reason,created_by,change_type— CHECK enum has 11 valid values:create, edit, ai_update, import, merge, rollback, archive, delete, metadata_change, owner_change, publication_state. 5 in active prod use (verified S234):archive, create, edit, metadata_change, owner_change. - Relationships:
--(N:1)--> content_items. - Application served: cross-cutting (audit trail / governance / change reports / ‘reorient me’).
- Lifecycle stage:
active. Finding 01 proposes extending withop_idfor rollback cohesion.
Entity: content_chunks (table)
Section titled “Entity: content_chunks (table)”- Home:
public.content_chunks(rows: 924). - Description: Heading-based chunks of content_items, each with its own embedding. Supports sub-document semantic search.
- Key attributes:
content_item_id(CASCADE),heading_text,heading_level,heading_path(array),content,position,parent_chunk_id(self-FK),embeddingvector,char_count,word_count. - Relationships:
--(N:1 CASCADE)--> content_items;--(self-FK)--> content_chunks.parent_chunk_id. - Application served: cross-cutting (chunk-level search; planned citation anchor per
citations.cited_chunk_id). - Lifecycle stage:
active. Per Q1.5: KEEP shape, extend withchunk_kindenum (heading-section / qa-block / paragraph).
Entity: ingestion_quality_log (table)
Section titled “Entity: ingestion_quality_log (table)”- Home:
public.ingestion_quality_log(rows: 0). - Description: Data quality flags raised during ingestion or quality scans (e.g. missing_title, duplicate_url).
- Key attributes:
content_item_id,flag_type,severity(warning/error),details(jsonb),resolved,resolved_at,resolved_by,resolution_notes,ingestion_batch,source_url. - Relationships:
--(N:1)--> content_items. - Application served: cross-cutting (review queue, quality dashboard).
- Lifecycle stage:
active(table) /unclear-utilisation(0 prod rows currently).
Entity: read_marks (table)
Section titled “Entity: read_marks (table)”- Home:
public.read_marks(rows: 8). - Description: Per-user read tracking. RLS-scoped to user_id.
- Key attributes:
content_item_id,read_at,source(manual/etc.),user_id. - Relationships:
--(N:1)--> content_items;--(N:1)--> auth.users. - Application served: cross-cutting UX (browse “unread” filter, ‘reorient me’).
- Lifecycle stage:
active.
Entity: verification_history (table)
Section titled “Entity: verification_history (table)”- Home:
public.verification_history(rows: 0). - Description: SME verification events on content_items — verify, unverify, flag actions.
- Key attributes:
content_item_id,action_type,note,performed_by,performed_at. - Relationships:
--(N:1)--> content_items;--(N:1)--> auth.users. - Application served: cross-cutting governance.
- Lifecycle stage:
active(specced + UI wired); empty in prod (platform not live).
Entity: classification_disputes (table)
Section titled “Entity: classification_disputes (table)”- Home:
public.classification_disputes(rows: 0). - Description: User/admin disputes of AI classification decisions. Stub tab in Wave A; full HITL workflow in Wave C.
- Key attributes:
content_item_id(CASCADE),disputed_by,disputed_field(primary_domain / primary_subtopic / secondary_domain / secondary_subtopic / primary_layer / content_type / entity_type),current_value(jsonb snapshot),proposed_value(jsonb),rationale(text >= 10 chars),status(open/resolved/rejected),resolved_by,resolved_at,resolution_notes. - Relationships:
--(N:1 CASCADE)--> content_items;--(N:1 SET NULL)--> user_profiles(viadisputed_by+resolved_by— FKs target theuser_profilesmirror, notauth.usersdirectly). - Application served: cross-cutting governance / quality-feedback loop.
- Lifecycle stage:
partially-built(table + RLS shipped; UI partial).
Entity: content_templates (table)
Section titled “Entity: content_templates (table)”- Home:
public.content_templates(rows: 0). - Description: Content creation templates that pre-fill the create form with suggested structure and metadata. (NB: distinct from
templates— bid document templates.) - Key attributes:
slug(UNIQUE),name,description,content_type,title_template,content_template,brief_template,suggested_domain,default_tags,display_order,is_active. - Relationships: standalone; logical link to
content_items.content_type. - Application served: cross-cutting (content authoring).
- Lifecycle stage:
active(shipped, empty).
Entity: dedup_status (state machine on content_items)
Section titled “Entity: dedup_status (state machine on content_items)”- Home: column on
content_items.dedup_status. - Description: Lifecycle state machine:
clean → suspected_duplicate → {confirmed_duplicate, confirmed_unique, superseded}. Implemented S183/S184/S186. - Lifecycle stage:
active.
Entity: superseded_by (supersession pointer)
Section titled “Entity: superseded_by (supersession pointer)”- Home:
content_items.superseded_byself-FK + helperlib/supersession/set.ts. - Description: Points to the newer row that replaces this one. Search hides superseded rows by default unless
include_superseded=true. - Lifecycle stage:
active.
Domain: Q&A / extraction
Section titled “Domain: Q&A / extraction”Entity: q_a_pair (current — content_type variant of content_items)
Section titled “Entity: q_a_pair (current — content_type variant of content_items)”- Home:
content_items.content_type='q_a_pair'(395 rows as of S234 — earlier claims of 387 were slightly stale). - Description: Today Q&A pairs are stored as content_items rows of type
q_a_pair, withanswer_standardandanswer_advancedcolumns +metadata.has_standard/metadata.has_advanced. - Key attributes (in content_items shape):
title= question,content= answer body,answer_standard,answer_advanced, plus all classification/governance/lifecycle. - Relationships: all
content_itemsrelationships apply; matched viabid_questions.matched_content_ids. - Application served: bids (citation, drafting); planned: sales-proposals, training, competitor-research.
- Lifecycle stage:
legacy(current shape) → migrating to dedicatedq_a_pairsdomain table per Q1.3 + Q1.4 + Q3.1 (S16 spike). Form-agnostic generalisation under Theme A.
Entity: q_a_pairs (planned — dedicated domain table)
Section titled “Entity: q_a_pairs (planned — dedicated domain table)”- Home: Planned per
0.9-intended-architecture.md§4.3. S235 ratified shape supersedes that doc’s §4.3 N:1 sketch per Q-OQR1-06 — see ontology pipeline §4.4 for canonical shape. - Description: First-class Q&A pair table separated from content_items corpus. Question + standard answer + advanced answer + provenance + scope + temporal validity. Corpus-level (NOT workspace-scoped) per Q-OQR1-06 ratification 14/05/2026 — workspace relevance computed at query time via
scope_tagoverlap. - Key attributes (proposed, S235 ratified):
source_workspace_id(NULLABLE — provenance audit only, e.g. captures originating workspace fororigin_kind='derived_from_bid_response'),question_text,answer_standard,answer_advanced,source_content_item_id,source_chunk_id,origin_kind(extracted_from_corpus/curated_explicit/derived_from_bid_response/imported_legacy),question_embeddingvector(1024),primary_domain,primary_subtopic,scope_tag[],anti_scope_tag[],valid_from,valid_to,confidence,verified_at,verified_by,governance_review_status,archived_at. NO directworkspace_idFK (supersedes0.9-intended-architecture.md§4.3workspace_id UUID NOT NULLsketch).private_to_workspace_iddeferred to v1.1 per Q-OQR1-08. - Relationships:
--(N:1 NULLABLE)--> workspacesviasource_workspace_id(audit only)--(N:1)--> content_items(source provenance)--(N:1)--> content_chunks(source chunk)--(cited_via)--> citations.cited_q_a_pair_id--(matched_via)--> question_matches.matched_q_a_pair_id(renamed S234 frombid_question_matchesper OQ-Q113-C;question_kinddiscriminator aligns withform_types)
- Application served: procurement primary (per Q-OQR1-02 procurement rename); planned for sales_proposal, training_onboarding, competitor_research.
- Lifecycle stage:
specced-but-not-built. S231 OQ10 ratified: predetermined-markdown YAML-frontmatter shape pre-ingestion. Form-agnostic per Theme A. Workspace relevance via scope_tag overlap query, NOT FK (per S235 §4.4 — empirically 0/395 prod q_a_pair rows assigned to workspaces today).
Entity: q_a_extractions (planned — derived cache)
Section titled “Entity: q_a_extractions (planned — derived cache)”- Home: Planned per
0.9-intended-architecture.md§4.3. - Description: Cache for “derive Q&A from corpus on demand” — populated by ingest-time mempalace miner / cocoindex flow. May be promoted to first-class q_a_pairs via curator approval.
- Key attributes (proposed):
source_content_item_id,source_chunk_id,question_text,answer_text,question_embedding,extractor_kind(mempalace_miner/cocoindex_pattern_a/cocoindex_pattern_b/llm_extraction/prior_bid_response),extraction_confidence,promoted_to_pair_id,invalidated_at. - Relationships:
--(N:1)--> content_items--(N:1)--> content_chunks--(promoted_to)--> q_a_pairs
- Application served: cross-cutting (any app that retrieves Q&A on demand).
- Lifecycle stage:
specced-but-not-built. Finding 02 §3.2 round-trip diagram references it.
Entity: Q&A detection (code-level concept)
Section titled “Entity: Q&A detection (code-level concept)”- Home:
lib/quality/qa-detection.ts— Pattern A (explicit table Q/A), Pattern B (heading-based), Pattern C (list/text). - Description: Detection types
DetectedQAPair,DetectionSource(table/list/heading/text),DetectionConfidence(high/medium/low). Output ofextract_tender_questions.py(PDF) and DOCX scanners. - Lifecycle stage:
active(used by bid library imports); Q3.5 future:PENDING-ARCH— retire vs repurpose (B1 in 00-synthesis is BLOCKING).
Entity: Q&A library ingest helpers (code)
Section titled “Entity: Q&A library ingest helpers (code)”- Home:
lib/bid-library-ingest/(docx-to-markdown.ts, extract-answer.ts, extract-qa-pairs.ts, resolve-question.ts). - Description: Bid-library import tools that parse Phew DOCX → markdown → Q&A pairs in content_items. Pattern A/B/C parser implementations.
- Lifecycle stage:
legacy— planned rename tolib/qa-mining/(Q3.5 + Q5.9); contradiction B1 in 00-synthesis on whether to retire entirely.
Entity: scripts/qa-migration/ (planned one-shot tooling)
Section titled “Entity: scripts/qa-migration/ (planned one-shot tooling)”- Home: Planned per OQ10 ratification.
- Description: One-shot scripts to migrate existing Phew historical Q&A shapes (5 catalogued in S16 §4) to the predetermined markdown YAML-frontmatter shape.
- Lifecycle stage:
specced-but-not-built.
Entity: predetermined markdown YAML-frontmatter Q&A shape (specced)
Section titled “Entity: predetermined markdown YAML-frontmatter Q&A shape (specced)”- Home: v1 canonical Q&A wire format pre-ingestion per OQ10 ratification.
- Description: YAML-frontmatter per Q&A pair (one file per pair). Defines question, answer_standard, answer_advanced, scope_tags, etc.
- Lifecycle stage:
specced-but-not-built— gates Finding 02 sidecar v1 promotion (I3 in 00-synthesis).
Domain: Workspace + types
Section titled “Domain: Workspace + types”Entity: workspaces (table)
Section titled “Entity: workspaces (table)”- Home:
public.workspaces(rows: 4 — alltype='intelligence'). - Description: Generic container with
typediscriminator. S235 ratified per Q-OQR1-01 Option (c):workspaces.typetext column retires; replaced byworkspaces.application_type_idFK to newapplication_typestable (rich config table withprovenanceenum per Q-OQR1-11).color+iconcolumns are residue from a prior UI in whichworkspaceswas a bid-instance-specific primitive; per-instance customisation retained. - Key attributes (current state):
name,description,color,icon,is_archived,type— CHECK enum 3 DB values:bid, kb_section, intelligence.kb_sectionretires entirely per Q-OQR1-S235 (zero prod rows; not in 6-baseline core list). Code registry additionally referencesproposal-placeholder(not in DB CHECK — source pointer needed).domain_metadata(jsonb — type-specific; columns promote toprocurement_workspacessatellite per Finding 05 Option B),status— CHECK enum is the 10BID_STATESverbatim. S235 rename per Q-OQR1-02:BID_STATES→PROCUREMENT_WORKFLOW_STATES;projects_status_checkCHECK gets renamed accordingly. State-machine code:lib/bid/bid-state-machine.ts→lib/procurement/procurement-workflow.tsper Q-OQR1-05. - Key attributes (S235 ratified post-migration):
name,description,color,icon(per-instance customisation — preserved),is_archived,application_type_id(FK →application_types.id— replacestypetext column),domain_metadata(deprecated; promoting to per-application_type satellite tables),status(constrained byapplication_types.state_machine_nameper row). New nullable columnscope_tag[]for q_a_pair scope overlap queries per Q-OQR1-06. - Relationships:
--(M:N via content_item_workspaces)--> content_items--(1:N)--> bid_questions.project_id(legacy column name)--(1:N)--> templates.project_id(legacy column name)--(1:N)--> source_documents.workspace_id--(1:N)--> feed_sources.workspace_id--(1:N)--> feed_prompts.workspace_id--(1:N)--> feed_articles.workspace_id--(1:N)--> si_processing_queue.workspace_id--(1:N)--> pipeline_runs.workspace_id--(1:1 logical)--> mempalace wing(per Finding 03 Q4.5: wing = workspace_id)
- Application served: all applications (bids, sector-intelligence, sales-proposals, etc.).
- Lifecycle stage:
active. Per Q1.13 + Finding 03: KEEP Shape B (single workspaces + type discriminator + per-type satellites).project_id→workspace_idrename pending (Q5.5).
Entity: content_item_workspaces (junction table)
Section titled “Entity: content_item_workspaces (junction table)”- Home:
public.content_item_workspaces(rows: 81). - Description: Many-to-many junction linking content items to workspaces.
- Key attributes:
content_item_id(CASCADE),workspace_id(CASCADE),assigned_at. - Application served: cross-cutting.
- Lifecycle stage:
active.
Entity: application_types (planned — S235 ratified new table)
Section titled “Entity: application_types (planned — S235 ratified new table)”- Home: Planned per Q-OQR1-01 Option (c) hybrid + Q-OQR1-11 provenance pattern (S235 ratified 14/05/2026).
- Description: Rich config table for application kinds. Replaces
workspaces.typetext column. Workspaces FK to this table. - Key attributes (proposed):
key(unique slug — e.g.procurement,intelligence,sales_proposal),label,description,route_path(e.g./procurement/),default_color,default_icon,default_template_ids(uuid[]) — or junction table for “all bid workspaces share this template set” per Liam,state_machine_name(e.g.procurement_workflow),state_machine_config(jsonb — sub-state semantics per-form_type override per Q-OQR1-15),provenanceenum (core/client/recommendedper Q-OQR1-11),is_active,display_order,client_extensibleflag,editable_viaenum (database_migration/admin_ui/seed_data). - Relationships:
--(1:N)--> workspaces(workspace.application_type_id FK)--(1:N optional)--> form_templates(default template set)
- Application served: cross-cutting platform primitive.
- Lifecycle stage:
specced-but-not-built. 6 baselinecoreseed rows ratified (Q-OQR1-03 14/05/2026): procurement, intelligence, sales_proposal, product_guide, competitor_research, training_onboarding.
Entity: procurement_workspaces (planned — workspace_type satellite, renamed from bid_workspaces S235)
Section titled “Entity: procurement_workspaces (planned — workspace_type satellite, renamed from bid_workspaces S235)”- Home: Planned per Finding 05 Option B (vs Option A typed-on-workspaces).
- Description: Per-application_type satellite for
workspaces.application_type_idmatchingprocurementrow. Promotes 6+ JSONB fields (buyer, deadline, submission_date, outcome, outcome_recorded_at, outcome_recorded_by, optionally evaluator_score — verified existing column on bid_responses per S235 WP1 — and evaluator_feedback) fromdomain_metadatato typed columns. Renamed S235 per Q-OQR1-02 procurement-rename ratification. - Relationships:
--(1:1)--> workspaces(where application_type=‘procurement’). - Application served: procurement (bid/RFP/PQQ/ITT/framework/DPS/G-Cloud form_types).
- Lifecycle stage:
specced-but-not-built— I1 in 00-synthesis pending implementation.
Entity: sales_proposal_workspaces / competitor_research_workspaces / training_onboarding_workspaces / product_guide_workspaces (future satellites)
Section titled “Entity: sales_proposal_workspaces / competitor_research_workspaces / training_onboarding_workspaces / product_guide_workspaces (future satellites)”- Home: Planned per Theme E / Finding 03 Shape B pattern + Q-OQR1-03 baseline core list.
- Description: Per-application_type satellite tables (mirror of
procurement_workspaces) for the other 5 baseline core application_types. Each ships as needed when the application reaches readiness; theapplication_typesrow exists from day 1. - Lifecycle stage:
specced-but-not-built(future).
Entity: workspaces.canonical_folder_path + adapter (planned)
Section titled “Entity: workspaces.canonical_folder_path + adapter (planned)”- Home: Planned per
0.9-intended-architecture.md§4.5 + §5.4. - Description: External-folder canonical config —
canonical_folder_path,canonical_folder_kind(localfs/sharepoint/notion/google_drive/dropbox/box/manual_upload_only),canonical_folder_config(jsonb),folder_watcher_status,last_folder_sync_at. - Lifecycle stage:
specced-but-not-built(v1 LocalFS only).
Entity: BidState / workspace status pipeline
Section titled “Entity: BidState / workspace status pipeline”- Home:
types/bid.tsBID_STATESconst tuple. - Description: 10-state state machine for bid workspaces: draft → questions_extracted → matching → drafting → in_review → ready_for_export → submitted → won → lost → withdrawn.
- Lifecycle stage:
active(used bylib/bid/bid-state-machine.ts).
Domain: Bid
Section titled “Domain: Bid”Entity: bid_questions (table)
Section titled “Entity: bid_questions (table)”- Home:
public.bid_questions(rows: 0). - Description: Extracted tender questions belonging to a bid workspace.
- Key attributes:
project_id(legacy → workspaces FK),section_name,section_sequence,question_sequence,question_text,word_limit,evaluation_weight,confidence_posture(strong_match/partial_match/needs_sme/no_content),matched_content_ids(uuid[] — legacy inline cache; per Q1.12 moves to bid_question_matches),status— CHECK enum has 7 values:pending, in_progress, drafted, reviewed, final, skipped, complete(verified S234 — NOTnot_started/ai_drafted/needs_reviewas previously claimed),has_variants,template_requirement_id(FK),assigned_to,created_by. - Relationships:
--(N:1)--> workspaces(via project_id)--(N:1)--> template_requirements--(1:N)--> bid_responses--(1:N)--> bid_question_matches(planned)
- Application served: bids.
- Lifecycle stage:
activeschema; empty in prod (not live).
Entity: bid_responses (table)
Section titled “Entity: bid_responses (table)”- Home:
public.bid_responses(rows: 0). - Description: AI-drafted and human-edited responses to bid questions. Versioned via bid_response_history.
- Key attributes:
question_id,response_text,response_text_advanced,source_content_ids(uuid[]),review_status(draft/review/approved/rejected/ai_drafted/edited/needs_review),drafted_by,last_edited_by,approved_by,metadata(jsonb — citations_data/quality_data/ai_metadata perbid-metadata.ts),version,overall_score(numeric 0-100 with CHECK constraint — already-exists column; Finding 05’s “extend with evaluator_score” must avoid duplicating this). - Relationships:
--(N:1)--> bid_questions--(1:N)--> bid_response_history--(1:N)--> content_citations
- Application served: bids.
- Lifecycle stage:
activeschema; empty in prod.
Entity: bid_response_history (table)
Section titled “Entity: bid_response_history (table)”- Home:
public.bid_response_history(rows: 0). Append-only. - Description: Versioned snapshots of bid_responses.
- Key attributes:
response_id,version,response_text,response_text_advanced,source_content_ids,review_status,change_reason,edited_by,metadata. - Relationships:
--(N:1)--> bid_responses. - Application served: bids; future:
outcome_signalextension per Finding 05. - Lifecycle stage:
active.
Entity: BidMetadata (TS type)
Section titled “Entity: BidMetadata (TS type)”- Home:
types/bid.ts+lib/validation/schemas.tsparseBidMetadata(). - Description: TypeScript shape for
workspaces.domain_metadataJSONB whentype='bid'. Contains buyer, status, deadline, reference_number, estimated_value, tender_source, tender_document_ids, submission_date, outcome, outcome_notes, notes, outcome_recorded_at, outcome_recorded_by. - Lifecycle stage:
active. Finding 05: 6-9 fields promote to typed columns onbid_workspacessatellite.
Entity: TenderDocument (TS type)
Section titled “Entity: TenderDocument (TS type)”- Home:
types/bid.ts. - Description: Per-bid tender document reference inside
domain_metadata. Has path, filename, size, mime_type, uploaded_at. - Lifecycle stage:
active(parked in JSONB).
Entity: TenderExtractedMetadata (TS type)
Section titled “Entity: TenderExtractedMetadata (TS type)”- Home:
types/bid-metadata.ts. - Description: Output of tender-extraction step (buyer_name, deadline, reference_number, estimated_value, title, confidence).
- Lifecycle stage:
active.
Entity: BidQuestionStats (TS type / aggregation)
Section titled “Entity: BidQuestionStats (TS type / aggregation)”- Home:
types/bid.ts. - Description: Aggregate of question status: total_questions, strong/partial/needs_sme/no_content/unmatched/drafted/complete counts.
- Lifecycle stage:
active(derived from bid_questions).
Entity: KBCandidate (TS type)
Section titled “Entity: KBCandidate (TS type)”- Home:
types/bid.ts. - Description: Bid-response → KB promotion candidate. Has
recommendationenum: new_entry / update_existing / skip. - Lifecycle stage:
active(UC-C outcome → corpus integration; Finding 05).
Entity: bid drafting state machine
Section titled “Entity: bid drafting state machine”- Home:
lib/bid/bid-state-machine.ts. - Description: Validates transitions across the 10 BID_STATES.
- Lifecycle stage:
active.
Entity: bid export pipelines (DOCX / XLSX / JSON)
Section titled “Entity: bid export pipelines (DOCX / XLSX / JSON)”- Home:
lib/bid/bid-export-{docx,xlsx,data,types}.ts. - Description: Exporters for tender-template-mapped DOCX, summary XLSX, and JSON.
- Lifecycle stage:
active.
Domain: Sector intelligence
Section titled “Domain: Sector intelligence”Entity: company_profiles (table)
Section titled “Entity: company_profiles (table)”- Home:
public.company_profiles(rows: 1). - Description: Anchors intelligence configuration to a client’s business context. Used by relevance scoring.
- Key attributes:
name,slug,description,website_url,sectors(text[]),services(text[]),certifications(text[]),geographic_scope(text[]),competitors(jsonb —[{name, website_url, notes, monitoring_priority}]),target_customers,value_proposition,key_topics(text[]),is_active(bool),is_primary(bool),company_embedding(vector). No UNIQUE constraint onslugexists in the actual schema (S234 verification §1.2 line 350) — add a migration if uniqueness is intended. - Relationships: logical anchor (no FK from intelligence tables today; scoping is by workspace).
- Application served: sector-intelligence; possible reuse by competitor-research and sales-proposals.
- Lifecycle stage:
active.
Entity: feed_sources (table)
Section titled “Entity: feed_sources (table)”- Home:
public.feed_sources(rows: 26). - Description: RSS / Atom / web sources per intelligence workspace.
- Key attributes:
workspace_id(CASCADE),name,url,source_type(rss/web/api),polling_interval_minutes,last_polled_at,last_polled_status(success/error/timeout/not_modified),last_polled_error,etag,last_modified,consecutive_failures,article_count,is_active. - Application served: sector-intelligence.
- Lifecycle stage:
active.
Entity: feed_prompts (table)
Section titled “Entity: feed_prompts (table)”- Home:
public.feed_prompts(rows: 4). - Description: Versioned filtering prompts per intelligence workspace. Used by Pass 2 relevance scoring (Claude).
- Key attributes:
workspace_id(CASCADE),prompt_text,version(UNIQUE per workspace),is_active,change_notes,performance_snapshot(jsonb — pass_rate/flag_rate/articles_scored). - Application served: sector-intelligence.
- Lifecycle stage:
active.
Entity: feed_articles (table)
Section titled “Entity: feed_articles (table)”- Home:
public.feed_articles(rows: 410). - Description: Every ingested article (passed and filtered) with relevance scoring audit trail.
- Key attributes:
workspace_id,feed_source_id,external_url(UNIQUE per workspace viaidx_feed_articles_dedup),external_id,title,raw_content,ai_summary(intentionally separate fromcontent_items.summary),relevance_score,relevance_category(high/medium/low/irrelevant),relevance_reasoning,matched_categories(text[]),passed(bool),prompt_version_id,content_item_id(SET NULL — promotion to KB),extraction_method— CHECK enum 5 values:rss_content, fetch, jina_reader, firecrawl, summary_fallback(Layer-1 CV — relevant to0.9-context.md§7.5 “drop Firecrawl” planning),published_at,ingested_at,created_at,updated_at. - Relationships:
--(N:1)--> feed_sources--(N:1)--> feed_prompts(prompt_version_id)--(N:1)--> content_items(when promoted)--(1:N)--> feed_flags
- Application served: sector-intelligence.
- Lifecycle stage:
active.
Entity: feed_flags (table)
Section titled “Entity: feed_flags (table)”- Home:
public.feed_flags(rows: 2). - Description: False positive / false negative feedback on feed_articles. Feeds prompt refinement workflow.
- Key attributes:
feed_article_id(CASCADE),flag_type(false_positive/false_negative),flagged_by,notes,resolved,resolved_by,resolved_at,resolved_notes,resolution_type(addressed/dismissed),prompt_version_id. - Application served: sector-intelligence.
- Lifecycle stage:
active.
Entity: si_processing_queue (table)
Section titled “Entity: si_processing_queue (table)”- Home:
public.si_processing_queue(rows: 2144). - Description: SEPARATE queue table for intelligence pipeline jobs (distinct from
processing_queuewhich serves template / batch / markdown jobs). - Key attributes:
workspace_id,feed_source_id,status,started_at,completed_at,error_message,articles_found,articles_new,articles_passed. - Application served: sector-intelligence.
- Lifecycle stage:
active.
Entity: SI pipeline domain types (code)
Section titled “Entity: SI pipeline domain types (code)”- Home:
lib/intelligence/types.ts. - Description:
ParsedFeedItem,PollResult,ExtractionResult,RelevanceResult,PreFilterResult,FeedProcessingResult,PipelineRunResult,CompanyContext. Constants:PIPELINE_SYSTEM_USER_ID,MIN_CONTENT_WORDS,EMBEDDING_PRE_FILTER_THRESHOLD,DEFAULT_RELEVANCE_THRESHOLD. - Application served: sector-intelligence.
- Lifecycle stage:
active.
Entity: intelligence rescoring / prompt refinement
Section titled “Entity: intelligence rescoring / prompt refinement”- Home:
lib/intelligence/flag-analyser.ts+types/intelligence-refinement.ts. - Description: Analyse flags → preview prompt change → resolve flags. Types:
AnalyseFlagsRequest/Response,RescoringPreviewRequest/Response,ResolveFlagsRequest/Response,FlagAnalysisResult,RescoringPreviewResult,FlagResolutionType. - Lifecycle stage:
active.
Entity: RSS generator (public feed output)
Section titled “Entity: RSS generator (public feed output)”- Home:
lib/intelligence/rss-generator.ts. - Description: Public RSS 2.0 feed of passed articles per workspace, plus separate feed of near-miss filtered articles for tuning.
- Lifecycle stage:
active.
Domain: Templates / forms
Section titled “Domain: Templates / forms”Entity: templates (table)
Section titled “Entity: templates (table)”- Home:
public.templates(rows: 0). - Description: Uploaded document templates belonging to a bid workspace (DOCX/XLSX/PDF). Per Q3.11 / Finding 03 rename →
bid_templates. - Key attributes:
project_id(legacy → workspaces FK),name,description,filename,mime_type,file_size,storage_path,structure_path(JSON),status,field_count,mapped_count. - Relationships:
--(N:1)--> workspaces--(1:N)--> template_fields--(1:N)--> template_completions
- Application served: bids.
- Lifecycle stage:
activeschema; empty in prod. Theme A generalisation: →form_templateswithform_type(bid/RFP/PQQ/checklist).
Entity: template_fields (table)
Section titled “Entity: template_fields (table)”- Home:
public.template_fields(rows: 0). - Description: Individual fields within a document template, linked to bid_questions.
- Key attributes:
template_id,field_type— CHECK enum 3 values:empty_cell, placeholder, highlighted(verified S234 — NOTtable_cell),sequence,section_name,placeholder_text,question_text,question_id(FK bid_questions),mapping_status— CHECK enum 5 values:unreviewed, confirmed, rejected, manual, unmapped(verified S234 — NOTauto_mapped),mapping_confidence,fill_status(pending/filled/skipped/failed),fill_error,word_limit,table_index/row_index/col_index. - Application served: bids; future: any form type.
- Lifecycle stage:
active(empty).
Entity: template_completions (table)
Section titled “Entity: template_completions (table)”- Home:
public.template_completions(rows: 0). - Description: Fill-job completions for document templates.
- Key attributes:
template_id,job_id(FK processing_queue),storage_path,fields_filled,fields_skipped,fields_failed,file_size. - Application served: bids.
- Lifecycle stage:
active.
Entity: template_requirements (table)
Section titled “Entity: template_requirements (table)”- Home:
public.template_requirements(rows: 96 — SSQ 66 + Charnwood ITT 30, both manually catalogued). - Description: Standardised tender template requirements with embeddings and domain classification. Used to match bid_questions against known requirement patterns.
- Key attributes:
template_name,template_type— CHECK enum 10 values:sq, rfp, eqq, pqq, gcloud, method_statement, dos, dps, framework, other(verified S234 — NOTITT; the Charnwood “ITT 30 rows” framing was approximate),template_version,section_ref,section_name,question_number,requirement_text,requirement_type— CHECK enum 7 values:policy, statement, evidence, data, narrative, declaration, reference(verified S234 —checklistis NOT in the enum; ontology §5 disposition “do not addchecklist” remains correct, but the rationale’s “checklist is a form_FORMAT” is built on a phantom premise — see §5 of ontology doc for amended rationale),description,is_mandatory,word_limit_guidance,matching_keywords(text[]),matching_guidance,primary_domain/primary_subtopic/secondary_domain/secondary_subtopic,sector_applicability(text[]),requirement_embeddingvector(1024),display_order,is_current. - Relationships: logical link to
bid_questions.template_requirement_id. - Application served: bids.
- Lifecycle stage:
active. Per Finding 04: rename →bid_template_requirements(contradicts Finding 03 — I2 in 00-synthesis).
Entity: Template / TemplateField / TemplateCompletion / TemplateSummary (TS types)
Section titled “Entity: Template / TemplateField / TemplateCompletion / TemplateSummary (TS types)”- Home:
types/template.ts. - Description: API-shape TS types. Also
TemplateStatus/FieldType/MappingStatus/FillStatus(validation enums inlib/validation/template-schemas). - Lifecycle stage:
active.
Entity: form_templates / form-extraction pipeline (planned per Theme A + Theme B)
Section titled “Entity: form_templates / form-extraction pipeline (planned per Theme A + Theme B)”- Home: Planned. Theme B 6-step flow: evaluate-form skill → HITL → convert to markdown → classify-form-data → HITL → cocoindex pipeline.
- Description: Generalised forms domain —
form_templates+form_template_fieldswithform_typediscriminator (bid/RFP/PQQ/checklist/etc.). Cover docx/xlsx/pdf/html. Auto-completion target: e.g. Cloud Security Principles Checklist V5_3.xlsx. - Lifecycle stage:
specced-but-not-built.
Entity: Form fixtures (canonical baseline)
Section titled “Entity: Form fixtures (canonical baseline)”- Home:
docs/client-documentation-base/forms/—Cloud Security Principles Checklist V5_3 - PHEW.xlsx,standard-selection-questionnaire-ppn-03-24.pdf. - Description: Test corpus exercising question-extraction + auto-completion for forms a real client would supply.
- Lifecycle stage:
active(corpus); pipelinespecced-but-not-built.
Domain: Citations / matches
Section titled “Domain: Citations / matches”Entity: content_citations (table)
Section titled “Entity: content_citations (table)”- Home:
public.content_citations(rows: 0). - Description: Tracks which content items are cited in bid responses. Joins bid_responses ↔ content_items.
- Key attributes:
bid_response_id,content_item_id,citation_type(reference/copied/adapted/inspired). - Application served: bids.
- Lifecycle stage:
active. Per Q1.11 / Finding 02: rename →citations, extend withq_a_pair_id,source_chunk_id, chunk offsets, CHECK exactly-one-target.
Entity: citations (planned — renamed + extended content_citations)
Section titled “Entity: citations (planned — renamed + extended content_citations)”- Home: Planned per
0.9-intended-architecture.md§4.3. - Description: Polymorphic chunk-level citation table. Citing entities: bid_response / sales_proposal / q_a_pair / mcp_search_response. Cited targets: chunk / content_item / q_a_pair.
- Key attributes (proposed):
citing_entityenum,citing_entity_id,cited_chunk_id,cited_content_item_id,cited_q_a_pair_id,confidence,citation_kind(verbatim_quote/paraphrase/derived_inference/q_a_match),invalidated_at,invalidation_reason. - Application served: cross-cutting (all citing apps).
- Lifecycle stage:
specced-but-not-built.
Entity: CitationEntry / CitationsData (TS types)
Section titled “Entity: CitationEntry / CitationsData (TS types)”- Home:
types/bid-metadata.ts. - Description: Inline citation shape stored in
bid_responses.metadata.citations_datafrom Anthropic Search Results API.cited_text,source_index,source_id,source_title,source_url,start_block_index,end_block_index. - Lifecycle stage:
active.
Entity: bid_question_matches (planned — match cache)
Section titled “Entity: bid_question_matches (planned — match cache)”- Home: Planned per
0.9-intended-architecture.md§4.3 + Finding 02. - Description: Caches matched_q_a_pair_ids + score per bid_question; avoids re-embed. Per Theme A may generalise to
question_matcheswithquestion_kinddiscriminator. - Key attributes (proposed):
bid_question_id,matched_q_a_pair_id,matched_content_item_id,matched_chunk_id,similarity_score,rank_in_results,match_method(qa_pair_embedding/corpus_chunk_embedding/qa_extraction_embedding),computed_at,expires_at,invalidated_at, optionally separateembedding_score+fulltext_scoreper N9. - Application served: bids; future: any form-type matching.
- Lifecycle stage:
specced-but-not-built.
Domain: Coverage / governance / freshness
Section titled “Domain: Coverage / governance / freshness”Entity: coverage_targets (table)
Section titled “Entity: coverage_targets (table)”- Home:
public.coverage_targets(rows: 0). - Description: Per-domain coverage targets for the coverage matrix.
- Key attributes:
domain_id(FK),metric_name,target_value. - Application served: cross-cutting (KB hygiene; primary feed to bids via Coverage UI).
- Lifecycle stage:
active.
Entity: governance_config (table)
Section titled “Entity: governance_config (table)”- Home:
public.governance_config(rows: 0). - Description: Per-domain governance settings — posture (open/review_on_change), preset (light_touch/strict), reviewer, timeout_days, quality_score_threshold, auto_flag_on_quality_drop, auto_flag_on_freshness_transition, auto_flag_cooldown_days.
- Application served: cross-cutting.
- Lifecycle stage:
active(empty in prod).
Entity: review_assignments (table)
Section titled “Entity: review_assignments (table)”- Home:
public.review_assignments(rows: 0). - Description: Assigns content review work to specific reviewers with scope filters (domain/content_type/freshness/date range).
- Key attributes:
reviewer_id,assigned_by,assignment_type,filter_domains/filter_content_types/filter_freshness/filter_date_from/to,item_count,status,notes,due_date,completed_at. - Application served: cross-cutting.
- Lifecycle stage:
active.
Entity: notifications (table)
Section titled “Entity: notifications (table)”- Home:
public.notifications(rows: 592). - Description: User notifications for governance, freshness, quality, ownership events.
- Key attributes:
user_id,type(governance_review_needed/governance_approve/governance_request_changes/governance_revert/quality_flag/digest_ready/freshness_transition/coverage_alert/content_gap/owner_content_stale/owner_content_updated/owner_assignment/source_document_updated/date_expiry_approaching/review_overdue),entity_type(content_item/digest/template_requirement/domain/source_document/entity_mention),entity_id,title,message,read_at,dismissed_at,expires_at. - Application served: cross-cutting.
- Lifecycle stage:
active.
Entity: user_notification_prefs (table)
Section titled “Entity: user_notification_prefs (table)”- Home:
public.user_notification_prefs(rows: 0). - Description: Per-user email notification preferences. Defaults all ON; rows created on first toggle.
- Key attributes:
user_id(PK),email_weekly_change_report,email_review_assigned,email_owned_content_flagged,auto_generate_change_reports. - Application served: cross-cutting UX.
- Lifecycle stage:
active.
Entity: digests (table)
Section titled “Entity: digests (table)”- Home:
public.digests(rows: 2). User-facing label: “Change Reports”. - Description: AI-generated change reports summarising recent activity, grouped into themed clusters with domain-level summaries.
- Key attributes:
digest_type(weekly/daily),period_start/period_end,item_count,domain_summaries(jsonb array),theme_clusters(jsonb array),narrative_summary,generated_at,generated_by,tokens_used,item_ids(uuid[]),metadata(jsonb — verified S234; previous inventory claim of separatefilters+governance_summarycolumns was wrong; both phantoms — actual schema has singlemetadatajsonb). - Application served: cross-cutting (governance / situational awareness).
- Lifecycle stage:
active. Per Q5.1: rename →change_reports.
Entity: DigestDomainSummary / DigestGovernanceSummary / ThemeCluster (TS types)
Section titled “Entity: DigestDomainSummary / DigestGovernanceSummary / ThemeCluster (TS types)”- Home:
types/digest.ts. - Description: Shape inside digests.domain_summaries / theme_clusters / governance_summary JSONB.
- Lifecycle stage:
active.
Entity: Freshness lifecycle (column-level concept)
Section titled “Entity: Freshness lifecycle (column-level concept)”- Home:
content_items.freshness+lib/freshness.ts+ cron atapp/api/cron/freshness-transitions/route.ts. - Description: State machine fresh → aging → stale → expired. Decay rates per
lifecycle_type. Notifies content_owner on transition. - Lifecycle stage:
active.
Entity: Quality scoring (column-level concept)
Section titled “Entity: Quality scoring (column-level concept)”- Home:
content_items.quality_score(0-100) +lib/quality/quality-score.ts+ cron atapp/api/cron/quality-score/route.ts. - Description: Composite quality score from completeness, freshness, classification confidence, verification status, depth.
- Lifecycle stage:
active.
Entity: Publication lifecycle state machine
Section titled “Entity: Publication lifecycle state machine”- Home:
content_items.publication_status(draft/in_review/published/archived) +lib/governance/publication-transitions.ts+ triggerenforce_archive_state_consistency. - Description: Bidirectional invariant
publication_status='archived' ↔ archived_at IS NOT NULL. State machine docs atdocs/specs/publication-lifecycle-state-machine-spec.md. - Lifecycle stage:
active.
Entity: content_history version triggers (DB-level)
Section titled “Entity: content_history version triggers (DB-level)”- Home: triggers
auto_version_content_history()(assigns monotonic version on INSERT tocontent_history) +ensure_v1_history_at_commit()(guarantees every content_item has a v1 history row at commit). - Description: Two trigger functions enforce the immutable-snapshot invariant. App code writes the row body; triggers stamp version + guarantee a baseline v1. Relevant to Theme C
edit_intent— any future trigger fix-up must dovetail with these. - Lifecycle stage:
active.
Entity: Review cadence (column-level concept)
Section titled “Entity: Review cadence (column-level concept)”- Home:
content_items.review_cadence_days(1-1095) +content_items.next_review_date+ cron atapp/api/cron/review-cadence/route.ts. - Description: Recurring review cadence per content item.
- Lifecycle stage:
active.
Entity: UnifiedGap / TaxonomyGap / TemplateGap / GuideGap (TS types)
Section titled “Entity: UnifiedGap / TaxonomyGap / TemplateGap / GuideGap (TS types)”- Home:
types/unified-gap.ts. - Description: Discriminated union for Priority Gaps view aggregating 3 sources (taxonomy / template / guide). Finding 04 + 05 propose 4th source:
bid_response(N4 in 00-synthesis: rename tobid_questionorbid_question_matchpending). - Lifecycle stage:
active.
Entity: guides (table)
Section titled “Entity: guides (table)”- Home:
public.guides(rows: 11). - Description: Content completeness guides — curated reading experiences organised by sector/product.
guide_typeCHECK enum 5 values:sector, product, company, research, custom(verified S234 —completenessis NOT in the enum; prior claim was a fabrication). - Key attributes:
name,slug(UNIQUE),description,guide_type,domain_filter,icon,color,display_order,is_published. - Relationships:
--(1:N)--> guide_sections. - Application served: cross-cutting (onboarding, sales walkthroughs, training in current form).
- Lifecycle stage:
active.
Entity: guide_sections (table)
Section titled “Entity: guide_sections (table)”- Home:
public.guide_sections(rows: 135). - Description: Sections within a guide. Each defines expected content_type / subtopic / layer.
- Key attributes:
guide_id,section_name,description,content_type_filter,subtopic_filter,expected_layer,is_required,display_order. - Application served: cross-cutting.
- Lifecycle stage:
active.
Entity: taxonomy_domains (table)
Section titled “Entity: taxonomy_domains (table)”- Home:
public.taxonomy_domains(rows: 15). - Description: Configurable taxonomy domains. Drives DB-driven taxonomy via TaxonomyProvider.
- Key attributes:
name,display_name,key_signal(text — may be load-bearing for taxonomy classification confidence),description,display_order,colour,is_active,provenance(baseline/client/recommended),recommended_at,recommended_by,accepted_at. - Application served: cross-cutting classification.
- Lifecycle stage:
active.
Entity: taxonomy_subtopics (table)
Section titled “Entity: taxonomy_subtopics (table)”- Home:
public.taxonomy_subtopics(rows: 57). - Description: Subtopics within a taxonomy domain. Same provenance model as domains.
- Key attributes:
domain_id(FK),name,display_name,description,display_order,is_active,provenance,recommended_*,accepted_at. - Application served: cross-cutting.
- Lifecycle stage:
active.
Entity: taxonomy_sync_state (table)
Section titled “Entity: taxonomy_sync_state (table)”- Home:
public.taxonomy_sync_state(rows: 1). - Description: Tracks Python pipeline taxonomy snapshot sync state. Pipeline reads from
scripts/tests/fixtures/taxonomy_snapshot.json. - Key attributes:
last_sync_hash,last_sync_at,synced_by. - Application served: cross-cutting (Python pipeline parity).
- Lifecycle stage:
active.
Entity: layer_vocabulary (table)
Section titled “Entity: layer_vocabulary (table)”- Home:
public.layer_vocabulary(rows: 4). - Description: DB-driven content layer definitions (sales_brief / bid_detail / company_reference / research). Promoted from static config.
- Key attributes:
key(UNIQUE),label,description,display_order,is_active. - Application served: cross-cutting (browse filter, coverage matrix).
- Lifecycle stage:
active.
Entity: tag_morphology_drift_flags (table)
Section titled “Entity: tag_morphology_drift_flags (table)”- Home:
public.tag_morphology_drift_flags(rows: 3). - Description: Triage queue for tag morphology drift surfaced by eval-tag-morphology-adoption. Each row = one (stored_tag, proposed_canonical) disagreement.
- Key attributes:
stored_tag,proposed_canonical,usage_count,affected_content_ids(uuid[]),detected_at,decision,decided_by,decided_at,decision_rationale. - Application served: cross-cutting (KB hygiene).
- Lifecycle stage:
active.
Domain: Entities / knowledge graph
Section titled “Domain: Entities / knowledge graph”Entity: entity_mentions (table)
Section titled “Entity: entity_mentions (table)”- Home:
public.entity_mentions(rows: 1358). - Description: Entities extracted from content items by AI classification (context graph layer).
- Key attributes:
content_item_id(CASCADE),entity_type(12-value enum: organisation/certification/regulation/framework/capability/person/technology/project/sector/product/standard/methodology),entity_name(original),canonical_name(normalised),confidencenumeric(3,2),context_snippet,entity_type_override,normalisation_version,metadata(jsonb — certification version/expiry/issuer/scope; framework round/status/lot; regulation registration_number/expiry). - Relationships:
--(N:1 CASCADE)--> content_items. UNIQUE(canonical_name, entity_type, content_item_id). - Application served: cross-cutting (entity browse, knowledge graph, certifications dashboard).
- Lifecycle stage:
active.
Entity: entity_relationships (table)
Section titled “Entity: entity_relationships (table)”- Home:
public.entity_relationships(rows: 593). - Description: Relationships between entities (context graph edges).
- Key attributes:
source_entity(canonical),relationship_type(10-value enum: holds/complies_with/delivers_to/uses/demonstrated_by/requires/part_of/supersedes/references/evidences),target_entity(canonical),source_item_id(SET NULL),confidence. - Application served: cross-cutting.
- Lifecycle stage:
active. Per Q1.6 + S3 §5: extend withvalid_from/valid_to(mempalace Shape A temporal),provenanceenum (EXTRACTED/INFERRED/AMBIGUOUS per Q4.7),adapter_name. Addkg_invalidate()RPC.
Entity: entity_aliases (table)
Section titled “Entity: entity_aliases (table)”- Home:
public.entity_aliases(rows: 24). - Description: DB-driven entity alias resolution. Maps variant names to canonical forms.
- Key attributes:
alias,canonical,category(client/generic),is_active. - Application served: cross-cutting classification.
- Lifecycle stage:
active.
Entity: Entity-type taxonomy (spec)
Section titled “Entity: Entity-type taxonomy (spec)”- Home:
docs/reference/entity-type-taxonomy-spec.md. - Description: Definitive list of 12 entity types + classification rules. Per Q4.13: KEEP KH taxonomy.
- Lifecycle stage:
active(source of truth).
Entity: Temporal validity / kg_timeline (planned RPC)
Section titled “Entity: Temporal validity / kg_timeline (planned RPC)”- Home: Planned per
0.9-intended-architecture.md§4.4. - Description: mempalace Shape A temporal columns + invalidation RPCs.
kg_invalidate(subject, predicate, object)andkg_timeline(entity_id, as_of). - Lifecycle stage:
kg_invalidate:specced-but-not-built(Q4.8 YES — pre-launch v1).kg_timeline:specced-but-not-built(Q4.9 DEFER to v2).
Entity: Knowledge Map primitive (planned user-facing)
Section titled “Entity: Knowledge Map primitive (planned user-facing)”- Home: Planned per CX.32 + §5.2.A.
- Description: User-facing visualisation of workspace KG (entities + relationships + temporal validity). Substrate = Cocoindex (not Graphify) per S232.
- Lifecycle stage:
specced-but-not-built(gated on S7 client-docs comparison).
Entity: Graphify confidence-label taxonomy (planned)
Section titled “Entity: Graphify confidence-label taxonomy (planned)”- Home: Planned per Q4.14 RESOLVED-ADOPT.
- Description: Confidence labels (EXTRACTED/INFERRED/AMBIGUOUS) across multiple surfaces (Q&A extractions, citations, classification, search results). Distinct from Q4.7 KG-provenance enum.
- Lifecycle stage:
specced-but-not-built.
Domain: User / role / auth
Section titled “Domain: User / role / auth”Entity: auth.users (table — Auth schema)
Section titled “Entity: auth.users (table — Auth schema)”- Home:
auth.users(Auth-owned schema). - Description: Supabase Auth canonical user identity.
- Relationships: referenced by many tables (see ON DELETE behaviour matrix in SCHEMA-QUICK-REFERENCE §34).
- Lifecycle stage:
active(external).
Entity: user_profiles (table — Auth mirror)
Section titled “Entity: user_profiles (table — Auth mirror)”- Home:
public.user_profiles(rows: 9). - Description: Mirror of auth.users for app-side reads (PostgREST doesn’t expose auth schema).
- Key attributes:
id(PK = auth.users.id CASCADE),email,full_name,created_at,updated_at. - Triggers: populated by
handle_new_user()+handle_user_update()on auth.users. - Application served: cross-cutting identity reads.
- Lifecycle stage:
active.
Entity: user_roles (table)
Section titled “Entity: user_roles (table)”- Home:
public.user_roles(rows: 9). - Description: Application-level role assignments. One row per user. New users cannot write until seeded.
- Key attributes:
user_id(UNIQUE),role(admin/editor/viewer). - Application served: cross-cutting RBAC.
- Lifecycle stage:
active.
Entity: content_owner_id concept
Section titled “Entity: content_owner_id concept”- Home:
content_items.content_owner_idFK → auth.users. - Description: User responsible for keeping content current. Drives owner notifications and “my content” filters.
- Lifecycle stage:
active.
Entity: ContentOwnerStats (TS type)
Section titled “Entity: ContentOwnerStats (TS type)”- Home:
types/owner.ts. - Description: Per-owner content stats: total_items + fresh/aging/stale/expired/unverified counts + display_name.
- Lifecycle stage:
active.
Entity: OAuth grants / MCP auth
Section titled “Entity: OAuth grants / MCP auth”- Home:
app/api/oauth/{decision,grants,revoke}/route.ts+lib/mcp/auth.ts. - Description: OAuth 2.1 with dynamic client registration for MCP/Claude integration. (DB tables in
auth.*schema, not public.) - Lifecycle stage:
active.
Domain: Pipeline / jobs / orchestration
Section titled “Domain: Pipeline / jobs / orchestration”Entity: pipeline_runs (table)
Section titled “Entity: pipeline_runs (table)”- Home:
public.pipeline_runs(rows: 36). - Description: Tracks execution of ingestion + processing pipelines.
- Key attributes:
pipeline_name,started_at,completed_at,status(running/completed/failed),items_processed,items_skipped,items_updated,error_message,result(jsonb),cost,progress(jsonb — step/steps_completed/steps_total/detail),source_filename,items_created(uuid[]),workspace_id,created_by. - Relationships:
--(N:1)--> workspaces--(produces)--> source_documents.pipeline_run_id--(produces uuids)--> content_items(via items_created array)
- Application served: cross-cutting (UI feedback for batch / upload / markdown / Python pipeline runs).
- Lifecycle stage:
active. Per N6 in 00-synthesis: retain as KH-side rollup of cocoindex runs (Liam pending).
Entity: processing_queue (table)
Section titled “Entity: processing_queue (table)”- Home:
public.processing_queue(rows: 0). - Description: Job queue for background processing (template_fill / template_analyse / bid_draft_all / batch_reclassify / markdown_batch + reserved embed/classify/extract_qa/summarise/validate/reprocess).
- Key attributes:
job_type(CHECK 11 values),payload(jsonb — envelope per spec §3.1: envelope_version, auth_context, body, pipeline_run_id),idempotency_key(top-level column — not nested inside payload despite spec wording),result(jsonb — captures terminal job output for downstream consumers),status(pending/processing/completed/failed/cancelled/dead_lettered),priority,attempts,max_attempts,error_message,started_at,completed_at,created_by. - Relationships:
--(payload links)--> pipeline_runs. - Application served: cross-cutting.
- Lifecycle stage:
active.
Entity: QueueJobPayload<TBody> / JobType / JobStatus (TS types)
Section titled “Entity: QueueJobPayload<TBody> / JobType / JobStatus (TS types)”- Home:
lib/queue/envelope.ts. - Description: Queue envelope with envelope_version, auth_context, body, idempotency_key, pipeline_run_id. JobType union: embed/classify/extract_qa/summarise/validate/reprocess/template_fill/template_analyse/bid_draft_all/batch_reclassify/markdown_batch. JobStatus: pending/processing/completed/failed/cancelled/dead_lettered.
- Lifecycle stage:
active.
Entity: cron jobs (background)
Section titled “Entity: cron jobs (background)”- Home:
app/api/cron/{classification-quality,content-gaps,coverage-alerts,freshness-transitions,intelligence-cleanup,intelligence-poll,process-queue,quality-score,review-cadence}/route.ts. - Description: Scheduled background jobs surfacing each domain concern: classification quality scan; content-gap detection; coverage alerts; freshness transitions; SI cleanup; SI feed polling; queue worker; quality score recompute; review-cadence check.
- Lifecycle stage:
active.
Entity: Python pipeline (kb_pipeline)
Section titled “Entity: Python pipeline (kb_pipeline)”- Home:
scripts/kb_pipeline/— chunk.py, classify.py, dedup.py, embed.py, extract_answer.py, extract.py, layer_inference.py, pipeline_log.py, pipeline.py, post_insert.py, progressive_depth.py, quality_checks.py, resolve_question.py, store.py, summarise.py, supersede.py, temporal_bridge.py, eval_holder_rule.py, extraction_result.py. - Description: Python ingestion pipeline for bulk historical imports (markdown directories, Word Q&A libraries, URL lists).
- Domain types:
ExtractedContent,ContentChunk,ClassificationResult,PostInsertResult. - Lifecycle stage:
active. Per intended arch: candidate replacement = cocoindex flows + Graphify semantic-extractor.
Entity: markdown_orchestrator (TS) + Markdown batch types
Section titled “Entity: markdown_orchestrator (TS) + Markdown batch types”- Home:
lib/ingest/markdown-orchestrator.ts+types/ingest.ts(MarkdownIngestFile,MarkdownPerFileOverride,MarkdownBatchOptions,MarkdownIngestAnalysis,MarkdownBatchResultsSummary, etc.). - Description: Two-phase ingest (analyse → import) for batch markdown ingest. Cooperative-cancel for queue mode. Pipeline E pattern (client-pre-generated
pipeline_run_id). - Lifecycle stage:
active.
Domain: Cocoindex (planned cross-cutting substrate)
Section titled “Domain: Cocoindex (planned cross-cutting substrate)”Entity: cocoindex source-key (planned)
Section titled “Entity: cocoindex source-key (planned)”- Home: Planned —
content_items.cocoindex_source_keyper Q1.9 Scenario A. - Description: Stable source-key identifying a binary input under cocoindex’s source binding. Carries binary identity in lieu of
source_documentsversioning columns under Option α/β. - Lifecycle stage:
specced-but-not-built(B2 in 00-synthesis pending Liam ruling).
Entity: cocoindex ops-DB ledger (planned)
Section titled “Entity: cocoindex ops-DB ledger (planned)”- Home: Planned (cocoindex-managed Postgres tables).
- Description: Engine-side append-only ledger of source-key history + content-hash + flow re-runs. Cocoindex’s “audit primitive.”
- Lifecycle stage:
specced-but-not-built.
Entity: cocoindex freshness concept (planned)
Section titled “Entity: cocoindex freshness concept (planned)”- Home: Planned per Theme D.
- Description: Engine-side freshness signal — distinct from
content_items.freshness. Integration TBD per cocoindex deep-dive. - Lifecycle stage:
specced-but-not-built.
Entity: cocoindex flow / @coco.fn (code substrate)
Section titled “Entity: cocoindex flow / @coco.fn (code substrate)”- Home: Planned
scripts/cocoindex/(per intended arch + S2 spike). - Description: Python flow definitions wrapping each pipeline step (extract / classify / embed / chunk / Q&A-extract / entity-extract).
- Lifecycle stage:
specced-but-not-built.
Entity: pullmd / skill-seekers / graphify (external tools)
Section titled “Entity: pullmd / skill-seekers / graphify (external tools)”- Home: External MCP servers / Python packages.
- Description:
- pullmd: URL fetcher (HTML/CF/GN/Reddit).
- skill-seekers: PDF scraper + dependency_analyzer.
- graphify: KG extractor with confidence-label taxonomy + Neo4j/FalkorDB target.
- Lifecycle stage:
active(used in dev workflow); product integrationspecced-but-not-built.
Domain: Mempalace / memory (cross-tool)
Section titled “Domain: Mempalace / memory (cross-tool)”Entity: Mempalace wing (external — 1:1 to workspace_id)
Section titled “Entity: Mempalace wing (external — 1:1 to workspace_id)”- Home: External MCP server (
plugin_mempalace_mempalace). Per Finding 03 Q4.5:wing = workspace_id. - Description: Per-workspace memory partition. Houses drawers (memory items), tunnels (relationships), and the wing-scoped KG.
- Lifecycle stage:
active(dev workflow). Mempalace wing-filter bug noted in CLAUDE.mdmempalace_search ⚠ PARTIAL.
Entity: Mempalace drawer (external)
Section titled “Entity: Mempalace drawer (external)”- Home: mempalace MCP
drawer_*tools. - Description: Memory item — content + metadata (entity codes + emotion markers + pipe-separated fields, AAAK format).
- Lifecycle stage:
active(dev workflow).
Entity: Mempalace tunnel (external)
Section titled “Entity: Mempalace tunnel (external)”- Home: mempalace MCP
tunnel_*tools. - Description: Cross-drawer / cross-wing relationship edge. Powers
mempalace_follow_tunnelstraversal. - Lifecycle stage:
active(dev workflow).
Entity: Mempalace KG (external)
Section titled “Entity: Mempalace KG (external)”- Home: mempalace MCP
kg_*tools. - Description: Wing-scoped knowledge graph layered over drawers. Has
kg_add,kg_query,kg_invalidate,kg_stats,kg_timeline. - Lifecycle stage:
active(dev) forkg_add/kg_query/kg_stats. Per Q4.1 + Q4.8: shape adopted ontoentity_relationships. KG empty until seeded.
Entity: Mempalace diary (external)
Section titled “Entity: Mempalace diary (external)”- Home: mempalace MCP
diary_*tools. - Description: Session diary in AAAK format. Default
wing_<agent>works; cross-projectwingparameter errors. - Lifecycle stage:
active(dev workflow).
Entity: user_memory_drawers (planned KH-native)
Section titled “Entity: user_memory_drawers (planned KH-native)”- Home: Planned per
0.9-intended-architecture.md§7.3. - Description: KH platform-side per-user memory. drawer_kind ∈ {preference, context, reorientation, shortcut}. Vector embedding for semantic recall. Temporal valid_from/valid_to. MCP tools:
save_user_memory/recall_user_memory/forget_user_memory. - Lifecycle stage:
specced-but-not-built(post-launch — gates on mempalace v4-alpha PG backend stable per Q4.6).
Domain: MCP tooling / external surface
Section titled “Domain: MCP tooling / external surface”Entity: KH MCP server
Section titled “Entity: KH MCP server”- Home:
lib/mcp/(auth.ts, app-bundles.ts, plugin-bundle.ts, resources.ts, tools/*.ts) +app/api/mcp/[transport]/route.ts. - Description: MCP server exposing 54 tools across 16 categories (search, dashboard, bids, content, quality, ai, entities, templates, governance, review, intelligence, guides, supersession, change-report, apps, workspaces).
- Lifecycle stage:
active.
Entity: KH MCP tool categories (code)
Section titled “Entity: KH MCP tool categories (code)”- Home:
lib/mcp/tools/{ai,apps,bids,change-report,content,dashboard,entities,governance,guides,intelligence,quality,review,search,shared,supersession,templates,workspaces}.ts. - Description: Per-category tool registrations. Each surfaces a domain operation to AI consumers (Claude Desktop, Claude.ai, Claude Code).
- Lifecycle stage:
active.
Entity: MCP Apps (interactive UIs)
Section titled “Entity: MCP Apps (interactive UIs)”- Home:
mcp-apps/(Vite single-file builds). 4 apps: Coverage Matrix, Bid Dashboard, Reorient Me, Intelligence Feed. - Description: Rich UIs rendered inside Claude conversations.
- Lifecycle stage:
active.
Entity: planned MCP tools (Theme Section §9.2-9.3)
Section titled “Entity: planned MCP tools (Theme Section §9.2-9.3)”- Home: Planned per
0.9-intended-architecture.md§9.2/§9.3. - Description:
list_source_documents,get_source_document_content,upload_source_document,check_content_duplicates,reprocess_content_item,save/recall/forget_user_memory, search mode parameter (strict_extract/rephrase),get_bid_coverage_gaps. - Lifecycle stage:
specced-but-not-built(MCP-action list NOT YET APPROVED per S231 §7.4).
Domain: UI / browse / search (cross-cutting)
Section titled “Domain: UI / browse / search (cross-cutting)”Entity: BrowseFilters (TS type)
Section titled “Entity: BrowseFilters (TS type)”- Home:
types/content.ts. - Description: URL-driven filter state: domain / subtopic / content_type / platform / author / date_from/to / keywords / starred / priority / workspace / user_tags / freshness / layer / entity / entity_type / quality_issues / include_drafts / include_qa / owner / review_status / source / sort / order.
- Lifecycle stage:
active.
Entity: FilterPreset (TS type)
Section titled “Entity: FilterPreset (TS type)”- Home:
types/filter-preset.ts. - Description: Saved browse-filter preset. System presets (deterministic slugs) + user presets (
u_prefix).paramsis URL query string. - Lifecycle stage:
active.
Entity: ContentListItem / ContentDetail / SearchResult (TS types)
Section titled “Entity: ContentListItem / ContentDetail / SearchResult (TS types)”- Home:
types/content.ts. - Description: Display-optimised shapes for browse/list/grid views and detail views.
- Lifecycle stage:
active.
Entity: ReorientData / UrgentItem / TeamChange / RecentWorkItem / BidBriefing (TS types)
Section titled “Entity: ReorientData / UrgentItem / TeamChange / RecentWorkItem / BidBriefing (TS types)”- Home:
types/reorient.ts. - Description: “Reorient Me” briefing payload — last_active_at, urgent items (bid_deadline / review_pending / content_expired / quality_flag / notification), team_changes (sourced from content_history + bid_response_history), my_recent_work, bid_summary.
- Lifecycle stage:
active.
Entity: Hybrid search / vector indexes
Section titled “Entity: Hybrid search / vector indexes”- Home: RPC
hybrid_search,search_for_bid_response,search_content_chunks. HNSW index oncontent_items.embedding(m=16, ef_construction=64). - Description: Combined semantic (1024-dim) + keyword search.
visibility_filter(default/all/admin). - Lifecycle stage:
active.
Entity: ReviewQueueItem / ReviewFilters / ReviewStatsResponse (TS types)
Section titled “Entity: ReviewQueueItem / ReviewFilters / ReviewStatsResponse (TS types)”- Home:
types/review.ts. - Description: Review queue domain types. ReviewStatus enum: unverified/verified/flagged/draft/all. ReviewStatsResponse breaks down by_domain/by_content_type/by_source_file/by_source_document + overdue + awaiting_publication.
- Lifecycle stage:
active.
Domain: Future applications
Section titled “Domain: Future applications”Entity: Sales proposals (future application)
Section titled “Entity: Sales proposals (future application)”- Home: Per CLAUDE.md + Theme E. Planned
sales_proposal_*family. Stub mention incitations.citing_entityplanned enum. - Description: Next application after bids. Templates ≠ bid templates; responses cite q_a_pairs via polymorphic citations table. New
sales_proposal_templatestable planned. - Data consumed: content_items, q_a_pairs, citations (as citing entity), workspaces (type=‘sales_proposal’), proposal_workspaces (satellite).
- Data produced: proposals (new), sales_proposal_responses (new), citations rows.
- Lifecycle stage:
specced-but-not-built(next).
Entity: Competitor research (future application)
Section titled “Entity: Competitor research (future application)”- Home: Per Theme E.
- Description: Workspace type for competitor monitoring. Less likely to be Q&A-based per OQ-Q111-A.
- Data consumed: company_profiles.competitors (jsonb), feed_articles, content_items.
- Data produced: competitor profiles, content_items (research notes).
- Lifecycle stage:
specced-but-not-built(future).
Entity: Training / onboarding (future application)
Section titled “Entity: Training / onboarding (future application)”- Home: Per Theme E.
- Description: Workspace type for new-starter onboarding + sector briefing.
- Data consumed: guides, guide_sections, content_items, q_a_pairs (less likely).
- Lifecycle stage:
specced-but-not-built(future).
Entity: Product guides (Phew use case — application or content)
Section titled “Entity: Product guides (Phew use case — application or content)”- Home: Per Theme E ambiguity.
- Description: Per Phew, product guides (Audit / LMS / Websites). Unclear whether these are an
applicationdistinct from content, or simply content_items + guides combinations. - Data observed in fixtures:
docs/client-documentation-base/markdown/has 4 bid library docs (Phew-Bid-Library-2026-v4_4.md, LMS_Bid_Library_v2.2.md, Website_Bid_Library_v4_2.md, Advanced_Audits_Bid_Library_v5.md) — these are content but in form of bid Q&A libraries per product. - Lifecycle stage:
unclear— Theme E open question.
Entity: Bid Topic Index (Phew-specific cross-reference index)
Section titled “Entity: Bid Topic Index (Phew-specific cross-reference index)”- Home: Embedded in
docs/client-documentation-base/markdown/Phew-Bid-Library-2026-v4_4.md“BID RESPONSE TOPIC INDEX” section. - Description: Phew Bid Library v4.4 introduced topic-tag index for cross-referencing answers. Roughly maps to: question category → list of Q&A pair entry titles. Currently markdown-only; not in DB.
- Lifecycle stage:
legacy-content— not yet a typed entity in schema.
Domain: Audit / lineage / provenance (cross-cutting)
Section titled “Domain: Audit / lineage / provenance (cross-cutting)”Entity: content_history (already in Content section)
Section titled “Entity: content_history (already in Content section)”- See above. Current
change_typevalues in use: 5 (edit/classify/import/archive/delete).
Entity: audit_log (planned)
Section titled “Entity: audit_log (planned)”- Home: Planned per Finding 01 Recommendation.
- Description: Human-readable compliance UX audit table — distinct from content_history’s row-shape snapshots. Workspace_id-scoped RLS per OQ-Q24-B + OQ-Q113-B pattern.
- Lifecycle stage:
specced-but-not-built.
Entity: op_id propagation pattern (specced)
Section titled “Entity: op_id propagation pattern (specced)”- Home: Planned per Finding 01 + edit-flow §6.0.6.
- Description: Operation identifier threaded through batch operations enabling rollback cohesion. Trigger-driven (DB) vs app-stamped — hybrid per Liam working default.
- Lifecycle stage:
specced-but-not-built.
Entity: ingest_source provenance (column-level)
Section titled “Entity: ingest_source provenance (column-level)”- Home:
content_items.ingest_source(S207 WP-A4). - Description: Canonical pipeline-source enum: manual/url_import/upload/upload_autosplit/mcp_create/rss_feed/bid_outcome_integration/python_url/python_markdown/qa_import/batch_reclassify.
- Lifecycle stage:
active.
Entity: Cost / token tracking (column-level concept)
Section titled “Entity: Cost / token tracking (column-level concept)”- Home:
content_items.classification_model/classification_tokens_in/_out/_cache_creation_tokens/_cache_read_tokens/embedding_model/embedding_tokens. Alsopipeline_runs.cost,digests.tokens_used,bid_responses.metadata.ai_metadata. - Description: Per-item AI cost tracking. Per S231 §7.1: budget/timeline terminology dropped from Phase B docs.
- Lifecycle stage:
active(tracked but de-emphasised in planning).
Domain: Operational / supporting
Section titled “Domain: Operational / supporting”Entity: RLS pattern doc (planned)
Section titled “Entity: RLS pattern doc (planned)”- Home: Planned per OQ-Q113-B.
- Description: Dedicated pattern doc + Supabase “auto-enable RLS on new tables” trigger. Pattern for new tables: workspace_id from
content_item_workspacesJOIN or direct FK. - Lifecycle stage:
specced-but-not-built.
Entity: Storage buckets (Supabase Storage)
Section titled “Entity: Storage buckets (Supabase Storage)”- Home: Supabase Storage paths referenced by
source_documents.storage_pathandtemplates.storage_path. - Description: Binary storage. Per Q2.6: no v1 audit-bucket; v2 evaluate.
- Lifecycle stage:
active(templates);active-but-empty(source_documents).
Entity: quality_issues_pending (view)
Section titled “Entity: quality_issues_pending (view)”- Home:
public.quality_issues_pending. - Description: Unresolved quality flags JOINed with content_item details — feeds review queue.
- Lifecycle stage:
active.
Entity: Pipeline system user
Section titled “Entity: Pipeline system user”- Home:
PIPELINE_SYSTEM_USER_ID = 'a0000000-0000-4000-8000-000000000001'(constant inlib/intelligence/types.ts,lib/auth/owner-default.ts). - Description: Service account UUID for
classifyContentand pipeline writes (NOT a literal string per CLAUDE.md Gotcha). - Lifecycle stage:
active.
§2 — Relationship map
Section titled “§2 — Relationship map”Flat relationship list — EntityA --(kind)--> EntityB. Soft pointers marked [soft].
Content & corpus
Section titled “Content & corpus”content_items --(M:N via content_item_workspaces)--> workspacescontent_items --(N:1)--> source_documents(source_document_id, SET NULL)content_items --(self-FK)--> content_items(parent_id hierarchy)content_items --(self-FK)--> content_items(superseded_by)content_items --(1:N)--> content_historycontent_items --(1:N CASCADE)--> content_chunkscontent_items --(1:N CASCADE)--> entity_mentionscontent_items --(1:N)--> ingestion_quality_logcontent_items --(1:N)--> read_markscontent_items --(1:N CASCADE)--> classification_disputescontent_items --(1:N)--> verification_historycontent_items --(1:N)--> content_citations(cited target)content_items --(N:1)--> auth.users(content_owner_id, created_by, updated_by, archived_by, verified_by — varied SET NULL/NO ACTION)content_items --(N:1)--> layer_vocabulary[soft via layer column FK to layer_vocabulary.key]content_chunks --(self-FK)--> content_chunks(parent_chunk_id)content_history --(N:1 SET NULL)--> content_items
Workspaces & containers
Section titled “Workspaces & containers”workspaces --(1:1 logical)--> mempalace wing[soft per Finding 03]workspaces --(1:N)--> bid_questions(via legacy project_id)workspaces --(1:N)--> templates(via legacy project_id)workspaces --(1:N)--> source_documentsworkspaces --(1:N)--> feed_sources(CASCADE)workspaces --(1:N)--> feed_prompts(CASCADE)workspaces --(1:N)--> feed_articles(CASCADE)workspaces --(1:N)--> si_processing_queueworkspaces --(1:N)--> pipeline_runsworkspaces --(1:1 planned)--> bid_workspaces(satellite per Theme E + Finding 05)workspaces --(1:1 planned)--> proposal_workspaces / competitor_workspaces / training_workspaces(satellites)
bid_questions --(N:1)--> workspaces(via project_id legacy)bid_questions --(N:1)--> template_requirementsbid_questions --(1:N)--> bid_responsesbid_questions --(1:N planned)--> bid_question_matchesbid_questions --(soft uuid[])--> content_items(matched_content_ids legacy)bid_responses --(1:N)--> bid_response_historybid_responses --(1:N)--> content_citationsbid_responses --(soft uuid[])--> content_items(source_content_ids)content_citations --(N:1)--> bid_responsescontent_citations --(N:1)--> content_items
Q&A (planned)
Section titled “Q&A (planned)”q_a_pairs --(N:1)--> workspacesq_a_pairs --(N:1)--> content_items(source_content_item_id)q_a_pairs --(N:1)--> content_chunks(source_chunk_id)q_a_pairs --(N:1)--> auth.users(verified_by, created_by, archived_by)q_a_extractions --(N:1)--> content_itemsq_a_extractions --(N:1)--> content_chunksq_a_extractions --(promoted_to)--> q_a_pairscitations --(polymorphic via citing_entity + citing_entity_id)--> {bid_responses, sales_proposals, q_a_pairs, mcp_search_response}[soft polymorphic]citations --(N:1)--> content_chunks(cited_chunk_id)citations --(N:1)--> content_items(cited_content_item_id)citations --(N:1)--> q_a_pairs(cited_q_a_pair_id)bid_question_matches --(N:1)--> bid_questionsbid_question_matches --(N:1)--> q_a_pairs / content_items / content_chunks
Templates / forms
Section titled “Templates / forms”templates --(N:1)--> workspacestemplates --(1:N)--> template_fieldstemplates --(1:N)--> template_completionstemplate_fields --(N:1)--> bid_questions(question_id)template_completions --(N:1)--> processing_queue(job_id)template_requirements --(soft logical FK from)--> bid_questions.template_requirement_id
Entities / KG
Section titled “Entities / KG”entity_mentions --(N:1 CASCADE)--> content_itemsentity_relationships --(N:1 SET NULL)--> content_items(source_item_id)entity_aliasesstandalone (text-keyed canonical mapping)- Planned:
entity_relationships --(extended cols)--> {valid_from, valid_to, provenance, adapter_name}
Sector intelligence
Section titled “Sector intelligence”feed_sources --(N:1 CASCADE)--> workspacesfeed_sources --(1:N)--> feed_articlesfeed_articles --(N:1 CASCADE)--> workspacesfeed_articles --(N:1 CASCADE)--> feed_sourcesfeed_articles --(N:1)--> feed_prompts(prompt_version_id)feed_articles --(N:1 SET NULL)--> content_items(when promoted to KB)feed_articles --(1:N CASCADE)--> feed_flagsfeed_flags --(N:1)--> feed_prompts(prompt_version_id)feed_flags --(N:1)--> auth.users(flagged_by, resolved_by)feed_prompts --(N:1 CASCADE)--> workspacescompany_profiles[soft per-workspace anchor — no FK in current schema]si_processing_queue --(N:1)--> workspacessi_processing_queue --(N:1)--> feed_sources
Coverage / governance / freshness
Section titled “Coverage / governance / freshness”coverage_targets --(N:1)--> taxonomy_domainstaxonomy_subtopics --(N:1)--> taxonomy_domainsguides --(1:N)--> guide_sectionsgovernance_config --(N:1 logical)--> taxonomy_domains(domain text)notifications --(N:1 CASCADE)--> auth.usersnotifications --(polymorphic via entity_type + entity_id)--> {content_item, digest, template_requirement, domain, source_document, entity_mention}user_notification_prefs --(N:1 CASCADE)--> auth.usersreview_assignments --(N:1)--> auth.users(reviewer_id, assigned_by)verification_history --(N:1)--> content_itemsverification_history --(N:1 SET NULL)--> auth.users(performed_by)tag_morphology_drift_flags --(soft uuid[])--> content_items(affected_content_ids)
Source documents
Section titled “Source documents”source_documents --(self-FK)--> source_documents.parent_idsource_documents --(N:1)--> pipeline_runssource_documents --(N:1)--> workspacessource_documents --(N:1 SET NULL)--> auth.users(uploaded_by, archived_by)source_document_diffs --(N:1 CASCADE)--> source_documents(old_document_id)source_document_diffs --(N:1 CASCADE)--> source_documents(new_document_id)source_document_diffs --(N:1 SET NULL)--> content_items(affected_content_item_id)
Pipeline / jobs
Section titled “Pipeline / jobs”pipeline_runs --(N:1)--> workspacespipeline_runs --(1:N)--> source_documentspipeline_runs --(soft uuid[])--> content_items(items_created)processing_queue --(payload→pipeline_run_id)--> pipeline_runs[soft via JSONB]template_completions --(N:1)--> processing_queue
User / role / auth
Section titled “User / role / auth”user_profiles --(1:1 PK CASCADE)--> auth.usersuser_roles --(N:1 CASCADE)--> auth.userscontent_items.content_owner_id --(N:1 SET NULL)--> auth.users- All
*_bycolumns (created_by, updated_by, archived_by, verified_by, etc.) reference auth.users with mixed SET NULL / NO ACTION
Audit (planned)
Section titled “Audit (planned)”audit_log --(workspace_id-scoped)--> workspaces[planned]content_history --(N:1 SET NULL)--> content_items(existing)bid_response_history --(N:1)--> bid_responses(existing)
Memory / mempalace
Section titled “Memory / mempalace”mempalace wing --(1:1 logical via wing param = workspace_id)--> workspaces[soft external]user_memory_drawers --(N:1 planned)--> auth.users[planned]user_memory_drawers --(N:1 planned)--> workspaces[planned]
§3 — Concept gaps (mentioned in docs but not yet built)
Section titled “§3 — Concept gaps (mentioned in docs but not yet built)”For each: name + where mentioned + proposed shape.
| Concept | Mentioned in | Proposed shape |
|---|---|---|
q_a_pairs (first-class table) | 0.9-intended-architecture.md §4.3; Finding 02 §3.2 round-trip diagram; Finding 05 promote-to-Q&A | Dedicated table (workspace_id, question_text, answer_standard, answer_advanced, source_content_item_id, source_chunk_id, origin_kind, question_embedding, scope_tag[], anti_scope_tag[], valid_from, valid_to, confidence, governance fields). Form-agnostic per Theme A. |
q_a_extractions (derived cache) | 0.9-intended-architecture.md §4.3 | Cache populated by mempalace miner / cocoindex flow. Has source FKs, extractor_kind, extraction_confidence, promoted_to_pair_id, invalidated_at. |
citations (renamed + extended content_citations) | 0.9-intended-architecture.md §4.3; Finding 02 Rec 3 | Polymorphic citing_entity ∈ {bid_response, sales_proposal, q_a_pair, mcp_search_response}; cited target one-of {chunk, content_item, q_a_pair}; chunk offsets; citation_kind ∈ {verbatim_quote, paraphrase, derived_inference, q_a_match}. |
bid_question_matches (match cache) | 0.9-intended-architecture.md §4.3; Finding 02 Rec 4 | Caches q_a_pair / content_item / chunk matches for bid_questions. similarity_score, match_method, rank_in_results, recompute_run_id. May generalise to question_matches with question_kind per Theme A. |
bid_workspaces (satellite — Option B) | Finding 05 §5.3; 00-synthesis I1 | Per-type satellite for workspaces.type=‘bid’. 6-9 typed columns promoted from JSONB (buyer, deadline, submission_date, outcome, outcome_recorded_at, outcome_recorded_by, optional evaluator_score, evaluator_feedback). Pending Liam ruling. |
proposal_workspaces / competitor_workspaces / training_workspaces | Theme E + Finding 03 Shape B precedent | Mirror of bid_workspaces for each application type. |
form_templates / form_template_fields (with form_type) | Theme A + Finding 03 Q3.11 proposal | Renames/extends templates + template_fields. form_type discriminator ∈ {bid, RFP, PQQ, checklist, …}. Per Finding 04 + S231 OQ11 the underlying cataloguer skill is template-cataloguer/SKILL.md (specced but never built). |
audit_log (compliance UX audit table) | Finding 01 + 00-synthesis | Workspace_id-scoped audit trail. Distinct shape from content_history (human-readable; not row snapshots). |
op_id propagation pattern | Finding 01 + edit-flow §6.0.6 | New column on content_history (and possibly audit_log) for batch-rollback cohesion. Hybrid trigger / app-stamped. |
user_memory_drawers (KH-native mempalace replacement) | 0.9-intended-architecture.md §7.3 | KH platform-side per-user memory table. Drawer kinds: preference, context, reorientation, shortcut. Vector embedding. Temporal valid_from/valid_to. MCP tools save/recall/forget. |
cocoindex_source_key column on content_items | Q1.9 Scenario A | Stable source-key string identifying binary input under cocoindex source binding. |
pullmd_share_id typed column on content_items | Q1.10 | URL-input provenance. |
original_path + original_format typed columns on content_items | Q2.3 | External-folder canonical path + original format enum. |
scope_tag[] + anti_scope_tag[] typed columns on content_items | Q1.7 | Scope-control taxonomy for tenancy isolation + conflict-surfacing (WP-OPS-X-SCOPE-TAGS). |
chunk_kind column on content_chunks | Q1.5 | Chunking-strategy enum: heading-section / qa-block / paragraph. |
user_id partition column | Q1.13 | Per-user content visibility (Shape C-lite). |
workspaces.canonical_folder_path + adapter | 0.9-intended-architecture.md §5.4 | External-folder config — kind / config jsonb / watcher status / last sync. |
pipeline_runs.workspace_id already exists | active | (covered) |
| Knowledge Map (user-facing primitive) | CX.32 + §5.2.A.(i) | UI on top of workspace KG (entities + relationships + temporal validity). Substrate = Cocoindex. |
| Graphify confidence-label taxonomy (cross-surface) | Q4.14 + §5.2.C | EXTRACTED/INFERRED/AMBIGUOUS labels across Q&A extractions, citations, classification, search results. |
bid_response.evaluator_score + evaluator_feedback | Finding 05 | New columns capturing client-side scorecard outputs. |
bid_response_history.outcome_signal | Finding 05 | Per-version capture of outcome learning signal. |
| Coverage 4th gap source | Finding 04 §4.3 + Finding 05 Rec 5 (N4 cosmetic) | New TypeScript discriminator branch in UnifiedGap union — name pending (bid_response vs bid_question_match). |
| Cocoindex freshness signal | Theme D | Engine-side freshness — integration with content_items.freshness pending. |
| Cocoindex ops-DB ledger | Theme D + Finding 01 | Engine-managed audit ledger (source-key + content-hash history). |
lib/qa-mining/ directory (rename of bid-library-ingest) | Q5.9 + Q3.5 | Directory rename + Pattern A/B/C parser fate (retire vs adapter) — B1 in 00-synthesis pending. |
scripts/qa-migration/ (one-shot Phew migration) | OQ10 ratification | Migrates 5 historical Phew Q&A shapes to canonical YAML-frontmatter shape. |
| Predetermined-markdown Q&A YAML-frontmatter shape | OQ10 + S231 §7.2 | v1 canonical Q&A wire format (one .md per pair). Defines schema for question / answer_standard / answer_advanced / scope_tags / etc. |
template-cataloguer/SKILL.md (Claude skill) | Finding 04 Rec 5 + template-driven-completeness-spec §7.3 | AI-assisted cataloguing of forms for human QA. Output = generated scripts/catalogue-<slug>.ts seed-script-and-commit. |
| evaluate-form skill (per format type) | Theme B step 1 | Per-format docx/xlsx/pdf evaluator proposing markdown conversion approach. |
| classify-form-data skill | Theme B step 4 | Classify form data once converted to markdown. |
bid_template_requirements rename | I2 in 00-synthesis (Finding 04 vs 03 contradiction) | template_requirements renames if 3-table bid_*template rename adopted. |
| Anthropic re-anchor policy for citations on edit | edit-flow §6.0.2 | Citations touching edited content re-anchor on content_history v_n+1. |
| Conflict pre-commit downstream-impact UI | edit-flow §6.0.5 | UI surface for content-hash mismatch + downstream impact. |
| Folder adapter interface | 0.9-intended-architecture.md §5.4 | FolderAdapter interface — listFiles / readFile / watchFolder / writeFile / getFileMetadata. |
bid_response.integrated_at | OQ-Q38-G | Tracks when promotion to KB happened (avoids new state). |
q_a_pairs.provenance_source JSONB back-pointer | OQ-Q38-F + N11 in 00-synthesis | {kind: 'bid_response', bid_response_id, bid_workspace_id, integrated_at} when promoted from bid response. |
§4 — Application-to-data matrix
Section titled “§4 — Application-to-data matrix”Rows = applications. Columns = data entity categories. C = consumes, P = produces, G = governs, — = not used.
| Entity | bids | sector-intel | sales-proposals (future) | competitor-research (future) | training/onboarding (future) | product-guides (Phew use case) |
|---|---|---|---|---|---|---|
content_items | C+P | P (from feed_articles promotion) | C+P | C+P | C | C+P |
content_chunks | C | C | C | C | C | C |
content_history | C+P | P | P | P | C | P |
content_item_workspaces | C+P | C+P | C+P | C+P | C+P | C+P |
q_a_pairs (planned) | C+P (primary) | — (less likely per OQ-Q111-A) | C+P | — | — | C (existing Phew Q&A library) |
q_a_extractions (planned) | C+P | C? | C+P | C? | C? | C+P |
bid_questions | C+P | — | — | — | — | — |
bid_responses | C+P | — | — | — | — | — |
bid_response_history | C+P | — | — | — | — | — |
bid_workspaces (planned satellite) | C+P | — | — | — | — | — |
templates (rename → bid_templates) | C+P | — | — | — | — | — |
template_fields | C+P | — | — | — | — | — |
template_completions | C+P | — | — | — | — | — |
template_requirements | C | — | — | — | — | — |
form_templates (planned generalised) | C+P | — | C+P | C+P (?) | C+P (?) | C? |
citations / content_citations | C+P | — | C+P | — | — | — |
bid_question_matches (planned) | C+P | — | — (or proposal_question_matches) | — | — | — |
workspaces | C+P | C+P | C+P | C+P | C+P | C? |
proposal_workspaces (planned) | — | — | C+P | — | — | — |
competitor_workspaces (planned) | — | — | — | C+P | — | — |
training_workspaces (planned) | — | — | — | — | C+P | — |
company_profiles | C (organisation context) | C+P (primary) | C | C | C | C |
feed_sources | — | C+P | — | C? | — | — |
feed_prompts | — | C+P | — | C? | — | — |
feed_articles | C (when promoted) | C+P (primary) | C? | C? | — | — |
feed_flags | — | C+P | — | — | — | — |
si_processing_queue | — | C+P | — | — | — | — |
coverage_targets | C (gap discovery) | C | C | C | C | C |
governance_config | G | G | G | G | G | G |
guides + guide_sections | C | C | C | C | C+P (primary) | C+P |
taxonomy_domains + taxonomy_subtopics | C | C | C | C | C | C |
layer_vocabulary | C | C | C | C | C | C |
notifications | C+P | C+P | C+P | C+P | C+P | C+P |
user_notification_prefs | G | G | G | G | G | G |
review_assignments | C (KB hygiene → bid coverage) | C+P | C | C | C | C |
verification_history | C+P | C+P | C+P | C+P | C+P | C+P |
digests (change reports) | C | C | C | C | C | C |
tag_morphology_drift_flags | G | G | G | G | G | G |
entity_mentions | C | C | C | C | C | C |
entity_relationships | C | C | C | C | C | C |
entity_aliases | C | C | C | C | C | C |
Knowledge Map (planned) | C | C | C | C | C | C |
source_documents | C+P (tender uploads) | — | C+P (proposal templates) | C+P? | C? | — |
source_document_diffs | C+P | — | C+P | C? | — | — |
pipeline_runs | C+P | C+P | C+P | C+P | C+P | C+P |
processing_queue | C+P (template_fill / bid_draft_all) | — (uses si_processing_queue) | C+P (proposal_fill?) | C+P? | — | C+P (markdown_batch) |
read_marks | C+P | C+P | C+P | C+P | C+P | C+P |
classification_disputes | C+P | C+P | C+P | C+P | C+P | C+P |
content_templates | C | — | C | — | — | C |
audit_log (planned) | C+P | C+P | C+P | C+P | C+P | C+P |
user_memory_drawers (planned) | C+P | C+P | C+P | C+P | C+P | C+P |
user_profiles / user_roles | C | C | C | C | C | C |
mempalace wing (external 1:1 workspace) | C+P | C+P | C+P | C+P | C+P | C+P |
End of inventory. This is a research-only capture; ontology layer mapping (vocab/taxonomy/thesaurus/etc.) is for main session to derive from this base.