KNOX_LOCAL_SOURCES=none disabled the auto-threader and snippet extractor along
with the ingesters. Both derive from rows already in the log, so a replica has
everything they need: the dhg.lol node held 11.5k observations and 4.9k entries
but only 2 of the origin's 28 threads, quietly degrading half the MCP surface.
Ingestion stays gated; derivation always runs.
A replica that restarts with a populated observation log and an empty entries
cache had no trigger to reconcile: pushes and pulls only fire on *new* rows,
and the node is already in sync. It now rebuilds once at startup.
The Dockerfile uses BuildKit cache mounts so module downloads and compiled
packages survive a go.sum bump, and the test job restores the runner-local
cache server that act_runner already exposes.
A 500-row batch of content-heavy observations exceeded the receiver's 4 MiB
body limit and returned 400, so the sender retried the same batch on every
sweep and the log stalled. Pushes now trim to a 2 MiB budget (rows are ordered
by HCL, so the tail simply arrives next time) and the receiver accepts up to
8 MiB.
The sweep returned early on an empty peer list, which is precisely the
replica case: dhg.lol configures no peers, receives pushes, and never rebuilt
entries. Check for pending pushes before bailing out.
A push-only node — a replica with no peers of its own, which is exactly the
dhg.lol deployment — received observations but never rebuilt entries, so search
returned nothing while the log filled up. The batch handler now signals the
sweep, and reconcile runs when either direction changed the log.
KNOX_PEER_ADDR doubled as the bind address, so a container tried to bind the
host's overlay IP and the gossip server never started. KNOX_LISTEN_ADDR now
controls the bind (defaulting to KNOX_PEER_ADDR for compatibility) and the
advertised address stays what peers dial.
Builds on dhg.lol's daemon (the runner whitelists /var/run/docker.sock and
/apps), tags :latest plus the commit SHA, and restarts the compose stack only
when apps/knox is already installed. No registry credentials: the registry
requires htpasswd auth and self-built apps are consumed with pull_policy never.
MCP moves from mark3labs/mcp-go v0.17 (stdio only, 5 releases behind) to the
official modelcontextprotocol/go-sdk with typed tool inputs, and gains a
Streamable HTTP transport so a remote node can serve agents.
Transport security works without a public DNS name: KNOX_AUTH_TOKEN guards
every endpoint, KNOX_TLS_CERT/KEY serve TLS from a self-signed cert, and
`knox tls init` mints one whose SANs are whatever addresses clients dial.
Daemon hygiene for an always-on host: SIGTERM shutdown of the gossip and
metrics servers, --version reporting the VCS revision, KNOX_LOCAL_SOURCES=none
for a replicate-only node (no ingest tickers, no Obsidian vault adoption), and
default watch dirs that skip paths which do not exist.
Packaging: multi-stage Dockerfile (static, non-root, /data volume).
sqlc pilot: schema moved to internal/db/schema.sql (embedded) and the read
paths behind the MCP tools are now generated. The pilot found real drift —
entries.created_at existed only as a runtime ALTER — so the column is declared
in schema.sql and a parity test fails if generated code disagrees with db.Open.
Conformance: scripts/conformance.sh runs the official suite against a throwaway
node; conformance-baseline.yml records the capabilities knox deliberately does
not implement (resources, prompts, completions, fixture tools).
Refs #8
opencode 2.0.24 migrated its session store: the session, message and
part tables stopped being written, and sessions now live in session_v2
with messages in session_message. The ingest kept querying the abandoned
tables, so every sweep after the migration logged "0 new" and no error.
Session titles are nullable in session_v2, so keep the COALESCE and the
"Session <short id>" fallback.
Transcripts are rebuilt from both message shapes the new store uses:
user turns carry text at $.text, assistant turns carry a typed part list
at $.content of which only "text" parts are conversation (reasoning and
tool parts are not indexed). Rows are ordered by seq, then part index,
so a session reads in order.
Harness reminders arrive as synthetic messages now; drop <system-reminder>
text so it does not consume the 4000-byte summary budget.
Also stop skipping an entry purely on created_at: resuming a session
appends messages without touching the creation time, so the summary is
compared too and the entry refreshes.
Bump the ingester to opencode-db/v2 and cover both message shapes with a
test that builds the new schema in a temp database.
Fixes#6
Pre-existing work-in-progress in the tree: karakeep, snippets,
skills-health and redaction ingesters, the opencode.db session sweep,
gossip and metrics changes. Checkpointed as-is so the adapter fix in the
next commit stays reviewable on its own.
- rebuild: fold observations per fingerprint in a total order
(hcl DESC, node_id DESC, id DESC) so two nodes with identical logs
rebuild identical entries (was: arbitrary bare-column row, merge-order
dependent)
- threads: CreateThreadCluster uses INSERT OR IGNORE + existing-id
fallback — concurrent auto-threaders converge instead of hitting UNIQUE
- errors surfaced instead of swallowed: scanEntries returns rows.Err(),
Stats() fails fast on query errors, AutoLinkThreadObservations /
linkTemporalNeighbors / golden-thread linking propagate failures,
AddThreadNote + LinkObservationToThread write under one tx,
watch records session upsert failures
- gossip client: push checks HTTP status and reports errors (a broken
push direction no longer looks like a silent success); gossip diff
gets a 10s timeout so a dead peer cannot hang the CLI
- ingest: failed source sweeps (obsidian/browser/gitea) are logged,
and -d's help text now states its file-only scope
- watch --quiet: fatal errors go to stderr instead of io.Discard
- main: cobra SilenceErrors/SilenceUsage (errors print once, usage is
not dumped on runtime failures); knox mcp exits 0 on SIGINT/SIGTERM
- metrics: drop _total suffix from gauges (knox_observations,
knox_entries, knox_projects, knox_sessions, knox_peers, knox_threads);
_total stays on counters per Prometheus convention
- http: ReadHeaderTimeout + IdleTimeout on gossip, metrics, and web servers
tests: concurrent cluster-create idempotency, HCL-order rebuild fold
(both merge orders), push HTTP-error surfacing; full suite + -race pass,
gofmt clean