Search and contents

Database reference

An operator's guide to Kindred's Postgres: what's in it, how a node finds it, how to look inside, how to back it up, and what the common errors mean. This is the one place database knowledge lives — other docs link here instead of restating it.

At a glance

  • One PostgreSQL 16 instance per node appliance, with the pgvector extension. Everything a node persists lives in one database in that instance (default name kindred).
  • A node creates its own tables at startup (CREATE TABLE IF NOT EXISTS). The installer only creates the empty database and enables pgvector; you never create tables by hand.
  • An appliance is rebuilt from the repository, never patched. A patch and an upgrade are the same act: change the repository, then re-run the provisioning scripts on the same host. The data stays in Postgres across a rebuild, and startup creates missing tables and adds missing columns (for example activity_log's chain_hash, chain_prev_hash and seq) but never changes an existing column, so a rebuilt engine reads the tables its predecessor wrote. There is no migration tooling and no hotfix path. See Appliance Lifecycle.
  • The engine never deletes rows from its audit and work tables (the order-narrative cache can be flushed, see order_narrative_cache). Only test teardown drops a table. Tables grow until you decide otherwise (see Housekeeping).
  • Nodes on different appliances do not share a database. Structured facts cross between nodes through the Communication Interface (communication-interface.md), never through a shared table.

What's in the database

TableHoldsPresent on
kindred_schema_generation The one row recording the schema generation this database was written under (see Schema generations) every node's Activity Log database
kindred_node_liveness When each Node instance was last known to be running, which is how a start finds the time it was away (see Coverage gaps) every node
trigger_queue Fired Triggers waiting to run, running, or finished every node
activity_log Append-only record of every Task run every node
activity_log_chain_heads The current hash-chain head of each node instance's activity_log entries every node
identity_records Resolved and pending identities for orders, materials and qualifications every node
mqtt_dead_letters MQTT messages that could not be ingested, kept for inspection nodes whose config has an mqtt section
database_log_watermarks Where each database log scan has read up to nodes whose config has a database_log section
database_log_dead_letters Database log rows that could not be ingested, kept for inspection nodes whose config has a database_log section
document_intake_ledger Which document revisions each intake provider has had handled, so one is never handled twice nodes whose config has a document_intake section
document_queue Documents and availability calls the management API staged for the Node to apply, then the record of how each ended nodes whose config has a document_intake section with a provider of kind rest
pending_signoffs Records awaiting (or through) human sign-off nodes whose config has an inference section
document_config_history Append-only record of each document type's chunking configuration and of the embedding profile, one numbered version per fingerprint, which every chunk is stamped with nodes whose config has a document_intake section
instruction_claim_drafts One row per candidate instruction claim the drafter has dealt with, so a claim is submitted for review once nodes whose config has a document_intake section
instruction_run_summaries One small row per run of a bound tag: the count, smallest, mean and largest reading and the standard deviation, never a reading nodes whose config has an instruction_bindings section
instruction_alerts One row per alert an alert-mode binding raised: the reading that confirmed it, the limit it crossed, how long it had lasted and how many repeats were counted, never any wording from a claim nodes whose config has an instruction_bindings section
instruction_alert_acknowledgements One row per alert a person acknowledged: who, when and which of three dispositions, never any text a person wrote nodes whose config has an instruction_bindings section
order_narrative_cache Cached order narratives, keyed by a fingerprint of the input they were drafted from nodes whose config has an inference section
embedding_store_profile The embedding model and dimensions each embeddings table was filled under nodes whose config has an embedding section
embeddings_<node_type>_<hash> That Node Type's Playbook chunks and embeddings, past case records included: precedent retrieval reads the same table nodes whose config has an embedding section

<hash> is a short digest of the Node Type name, so two names that differ only in punctuation can never collide. List a node's embedding tables with \dt embeddings_* in psql.

trigger_queue

The node's work list. Each fired Trigger is one row; the dispatch loop claims a row, runs its Task, and marks it finished. Detail: trigger-dispatch-queue.md.

ColumnMeaning
id Stable ID from whatever fired the Trigger. A redelivered Trigger with the same ID is ignored, so nothing runs twice.
trigger_type Which kind of Trigger (order_release, material_observed, …)
payload The event's data (JSONB)
status pending → claimed → done, or dead_lettered when retries run out
attempt_count Tries so far
enqueued_at, claimed_at, resolved_at Lifecycle timestamps

A dead_lettered row is the terminal failure state; it shows as gave_up or exhausted in the Activity Log and on the Activity Map. Nothing retries it again.

document_intake_ledger

The record that makes document intake idempotent. A row means a provider's document revision was handled; the Node checks it before it hands a document on, so a document a provider offers again is not handled twice, and an older revision of a document is not put back over a newer one. It holds ids and times only, never document text.

ColumnMeaning
provider The provider's name in the document_intake section. Renaming a provider offers its documents again
source_document_id The document's id as the provider gives it; for a type that keeps each revision, id@revision_label
source_revised_at When that revision was made
document_type The type the revision was handled as
handled_at When it was handled

The primary key is the first three columns, so two providers that use the same document id never affect each other. Recording a revision removes any later revision recorded for the same provider and document, because an item flagged overwrite replaces the stored content with an older revision and the later one must then be handled again. A row is removed by nothing else; to have a document handled again without overwrite, delete its rows.

document_queue

The queue the management API's document routes write to and the Node's worker drains, with the same columns and statuses as trigger_queue and a table of its own, so a backlog of documents never sits in front of a production trigger. A document_intake row is one document revision and a document_state row one call to deactivate or activate a stored document. The management API is the only other writer: the Node creates the table when it starts with a provider of kind rest, and the API never creates or alters it.

A row's id is derived from the document and revision (or, for a flagged re-send and an availability call, also the sender's request id), so a call sent twice is one row. While a row is pending or claimed its payload holds the document text, and the sum of that text across those rows is what the byte cap bounds. When a row ends (done or dead_lettered) the payload is replaced by a record of the outcome: the document id, the outcome, the chunk count, a reason class and the id of the token that sent it, and for a submission the revision time and the document type. The document text is not kept, so an ended row cannot be retried from here. Nothing removes ended rows: they hold ids and no text, at the pace documents are sent, and the byte count the cap uses reads only the rows still waiting. An operator may delete old ended rows; a revision sent again after its row is gone is new work, not a repeat.

mqtt_dead_letters

A message from a plant MQTT broker that the Node could not ingest. A message lands here when the pipeline rejects it, or when the database keeps refusing it with an error that can pass (a deadlock, a statement timeout) after five tries. A database that cannot be reached is not counted: it is retried until it returns. The message is acknowledged to the broker once it is here, so one bad message never holds up the ones behind it.

ColumnMeaning
id The message's trigger id; a redelivered message is one row
topic The MQTT topic it arrived on
record The parsed message (JSONB). The payload is stored here and never written to a log
reason The exception type, never its text
attempts Ingest attempts made
dead_lettered_at When it was kept

Nothing reads the table back by itself: a row is for an operator to look at and, once the cause is fixed, to re-publish from the source.

