Share one AI across the mesh instead of confining it to the owner

Curated state copied to every node is state that can disagree, so the index,
the model and the shared memory stay on the owner and each node reaches them
over the SSH trust onboarding already builds. Chats stay on the node that had
them; memory and bug reports stay the owner's to write.
This commit is contained in:
Gmer4Lfe
2026-08-20 19:53:28 -04:00
parent 4accd6b67e
commit 0621f66889
11 changed files with 1013 additions and 541 deletions
+9 -4
View File
@@ -410,9 +410,13 @@ fi
# full confidence and correct-looking citations, so a day of drift means the assistant quoting
# code that no longer exists. That is why this runs here rather than being left to a human.
#
# Three gates, any of which skips it: the pull must have succeeded, AI_INDEX_ON_PULL must be
# true, and AI_ENABLED must be true. ai_index.sh also refuses on its own unless AI_ENABLED is
# exactly "true", so a node with AI off never pays for this even if the flags disagree.
# Four gates, any of which skips it: the pull must have succeeded, AI_INDEX_ON_PULL must be true,
# AI_ENABLED must be true, and this must be the AI owner. ai_index.sh also refuses on its own on
# both the switch and the owner check, so a node never pays for this even if the flags disagree.
#
# The owner gate is the newest and was missing: the mesh shares one AI and the index belongs with
# the model, but this ran on every node regardless. On a node without a local Ollama it failed
# every night on the empty URL and said nothing, because the call below discards its output.
#
# Never fatal. Indexing is an enhancement; a git pull must not be reported as failed because an
# embedding call timed out.
@@ -420,7 +424,8 @@ if [[ "$DRY_RUN" == true ]]; then
[[ "${AI_INDEX_ON_PULL:-false}" == "true" ]] && warn "DRY RUN — would refresh the AI index"
elif [[ "$SYNC_SUCCESS" == true \
&& "${AI_INDEX_ON_PULL:-false}" == "true" \
&& "${AI_ENABLED:-false}" == "true" ]]; then
&& "${AI_ENABLED:-false}" == "true" \
&& "${MY_ID,,}" == "${AI_OWNER_HOST:-host1}" ]]; then
_AI_INDEX="$TARGET_DIR/AI/ai_index.sh"
if [[ -f "$_AI_INDEX" ]]; then