Documentation
¶
Overview ¶
migrate-knowledge copies the agent-network broker's `knowledge` rows into nexus.db's `knowledge` table. One-shot cutover utility.
Source schema (agent-network/code/broker/comms.db):
knowledge(id, from_agent, topic, content, created_at, updated_at)
Destination schema (nexus.db, see nexus/storage/schema.sql §knowledge):
knowledge(id, from_agent, topic, content, shared, created_at,
updated_at, embedding, embed_model, embed_dim)
UNIQUE(from_agent, topic)
The destination has a UNIQUE(from_agent, topic) constraint that the source lacks. We feed source rows in created_at ASC order so the upsert keeps the latest content for each (from_agent, topic) pair.
Embedding columns are left NULL — the embedding pipeline is deferred per §2.8 of the registration spec; backfill will populate them when vector retrieval lands.
Usage:
go run ./scripts/migrate-knowledge \ --source C:\src\agent-network\code\broker\comms.db \ --data-dir C:\src\nexus-cw\data \ [--topic-glob "v3/*"] \ [--from-agent keel] \ [--dry-run] \ [--shared]
Filters compose with AND. With no filters, every row migrates.
--dry-run reports what would migrate without touching the destination. --shared marks all migrated rows shared=1 (default 0).
Exit codes:
0 migration complete (or dry-run finished) 1 source/destination open failed, query failed, write failed 2 flag / argument problem