Skip to content

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.

  • 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_id chain 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 at app/api/upload/route.ts:444-447 AND platform-not-live). Under cocoindex Scenario A → Option α (slim-and-keep) retiring versioning cols; Option β drops entirely.
  • 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: active for 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_path column).
  • Description: Raw binary file storage for uploaded source documents and bid templates.
  • Lifecycle stage: active for 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.

  • 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: embedding vector(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).
  • 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, drop q_a_pair content_type post Q3 split). Wide table; substantial.
  • 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 trigger auto_version_content_history() on INSERT. Trigger ensure_v1_history_at_commit() guarantees every content_item has a v1 history row at commit time. Trigger enforce_archive_state_consistency() enforces the archive-state invariant (publication_status='archived' ↔ archived_at IS NOT NULL) on content_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), title snapshot, content snapshot, brief/detail/reference snapshots, metadata snapshot, 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 with op_id for rollback cohesion.
  • 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), embedding vector, 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 with chunk_kind enum (heading-section / qa-block / paragraph).
  • 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).
  • 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.
  • 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).
  • 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 (via disputed_by + resolved_by — FKs target the user_profiles mirror, not auth.users directly).
  • Application served: cross-cutting governance / quality-feedback loop.
  • Lifecycle stage: partially-built (table + RLS shipped; UI partial).
  • 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_by self-FK + helper lib/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.

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, with answer_standard and answer_advanced columns + 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_items relationships apply; matched via bid_questions.matched_content_ids.
  • Application served: bids (citation, drafting); planned: sales-proposals, training, competitor-research.
  • Lifecycle stage: legacy (current shape) → migrating to dedicated q_a_pairs domain 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_tag overlap.
  • Key attributes (proposed, S235 ratified): source_workspace_id (NULLABLE — provenance audit only, e.g. captures originating workspace for origin_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_embedding vector(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 direct workspace_id FK (supersedes 0.9-intended-architecture.md §4.3 workspace_id UUID NOT NULL sketch). private_to_workspace_id deferred to v1.1 per Q-OQR1-08.
  • Relationships:
    • --(N:1 NULLABLE)--> workspaces via source_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 from bid_question_matches per OQ-Q113-C; question_kind discriminator aligns with form_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 of extract_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).
  • 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 to lib/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).

  • Home: public.workspaces (rows: 4 — all type='intelligence').
  • Description: Generic container with type discriminator. S235 ratified per Q-OQR1-01 Option (c): workspaces.type text column retires; replaced by workspaces.application_type_id FK to new application_types table (rich config table with provenance enum per Q-OQR1-11). color + icon columns are residue from a prior UI in which workspaces was 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_section retires entirely per Q-OQR1-S235 (zero prod rows; not in 6-baseline core list). Code registry additionally references proposal-placeholder (not in DB CHECK — source pointer needed). domain_metadata (jsonb — type-specific; columns promote to procurement_workspaces satellite per Finding 05 Option B), status — CHECK enum is the 10 BID_STATES verbatim. S235 rename per Q-OQR1-02: BID_STATESPROCUREMENT_WORKFLOW_STATES; projects_status_check CHECK gets renamed accordingly. State-machine code: lib/bid/bid-state-machine.tslib/procurement/procurement-workflow.ts per 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 — replaces type text column), domain_metadata (deprecated; promoting to per-application_type satellite tables), status (constrained by application_types.state_machine_name per row). New nullable column scope_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_idworkspace_id rename 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.type text 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), provenance enum (core / client / recommended per Q-OQR1-11), is_active, display_order, client_extensible flag, editable_via enum (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 baseline core seed 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_id matching procurement row. 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) from domain_metadata to 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; the application_types row 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.ts BID_STATES const 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 by lib/bid/bid-state-machine.ts).

  • 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 — NOT not_started/ai_drafted/needs_review as 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: active schema; empty in prod (not live).
  • 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 per bid-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: active schema; empty in prod.
  • 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_signal extension per Finding 05.
  • Lifecycle stage: active.
  • Home: types/bid.ts + lib/validation/schemas.ts parseBidMetadata().
  • Description: TypeScript shape for workspaces.domain_metadata JSONB when type='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 on bid_workspaces satellite.
  • 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).
  • 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).
  • Home: types/bid.ts.
  • Description: Bid-response → KB promotion candidate. Has recommendation enum: new_entry / update_existing / skip.
  • Lifecycle stage: active (UC-C outcome → corpus integration; Finding 05).
  • 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.

  • 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 on slug exists 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.
  • 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.
  • 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.
  • 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 via idx_feed_articles_dedup), external_id, title, raw_content, ai_summary (intentionally separate from content_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 to 0.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.
  • 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.
  • Home: public.si_processing_queue (rows: 2144).
  • Description: SEPARATE queue table for intelligence pipeline jobs (distinct from processing_queue which 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.
  • 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.

  • 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: active schema; empty in prod. Theme A generalisation: → form_templates with form_type (bid/RFP/PQQ/checklist).
  • 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 — NOT table_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 — NOT auto_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).
  • 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.
  • 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 — NOT ITT; 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 — checklist is NOT in the enum; ontology §5 disposition “do not add checklist” 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_embedding vector(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 in lib/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_fields with form_type discriminator (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); pipeline specced-but-not-built.

  • 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 with q_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_entity enum, 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_data from 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_matches with question_kind discriminator.
  • 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 separate embedding_score + fulltext_score per N9.
  • Application served: bids; future: any form-type matching.
  • Lifecycle stage: specced-but-not-built.

  • 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.
  • 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).
  • 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.
  • 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.
  • 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.
  • 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 separate filters + governance_summary columns was wrong; both phantoms — actual schema has single metadata jsonb).
  • 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 at app/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 at app/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 + trigger enforce_archive_state_consistency.
  • Description: Bidirectional invariant publication_status='archived' ↔ archived_at IS NOT NULL. State machine docs at docs/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 to content_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 at app/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 to bid_question or bid_question_match pending).
  • Lifecycle stage: active.
  • Home: public.guides (rows: 11).
  • Description: Content completeness guides — curated reading experiences organised by sector/product. guide_type CHECK enum 5 values: sector, product, company, research, custom (verified S234 — completeness is 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.

  • 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), confidence numeric(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.
  • 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 with valid_from / valid_to (mempalace Shape A temporal), provenance enum (EXTRACTED/INFERRED/AMBIGUOUS per Q4.7), adapter_name. Add kg_invalidate() RPC.
  • 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.
  • 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) and kg_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.

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.
  • 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.
  • Home: content_items.content_owner_id FK → auth.users.
  • Description: User responsible for keeping content current. Drives owner notifications and “my content” filters.
  • Lifecycle stage: active.
  • Home: types/owner.ts.
  • Description: Per-owner content stats: total_items + fresh/aging/stale/expired/unverified counts + display_name.
  • Lifecycle stage: active.
  • 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.

  • 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).
  • 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.
  • 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.
  • 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)”
  • Home: Planned — content_items.cocoindex_source_key per Q1.9 Scenario A.
  • Description: Stable source-key identifying a binary input under cocoindex’s source binding. Carries binary identity in lieu of source_documents versioning columns under Option α/β.
  • Lifecycle stage: specced-but-not-built (B2 in 00-synthesis pending Liam ruling).
  • 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 integration specced-but-not-built.

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.md mempalace_search ⚠ PARTIAL.
  • Home: mempalace MCP drawer_* tools.
  • Description: Memory item — content + metadata (entity codes + emotion markers + pipe-separated fields, AAAK format).
  • Lifecycle stage: active (dev workflow).
  • Home: mempalace MCP tunnel_* tools.
  • Description: Cross-drawer / cross-wing relationship edge. Powers mempalace_follow_tunnels traversal.
  • Lifecycle stage: active (dev workflow).
  • 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) for kg_add/kg_query/kg_stats. Per Q4.1 + Q4.8: shape adopted onto entity_relationships. KG empty until seeded.
  • Home: mempalace MCP diary_* tools.
  • Description: Session diary in AAAK format. Default wing_<agent> works; cross-project wing parameter 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).

  • 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.
  • 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.
  • 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)”
  • 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.
  • Home: types/filter-preset.ts.
  • Description: Saved browse-filter preset. System presets (deterministic slugs) + user presets (u_ prefix). params is 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.
  • Home: RPC hybrid_search, search_for_bid_response, search_content_chunks. HNSW index on content_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.

