Pillar 1 · Corpus (the asset)

Updated · View the entry on sijie.xyz ↗

The owner's knowledge base — the moat. One table, corpus_notes, with a genre column (raw / wiki / output / subjectivity / writing) — the three tiers are still raw→wiki→output (isomorphic to an Obsidian vault's raw→wiki→output), but the separate raw_entries / wiki_entries / output_entries / writings tables were folded into that one structure on 2026-07-09 (d925d9081 raw, bfb8c7129 writings; backend/db/schema.sql:189). A parent_id derived-path tree (no path column; re-parenting is free), and note_refs backlink edge tables (renamed from wiki_refs, 4fc769d61, 2026-07-06) rebuilt declaratively from [[wikilinks]]. Fields: excerpt (was summary), published (was seo_indexed). Ingress today = full vault SyncVault (raw + writing + wiki/subjectivity + CSS) + writings export/import + admin direct writes; egress = the landing/reader (app/src/app/wiki|output|writings) and the agent's retrieval tools.

Status: the corpus-as-vault block has landed — all three faces built: feed (SyncVault wires raw + writing + wiki/subjectivity + .obsidian CSS; output stays promote-derived; reverse export writes wiki/subjectivity/output back as genre folder + tree + folder-notes since 2026-07-29 — backend/internal/corpus/obsidian/export_corpus.go, 9f1ffcf13 — alongside writings/<slug>.md), crawl (Meili FTS + corpus_links 1-hop over note_refs, ACL in query), render (KaTeX + Mermaid + callouts + TikZ + widgets). Sync is now a sync-mode connector (backend/internal/connector/obsidian.go).

flowchart LR
  OV["owner side:
Obsidian vault · AI session (push)"] -- "feed face" --> RAW
  subgraph SM["StandMeet — our box"]
    RAW["corpus_notes · genre=raw"] -- promote --> WIKI["corpus_notes · genre=wiki"]
    WIKI -- promote --> OUT["corpus_notes · genre=output"]
    WIKI --- REFS["note_refs
(edge table, rebuilt)"]
    WIKI --> READER["reader UI (app, Next.js)
/wiki /output /writings
(render face)"]
    OUT --> READER
    WIKI --> RET["retrieval (crawl face)
> > Meili lexical entry + corpus_links (1-hop, agent drives depth)"]
  end
  READER --> VIS["visitors · crawlers"]

Data model (ER)

erDiagram
  CORPUS_NOTES |o--o{ CORPUS_NOTES : "parent_id (derived-path tree, every genre)"
  CORPUS_NOTES ||--o{ CORPUS_NOTES : "source_ids / promoted_to (raw→wiki→output)"
  CORPUS_NOTES ||--o{ NOTE_REFS : "outgoing links (wiki/subjectivity)"
  NOTE_REFS }o--|| CORPUS_NOTES : "targets"
  CORPUS_NOTES ||--o{ WRITING_REFS : "links (genre=writing)"
  ASSETS ||--o{ ASSET_REFERENCES : "in use by"
  ASSET_REFERENCES }o--|| CORPUS_NOTES : "referrer (cover / body standmeet-asset:id)"

  CORPUS_NOTES {
    text genre
    uuid parent_id
    uuid[] source_ids
    text excerpt
    bool published
    bool show_as_source
    text slug
    timestamptz published_at
  }
  ASSETS {
    uuid owner_id
    text kind
  }

media_assets (three genre FKs, zero writers) is gone; media now lives in an owner-scoped global asset pool — assets + asset_references, a referenced asset cannot be deleted (d81d2782a, 2026-09-05; backend/db/schema.sql:585-613).

Two link estates on purpose: note_refs for the corpus tree, writing_refs for writings — both rebuilt declaratively, never hand-maintained (backlinks-as-rebuilt-edge-tables). Writings vs the corpus tiers is a standing confusable (confusables) — even now that both are rows of corpus_notes, writing addressing stays flat and slug-keyed while wiki/output paths derive from the tree.

Children

  • corpus-diagram-coverage — diagram-coverage ledger.
  • derived-path-corpus-as-filesystem — parent_id tree, paths derived not stored.
  • three-tier-corpus-promotion — raw→wiki→output as the curation pipeline.
  • backlinks-as-rebuilt-edge-tables — note_refs/writing_refs, declaratively rebuilt.
  • global-asset-pool — one owner-scoped assets pool + asset_references recomputed from content on every save; a referenced asset refuses delete and names its referrers.
  • corpus-retrieval — Meilisearch lexical (Postgres FTS fallback) + tree + corpus_links (1-hop; the agent drives depth — the BFS was the wrong model) (no vector, by choice).
  • writings-import-export — the obsidian subsystem: zip layout, publish-gate, source-path/slug idempotency (the web-edit guard is gone — the vault is the single live source), whole-batch link resolution; identity keyed on title, and a rename deliberately orphans.
  • obsidian-sync-mechanism — the sync design (protocol / vault-ingestion / rendering-and-extensibility); all genres wired both ways, and it now runs as a sync-mode connector.
  • rendering-engines — render symmetry: KaTeX · Mermaid · TikZ · callouts · widgets, all live.

Related notes