database_log_watermarks

Where a Node's scan of a target system's database table has read up to, so a restart resumes there. One row per Node instance and source. Detail: database-log-scanning.md.

ColumnMeaning
node_instance_id The Node that reads the table
source host:port/database/table, so pointing the section at another database or table starts a first scan
position The highest position delivered, as JSON holding the last row's watermark and key, each tagged with its type. NULL records that the first scan found an empty table under start_from: now
start_position The position the first scan began from, the floor of every later lookback. NULL for start_from: beginning
updated_at When the position last moved

Removing a row starts that source again, which recovers a stopped scan only with start_from: beginning (see the scanning page). The engine never changes the shape of a table that exists, so a column a later release adds to this one is not added to yours.

database_log_dead_letters

A row of a target system's database table that the Node could not ingest. A row lands here when the pipeline rejects it, or when the Node's database keeps refusing it with an error that can pass (a deadlock, a statement timeout) after five tries, or with any other error on the Node's side. A Node database that cannot be reached is not counted: the scan stops and tries again. The scan moves past a row once it is here, so one bad row never holds up the ones behind it, and the row counts as dealt with, so a re-read does not offer it again. A run of max_consecutive_rejections rows (50 unless the section sets it) kept one after another is not one bad row: the scan stops, with one Activity Log entry and the watermark where it was, until the Node is restarted.

ColumnMeaning
id The row's trigger id; a row read twice is one row here
target host:port/database/table it came from
key The row's key column value, as text
record The converted row (JSONB). It is stored here and never written to a log
reason The exception type, never its text
attempts Ingest attempts made
dead_lettered_at When it was kept

Nothing reads the table back by itself: a row is for an operator to look at. Count and read them with the queries in database-log-scanning.md.

activity_log

The audit trail. One row per Task run, written once and never updated. The database enforces that: two triggers, installed whenever a node starts, reject UPDATE, DELETE and TRUNCATE on the table (see Growth and retention for the deliberate exception). Each write is also queued for fire-and-forget publishing, by a long-lived background publisher (a bounded queue; events are lost, not saved, if the broker is unreachable for long), to the node's local MQTT broker on kindred/activity_log (that feed drives the Activity Map); the table is the durable record. Detail: wiring-task-execution-to-activity-log.md.

ColumnMeaning
id Unique ID of the run
node_type, node_instance_id Which node did it
occurred_at When
seq A sequence-assigned insertion counter, the tiebreak between entries sharing an occurred_at. NULL on rows written before the column existed. See activity-log-query-ordering-and-filtering.md.
trigger What set it off
task_type, workflow_pattern Which Task ran, and the deterministic Workflow pattern it used
outcome How it ended (for example succeeded, new, reconciled, flagged_first_article, exhausted)
peer_nodes_queried Peer nodes asked for data during the run (JSONB list)
reference_ids Links to what the run touched — order or vendor/lot reference, identity_record_id, trigger_queue_id (JSONB)
chain_hash, chain_prev_hash The entry's place in its node instance's hash chain: its own hash and the hash of the entry before it (NULL chain_prev_hash on the first chained entry). Both NULL on rows that predate the chain.

reference_ids is how you trace across tables: the trigger_queue_id in a run's row is the queue row that started it, and its identity_record_id is the identity record it created or matched.

activity_log_chain_heads

One row per node instance holding the hash at the end of that instance's activity_log chain, so a write can link to its predecessor without walking the log. Each activity_log write updates it in the same transaction. Unlike activity_log, no trigger guards it; verify_chain reports a disagreement between it and the entries as a head mismatch. Detail: activity-log-tamper-evidence.md.

ColumnMeaning
node_instance_id The node instance (primary key)
head_hash Hash of that instance's latest chained entry
updated_at When the head last moved

kindred_node_liveness

One row per Node instance: the last time that instance was known to be running. A scheduled task refreshes it every LIVENESS_INTERVAL_SECONDS, and a Node reads it once, as it starts, to find out how long it was away (see Coverage gaps).

ColumnMeaning
node_instance_id The Node instance (the primary key)
last_alive_at When the instance last refreshed the row, UTC

The table is additive: it is created when a Node starts and is not part of the schema generation (see Schema generations), so a database written by an earlier release starts unchanged and gains the table. The row is held where it is, not refreshed, while a Node-outage gap is waiting for its outcome, so a Node that stops in that time finds the same gap again.

order_narrative_cache

The node's saved order narratives, so an order whose assembled trail has not changed is not narrated again. Created only when inference is enabled. Detail: order-narrative-result-caching.md.

ColumnMeaning
fingerprint Hash of the exact input the narrative was drafted from (primary key)
order_id The order it narrates (indexed)
narrative The cached text
created_at When it was cached

This is one of the few tables the engine deletes from: the cache's invalidate_order and clear remove rows to force a fresh narrative. It holds nothing that cannot be rebuilt.

identity_records

What the node has concluded about the things it tracks. Detail: identity-resolution-and-reconciliation.md.

ColumnMeaning
id Record ID
entity_type order, material or qualification
reference_id The external identifier (for a vendor/lot qualification, <vendor>:<lot>). Unique per entity_type when present.
attributes Everything known about it (JSONB)
status resolved, or pending while it awaits a human
matched_record_id, match_score Set when the record was matched to another by inference
created_at, updated_at Timestamps

A pending qualification record is a blocking first-article flag: it stays pending until a person resolves it.

pending_signoffs

Records that need a person's decision before they take effect. Detail: mandatory-human-sign-off-mechanism.md.

ColumnMeaning
id, record_type, content What is awaiting sign-off (content is JSONB)
status pending, approved, rejected, or rejected_superseded (replaced by an edited resubmission)
predecessor_id The record this one revises, for Edit & Resubmit
submitted_by, submitted_at Who and when
resolved_by, resolved_at, resolution_action_id The decision

Embedding tables

One physical table per Node Type, because a pgvector column's width is fixed when the table is created and different Node Types may use embedding models with different output sizes. Each row is one chunk of source text with its embedding, the source document's ID and revision date, a document type, and applicability fields (product, order, unit range, date range) that retrieval filters on, and an active flag (false for a deactivated document, which retrieval skips). Retrieval only reads these tables; content arrives through the ingestion stage of a node with a document_intake section (retrieval-ingestion-pipeline.md). Table layout, the embedding profile record and the fixed-width caveat: retrieval-embedding-infra.md.

document_config_history

One row per version of a scope's configuration: a document type (by name) or the embedding profile. The first time the node starts with a configuration whose fingerprint is not yet recorded for its scope, it appends the next version number with a snapshot of the configuration and writes one Activity Log entry; going back to an earlier configuration reuses that version. The database refuses to delete, change or truncate a row (triggers), apart from marking that its Activity Log entry was written; only the table's owner can drop it.

