Context
The Kubeflow notebook image (docker/kubeflow/Dockerfile) uses s6-overlay for process supervision, running the OpenCode API server and the UI server as managed services. The session ingestion watcher (#241) needs to run alongside these as an additional s6 service so that sessions are automatically ingested into the memory system when running in Kubeflow.
This is optional for local development (where the watcher can run manually), but required for the Kubeflow deployment to ensure automatic memory ingestion without user intervention.
Goal
Add the session ingestion watcher as an s6 supervised service in the Kubeflow Docker image, so it starts automatically alongside OpenCode and the UI server.
Requirements
s6 Service Configuration
- Create an s6 service definition for the watcher
- The watcher must start after the OpenCode API server is healthy (depends on
start-server.sh completing its health check)
- Configure restart behavior (restart on crash, with backoff)
- Log output to stdout (s6 captures it)
Dockerfile Changes
- Copy watcher code into the image
- Install watcher dependencies (if any beyond Bun builtins)
- Add s6 service directory
Environment Variable Configuration
GRAPHITI_API_URL — URL of the Graphiti server (no default — memory is opt-in)
GRAPHITI_GROUP_ID — override group ID (default: derived from project directory)
MEMORY_ENABLED — enable/disable the watcher (default: false, only runs if Graphiti URL is set)
- The watcher should gracefully exit if
GRAPHITI_API_URL is not set (memory is opt-in)
Startup Script
- Wait for OpenCode API server to be healthy before starting the watcher
- Auto-detect the project directory from OpenCode's
worktree config or $HOME
- Connect to local OpenCode API at
http://127.0.0.1:4096
Files to create/modify
docker/kubeflow/s6/services.d/memory-watcher/run — s6 service run script
docker/kubeflow/Dockerfile — add watcher code and s6 service
docker/kubeflow/start-memory-watcher.sh — startup script with health check wait and env validation
Reference
Acceptance Criteria
Context
The Kubeflow notebook image (
docker/kubeflow/Dockerfile) uses s6-overlay for process supervision, running the OpenCode API server and the UI server as managed services. The session ingestion watcher (#241) needs to run alongside these as an additional s6 service so that sessions are automatically ingested into the memory system when running in Kubeflow.This is optional for local development (where the watcher can run manually), but required for the Kubeflow deployment to ensure automatic memory ingestion without user intervention.
Goal
Add the session ingestion watcher as an s6 supervised service in the Kubeflow Docker image, so it starts automatically alongside OpenCode and the UI server.
Requirements
s6 Service Configuration
start-server.shcompleting its health check)Dockerfile Changes
Environment Variable Configuration
GRAPHITI_API_URL— URL of the Graphiti server (no default — memory is opt-in)GRAPHITI_GROUP_ID— override group ID (default: derived from project directory)MEMORY_ENABLED— enable/disable the watcher (default:false, only runs if Graphiti URL is set)GRAPHITI_API_URLis not set (memory is opt-in)Startup Script
worktreeconfig or$HOMEhttp://127.0.0.1:4096Files to create/modify
docker/kubeflow/s6/services.d/memory-watcher/run— s6 service run scriptdocker/kubeflow/Dockerfile— add watcher code and s6 servicedocker/kubeflow/start-memory-watcher.sh— startup script with health check wait and env validationReference
docker/kubeflow/s6/services.d/opencode/run→start-server.shdocker/kubeflow/start-server.shwaits for/healthendpoint127.0.0.1:4096inside the containermemory/watcher/(from Build background session ingestion watcher #241)Acceptance Criteria
GRAPHITI_API_URLis setGRAPHITI_API_URLis not set (opt-in behavior)