Knowledge base (GKB)#

Publishing to the knowledge base Publishing to the knowledge base

A write reaches canonical Markdown first. PostgreSQL holds a projection built from it, so the projection can be rebuilt.

Publishing#

Step

What happens

Code

1

A client or agent publishes an artifact with evidence, lineage and an Idempotency-Key: POST /v1/gkb/artifacts or MCP gkb_publish

2

The artifact is built and checked against its schemas and pack extensions

KnowledgeArtifact.from_draft, PartRegistry.add_extension_validator

3

The contribution sink takes it

knowledge/gkb/sink.py

4

The sink holds the writer lease and reserves the key in the filesystem journal

writer_lease.py, operations.py

5

The Markdown file is committed atomically. This is the durable commit

repository.py

6

The artifact is registered and an outbox event queued in one transaction

catalog.py

7

The caller gets a receipt: artifact ID, URI, content hash and projection state

If PostgreSQL is down, the commit still stands and registration waits.

Projecting#

The gkb-worker container claims outbox events with a lease, reads the artifact, verifies its content hash, projects it for search and review state, and completes the event (knowledge/gkb/worker.py, projectors.py).

Reading#

POST /v1/gkb/search, GET /v1/gkb/artifacts/{artifact_id} and MCP gkb_get_artifact read the projection.

Authority#

Rule

Meaning

Canonical Markdown is authoritative

The geonemo_gkb schema is a projection

One writer set per canonical root

Only the writer set that holds the root’s lease commits

The projection is rebuildable

Host-local administration (gkb_reconcile) registers canonical artifacts again

Other GKB containers: gkb-maintenance (compaction, event feeds, recovery) and gkb-backup (backup cycle, profile gkb-backup). Reset, restore and reconciliation are host-local commands, never remote APIs.