ColumnMeaning
scope_kind, scope_name, version document_type or embedding_profile, the type's name (or embedding), and the number (the primary key)
fingerprint A SHA-256 of the configuration; unique per scope
snapshot The configuration the fingerprint is a hash of
recorded_at, logged_at When it was recorded, and when its Activity Log entry was written
-- Every recorded version of every document type, oldest first
SELECT scope_name, version, recorded_at FROM document_config_history
WHERE scope_kind = 'document_type' ORDER BY scope_name, version;

instruction_claim_drafts

The drafter's own record of the candidate claims it found, written in the same transaction as the Pending instruction_claim record it submitted, so a candidate has both or neither. It holds ids, hashes and statuses, never document text. See Instruction claim drafting.

ColumnMeaning
claim_key A SHA-256 of the revision, place, sentence and quantity (the primary key)
content_key A SHA-256 of the revision, sentence and quantity, without the place; empty on rows from before it was kept
base_document_id, stored_document_id The document's id, and the id it is stored under (id@label for a type that keeps each revision)
source_revised_at The revision's time
signoff_id The Pending record submitted, empty for a candidate the model discarded
status drafted, discarded (not a requirement) or superseded (a later revision replaced it)
recorded_at When the row was written

instruction_run_summaries

One row per run of a bound tag: the stretch in which a binding's scope condition held (see Instruction bindings). Kindred keeps no readings, so a row holds only what can be derived from them, and no wording from a claim. A run is written when it begins, refreshed about every minute while it lasts, and finished when the condition stops holding or cannot be read. The rows accrue from the day a binding first runs in observe or alert mode; the engine never deletes them.

