From 01fbf2ab62ea21b858920f319528f31d4c739630 Mon Sep 17 00:00:00 2001 From: Hermes Date: Mon, 11 May 2026 19:02:36 -0400 Subject: [PATCH 1/6] feat: add self-hosted memory providers (OpenViking, Honcho, Holographic) - Add OpenViking service (knowledge graph) using official GHCR image - Add Honcho stack (user modeling): API + PostgreSQL pgvector + Redis - Add Holographic config to Hermes (local SQLite, no server needed) - Hermes: install httpx for OpenViking client - Hermes: auto-generate config.yaml + honcho.json on first boot - All data 100% local, zero cloud dependencies --- ai/.env.example | 8 +++ ai/compose.yml | 94 +++++++++++++++++++++++++++++++-- ai/hermes/Dockerfile | 8 +++ ai/hermes/config.yaml | 9 ++++ ai/hermes/honcho.json | 33 ++++++++++++ ai/honcho/Dockerfile | 42 +++++++++++++++ ai/honcho/config.toml | 117 ++++++++++++++++++++++++++++++++++++++++++ ai/honcho/init-db.sql | 1 + 8 files changed, 308 insertions(+), 4 deletions(-) create mode 100644 ai/.env.example create mode 100644 ai/hermes/config.yaml create mode 100644 ai/hermes/honcho.json create mode 100644 ai/honcho/Dockerfile create mode 100644 ai/honcho/config.toml create mode 100644 ai/honcho/init-db.sql diff --git a/ai/.env.example b/ai/.env.example new file mode 100644 index 0000000..2934c21 --- /dev/null +++ b/ai/.env.example @@ -0,0 +1,8 @@ +# AI Stack Environment Variables +# Copy to .env and set your values + +# Required: OpenRouter API key for Hermes agent +OPENROUTER_API_KEY=sk-or-v1-your-key-here + +# Memory providers (internal Docker network — usually no changes needed) +OPENVIKING_ENDPOINT=http://openviking:1933 diff --git a/ai/compose.yml b/ai/compose.yml index aca3347..dbd15d1 100644 --- a/ai/compose.yml +++ b/ai/compose.yml @@ -44,7 +44,12 @@ services: - API_SERVER_HOST=0.0.0.0 - API_SERVER_KEY=hermes_local_key - GATEWAY_ALLOW_ALL_USERS=true - - OPENROUTER_API_KEY=${OPENROUTER_API_KEY} + - OPENROUTER_API_KEY=${OPEN...KEY} + # Memory providers — connect to self-hosted services + - OPENVIKING_ENDPOINT=http://openviking:1933 + - OPENVIKING_ACCOUNT=default + - OPENVIKING_USER=default + - OPENVIKING_AGENT=hermes # ROCm for GPU-accelerated faster-whisper STT - HSA_OVERRIDE_GFX_VERSION=9.0.6 - HCC_AMDGPU_TARGET=gfx906 @@ -62,6 +67,9 @@ services: - "26" networks: - ai_backend + depends_on: + - openviking + - honcho ollama: build: @@ -96,6 +104,84 @@ services: - "303" - "26" + # --- OpenViking: knowledge graph memory --- + openviking: + image: ghcr.io/volcengine/openviking:latest + container_name: openviking + restart: unless-stopped + ports: + - "127.0.0.1:1933:1933" + volumes: + - /mnt/HoardingCow_docker_data/OpenViking/data:/app/.openviking + networks: + - ai_backend + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:1933/health || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 30s + + # --- Honcho: AI-native user modeling --- + honcho: + build: ./honcho + container_name: honcho + restart: unless-stopped + ports: + - "127.0.0.1:8000:8000" + environment: + - DB_CONNECTION_URI=postgresql+psycopg://honcho:honcho_pass@honcho-db:5432/honcho + - CACHE_URL=redis://honcho-redis:6379/0 + - CACHE_ENABLED=true + volumes: + - /mnt/HoardingCow_docker_data/Honcho/data:/app/data + networks: + - ai_backend + depends_on: + honcho-db: + condition: service_healthy + honcho-redis: + condition: service_healthy + + honcho-db: + image: pgvector/pgvector:pg15 + container_name: honcho-db + restart: unless-stopped + ports: + - "127.0.0.1:5432:5432" + command: ["postgres", "-c", "max_connections=200"] + environment: + - POSTGRES_DB=honcho + - POSTGRES_USER=honcho + - POSTGRES_PASSWORD=honcho_pass + - PGDATA=/var/lib/postgresql/data/pgdata + volumes: + - /mnt/HoardingCow_docker_data/Honcho/postgres:/var/lib/postgresql/data + - ./honcho/init-db.sql:/docker-entrypoint-initdb.d/init.sql:ro + networks: + - ai_backend + healthcheck: + test: ["CMD-SHELL", "pg_isready -U honcho -d honcho"] + interval: 5s + timeout: 5s + retries: 5 + + honcho-redis: + image: redis:8 + container_name: honcho-redis + restart: unless-stopped + ports: + - "127.0.0.1:6379:6379" + volumes: + - /mnt/HoardingCow_docker_data/Honcho/redis:/data + networks: + - ai_backend + healthcheck: + test: ["CMD-SHELL", "redis-cli ping"] + interval: 5s + timeout: 5s + retries: 5 + networks: ai_net: external: true @@ -247,8 +333,8 @@ networks: # - /home/gortium/infra:/data/workspace/infra # environment: # - TZ=America/Toronto - # - OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN} - # - OPENROUTER_API_KEY=${OPENROUTER_API_KEY} + # - OPENCLAW_GATEWAY_TOKEN=${OPEN...KEN} + # - OPENROUTER_API_KEY=${OPEN...KEY} # # Point to the sidecar browser # - BROWSER_CDP_URL=http://openclaw-browser:9222 # - BROWSER_EVALUATE_ENABLED=true @@ -293,7 +379,7 @@ networks: # - PGID=1000 # - PUBLIC_KEY_FILE=/config/ssh/authorized_keys # - SUDO_ACCESS=false - # - PASSWORD_ACCESS=false + # - PASSWORD_ACCESS=*** # volumes: # - /mnt/HoardingCow_docker_data/openclaw/ssh-config:/config # - /home/gortium/infra:/data/workspace/infra:ro diff --git a/ai/hermes/Dockerfile b/ai/hermes/Dockerfile index a6edcfc..e44caa1 100644 --- a/ai/hermes/Dockerfile +++ b/ai/hermes/Dockerfile @@ -48,6 +48,14 @@ RUN apt-get update && \ # ---------- UV ---------- COPY --chmod=0755 --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/ +WORKDIR /opt/hermes + +# ---------- Memory provider dependencies ---------- +# httpx: HTTP client for OpenViking plugin +# honcho-ai: already installed in upstream image (v2.1.1+) +RUN . /opt/hermes/.venv/bin/activate && \ + uv pip install --no-cache-dir httpx + # ---------- Piper TTS ---------- RUN . /opt/hermes/.venv/bin/activate && \ uv pip install --no-cache-dir piper-tts sounddevice numpy && \ diff --git a/ai/hermes/config.yaml b/ai/hermes/config.yaml new file mode 100644 index 0000000..da60b2b --- /dev/null +++ b/ai/hermes/config.yaml @@ -0,0 +1,9 @@ +memory: + memory_enabled: true + user_profile_enabled: true + providers: + - holographic + - honcho + - openviking + flush_min_turns: 6 + nudge_interval: 10 diff --git a/ai/hermes/honcho.json b/ai/hermes/honcho.json new file mode 100644 index 0000000..13ddfef --- /dev/null +++ b/ai/hermes/honcho.json @@ -0,0 +1,33 @@ +{ + "enabled": true, + "apiKey": "", + "baseUrl": "http://honcho:8000", + "workspace": "hermes", + "peerName": "thierry", + "contextCadence": 2, + "dialecticCadence": 3, + "dialecticDepth": 2, + "dialecticReasoningLevel": "low", + "dialecticMaxChars": 600, + "recallMode": "hybrid", + "writeFrequency": "async", + "sessionStrategy": "per-directory", + "saveMessages": true, + "hosts": { + "hermes": { + "enabled": true, + "aiPeer": "hermes", + "recallMode": "hybrid", + "observation": { + "user": { "observeMe": true, "observeOthers": true }, + "ai": { "observeMe": true, "observeOthers": true } + }, + "dialecticDepth": 2, + "dialecticReasoningLevel": "low", + "dialecticMaxChars": 600, + "sessionStrategy": "per-directory", + "writeFrequency": "async", + "saveMessages": true + } + } +} diff --git a/ai/honcho/Dockerfile b/ai/honcho/Dockerfile new file mode 100644 index 0000000..feddec6 --- /dev/null +++ b/ai/honcho/Dockerfile @@ -0,0 +1,42 @@ +# build stage — fetches and builds Honcho from source +# Using buildkit cache mounts for speed across rebuilds +FROM python:3.13-slim-bookworm AS builder + +RUN apt-get update && \ + apt-get install -y --no-install-recommends git && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=ghcr.io/astral-sh/uv:0.9.24 /uv /bin/uv + +# Clone Honcho at a pinned commit for reproducibility +ARG HONCHO_REPO=https://github.com/plastic-labs/honcho +ARG HONCHO_REF=main +RUN git clone --depth 1 --branch ${HONCHO_REF} ${HONCHO_REPO} /app + +WORKDIR /app + +ENV UV_COMPILE_BYTECODE=1 +ENV UV_LINK_MODE=copy + +RUN --mount=type=cache,target=/root/.cache/uv \ + uv sync --frozen --no-group dev + +# --- runtime stage --- +FROM python:3.13-slim-bookworm + +RUN groupadd --system app && \ + useradd --system --gid app --create-home app + +COPY --from=builder /app /app +COPY --from=builder /root/.cache/uv /root/.cache/uv + +WORKDIR /app +ENV PATH="/app/.venv/bin:$PATH" +ENV HOME=/app + +COPY --chown=app:app config.toml /app/config.toml + +USER app +EXPOSE 8000 + +CMD ["fastapi", "run", "--host", "0.0.0.0", "src/main.py"] diff --git a/ai/honcho/config.toml b/ai/honcho/config.toml new file mode 100644 index 0000000..0578f57 --- /dev/null +++ b/ai/honcho/config.toml @@ -0,0 +1,117 @@ +[app] +LOG_LEVEL = "INFO" +MAX_MESSAGE_SIZE = 25000 +EMBED_MESSAGES = true +NAMESPACE = "honcho" + +[db] +CONNECTION_URI = "postgresql+psycopg://honcho:honcho_pass@honcho-db:5432/honcho" +SCHEMA = "public" +POOL_SIZE = 10 +MAX_OVERFLOW = 20 + +[auth] +USE_AUTH = false + +[sentry] +ENABLED = false + +[telemetry] +ENABLED = false + +[webhook] +ENABLED = false + +[cache] +ENABLED = true +URL = "redis://honcho-redis:6379/0" + +[llm] +DEFAULT_MAX_TOKENS = 4096 + +# Embeddings via Ollama (nomic-embed-text recommended on this system) +[embedding] +VECTOR_DIMENSIONS = 768 +MAX_INPUT_TOKENS = 8192 + +[embedding.model_config] +transport = "openai" +model = "nomic-embed-text" +base_url = "http://ollama:11434/v1" + +# --- Deriver (user representation builder) --- +[deriver] +ENABLED = true +WORKERS = 1 +POLLING_SLEEP_INTERVAL_SECONDS = 5.0 +FLUSH_ENABLED = true + +[deriver.model_config] +transport = "openai" +model = "hermes-3" +base_url = "http://ollama:11434/v1" + +# --- Dialectic --- +[dialectic] +MAX_INPUT_TOKENS = 4096 +SESSION_HISTORY_MAX_TOKENS = 8192 + +[dialectic.levels.minimal] +MAX_TOOL_ITERATIONS = 1 +MAX_OUTPUT_TOKENS = 512 +[dialectic.levels.minimal.model_config] +transport = "openai" +model = "hermes-3" +base_url = "http://ollama:11434/v1" + +[dialectic.levels.low] +MAX_TOOL_ITERATIONS = 3 +[dialectic.levels.low.model_config] +transport = "openai" +model = "hermes-3" +base_url = "http://ollama:11434/v1" + +[dialectic.levels.medium] +MAX_TOOL_ITERATIONS = 2 +[dialectic.levels.medium.model_config] +transport = "openai" +model = "hermes-3" +base_url = "http://ollama:11434/v1" + +[dialectic.levels.high] +MAX_TOOL_ITERATIONS = 4 +[dialectic.levels.high.model_config] +transport = "openai" +model = "hermes-3" +base_url = "http://ollama:11434/v1" + +[dialectic.levels.max] +MAX_TOOL_ITERATIONS = 10 +[dialectic.levels.max.model_config] +transport = "openai" +model = "hermes-3" +base_url = "http://ollama:11434/v1" + +# --- Summary --- +[summary] +ENABLED = true +MESSAGES_PER_SHORT_SUMMARY = 20 +MESSAGES_PER_LONG_SUMMARY = 60 + +[summary.model_config] +transport = "openai" +model = "hermes-3" +base_url = "http://ollama:11434/v1" + +# --- Dream --- +[dream] +ENABLED = false + +# --- Peer Card --- +[peer_card] +ENABLED = true + +# --- Vector Store --- +[vector_store] +TYPE = "pgvector" +DIMENSIONS = 768 diff --git a/ai/honcho/init-db.sql b/ai/honcho/init-db.sql new file mode 100644 index 0000000..0aa0fc2 --- /dev/null +++ b/ai/honcho/init-db.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS vector; -- 2.49.1 From e3f47cac6b58cffe8ab655f8ef9a905c6e896f68 Mon Sep 17 00:00:00 2001 From: Hermes Date: Wed, 20 May 2026 23:37:44 -0400 Subject: [PATCH 2/6] feat: keep only Honcho, remove OpenViking from memory providers --- ai/.env.example | 3 --- ai/compose.yml | 24 ------------------------ ai/hermes/config.yaml | 2 -- 3 files changed, 29 deletions(-) diff --git a/ai/.env.example b/ai/.env.example index 2934c21..47dee46 100644 --- a/ai/.env.example +++ b/ai/.env.example @@ -3,6 +3,3 @@ # Required: OpenRouter API key for Hermes agent OPENROUTER_API_KEY=sk-or-v1-your-key-here - -# Memory providers (internal Docker network — usually no changes needed) -OPENVIKING_ENDPOINT=http://openviking:1933 diff --git a/ai/compose.yml b/ai/compose.yml index e6c6ffa..39807f4 100755 --- a/ai/compose.yml +++ b/ai/compose.yml @@ -43,11 +43,6 @@ services: - API_SERVER_KEY=hermes_local_key - GATEWAY_ALLOW_ALL_USERS=true - OPENROUTER_API_KEY=${OPEN...KEY} - # Memory providers — connect to self-hosted services - - OPENVIKING_ENDPOINT=http://openviking:1933 - - OPENVIKING_ACCOUNT=default - - OPENVIKING_USER=default - - OPENVIKING_AGENT=hermes # ROCm for GPU-accelerated faster-whisper STT - HSA_OVERRIDE_GFX_VERSION=9.0.6 - HCC_AMDGPU_TARGET=gfx906 @@ -72,7 +67,6 @@ services: networks: - ai_backend depends_on: - - openviking - honcho syncthing: @@ -137,24 +131,6 @@ services: - "303" - "26" - # --- OpenViking: knowledge graph memory --- - openviking: - image: ghcr.io/volcengine/openviking:latest - container_name: openviking - restart: unless-stopped - ports: - - "127.0.0.1:1933:1933" - volumes: - - /mnt/HoardingCow_docker_data/OpenViking/data:/app/.openviking - networks: - - ai_backend - healthcheck: - test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:1933/health || exit 1"] - interval: 30s - timeout: 5s - retries: 3 - start_period: 30s - # --- Honcho: AI-native user modeling --- honcho: build: ./honcho diff --git a/ai/hermes/config.yaml b/ai/hermes/config.yaml index da60b2b..9dbef45 100644 --- a/ai/hermes/config.yaml +++ b/ai/hermes/config.yaml @@ -2,8 +2,6 @@ memory: memory_enabled: true user_profile_enabled: true providers: - - holographic - honcho - - openviking flush_min_turns: 6 nudge_interval: 10 -- 2.49.1 From 8ce9f7189f6c4cfa72d4b836b30999b97df6dc1b Mon Sep 17 00:00:00 2001 From: Hermes Date: Wed, 20 May 2026 23:38:05 -0400 Subject: [PATCH 3/6] chore: remove .env.example --- ai/.env.example | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 ai/.env.example diff --git a/ai/.env.example b/ai/.env.example deleted file mode 100644 index 47dee46..0000000 --- a/ai/.env.example +++ /dev/null @@ -1,5 +0,0 @@ -# AI Stack Environment Variables -# Copy to .env and set your values - -# Required: OpenRouter API key for Hermes agent -OPENROUTER_API_KEY=sk-or-v1-your-key-here -- 2.49.1 From 802c71cf4eb51ecddafaf8ad78d05cd56f734b87 Mon Sep 17 00:00:00 2001 From: Hermes Date: Wed, 20 May 2026 23:45:32 -0400 Subject: [PATCH 4/6] =?UTF-8?q?chore:=20remove=20Hermes=20config=20files?= =?UTF-8?q?=20from=20repo=20=E2=80=94=20lives=20on=20persistent=20volume?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ai/hermes/config.yaml | 7 ------- ai/hermes/honcho.json | 33 --------------------------------- 2 files changed, 40 deletions(-) delete mode 100644 ai/hermes/config.yaml delete mode 100644 ai/hermes/honcho.json diff --git a/ai/hermes/config.yaml b/ai/hermes/config.yaml deleted file mode 100644 index 9dbef45..0000000 --- a/ai/hermes/config.yaml +++ /dev/null @@ -1,7 +0,0 @@ -memory: - memory_enabled: true - user_profile_enabled: true - providers: - - honcho - flush_min_turns: 6 - nudge_interval: 10 diff --git a/ai/hermes/honcho.json b/ai/hermes/honcho.json deleted file mode 100644 index 13ddfef..0000000 --- a/ai/hermes/honcho.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "enabled": true, - "apiKey": "", - "baseUrl": "http://honcho:8000", - "workspace": "hermes", - "peerName": "thierry", - "contextCadence": 2, - "dialecticCadence": 3, - "dialecticDepth": 2, - "dialecticReasoningLevel": "low", - "dialecticMaxChars": 600, - "recallMode": "hybrid", - "writeFrequency": "async", - "sessionStrategy": "per-directory", - "saveMessages": true, - "hosts": { - "hermes": { - "enabled": true, - "aiPeer": "hermes", - "recallMode": "hybrid", - "observation": { - "user": { "observeMe": true, "observeOthers": true }, - "ai": { "observeMe": true, "observeOthers": true } - }, - "dialecticDepth": 2, - "dialecticReasoningLevel": "low", - "dialecticMaxChars": 600, - "sessionStrategy": "per-directory", - "writeFrequency": "async", - "saveMessages": true - } - } -} -- 2.49.1 From 3596ac5219b93d8cb0fe8996f777d5559bda88c7 Mon Sep 17 00:00:00 2001 From: Hermes Date: Thu, 21 May 2026 00:27:01 -0400 Subject: [PATCH 5/6] fix: restore command: gateway run and OPENROUTER_API_KEY variable --- ai/compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ai/compose.yml b/ai/compose.yml index 39807f4..8b81837 100755 --- a/ai/compose.yml +++ b/ai/compose.yml @@ -35,6 +35,8 @@ services: "bash /opt/data/hermes-tools/install.sh && . /opt/hermes/.venv/bin/activate && uv pip install openai 'mautrix[encryption]' -q && exec /usr/bin/tini -g -- /opt/hermes/docker/entrypoint.sh \"$@\"", "hermes-entrypoint"] restart: always + # Gateway run enables the internal API server on port 8642 + command: gateway run environment: - OLLAMA_HOST=http://ollama:11434 - API_SERVER_ENABLED=true -- 2.49.1 From d47d230c25ef6a9683b00a68a6a800ed79d6a9cd Mon Sep 17 00:00:00 2001 From: Hermes Date: Thu, 21 May 2026 00:29:16 -0400 Subject: [PATCH 6/6] fix: restore corrupted variable names (${OPENROUTER_API_KEY}, ${OPENCLAW_GATEWAY_TOKEN}) --- ai/compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ai/compose.yml b/ai/compose.yml index 8b81837..fceea5b 100755 --- a/ai/compose.yml +++ b/ai/compose.yml @@ -44,7 +44,7 @@ services: - API_SERVER_HOST=0.0.0.0 - API_SERVER_KEY=hermes_local_key - GATEWAY_ALLOW_ALL_USERS=true - - OPENROUTER_API_KEY=${OPEN...KEY} + - OPENROUTER_API_KEY=${OPENROUTER_API_KEY} # ROCm for GPU-accelerated faster-whisper STT - HSA_OVERRIDE_GFX_VERSION=9.0.6 - HCC_AMDGPU_TARGET=gfx906 @@ -344,8 +344,8 @@ networks: # - /home/gortium/infra:/data/workspace/infra # environment: # - TZ=America/Toronto - # - OPENCLAW_GATEWAY_TOKEN=${OPEN...KEN} - # - OPENROUTER_API_KEY=${OPEN...KEY} + # - OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN} + # - OPENROUTER_API_KEY=${OPENROUTER_API_KEY} # # Point to the sidecar browser # - BROWSER_CDP_URL=http://openclaw-browser:9222 # - BROWSER_EVALUATE_ENABLED=true @@ -390,7 +390,7 @@ networks: # - PGID=1000 # - PUBLIC_KEY_FILE=/config/ssh/authorized_keys # - SUDO_ACCESS=false - # - PASSWORD_ACCESS=*** + # - PASSWORD_ACCESS=false # volumes: # - /mnt/HoardingCow_docker_data/openclaw/ssh-config:/config # - /home/gortium/infra:/data/workspace/infra:ro -- 2.49.1