Entity: Sales proposals (future application)

Section titled “Entity: Sales proposals (future application)”
  • Home: Per CLAUDE.md + Theme E. Planned sales_proposal_* family. Stub mention in citations.citing_entity planned enum.
  • Description: Next application after bids. Templates ≠ bid templates; responses cite q_a_pairs via polymorphic citations table. New sales_proposal_templates table 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 application distinct 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_type values in use: 5 (edit/classify/import/archive/delete).
  • 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. Also pipeline_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).

  • 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_workspaces JOIN 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_path and templates.storage_path.
  • Description: Binary storage. Per Q2.6: no v1 audit-bucket; v2 evaluate.
  • Lifecycle stage: active (templates); active-but-empty (source_documents).
  • Home: public.quality_issues_pending.
  • Description: Unresolved quality flags JOINed with content_item details — feeds review queue.
  • Lifecycle stage: active.
  • Home: PIPELINE_SYSTEM_USER_ID = 'a0000000-0000-4000-8000-000000000001' (constant in lib/intelligence/types.ts, lib/auth/owner-default.ts).
  • Description: Service account UUID for classifyContent and pipeline writes (NOT a literal string per CLAUDE.md Gotcha).
  • Lifecycle stage: active.

Flat relationship list — EntityA --(kind)--> EntityB. Soft pointers marked [soft].

  • content_items --(M:N via content_item_workspaces)--> workspaces
  • content_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_history
  • content_items --(1:N CASCADE)--> content_chunks
  • content_items --(1:N CASCADE)--> entity_mentions
  • content_items --(1:N)--> ingestion_quality_log
  • content_items --(1:N)--> read_marks
  • content_items --(1:N CASCADE)--> classification_disputes
  • content_items --(1:N)--> verification_history
  • content_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 --(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_documents
  • workspaces --(1:N)--> feed_sources (CASCADE)
  • workspaces --(1:N)--> feed_prompts (CASCADE)
  • workspaces --(1:N)--> feed_articles (CASCADE)
  • workspaces --(1:N)--> si_processing_queue
  • workspaces --(1:N)--> pipeline_runs
  • workspaces --(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_requirements
  • bid_questions --(1:N)--> bid_responses
  • bid_questions --(1:N planned)--> bid_question_matches
  • bid_questions --(soft uuid[])--> content_items (matched_content_ids legacy)
  • bid_responses --(1:N)--> bid_response_history
  • bid_responses --(1:N)--> content_citations
  • bid_responses --(soft uuid[])--> content_items (source_content_ids)
  • content_citations --(N:1)--> bid_responses
  • content_citations --(N:1)--> content_items
  • q_a_pairs --(N:1)--> workspaces
  • q_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_items
  • q_a_extractions --(N:1)--> content_chunks
  • q_a_extractions --(promoted_to)--> q_a_pairs
  • citations --(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_questions
  • bid_question_matches --(N:1)--> q_a_pairs / content_items / content_chunks
  • templates --(N:1)--> workspaces
  • templates --(1:N)--> template_fields
  • templates --(1:N)--> template_completions
  • template_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
  • entity_mentions --(N:1 CASCADE)--> content_items
  • entity_relationships --(N:1 SET NULL)--> content_items (source_item_id)
  • entity_aliases standalone (text-keyed canonical mapping)
  • Planned: entity_relationships --(extended cols)--> {valid_from, valid_to, provenance, adapter_name}
  • feed_sources --(N:1 CASCADE)--> workspaces
  • feed_sources --(1:N)--> feed_articles
  • feed_articles --(N:1 CASCADE)--> workspaces
  • feed_articles --(N:1 CASCADE)--> feed_sources
  • feed_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_flags
  • feed_flags --(N:1)--> feed_prompts (prompt_version_id)
  • feed_flags --(N:1)--> auth.users (flagged_by, resolved_by)
  • feed_prompts --(N:1 CASCADE)--> workspaces
  • company_profiles [soft per-workspace anchor — no FK in current schema]
  • si_processing_queue --(N:1)--> workspaces
  • si_processing_queue --(N:1)--> feed_sources
  • coverage_targets --(N:1)--> taxonomy_domains
  • taxonomy_subtopics --(N:1)--> taxonomy_domains
  • guides --(1:N)--> guide_sections
  • governance_config --(N:1 logical)--> taxonomy_domains (domain text)
  • notifications --(N:1 CASCADE)--> auth.users
  • notifications --(polymorphic via entity_type + entity_id)--> {content_item, digest, template_requirement, domain, source_document, entity_mention}
  • user_notification_prefs --(N:1 CASCADE)--> auth.users
  • review_assignments --(N:1)--> auth.users (reviewer_id, assigned_by)
  • verification_history --(N:1)--> content_items
  • verification_history --(N:1 SET NULL)--> auth.users (performed_by)
  • tag_morphology_drift_flags --(soft uuid[])--> content_items (affected_content_ids)
  • source_documents --(self-FK)--> source_documents.parent_id
  • source_documents --(N:1)--> pipeline_runs
  • source_documents --(N:1)--> workspaces
  • source_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_runs --(N:1)--> workspaces
  • pipeline_runs --(1:N)--> source_documents
  • pipeline_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_profiles --(1:1 PK CASCADE)--> auth.users
  • user_roles --(N:1 CASCADE)--> auth.users
  • content_items.content_owner_id --(N:1 SET NULL)--> auth.users
  • All *_by columns (created_by, updated_by, archived_by, verified_by, etc.) reference auth.users with mixed SET NULL / NO ACTION
  • audit_log --(workspace_id-scoped)--> workspaces [planned]
  • content_history --(N:1 SET NULL)--> content_items (existing)
  • bid_response_history --(N:1)--> bid_responses (existing)
  • 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.

ConceptMentioned inProposed 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&ADedicated 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.3Cache 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 3Polymorphic 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 4Caches 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 I1Per-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_workspacesTheme E + Finding 03 Shape B precedentMirror of bid_workspaces for each application type.
form_templates / form_template_fields (with form_type)Theme A + Finding 03 Q3.11 proposalRenames/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-synthesisWorkspace_id-scoped audit trail. Distinct shape from content_history (human-readable; not row snapshots).
op_id propagation patternFinding 01 + edit-flow §6.0.6New 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.3KH 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_itemsQ1.9 Scenario AStable source-key string identifying binary input under cocoindex source binding.
pullmd_share_id typed column on content_itemsQ1.10URL-input provenance.
original_path + original_format typed columns on content_itemsQ2.3External-folder canonical path + original format enum.
scope_tag[] + anti_scope_tag[] typed columns on content_itemsQ1.7Scope-control taxonomy for tenancy isolation + conflict-surfacing (WP-OPS-X-SCOPE-TAGS).
chunk_kind column on content_chunksQ1.5Chunking-strategy enum: heading-section / qa-block / paragraph.
user_id partition columnQ1.13Per-user content visibility (Shape C-lite).
workspaces.canonical_folder_path + adapter0.9-intended-architecture.md §5.4External-folder config — kind / config jsonb / watcher status / last sync.
pipeline_runs.workspace_id already existsactive(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.CEXTRACTED/INFERRED/AMBIGUOUS labels across Q&A extractions, citations, classification, search results.
bid_response.evaluator_score + evaluator_feedbackFinding 05New columns capturing client-side scorecard outputs.
bid_response_history.outcome_signalFinding 05Per-version capture of outcome learning signal.
Coverage 4th gap sourceFinding 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 signalTheme DEngine-side freshness — integration with content_items.freshness pending.
Cocoindex ops-DB ledgerTheme D + Finding 01Engine-managed audit ledger (source-key + content-hash history).
lib/qa-mining/ directory (rename of bid-library-ingest)Q5.9 + Q3.5Directory rename + Pattern A/B/C parser fate (retire vs adapter) — B1 in 00-synthesis pending.
scripts/qa-migration/ (one-shot Phew migration)OQ10 ratificationMigrates 5 historical Phew Q&A shapes to canonical YAML-frontmatter shape.
Predetermined-markdown Q&A YAML-frontmatter shapeOQ10 + S231 §7.2v1 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.3AI-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 1Per-format docx/xlsx/pdf evaluator proposing markdown conversion approach.
classify-form-data skillTheme B step 4Classify form data once converted to markdown.
bid_template_requirements renameI2 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 editedit-flow §6.0.2Citations touching edited content re-anchor on content_history v_n+1.
Conflict pre-commit downstream-impact UIedit-flow §6.0.5UI surface for content-hash mismatch + downstream impact.
Folder adapter interface0.9-intended-architecture.md §5.4FolderAdapter interface — listFiles / readFile / watchFolder / writeFile / getFileMetadata.
bid_response.integrated_atOQ-Q38-GTracks when promotion to KB happened (avoids new state).
q_a_pairs.provenance_source JSONB back-pointerOQ-Q38-F + N11 in 00-synthesis{kind: 'bid_response', bid_response_id, bid_workspace_id, integrated_at} when promoted from bid response.

Rows = applications. Columns = data entity categories. C = consumes, P = produces, G = governs, = not used.

Entitybidssector-intelsales-proposals (future)competitor-research (future)training/onboarding (future)product-guides (Phew use case)
content_itemsC+PP (from feed_articles promotion)C+PC+PCC+P
content_chunksCCCCCC
content_historyC+PPPPCP
content_item_workspacesC+PC+PC+PC+PC+PC+P
q_a_pairs (planned)C+P (primary)— (less likely per OQ-Q111-A)C+PC (existing Phew Q&A library)
q_a_extractions (planned)C+PC?C+PC?C?C+P
bid_questionsC+P
bid_responsesC+P
bid_response_historyC+P
bid_workspaces (planned satellite)C+P
templates (rename → bid_templates)C+P
template_fieldsC+P
template_completionsC+P
template_requirementsC
form_templates (planned generalised)C+PC+PC+P (?)C+P (?)C?
citations / content_citationsC+PC+P
bid_question_matches (planned)C+P— (or proposal_question_matches)
workspacesC+PC+PC+PC+PC+PC?
proposal_workspaces (planned)C+P
competitor_workspaces (planned)C+P
training_workspaces (planned)C+P
company_profilesC (organisation context)C+P (primary)CCCC
feed_sourcesC+PC?
feed_promptsC+PC?
feed_articlesC (when promoted)C+P (primary)C?C?
feed_flagsC+P
si_processing_queueC+P
coverage_targetsC (gap discovery)CCCCC
governance_configGGGGGG
guides + guide_sectionsCCCCC+P (primary)C+P
taxonomy_domains + taxonomy_subtopicsCCCCCC
layer_vocabularyCCCCCC
notificationsC+PC+PC+PC+PC+PC+P
user_notification_prefsGGGGGG
review_assignmentsC (KB hygiene → bid coverage)C+PCCCC
verification_historyC+PC+PC+PC+PC+PC+P
digests (change reports)CCCCCC
tag_morphology_drift_flagsGGGGGG
entity_mentionsCCCCCC
entity_relationshipsCCCCCC
entity_aliasesCCCCCC
Knowledge Map (planned)CCCCCC
source_documentsC+P (tender uploads)C+P (proposal templates)C+P?C?
source_document_diffsC+PC+PC?
pipeline_runsC+PC+PC+PC+PC+PC+P
processing_queueC+P (template_fill / bid_draft_all)— (uses si_processing_queue)C+P (proposal_fill?)C+P?C+P (markdown_batch)
read_marksC+PC+PC+PC+PC+PC+P
classification_disputesC+PC+PC+PC+PC+PC+P
content_templatesCCC
audit_log (planned)C+PC+PC+PC+PC+PC+P
user_memory_drawers (planned)C+PC+PC+PC+PC+PC+P
user_profiles / user_rolesCCCCCC
mempalace wing (external 1:1 workspace)C+PC+PC+PC+PC+PC+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.