ColumnMeaning
id Unique ID of the run (the primary key)
node_instance_id Which node instance ran it
binding_id, claim_id, claim_revision The binding, the instruction claim it named, and the revision label of that claim's document (empty when the document has none)
product, operation The binding's labels
mode The binding's mode when the run began: observe or alert
started_at, ended_at The first reading of the run and the reading that ended it, or the time the binding was stopped for a claim_stopped run. While the run is open, ended_at is the time of its last refresh
status open (in progress), complete, or interrupted (the Node stopped while it was open)
ended_reason condition_ended (the condition stopped holding), condition_unreadable, claim_stopped (the binding's claim stopped being current, so the binding was stopped; see When a claim stops being current), or restart for an interrupted run
reading_count How many readings were judged: usable numbers taken while the condition held
outside_count How many of those were outside a limit
min_value, mean_value, max_value The smallest, mean and largest of them; NULL for a run with no usable reading
stddev_value The sample standard deviation; NULL below two readings
recorded_at When the row was first written

A Node that stops leaves its runs open. The next start records each of them as interrupted, with the figures of its last refresh (so up to a minute of readings may be missing from them): a run the Node did not see the end of is never shown as a complete one. A finished row is never changed again.

instruction_alerts

One row per alert a binding in alert mode raised (see Alerts). The same alert is also an Activity Log entry and a deviation Trigger, and all three have the row's id. The log is append-only, so the row is where a repeat count can change. A row holds ids, labels and numbers: the one reading that confirmed the crossing, the limit it crossed and how long it had lasted. It holds no wording from a claim, no value of the scope condition and no other reading. The engine never deletes rows.

ColumnMeaning
id The alert's id (the primary key), derived from the root cause key and the time of the confirming reading. It is also the Activity Log entry's id and the Trigger's id
node_instance_id Which node instance raised it. Repair at start completes only this Node's rows
root_cause_key A SHA-256 of the binding id, the claim id, the limit crossed and the scope condition's tag (or field) and value, and the order when there is one. The same key is the same cause; it is computed by the Node and never by a model
binding_id, claim_id The binding and the instruction claim it names
limit_name lower or upper: the limit the reading crossed
raised_at The time of the reading that confirmed the crossing. Suppression measures the minimum interval from here
measured_value, limit_value That reading, and the limit it crossed
unit The binding's unit
product, operation The binding's labels
held_readings, held_seconds How many consecutive readings, and how many seconds by the readings' own times, the value had been outside the limit when it was confirmed
repeat_count How many recurrences have been counted on this alert: new runs outside the limit, inside the minimum interval after raised_at. It changes after the row is finished, with last_repeat_at
last_repeat_at The time of the latest of them; NULL when none
previous_alert_id The alert for the same cause that came before; NULL for the first
suppressed_before The repeat_count the previous alert had reached when this one was raised; 0 for the first
finished_at When the alert's entry and Trigger had both been written; NULL until then
order_id The order whose records crossed the limit, for a binding beside a record source; NULL for a binding that reads a tag. It is part of the root cause key when set

An alert is raised in four steps, each of which can be repeated, because Postgres cannot wrap the table, the log and the queue in one transaction: the row is inserted with finished_at empty; the Activity Log entry is written; the deviation Trigger is queued; finished_at is set. An entry or a Trigger only ever exists for a row that exists. When the Node starts, before any tag is read, each of its rows with no finished_at is completed by doing the steps again, with the claim's wording read from the claim's own record. Anything that lists alerts should list only rows with a finished_at, because an unfinished row may not have its entry in the log yet. Suppression reads this table, not memory, so it survives a restart; the reasoning is on the Alerts page.

Three indexes serve it: on raised_at (newest alerts), on root_cause_key and raised_at (the latest alert for a cause) and on raised_at for rows with no finished_at (repair at start).

instruction_alert_acknowledgements

One row per acknowledgement of an alert (see Acknowledging an alert). An acknowledgement is after the fact and gates nothing, so it is a table of its own: the instruction_alerts row has no acknowledgement column and is never changed by one, and a sign-off record is not involved, so the count of Pending sign-off records does not change with alerts. The engine never deletes rows.

ColumnMeaning
alert_id The alert acknowledged (the primary key; it names an instruction_alerts.id but holds no foreign key, so alerts and acknowledgements can each be archived or pruned on their own). One acknowledgement per alert is the database's rule, so two people answering at once leave one row
disposition confirmed_issue, dismissed or instruction_needs_revising; the database refuses any other value
acknowledged_by The id of the management token that authenticated the request, never a name the caller supplied
acknowledged_at When the request was handled; it is also the time of the Activity Log entry
logged_at When that Activity Log entry was written; NULL until it has been. Postgres cannot wrap this table and the Activity Log in one transaction, so the row comes first and the same request, repeated by the same token, writes a missing entry

A row is written only for a finished alert (one with a finished_at), in one statement that also decides between two callers. The count of unacknowledged alerts is the finished alerts with no row here, and the oldest is the smallest raised_at among them, in one query. No index beyond the primary key is kept: alerts are few, and the count is looked up by that key.

Configuration

A node reads its database settings from the environment, falling back to a .env file in the working directory. A real environment variable overrides .env.

VariableDefaultMeaning
POSTGRES_HOST localhost Server host
POSTGRES_PORT 5432 Server port
POSTGRES_DB kindred The node's one database: its queue, sign-offs, Activity Log, identity records and embeddings
POSTGRES_USER postgres Role the node connects as
POSTGRES_PASSWORD (empty) That role's password

Two things to know:

  • A node always connects over TCP, even to localhost. That means password authentication (scram-sha-256). Peer authentication only applies to the local socket used by sudo -u postgres psql.
  • A variable the engine does not know is ignored without a message. A mistyped name (POSTGRES_DATABASE for POSTGRES_DB) leaves the default in force, so the node connects to kindred and reports nothing wrong. deployment/doctor.sh prints the database it checked.

Provisioning

deployment/provision_node.sh generates the node's .env (including a random POSTGRES_PASSWORD), calls deployment/install_postgres_pgvector.sh, and, once the engine is installed, creates the Activity Log table (python -m engine.provision_schema) in the node's database, so a first config sync works before any Node has started (the step stops with a one-line message naming the database if it cannot reach it). Each Node creates its own tables when it starts. You can also run the installer directly:

deployment/install_postgres_pgvector.sh [db_name] [postgres_password]

db_name defaults to kindred. The script installs PostgreSQL 16 and postgresql-16-pgvector, creates the database with --encoding=UTF8 --template=template0, enables the vector extension, and, if you pass a password, sets it on the postgres role. It is safe to re-run. If you create a database yourself, do the same three things: UTF8 from template0 (otherwise text columns can come back as raw bytes), then CREATE EXTENSION vector;.

Finding the password

Nobody chooses the database password. provision_node.sh generates it at random (32 characters of base64: letters, digits, +, / and =), writes it to .env, and sets it on the postgres role. That .env is the only record of it, so every client that needs it (a GUI, psql over TCP, a script) starts there.

1. Find the .env that counts. The engine reads .env from the directory it runs in, and the services run from the checkout their unit names as WorkingDirectory. That checkout's .env is the one in use:

systemctl show -p WorkingDirectory --value kindred-node kindred-management

2. Print the value. The file is mode 0600, owned by the service user, so read it as that user:

grep '^POSTGRES_PASSWORD=' ~/kindred/.env | cut -d= -f2-

Use cut -d= -f2-, not cut -d= -f2 or awk -F=: the password can contain = (base64 padding), and those forms drop everything from the second = on, handing you a password that is a few characters short.

3. Check it works, without printing it. From the checkout:

PGPASSWORD="$(grep '^POSTGRES_PASSWORD=' .env | cut -d= -f2-)" \
  psql -h localhost -U postgres -d kindred -tAc 'select current_user'

postgres back means the value in this .env is the database's password. deployment/doctor.sh runs the same check and names an authentication failure. A failure here means the file and the database have drifted apart, which is the next section.

Copying it into a client. Paste the whole value into the password field and check the field's length is 32. A double-click in a terminal selects only up to the first +, / or =, so select the whole line, and don't let a trailing space or newline come along.

If the .env and the database disagree. Make the database match the file. This changes no .env and needs no restart, provided the services were started after the file last changed (they hold the value they read at start):

P="$(grep '^POSTGRES_PASSWORD=' ~/kindred/.env | head -1 | cut -d= -f2-)"
sudo -u postgres psql <<SQL
ALTER USER postgres PASSWORD '${P}';
SQL

The value goes in through stdin, not as a -c argument, so it never shows in the process list. install_postgres_pgvector.sh <db_name> <password> does the same thing. The generated value has no quote characters, so the single quotes are safe; a password you chose yourself with one in it is not.

Choosing a new password. Change both ends, then restart: set it on the role (\password postgres inside sudo -u postgres psql prompts without echo), put the same value in POSTGRES_PASSWORD in .env, and restart kindred-node and kindred-management. They read .env once, at start, so until the restart they keep connecting with the old password and fail. Changing only the database breaks the Node; changing only .env does the same.

Only one .env is the truth; old ones are traps. A leftover checkout (an earlier clone, a copy in /root, a test copy) keeps its own .env with a password from when it was provisioned, and it will not match the live one. Because .env is read from the current directory, a command run from such a checkout reads that file instead of the live one. Remove stale checkouts rather than keep them, and when two passwords turn up, step 3 above, run against the database, decides which is right. To list the candidates:

find /home /root /opt -maxdepth 4 -name '.env' -not -path '*/node_modules/*' 2>/dev/null

Connecting and inspecting

On the node's host, through the local socket (peer authentication, no password):

sudo -u postgres psql -d kindred

Over TCP as the node does (prompts for the password; Finding the password says where it is):

psql "host=localhost dbname=kindred user=postgres"

From a GUI client such as DBeaver. A fresh install listens on 127.0.0.1 and ::1 only, so a direct connection to the host's network address is refused. Use an SSH tunnel:

  • SSH tab: the node's host, port 22, your SSH user and key (or that user's password).
  • Main tab: host localhost, port 5432 (the tunnel's local end), user postgres, the password from POSTGRES_PASSWORD in the node's .env, and the database name the node uses.

The SSH and database credentials are separate fields; filling one and not the other is the usual mistake.

Walkthrough: connecting DBeaver

  1. Get the password first. Follow Finding the password and keep the value on the clipboard. Run the step 3 check on the host before you open DBeaver, so you know the value is good and any later failure is the client's.
  2. New connection → PostgreSQL. Make a new one rather than editing an old one; DBeaver keeps saved credentials per connection and an edited connection can hold an empty or stale entry.
  3. Main tab. Connect by Host, not by URL (a + in a password inside a URL is decoded as a space). Host localhost, port 5432, database the name the node uses, Authentication: Database Native (the "PostgreSQL pgpass" option reads a .pgpass file on your own machine and ignores the field), user postgres, and the password pasted into the Password field. Tick Save password.
  4. SSH tab. Tick Use SSH Tunnel. Host: the node's address, port 22, user: the service user or your own account, and a key or that user's login password. Press Test tunnel configuration; a pass here proves only the SSH side.
  5. Test Connection. A pass means both halves are right. If it fails, read the message against the troubleshooting table: the two common ones point at opposite causes. no password was provided means DBeaver sent nothing (step 3), and password authentication failed means it sent something the database refused (a stale or partial copy, step 1).
  6. Which database. A node process writes to POSTGRES_DB from its .env (the default, kindred, unless the node was started with another). Connect to the one you want to read; see Running more than one node process.

To confirm what the server saw, read its log on the host: /var/log/postgresql/postgresql-16-main.log records each failed login with the pg_hba.conf rule it matched. A failure that names a scram-sha-256 line reached the password check, so the tunnel and the access rules are fine and only the password is wrong.

A read-only login for inspection, so nobody browses as the superuser:

CREATE ROLE inspector LOGIN PASSWORD '<choose-a-password>';
GRANT CONNECT ON DATABASE kindred TO inspector;
GRANT USAGE ON SCHEMA public TO inspector;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO inspector;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO inspector;

Run these as postgres, in the node's database. The last line covers tables a node creates later.

Useful queries

-- Work waiting, running and finished
SELECT status, count(*) FROM trigger_queue GROUP BY status;

-- Triggers that ran out of retries
SELECT id, trigger_type, attempt_count, enqueued_at, payload
FROM trigger_queue WHERE status = 'dead_lettered' ORDER BY enqueued_at DESC;

-- The most recent Task runs
SELECT occurred_at, node_instance_id, task_type, trigger, outcome, reference_ids
FROM activity_log ORDER BY occurred_at DESC LIMIT 20;

-- Everything the log recorded about one order or vendor/lot reference
SELECT occurred_at, task_type, outcome FROM activity_log
WHERE reference_ids->>'reference_id' = '<order-or-vendor:lot>' ORDER BY occurred_at;

-- Items waiting on a person
SELECT id, entity_type, reference_id, created_at FROM identity_records WHERE status = 'pending';
SELECT id, record_type, submitted_by, submitted_at FROM pending_signoffs
WHERE status = 'pending' ORDER BY submitted_at;

-- How much retrieval content a Node Type has (find the table name with \dt embeddings_*)
SELECT document_type, count(*) FROM embeddings_<node_type>_<hash> GROUP BY document_type;

Read with SELECT. Don't edit these tables by hand: rows are linked by ID across tables, and a hand edit can leave a queue row, a log entry and an identity record disagreeing with each other.

Housekeeping

Backup and restore

The database holds the node's data: the audit trail, pending sign-offs and identity records exist nowhere else. Retrieval content can be rebuilt by re-running ingestion; the rest cannot. Backups, archiving and retention are yours to run with standard Postgres tools; Kindred adds no tooling for them.

# Back up (custom format, compressed)
sudo -u postgres pg_dump -Fc -d kindred > kindred-$(date +%F).dump

# Check it is readable and lists every table
pg_restore --list kindred-2026-01-01.dump

Restore into a new, empty database. The target needs pgvector installed (the installer does this):

sudo -u postgres createdb --encoding=UTF8 --template=template0 kindred_restored
sudo -u postgres pg_restore --exit-on-error -d kindred_restored < kindred-2026-01-01.dump

Notes on the restore:

  • --exit-on-error stops the restore at the first error. Without it, pg_restore reports each error, exits non-zero, and carries on loading rows into any table that already exists. That is how a restore aimed at the wrong database ends up half-merged.
  • The restoring role must be allowed to create the vector extension, which the dump creates in the new database. The postgres role is.
  • Feed the dump on standard input, as above. sudo -u postgres pg_restore -d … file.dump fails with "Permission denied" whenever the file sits somewhere the postgres OS user cannot read, such as your home directory.
  • To restore over the node's real database, stop the node processes first. Then restore into a fresh database and point POSTGRES_DB at it (or rename it into place), rather than restoring on top of live data.

A full node backup also covers what isn't in Postgres:

  • .env: the node's settings, including its generated secrets.
  • The license file (the path in LICENSE_FILE_PATH), wherever you keep it.
  • The age key at ~/.config/sops/age/keys.txt, which decrypts the node's sops-encrypted configuration. If you distribute one shared key with deployment/distribute_age_key.sh, the master copy lives on your source-of-truth host; that copy is the one to protect.
  • The node's config files (the --config files), if they aren't already kept in source control.

Disaster recovery: restoring onto a rebuilt appliance

When a node's host is lost, recovery is the Appliance Lifecycle applied to a new host: rebuild from the repository, then put the data back. Kindred provides no recovery tooling. This is the order the work happens in; how backups are taken and kept, how the replacement host is obtained, and how long each step takes are the site's. An automated run (tests/test_appliance_rebuild.py) follows these steps in this order against a populated database, a provisioned default and a fresh restore target. It exercises steps 1, 2, 3, 6 and 7; steps 4 and 5 (files and the node's certificate) and the real host, power and network parts of the others are the site's to rehearse. The run fails if this list and its own sequence disagree.

  1. Make sure the lost host cannot return as the same node. Power it off or decommission it before the replacement starts. Two hosts holding one node's identity and certificate would both write as that node.
  2. Rebuild the appliance from the repository, at the release that wrote the backup or a later one (a dump from a later release has not been tried against an earlier engine). This is the install in the integrator walkthrough: place the node's backed-up age key before provisioning, then run provision_node.sh. Provisioning leaves a default database that is empty of data but not an empty database: pgvector is enabled, and the Activity Log table and its append-only guard are already in it.
  3. Restore the database before anything writes to it: before the first config sync and before the node starts. Restore into a fresh database, as under Backup and restore, and point POSTGRES_DB at it.
    • Do not restore on top of the default database. Its Activity Log table already exists, so the restore collides with it. With --exit-on-error the restore stops with "already exists" and loads nothing. Without it, the same errors are reported but the rows are still loaded into the existing tables.
    • Anything written to the default database before you switch (a recorded sync, for example) stays there and is not part of the restored audit trail.
  4. Restore the files that are not in Postgres: the license file and the node's config files. Do not overwrite the rebuilt .env with the old one. The Postgres password belongs to the cluster, not to the dump, so the old .env's POSTGRES_PASSWORD is the old host's. Carry other settings across by hand, or place the old .env before provisioning in step 2, which reuses the password it finds there.
  5. Reinstall the node's certificate. The node's key and certificate are not in the database or in the backup list above; they are reissued from the site CA, which is why the CA key's own backup matters (site-pki.md).
  6. Bring the node up in the walkthrough's order: management API, token, config sync, node service.
  7. Check the result. Verify the Activity Log chain (activity-log-tamper-evidence.md), compare row counts with what you recorded when the backup was taken, and run deployment/doctor.sh.

Take a fresh backup once the node is running on the new host; the old backups describe a host that no longer exists.

Schema generations

The schema is additive-only within a generation: a release may add a table, or add a column that is nullable or has a default, and may never rename, drop, retype or change the meaning of anything an earlier release wrote. That rule is what makes a rebuild safe: a newer release of the same generation runs over the data an older one left in place.

A generation boundary is the one change the rule forbids: a change an earlier release's data cannot satisfy (a dropped or renamed column, a changed meaning, a table split in two). It is the only thing that bumps the generation, which is the number SCHEMA_GENERATION in engine/schema_generation.py. It is currently generation 1. An additive table or column never bumps it.

The engine records its generation in one row of kindred_schema_generation in the Activity Log database and compares it at start, before it changes anything. A database with no row (a first start, or one an earlier release of this generation wrote) is recorded as the engine's own generation. A database that records another generation is refused: provisioning exits non-zero and a Node does not start, with a message naming both generations. GET /v1/status reports the same comparison under schema_generation (match, mismatch, not_recorded, or unknown when the database cannot be read in time).

The check protects the engine however the mismatch arose: a restored old dump, a hand-run ALTER TABLE, a half-finished rebuild. It does not detect a hotfix and is not a support check.

A breaking change is not handled by the engine. It is decided when one is needed, and the data moves case by case with standard Postgres tooling (pg_dump/pg_restore) onto a database that the new release records as its own generation; Kindred builds no migration tool. On a mismatch, run a release built for the database's generation, or move the data that way.

Growth and retention

Nothing in the engine prunes activity_log, trigger_queue (finished rows stay) or identity_records. activity_log feeds order-trail and audit views, so deleting from it removes history. There is no built-in retention procedure; if you need one, decide it deliberately and take a backup first. The tables have no foreign keys, so any one of them can be archived or pruned on its own.

One exception to "on its own": trigger_queue is also how a Node remembers which rows of a database_log source it has ingested. Rows removed from it that are still inside that section's lookback are read again as new, so prune only rows older than the lookback. Deleting a row from database_log_dead_letters makes that row eligible again in the same way.

activity_log also refuses to be changed. Two triggers, activity_log_no_update_delete and activity_log_no_truncate, reject UPDATE, DELETE and TRUNCATE for every session, including a superuser's, so a mistyped statement in a GUI client can't rewrite the audit trail.

  • The triggers live in the database, so a pg_dump restore brings them back.
  • They do not stop an administrator who lifts them on purpose, and they do not guard against DROP TABLE.

Warning: pruning activity_log breaks chain verification. Entries are hash-chained per node instance (chain_hash, chain_prev_hash). After a prune, python -m engine.activity_log_verify verify reports:

  • a deleted entry as a gap, or as an orphaned chain when the oldest entries go;
  • possibly a head mismatch against activity_log_chain_heads, which the triggers do not cover and a prune does not update.

Pruning also discards the history an off-box syslog checkpoint was meant to vouch for. Treat a prune as ending the verifiable chain for the removed range (see activity-log-tamper-evidence.md). Archive the rows first.

If you have decided to archive or prune, do it in one transaction, after a backup, so the guard is back the moment you finish:

BEGIN;
ALTER TABLE activity_log DISABLE TRIGGER activity_log_no_update_delete;
ALTER TABLE activity_log DISABLE TRIGGER activity_log_no_truncate;
-- archive or prune here
ALTER TABLE activity_log ENABLE TRIGGER activity_log_no_update_delete;
ALTER TABLE activity_log ENABLE TRIGGER activity_log_no_truncate;
COMMIT;

Updates to Postgres and the OS

PostgreSQL, pgvector, Mosquitto, the Python interpreter and the OS come from Ubuntu's repositories, so you maintain them with Ubuntu's own tools (apt, unattended-upgrades). Within an Ubuntu release, package versions stay stable: PostgreSQL stays on major version 16 and takes 16.x updates in place, with no data conversion. Two things to plan for:

  • Updates restart Postgres and Mosquitto. The node recovers by itself (see Restart behaviour for what it does and what is lost), but schedule updates for a quiet window and check the node afterward.
  • A newer Ubuntu release or PostgreSQL major is not an in-place upgrade. The provisioning scripts target Ubuntu 24.04 LTS with PostgreSQL 16 and hard-code those package names. To move to a newer release, provision a fresh host on it and move the data with standard Postgres tools (pg_dump/pg_restore, or pg_upgrade), and only onto a release the project documents as supported.

Restart behaviour

The OS restarts Postgres and Mosquitto when their packages update, and an operator can restart them by hand. A Node does not need a restart when that happens. Each case below is exercised against a real Postgres and a real Mosquitto in tests/test_restart_tolerance.py, which also checks that this section records each outcome.

Postgres restarts or is briefly unavailable. The Node opens a connection for each database operation, so nothing it holds goes stale; the first operation after the restart connects afresh.

  • Trigger dispatch loop. A failure to claim a Trigger is not an error: the loop logs one warning, waits (0.5 s, doubling to 10 s) and tries again, for as long as it takes. It logs again every minute while the outage lasts and once when the database is back. A Trigger the loop had claimed when the connection broke is put back, and only that one (the loop never resets other claimed rows), and dispatched again, so dispatch is at least once across a Postgres restart: a handler can run twice for the same Trigger, and no Trigger is lost. Triggers waiting in the queue are untouched. The one gap: if the connection breaks at the instant a claim commits, that row stays claimed until the Node next starts, when startup returns every claimed row to the queue.
  • Scheduled tasks (the polling ingestion producers, deviation and costing checks, the shift handoff). A tick that meets the outage fails, an error: database unavailable entry is written to the Activity Log if the database allows it (otherwise only the console records it), and the next tick runs normally. Failed ticks are counted, and a task that fails several in a row is degraded (see Scheduled-task failure policy).
  • The OPC UA ingestion producer. Events are ingested on a worker thread of the producer's own, so the sidecar's reader thread (which also reads the sidecar's replies) is never held. An event it cannot ingest because the database is unavailable is retried until the database answers; later events wait behind it, in order, up to 10,000. Beyond that, new events are dropped and counted (events_dropped), because waiting would stall the sidecar. The sidecar's pipe and the OPC UA server's own monitored-item queue sit upstream of this and are finite too, so a long outage can still lose value changes there; Reconciliation is what recovers state afterward. An event the engine itself refuses (a KindredError) is logged, counted (events_rejected) and skipped; any other error is a bug, and the producer reports it so the Node exits (below).
  • The MQTT ingestion producer already holds a message until the database answers, and dead-letters one the database refuses (see mqtt_dead_letters).
  • The instruction-binding monitor keeps judging readings while the database refuses its run summaries. It holds the newest figures of each run, at most 100 runs, and writes them when the database answers again; past 100 the oldest are dropped and the Node logs it once. A start that meets the outage does not read any tag until it has recorded the runs the last process left open, completed the alerts the last process left half written and judged the claims, and the task policy above tries it again on the next tick.
  • Alerts raised by the monitor are not dropped while the Node runs. A reading that cannot be settled waits in memory, in order, and is tried again; requests for the same cause are folded into one, so what waits is bounded by the number of causes and the time elapsed. The database is never given more than 20 requests in a call, and after a failure it is left one second, then two, up to 30. A Node that stops during the outage loses the requests that had only been in memory. See When the database refuses.

Mosquitto restarts or is briefly unavailable. The Activity Log publisher reconnects by itself, with no Node restart, and publishes again. The publish is fire-and-forget (QoS 0, nothing persisted), so the outage costs events as follows: an event published while the broker is down waits in a bounded in-memory queue (1000 events) and is sent on reconnect, in order; an event beyond that bound (the oldest goes first), one in flight at the moment the broker stops, and any still queued if the Node itself stops are lost. The Activity Log in Postgres is the record; the topic is a live feed, not the audit trail.

The pending-summary publisher and the identity announcer. Both follow the broker and the database on their own, with no Node restart. The pending-summary publisher catches every error in a tick, logs it, and tries again at its next interval, so a Postgres or Mosquitto restart costs the counts for that interval and no more. The identity announcer announces the Node online on every reconnect to the broker. Neither is under the "cannot recover" rule below, because neither has an error it cannot wait out.

A component that cannot recover. A thread that meets an error that is not an outage (a bug) does not end alone and leave the Node running without it: the Node stops everything it started and exits non-zero with a ComponentFailedError naming the component, and the service manager restarts it: the Node's unit has Restart=on-failure, waits 5 s, and gives up after 5 starts in 300 s so a persistent fault is not a crash loop for ever (systemctl status then shows failed; fix the cause and systemctl reset-failed, then start it). A scheduled task's cause is also written as a crashed Activity Log entry. A restart loop therefore shows in the journal and the entries rather than as silence.

What a restart does not do: the in-memory state of the Node (an unsent Activity Log queue, an OPC UA subscription's last-seen values) starts empty. Re-subscribing makes the OPC UA server announce current values again, which the producer treats as a baseline rather than a change.

Scheduled-task failure policy

A scheduled task (the polling producers, the deviation and costing checks, the shift handoff) that fails is retried every tick for ever, but a failure that repeats is made visible and bounded, never given up on. Every scheduled task on the Node is covered. The behaviour is exercised in tests/test_scheduled_task_policy.py.

  • Counting. Each failed tick (a KindredError, or the database being unavailable) adds one to the task's consecutive-failure count; a success resets it. The threshold is the Node setting SCHEDULED_TASK_DEGRADE_AFTER_FAILURES (a whole number, default 3, minimum 1). A value below 1 or one that is not a whole number (0, 2.5, three) is refused when the settings load, which doctor's env-file check reports; it is never discovered at runtime.
  • Within a tick the clients decide what is retried: a timeout, a connection error and a 5xx are retried up to the client's attempt limit; a 4xx that cannot change on a second try (400, 401, 403, 404...) is not. A 408, 425 or 429 is retried. The inference client follows the same rule as the embedding client.
  • Degraded. At the threshold the task enters degraded: one degraded Activity Log entry is written (task name, consecutive failures, since when, failure class: task_error, database_unavailable or crashed; never driver text or record content; it is also published on the activity topic), and one scheduled_task_degraded Trigger is enqueued. Its id is derived from the task name and the start of the episode, so a repeat does not enqueue a second.
  • While degraded, each tick probes the real run with a single attempt and, if the probe fails, runs the task's declared degraded_run or, if it declares none, skips the tick with a skipped entry. The first successful probe writes a recovered entry, enqueues a scheduled_task_recovered Trigger and resets the count. The shift handoff declares a degraded_run: it drafts the structured fact listing, flagged degraded in the draft and in its text, and the window advances. It is an ordinary Pending draft; a reviewer needs to do nothing beyond what any handoff needs, and the first success resumes the model-drafted path.
  • Handling it. A Node Type registers its own TriggerHandler for scheduled_task_degraded and scheduled_task_recovered; the handler receives the task name, node type, node instance id, the count, the since-time and the failure class, and nothing else. A Node with none acknowledges them through a default handler, so they are never dead-lettered. Degradation creates no Pending record and needs no reviewer action.
  • Seeing it. GET /v1/status lists each task with state (ok or degraded), consecutive_failures, last_success, degraded_since and failure_class; doctor prints each degraded task as a warning. Neither stops the Node.
  • Not an exit. A failure that is not a KindredError or an outage is a bug, not a degradation: the failure is counted, a crashed entry is written and the process exits non-zero for a restart, as in "A component that cannot recover" above.
  • The count is in memory. It starts at zero after a restart, so a restart ends an episode and a task that is still failing begins a new one (a new Trigger) after the threshold. The records status and doctor read live in a small file beside the Node's runtime-state file and are removed on a clean stop.

Coverage gaps

A Node observes, so a Node that is stopped stops nothing on the floor. What it costs is events nobody recorded, in a log that reads as complete. A coverage gap is the log saying where it is incomplete: time the Node could not have seen its source. It is one activity_log entry, written once, and it is about time, never content.

  • The entry. task_type is coverage gap. trigger is the cause, one of node_stopped, connection_lost and messages_dropped. outcome is replayed or not_replayed. reference_ids holds the connector (the name of the config section: mqtt, opcua, database_log or rest) and the window as gap_start and gap_end (ISO 8601, UTC). The entry names no record, carries no payload text and no topic, and never a count of what was lost, because the Node cannot know one. Its id is derived from the Node instance, the connector and the start of the gap, so a restart or a repeat leaves exactly one.
  • Three causes.
    • node_stopped: the Node was not running, stopped cleanly or crashed (the log does not say which). A Node finds it as it starts: the kindred_node_liveness row is older than twice LIVENESS_INTERVAL_SECONDS, so one entry is written for each connector, from that time to the start. A first start, and a start within twice the interval, write none.
    • connection_lost: a connection to a source stayed down for its reconnect window (30 seconds for an MQTT broker) and returned, or an OPC UA subscription was lost and made again. For OPC UA the window runs from the loss to the first value afterwards. A broker that is already down when the Node starts counts from the start. A shorter drop writes nothing.
    • messages_dropped: the Node itself threw away messages it had received (a full ingest queue, or a message it could not hand on). Written at most once a minute for a connector, as the window from the first drop to the last, with no count.
  • The setting. LIVENESS_INTERVAL_SECONDS (a whole number, default 60, minimum 1, maximum 86400) is how often a Node refreshes its row and so the unit a gap is measured in. A value below 1, above a day or that is not a whole number is refused when the settings load, which doctor's env-file check reports.
  • replayed and not_replayed. replayed is written only when the source gave back what the Node missed and it has been ingested and acknowledged: an MQTT connector on a persistent session at QoS 1, whose broker kept the session, once the connection has stayed up for a liveness interval and nothing is waiting to be ingested. Anything else is not_replayed: a clean session, a QoS 0 or 2 subscription, a broker that forgot the session, and every other kind of source. An entry that cannot yet say waits, in memory, for up to 5 liveness intervals and is then written not_replayed. A Node that stops while a connection_lost or messages_dropped entry waits loses it; a node_stopped entry is not lost, because the liveness row is not refreshed while it waits.
  • What survives an outage, by kind of source.
    • MQTT: what the broker queued, up to the broker's own queue limit, and only on a persistent session at QoS 1. A MES Node's default is a persistent session unless a subscription uses QoS 2; a PLC / Generic Device Node's default is a clean session, which holds nothing. QoS 0 messages are never held. A broker's own overflow cannot be seen, so a gap marked replayed is not a promise that the broker lost nothing.
    • Files (document intake): fully. The ledger of what was handled finds every new or changed file on the next poll, once.
    • Database log: the scan resumes from its stored position, so rows the target system still holds are read; rows it has since removed are not. Its failures are the scheduled task's degraded and recovered entries, not a gap.
    • REST (ERP, Production Scheduling): the current state as it is now. A poll reads one resource and compares it with the last one it saw, so a transition that began and ended inside the outage is not seen at all, and nothing in a connector profile asks a source for "changes since". The outage of a polled source is the scheduled task's degraded and recovered pair (see Scheduled-task failure policy); no coverage gap is written for it, except node_stopped when the Node itself was away.
    • OPC UA: the current value, which a new subscription announces first. A change inside the outage is not seen. The sidecar reports no event for a session that dropped while its process kept running, so that loss is not detected; a dead sidecar is, because the Node checks it every 5 seconds and subscribes again.
  • What a hypervisor-level restart or migration preserves. A restart or a cold migration of the appliance is a Node that was stopped and started: the database and the kindred_node_liveness row go with the disk, so the next start writes a node_stopped gap for the time it was away. It does not preserve what the sources did meanwhile beyond the table above, and a pause that does not restart the Node (a suspend, or a live migration that stalls it) is not a node_stopped gap, because that is found only as a Node starts; the connections it dropped are connection_lost. Restoring a snapshot does not preserve the entries written after it, and the liveness row goes back with them, so the stretch the restore removed is not reported as a gap: the log then reads as complete up to the snapshot.
  • Where a person reads it. GET /v1/status reports coverage: last_alive_at and latest_gap (the most recent gap's connector, cause, outcome and window), both null when none or unreadable. A Node that was stopped cleanly has removed the file that names its instance, so the status then reports the one instance the database knows, and nothing at all if it holds several. The read is bounded to two seconds and never stops the Node. An order's trail and genealogy list the gaps over the span of their entries as coverage_gaps and are not complete while one overlaps: a peer's gaps arrive with its contribution, by the same entries request, and a peer that cannot answer it is named like any other. The shift handoff opens with a sentence, written by code, that coverage was incomplete in the window, naming the connector and the times and nothing of what was missed, and a drafting model is given each gap as a fact, never as free text.
  • Asking for the gaps of an old order. A gap is logged when it ends, so the trail and genealogy checks ask for every gap since the order's first entry and keep those that overlap its span; an order from long ago, on a site with a long history of gaps, reads and asks for more than a recent one.
  • Not covered. Nothing here replicates between Nodes or reads another Node's database; redundant Nodes that sync with each other are a different feature. A PLC / Generic Device Node with no deviation rules has no database, so it records no gap. A gap in one connector says nothing about another, and a window with no gap is not a promise that nothing was missed.

To list them:

SELECT occurred_at, trigger, outcome, reference_ids->>'connector' AS connector,
       reference_ids->>'gap_start' AS gap_start, reference_ids->>'gap_end' AS gap_end
FROM activity_log WHERE task_type = 'coverage gap' ORDER BY occurred_at DESC;

Renaming or dropping a database

Renaming (ALTER DATABASE … RENAME TO …) needs every session on that database closed, and it immediately breaks anything still configured with the old name — node processes' POSTGRES_DB, .env files and saved GUI connections — with database "<old name>" does not exist. Update those first, or expect the errors. Take a backup before dropping anything.

Changing an embedding model's output size

An embedding table's vector width is fixed when the table is created, and startup will not change it. Switching to a model with a different width means dropping that table and re-ingesting its content. See retrieval-embedding-infra.md.

Running more than one node process on one server

A real deployment gives each node its own appliance and its own Postgres, so none of this applies. It comes up in development setups that run several node processes against a single Postgres server.

Two node processes pointed at the same database share one trigger_queue. The queue has no column saying which node a row belongs to, so either node can claim a row the other enqueued and burn it to exhausted because it has no route for that Trigger type. To avoid that, give each node process its own database on the shared server. A development layout looks like this:

DatabaseUsed byTables
kindred_mes the MES node trigger_queue, pending_signoffs, activity_log, identity_records, the embedding tables
kindred_erp the ERP node trigger_queue, activity_log, identity_records

Each node's activity_log and identity_records are its own, as on a real appliance. A feature that follows one reference ID across nodes (the order trail, genealogy) asks the other nodes for their entries over the Communication Interface (communication-interface.md); it does not read a table the nodes share.

Create the databases with the installer, then launch each node with its own POSTGRES_DB:

deployment/install_postgres_pgvector.sh kindred_mes
deployment/install_postgres_pgvector.sh kindred_erp

POSTGRES_DB=kindred_mes \
  poetry run python -m engine.node_main --config <mes-config.json> --node-instance-id <id>

POSTGRES_DB=kindred_erp \
  poetry run python -m engine.erp_main --config <erp-config.json> --node-instance-id <id>

Two consequences worth knowing:

  • Anything that reads a store must point at the database that node wrote to. An IdentityStore or EmbeddingStore built against the wrong database reports zero rows rather than raising an error.
  • A process launched without POSTGRES_DB falls back to .env's value (kindred after a standard provision), not to either of the databases above. On a host used this way, kindred is an unused default and nothing should be writing to it. If you rename or drop it, read Renaming or dropping a database first.

Troubleshooting

You seeCauseFix
database "<name>" does not exist The database was renamed or dropped, or the name is mistyped in POSTGRES_DB, .env or a GUI connection Correct the name where it is configured (see Renaming or dropping)
The server requested SCRAM-based authentication, but no password was provided The client sent no password: the Main tab's field is empty (the SSH password is a different field), or Authentication is set to "PostgreSQL pgpass" with no matching entry Set Authentication to Database Native and fill in the Main tab's password (walkthrough)
FATAL: password authentication failed for user "postgres" The client sent a password and the database refused it: a stale .env (an old checkout's, not the one the services run from), a copy cut short at a +, / or =, or the wrong field Read the password again from the services' .env, and test it on the host (Finding the password). If the host test also fails, the database and .env have drifted; the same section shows how to align them
no pg_hba.conf entry for host ... The connection did not come from the host's own loopback, so it was not made through the tunnel Connect to localhost through the SSH tunnel, not to the host's address
Peer authentication failed for user "postgres" or role "<your-os-user>" does not exist psql over the local socket as the wrong OS user Use sudo -u postgres psql -d <db>, or connect over TCP with -h localhost and the password
Connection refused to the host's network address on 5432 Postgres listens on loopback only Use an SSH tunnel and connect to localhost
activity_log is append-only: DELETE is not allowed (or UPDATE, TRUNCATE) A statement tried to change or clear the audit trail; the guard on activity_log refused it This is intended. To archive or prune on purpose, use the transaction under Growth and retention
permission denied for table activity_log The connecting role has no privileges on the tables Connect as the node's role, or set up the read-only role above
A count or query returns 0 although you know the record exists You are connected to (or your code is configured for) a different database than the node wrote to Check POSTGRES_DB; see Running more than one node process
A retrieval answer comes back ungrounded, with no error The embedding tables are in another database than the one the process is using Point the process at the node's own POSTGRES_DB
A Trigger burned to exhausted although its Task is fine Two node processes share one database and one claimed the other's Trigger Give each node process its own database
Text columns come back as raw bytes The database was created as SQL_ASCII Recreate it as UTF8 from template0 (the installer does this)
DocCovers
trigger-dispatch-queue.md trigger_queue semantics, claiming, retries
database-log-scanning.md database_log_watermarks and database_log_dead_letters, and the scan that writes them
wiring-task-execution-to-activity-log.md How Task runs become activity_log rows
identity-resolution-and-reconciliation.md identity_records and how records get matched
mandatory-human-sign-off-mechanism.md pending_signoffs lifecycle
retrieval-embedding-infra.md Embedding tables, model profiles, vector width
retrieval-ingestion-pipeline.md How content gets into the embedding tables
deployment/README.md (in the repository, not a page here) Installer and provisioning scripts

Release: v0.11.0